@pix3/cli 1.6.0
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/LICENSE +201 -0
- package/README.md +754 -0
- package/dist/index.js +494 -0
- package/dist/runtime-types.json +1 -0
- package/dist/smoke/prebuilt/build-7MIXIMSZ.mjs +948 -0
- package/dist/smoke/prebuilt/chunk-J2SJVMDO.mjs +2 -0
- package/dist/smoke/prebuilt/chunk-OJXQXIIQ.mjs +239 -0
- package/dist/smoke/prebuilt/chunk-P2CBRXPJ.mjs +4050 -0
- package/dist/smoke/prebuilt/runtime.mjs +2 -0
- package/dist/smoke/prebuilt/smoke-worker.mjs +3 -0
- package/dist/smoke/prebuilt/three.mjs +2 -0
- package/dist/smoke/prebuilt/tree-defaults.mjs +2 -0
- package/dist/validate/prebuilt/build-AUGKXER3.js +948 -0
- package/dist/validate/prebuilt/bundle-main.js +24 -0
- package/dist/validate/prebuilt/chunk-6ACT6FNV.js +4050 -0
- package/dist/validate/prebuilt/chunk-BS2OZM7U.js +239 -0
- package/dist/validate/prebuilt/runtime.js +2 -0
- package/dist/validate/prebuilt/three.js +2 -0
- package/kit/files/.claude/skills/pix3-nodes/SKILL.md +210 -0
- package/kit/files/.claude/skills/pix3-nodes/reference.md +1331 -0
- package/kit/files/.claude/skills/pix3-scene-format/SKILL.md +235 -0
- package/kit/files/.claude/skills/pix3-scene-format/reference.md +176 -0
- package/kit/files/.claude/skills/pix3-scripts/SKILL.md +281 -0
- package/kit/files/.claude/skills/pix3-scripts/reference.md +638 -0
- package/kit/files/.claude/skills/pix3-verify/SKILL.md +386 -0
- package/kit/files/.claude/skills/pix3-verify/reference.md +21 -0
- package/kit/files/AGENTS.md +203 -0
- package/kit/files/CLAUDE.md +1 -0
- package/kit/kit.json +24 -0
- package/package.json +54 -0
- package/templates/empty-2d/files/README.md +20 -0
- package/templates/empty-2d/files/scenes/main.pix3scene +68 -0
- package/templates/empty-2d/files/sprites/pix3-logo.png +0 -0
- package/templates/empty-2d/template.yaml +7 -0
- package/templates/empty-3d/files/README.md +20 -0
- package/templates/empty-3d/files/scenes/main.pix3scene +108 -0
- package/templates/empty-3d/files/sprites/pix3-logo.png +0 -0
- package/templates/empty-3d/template.yaml +7 -0
- package/templates/idea-blank/files/README.md +22 -0
- package/templates/idea-blank/files/scenes/main.pix3scene +37 -0
- package/templates/idea-blank/template.yaml +10 -0
- package/templates/minigame-2d/files/README.md +44 -0
- package/templates/minigame-2d/files/design/tests/reachability.json +1 -0
- package/templates/minigame-2d/files/design/tests/routines/mute-music.json +44 -0
- package/templates/minigame-2d/files/scenes/main.pix3scene +84 -0
- package/templates/minigame-2d/files/scenes/menu.pix3scene +118 -0
- package/templates/minigame-2d/files/scenes/ui/settings-window.pix3scene +138 -0
- package/templates/minigame-2d/files/scripts/GameFlow.ts +133 -0
- package/templates/minigame-2d/files/scripts/MenuFlow.ts +217 -0
- package/templates/minigame-2d/files/scripts/SettingsWindow.ts +198 -0
- package/templates/minigame-2d/template.yaml +10 -0
- package/templates/playable-2d/files/README.md +30 -0
- package/templates/playable-2d/files/design/recipe.md +83 -0
- package/templates/playable-2d/files/design/tests/reachability.json +4 -0
- package/templates/playable-2d/files/design/tests/routines/intro-to-cta.json +32 -0
- package/templates/playable-2d/files/scenes/main.pix3scene +111 -0
- package/templates/playable-2d/files/scenes/ui/end-screen.pix3scene +91 -0
- package/templates/playable-2d/files/scenes/ui/intro.pix3scene +65 -0
- package/templates/playable-2d/files/scripts/CtaButton.ts +55 -0
- package/templates/playable-2d/files/scripts/GameFlow.ts +256 -0
- package/templates/playable-2d/files/sprites/pix3-logo.png +0 -0
- package/templates/playable-2d/template.yaml +9 -0
- package/templates/playable-3d/files/README.md +32 -0
- package/templates/playable-3d/files/design/recipe.md +127 -0
- package/templates/playable-3d/files/design/tests/reachability.json +4 -0
- package/templates/playable-3d/files/design/tests/routines/intro-to-cta.json +32 -0
- package/templates/playable-3d/files/scenes/main.pix3scene +230 -0
- package/templates/playable-3d/files/scenes/ui/end-screen.pix3scene +91 -0
- package/templates/playable-3d/files/scenes/ui/intro.pix3scene +65 -0
- package/templates/playable-3d/files/scripts/CtaButton.ts +55 -0
- package/templates/playable-3d/files/scripts/GameFlow.ts +309 -0
- package/templates/playable-3d/files/scripts/GameRules.ts +290 -0
- package/templates/playable-3d/files/scripts/ScoreHud.ts +113 -0
- package/templates/playable-3d/template.yaml +9 -0
- package/templates/recipe-arena-2d/files/README.md +48 -0
- package/templates/recipe-arena-2d/files/design/recipe.md +127 -0
- package/templates/recipe-arena-2d/files/design/tests/reachability.json +4 -0
- package/templates/recipe-arena-2d/files/design/tests/routines/terminal-retry.json +23 -0
- package/templates/recipe-arena-2d/files/scenes/main.pix3scene +292 -0
- package/templates/recipe-arena-2d/files/scenes/menu.pix3scene +100 -0
- package/templates/recipe-arena-2d/files/scenes/prefabs/hazard.pix3scene +42 -0
- package/templates/recipe-arena-2d/files/scenes/prefabs/pickup.pix3scene +45 -0
- package/templates/recipe-arena-2d/files/scenes/ui/result.pix3scene +85 -0
- package/templates/recipe-arena-2d/files/scripts/GameRules.ts +368 -0
- package/templates/recipe-arena-2d/files/scripts/MenuFlow.ts +106 -0
- package/templates/recipe-arena-2d/files/scripts/PlayerController.ts +151 -0
- package/templates/recipe-arena-2d/files/scripts/ScoreHud.ts +94 -0
- package/templates/recipe-arena-2d/files/scripts/Spawner.ts +214 -0
- package/templates/recipe-arena-2d/files/scripts/TouchRules.ts +174 -0
- package/templates/recipe-arena-2d/files/sprites/ph-avatar.png +0 -0
- package/templates/recipe-arena-2d/files/sprites/ph-hazard.png +0 -0
- package/templates/recipe-arena-2d/files/sprites/ph-pickup.png +0 -0
- package/templates/recipe-arena-2d/template.yaml +10 -0
- package/templates/recipe-blank-2d/files/README.md +61 -0
- package/templates/recipe-blank-2d/files/design/recipe.md +148 -0
- package/templates/recipe-blank-2d/files/design/tests/reachability.json +4 -0
- package/templates/recipe-blank-2d/files/design/tests/routines/restart.json +27 -0
- package/templates/recipe-blank-2d/files/design/tests/routines/terminal-retry.json +23 -0
- package/templates/recipe-blank-2d/files/scenes/main.pix3scene +224 -0
- package/templates/recipe-blank-2d/files/scenes/ui/result.pix3scene +85 -0
- package/templates/recipe-blank-2d/files/scripts/GameRules.ts +350 -0
- package/templates/recipe-blank-2d/files/scripts/ScoreHud.ts +110 -0
- package/templates/recipe-blank-2d/files/sprites/ph-bg.png +0 -0
- package/templates/recipe-blank-2d/files/sprites/ph-capsule.png +0 -0
- package/templates/recipe-blank-2d/files/sprites/ph-circle.png +0 -0
- package/templates/recipe-blank-2d/files/sprites/ph-orb.png +0 -0
- package/templates/recipe-blank-2d/files/sprites/ph-ring.png +0 -0
- package/templates/recipe-blank-2d/files/sprites/ph-star.png +0 -0
- package/templates/recipe-blank-2d/template.yaml +10 -0
- package/templates/recipe-bouncer-2d/files/README.md +81 -0
- package/templates/recipe-bouncer-2d/files/design/recipe.md +146 -0
- package/templates/recipe-bouncer-2d/files/design/tests/reachability.json +4 -0
- package/templates/recipe-bouncer-2d/files/design/tests/routines/terminal-retry.json +23 -0
- package/templates/recipe-bouncer-2d/files/scenes/main.pix3scene +615 -0
- package/templates/recipe-bouncer-2d/files/scenes/menu.pix3scene +191 -0
- package/templates/recipe-bouncer-2d/files/scenes/ui/result.pix3scene +87 -0
- package/templates/recipe-bouncer-2d/files/scripts/BallBody.ts +298 -0
- package/templates/recipe-bouncer-2d/files/scripts/GameRules.ts +377 -0
- package/templates/recipe-bouncer-2d/files/scripts/MenuFlow.ts +109 -0
- package/templates/recipe-bouncer-2d/files/scripts/PaddleController.ts +112 -0
- package/templates/recipe-bouncer-2d/files/scripts/ScoreHud.ts +94 -0
- package/templates/recipe-bouncer-2d/files/scripts/TouchRules.ts +263 -0
- package/templates/recipe-bouncer-2d/files/scripts/ball-collision.ts +307 -0
- package/templates/recipe-bouncer-2d/files/sprites/ph-ball.png +0 -0
- package/templates/recipe-bouncer-2d/files/sprites/ph-bg.png +0 -0
- package/templates/recipe-bouncer-2d/files/sprites/ph-bumper.png +0 -0
- package/templates/recipe-bouncer-2d/files/sprites/ph-paddle.png +0 -0
- package/templates/recipe-bouncer-2d/template.yaml +10 -0
- package/templates/recipe-grid-3d/files/README.md +22 -0
- package/templates/recipe-grid-3d/files/design/recipe.md +110 -0
- package/templates/recipe-grid-3d/files/scenes/main.pix3scene +169 -0
- package/templates/recipe-grid-3d/files/scenes/menu.pix3scene +100 -0
- package/templates/recipe-grid-3d/files/scenes/ui/result.pix3scene +105 -0
- package/templates/recipe-grid-3d/files/scripts/GridBoard.ts +319 -0
- package/templates/recipe-grid-3d/files/scripts/GridRules.ts +278 -0
- package/templates/recipe-grid-3d/files/scripts/MenuFlow.ts +106 -0
- package/templates/recipe-grid-3d/files/scripts/ScoreHud.ts +94 -0
- package/templates/recipe-grid-3d/template.yaml +10 -0
- package/templates/recipe-tapper-2d/files/README.md +39 -0
- package/templates/recipe-tapper-2d/files/design/recipe.md +132 -0
- package/templates/recipe-tapper-2d/files/design/tests/reachability.json +4 -0
- package/templates/recipe-tapper-2d/files/design/tests/routines/terminal-retry.json +23 -0
- package/templates/recipe-tapper-2d/files/scenes/main.pix3scene +269 -0
- package/templates/recipe-tapper-2d/files/scenes/menu.pix3scene +100 -0
- package/templates/recipe-tapper-2d/files/scenes/prefabs/hazard.pix3scene +42 -0
- package/templates/recipe-tapper-2d/files/scenes/prefabs/target.pix3scene +45 -0
- package/templates/recipe-tapper-2d/files/scenes/ui/result.pix3scene +85 -0
- package/templates/recipe-tapper-2d/files/scripts/GameRules.ts +368 -0
- package/templates/recipe-tapper-2d/files/scripts/MenuFlow.ts +106 -0
- package/templates/recipe-tapper-2d/files/scripts/ScoreHud.ts +94 -0
- package/templates/recipe-tapper-2d/files/scripts/Spawner.ts +214 -0
- package/templates/recipe-tapper-2d/files/scripts/TouchRules.ts +192 -0
- package/templates/recipe-tapper-2d/files/sprites/ph-hazard.png +0 -0
- package/templates/recipe-tapper-2d/files/sprites/ph-target.png +0 -0
- package/templates/recipe-tapper-2d/template.yaml +10 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __pix3CreateRequire } from 'node:module'; const require = __pix3CreateRequire(import.meta.url);
|
|
3
|
+
var GU=Object.create;var lg=Object.defineProperty;var YU=Object.getOwnPropertyDescriptor;var XU=Object.getOwnPropertyNames;var QU=Object.getPrototypeOf,eV=Object.prototype.hasOwnProperty;var ze=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),We=(t,e)=>{for(var r in e)lg(t,r,{get:e[r],enumerable:!0})},tV=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of XU(e))!eV.call(t,s)&&s!==r&&lg(t,s,{get:()=>e[s],enumerable:!(n=YU(e,s))||n.enumerable});return t};var Fe=(t,e,r)=>(r=t!=null?GU(QU(t)):{},tV(e||!t||!t.__esModule?lg(r,"default",{value:t,enumerable:!0}):r,t));var pe=_(ct=>{"use strict";var ug=Symbol.for("yaml.alias"),ZE=Symbol.for("yaml.document"),pd=Symbol.for("yaml.map"),UE=Symbol.for("yaml.pair"),dg=Symbol.for("yaml.scalar"),hd=Symbol.for("yaml.seq"),hn=Symbol.for("yaml.node.type"),rV=t=>!!t&&typeof t=="object"&&t[hn]===ug,nV=t=>!!t&&typeof t=="object"&&t[hn]===ZE,sV=t=>!!t&&typeof t=="object"&&t[hn]===pd,oV=t=>!!t&&typeof t=="object"&&t[hn]===UE,VE=t=>!!t&&typeof t=="object"&&t[hn]===dg,iV=t=>!!t&&typeof t=="object"&&t[hn]===hd;function BE(t){if(t&&typeof t=="object")switch(t[hn]){case pd:case hd:return!0}return!1}function aV(t){if(t&&typeof t=="object")switch(t[hn]){case ug:case pd:case dg:case hd:return!0}return!1}var cV=t=>(VE(t)||BE(t))&&!!t.anchor;ct.ALIAS=ug;ct.DOC=ZE;ct.MAP=pd;ct.NODE_TYPE=hn;ct.PAIR=UE;ct.SCALAR=dg;ct.SEQ=hd;ct.hasAnchor=cV;ct.isAlias=rV;ct.isCollection=BE;ct.isDocument=nV;ct.isMap=sV;ct.isNode=aV;ct.isPair=oV;ct.isScalar=VE;ct.isSeq=iV});var La=_(fg=>{"use strict";var et=pe(),It=Symbol("break visit"),KE=Symbol("skip children"),Br=Symbol("remove node");function md(t,e){let r=HE(e);et.isDocument(t)?Lo(null,t.contents,r,Object.freeze([t]))===Br&&(t.contents=null):Lo(null,t,r,Object.freeze([]))}md.BREAK=It;md.SKIP=KE;md.REMOVE=Br;function Lo(t,e,r,n){let s=WE(t,e,r,n);if(et.isNode(s)||et.isPair(s))return JE(t,n,s),Lo(t,s,r,n);if(typeof s!="symbol"){if(et.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=Lo(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===It)return It;i===Br&&(e.items.splice(o,1),o-=1)}}}else if(et.isPair(e)){n=Object.freeze(n.concat(e));let o=Lo("key",e.key,r,n);if(o===It)return It;o===Br&&(e.key=null);let i=Lo("value",e.value,r,n);if(i===It)return It;i===Br&&(e.value=null)}}return s}async function gd(t,e){let r=HE(e);et.isDocument(t)?await Do(null,t.contents,r,Object.freeze([t]))===Br&&(t.contents=null):await Do(null,t,r,Object.freeze([]))}gd.BREAK=It;gd.SKIP=KE;gd.REMOVE=Br;async function Do(t,e,r,n){let s=await WE(t,e,r,n);if(et.isNode(s)||et.isPair(s))return JE(t,n,s),Do(t,s,r,n);if(typeof s!="symbol"){if(et.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=await Do(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===It)return It;i===Br&&(e.items.splice(o,1),o-=1)}}}else if(et.isPair(e)){n=Object.freeze(n.concat(e));let o=await Do("key",e.key,r,n);if(o===It)return It;o===Br&&(e.key=null);let i=await Do("value",e.value,r,n);if(i===It)return It;i===Br&&(e.value=null)}}return s}function HE(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function WE(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(et.isMap(e))return r.Map?.(t,e,n);if(et.isSeq(e))return r.Seq?.(t,e,n);if(et.isPair(e))return r.Pair?.(t,e,n);if(et.isScalar(e))return r.Scalar?.(t,e,n);if(et.isAlias(e))return r.Alias?.(t,e,n)}function JE(t,e,r){let n=e[e.length-1];if(et.isCollection(n))n.items[t]=r;else if(et.isPair(n))t==="key"?n.key=r:n.value=r;else if(et.isDocument(n))n.contents=r;else{let s=et.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}fg.visit=md;fg.visitAsync=gd});var pg=_(YE=>{"use strict";var GE=pe(),lV=La(),uV={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dV=t=>t.replace(/[!,[\]{}]/g,e=>uV[e]),Da=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),s=n.shift();switch(s){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,i]=n;return this.tags[o]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let i=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,i),!1}}default:return r(0,`Unknown directive ${s}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);return i==="!"||i==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),i)}let[,n,s]=e.match(/^(.*!)([^!]*)$/s);s||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(s)}catch(i){return r(String(i)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+dV(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),s;if(e&&n.length>0&&GE.isNode(e.contents)){let o={};lV.visit(e.contents,(i,a)=>{GE.isNode(a)&&a.tag&&(o[a.tag]=!0)}),s=Object.keys(o)}else s=[];for(let[o,i]of n)o==="!!"&&i==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(i)))&&r.push(`%TAG ${o} ${i}`);return r.join(`
|
|
4
|
+
`)}};Da.defaultYaml={explicit:!1,version:"1.2"};Da.defaultTags={"!!":"tag:yaml.org,2002:"};YE.Directives=Da});var yd=_(qa=>{"use strict";var XE=pe(),fV=La();function pV(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function QE(t){let e=new Set;return fV.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function eT(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function hV(t,e){let r=[],n=new Map,s=null;return{onAnchor:o=>{r.push(o),s??(s=QE(t));let i=eT(e,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i=="object"&&i.anchor&&(XE.isScalar(i.node)||XE.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}qa.anchorIsValid=pV;qa.anchorNames=QE;qa.createNodeAnchors=hV;qa.findNewAnchor=eT});var hg=_(tT=>{"use strict";function Fa(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let s=0,o=n.length;s<o;++s){let i=n[s],a=Fa(t,n,String(s),i);a===void 0?delete n[s]:a!==i&&(n[s]=a)}else if(n instanceof Map)for(let s of Array.from(n.keys())){let o=n.get(s),i=Fa(t,n,s,o);i===void 0?n.delete(s):i!==o&&n.set(s,i)}else if(n instanceof Set)for(let s of Array.from(n)){let o=Fa(t,n,s,s);o===void 0?n.delete(s):o!==s&&(n.delete(s),n.add(o))}else for(let[s,o]of Object.entries(n)){let i=Fa(t,n,s,o);i===void 0?delete n[s]:i!==o&&(n[s]=i)}return t.call(e,r,n)}tT.applyReviver=Fa});var Vn=_(nT=>{"use strict";var mV=pe();function rT(t,e,r){if(Array.isArray(t))return t.map((n,s)=>rT(n,String(s),r));if(t&&typeof t.toJSON=="function"){if(!r||!mV.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let s=t.toJSON(e,r);return r.onCreate&&r.onCreate(s),s}return typeof t=="bigint"&&!r?.keep?Number(t):t}nT.toJS=rT});var _d=_(oT=>{"use strict";var gV=hg(),sT=pe(),yV=Vn(),mg=class{constructor(e){Object.defineProperty(this,sT.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:s,reviver:o}={}){if(!sT.isDocument(e))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=yV.toJS(this,"",i);if(typeof s=="function")for(let{count:c,res:l}of i.anchors.values())s(l,c);return typeof o=="function"?gV.applyReviver(o,{"":a},"",a):a}};oT.NodeBase=mg});var Za=_(iT=>{"use strict";var _V=yd(),vV=La(),qo=pe(),wV=_d(),bV=Vn(),gg=class extends wV.NodeBase{constructor(e){super(qo.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],vV.visit(e,{Node:(o,i)=>{(qo.isAlias(i)||qo.hasAnchor(i))&&n.push(i)}}),r&&(r.aliasResolveCache=n));let s;for(let o of n){if(o===this)break;o.anchor===this.source&&(s=o)}return s}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:o}=r,i=this.resolve(s,r);if(!i){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(i);if(a||(bV.toJS(i,null,r),a=n.get(i)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=vd(s,i,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let s=`*${this.source}`;if(e){if(_V.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${s} `}return s}};function vd(t,e,r){if(qo.isAlias(e)){let n=e.resolve(t),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(qo.isCollection(e)){let n=0;for(let s of e.items){let o=vd(t,s,r);o>n&&(n=o)}return n}else if(qo.isPair(e)){let n=vd(t,e.key,r),s=vd(t,e.value,r);return Math.max(n,s)}return 1}iT.Alias=gg});var Ye=_(yg=>{"use strict";var SV=pe(),$V=_d(),kV=Vn(),xV=t=>!t||typeof t!="function"&&typeof t!="object",Bn=class extends $V.NodeBase{constructor(e){super(SV.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:kV.toJS(this.value,e,r)}toString(){return String(this.value)}};Bn.BLOCK_FOLDED="BLOCK_FOLDED";Bn.BLOCK_LITERAL="BLOCK_LITERAL";Bn.PLAIN="PLAIN";Bn.QUOTE_DOUBLE="QUOTE_DOUBLE";Bn.QUOTE_SINGLE="QUOTE_SINGLE";yg.Scalar=Bn;yg.isScalarValue=xV});var Ua=_(cT=>{"use strict";var EV=Za(),zs=pe(),aT=Ye(),TV="tag:yaml.org,2002:";function PV(t,e,r){if(e){let n=r.filter(o=>o.tag===e),s=n.find(o=>!o.format)??n[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return r.find(n=>n.identify?.(t)&&!n.format)}function OV(t,e,r){if(zs.isDocument(t)&&(t=t.contents),zs.isNode(t))return t;if(zs.isPair(t)){let d=r.schema[zs.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:o,schema:i,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=s(t)),new EV.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=TV+e.slice(2));let l=PV(t,e,i.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new aT.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?i[zs.MAP]:Symbol.iterator in Object(t)?i[zs.SEQ]:i[zs.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new aT.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}cT.createNode=OV});var bd=_(wd=>{"use strict";var IV=Ua(),Kr=pe(),NV=_d();function _g(t,e,r){let n=r;for(let s=e.length-1;s>=0;--s){let o=e[s];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let i=[];i[o]=n,n=i}else n=new Map([[o,n]])}return IV.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var lT=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,vg=class extends NV.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>Kr.isNode(n)||Kr.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(lT(e))this.add(r);else{let[n,...s]=e,o=this.get(n,!0);if(Kr.isCollection(o))o.addIn(s,r);else if(o===void 0&&this.schema)this.set(n,_g(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let s=this.get(r,!0);if(Kr.isCollection(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...s]=e,o=this.get(n,!0);return s.length===0?!r&&Kr.isScalar(o)?o.value:o:Kr.isCollection(o)?o.getIn(s,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Kr.isPair(r))return!1;let n=r.value;return n==null||e&&Kr.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let s=this.get(r,!0);return Kr.isCollection(s)?s.hasIn(n):!1}setIn(e,r){let[n,...s]=e;if(s.length===0)this.set(n,r);else{let o=this.get(n,!0);if(Kr.isCollection(o))o.setIn(s,r);else if(o===void 0&&this.schema)this.set(n,_g(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}};wd.Collection=vg;wd.collectionFromPath=_g;wd.isEmptyPath=lT});var Va=_(Sd=>{"use strict";var CV=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function wg(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var RV=(t,e,r)=>t.endsWith(`
|
|
5
|
+
`)?wg(r,e):r.includes(`
|
|
6
|
+
`)?`
|
|
7
|
+
`+wg(r,e):(t.endsWith(" ")?"":" ")+r;Sd.indentComment=wg;Sd.lineComment=RV;Sd.stringifyComment=CV});var dT=_(Ba=>{"use strict";var AV="flow",bg="block",$d="quoted";function zV(t,e,r="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!s||s<0)return t;s<o&&(o=0);let c=Math.max(1+o,1+s-e.length);if(t.length<=c)return t;let l=[],u={},d=s-e.length;typeof n=="number"&&(n>s-Math.max(2,o)?l.push(0):d=s-n);let f,p,m=!1,h=-1,g=-1,y=-1;r===bg&&(h=uT(t,h,e.length),h!==-1&&(d=h+c));for(let b;b=t[h+=1];){if(r===$d&&b==="\\"){switch(g=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(b===`
|
|
8
|
+
`)r===bg&&(h=uT(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(b===" "&&p&&p!==" "&&p!==`
|
|
9
|
+
`&&p!==" "){let x=t[h+1];x&&x!==" "&&x!==`
|
|
10
|
+
`&&x!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===$d){for(;p===" "||p===" ";)p=b,b=t[h+=1],m=!0;let x=h>y+1?h-2:g-1;if(u[x])return t;l.push(x),u[x]=!0,d=x+c,f=void 0}else m=!0}p=b}if(m&&a&&a(),l.length===0)return t;i&&i();let w=t.slice(0,l[0]);for(let b=0;b<l.length;++b){let x=l[b],v=l[b+1]||t.length;x===0?w=`
|
|
11
|
+
${e}${t.slice(0,v)}`:(r===$d&&u[x]&&(w+=`${t[x]}\\`),w+=`
|
|
12
|
+
${e}${t.slice(x+1,v)}`)}return w}function uT(t,e,r){let n=e,s=e+1,o=t[s];for(;o===" "||o===" ";)if(e<s+r)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
13
|
+
`);n=e,s=e+1,o=t[s]}return n}Ba.FOLD_BLOCK=bg;Ba.FOLD_FLOW=AV;Ba.FOLD_QUOTED=$d;Ba.foldFlowLines=zV});var Ha=_(fT=>{"use strict";var Sr=Ye(),Kn=dT(),xd=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ed=t=>/^(%|---|\.\.\.)/m.test(t);function jV(t,e,r){if(!e||e<0)return!1;let n=e-r,s=t.length;if(s<=n)return!1;for(let o=0,i=0;o<s;++o)if(t[o]===`
|
|
14
|
+
`){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function Ka(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,s=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ed(t)?" ":""),i="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(i+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{i+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:u.substr(0,2)==="00"?i+="\\x"+u.substr(2):i+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<s)c+=1;else{for(i+=r.slice(a,c)+`
|
|
15
|
+
|
|
16
|
+
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)i+=`
|
|
17
|
+
`,c+=2;i+=o,r[c+2]===" "&&(i+="\\"),c+=1,a=c+1}break;default:c+=1}return i=a?i+r.slice(a):r,n?i:Kn.foldFlowLines(i,o,Kn.FOLD_QUOTED,xd(e,!1))}function Sg(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Ka(t,e);let r=e.indent||(Ed(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${r}`)+"'";return e.implicitKey?n:Kn.foldFlowLines(n,r,Kn.FOLD_FLOW,xd(e,!1))}function Fo(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=Ka;else{let s=t.includes('"'),o=t.includes("'");s&&!o?n=Sg:o&&!s?n=Ka:n=r?Sg:Ka}return n(t,e)}var $g;try{$g=new RegExp(`(^|(?<!
|
|
20
|
+
))
|
|
21
|
+
+(?!
|
|
22
|
+
|$)`,"g")}catch{$g=/\n+(?!\n|$)/g}function kd({comment:t,type:e,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return Fo(r,n);let l=n.indent||(n.forceBlockIndent||Ed(r)?" ":""),u=i==="literal"?!0:i==="folded"||e===Sr.Scalar.BLOCK_FOLDED?!1:e===Sr.Scalar.BLOCK_LITERAL?!0:!jV(r,c,l.length);if(!r)return u?`|
|
|
23
|
+
`:`>
|
|
24
|
+
`;let d,f;for(f=r.length;f>0;--f){let v=r[f-1];if(v!==`
|
|
25
|
+
`&&v!==" "&&v!==" ")break}let p=r.substring(f),m=p.indexOf(`
|
|
26
|
+
`);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
27
|
+
`&&(p=p.slice(0,-1)),p=p.replace($g,`$&${l}`));let h=!1,g,y=-1;for(g=0;g<r.length;++g){let v=r[g];if(v===" ")h=!0;else if(v===`
|
|
28
|
+
`)y=g;else break}let w=r.substring(0,y<g?y+1:g);w&&(r=r.substring(w.length),w=w.replace(/\n+/g,`$&${l}`));let x=(h?l?"2":"1":"")+d;if(t&&(x+=" "+a(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!u){let v=r.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),S=!1,T=xd(n,!0);i!=="folded"&&e!==Sr.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{S=!0});let I=Kn.foldFlowLines(`${w}${v}${p}`,l,Kn.FOLD_BLOCK,T);if(!S)return`>${x}
|
|
30
|
+
${l}${I}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x}
|
|
31
|
+
${l}${w}${r}${p}`}function MV(t,e,r,n){let{type:s,value:o}=t,{actualString:i,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&o.includes(`
|
|
32
|
+
`)||u&&/[[\]{},]/.test(o))return Fo(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
33
|
+
`)?Fo(o,e):kd(t,e,r,n);if(!a&&!u&&s!==Sr.Scalar.PLAIN&&o.includes(`
|
|
34
|
+
`))return kd(t,e,r,n);if(Ed(o)){if(c==="")return e.forceBlockIndent=!0,kd(t,e,r,n);if(a&&c===l)return Fo(o,e)}let d=o.replace(/\n+/g,`$&
|
|
35
|
+
${c}`);if(i){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Fo(o,e)}return a?d:Kn.foldFlowLines(d,c,Kn.FOLD_FLOW,xd(e,!1))}function LV(t,e,r,n){let{implicitKey:s,inFlow:o}=e,i=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Sr.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=Sr.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Sr.Scalar.BLOCK_FOLDED:case Sr.Scalar.BLOCK_LITERAL:return s||o?Fo(i.value,e):kd(i,e,r,n);case Sr.Scalar.QUOTE_DOUBLE:return Ka(i.value,e);case Sr.Scalar.QUOTE_SINGLE:return Sg(i.value,e);case Sr.Scalar.PLAIN:return MV(i,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=s&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}fT.stringifyString=LV});var Wa=_(kg=>{"use strict";var DV=yd(),Hn=pe(),qV=Va(),FV=Ha();function ZV(t,e){let r=Object.assign({blockQuote:!0,commentString:qV.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function UV(t,e){if(e.tag){let s=t.filter(o=>o.tag===e.tag);if(s.length>0)return s.find(o=>o.format===e.format)??s[0]}let r,n;if(Hn.isScalar(e)){n=e.value;let s=t.filter(o=>o.identify?.(n));if(s.length>1){let o=s.filter(i=>i.test);o.length>0&&(s=o)}r=s.find(o=>o.format===e.format)??s.find(o=>!o.format)}else n=e,r=t.find(s=>s.nodeClass&&n instanceof s.nodeClass);if(!r){let s=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${s} value`)}return r}function VV(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let s=[],o=(Hn.isScalar(t)||Hn.isCollection(t))&&t.anchor;o&&DV.anchorIsValid(o)&&(r.add(o),s.push(`&${o}`));let i=t.tag??(e.default?null:e.tag);return i&&s.push(n.directives.tagString(i)),s.join(" ")}function BV(t,e,r,n){if(Hn.isPair(t))return t.toString(e,r,n);if(Hn.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let s,o=Hn.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>s=c});s??(s=UV(e.doc.schema.tags,o));let i=VV(o,s,e);i.length>0&&(e.indentAtStart=(e.indentAtStart??0)+i.length+1);let a=typeof s.stringify=="function"?s.stringify(o,e,r,n):Hn.isScalar(o)?FV.stringifyString(o,e,r,n):o.toString(e,r,n);return i?Hn.isScalar(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
|
|
36
|
+
${e.indent}${a}`:a}kg.createStringifyContext=ZV;kg.stringify=BV});var gT=_(mT=>{"use strict";var mn=pe(),pT=Ye(),hT=Wa(),Ja=Va();function KV({key:t,value:e},r,n,s){let{allNullValues:o,doc:i,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=mn.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(mn.isCollection(t)||!mn.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||mn.isCollection(t)||(mn.isScalar(t)?t.type===pT.Scalar.BLOCK_FOLDED||t.type===pT.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=hT.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||e==null&&p)return g=`? ${g}`,f&&!m?g+=Ja.lineComment(g,r.indent,l(f)):h&&s&&s(),g;m&&(f=null),p?(f&&(g+=Ja.lineComment(g,r.indent,l(f))),g=`? ${g}
|
|
37
|
+
${a}:`):(g=`${g}:`,f&&(g+=Ja.lineComment(g,r.indent,l(f))));let y,w,b;mn.isNode(e)?(y=!!e.spaceBefore,w=e.commentBefore,b=e.comment):(y=!1,w=null,b=null,e&&typeof e=="object"&&(e=i.createNode(e))),r.implicitKey=!1,!p&&!f&&mn.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&mn.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,v=hT.stringify(e,r,()=>x=!0,()=>h=!0),S=" ";if(f||y||w){if(S=y?`
|
|
38
|
+
`:"",w){let T=l(w);S+=`
|
|
39
|
+
${Ja.indentComment(T,r.indent)}`}v===""&&!r.inFlow?S===`
|
|
40
|
+
`&&b&&(S=`
|
|
41
|
+
|
|
42
|
+
`):S+=`
|
|
43
|
+
${r.indent}`}else if(!p&&mn.isCollection(e)){let T=v[0],I=v.indexOf(`
|
|
44
|
+
`),A=I!==-1,U=r.inFlow??e.flow??e.items.length===0;if(A||!U){let ae=!1;if(A&&(T==="&"||T==="!")){let J=v.indexOf(" ");T==="&"&&J!==-1&&J<I&&v[J+1]==="!"&&(J=v.indexOf(" ",J+1)),(J===-1||I<J)&&(ae=!0)}ae||(S=`
|
|
45
|
+
${r.indent}`)}}else(v===""||v[0]===`
|
|
46
|
+
`)&&(S="");return g+=S+v,r.inFlow?x&&n&&n():b&&!x?g+=Ja.lineComment(g,r.indent,l(b)):h&&s&&s(),g}mT.stringifyPair=KV});var Eg=_(xg=>{"use strict";var yT=ze("process");function HV(t,...e){t==="debug"&&console.log(...e)}function WV(t,e){(t==="debug"||t==="warn")&&(typeof yT.emitWarning=="function"?yT.emitWarning(e):console.warn(e))}xg.debug=HV;xg.warn=WV});var Nd=_(Id=>{"use strict";var Od=pe(),_T=Ye(),Td="<<",Pd={identify:t=>t===Td||typeof t=="symbol"&&t.description===Td,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new _T.Scalar(Symbol(Td)),{addToJSMap:vT}),stringify:()=>Td},JV=(t,e)=>(Pd.identify(e)||Od.isScalar(e)&&(!e.type||e.type===_T.Scalar.PLAIN)&&Pd.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Pd.tag&&r.default);function vT(t,e,r){let n=wT(t,r);if(Od.isSeq(n))for(let s of n.items)Tg(t,e,s);else if(Array.isArray(n))for(let s of n)Tg(t,e,s);else Tg(t,e,n)}function Tg(t,e,r){let n=wT(t,r);if(!Od.isMap(n))throw new Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,t,Map);for(let[o,i]of s)e instanceof Map?e.has(o)||e.set(o,i):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return e}function wT(t,e){return t&&Od.isAlias(e)?e.resolve(t.doc,t):e}Id.addMergeToJSMap=vT;Id.isMergeKey=JV;Id.merge=Pd});var Og=_($T=>{"use strict";var GV=Eg(),bT=Nd(),YV=Wa(),ST=pe(),Pg=Vn();function XV(t,e,{key:r,value:n}){if(ST.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(bT.isMergeKey(t,r))bT.addMergeToJSMap(t,e,n);else{let s=Pg.toJS(r,"",t);if(e instanceof Map)e.set(s,Pg.toJS(n,s,t));else if(e instanceof Set)e.add(s);else{let o=QV(r,s,t),i=Pg.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):e[o]=i}}return e}function QV(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(ST.isNode(t)&&r?.doc){let n=YV.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(s);o.length>40&&(o=o.substring(0,36)+'..."'),GV.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return s}return JSON.stringify(e)}$T.addPairToJSMap=XV});var Wn=_(Ig=>{"use strict";var kT=Ua(),e4=gT(),t4=Og(),Cd=pe();function r4(t,e,r){let n=kT.createNode(t,void 0,r),s=kT.createNode(e,void 0,r);return new Rd(n,s)}var Rd=class t{constructor(e,r=null){Object.defineProperty(this,Cd.NODE_TYPE,{value:Cd.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Cd.isNode(r)&&(r=r.clone(e)),Cd.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return t4.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?e4.stringifyPair(this,e,r,n):JSON.stringify(this)}};Ig.Pair=Rd;Ig.createPair=r4});var Ng=_(ET=>{"use strict";var js=pe(),xT=Wa(),Ad=Va();function n4(t,e,r){return(e.inFlow??t.flow?o4:s4)(t,e,r)}function s4({comment:t,items:e},r,{blockItemPrefix:n,flowChars:s,itemIndent:o,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;m<e.length;++m){let h=e[m],g=null;if(js.isNode(h))!d&&h.spaceBefore&&f.push(""),zd(r,f,h.commentBefore,d),h.comment&&(g=h.comment);else if(js.isPair(h)){let w=js.isNode(h.key)?h.key:null;w&&(!d&&w.spaceBefore&&f.push(""),zd(r,f,w.commentBefore,d))}d=!1;let y=xT.stringify(h,u,()=>g=null,()=>d=!0);g&&(y+=Ad.lineComment(y,o,l(g))),d&&g&&(d=!1),f.push(n+y)}let p;if(f.length===0)p=s.start+s.end;else{p=f[0];for(let m=1;m<f.length;++m){let h=f[m];p+=h?`
|
|
47
|
+
${c}${h}`:`
|
|
48
|
+
`}}return t?(p+=`
|
|
49
|
+
`+Ad.indentComment(l(t),c),a&&a()):d&&i&&i(),p}function o4({items:t},e,{flowChars:r,itemIndent:n}){let{indent:s,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;m<t.length;++m){let h=t[m],g=null;if(js.isNode(h))h.spaceBefore&&d.push(""),zd(e,d,h.commentBefore,!1),h.comment&&(g=h.comment);else if(js.isPair(h)){let w=js.isNode(h.key)?h.key:null;w&&(w.spaceBefore&&d.push(""),zd(e,d,w.commentBefore,!1),w.comment&&(l=!0));let b=js.isNode(h.value)?h.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(l=!0)):h.value==null&&w?.comment&&(g=w.comment)}g&&(l=!0);let y=xT.stringify(h,c,()=>g=null);l||(l=d.length>u||y.includes(`
|
|
50
|
+
`)),m<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=d.reduce((w,b)=>w+b.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),g&&(y+=Ad.lineComment(y,n,a(g))),d.push(y),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?`
|
|
51
|
+
${o}${s}${h}`:`
|
|
52
|
+
`;return`${m}
|
|
53
|
+
${s}${p}`}else return`${f}${i}${d.join(" ")}${i}${p}`}function zd({indent:t,options:{commentString:e}},r,n,s){if(n&&s&&(n=n.replace(/^\n+/,"")),n){let o=Ad.indentComment(e(n),t);r.push(o.trimStart())}}ET.stringifyCollection=n4});var Gn=_(Rg=>{"use strict";var i4=Ng(),a4=Og(),c4=bd(),Jn=pe(),jd=Wn(),l4=Ye();function Ga(t,e){let r=Jn.isScalar(e)?e.value:e;for(let n of t)if(Jn.isPair(n)&&(n.key===e||n.key===r||Jn.isScalar(n.key)&&n.key.value===r))return n}var Cg=class extends c4.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Jn.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:s,replacer:o}=n,i=new this(e),a=(c,l)=>{if(typeof o=="function")l=o.call(r,c,l);else if(Array.isArray(o)&&!o.includes(c))return;(l!==void 0||s)&&i.items.push(jd.createPair(c,l,n))};if(r instanceof Map)for(let[c,l]of r)a(c,l);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,r){let n;Jn.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new jd.Pair(e,e?.value):n=new jd.Pair(e.key,e.value);let s=Ga(this.items,n.key),o=this.schema?.sortMapEntries;if(s){if(!r)throw new Error(`Key ${n.key} already set`);Jn.isScalar(s.value)&&l4.isScalarValue(n.value)?s.value.value=n.value:s.value=n.value}else if(o){let i=this.items.findIndex(a=>o(n,a)<0);i===-1?this.items.push(n):this.items.splice(i,0,n)}else this.items.push(n)}delete(e){let r=Ga(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let s=Ga(this.items,e)?.value;return(!r&&Jn.isScalar(s)?s.value:s)??void 0}has(e){return!!Ga(this.items,e)}set(e,r){this.add(new jd.Pair(e,r),!0)}toJSON(e,r,n){let s=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(s);for(let o of this.items)a4.addPairToJSMap(r,s,o);return s}toString(e,r,n){if(!e)return JSON.stringify(this);for(let s of this.items)if(!Jn.isPair(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),i4.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};Rg.YAMLMap=Cg;Rg.findPair=Ga});var Zo=_(PT=>{"use strict";var u4=pe(),TT=Gn(),d4={collection:"map",default:!0,nodeClass:TT.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return u4.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>TT.YAMLMap.from(t,e,r)};PT.map=d4});var Yn=_(OT=>{"use strict";var f4=Ua(),p4=Ng(),h4=bd(),Ld=pe(),m4=Ye(),g4=Vn(),Ag=class extends h4.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ld.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Md(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Md(e);if(typeof n!="number")return;let s=this.items[n];return!r&&Ld.isScalar(s)?s.value:s}has(e){let r=Md(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=Md(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[n];Ld.isScalar(s)&&m4.isScalarValue(r)?s.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let s=0;for(let o of this.items)n.push(g4.toJS(o,String(s++),r));return n}toString(e,r,n){return e?p4.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:s}=n,o=new this(e);if(r&&Symbol.iterator in Object(r)){let i=0;for(let a of r){if(typeof s=="function"){let c=r instanceof Set?a:String(i++);a=s.call(r,c,a)}o.items.push(f4.createNode(a,void 0,n))}}return o}};function Md(t){let e=Ld.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}OT.YAMLSeq=Ag});var Uo=_(NT=>{"use strict";var y4=pe(),IT=Yn(),_4={collection:"seq",default:!0,nodeClass:IT.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return y4.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>IT.YAMLSeq.from(t,e,r)};NT.seq=_4});var Ya=_(CT=>{"use strict";var v4=Ha(),w4={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),v4.stringifyString(t,e,r,n)}};CT.string=w4});var Dd=_(zT=>{"use strict";var RT=Ye(),AT={identify:t=>t==null,createNode:()=>new RT.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new RT.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&AT.test.test(t)?t:e.options.nullStr};zT.nullTag=AT});var zg=_(MT=>{"use strict";var b4=Ye(),jT={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new b4.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&jT.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};MT.boolTag=jT});var Vo=_(LT=>{"use strict";function S4({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let s=typeof n=="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let i=o.indexOf(".");i<0&&(i=o.length,o+=".");let a=e-(o.length-i-1);for(;a-- >0;)o+="0"}return o}LT.stringifyNumber=S4});var Mg=_(qd=>{"use strict";var $4=Ye(),jg=Vo(),k4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:jg.stringifyNumber},x4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():jg.stringifyNumber(t)}},E4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new $4.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:jg.stringifyNumber};qd.float=E4;qd.floatExp=x4;qd.floatNaN=k4});var Dg=_(Zd=>{"use strict";var DT=Vo(),Fd=t=>typeof t=="bigint"||Number.isInteger(t),Lg=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function qT(t,e,r){let{value:n}=t;return Fd(n)&&n>=0?r+n.toString(e):DT.stringifyNumber(t)}var T4={identify:t=>Fd(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>Lg(t,2,8,r),stringify:t=>qT(t,8,"0o")},P4={identify:Fd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>Lg(t,0,10,r),stringify:DT.stringifyNumber},O4={identify:t=>Fd(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>Lg(t,2,16,r),stringify:t=>qT(t,16,"0x")};Zd.int=P4;Zd.intHex=O4;Zd.intOct=T4});var ZT=_(FT=>{"use strict";var I4=Zo(),N4=Dd(),C4=Uo(),R4=Ya(),A4=zg(),qg=Mg(),Fg=Dg(),z4=[I4.map,C4.seq,R4.string,N4.nullTag,A4.boolTag,Fg.intOct,Fg.int,Fg.intHex,qg.floatNaN,qg.floatExp,qg.float];FT.schema=z4});var BT=_(VT=>{"use strict";var j4=Ye(),M4=Zo(),L4=Uo();function UT(t){return typeof t=="bigint"||Number.isInteger(t)}var Ud=({value:t})=>JSON.stringify(t),D4=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Ud},{identify:t=>t==null,createNode:()=>new j4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ud},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Ud},{identify:UT,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>UT(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Ud}],q4={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},F4=[M4.map,L4.seq].concat(D4,q4);VT.schema=F4});var Ug=_(KT=>{"use strict";var Xa=ze("buffer"),Zg=Ye(),Z4=Ha(),U4={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Xa.Buffer=="function")return Xa.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,s,o){if(!r)return"";let i=r,a;if(typeof Xa.Buffer=="function")a=i instanceof Xa.Buffer?i.toString("base64"):Xa.Buffer.from(i.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<i.length;++l)c+=String.fromCharCode(i[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Zg.Scalar.BLOCK_LITERAL),e!==Zg.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=a.substr(f,c);a=u.join(e===Zg.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Z4.stringifyString({comment:t,type:e,value:a},n,s,o)}};KT.binary=U4});var Kd=_(Bd=>{"use strict";var Vd=pe(),Vg=Wn(),V4=Ye(),B4=Yn();function HT(t,e){if(Vd.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!Vd.isPair(n)){if(Vd.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let s=n.items[0]||new Vg.Pair(new V4.Scalar(null));if(n.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
|
|
55
|
+
${s.key.commentBefore}`:n.commentBefore),n.comment){let o=s.value??s.key;o.comment=o.comment?`${n.comment}
|
|
56
|
+
${o.comment}`:n.comment}n=s}t.items[r]=Vd.isPair(n)?n:new Vg.Pair(n)}}else e("Expected a sequence for this tag");return t}function WT(t,e,r){let{replacer:n}=r,s=new B4.YAMLSeq(t);s.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof n=="function"&&(i=n.call(e,String(o++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let l=Object.keys(i);if(l.length===1)a=l[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=i;s.items.push(Vg.createPair(a,c,r))}return s}var K4={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:HT,createNode:WT};Bd.createPairs=WT;Bd.pairs=K4;Bd.resolvePairs=HT});var Hg=_(Kg=>{"use strict";var JT=pe(),Bg=Vn(),Qa=Gn(),H4=Yn(),GT=Kd(),Ms=class t extends H4.YAMLSeq{constructor(){super(),this.add=Qa.YAMLMap.prototype.add.bind(this),this.delete=Qa.YAMLMap.prototype.delete.bind(this),this.get=Qa.YAMLMap.prototype.get.bind(this),this.has=Qa.YAMLMap.prototype.has.bind(this),this.set=Qa.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let s of this.items){let o,i;if(JT.isPair(s)?(o=Bg.toJS(s.key,"",r),i=Bg.toJS(s.value,o,r)):o=Bg.toJS(s,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,i)}return n}static from(e,r,n){let s=GT.createPairs(e,r,n),o=new this;return o.items=s.items,o}};Ms.tag="tag:yaml.org,2002:omap";var W4={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ms,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=GT.resolvePairs(t,e),n=[];for(let{key:s}of r.items)JT.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new Ms,r)},createNode:(t,e,r)=>Ms.from(t,e,r)};Kg.YAMLOMap=Ms;Kg.omap=W4});var tP=_(Wg=>{"use strict";var YT=Ye();function XT({value:t,source:e},r){return e&&(t?QT:eP).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var QT={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new YT.Scalar(!0),stringify:XT},eP={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new YT.Scalar(!1),stringify:XT};Wg.falseTag=eP;Wg.trueTag=QT});var rP=_(Hd=>{"use strict";var J4=Ye(),Jg=Vo(),G4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Jg.stringifyNumber},Y4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Jg.stringifyNumber(t)}},X4={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new J4.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Jg.stringifyNumber};Hd.float=X4;Hd.floatExp=Y4;Hd.floatNaN=G4});var sP=_(tc=>{"use strict";var nP=Vo(),ec=t=>typeof t=="bigint"||Number.isInteger(t);function Wd(t,e,r,{intAsBigInt:n}){let s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let i=BigInt(t);return s==="-"?BigInt(-1)*i:i}let o=parseInt(t,r);return s==="-"?-1*o:o}function Gg(t,e,r){let{value:n}=t;if(ec(n)){let s=n.toString(e);return n<0?"-"+r+s.substr(1):r+s}return nP.stringifyNumber(t)}var Q4={identify:ec,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Wd(t,2,2,r),stringify:t=>Gg(t,2,"0b")},e9={identify:ec,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Wd(t,1,8,r),stringify:t=>Gg(t,8,"0")},t9={identify:ec,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Wd(t,0,10,r),stringify:nP.stringifyNumber},r9={identify:ec,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Wd(t,2,16,r),stringify:t=>Gg(t,16,"0x")};tc.int=t9;tc.intBin=Q4;tc.intHex=r9;tc.intOct=e9});var Xg=_(Yg=>{"use strict";var Yd=pe(),Jd=Wn(),Gd=Gn(),Ls=class t extends Gd.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Yd.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Jd.Pair(e.key,null):r=new Jd.Pair(e,null),Gd.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Gd.findPair(this.items,e);return!r&&Yd.isPair(n)?Yd.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Gd.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Jd.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:s}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let i of r)typeof s=="function"&&(i=s.call(r,i,i)),o.items.push(Jd.createPair(i,null,n));return o}};Ls.tag="tag:yaml.org,2002:set";var n9={collection:"map",identify:t=>t instanceof Set,nodeClass:Ls,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ls.from(t,e,r),resolve(t,e){if(Yd.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ls,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Yg.YAMLSet=Ls;Yg.set=n9});var ey=_(Xd=>{"use strict";var s9=Vo();function Qg(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,s=i=>e?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function oP(t){let{value:e}=t,r=i=>i;if(typeof e=="bigint")r=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return s9.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let s=r(60),o=[e%s];return e<60?o.unshift(0):(e=(e-o[0])/s,o.unshift(e%s),e>=60&&(e=(e-o[0])/s,o.unshift(e))),n+o.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var o9={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Qg(t,r),stringify:oP},i9={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Qg(t,!1),stringify:oP},iP={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(iP.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,s,o||0,i||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Qg(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Xd.floatTime=i9;Xd.intTime=o9;Xd.timestamp=iP});var lP=_(cP=>{"use strict";var a9=Zo(),c9=Dd(),l9=Uo(),u9=Ya(),d9=Ug(),aP=tP(),ty=rP(),Qd=sP(),f9=Nd(),p9=Hg(),h9=Kd(),m9=Xg(),ry=ey(),g9=[a9.map,l9.seq,u9.string,c9.nullTag,aP.trueTag,aP.falseTag,Qd.intBin,Qd.intOct,Qd.int,Qd.intHex,ty.floatNaN,ty.floatExp,ty.float,d9.binary,f9.merge,p9.omap,h9.pairs,m9.set,ry.intTime,ry.floatTime,ry.timestamp];cP.schema=g9});var vP=_(oy=>{"use strict";var pP=Zo(),y9=Dd(),hP=Uo(),_9=Ya(),v9=zg(),ny=Mg(),sy=Dg(),w9=ZT(),b9=BT(),mP=Ug(),rc=Nd(),gP=Hg(),yP=Kd(),uP=lP(),_P=Xg(),ef=ey(),dP=new Map([["core",w9.schema],["failsafe",[pP.map,hP.seq,_9.string]],["json",b9.schema],["yaml11",uP.schema],["yaml-1.1",uP.schema]]),fP={binary:mP.binary,bool:v9.boolTag,float:ny.float,floatExp:ny.floatExp,floatNaN:ny.floatNaN,floatTime:ef.floatTime,int:sy.int,intHex:sy.intHex,intOct:sy.intOct,intTime:ef.intTime,map:pP.map,merge:rc.merge,null:y9.nullTag,omap:gP.omap,pairs:yP.pairs,seq:hP.seq,set:_P.set,timestamp:ef.timestamp},S9={"tag:yaml.org,2002:binary":mP.binary,"tag:yaml.org,2002:merge":rc.merge,"tag:yaml.org,2002:omap":gP.omap,"tag:yaml.org,2002:pairs":yP.pairs,"tag:yaml.org,2002:set":_P.set,"tag:yaml.org,2002:timestamp":ef.timestamp};function $9(t,e,r){let n=dP.get(e);if(n&&!t)return r&&!n.includes(rc.merge)?n.concat(rc.merge):n.slice();let s=n;if(!s)if(Array.isArray(t))s=[];else{let o=Array.from(dP.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)s=s.concat(o);else typeof t=="function"&&(s=t(s.slice()));return r&&(s=s.concat(rc.merge)),s.reduce((o,i)=>{let a=typeof i=="string"?fP[i]:i;if(!a){let c=JSON.stringify(i),l=Object.keys(fP).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}oy.coreKnownTags=S9;oy.getTags=$9});var cy=_(wP=>{"use strict";var iy=pe(),k9=Zo(),x9=Uo(),E9=Ya(),tf=vP(),T9=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ay=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:s,schema:o,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?tf.getTags(e,"compat"):e?tf.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=s?tf.coreKnownTags:{},this.tags=tf.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,iy.MAP,{value:k9.map}),Object.defineProperty(this,iy.SCALAR,{value:E9.string}),Object.defineProperty(this,iy.SEQ,{value:x9.seq}),this.sortMapEntries=typeof i=="function"?i:i===!0?T9:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};wP.Schema=ay});var SP=_(bP=>{"use strict";var P9=pe(),ly=Wa(),nc=Va();function O9(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let s=ly.createStringifyContext(t,e),{commentString:o}=s.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(nc.indentComment(c,""))}let i=!1,a=null;if(t.contents){if(P9.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(nc.indentComment(u,""))}s.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>i=!0,l=ly.stringify(t.contents,s,()=>a=null,c);a&&(l+=nc.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ly.stringify(t.contents,s));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
57
|
+
`)?(r.push("..."),r.push(nc.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&i&&(c=c.replace(/^\n+/,"")),c&&((!i||a)&&r[r.length-1]!==""&&r.push(""),r.push(nc.indentComment(o(c),"")))}return r.join(`
|
|
58
|
+
`)+`
|
|
59
|
+
`}bP.stringifyDocument=O9});var sc=_($P=>{"use strict";var I9=Za(),Bo=bd(),ir=pe(),N9=Wn(),C9=Vn(),R9=cy(),A9=SP(),uy=yd(),z9=hg(),j9=Ua(),dy=pg(),fy=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ir.NODE_TYPE,{value:ir.DOC});let s=null;typeof r=="function"||Array.isArray(r)?s=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:i}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new dy.Directives({version:i}),this.setSchema(i,n),this.contents=e===void 0?null:this.createNode(e,s,n)}clone(){let e=Object.create(t.prototype,{[ir.NODE_TYPE]:{value:ir.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ir.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ko(this.contents)&&this.contents.add(e)}addIn(e,r){Ko(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=uy.anchorNames(this);e.anchor=!r||n.has(r)?uy.findNewAnchor(r||"a",n):r}return new I9.Alias(e.anchor)}createNode(e,r,n){let s;if(typeof r=="function")e=r.call({"":e},"",e),s=r;else if(Array.isArray(r)){let g=w=>typeof w=="number"||w instanceof String||w instanceof Number,y=r.filter(g).map(String);y.length>0&&(r=r.concat(y)),s=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:i,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=uy.createNodeAnchors(this,i||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:s,schema:this.schema,sourceObjects:p},h=j9.createNode(e,u,m);return a&&ir.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let s=this.createNode(e,null,n),o=this.createNode(r,null,n);return new N9.Pair(s,o)}delete(e){return Ko(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Bo.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ko(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return ir.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Bo.isEmptyPath(e)?!r&&ir.isScalar(this.contents)?this.contents.value:this.contents:ir.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return ir.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Bo.isEmptyPath(e)?this.contents!==void 0:ir.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Bo.collectionFromPath(this.schema,[e],r):Ko(this.contents)&&this.contents.set(e,r)}setIn(e,r){Bo.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Bo.collectionFromPath(this.schema,Array.from(e),r):Ko(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new dy.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new dy.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new R9.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:s,onAnchor:o,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=C9.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof i=="function"?z9.applyReviver(i,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return A9.stringifyDocument(this,e)}};function Ko(t){if(ir.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}$P.Document=fy});var ac=_(ic=>{"use strict";var oc=class extends Error{constructor(e,r,n,s){super(),this.name=e,this.code=n,this.message=s,this.pos=r}},py=class extends oc{constructor(e,r,n){super("YAMLParseError",e,r,n)}},hy=class extends oc{constructor(e,r,n){super("YAMLWarning",e,r,n)}},M9=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:s}=r.linePos[0];r.message+=` at line ${n}, column ${s}`;let o=s-1,i=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){let a=Math.min(o-39,i.length-79);i="\u2026"+i.substring(a),o-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(i.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
|
+
`),i=a+i}if(/[^ ]/.test(i)){let a=1,c=r.linePos[1];c?.line===n&&c.col>s&&(a=Math.max(1,Math.min(c.col-s,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
|
61
|
+
|
|
62
|
+
${i}
|
|
63
|
+
${l}
|
|
64
|
+
`}};ic.YAMLError=oc;ic.YAMLParseError=py;ic.YAMLWarning=hy;ic.prettifyError=M9});var cc=_(kP=>{"use strict";function L9(t,{flow:e,indicator:r,next:n,offset:s,onError:o,parentIndent:i,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,h=null,g=null,y=null,w=null,b=null,x=null,v=null;for(let I of t)switch(m&&(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma"&&o(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&I.type!=="comment"&&I.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),I.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&I.source.includes(" ")&&(h=I),u=!0;break;case"comment":{u||o(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=I.source.substring(1)||" ";d?d+=f+A:d=A,f="",l=!1;break}case"newline":l?d?d+=I.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=I.source,l=!0,p=!0,(g||y)&&(w=I),u=!0;break;case"anchor":g&&o(I,"MULTIPLE_ANCHORS","A node can have at most one anchor"),I.source.endsWith(":")&&o(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=I,v??(v=I.offset),l=!1,u=!1,m=!0;break;case"tag":{y&&o(I,"MULTIPLE_TAGS","A node can have at most one tag"),y=I,v??(v=I.offset),l=!1,u=!1,m=!0;break}case r:(g||y)&&o(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`),x&&o(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${e??"collection"}`),x=I,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){b&&o(I,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=I,l=!1,u=!1;break}default:o(I,"UNEXPECTED_TOKEN",`Unexpected ${I.type} token`),l=!1,u=!1}let S=t[t.length-1],T=S?S.offset+S.source.length:s;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=i||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:y,newlineAfterProp:w,end:T,start:v??T}}kP.resolveProps=L9});var rf=_(xP=>{"use strict";function my(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
65
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(my(e.key)||my(e.value))return!0}return!1;default:return!0}}xP.containsNewline=my});var gy=_(EP=>{"use strict";var D9=rf();function q9(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&D9.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}EP.flowIndentCheck=q9});var yy=_(PP=>{"use strict";var TP=pe();function F9(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let s=typeof n=="function"?n:(o,i)=>o===i||TP.isScalar(o)&&TP.isScalar(i)&&o.value===i.value;return e.some(o=>s(o.key,r))}PP.mapIncludes=F9});var AP=_(RP=>{"use strict";var OP=Wn(),Z9=Gn(),IP=cc(),U9=rf(),NP=gy(),V9=yy(),CP="All mapping items must start at the same column";function B9({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??Z9.YAMLMap,a=new i(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,h=IP.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&s(c,"BAD_INDENT",CP)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||U9.containsNewline(f))&&s(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==n.indent&&s(c,"BAD_INDENT",CP);r.atKey=!0;let y=h.end,w=f?t(r,f,h,s):e(r,y,d,null,h,s);r.schema.compat&&NP.flowIndentCheck(n.indent,f,s),r.atKey=!1,V9.mapIncludes(r,a.items,w)&&s(y,"DUPLICATE_KEY","Map keys must be unique");let b=IP.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:w.range[2],onError:s,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=b.end,b.found){g&&(m?.type==="block-map"&&!b.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<b.found.offset-1024&&s(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=m?t(r,m,b,s):e(r,c,p,null,b,s);r.schema.compat&&NP.flowIndentCheck(n.indent,m,s),c=x.range[2];let v=new OP.Pair(w,x);r.options.keepSourceTokens&&(v.srcToken=u),a.items.push(v)}else{g&&s(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(w.comment?w.comment+=`
|
|
67
|
+
`+b.comment:w.comment=b.comment);let x=new OP.Pair(w);r.options.keepSourceTokens&&(x.srcToken=u),a.items.push(x)}}return l&&l<c&&s(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}RP.resolveBlockMap=B9});var jP=_(zP=>{"use strict";var K9=Yn(),H9=cc(),W9=gy();function J9({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??K9.YAMLSeq,a=new i(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=H9.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?s(f.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{l=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?t(r,d,f,s):e(r,f.end,u,null,f,s);r.schema.compat&&W9.flowIndentCheck(n.indent,d,s),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}zP.resolveBlockSeq=J9});var Ho=_(MP=>{"use strict";function G9(t,e,r,n){let s="";if(t){let o=!1,i="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";s?s+=i+u:s=u,i="";break}case"newline":s&&(i+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:s,offset:e}}MP.resolveEnd=G9});var FP=_(qP=>{"use strict";var Y9=pe(),X9=Wn(),LP=Gn(),Q9=Yn(),eB=Ho(),DP=cc(),tB=rf(),rB=yy(),_y="Block collections are not allowed within flow collections",vy=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nB({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",c=o?.nodeClass??(i?LP.YAMLMap:Q9.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let y=n.items[g],{start:w,key:b,sep:x,value:v}=y,S=DP.resolveProps(w,{flow:a,indicator:"explicit-key-ind",next:b??x?.[0],offset:d,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!x&&!v){g===0&&S.comma?s(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&s(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),S.comment&&(l.comment?l.comment+=`
|
|
68
|
+
`+S.comment:l.comment=S.comment),d=S.end;continue}!i&&r.options.strict&&tB.containsNewline(b)&&s(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)S.comma&&s(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(S.comma||s(S.start,"MISSING_CHAR",`Missing , between ${a} items`),S.comment){let T="";e:for(let I of w)switch(I.type){case"comma":case"space":break;case"comment":T=I.source.substring(1);break e;default:break e}if(T){let I=l.items[l.items.length-1];Y9.isPair(I)&&(I=I.value??I.key),I.comment?I.comment+=`
|
|
69
|
+
`+T:I.comment=T,S.comment=S.comment.substring(T.length+1)}}if(!i&&!x&&!S.found){let T=v?t(r,v,S,s):e(r,S.end,x,null,S,s);l.items.push(T),d=T.range[2],vy(v)&&s(T.range,"BLOCK_IN_FLOW",_y)}else{r.atKey=!0;let T=S.end,I=b?t(r,b,S,s):e(r,T,w,null,S,s);vy(b)&&s(I.range,"BLOCK_IN_FLOW",_y),r.atKey=!1;let A=DP.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:v,offset:I.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(A.found){if(!i&&!S.found&&r.options.strict){if(x)for(let J of x){if(J===A.found)break;if(J.type==="newline"){s(J,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<A.found.offset-1024&&s(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else v&&("source"in v&&v.source?.[0]===":"?s(v,"MISSING_CHAR",`Missing space after : in ${a}`):s(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let U=v?t(r,v,A,s):A.found?e(r,A.end,x,null,A,s):null;U?vy(v)&&s(U.range,"BLOCK_IN_FLOW",_y):A.comment&&(I.comment?I.comment+=`
|
|
70
|
+
`+A.comment:I.comment=A.comment);let ae=new X9.Pair(I,U);if(r.options.keepSourceTokens&&(ae.srcToken=y),i){let J=l;rB.mapIncludes(r,J.items,I)&&s(T,"DUPLICATE_KEY","Map keys must be unique"),J.items.push(ae)}else{let J=new LP.YAMLMap(r.schema);J.flow=!0,J.items.push(ae);let Y=(U??I).range;J.range=[I.range[0],Y[1],Y[2]],l.items.push(J)}d=U?U.range[2]:A.end}}let f=i?"}":"]",[p,...m]=n.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),y=u?`${g} must end with a ${f}`:`${g} in block collection must be sufficiently indented and end with a ${f}`;s(d,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){let g=eB.resolveEnd(m,h,r.options.strict,s);g.comment&&(l.comment?l.comment+=`
|
|
71
|
+
`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}qP.resolveFlowCollection=nB});var UP=_(ZP=>{"use strict";var sB=pe(),oB=Ye(),iB=Gn(),aB=Yn(),cB=AP(),lB=jP(),uB=FP();function wy(t,e,r,n,s,o){let i=r.type==="block-map"?cB.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?lB.resolveBlockSeq(t,e,r,n,o):uB.resolveFlowCollection(t,e,r,n,o),a=i.constructor;return s==="!"||s===a.tagName?(i.tag=a.tagName,i):(s&&(i.tag=s),i)}function dB(t,e,r,n,s){let o=n.tag,i=o?e.directives.tagName(o.source,f=>s(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offset<m.offset)&&s(m,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===iB.YAMLMap.tagName&&a==="map"||i===aB.YAMLSeq.tagName&&a==="seq")return wy(t,e,r,s,i);let c=e.schema.tags.find(f=>f.tag===i&&f.collection===a);if(!c){let f=e.schema.knownTags[i];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?s(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):s(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),wy(t,e,r,s,i)}let l=wy(t,e,r,s,i,c),u=c.resolve?.(l,f=>s(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=sB.isNode(u)?u:new oB.Scalar(u);return d.range=l.range,d.tag=i,c?.format&&(d.format=c.format),d}ZP.composeCollection=dB});var Sy=_(VP=>{"use strict";var by=Ye();function fB(t,e,r){let n=e.offset,s=pB(e,t.options.strict,r);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let o=s.mode===">"?by.Scalar.BLOCK_FOLDED:by.Scalar.BLOCK_LITERAL,i=e.source?hB(e.source):[],a=i.length;for(let h=i.length-1;h>=0;--h){let g=i[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=s.chomp==="+"&&i.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,i.length-1)):"",g=n+s.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:s.comment,range:[n,g,g]}}let c=e.indent+s.indent,l=e.offset+s.length,u=0;for(let h=0;h<a;++h){let[g,y]=i[h];if(y===""||y==="\r")s.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&r(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=g.length),u=h,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let h=i.length-1;h>=a;--h)i[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;h<u;++h)d+=i[h][0].slice(c)+`
|
|
73
|
+
`;for(let h=u;h<a;++h){let[g,y]=i[h];l+=g.length+y.length+1;let w=y[y.length-1]==="\r";if(w&&(y=y.slice(0,-1)),y&&g.length<c){let x=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;r(l-y.length-(w?2:1),"BAD_INDENT",x),g=""}o===by.Scalar.BLOCK_LITERAL?(d+=f+g.slice(c)+y,f=`
|
|
74
|
+
`):g.length>c||y[0]===" "?(f===" "?f=`
|
|
75
|
+
`:!p&&f===`
|
|
76
|
+
`&&(f=`
|
|
77
|
+
|
|
78
|
+
`),d+=f+g.slice(c)+y,f=`
|
|
79
|
+
`,p=!0):y===""?f===`
|
|
80
|
+
`?d+=`
|
|
81
|
+
`:f=`
|
|
82
|
+
`:(d+=f+y,f=" ",p=!1)}switch(s.chomp){case"-":break;case"+":for(let h=a;h<i.length;++h)d+=`
|
|
83
|
+
`+i[h][0].slice(c);d[d.length-1]!==`
|
|
84
|
+
`&&(d+=`
|
|
85
|
+
`);break;default:d+=`
|
|
86
|
+
`}let m=n+s.length+e.source.length;return{value:d,type:o,comment:s.comment,range:[n,m,m]}}function pB({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],o=s[0],i=0,a="",c=-1;for(let f=1;f<s.length;++f){let p=s[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);!i&&m?i=m:c===-1&&(c=t+f)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let l=!1,u="",d=s.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":r&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",m);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:o,indent:i,chomp:a,comment:u,length:d}}function hB(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<e.length;i+=2)o.push([e[i],e[i+1]]);return o}VP.resolveBlockScalar=fB});var ky=_(KP=>{"use strict";var $y=Ye(),mB=Ho();function gB(t,e,r){let{offset:n,type:s,source:o,end:i}=t,a,c,l=(f,p,m)=>r(n+f,p,m);switch(s){case"scalar":a=$y.Scalar.PLAIN,c=yB(o,l);break;case"single-quoted-scalar":a=$y.Scalar.QUOTE_SINGLE,c=_B(o,l);break;case"double-quoted-scalar":a=$y.Scalar.QUOTE_DOUBLE,c=vB(o,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=mB.resolveEnd(i,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function yB(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),BP(t)}function _B(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),BP(t.slice(1,-1)).replace(/''/g,"'")}function BP(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
|
+
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let s=n[1],o=" ",i=e.lastIndex;for(r.lastIndex=i;n=r.exec(t);)n[1]===""?o===`
|
|
89
|
+
`?s+=o:o=`
|
|
90
|
+
`:(s+=o+n[1],o=" "),i=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,n=a.exec(t),s+o+(n?.[1]??"")}function vB(t,e){let r="";for(let n=1;n<t.length-1;++n){let s=t[n];if(!(s==="\r"&&t[n+1]===`
|
|
91
|
+
`))if(s===`
|
|
92
|
+
`){let{fold:o,offset:i}=wB(t,n);r+=o,n=i}else if(s==="\\"){let o=t[++n],i=bB[o];if(i)r+=i;else if(o===`
|
|
93
|
+
`)for(o=t[n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="\r"&&t[n+1]===`
|
|
94
|
+
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=SB(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(s===" "||s===" "){let o=n,i=t[n+1];for(;i===" "||i===" ";)i=t[++n+1];i!==`
|
|
95
|
+
`&&!(i==="\r"&&t[n+2]===`
|
|
96
|
+
`)&&(r+=n>o?t.slice(o,n+1):s)}else r+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function wB(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
97
|
+
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
98
|
+
`);)n===`
|
|
99
|
+
`&&(r+=`
|
|
100
|
+
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var bB={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function SB(t,e,r,n){let s=t.substr(e,r),i=s.length===r&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(i)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}KP.resolveFlowScalar=gB});var JP=_(WP=>{"use strict";var Ds=pe(),HP=Ye(),$B=Sy(),kB=ky();function xB(t,e,r,n){let{value:s,type:o,comment:i,range:a}=e.type==="block-scalar"?$B.resolveBlockScalar(t,e,n):kB.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[Ds.SCALAR]:c?l=EB(t.schema,s,c,r,n):e.type==="scalar"?l=TB(t,s,e,n):l=t.schema[Ds.SCALAR];let u;try{let d=l.resolve(s,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=Ds.isScalar(d)?d:new HP.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new HP.Scalar(s)}return u.range=a,u.source=s,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),i&&(u.comment=i),u}function EB(t,e,r,n,s){if(r==="!")return t[Ds.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let i=t.knownTags[r];return i&&!i.collection?(t.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[Ds.SCALAR])}function TB({atKey:t,directives:e,schema:r},n,s,o){let i=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[Ds.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[Ds.SCALAR];if(i.tag!==a.tag){let c=e.tagString(i.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(s,"TAG_RESOLVE_FAILED",u,!0)}}return i}WP.composeScalar=xB});var YP=_(GP=>{"use strict";function PB(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let s=e[n];switch(s.type){case"space":case"comment":case"newline":t-=s.source.length;continue}for(s=e[++n];s?.type==="space";)t+=s.source.length,s=e[++n];break}}return t}GP.emptyScalarPosition=PB});var eO=_(Ey=>{"use strict";var OB=Za(),IB=pe(),NB=UP(),XP=JP(),CB=Ho(),RB=YP(),AB={composeNode:QP,composeEmptyNode:xy};function QP(t,e,r,n){let s=t.atKey,{spaceBefore:o,comment:i,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=zB(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=XP.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=NB.composeCollection(AB,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=xy(t,e.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&t.options.stringKeys&&(!IB.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?l.comment=i:l.commentBefore=i),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function xy(t,e,r,n,{spaceBefore:s,comment:o,anchor:i,tag:a,end:c},l){let u={type:"scalar",offset:RB.emptyScalarPosition(e,r,n),indent:-1,source:""},d=XP.composeScalar(t,u,a,l);return i&&(d.anchor=i.source.substring(1),d.anchor===""&&l(i,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function zB({options:t},{offset:e,source:r,end:n},s){let o=new OB.Alias(r.substring(1));o.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&s(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=e+r.length,a=CB.resolveEnd(n,i,t.strict,s);return o.range=[e,i,a.offset],a.comment&&(o.comment=a.comment),o}Ey.composeEmptyNode=xy;Ey.composeNode=QP});var nO=_(rO=>{"use strict";var jB=sc(),tO=eO(),MB=Ho(),LB=cc();function DB(t,e,{offset:r,start:n,value:s,end:o},i){let a=Object.assign({_directives:e},t),c=new jB.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=LB.resolveProps(n,{indicator:"doc-start",next:s??o?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!u.hasNewline&&i(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?tO.composeNode(l,s,u,i):tO.composeEmptyNode(l,u.end,n,null,u,i);let d=c.contents.range[2],f=MB.resolveEnd(o,d,!1,i);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}rO.composeDoc=DB});var Py=_(iO=>{"use strict";var qB=ze("process"),FB=pg(),ZB=sc(),lc=ac(),sO=pe(),UB=nO(),VB=Ho();function uc(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function oO(t){let e="",r=!1,n=!1;for(let s=0;s<t.length;++s){let o=t[s];switch(o[0]){case"#":e+=(e===""?"":n?`
|
|
102
|
+
|
|
103
|
+
`:`
|
|
104
|
+
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var Ty=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,s,o)=>{let i=uc(r);o?this.warnings.push(new lc.YAMLWarning(i,n,s)):this.errors.push(new lc.YAMLParseError(i,n,s))},this.directives=new FB.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:s}=oO(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment}
|
|
105
|
+
${n}`:n;else if(s||e.directives.docStart||!o)e.commentBefore=n;else if(sO.isCollection(o)&&!o.flow&&o.items.length>0){let i=o.items[0];sO.isPair(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${n}
|
|
106
|
+
${a}`:n}else{let i=o.commentBefore;o.commentBefore=i?`${n}
|
|
107
|
+
${i}`:n}}if(r){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:oO(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let s of e)yield*this.next(s);yield*this.end(r,n)}*next(e){switch(qB.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,s)=>{let o=uc(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=UB.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new lc.YAMLParseError(uc(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new lc.YAMLParseError(uc(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=VB.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
108
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new lc.YAMLParseError(uc(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),s=new ZB.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,r,r],this.decorate(s,!1),yield s}}};iO.Composer=Ty});var lO=_(nf=>{"use strict";var BB=Sy(),KB=ky(),HB=ac(),aO=Ha();function WB(t,e=!0,r){if(t){let n=(s,o,i)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(r)r(a,o,i);else throw new HB.YAMLParseError([a,a+1],o,i)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return KB.resolveFlowScalar(t,e,n);case"block-scalar":return BB.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function JB(t,e){let{implicitKey:r=!1,indent:n,inFlow:s=!1,offset:o=-1,type:i="PLAIN"}=e,a=aO.stringifyString({type:i,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
109
|
+
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
110
|
+
`),u=a.substring(0,l),d=a.substring(l+1)+`
|
|
111
|
+
`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return cO(f,c)||f.push({type:"newline",offset:-1,indent:n,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function GB(t,e,r={}){let{afterKey:n=!1,implicitKey:s=!1,inFlow:o=!1,type:i}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!i)switch(t.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=aO.stringifyString({type:i,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":YB(t,c);break;case'"':Oy(t,c,"double-quoted-scalar");break;case"'":Oy(t,c,"single-quoted-scalar");break;default:Oy(t,c,"scalar")}}function YB(t,e){let r=e.indexOf(`
|
|
113
|
+
`),n=e.substring(0,r),s=e.substring(r+1)+`
|
|
114
|
+
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=s}else{let{offset:o}=t,i="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:i,source:n}];cO(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:i,source:`
|
|
115
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:i,props:a,source:s})}}function cO(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function Oy(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),s=e.length;t.props[0].type==="block-scalar-header"&&(s-=t.props[0].source.length);for(let o of n)o.offset+=s;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let s={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
116
|
+
`};delete t.items,Object.assign(t,{type:r,source:e,end:[s]});break}default:{let n="indent"in t?t.indent:-1,s="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:s})}}}nf.createScalarToken=JB;nf.resolveAsScalar=WB;nf.setScalarValue=GB});var dO=_(uO=>{"use strict";var XB=t=>"type"in t?of(t):sf(t);function of(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=of(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=sf(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=sf(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=sf(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function sf({start:t,key:e,sep:r,value:n}){let s="";for(let o of t)s+=o.source;if(e&&(s+=of(e)),r)for(let o of r)s+=o.source;return n&&(s+=of(n)),s}uO.stringify=XB});var mO=_(hO=>{"use strict";var Iy=Symbol("break visit"),QB=Symbol("skip children"),fO=Symbol("remove item");function qs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),pO(Object.freeze([]),t,e)}qs.BREAK=Iy;qs.SKIP=QB;qs.REMOVE=fO;qs.itemAtPath=(t,e)=>{let r=t;for(let[n,s]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[s];else return}return r};qs.parentCollection=(t,e)=>{let r=qs.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],s=r?.[n];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function pO(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let s of["key","value"]){let o=e[s];if(o&&"items"in o){for(let i=0;i<o.items.length;++i){let a=pO(Object.freeze(t.concat([[s,i]])),o.items[i],r);if(typeof a=="number")i=a-1;else{if(a===Iy)return Iy;a===fO&&(o.items.splice(i,1),i-=1)}}typeof n=="function"&&s==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}hO.visit=qs});var af=_(Nt=>{"use strict";var Ny=lO(),e3=dO(),t3=mO(),Cy="\uFEFF",Ry="",Ay="",zy="",r3=t=>!!t&&"items"in t,n3=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function s3(t){switch(t){case Cy:return"<BOM>";case Ry:return"<DOC>";case Ay:return"<FLOW_END>";case zy:return"<SCALAR>";default:return JSON.stringify(t)}}function o3(t){switch(t){case Cy:return"byte-order-mark";case Ry:return"doc-mode";case Ay:return"flow-error-end";case zy:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
|
+
`:case`\r
|
|
118
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Nt.createScalarToken=Ny.createScalarToken;Nt.resolveAsScalar=Ny.resolveAsScalar;Nt.setScalarValue=Ny.setScalarValue;Nt.stringify=e3.stringify;Nt.visit=t3.visit;Nt.BOM=Cy;Nt.DOCUMENT=Ry;Nt.FLOW_END=Ay;Nt.SCALAR=zy;Nt.isCollection=r3;Nt.isScalar=n3;Nt.prettyToken=s3;Nt.tokenType=o3});var Ly=_(yO=>{"use strict";var dc=af();function $r(t){switch(t){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var gO=new Set("0123456789ABCDEFabcdef"),i3=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),cf=new Set(",[]{}"),a3=new Set(` ,[]{}
|
|
120
|
+
\r `),jy=t=>!t||a3.has(t),My=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
|
|
121
|
+
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
122
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let s=this.buffer[n+e+1];if(s===`
|
|
123
|
+
`||!s&&!this.atEnd)return e+n+1}return r===`
|
|
124
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&$r(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
125
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===dc.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let s=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield dc.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&$r(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!$r(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&$r(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(jy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&$r(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield dc.FLOW_END,yield*this.parseLineStart();let o=0;for(;s[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),s[o]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(jy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||$r(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),s=n.indexOf(`
|
|
126
|
+
`,this.pos);if(s!==-1){for(;s!==-1;){let o=this.continueScalar(s+1);if(o===-1)break;s=n.indexOf(`
|
|
127
|
+
`,o)}s!==-1&&(r=s-(n[s-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>$r(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
|
|
128
|
+
`:e=o,r=0;break;case"\r":{let i=this.buffer[o+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
|
|
129
|
+
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
130
|
+
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
131
|
+
`;)n=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let o=e-1,i=this.buffer[o];i==="\r"&&(i=this.buffer[--o]);let a=o;for(;i===" ";)i=this.buffer[--o];if(i===`
|
|
132
|
+
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield dc.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let o=this.buffer[n+1];if($r(o)||e&&cf.has(o))break;r=n}else if($r(s)){let o=this.buffer[n+1];if(s==="\r"&&(o===`
|
|
133
|
+
`?(n+=1,s=`
|
|
134
|
+
`,o=this.buffer[n+1]):r=n),o==="#"||e&&cf.has(o))break;if(s===`
|
|
135
|
+
`){let i=this.continueScalar(n+1);if(i===-1)break;n=Math.max(n,i-2)}}else{if(e&&cf.has(s))break;r=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield dc.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(jy),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if($r(n)||r&&cf.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!$r(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(i3.has(r))r=this.buffer[++e];else if(r==="%"&&gO.has(this.buffer[e+1])&&gO.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
136
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let s=r-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=r),s}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};yO.Lexer=My});var qy=_(_O=>{"use strict";var Dy=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<e?r=o+1:n=o}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let s=this.lineStarts[r-1];return{line:r,col:e-s+1}}}};_O.LineCounter=Dy});var Zy=_($O=>{"use strict";var c3=ze("process"),vO=af(),l3=Ly();function Xn(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function wO(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function SO(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function lf(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Wo(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function uf(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r<e.length;++r)t.push(e[r])}function bO(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Xn(e.start,"explicit-key-ind")&&!Xn(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,SO(e.value)?e.value.end?uf(e.value.end,e.sep):e.value.end=e.sep:uf(e.start,e.sep),delete e.sep)}var Fy=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new l3.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,c3.env.LOG_TOKENS&&console.log("|",vO.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=vO.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&bO(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=r;else{Object.assign(s,{key:r,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:r}):s.value=r;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:r,sep:[]}):s.sep?s.value=r:Object.assign(s,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let s=r.items[r.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&wO(s.start)===-1&&(r.indent===0||s.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{wO(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=lf(this.peek(2)),n=Wo(r),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
138
|
+
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
139
|
+
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){uf(s,r.start),s.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(s&&r.sep&&!r.value){let i=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(o=r.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):s||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Xn(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(SO(r.key)&&!Xn(r.sep,"newline")){let i=Wo(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Xn(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let i=Wo(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Xn(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);s||r.value?(e.items.push({start:o,key:i,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(i):(Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Xn(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){uf(s,r.start),s.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||Xn(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=lf(n),o=Wo(s);bO(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
140
|
+
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
141
|
+
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=lf(e),n=Wo(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=lf(e),n=Wo(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};$O.Parser=Fy});var PO=_(pc=>{"use strict";var kO=Py(),u3=sc(),fc=ac(),d3=Eg(),f3=pe(),p3=qy(),xO=Zy();function EO(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new p3.LineCounter||null,prettyErrors:e}}function h3(t,e={}){let{lineCounter:r,prettyErrors:n}=EO(e),s=new xO.Parser(r?.addNewLine),o=new kO.Composer(e),i=Array.from(o.compose(s.parse(t)));if(n&&r)for(let a of i)a.errors.forEach(fc.prettifyError(t,r)),a.warnings.forEach(fc.prettifyError(t,r));return i.length>0?i:Object.assign([],{empty:!0},o.streamInfo())}function TO(t,e={}){let{lineCounter:r,prettyErrors:n}=EO(e),s=new xO.Parser(r?.addNewLine),o=new kO.Composer(e),i=null;for(let a of o.compose(s.parse(t),!0,t.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new fc.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(i.errors.forEach(fc.prettifyError(t,r)),i.warnings.forEach(fc.prettifyError(t,r))),i}function m3(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let s=TO(t,r);if(!s)return null;if(s.warnings.forEach(o=>d3.warn(s.options.logLevel,o)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function g3(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(t===void 0){let{keepUndefined:s}=r??e??{};if(!s)return}return f3.isDocument(t)&&!n?t.toString(r):new u3.Document(t,n,r).toString(r)}pc.parse=m3;pc.parseAllDocuments=h3;pc.parseDocument=TO;pc.stringify=g3});var kr=_(Se=>{"use strict";var y3=Py(),_3=sc(),v3=cy(),Uy=ac(),w3=Za(),Qn=pe(),b3=Wn(),S3=Ye(),$3=Gn(),k3=Yn(),x3=af(),E3=Ly(),T3=qy(),P3=Zy(),df=PO(),OO=La();Se.Composer=y3.Composer;Se.Document=_3.Document;Se.Schema=v3.Schema;Se.YAMLError=Uy.YAMLError;Se.YAMLParseError=Uy.YAMLParseError;Se.YAMLWarning=Uy.YAMLWarning;Se.Alias=w3.Alias;Se.isAlias=Qn.isAlias;Se.isCollection=Qn.isCollection;Se.isDocument=Qn.isDocument;Se.isMap=Qn.isMap;Se.isNode=Qn.isNode;Se.isPair=Qn.isPair;Se.isScalar=Qn.isScalar;Se.isSeq=Qn.isSeq;Se.Pair=b3.Pair;Se.Scalar=S3.Scalar;Se.YAMLMap=$3.YAMLMap;Se.YAMLSeq=k3.YAMLSeq;Se.CST=x3;Se.Lexer=E3.Lexer;Se.LineCounter=T3.LineCounter;Se.Parser=P3.Parser;Se.parse=df.parse;Se.parseAllDocuments=df.parseAllDocuments;Se.parseDocument=df.parseDocument;Se.stringify=df.stringify;Se.visit=OO.visit;Se.visitAsync=OO.visitAsync});var RO={};We(RO,{PROJECT_MANIFEST_FILE:()=>xe,buildManifestPayload:()=>By,createProjectId:()=>Vy,findProjectRoot:()=>Xe,readProjectId:()=>Fs,renderManifest:()=>Ky});import{randomUUID as O3}from"node:crypto";import{readFileSync as IO}from"node:fs";import{dirname as I3,join as NO,resolve as N3}from"node:path";var ff,xe,CO,C3,R3,Vy,By,Ky,Xe,Fs,lt=$(()=>{"use strict";ff=Fe(kr(),1),xe="pix3project.yaml",CO="projectId",C3="1.0.0",R3=t=>{switch(t){case"mobile":return{antialias:!1,shadows:!1,maxPixelRatio:2};case"desktop":return{antialias:!0,shadows:!0,maxPixelRatio:3};case"universal":return{antialias:!0,shadows:!0,maxPixelRatio:2}}},Vy=()=>O3(),By=(t,e)=>({version:C3,defaultExportScenePath:t.entryScenePath,viewportBaseSize:{width:Math.max(64,t.viewport.width),height:Math.max(64,t.viewport.height)},ambientOcclusion:"baked",textureFiltering:"linear",projectType:t.projectType,targetPlatform:t.targetPlatform,quality:R3(t.targetPlatform),metadata:{projectName:e.projectName,templateId:t.id,[CO]:e.projectId},autoloads:[]}),Ky=t=>(0,ff.stringify)(t,{indent:2}),Xe=t=>{let e=N3(t);for(;;)try{return IO(NO(e,xe)),e}catch{let r=I3(e);if(r===e)return null;e=r}},Fs=t=>{try{let e=(0,ff.parse)(IO(NO(t,xe),"utf8"));if(!e||typeof e!="object")return null;let r=e,s=(r.metadata&&typeof r.metadata=="object"?r.metadata:{})[CO];return typeof s=="string"&&s.trim()?s.trim():typeof r.id=="string"&&r.id.trim()?r.id.trim():null}catch{return null}}});import{existsSync as A3,readFileSync as z3}from"node:fs";import{dirname as Hy,join as AO}from"node:path";import{fileURLToPath as j3}from"node:url";var M3,L3,pf,Wt,D3,hf,Zs=$(()=>{"use strict";M3="@pix3/cli",L3=t=>{try{return JSON.parse(z3(t,"utf8")).name===M3}catch{return!1}},Wt=()=>{if(pf!==void 0)return pf;let t=Hy(j3(import.meta.url)),e=t;for(;;){let r=AO(e,"package.json");if(A3(r)&&L3(r))return pf=e;let n=Hy(e);if(n===e)break;e=n}return pf=Hy(t)},D3=()=>import.meta.url.endsWith(".ts"),hf=t=>D3()?null:AO(Wt(),"dist",t,"prebuilt")});import{readFileSync as q3}from"node:fs";import{join as F3}from"node:path";var Z3,be,ar=$(()=>{"use strict";Zs();Z3=()=>{try{let t=q3(F3(Wt(),"package.json"),"utf8"),e=JSON.parse(t);return typeof e.version=="string"?e.version:"0.0.0"}catch{return"0.0.0"}},be=Z3()});var ZO={};We(ZO,{MCP_CONFIG_FILE:()=>gn,isDevCheckout:()=>qO,mcpConfigStep:()=>Jy,mcpLaunch:()=>Jo,renderMcpConfig:()=>mf,setupInstructions:()=>K3,writeMcpConfig:()=>FO});import{existsSync as Wy,readFileSync as U3,writeFileSync as V3}from"node:fs";import{dirname as zO,join as LO}from"node:path";import{fileURLToPath as B3}from"node:url";var gn,DO,qO,Jo,mf,FO,Jy,jO,MO,K3,gf=$(()=>{"use strict";ar();gn=".mcp.json",DO=()=>{try{return B3(new URL("./index.ts",import.meta.url))}catch{return null}},qO=()=>{if(process.env.PIX3_CLI_DEV==="1")return!0;if(process.env.PIX3_CLI_DEV==="0")return!1;let t=DO();if(!t)return!1;let e=zO(zO(t));return Wy(t)&&import.meta.url.endsWith(".ts")&&Wy(LO(e,"..","pix3-runtime","package.json"))},Jo=(t={})=>{let e=t.dev??qO(),r=["mcp","--workspace",...t.projectDir?["--project",t.projectDir]:[]],n=e?DO():null;return n?{command:"node",args:[n,...r]}:{command:"npx",args:["-y",`@pix3/cli@${be}`,...r]}},mf=(t,e)=>{let r={};if(e)try{let s=JSON.parse(e);s&&typeof s=="object"&&!Array.isArray(s)&&(r=s)}catch{r={}}let n=r.mcpServers&&typeof r.mcpServers=="object"&&!Array.isArray(r.mcpServers)?r.mcpServers:{};return JSON.stringify({...r,mcpServers:{...n,pix3:{command:t.command,args:t.args}}},null,2)+`
|
|
142
|
+
`},FO=(t,e={})=>{let r=LO(t,gn),n=Wy(r)?U3(r,"utf8"):void 0;return V3(r,mf(Jo({dev:e.dev}),n)),gn},Jy=(t={})=>e=>[FO(e.dir,t)],jO=t=>/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,MO=t=>JSON.stringify(t),K3=(t,e,r={})=>{let n=[];if(t===null||t==="claude"){let s=Jo({dev:r.dev});n.push("Claude Code \u2014 run inside the project folder:","",` cd ${jO(e)}`,` claude mcp add pix3 -- ${[s.command,...s.args].map(jO).join(" ")}`,"",` (or commit the project's ${gn}; \`pix3 new\` writes one.)`,"")}if(t===null||t==="codex"){let s=Jo({dev:r.dev,projectDir:e});n.push("Codex \u2014 add to ~/.codex/config.toml:",""," [mcp_servers.pix3]",` command = ${MO(s.command)}`,` args = [${s.args.map(MO).join(", ")}]`," # game_run can take longer than the default tool timeout"," tool_timeout_sec = 180","")}return n.push("Then start `pix3 serve` in the project, connect the Pix3 editor to it (File \u2192 Connect to","Workspace\u2026), and start the agent in the project folder.",""),n.join(`
|
|
143
|
+
`)}});var bf={};We(bf,{RUNTIME_TYPES_FORMAT:()=>Us,buildRuntimeTypes:()=>iI,ensureRuntimeTypes:()=>bK,expandRuntimeTypes:()=>aI,packRuntimeTypes:()=>vK,readRuntimeTypesManifest:()=>_c,repoRuntimePackage:()=>Xo,runtimeSourceStamp:()=>vc,runtimeTypesArchive:()=>wf,runtimeTypesDir:()=>Yo});import{spawnSync as fK}from"node:child_process";import{createHash as pK}from"node:crypto";import{cpSync as Qy,existsSync as e_,mkdirSync as yf,mkdtempSync as hK,readdirSync as rI,readFileSync as vf,renameSync as mK,rmSync as mc,statSync as gK,writeFileSync as gc}from"node:fs";import{createRequire as nI}from"node:module";import{tmpdir as sI}from"node:os";import{dirname as yc,join as Pe,relative as oI,sep as yK}from"node:path";var Us,_f,Yo,wf,Xo,t_,_c,r_,vc,_K,iI,vK,wK,aI,bK,wc=$(()=>{"use strict";Zs();ar();Us=1,_f=()=>Wt(),Yo=()=>Pe(_f(),"runtime-types"),wf=()=>Pe(_f(),"dist","runtime-types.json"),Xo=()=>{let t=Pe(_f(),"..","pix3-runtime");return e_(Pe(t,"tsconfig.types.json"))&&e_(Pe(_f(),"scripts","build-runtime-types.mjs"))?t:null},t_=t=>{try{return JSON.parse(vf(t,"utf8"))}catch{return null}},_c=(t=Yo())=>t_(Pe(t,"manifest.json")),r_=(t,e=[])=>{for(let r of rI(t,{withFileTypes:!0})){let n=Pe(t,r.name);r.isDirectory()?r_(n,e):r.isFile()&&e.push(n)}return e},vc=t=>{let e=pK("sha256");e.update(`${be}
|
|
144
|
+
`);for(let n of["tsconfig.json","tsconfig.types.json","package.json"])e.update(vf(Pe(t,n)));let r=r_(Pe(t,"src")).filter(n=>n.endsWith(".ts")&&!n.endsWith(".spec.ts")).sort();for(let n of r){let s=gK(n);e.update(`${oI(t,n)}:${s.size}:${Math.trunc(s.mtimeMs)}
|
|
145
|
+
`)}return e.digest("hex")},_K=t=>{let e=nI(Pe(t,"package.json"));return yc(e.resolve("@types/three/package.json"))},iI=(t={})=>{let e=Xo();if(!e)throw new Error("runtime types can only be built from a checkout of the pix3 repo");let r=t.outDir??Yo(),n=nI(import.meta.url),s=Pe(yc(n.resolve("typescript/package.json")),"bin","tsc"),o=hK(Pe(sI(),"pix3-runtime-types-"));try{let i=Pe(o,"emit"),a=fK(process.execPath,[s,"-p",Pe(e,"tsconfig.types.json"),"--outDir",i],{encoding:"utf8"});if(a.status!==0)throw new Error(`tsc -p packages/pix3-runtime/tsconfig.types.json failed:
|
|
146
|
+
${a.stdout}${a.stderr}`);let c=t_(Pe(e,"package.json"))?.version??"0.0.0",l=_K(e),u=t_(Pe(l,"package.json"))?.version??"0.0.0",d=Pe(o,"out"),f=Pe(d,"@pix3","runtime");Qy(i,f,{recursive:!0}),gc(Pe(f,"package.json"),`${JSON.stringify({name:"@pix3/runtime",version:c,types:"index.d.ts"},null,2)}
|
|
147
|
+
`);let p=Pe(d,"@types","three");yf(p,{recursive:!0});for(let h of rI(l))h!=="node_modules"&&Qy(Pe(l,h),Pe(p,h),{recursive:!0});let m={format:Us,cliVersion:be,runtimeVersion:c,threeTypesVersion:u,sourceStamp:vc(e),builtAt:new Date().toISOString()};return gc(Pe(d,"manifest.json"),`${JSON.stringify(m,null,2)}
|
|
148
|
+
`),mc(r,{recursive:!0,force:!0}),yf(yc(r),{recursive:!0}),Qy(d,r,{recursive:!0}),t.log?.(`runtime types ${c} (+ @types/three ${u}) -> ${r}`),m}finally{mc(o,{recursive:!0,force:!0})}},vK=(t=Yo(),e=wf())=>{let r=_c(t);if(!r)throw new Error(`${t} has no manifest.json: build the runtime types first`);let n=r_(t).map(i=>oI(t,i).split(yK).join("/")).filter(i=>i!=="manifest.json").sort().map(i=>{let a=vf(Pe(t,i)),c=a.toString("utf8");if(!Buffer.from(c,"utf8").equals(a))throw new Error(`runtime types: ${i} is not UTF-8 text and cannot be archived`);return[i,c]}),o=JSON.stringify({format:Us,manifest:r,files:n});return yf(yc(e),{recursive:!0}),gc(e,o),{files:n.length,bytes:Buffer.byteLength(o)}},wK=(t,e)=>{let r=`${e}.tmp-${process.pid}-${Date.now()}`;mc(r,{recursive:!0,force:!0});try{for(let[n,s]of t.files){let o=Pe(r,...n.split("/"));yf(yc(o),{recursive:!0}),gc(o,s)}gc(Pe(r,"manifest.json"),`${JSON.stringify(t.manifest,null,2)}
|
|
149
|
+
`),mc(e,{recursive:!0,force:!0}),mK(r,e)}catch(n){if(mc(r,{recursive:!0,force:!0}),_c(e)?.sourceStamp===t.manifest.sourceStamp)return;throw n}},aI=(t=wf(),e=Yo())=>{if(!e_(t))return null;let r=JSON.parse(vf(t,"utf8"));if(r.format!==Us)throw new Error(`${t}: runtime types archive format ${r.format}, expected ${Us}`);let n=Pe(sI(),`pix3-cli-runtime-types-${r.manifest.cliVersion}-${r.manifest.sourceStamp.slice(0,12)}`);for(let s of[e,n]){if(_c(s)?.sourceStamp===r.manifest.sourceStamp)return{dir:s,manifest:r.manifest};try{return wK(r,s),{dir:s,manifest:r.manifest}}catch(o){if(s===n)throw o}}return null},bK=(t={})=>{let e=Yo(),r=Xo(),n=_c(e);if(r)return n&&n.format===Us&&n.sourceStamp===vc(r)?{dir:e,manifest:n}:(t.log?.("Building the @pix3/runtime type declarations from the repo sources\u2026"),{dir:e,manifest:iI({log:t.log})});if(n?.format===Us&&n.cliVersion===be)return{dir:e,manifest:n};let s=aI();if(s)return s;if(!n)throw new Error(`${wf()} is missing: this @pix3/cli package was published without its runtime types.`);return{dir:e,manifest:n}}});var s_,o_,Sf,cI,Qo,SK,$K,kK,xK,n_,EK,$f,i_=$(()=>{"use strict";s_=new Set(["play_start","play_restart","game_run"]),o_=new Set(["play_status","game_input","game_observe","viewport_screenshot","read_errors","read_logs"]),Sf=["project_status","play_start","play_stop","play_restart","play_status","game_run","game_input","game_observe","read_errors","read_logs","viewport_screenshot","generate_asset","generate_sfx","get_selection"],cI=["disk_differs_from_agent","sync_timeout","load_failed","pending_external","no_editor","permission_denied","no_workspace_server"],Qo={type:"object",properties:{},additionalProperties:!1},SK={type:"object",description:'sha256 (lowercase hex of the RAW BYTES) of every project file you wrote since your last run, keyed by project-relative path, e.g. {"scenes/main.pix3scene": "ab12\u2026"}. The run starts only if the disk holds exactly these versions (else `disk_differs_from_agent`, with a recovery copy when one exists). Omit only when you wrote nothing; the answer then says `agentExpectations: "none"`.',additionalProperties:{type:"string",pattern:"^[0-9a-f]{64}$"}},$K=" Runs through the sync barrier first: checks `expect` against the disk, stops play, makes the editor load the current files and verifies its hashes against the disk, then starts; the answer carries `revision`, `startupMs`, `matchesAgent`, `matchesDisk` and `changedDuringRun`.",kK=" Does not stop or resync the game: the answer carries the `revision` the running game started from and `stale: true` when the disk moved since (use play_restart to pick new files up).",xK={project_status:{name:"project_status",description:"Whether a Pix3 editor window is connected to this project, what it has open, external versions it has not applied yet, unreadable files, merge conflicts and the latest merge-log entries (why a write of yours did not land as written).",inputSchema:Qo},play_start:{name:"play_start",description:"Enter play mode. Without `scene` plays the active scene; `scene` (res:// or project-relative .pix3scene) plays that one.",inputSchema:{type:"object",properties:{scene:{type:"string",description:"Scene to play (optional)."},reload:{type:"boolean",description:"Re-read the scene from disk first."}},additionalProperties:!1}},play_stop:{name:"play_stop",description:"Exit play mode.",inputSchema:Qo},play_restart:{name:"play_restart",description:"Restart play mode.",inputSchema:Qo},play_status:{name:"play_status",description:"Whether the game is playing, and what the last frame drew (draw calls, visible meshes).",inputSchema:Qo},game_run:{name:"game_run",description:"Run the game frame by frame until a predicate holds (`until`, OR), fails (`fail`) or a budget runs out, or run a stored routine from design/tests/routines (`routine`, `args`). Read `verdict` first. Starts play mode when it is not running.",inputSchema:{type:"object",properties:{until:{type:"array",items:{type:"object"}},fail:{type:"array",items:{type:"object"}},watch:{type:"array",items:{type:"string"}},maxFrames:{type:"integer"},maxWallMs:{type:"integer"},routine:{type:"string"},args:{type:"object"}},additionalProperties:!0}},game_input:{name:"game_input",description:"Send real input to the running game (steps: tap / key / keys / drag / hover / invoke / wait) and report the reaction; `observe` watches nodes over the window. Read `verdict` first.",inputSchema:{type:"object",properties:{steps:{type:"array",items:{type:"object"}},observe:{type:"array",items:{type:"string"}},expect:{type:"object"}},required:["steps"],additionalProperties:!0}},game_observe:{name:"game_observe",description:"Read live node state of the running game (by name or id) without sending input.",inputSchema:{type:"object",properties:{},additionalProperties:!0}},read_errors:{name:"read_errors",description:"Recent runtime errors captured in the editor (console.error, window errors, rejections).",inputSchema:Qo},read_logs:{name:"read_logs",description:"Recent editor log entries; `since` (epoch ms) returns only newer ones.",inputSchema:{type:"object",properties:{since:{type:"number"}},additionalProperties:!1}},viewport_screenshot:{name:"viewport_screenshot",description:'A screenshot as an image: the running game while playing, else the editor viewport. `frame: "all" | "selection" | "node"` (+ `nodeId`) aims the editor camera temporarily.',inputSchema:{type:"object",properties:{maxSize:{type:"integer"},source:{type:"string",enum:["auto","game","editor"]},frame:{type:"string",enum:["current","all","selection","node"]},nodeId:{type:"string"},isolate:{type:"boolean"},padding:{type:"number"},visualReason:{type:"string"}},additionalProperties:!1}},generate_asset:{name:"generate_asset",description:"Generate an image with the editor's configured image provider (the user's keys \u2014 the editor asks the user to allow this for the session), post-process it and save it into the project.",inputSchema:{type:"object",properties:{prompt:{type:"string"},name:{type:"string",description:'Target file, e.g. "sprites/car.png".'},transparent:{type:"boolean"},postProcess:{type:"string",enum:["sprite","icon","texture","none"]},width:{type:"integer"},height:{type:"integer"},providerId:{type:"string"}},required:["prompt","name"],additionalProperties:!0}},generate_sfx:{name:"generate_sfx",description:"Generate a prototype sound effect (WAV under res://sfx/) with the editor's LLM (asks the user to allow this for the session). Not for music, ambience or voice.",inputSchema:{type:"object",properties:{prompt:{type:"string"},name:{type:"string"},soundline:{type:"string"},feedback:{type:"string"},save:{type:"boolean"}},required:["prompt"],additionalProperties:!0}},get_selection:{name:"get_selection",description:"What the human has selected in the editor right now (node ids, primary, hovered).",inputSchema:Qo}},n_=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:null,EK=t=>{let e=n_(t.properties)??{};return{...t,type:"object",properties:{...e,expect:SK}}},$f=t=>{let e=new Map;for(let r of t??[]){let n=n_(r);if(!n||typeof n.name!="string"||!Sf.includes(n.name))continue;let s=n_(n.inputSchema);s&&e.set(n.name,{name:n.name,description:typeof n.description=="string"?n.description:"",inputSchema:s})}return Sf.map(r=>{let n=e.get(r)??xK[r];return s_.has(r)?{name:r,description:n.description+$K,inputSchema:EK(n.inputSchema)}:o_.has(r)?{...n,description:n.description+kK}:n})}});var lI,kf,uI=$(()=>{"use strict";lI="kit.json",kf="files"});var dI=_(()=>{throw new Error("src\\kit\\generate.ts is only available in a checkout of the pix3 repo (the published @pix3/cli ships its bundles prebuilt)")});var fI=_(()=>{throw new Error("src\\kit\\core-components.ts is only available in a checkout of the pix3 repo (the published @pix3/cli ships its bundles prebuilt)")});var wI={};We(wI,{buildKitFromCheckout:()=>vI,ensureKit:()=>l_,isKitCheckout:()=>mI,kitDir:()=>a_,kitInputsStamp:()=>c_,kitMcpErrorCodes:()=>_I,kitMcpTools:()=>yI,kitSrcDir:()=>Ef,repoRootOfCheckout:()=>Tf});import{createHash as TK}from"node:crypto";import{existsSync as pI,readdirSync as PK,readFileSync as bc}from"node:fs";import{join as Ct,relative as OK,sep as IK}from"node:path";var xf,a_,Ef,Tf,mI,NK,gI,yI,_I,c_,CK,vI,l_,u_=$(()=>{"use strict";Zs();wc();ar();i_();uI();xf=()=>Wt(),a_=()=>Ct(xf(),"kit"),Ef=()=>Ct(xf(),"kit-src"),Tf=()=>Ct(xf(),"..",".."),mI=()=>pI(Ef())&&pI(Ct(Tf(),"docs","pix3-specification.md"))&&Xo()!==null,NK=/\{\{include:([^#@|}]+)/g,gI=(t,e=t)=>{let r=[];for(let n of PK(e,{withFileTypes:!0})){let s=Ct(e,n.name);n.isDirectory()?r.push(...gI(t,s)):n.isFile()&&r.push(OK(t,s).split(IK).join("/"))}return r.sort()},yI=()=>$f(null).map(t=>({name:t.name,summary:t.description.split(/(?<=\.)\s/)[0]??t.description})),_I=()=>[...cI],c_=()=>{let t=TK("sha256");t.update(`${1}:${be}
|
|
150
|
+
`);let e=Ef(),r=Tf(),n=new Set;for(let i of gI(e)){let a=bc(Ct(e,i),"utf8");t.update(`${i}
|
|
151
|
+
`).update(a);for(let c of a.matchAll(NK))n.add(c[1].trim())}for(let i of[...n].sort()){t.update(`${i}
|
|
152
|
+
`);try{t.update(bc(Ct(r,i)))}catch{t.update("(missing)")}}let s=Ct(xf(),"src","kit");for(let i of["generate.ts","kit-format.ts","core-components.ts","kit-source.ts"])t.update(bc(Ct(s,i)));t.update(bc(Ct(s,"..","workspace-agent","tools.ts")));let o=Xo();return o&&t.update(vc(o)),t.digest("hex")},CK=t=>{try{return JSON.parse(bc(Ct(t,lI),"utf8"))}catch{return null}},vI=async(t={})=>{let{generateKit:e}=await Promise.resolve().then(()=>Fe(dI(),1)),r=t.coreComponents??await(await Promise.resolve().then(()=>Fe(fI(),1))).loadCoreComponentsFromSource();return e({repoRoot:Tf(),kitSrcDir:Ef(),outDir:t.outDir??a_(),version:be,coreComponents:r,mcpTools:yI(),mcpErrorCodes:_I(),inputsStamp:t.stamp??c_()})},l_=async(t={})=>{let e=a_(),r=CK(e);if(mI()){let n=c_();if(r&&r.format===1&&r.inputsStamp===n)return{dir:e,filesDir:Ct(e,kf),manifest:r};t.log?.("Generating the agent kit from the repo sources\u2026");let s=await vI({stamp:n});return{dir:e,filesDir:Ct(e,kf),manifest:s}}if(!r)throw new Error(`${e} is missing: this @pix3/cli package was published without its kit.`);return{dir:e,filesDir:Ct(e,kf),manifest:r}}});import{cpSync as RK,existsSync as SI,mkdirSync as AK,readFileSync as f_,rmSync as zK,writeFileSync as bI}from"node:fs";import{join as yn}from"node:path";var d_,Vs,ts,p_,$I,ei,jK,Pf,Of,If=$(()=>{"use strict";d_=".pix3/types",Vs=".pix3/tsconfig.check.json",ts="tsconfig.json",p_=`{ "extends": "./.pix3/tsconfig.check.json" }
|
|
153
|
+
`,$I=`// Written by @pix3/cli (pix3 kit / pix3 check); replaced when the CLI version changes.
|
|
154
|
+
// Type-checks the project's scripts against the @pix3/runtime declarations in ./types/.
|
|
155
|
+
{
|
|
156
|
+
"compilerOptions": {
|
|
157
|
+
"target": "ES2022",
|
|
158
|
+
"module": "ESNext",
|
|
159
|
+
"moduleResolution": "bundler",
|
|
160
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
161
|
+
"strict": true,
|
|
162
|
+
"noEmit": true,
|
|
163
|
+
"skipLibCheck": true,
|
|
164
|
+
"isolatedModules": true,
|
|
165
|
+
"allowImportingTsExtensions": true,
|
|
166
|
+
"typeRoots": ["./types/@types"],
|
|
167
|
+
"paths": {
|
|
168
|
+
"@pix3/runtime": ["./types/@pix3/runtime/index.d.ts"],
|
|
169
|
+
"three": ["./types/@types/three/index.d.ts"],
|
|
170
|
+
"three/*": ["./types/@types/three/*"]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"include": ["../scripts/**/*.ts", "../src/scripts/**/*.ts"]
|
|
174
|
+
}
|
|
175
|
+
`,ei=t=>{let e=yn(t,ts);if(!SI(e))return!1;try{return f_(e,"utf8").trim()!==p_.trim()}catch{return!0}},jK=t=>{try{return JSON.parse(f_(yn(t,d_,"version.json"),"utf8"))}catch{return null}},Pf=(t,e)=>{let r=jK(t);return r!==null&&r.cliVersion===e.cliVersion&&r.sourceStamp===e.sourceStamp&&SI(yn(t,Vs))&&f_(yn(t,Vs),"utf8")===$I},Of=(t,e)=>{let r=yn(t,d_);zK(r,{recursive:!0,force:!0}),AK(r,{recursive:!0});for(let n of["@pix3","@types"])RK(yn(e.dir,n),yn(r,n),{recursive:!0});return bI(yn(r,"version.json"),`${JSON.stringify(e.manifest,null,2)}
|
|
176
|
+
`),bI(yn(t,Vs),$I),[`${d_}/`,Vs]}});var OI={};We(OI,{AGENTS_ALT_FILE:()=>rs,AGENTS_FILE:()=>cr,AGENTS_LINK_LINE:()=>y_,CLAUDE_FILE:()=>Ks,KIT_PROJECT_MANIFEST:()=>m_,PRECEDENCE_SENTENCE:()=>g_,agentKitStep:()=>BK,ensureGitignore:()=>EI,formatKitReport:()=>__,installKit:()=>Rf,readProjectKitManifest:()=>xI,withAltAgentsHeader:()=>PI,writeAgentKitMetadata:()=>TI});import{createHash as MK}from"node:crypto";import{existsSync as Nf,mkdirSync as LK,readFileSync as Bs,renameSync as DK,writeFileSync as qK}from"node:fs";import{dirname as FK,join as Hr}from"node:path";var kI,m_,cr,rs,Ks,h_,ZK,Cf,Sc,xI,ti,EI,TI,g_,y_,PI,UK,VK,Rf,BK,__,v_=$(()=>{"use strict";kI=Fe(kr(),1);lt();gf();If();m_=".pix3/kit-manifest.json",cr="AGENTS.md",rs="AGENTS.pix3.md",Ks="CLAUDE.md",h_=".gitignore",ZK=".pix3/",Cf=t=>MK("sha256").update(t).digest("hex"),Sc=t=>{try{return Bs(t,"utf8")}catch{return null}},xI=t=>{let e=Sc(Hr(t,m_));if(e===null)return null;try{let r=JSON.parse(e);return r&&typeof r.files=="object"&&r.files!==null?{format:1,version:String(r.version??""),files:r.files}:null}catch{return null}},ti=(t,e)=>{LK(FK(t),{recursive:!0});let r=`${t}.${process.pid}.tmp`;qK(r,e),DK(r,t)},EI=t=>{let e=Hr(t,h_),r=Sc(e)??"";if(r.split(/\r?\n/).map(o=>o.trim()).some(o=>[".pix3",".pix3/","/.pix3","/.pix3/",".pix3/*","/.pix3/*"].includes(o)))return!1;let s=r.length===0||r.endsWith(`
|
|
177
|
+
`)?r:`${r}
|
|
178
|
+
`;return ti(e,`${s}${s?`
|
|
179
|
+
`:""}# Pix3 editor + CLI bookkeeping (recovery journal, merge log, script types)
|
|
180
|
+
${ZK}
|
|
181
|
+
`),!0},TI=(t,e)=>{let r=Hr(t,xe),n=Sc(r);if(n===null)return!1;let s=(0,kI.parseDocument)(n),o={version:e.version,files:[...e.files]},i=s.toJS();return JSON.stringify(i?.metadata?.agentKit??null)===JSON.stringify(o)?!1:((!i?.metadata||typeof i.metadata!="object")&&s.set("metadata",s.createNode({})),s.setIn(["metadata","agentKit"],s.createNode(o)),ti(r,s.toString({indent:2})),!0)},g_="The project's own AGENTS.md wins on process (planning first, config placement); the Pix3 kit wins on Pix3 facts (YAML, runtime API, pix3 check).",y_=`See ${rs} for the Pix3 engine rules.`,PI=t=>{let e=["",`> **This project has its own \`${cr}\`; this file is the Pix3 kit beside it.** ${g_}`,`> If \`${cr}\` does not mention this file yet, add the line "${y_}" to it (agents that read only \`${cr}\` will not find this one otherwise).`,""].join(`
|
|
182
|
+
`),r=t.indexOf(`
|
|
183
|
+
`);return r<0?`${t}
|
|
184
|
+
${e}
|
|
185
|
+
`:`${t.slice(0,r+1)}${e}
|
|
186
|
+
${t.slice(r+1)}`},UK=t=>(Sc(t)??"").includes(rs),VK=t=>t===cr?`@AGENTS.md
|
|
187
|
+
`:`@AGENTS.md
|
|
188
|
+
@${rs}
|
|
189
|
+
`,Rf=(t,e,r={})=>{let n=xI(t),s={...n?.files??{}},o=[],i=[],a=[],c=(v,S)=>{let T=Hr(t,v),I=Cf(S),A=Nf(T)?Bs(T):null;if(A===null){ti(T,S),s[v]=I,o.push({path:v,action:"written"});return}let U=Cf(A);if(U===I){s[v]=I,o.push({path:v,action:"unchanged"});return}if(s[v]===U){r.update?(ti(T,S),s[v]=I,o.push({path:v,action:"updated"})):o.push({path:v,action:"outdated"});return}o.push({path:v,action:"skipped-edited"})},l=Hr(t,cr),u=!Nf(l)||s[cr]!==void 0&&s[cr]===Cf(Bs(l)),d=s[rs]!==void 0||!u?rs:cr;for(let v of e.manifest.files){let S=Bs(Hr(e.filesDir,v),"utf8");if(v===cr){let T=d===rs;c(d,T?PI(S):S),T&&!UK(l)&&i.push(`This project already has its own ${cr}: the Pix3 kit is in ${rs}. ${g_} Add a line "${y_}" to ${cr}.`);continue}if(v===Ks){let T=Hr(t,Ks),I=VK(d);if(!Nf(T)||s[Ks]===Cf(Bs(T))||Bs(T,"utf8")===I)c(Ks,I);else{let U=Bs(T,"utf8"),ae=`@${d}`;U.split(/\r?\n/).some(J=>J.trim()===ae)||i.push(`This project already has its own ${Ks}: add the line "${ae}" to it so Claude Code loads the Pix3 kit.`),o.push({path:Ks,action:"skipped-edited"})}continue}c(v,S)}let f=Hr(t,gn),p=Sc(f),m=mf(Jo({dev:r.devMcp}),p??void 0),h=(()=>{try{return!!(p?JSON.parse(p):null)?.mcpServers?.pix3}catch{return!1}})();p===m?o.push({path:gn,action:"unchanged"}):!h||r.update?(ti(f,m),o.push({path:gn,action:p===null?"written":"updated"})):o.push({path:gn,action:"outdated"}),EI(t)&&o.push({path:h_,action:"updated"});let g;if(ei(t))g="own-tsconfig",a.push(`${ts} is the project's own: pix3 check type-checks with it (against node_modules), .pix3/types is not written.`);else{if(!r.runtimeTypes)throw new Error("installKit: runtime types are required");Pf(t,r.runtimeTypes.manifest)?g="current":(Of(t,r.runtimeTypes),g="installed"),c(ts,p_)}let y=[...o.filter(v=>v.action!=="skipped-edited"&&v.path!==h_).map(v=>v.path)].sort(),w=o.filter(v=>v.action==="outdated"),b=w.length>0&&n?.version?n.version:e.manifest.version,x={format:1,version:b,files:Object.fromEntries(Object.entries(s).filter(([v])=>Nf(Hr(t,v))).sort(([v],[S])=>v<S?-1:1))};return ti(Hr(t,m_),`${JSON.stringify(x,null,2)}
|
|
190
|
+
`),TI(t,{version:b,files:y}),w.length>0&&a.push(`${w.length} kit file(s) are from another version and unchanged by you: pix3 kit --update replaces them.`),{version:b,files:o,instructions:i,notes:a,types:g}},BK=(t,e,r={})=>n=>Rf(n.dir,t,{runtimeTypes:e,devMcp:r.devMcp}).files.filter(o=>o.action==="written"||o.action==="updated").map(o=>o.path),__=(t,e)=>{let r=[`Pix3 agent kit ${t.version} in ${e}`],n={written:"wrote",updated:"updated",unchanged:"current","skipped-edited":"SKIPPED",outdated:"outdated"};for(let s of t.files){let o=s.action==="skipped-edited"?" (edited since the kit wrote it, or not the kit's; left as is)":s.action==="outdated"?" (pix3 kit --update replaces it)":"";r.push(` ${n[s.action].padEnd(8)} ${s.path}${o}`)}t.types==="installed"&&r.push(" wrote .pix3/types/, .pix3/tsconfig.check.json");for(let s of t.notes)r.push(`note: ${s}`);for(let s of t.instructions)r.push(`TODO: ${s}`);return`${r.join(`
|
|
191
|
+
`)}
|
|
192
|
+
`}});import{isAbsolute as KK,relative as HK,resolve as WK,sep as JK}from"node:path";var Af,II,NI=$(()=>{"use strict";Af=(t,e)=>{let r=HK(t,e);return r&&!r.startsWith("..")&&!KK(r)?r.split(JK).join("/"):e},II=(t,e,r)=>{let n=Date.now(),s=[],o=WK(e,r),i=Af(e,o),a=f=>{let p=t.flattenDiagnosticMessageText(f.messageText,`
|
|
193
|
+
`),m=`TS${f.code}`;if(f.file&&f.start!==void 0){let{line:h,character:g}=f.file.getLineAndCharacterOfPosition(f.start);return{file:Af(e,f.file.fileName),line:h+1,column:g+1,tsCode:m,message:p}}return{file:f.file?Af(e,f.file.fileName):i,tsCode:m,message:p}},c=[],l=t.getParsedCommandLineOfConfigFile(o,{noEmit:!0},{...t.sys,onUnRecoverableConfigFileDiagnostic:f=>c.push(f)});if(!l)return{tsconfig:i,files:[],errors:c.map(a),durationMs:Date.now()-n};let u=18003;for(let f of[...c,...l.errors])f.code!==u&&s.push(a(f));let d=l.fileNames.map(f=>Af(e,f)).sort();if(l.fileNames.length>0){let f=t.createProgram({rootNames:l.fileNames,options:{...l.options,noEmit:!0},projectReferences:l.projectReferences});for(let p of t.getPreEmitDiagnostics(f))s.push(a(p))}return{tsconfig:i,files:d,errors:s,durationMs:Date.now()-n}}});import{spawnSync as GK}from"node:child_process";import{existsSync as w_,mkdirSync as YK}from"node:fs";import{createRequire as CI}from"node:module";import{homedir as XK}from"node:os";import{join as Wr}from"node:path";import{fileURLToPath as QK,pathToFileURL as e6}from"node:url";var zf,ri,t6,r6,n6,s6,o6,i6,$c,RI,AI=$(()=>{"use strict";zf="5.8.3",ri=class extends Error{command;constructor(e,r){super(e),this.command=r}},t6=()=>Wr(XK(),".pix3","typescript"),r6=(t,e=zf)=>`npm install --prefix ${JSON.stringify(t)} typescript@${e} --no-save --no-package-lock --no-audit --no-fund --loglevel=error`,n6=t=>{try{return Wr(t.resolve("typescript/package.json"),"..")}catch{return null}},s6=t=>n6(CI(Wr(t,"__pix3_check__.js"))),o6=()=>{try{let t=import.meta.resolve("typescript");return Wr(QK(t),"..","..")}catch{return null}},i6=(t,e)=>{YK(t,{recursive:!0});let r=process.platform==="win32"?"npm.cmd":"npm",n=GK(r,["install","--prefix",t,`typescript@${e}`,"--no-save","--no-package-lock","--no-audit","--no-fund","--loglevel=error"],{encoding:"utf8",stdio:["ignore","pipe","pipe"],shell:process.platform==="win32"});return n.error?n.error.message:n.status!==0?(n.stderr||n.stdout||`exit ${n.status}`).trim():null},$c=async t=>{let r=CI(Wr(t,"package.json")).resolve("typescript"),n=await import(e6(r).href),s=n.default??n;if(typeof s.createProgram!="function")throw new Error(`${r} is not the TypeScript compiler API`);return{ts:s,version:s.version}},RI=async t=>{let e=process.env.PIX3_TYPESCRIPT;if(e){let{ts:c,version:l}=await $c(e);return{ts:c,version:l,source:"env",dir:e}}let r=s6(t.projectRoot);if(r)return{...await $c(r),source:"project",dir:r};let n=t.skipCliSibling?null:o6();if(n&&w_(Wr(n,"package.json")))return{...await $c(n),source:"cli",dir:n};let s=Wr(t.cacheRoot??t6(),zf),o=Wr(s,"node_modules","typescript"),i=r6(s);if(w_(Wr(o,"package.json")))return{...await $c(o),source:"cache",dir:o};if(t.offline)throw new ri(`TypeScript is not installed for pix3 check, and --offline forbids installing it. Run once:
|
|
194
|
+
${i}`,i);t.log?.(`pix3 check: installing TypeScript ${zf} once into ${s}
|
|
195
|
+
$ ${i}`);let a=(t.install??i6)(s,zf);if(a!==null||!w_(Wr(o,"package.json")))throw new ri(`Could not install TypeScript (${a??"npm reported success but nothing was installed"}). Run it yourself:
|
|
196
|
+
${i}`,i);return{...await $c(o),source:"installed",dir:o}}});var zI=_(()=>{throw new Error("src\\validate\\bundle.ts is only available in a checkout of the pix3 repo (the published @pix3/cli ships its bundles prebuilt)")});var S_={};We(S_,{runValidateCli:()=>f6,withValidateBundle:()=>DI});import{existsSync as a6,mkdtempSync as c6,rmSync as l6}from"node:fs";import{tmpdir as u6}from"node:os";import{join as b_}from"node:path";import{pathToFileURL as d6}from"node:url";var LI,jI,MI,DI,f6,$_=$(()=>{"use strict";Zs();LI="bundle-main.js",jI=()=>{try{return import.meta.resolve("esbuild")}catch{return}},MI=async t=>await import(d6(b_(t,LI)).href),DI=async t=>{let e=hf("validate");if(e&&a6(b_(e,LI)))return t(await MI(e),jI());let r=c6(b_(u6(),"pix3-validate-bundle-"));try{let{buildValidateBundle:n}=await Promise.resolve().then(()=>Fe(zI(),1));return await n(r),await t(await MI(r),jI())}finally{l6(r,{recursive:!0,force:!0})}},f6=t=>DI((e,r)=>e.runBundledValidate(t,{cwd:process.cwd(),stdout:n=>process.stdout.write(n),stderr:n=>process.stderr.write(n),esbuildSpecifier:r}))});var YI={};We(YI,{CHECK_CODES:()=>T_,CHECK_USAGE:()=>k_,MERGE_LOG_TAIL:()=>UI,checkProject:()=>GI,describeMergeLogEntry:()=>x_,formatCheckHuman:()=>WI,formatCheckJson:()=>JI,hasNodeModules:()=>BI,installedRuntimeVersion:()=>KI,readKitVersion:()=>VI,readMergeLogTail:()=>HI,runCheck:()=>S6});import{createHash as p6}from"node:crypto";import{existsSync as kc,readFileSync as jf}from"node:fs";import{dirname as FI,join as Hs,resolve as E_}from"node:path";var ZI,k_,T_,UI,h6,m6,g6,y6,_6,ni,VI,BI,KI,HI,v6,qI,x_,w6,WI,JI,b6,GI,S6,XI=$(()=>{"use strict";ZI=Fe(kr(),1);lt();If();ar();NI();AI();k_=`Usage: pix3 check [--json] [--no-hydrate] [--offline] [--project <dir>]
|
|
197
|
+
|
|
198
|
+
Everything \`pix3 validate\` checks, plus a TypeScript type-check of the project's scripts
|
|
199
|
+
(tsc --noEmit), the newest .pix3/merge-log.jsonl entries and a version check.
|
|
200
|
+
|
|
201
|
+
--json machine-readable report (diagnostics, sha256 of every checked file, typecheck,
|
|
202
|
+
mergeLog, kit)
|
|
203
|
+
--no-hydrate validate level 1 only (user: component properties not checked)
|
|
204
|
+
--offline never install TypeScript (fails with the command to run instead)
|
|
205
|
+
--project dir project root (default: nearest folder with pix3project.yaml)
|
|
206
|
+
`,T_={E_TYPE:{severity:"error",summary:"a TypeScript error in a project script"},E_DEPENDENCIES_MISSING:{severity:"error",summary:"the project has its own tsconfig.json but no node_modules: run npm install (the type-check was skipped)"},E_TYPECHECK_UNAVAILABLE:{severity:"error",summary:"TypeScript could not be found or installed, so the scripts were not type-checked"},W_RUNTIME_VERSION_MISMATCH:{severity:"warning",summary:"the project's own node_modules/@pix3/runtime is not this CLI's version"},W_RUNTIME_NOT_INSTALLED:{severity:"warning",summary:"the project has its own tsconfig.json and node_modules, but no node_modules/@pix3/runtime"},W_KIT_OUTDATED:{severity:"warning",summary:"the agent kit in this project was written by another CLI version"}},UI=10,h6=".pix3/merge-log.jsonl",m6=40,g6=t=>{let e=!1,r=!0,n=!1,s,o=!1;for(let i=0;i<t.length;i++){let a=t[i];if(a==="--json")e=!0;else if(a==="--no-hydrate")r=!1;else if(a==="--offline")n=!0;else if(a==="--help"||a==="-h")o=!0;else if(a==="--project"){if(s=t[++i],!s)return{error:"--project needs a folder"}}else if(a.startsWith("--project="))s=a.slice(10);else return{error:`unknown argument ${a}`}}return{json:e,hydrate:r,offline:n,project:s,help:o}},y6=async t=>{let{withValidateBundle:e}=await Promise.resolve().then(()=>($_(),S_));return e((r,n)=>r.validateBundledProject({...t,esbuildSpecifier:n}))},_6=t=>p6("sha256").update(jf(t)).digest("hex"),ni=(t,e)=>({severity:T_[t].severity,code:t,...e}),VI=t=>{try{let e=(0,ZI.parse)(jf(Hs(t,xe),"utf8")),n=(e&&typeof e=="object"?e.metadata:void 0)?.agentKit?.version;return typeof n=="string"?n:null}catch{return null}},BI=t=>{let e=E_(t);for(;;){if(kc(Hs(e,"node_modules")))return!0;let r=FI(e);if(r===e)return!1;e=r}},KI=t=>{let e=E_(t);for(;;){let r=Hs(e,"node_modules","@pix3","runtime","package.json");if(kc(r))try{let s=JSON.parse(jf(r,"utf8")).version;return typeof s=="string"?s:null}catch{return null}let n=FI(e);if(n===e)return null;e=n}},HI=(t,e=UI)=>{let r;try{r=jf(Hs(t,h6),"utf8")}catch{return[]}let n=[];for(let s of r.split(`
|
|
207
|
+
`))if(s.trim())try{let o=JSON.parse(s);o&&typeof o=="object"&&!Array.isArray(o)&&n.push(o)}catch{}return n.slice(-e)},v6=(t,e)=>{let r=typeof t=="string"?Date.parse(t):Number.NaN;if(!Number.isFinite(r))return"";let n=Math.max(0,Math.round((e.getTime()-r)/1e3));return n<90?`${n}s ago`:n<5400?`${Math.round(n/60)} min ago`:n<36*3600?`${Math.round(n/3600)} h ago`:`${Math.round(n/86400)} d ago`},qI=new Set(["ack-unknown"]),x_=(t,e)=>{let r=typeof t.file=="string"?t.file:"(project)",n=v6(t.at,e),s=`${n?`${n} `:""}${r} `;switch(t.event){case"merge":{let o=Array.isArray(t.decisions)?t.decisions:[],i=o.filter(u=>u&&typeof u=="object"&&u.kept==="human").length,a=o.filter(u=>u&&typeof u=="object"&&u.kept==="human-unchanged-by-agent").length,c=Array.isArray(t.conflicts)?t.conflicts.length:0;if(t.status==="rejected"){let u=Array.isArray(t.problems)?t.problems.join("; "):"";return`${s}REJECTED your version (${u||"unreadable"}); the editor kept its own. Fix the file and write it again.`}let l=[];return(i>0||c>0)&&l.push(`the editor KEPT ${Math.max(i,c)} human value(s) over yours \u2014 \`pix3 read ${r}\`, then write again if yours is still meant`),a>0&&l.push(`${a} human value(s) kept where your file carried the old value`),`${s}merged${l.length?`: ${l.join("; ")}`:" cleanly"}`}case"ack-applied":return`${s}your read confirmation was applied (released ${Array.isArray(t.released)?t.released.length:0} protected value(s))`;case"ack-unknown":return`${s}read confirmation for a version the editor has not recorded \u2014 ignored`;case"accept-agent":return`${s}the human accepted your version`;case"keep-mine":return`${s}the human kept their version over yours`;case"restore-version":return`${s}the human restored an earlier version`;case"reload":return`${s}reloaded your version`;default:return`${s}${String(t.event??"entry")}`}},w6=t=>{let e=`${t.file}${t.line!==void 0?`:${t.line}`:""}`,r=t.nodeId!==void 0?` [${t.nodeId}]`:"",n=`${e} ${t.severity} ${t.code}${r} ${t.message}
|
|
208
|
+
`;return t.path&&(n+=` at ${t.path}
|
|
209
|
+
`),t.fix&&(n+=` fix: ${t.fix}
|
|
210
|
+
`),n},WI=(t,e)=>{let r="",n=new Map,s=0;for(let u of t.diagnostics){let d=(n.get(u.code)??0)+1;if(n.set(u.code,d),d>m6){s+=1;continue}r+=w6(u)}s>0&&(r+=`\u2026 ${s} more (pix3 check --json lists them all)
|
|
211
|
+
`);for(let u of t.notes)r+=`note: ${u}
|
|
212
|
+
`;let o=t.mergeLog.filter(u=>qI.has(u.event)),i=t.mergeLog.filter(u=>!qI.has(u.event));for(let u of o)r+=`note: ${x_(u,e)}
|
|
213
|
+
`;if(i.length>0){r+=`merge-log (newest ${i.length}, .pix3/merge-log.jsonl):
|
|
214
|
+
`;for(let u of i)r+=` ${x_(u,e)}
|
|
215
|
+
`}let a=t.typecheck,c=a.typescript?`typecheck ${a.files} file(s) with TypeScript ${a.typescript.version} (${a.typescript.source}, ${a.tsconfig}): ${a.errors} error(s)`:a.skipped?`typecheck skipped: ${a.skipped}`:"typecheck did not run",l=t.level2.state==="ran"?`level 2 hydrated ${t.level2.filesHydrated} file(s)`:t.level2.state==="disabled"?"level 2 off":`level 2 skipped: ${t.level2.reason}`;return r+=`${c}; ${l}.
|
|
216
|
+
`,t.kit.version===null&&(r+=`kit: none in this project (pix3 kit installs it).
|
|
217
|
+
`),r+=`${t.errorCount===0?"OK":"FAILED"}: ${t.files.length} file(s) checked, ${t.errorCount} error(s), ${t.warningCount} warning(s) in ${t.timingsMs.total} ms.
|
|
218
|
+
`,r},JI=t=>`${JSON.stringify(t,null,2)}
|
|
219
|
+
`,b6=(t,e)=>t.file.localeCompare(e.file)||(t.line??0)-(e.line??0)||t.code.localeCompare(e.code),GI=async(t,e)=>{let r=Date.now(),s=await(e.validate??y6)({projectRoot:t,hydrate:e.hydrate}),o=Date.now()-r,i=[],a=[...s.notes],c=ei(t),l,u=null;if(c){l=ts;let S=KI(t);BI(t)?S===null?i.push(ni("W_RUNTIME_NOT_INSTALLED",{file:ts,message:`This project has its own tsconfig.json, so its scripts are type-checked against its own node_modules \u2014 and node_modules/@pix3/runtime is missing (this CLI ships ${be}).`,fix:"npm install in the project, then run pix3 check again"})):S!==be&&i.push(ni("W_RUNTIME_VERSION_MISMATCH",{file:"node_modules/@pix3/runtime/package.json",message:`The project type-checks against @pix3/runtime ${S}; this CLI (and its kit and validator) is ${be}. APIs the kit describes may be missing, or behave differently.`,fix:`npm install @pix3/runtime@${be}, or run the @pix3/cli@${S} that matches it`})):(u="dependencies not installed (run npm install)",i.push(ni("E_DEPENDENCIES_MISSING",{file:kc(Hs(t,"package.json"))?"package.json":ts,message:"This project has its own tsconfig.json, so its scripts are type-checked against its own node_modules \u2014 and there is no node_modules. The type-check was skipped; the scenes were still validated.",fix:"npm install"})))}else{l=Vs;let{ensureRuntimeTypes:S}=await Promise.resolve().then(()=>(wc(),bf)),T=S({log:e.log});Pf(t,T.manifest)||(Of(t,T),a.push(`Wrote the @pix3/runtime ${T.manifest.runtimeVersion} types to .pix3/types/ (and ${Vs}).`))}let d=Date.now(),f=null,p=null;if(u===null)try{f=await RI({projectRoot:t,offline:e.offline,log:e.log,...e.typescript}),p=II(f.ts,t,l)}catch(S){let T=S instanceof ri?S.command:void 0;i.push(ni("E_TYPECHECK_UNAVAILABLE",{file:l,message:S instanceof Error?S.message:String(S),fix:T}))}let m=Date.now()-d,h=(p?.errors??[]).map(S=>ni("E_TYPE",{file:S.file,line:S.line,message:`${S.tsCode}: ${S.message}`}));i.push(...h);let g=VI(t),y=g===be;g!==null&&!y&&i.push(ni("W_KIT_OUTDATED",{file:xe,path:"metadata.agentKit.version",message:`The agent kit here is ${g}; this CLI is ${be}.`,fix:"pix3 kit --update (it never overwrites kit files you edited)"}));let w=new Map;for(let S of s.files)w.set(S.file,S.sha256);for(let S of p?.files??[]){if(S.startsWith("/")||/^[A-Za-z]:/.test(S))continue;let T=Hs(t,S);!w.has(S)&&kc(T)&&w.set(S,_6(T))}let b=[...s.diagnostics,...[...i].sort(b6)],x=b.filter(S=>S.severity==="error").length,v=b.filter(S=>S.code==="E_TYPE"||S.code==="E_TYPECHECK_UNAVAILABLE"||S.code==="E_DEPENDENCIES_MISSING").length;return{ok:x===0,projectRoot:t,errorCount:x,warningCount:b.filter(S=>S.severity==="warning").length,level2:s.level2,files:[...w.entries()].sort(([S],[T])=>S<T?-1:S>T?1:0).map(([S,T])=>({file:S,sha256:T})),diagnostics:b,notes:a,typecheck:{ok:v===0,errors:v,tsconfig:l,mode:c?"project":"pix3-types",files:p?.files.length??0,typescript:f?{version:f.version,source:f.source}:null,skipped:u},mergeLog:HI(t),kit:{version:g,cliVersion:be,upToDate:y},timingsMs:{validate:o,typecheck:m,total:Date.now()-r}}},S6=async(t,e)=>{let r=g6(t);if("error"in r)return e.stderr(`pix3 check: ${r.error}
|
|
220
|
+
|
|
221
|
+
${k_}`),2;if(r.help)return e.stdout(`${k_}
|
|
222
|
+
Codes added to validate's (pix3 validate --help lists those):
|
|
223
|
+
${Object.entries(T_).map(([i,a])=>` ${i.padEnd(28)} ${a.summary}`).join(`
|
|
224
|
+
`)}
|
|
225
|
+
`),0;let n=r.project?E_(e.cwd,r.project):e.cwd,s=r.project?n:Xe(n);if(!s||!kc(Hs(s,xe)))return e.stderr(`pix3 check: no pix3project.yaml in ${n}${r.project?"":" or any parent folder"}. Run it inside a Pix3 project, or pass --project <dir>.
|
|
226
|
+
`),2;let o=await GI(s,{hydrate:r.hydrate,offline:r.offline,validate:e.validate,typescript:e.typescript,log:i=>e.stderr(`${i}
|
|
227
|
+
`)});return e.stdout(r.json?JI(o):WI(o,e.now?.()??new Date)),o.errorCount>0?1:0}});var QI={};We(QI,{runKitCli:()=>E6});import{existsSync as $6}from"node:fs";import{join as k6,resolve as x6}from"node:path";var E6,eN=$(()=>{"use strict";lt();If();v_();u_();E6=async t=>{let e=t.projectDir?x6(t.cwd,t.projectDir):t.cwd,r=t.projectDir?e:Xe(e);if(!r||!$6(k6(r,xe)))return process.stderr.write(`pix3 kit: no ${xe} in ${e}${t.projectDir?"":" or any parent folder"}. Run it inside a Pix3 project, or pass --project <dir>.
|
|
228
|
+
`),2;let n=a=>{process.stderr.write(`${a}
|
|
229
|
+
`)},s=await l_({log:n}),o=ei(r)?void 0:(await Promise.resolve().then(()=>(wc(),bf))).ensureRuntimeTypes({log:n}),i=Rf(r,s,{update:t.update,runtimeTypes:o});return process.stdout.write(__(i,r)),0}});var Jt,P_,tN,O_,rN,nN,sN,si,I_,Mf,oN,iN,aN,Lf,N_,cN,lN,xr=$(()=>{"use strict";Jt="127.0.0.1",P_=Array.from({length:10},(t,e)=>8490+e),tN=["https://editor.pix3.dev","http://localhost:8123","http://127.0.0.1:8123"],O_=".pix3/link",rN=1e4,nN=1e4,sN=25e3,si=6e4,I_=1,Mf=P_,oN=".pix3/workspace.json",iN=5e3,aN=1e4,Lf=1e4,N_=100,cN=1e4,lN=3e4});var M,C_,uN,R_,Jr,oi,T6,ii,Df,Gt,xc=$(()=>{"use strict";xr();M=class extends Error{status;code;extra;constructor(e,r,n,s={}){super(n),this.status=e,this.code=r,this.extra=s}},C_=t=>!!t&&typeof t=="object"&&!Array.isArray(t),uN=1024*1024,R_=(t,e=uN)=>new Promise((r,n)=>{let s=[],o=0;t.on("data",i=>{if(o+=i.length,o>e){n(new M(413,"too_large","Request body too large.")),t.destroy();return}s.push(i)}),t.on("end",()=>r(Buffer.concat(s).toString("utf8"))),t.on("error",n)}),Jr=async(t,e=uN)=>{let r=await R_(t,e);if(!r.trim())return{};try{let n=JSON.parse(r);if(C_(n))return n}catch{}throw new M(400,"bad_json","Body must be a JSON object.")},oi=t=>{let e=(t??"").trim().toLowerCase();if(!e)return!1;let r,n="";if(e.startsWith("[")){let s=e.indexOf("]");if(s<0)return!1;r=e.slice(0,s+1);let o=e.slice(s+1);if(o&&!o.startsWith(":"))return!1;n=o.slice(1)}else{let s=e.indexOf(":");if(r=s<0?e:e.slice(0,s),n=s<0?"":e.slice(s+1),s>=0&&!n)return!1}return n&&!/^\d{1,5}$/.test(n)?!1:r==="localhost"||r==="127.0.0.1"||r==="[::1]"},T6=/^http:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/,ii=t=>t===null||tN.includes(t)||T6.test(t),Df=t=>{let e=t.headers.origin;return typeof e=="string"?e:null},Gt=(t,e,r,n,s={})=>{if(t.writableEnded||t.destroyed)return;let o={"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...s};n&&(o["Access-Control-Allow-Origin"]=n,o.Vary="Origin"),t.writeHead(e,o),t.end(JSON.stringify(r))}});import{lstat as P6}from"node:fs/promises";import{join as dN}from"node:path";var Rt,O6,Er,A_,I6,_n,vn,N6,wn,Ec,qf=$(()=>{"use strict";xc();Rt=".pix3",O6=new Set(["workspace.json","serve.lock","tmp","link"]),Er=".pix3/ack.json",A_=t=>{let e=t.split("/");return e[0].toLowerCase()!==Rt?!1:e.length===1?!0:O6.has(e[1].toLowerCase())},I6=4096,_n=t=>new M(400,"bad_path",t),vn=(t,e="path")=>{if(typeof t!="string"||t.length===0)throw _n(`\`${e}\` must be a non-empty string.`);if(t.length>I6)throw _n(`\`${e}\` is too long.`);if(t.includes("\0"))throw _n(`\`${e}\` contains a NUL byte.`);if(t.includes("\\"))throw _n(`\`${e}\` must use "/" separators, not backslashes.`);if(t.startsWith("/"))throw _n(`\`${e}\` must be relative to the workspace root.`);if(/^[A-Za-z]:/.test(t))throw _n(`\`${e}\` must not carry a drive letter.`);let r=t.split("/");for(let n of r){if(n==="")throw _n(`\`${e}\` has an empty segment (leading, trailing or double "/").`);if(n==="."||n==="..")throw _n(`\`${e}\` must not contain "." or "..".`)}if(A_(t))throw new M(403,"reserved_path",`\`${Rt}\` itself and \`${Rt}/workspace.json\`, \`serve.lock\`, \`tmp/\` and \`link/\` belong to the server.`);return t},N6=t=>t&&typeof t=="object"&&"code"in t?String(t.code):void 0,wn=async(t,e,r)=>{let n=e.split("/"),s=t;for(let o=0;o<n.length;o++){s=dN(s,n[o]);let i=o===n.length-1,a;try{a=await P6(s)}catch(c){let l=N6(c);if(l==="ENOENT"){if(!r.allowMissing)throw new M(404,"not_found",`${e} does not exist.`);return{absolute:dN(t,...n),kind:null}}throw l==="ENOTDIR"?new M(409,"not_a_directory",`A parent of ${e} is not a directory.`):c}if(a.isSymbolicLink())throw new M(403,"symlink",`${e} goes through a symbolic link; the workspace server does not follow them.`);if(!i&&!a.isDirectory())throw new M(409,"not_a_directory",`A parent of ${e} is not a directory.`);if(i)return{absolute:s,kind:a.isFile()?"file":a.isDirectory()?"dir":"other"}}throw _n("Empty path.")},Ec=t=>{let e=t.lastIndexOf("/");return e<0?null:t.slice(0,e)}});import{createHash as C6,randomBytes as mN,randomUUID as R6,timingSafeEqual as A6}from"node:crypto";import{chmodSync as z6,existsSync as j6,mkdirSync as M6,readFileSync as z_,renameSync as L6,rmSync as fN,statSync as D6,writeFileSync as M_}from"node:fs";import{join as Zf}from"node:path";var q6,L_,gN,j_,pN,yN,Ws,F6,Tr,_N,vN,Ff,D_,wN,bN,hN,Z6,SN,Tc=$(()=>{"use strict";xr();qf();q6="p3ws_",L_=t=>Zf(t,...oN.split("/")),gN=t=>Zf(t,Rt),j_=t=>C6("sha256").update(t,"utf8").digest("hex"),pN=()=>`${q6}${mN(32).toString("base64url")}`,yN=(t,e)=>{if(!e||!t)return!1;let r=Buffer.from(j_(t),"hex"),n=Buffer.from(e.sha256,"hex");return r.length===n.length&&A6(r,n)},Ws=t=>typeof t=="string"&&t.length>0,F6=t=>{let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;let r=e;if(r.version!==1||!Ws(r.workspaceId)||!Ws(r.root))return null;let n=r.token,s=n&&typeof n=="object"&&Ws(n.sha256)&&Ws(n.issuedAt)?{sha256:n.sha256,issuedAt:n.issuedAt}:null,o=r.server,i=o&&typeof o=="object"&&typeof o.pid=="number"&&typeof o.port=="number"&&Ws(o.serverSession)&&Ws(o.control)&&Ws(o.startedAt)?{pid:o.pid,port:o.port,serverSession:o.serverSession,control:o.control,startedAt:o.startedAt}:null;return{version:1,workspaceId:r.workspaceId,root:r.root,token:s,server:i}},Tr=t=>{try{return F6(z_(L_(t),"utf8"))}catch{return null}},_N=t=>{try{let e=D6(L_(t),{bigint:!0});return`${e.mtimeNs}:${e.size}:${e.ino}`}catch{return null}},vN=t=>{let e=gN(t);M6(e,{recursive:!0,mode:448});let r=Zf(e,".gitignore");j6(r)||M_(r,`*
|
|
230
|
+
`,{mode:384})},Ff=(t,e)=>{vN(t);let r=L_(t),n=`${r}.${process.pid}.${mN(4).toString("hex")}.tmp`;M_(n,`${JSON.stringify(e,null,2)}
|
|
231
|
+
`,{mode:384}),z6(n,384),L6(n,r)},D_=(t,e)=>{let r=Tr(t),n=r!==null&&r.root!==t;if(!r||n){let s=pN(),o={version:1,workspaceId:R6(),root:t,token:{sha256:j_(s),issuedAt:new Date().toISOString()},server:null};return Ff(t,o),{state:o,issuedToken:s,minted:n?"moved":"new"}}if(e.rotateToken||r.token===null){let s=pN(),o={...r,token:{sha256:j_(s),issuedAt:new Date().toISOString()}};return Ff(t,o),{state:o,issuedToken:s,minted:null}}return{state:r,issuedToken:null,minted:null}},wN=(t,e)=>{let r=Tr(t);r&&Ff(t,{...r,server:e})},bN=(t,e)=>{let r=Tr(t);!r||r.server?.serverSession!==e||Ff(t,{...r,server:null})},hN=t=>Zf(gN(t),"serve.lock"),Z6=t=>{if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(e){return!!e&&typeof e=="object"&&"code"in e&&e.code==="EPERM"}},SN=t=>{vN(t);let e=hN(t);for(let r=0;r<2;r++){try{M_(e,`${process.pid}
|
|
232
|
+
`,{flag:"wx",mode:384});let s=!1;return{acquired:!0,release:()=>{if(!s){s=!0;try{z_(e,"utf8").trim()===String(process.pid)&&fN(e,{force:!0})}catch{}}}}}catch(s){if(!(s&&typeof s=="object"&&"code"in s&&s.code==="EEXIST"))throw s}let n=0;try{n=Number.parseInt(z_(e,"utf8").trim(),10)}catch{}if(n&&Z6(n))return{acquired:!1,pid:n};fN(e,{force:!0})}throw new Error(`Could not take ${hN(t)}; remove it if no pix3 serve is running.`)}});var Yt,ns,$N,U6,V6,q_,Uf,F_=$(()=>{"use strict";xr();Tc();Yt=class extends Error{root;constructor(e,r){super(`Workspace server is not running. Run \`pix3 serve\` in ${e}`+(r?` (${r})`:"")+", then open it in Pix3 (File \u2192 Connect to Workspace\u2026)."),this.root=e}},ns=class extends Error{status;code;body;constructor(e,r,n,s){super(n),this.status=e,this.code=r,this.body=s}},$N=2e3,U6=15e3,V6=5e3,q_=t=>!!t&&typeof t=="object"&&!Array.isArray(t),Uf=class{root;connection=null;identity;constructor(e,r){this.root=e,this.identity=r}reset(){this.connection=null}async status(){return await this.request("GET","/ws/agent/status")}async tools(){let e=await this.request("GET","/ws/agent/tools",void 0,8e3);return Array.isArray(e.tools)?e.tools:[]}async call(e,r,n=12e4){let s=await this.request("POST","/ws/agent/call",{name:e,input:r,timeoutMs:n,agent:this.identity()},n+V6);if(!q_(s.result)||!Array.isArray(s.result.content))throw new ns(502,"bad_editor_reply","The server sent no tool result.",s);return s.result}async presence(e=!1,r=$N){await this.request("POST","/ws/agent/presence",{agent:this.identity(),...e?{leaving:!0}:{}},r)}async hash(e){if(e.length===0)return{hashes:{},seq:(await this.revision()).seq};let r=await this.request("POST","/ws/agent/hash",{paths:e});return{hashes:q_(r.hashes)?r.hashes:{},seq:typeof r.seq=="number"?r.seq:0}}async expect(e){return await this.request("POST","/ws/agent/expect",{expect:e})}async changes(e){return await this.request("GET",`/ws/agent/changes?since=${Math.max(0,Math.floor(e))}`)}async revision(){let e=await this.request("GET","/ws/revision");return{revision:String(e.revision??""),seq:typeof e.seq=="number"?e.seq:0,serverSession:String(e.serverSession??"")}}async connect(){if(this.connection)return this.connection;let e=Tr(this.root);if(!e)throw new Yt(this.root,"no .pix3/workspace.json");let r=e.server;if(!r)throw new Yt(this.root);let n=`http://${Jt}:${r.port}`,s;try{let o=await fetch(`${n}/ws/agent/status`,{headers:{"X-Pix3-Control":r.control},signal:AbortSignal.timeout($N)});if(!o.ok)throw new Yt(this.root,`port ${r.port} answers ${o.status}; an older pix3 serve, or another process`);s=await o.json()}catch(o){throw o instanceof Yt?o:new Yt(this.root,`nothing answers on port ${r.port}`)}if(s.serverSession!==r.serverSession||s.workspaceId!==e.workspaceId)throw new Yt(this.root,"the recorded server is gone");return this.connection={base:n,control:r.control,serverSession:r.serverSession},this.connection}async request(e,r,n,s=U6){for(let o=0;;o++){let i=await this.connect(),a;try{a=await fetch(`${i.base}${r}`,{method:e,headers:{"X-Pix3-Control":i.control,...n!==void 0?{"Content-Type":"application/json"}:{}},body:n!==void 0?JSON.stringify(n):void 0,signal:AbortSignal.timeout(s)})}catch(u){if(this.connection=null,u instanceof Error&&u.name==="TimeoutError")throw new ns(504,"no_editor_reply","The workspace server did not answer in time.",{});if(o===0)continue;throw new Yt(this.root,"the connection dropped")}let c=await a.text(),l={};try{let u=c?JSON.parse(c):{};l=q_(u)?u:{}}catch{l={}}if(a.ok)return l;if(a.status===401&&o===0){this.connection=null;continue}throw new ns(a.status,typeof l.error=="string"?l.error:`http_${a.status}`,typeof l.message=="string"?l.message:`HTTP ${a.status}`,l)}}}});var B6,K6,H6,W6,Yr,J6,ai,Gr,Vf,G6,Y6,Bf,X6,Q6,kN,xN=$(()=>{"use strict";F_();i_();B6=5e3,K6=250,H6=1e5,W6=12e4,Yr=t=>!!t&&typeof t=="object"&&!Array.isArray(t),J6=t=>new Promise(e=>setTimeout(e,t)),ai=t=>JSON.stringify(t,null,2),Gr=(t,e,r={})=>({content:[{type:"text",text:ai({error:t,message:e,...r})}],isError:!0}),Vf=t=>{let e=t.content.flatMap(o=>o.type==="text"?[o.text]:[]),r=t.content.filter(o=>o.type==="image"),n=e.join(`
|
|
233
|
+
`),s=n;try{s=n?JSON.parse(n):null}catch{s=n}return{payload:s,images:r}},G6=t=>t.mergeLog?`The editor merged your write of ${t.path} with the human's manual edits (see .pix3/merge-log.jsonl). Re-read the file: the merged version is what runs now.`:t.diskHash===null?`${t.path} is missing on disk. Write it again.`:t.recovery?`Your write of ${t.path} was overwritten. A copy of your version: ${t.recovery}.`:`Your write of ${t.path} was overwritten and no copy exists \u2014 write the file again.`,Y6=t=>{if(!Yr(t)||!Yr(t.loaded))return null;let e={};for(let[n,s]of Object.entries(t.loaded))typeof s=="string"&&(e[n]=s);let r=[];for(let n of Array.isArray(t.errors)?t.errors:[]){if(!Yr(n)||typeof n.message!="string")continue;let s=n.kind==="compile"||n.kind==="pending"?n.kind:"load";r.push({file:typeof n.file=="string"?n.file:null,...typeof n.line=="number"?{line:n.line}:{},message:n.message,kind:s})}return{loaded:e,errors:r,holdId:typeof t.holdId=="string"?t.holdId:null}},Bf=class{lane;log;syncBudgetMs;advertised=null;constructor(e,r={}){this.lane=e,this.log=r.log??(()=>{}),this.syncBudgetMs=r.syncBudgetMs??B6}async list(){return $f(await this.advertisedTools())}hasAdvertisedTools(){return this.advertised!==null}async advertisedTools(){try{let e=await this.lane.status();if(this.advertised?.serverSession===e.serverSession)return this.advertised.tools;if(e.holder!=="connected")return null;let r=await this.lane.tools();return this.advertised={serverSession:e.serverSession,tools:r},r}catch{return null}}async call(e,r){if(!Sf.includes(e))return{content:[{type:"text",text:`Unknown tool: ${e}`}],isError:!0};try{return e==="project_status"?await this.projectStatus():s_.has(e)?await this.barrierTool(e,r):o_.has(e)?await this.observingTool(e,r):this.passthrough(await this.lane.call(e,r))}catch(n){return this.transportError(n)}}transportError(e){return e instanceof Yt?(this.log(e.message),Gr("no_workspace_server",e.message,{root:e.root})):e instanceof ns?e.code==="no_editor"?Gr("no_editor",e.message):e.code==="lease_lost"?Gr("no_editor",`${e.message} Open the project in Pix3 again.`,{reason:"lease_lost"}):e.code==="no_editor_reply"?Gr("no_editor","The Pix3 editor holds this project but did not answer in time (a background tab may be throttled \u2014 bring the editor window to the front and retry).",{reason:"no_reply"}):{content:[{type:"text",text:ai({error:e.code,message:e.message})}],isError:!0}:{content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}passthrough(e){return{content:e.content,...e.isError?{isError:!0}:{}}}async projectStatus(){let e=await this.lane.status(),r={root:e.root,projectName:e.projectName,revision:e.revision,seq:e.seq,serverSession:e.serverSession,cliVersion:e.cliVersion};try{let n=await this.lane.call("project_status",{},15e3),{payload:s}=Vf(n);return{content:[{type:"text",text:ai({connected:!0,server:r,editor:s})}],...n.isError?{isError:!0}:{}}}catch(n){if(n instanceof ns&&n.code==="no_editor")return{content:[{type:"text",text:ai({connected:!1,server:r,editor:null,message:n.message})}]};throw n}}async observingTool(e,r){let n=await this.lane.call(e,r),s=Yr(n._meta)&&Yr(n._meta.pix3)?n._meta.pix3:{},o=Yr(s.playRevision)?Object.fromEntries(Object.entries(s.playRevision).filter(([,l])=>typeof l=="string")):null,i=s.stale===!0;if(o&&!i){let{hashes:l}=await this.lane.hash(Object.keys(o));i=Object.entries(o).some(([u,d])=>l[u]!==d)}let{payload:a,images:c}=Vf(n);return{content:[{type:"text",text:ai({revision:o,stale:i,result:a})},...c],...n.isError?{isError:!0}:{}}}async barrierTool(e,r){let{expect:n,...s}=r,o=null;if(n!=null){if(!Yr(n))return{content:[{type:"text",text:"`expect` must be an object {path: sha256}."}],isError:!0};o={};for(let[a,c]of Object.entries(n))typeof c=="string"&&(o[a.replace(/^res:\/\//,"")]=c.toLowerCase())}if(o&&Object.keys(o).length>0){let a=await this.lane.expect(o);if(!a.matchesAgent)return Gr("disk_differs_from_agent","The disk does not hold the versions you wrote; nothing was started.",{differing:a.differing.map(c=>({...c,hint:G6(c)}))})}else o=null;let i=null;try{let a=Date.now()+this.syncBudgetMs,c=null,l=0;for(;;){let v=await this.lane.call("sync_barrier",{tool:e},H6),{payload:S}=Vf(v);if(v.isError)return this.passthrough(v);let T=Y6(S);if(!T)return{content:[{type:"text",text:"The editor answered sync_barrier without hashes."}],isError:!0};if(T.holdId&&i&&T.holdId!==i){let Y=i;await this.lane.call("sync_release",{holdId:Y},5e3).catch(()=>{})}i=T.holdId??i;let I={...T.loaded,...o??{}},A=await this.lane.hash(Object.keys(I)),U=Object.entries(I).filter(([Y,Ht])=>A.hashes[Y]!==Ht).map(([Y,Ht])=>({path:Y,diskHash:A.hashes[Y]??null,...o&&Y in o?{agentHash:Ht}:{},...Y in T.loaded?{loadedHash:T.loaded[Y]}:{}})),ae=T.errors.filter(Y=>Y.kind!=="pending"),J=T.errors.filter(Y=>Y.kind==="pending");if(U.length===0){if(ae.length>0)return Gr("load_failed","The editor could not load the current files.",{errors:ae});if(J.length>0)return Gr("pending_external",kN(J),{errors:J});c=I,l=A.seq;break}if(Date.now()>=a)return J.length>0?Gr("pending_external",kN(J),{errors:J}):ae.length>0?Gr("load_failed","The editor could not load the current files.",{errors:ae}):Gr("sync_timeout",`The editor's files did not match the disk within ${Math.round(this.syncBudgetMs/1e3)} s (still being written?). Nothing was started; call again when the writes are done.`,{differing:U});await J6(K6)}let u=await this.lane.call(e,s,W6),d=await this.lane.hash(Object.keys(c)),f=await this.lane.changes(l),{changedDuringRun:p,editorWroteDuringRun:m}=X6(f,c,d.hashes),h=Object.entries(c).every(([v,S])=>d.hashes[v]===S),g=[];o&&(g=(await this.lane.expect(o)).differing.filter(S=>S.mergeLog).map(S=>S.path));let{payload:y,images:w}=Vf(u),b=Q6(u,y),x={revision:c,startupMs:b,matchesAgent:o?!0:null,...o?{}:{agentExpectations:"none"},matchesDisk:h,changedDuringRun:p,editorWroteDuringRun:m,...f.complete?{}:{changeLogIncomplete:!0},editorChangedSinceAgentWrite:g,result:y};return{content:[{type:"text",text:ai(x)},...w],...u.isError?{isError:!0}:{}}}finally{i&&await this.lane.call("sync_release",{holdId:i},5e3).catch(()=>{})}}},X6=(t,e,r)=>{let n=new Map,s=(a,c)=>{let l=n.get(a)??new Set;l.add(c),n.set(a,l)};if(t.entries)for(let a of t.entries)s(a.path,a.origin);else for(let a of t.paths)s(a,"external");for(let[a,c]of Object.entries(e))r[a]!==c&&!n.get(a)?.has("editor")&&s(a,"external");let o=[],i=[];for(let[a,c]of n)(c.has("external")?o:i).push(a);return{changedDuringRun:o.sort(),editorWroteDuringRun:i.sort()}},Q6=(t,e)=>{let r=Yr(t._meta)&&Yr(t._meta.pix3)?t._meta.pix3:{};return typeof r.startupMs=="number"?r.startupMs:Yr(e)&&typeof e.startupMs=="number"?e.startupMs:null},kN=t=>`${t.map(r=>r.file??"?").join(", ")} cannot be read as a valid file (the editor keeps its last good version). Finish or fix the write, then call again.`});var ce,EN,C,bn,Pc=$(()=>{(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ce||(ce={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(EN||(EN={}));C=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bn=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}}});var P,Xt,Kf=$(()=>{Pc();P=ce.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"]),Xt=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:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let l=i.path[c],u=c===i.path.length-1;if(l==="_errors"){u&&a._errors.push(r(i)),c++;continue}Object.prototype.hasOwnProperty.call(a,l)||(l==="__proto__"?Object.defineProperty(a,l,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[l]={_errors:[]}),a=a[l],u&&a._errors.push(r(i)),c++}}};return s(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,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Xt.create=t=>new Xt(t)});var eH,ss,Z_=$(()=>{Kf();Pc();eH=(t,e)=>{let r;switch(t.code){case P.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ce.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${ce.joinValues(t.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ce.joinValues(t.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${ce.joinValues(t.options)}, received '${t.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.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}"`:ce.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case P.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 P.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 P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=e.defaultError,ce.assertNever(t)}return{message:r}},ss=eH});function Oc(){return tH}var tH,Hf=$(()=>{Z_();tH=ss});function N(t,e){let r=Oc(),n=Wf({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ss?void 0:ss].filter(s=>!!s)});t.common.issues.push(n)}var Wf,ht,B,ci,bt,U_,V_,Js,Ic,B_=$(()=>{Hf();Z_();Wf=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}};ht=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 s of r){if(s.status==="aborted")return B;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return B;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}},B=Object.freeze({status:"aborted"}),ci=t=>({status:"dirty",value:t}),bt=t=>({status:"valid",value:t}),U_=t=>t.status==="aborted",V_=t=>t.status==="dirty",Js=t=>t.status==="valid",Ic=t=>typeof Promise<"u"&&t instanceof Promise});var TN=$(()=>{});var z,PN=$(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}))});function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=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:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}function NN(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 _H(t){return new RegExp(`^${NN(t)}$`)}function vH(t){let e=`${IN}T${NN(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 wH(t,e){return!!((e==="v4"||!e)&&dH.test(t)||(e==="v6"||!e)&&pH.test(t))}function bH(t,e){if(!aH.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,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function SH(t,e){return!!((e==="v4"||!e)&&fH.test(t)||(e==="v6"||!e)&&hH.test(t))}function $H(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}function li(t){if(t instanceof Qt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Pr.create(li(n))}return new Qt({...t._def,shape:()=>e})}else return t instanceof is?new is({...t._def,type:li(t.element)}):t instanceof Pr?Pr.create(li(t.unwrap())):t instanceof kn?kn.create(li(t.unwrap())):t instanceof $n?$n.create(t.items.map(e=>li(e))):t}function W_(t,e){let r=bn(t),n=bn(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&n===C.object){let s=ce.objectKeys(e),o=ce.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(let a of o){if(a==="__proto__")continue;let c=W_(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===C.array&&n===C.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=W_(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===C.date&&n===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function CN(t,e){return new yi({values:t,typeName:O.ZodEnum,...G(e)})}var lr,ON,te,rH,nH,sH,oH,iH,aH,cH,lH,uH,K_,dH,fH,pH,hH,mH,gH,IN,yH,ui,Nc,Cc,Rc,Ac,zc,di,fi,jc,os,Xr,Mc,is,Qt,pi,Sn,H_,hi,$n,J_,Lc,Dc,G_,mi,gi,yi,_i,Gs,Or,Pr,kn,vi,wi,qc,Jf,Gf,bi,upe,O,dpe,fpe,ppe,hpe,mpe,gpe,ype,_pe,vpe,wpe,bpe,Spe,$pe,kpe,RN,xpe,Epe,Tpe,Ppe,Ope,Ipe,Npe,Cpe,Rpe,Ape,zpe,jpe,Mpe,Lpe,Dpe,qpe,Fpe,Zpe,Upe,AN=$(()=>{Kf();Hf();PN();B_();Pc();lr=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},ON=(t,e)=>{if(Js(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 Xt(t.common.issues);return this._error=r,this._error}}};te=class{get description(){return this._def.description}_getType(e){return bn(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:bn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ht,ctx:{common:e.parent.common,data:e.data,parsedType:bn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ic(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:bn(e)},s=this._parseSync({data:e,path:n.path,parent:n});return ON(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bn(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Js(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=>Js(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:bn(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(Ic(s)?s:Promise.resolve(s));return ON(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:P.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Or({schema:this,typeName:O.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 Pr.create(this,this._def)}nullable(){return kn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return is.create(this)}promise(){return Gs.create(this,this._def)}or(e){return pi.create([this,e],this._def)}and(e){return hi.create(this,e,this._def)}transform(e){return new Or({...G(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new vi({...G(this._def),innerType:this,defaultValue:r,typeName:O.ZodDefault})}brand(){return new Jf({typeName:O.ZodBranded,type:this,...G(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new wi({...G(this._def),innerType:this,catchValue:r,typeName:O.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Gf.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},rH=/^c[^\s-]{8,}$/i,nH=/^[0-9a-z]+$/,sH=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oH=/^[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,iH=/^[a-z0-9_-]{21}$/i,aH=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cH=/^[-+]?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)?)??$/,lH=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uH="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",dH=/^(?:(?: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])$/,fH=/^(?:(?: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])$/,pH=/^(([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]))$/,hH=/^(([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])$/,mH=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gH=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,IN="((\\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])))",yH=new RegExp(`^${IN}$`);ui=class t extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let o=this._getOrReturnCtx(e);return N(o,{code:P.invalid_type,expected:C.string,received:o.parsedType}),B}let n=new ht,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.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&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?N(s,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&N(s,{code:P.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")lH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")K_||(K_=new RegExp(uH,"u")),K_.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")oH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")iH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"nanoid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")rH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")nH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")sH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:P.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"regex",code:P.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)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.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)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?vH(o).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?yH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?_H(o).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:P.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?cH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"duration",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?wH(e.data,o.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?bH(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"jwt",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?SH(e.data,o.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cidr",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?mH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?gH.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"base64url",code:P.invalid_string,message:o.message}),n.dirty()):ce.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:P.invalid_string,...z.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.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,...z.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,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...z.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...z.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...z.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...z.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...z.errToObj(r)})}nonempty(e){return this.min(1,z.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}};ui.create=t=>new ui({checks:[],typeName:O.ZodString,coerce:t?.coerce??!1,...G(t)});Nc=class t extends te{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)!==C.number){let o=this._getOrReturnCtx(e);return N(o,{code:P.invalid_type,expected:C.number,received:o.parsedType}),B}let n,s=new ht;for(let o of this._def.checks)o.kind==="int"?ce.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:P.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:P.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:P.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?$H(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),N(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:P.not_finite,message:o.message}),s.dirty()):ce.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,z.toString(r))}gt(e,r){return this.setLimit("min",e,!1,z.toString(r))}lte(e,r){return this.setLimit("max",e,!0,z.toString(r))}lt(e,r){return this.setLimit("max",e,!1,z.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:z.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.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"&&ce.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)}};Nc.create=t=>new Nc({checks:[],typeName:O.ZodNumber,coerce:t?.coerce||!1,...G(t)});Cc=class t extends te{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)!==C.bigint)return this._getInvalidInput(e);let n,s=new ht;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),N(n,{code:P.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:P.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),N(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ce.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:C.bigint,received:r.parsedType}),B}gte(e,r){return this.setLimit("min",e,!0,z.toString(r))}gt(e,r){return this.setLimit("min",e,!1,z.toString(r))}lte(e,r){return this.setLimit("max",e,!0,z.toString(r))}lt(e,r){return this.setLimit("max",e,!1,z.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:z.toString(s)}]})}_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:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:z.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}};Cc.create=t=>new Cc({checks:[],typeName:O.ZodBigInt,coerce:t?.coerce??!1,...G(t)});Rc=class extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.boolean,received:n.parsedType}),B}return bt(e.data)}};Rc.create=t=>new Rc({typeName:O.ZodBoolean,coerce:t?.coerce||!1,...G(t)});Ac=class t extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let o=this._getOrReturnCtx(e);return N(o,{code:P.invalid_type,expected:C.date,received:o.parsedType}),B}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return N(o,{code:P.invalid_date}),B}let n=new ht,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:P.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ce.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:z.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:z.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}};Ac.create=t=>new Ac({checks:[],coerce:t?.coerce||!1,typeName:O.ZodDate,...G(t)});zc=class extends te{_parse(e){if(this._getType(e)!==C.symbol){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.symbol,received:n.parsedType}),B}return bt(e.data)}};zc.create=t=>new zc({typeName:O.ZodSymbol,...G(t)});di=class extends te{_parse(e){if(this._getType(e)!==C.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.undefined,received:n.parsedType}),B}return bt(e.data)}};di.create=t=>new di({typeName:O.ZodUndefined,...G(t)});fi=class extends te{_parse(e){if(this._getType(e)!==C.null){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.null,received:n.parsedType}),B}return bt(e.data)}};fi.create=t=>new fi({typeName:O.ZodNull,...G(t)});jc=class extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};jc.create=t=>new jc({typeName:O.ZodAny,...G(t)});os=class extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bt(e.data)}};os.create=t=>new os({typeName:O.ZodUnknown,...G(t)});Xr=class extends te{_parse(e){let r=this._getOrReturnCtx(e);return N(r,{code:P.invalid_type,expected:C.never,received:r.parsedType}),B}};Xr.create=t=>new Xr({typeName:O.ZodNever,...G(t)});Mc=class extends te{_parse(e){if(this._getType(e)!==C.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.void,received:n.parsedType}),B}return bt(e.data)}};Mc.create=t=>new Mc({typeName:O.ZodVoid,...G(t)});is=class t extends te{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==C.array)return N(r,{code:P.invalid_type,expected:C.array,received:r.parsedType}),B;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(N(r,{code:i?P.too_big:P.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(N(r,{code:P.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(N(r,{code:P.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new lr(r,i,r.path,a)))).then(i=>ht.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new lr(r,i,r.path,a)));return ht.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:z.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:z.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:z.toString(r)}})}nonempty(e){return this.min(1,e)}};is.create=(t,e)=>new is({type:t,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...G(e)});Qt=class t extends te{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=ce.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){let l=this._getOrReturnCtx(e);return N(l,{code:P.invalid_type,expected:C.object,received:l.parsedType}),B}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Xr&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||a.push(l);let c=[];for(let l of i){let u=o[l],d=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new lr(s,d,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof Xr){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(l==="strict")a.length>0&&(N(s,{code:P.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of a){let d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new lr(s,d,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>ht.mergeObjectSync(n,l)):ht.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:z.errToObj(e).message??s}:{message:s}}}:{}})}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:O.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 ce.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 ce.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return li(this)}partial(e){let r={};for(let n of ce.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ce.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Pr;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return CN(ce.objectKeys(this.shape))}};Qt.create=(t,e)=>new Qt({shape:()=>t,unknownKeys:"strip",catchall:Xr.create(),typeName:O.ZodObject,...G(e)});Qt.strictCreate=(t,e)=>new Qt({shape:()=>t,unknownKeys:"strict",catchall:Xr.create(),typeName:O.ZodObject,...G(e)});Qt.lazycreate=(t,e)=>new Qt({shape:t,unknownKeys:"strip",catchall:Xr.create(),typeName:O.ZodObject,...G(e)});pi=class extends te{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(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 i=o.map(a=>new Xt(a.ctx.common.issues));return N(r,{code:P.invalid_union,unionErrors:i}),B}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new Xt(c));return N(r,{code:P.invalid_union,unionErrors:a}),B}}get options(){return this._def.options}};pi.create=(t,e)=>new pi({options:t,typeName:O.ZodUnion,...G(e)});Sn=t=>t instanceof mi?Sn(t.schema):t instanceof Or?Sn(t.innerType()):t instanceof gi?[t.value]:t instanceof yi?t.options:t instanceof _i?ce.objectValues(t.enum):t instanceof vi?Sn(t._def.innerType):t instanceof di?[void 0]:t instanceof fi?[null]:t instanceof Pr?[void 0,...Sn(t.unwrap())]:t instanceof kn?[null,...Sn(t.unwrap())]:t instanceof Jf||t instanceof bi?Sn(t.unwrap()):t instanceof wi?Sn(t._def.innerType):[],H_=class t extends te{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return N(r,{code:P.invalid_type,expected:C.object,received:r.parsedType}),B;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);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}):(N(r,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=Sn(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...G(n)})}};hi=class extends te{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if(U_(o)||U_(i))return B;let a=W_(o.value,i.value);return a.valid?((V_(o)||V_(i))&&r.dirty(),{status:r.value,value:a.data}):(N(n,{code:P.invalid_intersection_types}),B)};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,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hi.create=(t,e,r)=>new hi({left:t,right:e,typeName:O.ZodIntersection,...G(r)});$n=class t extends te{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.array)return N(n,{code:P.invalid_type,expected:C.array,received:n.parsedType}),B;if(n.data.length<this._def.items.length)return N(n,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&n.data.length>this._def.items.length&&(N(n,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new lr(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>ht.mergeArray(r,i)):ht.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};$n.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $n({items:t,typeName:O.ZodTuple,rest:null,...G(e)})};J_=class t extends te{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!==C.object)return N(n,{code:P.invalid_type,expected:C.object,received:n.parsedType}),B;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new lr(n,a,n.path,a)),value:i._parse(new lr(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ht.mergeObjectAsync(r,s):ht.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof te?new t({keyType:e,valueType:r,typeName:O.ZodRecord,...G(n)}):new t({keyType:ui.create(),valueType:e,typeName:O.ZodRecord,...G(r)})}},Lc=class extends te{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!==C.map)return N(n,{code:P.invalid_type,expected:C.map,received:n.parsedType}),B;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],l)=>({key:s._parse(new lr(n,a,n.path,[l,"key"])),value:o._parse(new lr(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return B;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return B;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};Lc.create=(t,e,r)=>new Lc({valueType:e,keyType:t,typeName:O.ZodMap,...G(r)});Dc=class t extends te{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.set)return N(n,{code:P.invalid_type,expected:C.set,received:n.parsedType}),B;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(N(n,{code:P.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(N(n,{code:P.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let l=new Set;for(let u of c){if(u.status==="aborted")return B;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>o._parse(new lr(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:z.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:z.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Dc.create=(t,e)=>new Dc({valueType:t,minSize:null,maxSize:null,typeName:O.ZodSet,...G(e)});G_=class t extends te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.function)return N(r,{code:P.invalid_type,expected:C.function,received:r.parsedType}),B;function n(a,c){return Wf({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Oc(),ss].filter(l=>!!l),issueData:{code:P.invalid_arguments,argumentsError:c}})}function s(a,c){return Wf({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Oc(),ss].filter(l=>!!l),issueData:{code:P.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Gs){let a=this;return bt(async function(...c){let l=new Xt([]),u=await a._def.args.parseAsync(c,o).catch(p=>{throw l.addIssue(n(c,p)),l}),d=await Reflect.apply(i,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw l.addIssue(s(d,p)),l})})}else{let a=this;return bt(function(...c){let l=a._def.args.safeParse(c,o);if(!l.success)throw new Xt([n(c,l.error)]);let u=Reflect.apply(i,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new Xt([s(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:$n.create(e).rest(os.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||$n.create([]).rest(os.create()),returns:r||os.create(),typeName:O.ZodFunction,...G(n)})}},mi=class extends te{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})}};mi.create=(t,e)=>new mi({getter:t,typeName:O.ZodLazy,...G(e)});gi=class extends te{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return N(r,{received:r.data,code:P.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};gi.create=(t,e)=>new gi({value:t,typeName:O.ZodLiteral,...G(e)});yi=class t extends te{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return N(r,{expected:ce.joinValues(n),received:r.parsedType,code:P.invalid_type}),B}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 N(r,{received:r.data,code:P.invalid_enum_value,options:n}),B}return bt(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})}};yi.create=CN;_i=class extends te{_parse(e){let r=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==C.string&&n.parsedType!==C.number){let s=ce.objectValues(r);return N(n,{expected:ce.joinValues(s),received:n.parsedType,code:P.invalid_type}),B}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=ce.objectValues(r);return N(n,{received:n.data,code:P.invalid_enum_value,options:s}),B}return bt(e.data)}get enum(){return this._def.values}};_i.create=(t,e)=>new _i({values:t,typeName:O.ZodNativeEnum,...G(e)});Gs=class extends te{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return N(r,{code:P.invalid_type,expected:C.promise,received:r.parsedType}),B;let n=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return bt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Gs.create=(t,e)=>new Gs({type:t,typeName:O.ZodPromise,...G(e)});Or=class extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{N(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return B;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?B:c.status==="dirty"?ci(c.value):r.value==="dirty"?ci(c.value):c});{if(r.value==="aborted")return B;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?B:a.status==="dirty"?ci(a.value):r.value==="dirty"?ci(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.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"?B:(a.status==="dirty"&&r.dirty(),i(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"?B:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Js(i))return B;let a=s.transform(i.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(i=>Js(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):B);ce.assertNever(s)}};Or.create=(t,e,r)=>new Or({schema:t,typeName:O.ZodEffects,effect:e,...G(r)});Or.createWithPreprocess=(t,e,r)=>new Or({schema:e,effect:{type:"preprocess",transform:t},typeName:O.ZodEffects,...G(r)});Pr=class extends te{_parse(e){return this._getType(e)===C.undefined?bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pr.create=(t,e)=>new Pr({innerType:t,typeName:O.ZodOptional,...G(e)});kn=class extends te{_parse(e){return this._getType(e)===C.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};kn.create=(t,e)=>new kn({innerType:t,typeName:O.ZodNullable,...G(e)});vi=class extends te{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===C.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};vi.create=(t,e)=>new vi({innerType:t,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});wi=class extends te{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ic(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Xt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};wi.create=(t,e)=>new wi({innerType:t,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});qc=class extends te{_parse(e){if(this._getType(e)!==C.nan){let n=this._getOrReturnCtx(e);return N(n,{code:P.invalid_type,expected:C.nan,received:n.parsedType}),B}return{status:"valid",value:e.data}}};qc.create=t=>new qc({typeName:O.ZodNaN,...G(t)});Jf=class extends te{_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}},Gf=class t extends te{_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"?B:o.status==="dirty"?(r.dirty(),ci(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?B:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:O.ZodPipeline})}},bi=class extends te{_parse(e){let r=this._def.innerType._parse(e),n=s=>(Js(s)&&(s.value=Object.freeze(s.value)),s);return Ic(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};bi.create=(t,e)=>new bi({innerType:t,typeName:O.ZodReadonly,...G(e)});upe={object:Qt.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"})(O||(O={}));dpe=ui.create,fpe=Nc.create,ppe=qc.create,hpe=Cc.create,mpe=Rc.create,gpe=Ac.create,ype=zc.create,_pe=di.create,vpe=fi.create,wpe=jc.create,bpe=os.create,Spe=Xr.create,$pe=Mc.create,kpe=is.create,RN=Qt.create,xpe=Qt.strictCreate,Epe=pi.create,Tpe=H_.create,Ppe=hi.create,Ope=$n.create,Ipe=J_.create,Npe=Lc.create,Cpe=Dc.create,Rpe=G_.create,Ape=mi.create,zpe=gi.create,jpe=yi.create,Mpe=_i.create,Lpe=Gs.create,Dpe=Or.create,qpe=Pr.create,Fpe=kn.create,Zpe=Or.createWithPreprocess,Upe=Gf.create});var zN=$(()=>{Hf();B_();TN();Pc();AN();Kf()});var Fc=$(()=>{zN()});var V={};We(V,{BIGINT_FORMAT_RANGES:()=>ep,CONSTANT_CATCH:()=>XN,Class:()=>Q_,NUMBER_FORMAT_RANGES:()=>Uc,aborted:()=>Ir,allowsEval:()=>sv,assert:()=>IH,assertEqual:()=>xH,assertIs:()=>PH,assertNever:()=>OH,assertNotEqual:()=>EH,assignProp:()=>At,attachSchema:()=>rp,base64ToUint8Array:()=>GN,base64urlToUint8Array:()=>ZH,cached:()=>xi,captureStackTrace:()=>Xf,cleanEnum:()=>FH,cleanRegex:()=>Zc,clone:()=>zt,cloneDef:()=>RH,codePointLength:()=>Vc,constantCatch:()=>QN,createTransparentProxy:()=>DH,defineLazy:()=>MN,defineLazyInternal:()=>_e,derived:()=>KH,esc:()=>rv,escapeRegex:()=>En,explicitlyAborted:()=>cv,extend:()=>UN,finalizeIssue:()=>Nr,floatSafeRemainder:()=>tv,getElementAtPath:()=>AH,getEnumValues:()=>$i,getLengthableOrigin:()=>Bc,getParsedType:()=>LH,getSizableOrigin:()=>JN,hexToUint8Array:()=>VH,hide:()=>np,installLazyProp:()=>dv,isObject:()=>Xs,isPlainObject:()=>cs,issue:()=>Ti,joinValues:()=>Yf,jsonStringifyReplacer:()=>ki,members:()=>uv,merge:()=>KN,mergeDefs:()=>en,normalizeParams:()=>Z,nullish:()=>ev,numKeys:()=>MH,objectClone:()=>NH,omit:()=>ZN,optionalKeys:()=>av,own:()=>Qr,parsedType:()=>lv,partial:()=>HN,pick:()=>FN,prefixIssues:()=>Tn,primitiveTypes:()=>qN,promiseAllObject:()=>zH,propertyKeyTypes:()=>iv,randomString:()=>jH,rawShape:()=>Ei,required:()=>WN,safeExtend:()=>BN,shallowClone:()=>ov,slugify:()=>nv,stringifyPrimitive:()=>Qf,toZod:()=>TH,uint8ArrayToBase64:()=>YN,uint8ArrayToBase64url:()=>UH,uint8ArrayToHex:()=>BH,unwrapMessage:()=>Si});function xH(t){return t}function EH(t){return t}function TH(){return t=>t}function PH(t){}function OH(t){throw new Error("Unexpected value in exhaustive check")}function IH(t){}function $i(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function Yf(t,e="|"){return t.map(r=>Qf(r)).join(e)}function ki(t,e){return typeof e=="bigint"?e.toString():e}function xi(t){return new X_(t)}function ev(t){return t==null}function Zc(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function tv(t,e){let r=t/e,n=Math.round(r),s=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<s?0:r-n}function MN(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==jN)return n===void 0&&(n=jN,n=r()),n},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function NH(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function At(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ei(t){let e=Object.getOwnPropertyDescriptor(t,"shape");return e?.get?e.get.raw:e?.value}function xn(t){return Ei(t._zod.def)??t._zod.def.shape}function LN(t,e,r){Object.defineProperty(t,e,{get(){let n=r();return At(this,e,n),n},enumerable:!0,configurable:!0})}function DN(t,e,r){e in t?At(t,e,r):t[e]=r}function Ys(t,e,r,n){let s=xn(e);for(let o of r){let i=Object.getOwnPropertyDescriptor(s,o);i.enumerable&&(i.get?LN(t,o,()=>{let a=e._zod.def.shape[o];return n?n(a,o):a}):DN(t,o,n?n(i.value,o):i.value))}}function CH(t,e){for(let r of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(e,r);n.enumerable&&(n.get?LN(t,r,()=>e[r]):DN(t,r,n.value))}}function en(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function RH(t){return en(t._zod.def)}function AH(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function zH(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let s={};for(let o=0;o<e.length;o++)s[e[o]]=n[o];return s})}function jH(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function rv(t){return JSON.stringify(t)}function nv(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Xs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function cs(t){if(Xs(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Xs(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ov(t){return cs(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function MH(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function En(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zt(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Z(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function DH(t){let e;return new Proxy({},{get(r,n,s){return e??(e=t()),Reflect.get(e,n,s)},set(r,n,s,o){return e??(e=t()),Reflect.set(e,n,s,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,s){return e??(e=t()),Reflect.defineProperty(e,n,s)}})}function Qf(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function av(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}function FN(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return Ys(o,t,tp(t,e)),zt(t,en(r,{shape:o,checks:[]}))}function tp(t,e){let r=xn(t),n=[];for(let s of Reflect.ownKeys(e)){if(!Object.getOwnPropertyDescriptor(r,s)?.enumerable)throw new Error(`Unrecognized key: "${String(s)}"`);e[s]&&n.push(s)}return n}function ZN(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(tp(t,e)),i={};return Ys(i,t,Reflect.ownKeys(xn(t)).filter(a=>!o.has(a))),zt(t,en(r,{shape:i,checks:[]}))}function UN(t,e){if(!cs(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=xn(t);for(let o of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return zt(t,en(t._zod.def,{shape:VN(t,e)}))}function VN(t,e){let r={};return Ys(r,t,Reflect.ownKeys(xn(t))),CH(r,e),r}function BN(t,e){if(!cs(e))throw new Error("Invalid input to safeExtend: expected a plain object");return zt(t,en(t._zod.def,{shape:VN(t,e)}))}function KN(t,e){if(!e?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Ys(r,t,Reflect.ownKeys(xn(t))),Ys(r,e,Reflect.ownKeys(xn(e)));let n=en(t._zod.def,{shape:r,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return zt(t,n)}function HN(t,e,r,n="partial"){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(tp(e,r)):void 0,c={};return Ys(c,e,Reflect.ownKeys(xn(e)),t&&((l,u)=>a&&!a.has(u)?l:new t({type:"optional",innerType:l}))),zt(e,en(e._zod.def,{shape:c,checks:[]}))}function WN(t,e,r){let n=r?new Set(tp(e,r)):void 0,s={};return Ys(s,e,Reflect.ownKeys(xn(e)),(o,i)=>n&&!n.has(i)?o:new t({type:"nonoptional",innerType:o})),zt(e,en(e._zod.def,{shape:s}))}function Ir(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function cv(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Tn(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Si(t){return typeof t=="string"?t:t?.message}function rp(t,e,r){var n;for(let s=e;s<t.length;s++)(n=t[s]).schema??(n.schema=r)}function Nr(t,e,r){var n;let s=t.inst?._zod?.traits;s?.has("$ZodType")&&(s.has("$ZodCheck")?(n=t).schema??(n.schema=t.inst):t.schema=t.inst);let o=t.schema!==t.inst?t.schema?._zod.def?.error:void 0,i=t.message?t.message:Si(t.inst?._zod.def?.error?.(t))??Si(o?.(t))??Si(e?.error?.(t))??Si(r.customError?.(t))??Si(r.localeError?.(t))??"Invalid input",a={};for(let c of Object.keys(t))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=t[c]);return a.path??(a.path=[]),a.message=i,e?.reportInput&&(a.input=t.input),a}function JN(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Vc(t){let e=t.length;if(!qH.test(t))return e;let r=e;for(let n=0;n<e-1;n++)(t.charCodeAt(n)&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Bc(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lv(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Ti(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function FH(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function GN(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function YN(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function ZH(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return GN(e+r)}function UH(t){return YN(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function VH(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function BH(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function uv(t,e){for(let r in e){let n=Object.getOwnPropertyDescriptor(e,r);n.get?Object.defineProperty(t,r,{...n,enumerable:!1}):HH(t,r,n.value)}}function Qr(t,e,r,n=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function np(t,e,r){return Qr(t,e,r,!1)}function KH(t,e){for(let r in t){let n=t[r];Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){return Qr(this,r,n(this))},set(s){Qr(this,r,s)}})}return e}function HH(t,e,r){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?r:Qr(this,e,r.bind(this))},set(n){Qr(this,e,n)}})}function WH(t,e){let r=Object.getPrototypeOf(t);return e in r?void 0:r}function _e(t,e,r){let n=Object.getPrototypeOf(t._zod);if(e in n&&Y_!==t._zod){Y_=void 0;return}Y_=t._zod,Object.defineProperty(n,e,{configurable:!0,get(){Object.defineProperty(this,e,JH);let s=as;as=!1;try{let o=r(this);return as?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:o}),as=as||s,o}catch(o){throw delete this[e],as=as||s,o}},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})}function dv(t,e,r,n){let s=WH(t,e);s&&Object.defineProperty(s,e,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,e,o),o.value=r(this),Object.defineProperty(this,e,o),o.value},set(o){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:n,value:o})}})}function QN(t){let e=()=>t;return e[XN]=!0,e}var X_,jN,Xf,sv,LH,iv,qN,Uc,ep,qH,Q_,Y_,as,JH,XN,St=$(()=>{Qs();X_=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};jN=Symbol("evaluating");Xf="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};sv=xi(()=>{if(jt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});LH=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},iv=new Set(["string","number","symbol"]),qN=new Set(["string","number","bigint","boolean","symbol","undefined"]);Uc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ep={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};qH=/[\uD800-\uDBFF]/;Q_=class{constructor(...e){}};as=!1,JH={configurable:!0,get(){as=!0}};XN="~constantCatch"});function GH(t){let e=tC;if(e){let r=e.stackTraceLimit;if(typeof r=="number"){try{e.stackTraceLimit=0}catch{return tC=null,new t}try{return new t}finally{e.stackTraceLimit=r}}}return new t}function E(t,e,r,n){let s={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=s;let i=r,a=i&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(t))return}else{fv.value=new o(p);try{Object.defineProperty(f,"_zod",fv)}finally{fv.value=void 0}}if(f._zod.traits.add(t),e(f,p),a){let h=Object.getPrototypeOf(f),g=f._zod.constr.prototype,y=h;for(;y&&y!==g;)y=Object.getPrototypeOf(y);let w=y??h;a.has(w)||(a.add(w),uv(w,i))}let m=d.prototype;for(let h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in f||(f[h]=m[h].bind(f)))}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:t});function d(f){let p=n?.Parent?GH(u):this;c(p,f);let m=p._zod.deferred;if(m){for(let g of m)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(t)}),Object.defineProperty(d,"name",{value:t}),d}function er(t){return t&&Object.assign(jt,t),jt}var eC,fv,tC,Cr,Pi,jt,Qs=$(()=>{St();fv={value:void 0,enumerable:!1},tC="captureStackTrace"in Error?Error:null;Cr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pi=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(eC=globalThis).__zod_globalConfig??(eC.__zod_globalConfig={});jt=globalThis.__zod_globalConfig});function YH(){let t=this._zod;return t.message??(t.message=JSON.stringify(t.def,ki,2)),t.message}function XH(t){this._zod.message=t}function eW(t,e,r){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:r(),writable:!0,enumerable:!0,configurable:!0}):t[e]=r()),t[e]}function oC(t,e=r=>r.message){let r={},n=[];for(let s of t.issues)s.path.length>0?eW(r,s.path[0],()=>[]).push(e(s)):n.push(e(s));return{formErrors:n,fieldErrors:r}}function iC(t,e=r=>r.message){let r={_errors:[]},n=(s,o=[])=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...o,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...o,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...o,...i.path]);else{let a=[...o,...i.path];if(a.length===0)r._errors.push(e(i));else{let c=r,l=0;for(;l<a.length;){let u=a[l],d=l===a.length-1;if(u==="_errors"){d&&c._errors.push(e(i)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[u];d&&f._errors.push(e(i)),c=f,l++}}}};return n(t),r}var QH,hv,rC,nC,sC,Kc,mv=$(()=>{Qs();St();QH={get:YH,set:XH,enumerable:!0,configurable:!0},hv={value:void 0,enumerable:!1},rC=new WeakSet([Object.prototype,Error.prototype]),nC=(t,e)=>{t.name="$ZodError",hv.value=e,Object.defineProperty(t,"issues",hv),hv.value=void 0,Object.defineProperty(t,"message",QH);let r=Object.getPrototypeOf(t);rC.has(r)||(rC.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},sC=E("$ZodError",nC),Kc=E("$ZodError",nC,void 0,{Parent:Error})});function sp(t,e){return{callee:e?.callee??t,Err:e?.Err}}function aC(t,e,r){let n;return{success:!1,get error(){return n||(n=new t(e.map(s=>Nr(s,r,er()))),e=void 0,r=void 0),n},set error(s){n=s,e=void 0,r=void 0}}}function sW(t,e,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=t._zod.bag.fallbackRun,o;if(s?(n[nW]=!0,o=s({value:e,issues:[]},n)):o=t._zod.run({value:e,issues:[]},n),o instanceof Promise)throw new Cr;return o.issues.length===0}var Hc,gv,Wc,yv,Jc,Gc,Yc,Xc,rW,nW,op,ip,cC,lC,uC,dC,fC,pC,hC,mC,gC=$(()=>{Qs();mv();St();Hc=t=>{let e=(r,n,s,o)=>{let i=s?{...s,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Cr;if(a.issues.length){let c=new(o?.Err??t)(a.issues.map(l=>Nr(l,i,er())));throw Xf(c,o?.callee??e),c}return a.value};return e},gv=Hc(Kc),Wc=t=>{let e=async(r,n,s,o)=>{let i=s?{...s,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??t)(a.issues.map(l=>Nr(l,i,er())));throw Xf(c,o?.callee??e),c}return a.value};return e},yv=Wc(Kc),Jc=t=>(e,r,n)=>{let s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Cr;return o.issues.length?aC(t,o.issues,s):{success:!0,data:o.value}},Gc=Jc(Kc);Yc=t=>async(e,r,n)=>{let s=n?{...n,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?aC(t,o.issues,s):{success:!0,data:o.value}},Xc=Yc(Kc),rW=Symbol.for("zod.compile.invalid"),nW=Symbol.for("zod.compile.fallback"),op=((t,e,r)=>{let n=t._zod.bag.validator;if(n!==void 0){if(n(e)!==rW)return!0;if(n.definite===!0&&r===void 0)return!1}return sW(t,e,r)});ip=async(t,e,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},s=t._zod.run({value:e,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length===0},cC=t=>{let e=Hc(t),r=(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return e(n,s,a,sp(r,i))};return r},lC=t=>{let e=Hc(t),r=(n,s,o,i)=>e(n,s,o,sp(r,i));return r},uC=t=>{let e=Wc(t),r=async(n,s,o,i)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await e(n,s,a,sp(r,i))};return r},dC=t=>{let e=Wc(t),r=async(n,s,o,i)=>await e(n,s,o,sp(r,i));return r},fC=t=>(e,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Jc(t)(e,r,s)},pC=t=>(e,r,n)=>Jc(t)(e,r,n),hC=t=>async(e,r,n)=>{let s=n?{...n,direction:"backward"}:{direction:"backward"};return Yc(t)(e,r,s)},mC=t=>async(e,r,n)=>Yc(t)(e,r,n)});function $C(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}function TC(){return new RegExp(oW,"u")}function iW(t){return new RegExp(`^${t}$`)}function _v(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function LC(t){return new RegExp(`^${_v(t)}$`)}function DC(t){let e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${_v({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,n=t.local?`${r}|${_v({precision:t.precision})}`:r;return new RegExp(`^${jC}T(?:${n})$`)}var yC,_C,vC,wC,bC,SC,kC,xC,vv,EC,oW,PC,OC,IC,NC,CC,RC,AC,zC,jC,MC,qC,wv,Qc,FC,ZC,UC,VC,el=$(()=>{yC=/^[cC][0-9a-z]{6,}$/,_C=/^[0-9a-z]+$/,vC=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,wC=/^[0-9a-vA-V]{20}$/,bC=/^[A-Za-z0-9]{27}$/,SC=/^[a-zA-Z0-9_-]{21}$/;kC=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xC=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vv=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,EC=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,oW="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";PC=/^(?:(?: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])$/,OC=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,IC=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,NC=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,CC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,RC=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,AC=/^https?$/,zC=/^\+[1-9]\d{6,14}$/,jC="(?:(?:\\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])))";MC=iW(jC);qC=/^[\s\S]{0,}$/,wv=/^-?\d+$/,Qc=/^-?\d+(?:\.\d+)?$/,FC=/^(?:true|false)$/i,ZC=/^null$/i,UC=/^[^A-Z]*$/,VC=/^[^a-z]*$/});var rt,bv,ap,Sv,$v,BC,KC,HC,WC,JC,tl,GC,YC,XC,QC,eR,tR,rR,cp=$(()=>{Qs();el();St();rt=E("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),bv=t=>{let e=t.value;return!ev(e)&&e.length!==void 0},ap={number:"number",bigint:"bigint",object:"date"},Sv=E("$ZodCheckLessThan",(t,e)=>{rt.init(t,e);let r=ap[typeof e.value];t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:ap[typeof n.value]??r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),$v=E("$ZodCheckGreaterThan",(t,e)=>{rt.init(t,e);let r=ap[typeof e.value];t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:ap[typeof n.value]??r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),BC=E("$ZodCheckMultipleOf",(t,e)=>{rt.init(t,e),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?e.value!==BigInt(0)&&r.value%e.value===BigInt(0):tv(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),KC=E("$ZodCheckNumberFormat",(t,e)=>{rt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[s,o]=Uc[e.format];t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),a>o&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),HC=E("$ZodCheckMaxLength",(t,e)=>{var r;rt.init(t,e),(r=t._zod.def).when??(r.when=bv),t._zod.check=n=>{let s=n.value,o=s.length;if((typeof s=="string"&&o>e.maximum?Vc(s):o)<=e.maximum)return;let a=Bc(s);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),WC=E("$ZodCheckMinLength",(t,e)=>{var r;rt.init(t,e),(r=t._zod.def).when??(r.when=bv),t._zod.check=n=>{let s=n.value,o=s.length;if((typeof s=="string"&&o>=e.minimum&&o<e.minimum*2?Vc(s):o)>=e.minimum)return;let a=Bc(s);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),JC=E("$ZodCheckLengthEquals",(t,e)=>{var r;rt.init(t,e),(r=t._zod.def).when??(r.when=bv),t._zod.check=n=>{let s=n.value,o=s.length,i=typeof s=="string"&&o>=e.length&&o<=e.length*2?Vc(s):o;if(i===e.length)return;let a=Bc(s),c=i>e.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),tl=E("$ZodCheckStringFormat",(t,e)=>{var r,n;rt.init(t,e),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),GC=E("$ZodCheckRegex",(t,e)=>{tl.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),YC=E("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=UC),tl.init(t,e)}),XC=E("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=VC),tl.init(t,e)}),QC=E("$ZodCheckIncludes",(t,e)=>{rt.init(t,e);let r=En(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position},}${r}`:r);e.pattern=n,t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),eR=E("$ZodCheckStartsWith",(t,e)=>{rt.init(t,e);let r=new RegExp(`^${En(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),tR=E("$ZodCheckEndsWith",(t,e)=>{rt.init(t,e);let r=new RegExp(`.*${En(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),rR=E("$ZodCheckOverwrite",(t,e)=>{rt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var lp,kv=$(()=>{lp=class{constructor(e=[],r={}){this.content=[],this.indent=0,this.args=e,this.closed=r}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
234
|
+
`).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,r=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
235
|
+
${r.join(`
|
|
236
|
+
`)}
|
|
237
|
+
};`)(...Object.values(this.closed))}}});var sR,xv=$(()=>{sR={major:4,minor:6,patch:5}});async function aW(t,e){let r={async:!0};return mR(await t._zod.run({value:e,issues:[]},r),r)}function Tv(t){return{validate:e=>{let r={async:!1};try{let n=t._zod.run({value:e,issues:[]},r);if(!(n instanceof Promise))return mR(n,r)}catch{}return aW(t,e)},vendor:"zod",version:1}}function yR(t){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function cW(t,e){return!("normalize"in e)&&!("hostname"in e)&&!("protocol"in e)?yR(t)||dp:lW(t,e)}function lW(t,e){if(!e.normalize&&e.protocol?.source===AC.source&&!/^https?:\/\//i.test(t))return gR;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(t)??dp}return new URL(t)}catch{return dp}}function oR(t){return t.replace(uW,"")}function dW(t,e){return e.lastIndex=0,e.test(t.hostname)}function fW(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}function SR(t){return pW.test(t)?yR(`http://[${t}]`):!1}function hW(t){let e=t.split("/");if(e.length!==2)return!1;let[r,n]=e;if(!n)return!1;let s=Number(n);return`${s}`!==n||s<0||s>128?!1:SR(r)}function $R(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function mW(t){if(!pp.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return $R(r)}function gW(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}function iR(t,e,r){t.issues.length&&e.issues.push(...Tn(r,t.issues)),e.value[r]=t.value}function fp(t,e,r,n,s,o){let i=r in n,a=o==="optional";if(!(!i&&a&&s==="optional")){if(t.issues.length){if(s!==void 0&&a&&!i)return;e.issues.push(...Tn(r,t.issues))}if(!i&&s===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?(i||s==="defaulted"&&!a)&&(e.value[r]=void 0):e.value[r]=t.value}}function kR(t){let e=Object.keys(t.shape),r=Object.getOwnPropertySymbols(t.shape),n=r.length?r:yW,s=n.length?[...e,...n]:e;for(let i of s)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let o=av(t.shape);return{...t,allKeys:s,symbolKeys:n,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(o)}}function xR(t,e,r,n,s,o,i){let a=[],c=s.keySet,l=s.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let m in e){if(i&&r.issues.length!==p){if(Ir(r,p))break;p=r.issues.length}if(c.has(m))continue;if(m==="__proto__"){u==="never"&&a.push(m);continue}if(u==="never"){a.push(m);continue}let h=l.run({value:e[m],issues:[]},n);h instanceof Promise?t.push(h.then(g=>fp(g,r,m,e,d,f))):fp(h,r,m,e,d,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:o,continue:!0}),t.length?Promise.all(t).then(()=>r):r}function aR(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let s=t.filter(o=>!Ir(o));return s.length===1?(e.value=s[0].value,s[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(i=>Nr(i,n,er())))}),e)}function _W(t){let e=new Map;for(let r of t.options){let n=r._zod.propValues?.[t.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let s of n)if(e.has(s)){if(s!==void 0)throw new Error(`Duplicate discriminator value "${String(s)}"`);e.set(s,null)}else e.set(s,r)}return e}function Ev(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(cs(t)&&cs(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let o of n){if(o==="__proto__")continue;let i=Ev(t[o],e[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=e[n],i=Ev(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function cR(t,e,r){let n=new Map,s,o=new Map,i=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)s??(s=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let f=String(l.path[0]);o.has(f)||o.set(f,l),d=[f]}else return!1;for(let f of d)n.has(f)||n.set(f,{}),n.get(f)[u]=!0;return!0};for(let l of e.issues)i(l,"l")||t.issues.push(l);for(let l of r.issues)i(l,"r")||t.issues.push(l);let a=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=s?a.filter(u=>s.keys.includes(u)):[];l.length&&t.issues.push({...s,keys:l});for(let u of a)!l.includes(u)&&o.has(u)&&t.issues.push(o.get(u))}let c=Ev(e.value,r.value);if(!c.valid){if(Ir(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return t.value=c.data,t}function lR(t,e){return t.value=e.issues.length?void 0:e.value,t}function uR(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function dR(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function fR(t,e,r,n){return e.issues.length?(t.value=r.catchValue({...e,value:t.value,error:{issues:e.issues.map(s=>Nr(s,n,er()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}function up(t,e,r){return t.issues.some(n=>n.code!=="unrecognized_keys")?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}function pR(t){return t.memo||(t.value=Object.freeze(t.value)),t}function hR(t,e,r,n){if(!t){let s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(Ti(s))}}var Oe,mR,rl,Re,Pv,Ov,Iv,gR,dp,uW,Nv,Cv,Rv,Av,zv,jv,Mv,Lv,_R,vR,wR,bR,Dv,pW,qv,Fv,Zv,Uv,Vv,pp,Bv,Kv,Hv,hp,Wv,Jv,Gv,Yv,Xv,Qv,yW,ew,ER,mp,tw,rw,nw,sw,ow,iw,gp,aw,cw,lw,uw,dw,fw,yp,TR,pw,hw,mw=$(()=>{cp();Qs();kv();el();St();xv();St();Oe=E("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=sR;let n=t._zod.def.checks,s=t._zod.traits.has("$ZodCheck")?[t,...n??[]]:n?.length?[...n]:[];for(let o of s)for(let i of o._zod.onattach)i(t);if(s.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,c,l)=>{if(a.memo)return a;let u=Ir(a),d;for(let f of c){if(f._zod.def.when){if(cv(a)||!f._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&l?.async===!1)throw new Cr;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(rp(a.issues,p,t),u||(u=Ir(a,p)))});else{if(a.issues.length===p)continue;rp(a.issues,p,t),u||(u=Ir(a,p))}}return d?d.then(()=>a):a},i=(a,c,l)=>{if(Ir(a))return a.aborted=!0,a;let u=o(c,s,l);if(u instanceof Promise){if(l.async===!1)throw new Cr;return u.then(d=>t._zod.parse(d,l))}return t._zod.parse(u,l)};t._zod.run=(a,c)=>{if(c.skipChecks)return t._zod.parse(a,c);if(c.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,a,c)):i(u,a,c)}let l=t._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new Cr;return l.then(u=>o(u,s,c))}return o(l,s,c)}}},{get"~standard"(){return np(this,"~standard",Tv(this))},set"~standard"(t){Qr(this,"~standard",t)}}),mR=(t,e)=>t.issues.length?{issues:t.issues.map(r=>Nr(r,e,er()))}:{value:t.value};rl=E("$ZodString",(t,e)=>{Oe.init(t,e),t._zod.pattern=e.pattern??qC,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Re=E("$ZodStringFormat",(t,e)=>{tl.init(t,e),rl.init(t,e)}),Pv=E("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=xC),Re.init(t,e)}),Ov=E("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=vv(n))}else e.pattern??(e.pattern=vv());Re.init(t,e)}),Iv=E("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=EC),Re.init(t,e)}),gR=1,dp=2;uW=/[\t\n\r]/g;Nv=E("$ZodURL",(t,e)=>{Re.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),s=cW(n,e);if(s===gR){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}if(s===dp){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort});return}if(s===!0){r.value=oR(n);return}e.hostname&&!dW(s,e.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort}),e.protocol&&!fW(s,e.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort}),r.value=e.normalize?s.href:oR(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Cv=E("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=TC()),Re.init(t,e)}),Rv=E("$ZodNanoID",(t,e)=>{if(e.length!==void 0&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);e.pattern??(e.pattern=e.length===void 0?SC:$C(e.length)),Re.init(t,e)}),Av=E("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=yC),Re.init(t,e)}),zv=E("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=_C),Re.init(t,e)}),jv=E("$ZodULID",(t,e)=>{e.pattern??(e.pattern=vC),Re.init(t,e)}),Mv=E("$ZodXID",(t,e)=>{e.pattern??(e.pattern=wC),Re.init(t,e)}),Lv=E("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=bC),Re.init(t,e)}),_R=E("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=DC(e)),Re.init(t,e)}),vR=E("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=MC),Re.init(t,e)}),wR=E("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=LC(e)),Re.init(t,e)}),bR=E("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=kC),Re.init(t,e)}),Dv=E("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=PC),Re.init(t,e)}),pW=/^[0-9a-fA-F:.]+$/;qv=E("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=OC),Re.init(t,e),t._zod.check=r=>{SR(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}),Fv=E("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=IC),Re.init(t,e)});Zv=E("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=NC),Re.init(t,e),t._zod.check=r=>{hW(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}});Uv=/^[0-9a-zA-Z+/]*={0,2}$/,Vv=E("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Uv),Re.init(t,e),t._zod.check=r=>{$R(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}}),pp=/^[A-Za-z0-9_-]*$/;Bv=E("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=pp),Re.init(t,e),t._zod.check=r=>{mW(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Kv=E("$ZodE164",(t,e)=>{e.pattern??(e.pattern=zC),Re.init(t,e)});Hv=E("$ZodJWT",(t,e)=>{Re.init(t,e),t._zod.check=r=>{gW(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),hp=E("$ZodNumber",(t,e)=>{Oe.init(t,e),t._zod.pattern=Qc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:String(s):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...o?{received:o}:{}}),r}}),Wv=E("$ZodNumberFormat",(t,e)=>{KC.init(t,e),hp.init(t,e)}),Jv=E("$ZodBoolean",(t,e)=>{Oe.init(t,e),t._zod.pattern=FC,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),r}}),Gv=E("$ZodNull",(t,e)=>{Oe.init(t,e),t._zod.pattern=ZC,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:t}),r}}),Yv=E("$ZodUnknown",(t,e)=>{Oe.init(t,e),t._zod.parse=r=>r}),Xv=E("$ZodNever",(t,e)=>{Oe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});Qv=E("$ZodArray",(t,e)=>{Oe.init(t,e);let r=jt.memoizer;r?.attach(t),t._zod.parse=(n,s)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=r?r.alloc(t,n,Array(o.length),s):Array(o.length);let i=[],a=s?.abortEarly;for(let c=0;c<o.length;c++){let l=o[c],u=e.element._zod.run({value:l,issues:[]},s);if(u instanceof Promise)i.push(u.then(d=>iR(d,n,c)));else if(iR(u,n,c),a&&u.issues.length!==0&&Ir(u))break}return i.length?Promise.all(i).then(()=>n):n}});yW=[];ew=E("$ZodObject",(t,e)=>{Oe.init(t,e);let r=Object.getOwnPropertyDescriptor(e,"shape"),n=r?.get?r.get.raw:e.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(e,"shape",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(e,"shape",{get:l})}let s=xi(()=>kR(e));_e(t,"propValues",l=>{let u=l.def.shape,d={};for(let f in u){let p=u[f]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,f)||At(d,f,new Set);for(let m of p.values)d[f].add(m);p.optin!==void 0&&d[f].add(void 0)}}return d});let o=Xs,i=e.catchall,a,c=jt.memoizer;c?.attach(t),t._zod.parse=(l,u)=>{a??(a=s.value);let d=l.value;if(!o(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:t}),l;l.value=c?c.alloc(t,l,{},u):{};let f=[],p=a.shape,m=u?.abortEarly,h=l.issues.length;for(let g of a.allKeys){if(m&&l.issues.length!==h){if(Ir(l,h))break;h=l.issues.length}if(g==="__proto__")continue;let y=p[g],w=y._zod.optin,b=y._zod.optout,x=y._zod.run({value:d[g],issues:[]},u);x instanceof Promise?f.push(x.then(v=>fp(v,l,g,d,w,b))):fp(x,l,g,d,w,b)}return i?xR(f,d,l,u,s.value,t,m===!0):f.length?Promise.all(f).then(()=>l):l}}),ER=E("$ZodObjectJIT",(t,e)=>{ew.init(t,e);let r=t._zod.parse,n=xi(()=>kR(e)),s=jt.memoizer,o=p=>{let m=n.value,h=m.symbolKeys,g=new lp(["payload","ctx"],{shape:p,inst:t,memo:s,syms:h}),y=v=>`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`,w=(v,S)=>`
|
|
238
|
+
let ${v}_ab = false;
|
|
239
|
+
for (let i = 0; i < ${v}.issues.length; i++) {
|
|
240
|
+
const iss = ${v}.issues[i];
|
|
241
|
+
iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
|
|
242
|
+
payload.issues.push(iss);
|
|
243
|
+
if (iss.continue !== true) ${v}_ab = true;
|
|
244
|
+
}
|
|
245
|
+
if (${v}_ab && ctx && ctx.abortEarly) {
|
|
246
|
+
payload.value = newResult;
|
|
247
|
+
return payload;
|
|
248
|
+
}`;g.write("const input = payload.value;");let b=Object.create(null),x=0;for(let v of m.allKeys)b[v]=`key_${x++}`;g.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let v of m.allKeys){if(v==="__proto__")continue;let S=b[v],T=typeof v=="symbol"?`syms[${h.indexOf(v)}]`:rv(v),I=`${T} in input`,A=p[v],U=A?._zod?.optin,ae=U!==void 0,J=A?._zod?.optout==="optional";if(g.write(`const ${S} = ${y(T)};`),ae&&J){let Y=U==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;g.write(`
|
|
249
|
+
const ${S}_present = ${I};
|
|
250
|
+
if (!${S}.issues.length || ${S}_present) {
|
|
251
|
+
if (${S}.issues.length) {${w(S,T)}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (${Y}) {
|
|
255
|
+
newResult[${T}] = ${S}.value;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
`)}else ae?(g.write(`
|
|
260
|
+
if (${S}.issues.length) {${w(S,T)}
|
|
261
|
+
}
|
|
262
|
+
`),U==="defaulted"?g.write(`newResult[${T}] = ${S}.value;`):g.write(`
|
|
263
|
+
if (${S}.value !== undefined || ${I}) {
|
|
264
|
+
newResult[${T}] = ${S}.value;
|
|
265
|
+
}
|
|
266
|
+
`)):g.write(`
|
|
267
|
+
const ${S}_present = ${I};
|
|
268
|
+
if (${S}.issues.length) {${w(S,T)}
|
|
269
|
+
}
|
|
270
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
271
|
+
payload.issues.push({
|
|
272
|
+
code: "invalid_type",
|
|
273
|
+
expected: "nonoptional",
|
|
274
|
+
input: undefined,
|
|
275
|
+
path: [${T}]
|
|
276
|
+
});
|
|
277
|
+
if (ctx && ctx.abortEarly) {
|
|
278
|
+
payload.value = newResult;
|
|
279
|
+
return payload;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (${S}_present) {
|
|
284
|
+
newResult[${T}] = ${S}.value;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Xs,c=!jt.jitless,u=c&&sv.value,d=e.catchall,f;t._zod.parse=(p,m)=>{f??(f=n.value);let h=p.value;return a(h)?c&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(e.shape)),p=i(p,m),d?xR([],h,p,m,f,t,m?.abortEarly===!0):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),p)}});mp=E("$ZodUnion",(t,e)=>{Oe.init(t,e),_e(t,"optin",n=>n.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":n.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),_e(t,"optout",n=>n.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),_e(t,"values",n=>{if(n.def.options.every(s=>s._zod.values))return new Set(n.def.options.flatMap(s=>Array.from(s._zod.values)))}),_e(t,"pattern",n=>{if(n.def.options.every(s=>s._zod.pattern)){let s=n.def.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Zc(o.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,s)=>{if(r)return r(n,s);let o=!1,i=[];for(let a of e.options){let c=a._zod.run({value:n.value,issues:[]},s);if(c instanceof Promise)i.push(c),o=!0;else{if(c.issues.length===0)return c;i.push(c)}}return o?Promise.all(i).then(a=>aR(a,n,t,s)):aR(i,n,t,s)}});tw=E("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,mp.init(t,e);let r=t._zod.parse;_e(t,"propValues",s=>{let o={},i=0;for(let a of s.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${s.def.options.indexOf(a)}"`);c[s.def.discriminator]?.has(void 0)&&i++;for(let[l,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(o,l)||At(o,l,new Set);for(let d of u)o[l].add(d)}}return!s.def.unionFallback&&i>1&&o[s.def.discriminator]?.delete(void 0),o}),e.options.forEach((s,o)=>{let i=Ei(s._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,e.discriminator))throw new Error(`Invalid discriminated union option at index "${o}"`)});let n=xi(()=>_W(e));t._zod.parse=(s,o)=>{let i=s.value;if(!Xs(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),s;let a=i?.[e.discriminator],c=n.value.get(a);return c&&(a!==void 0||o.direction!=="backward")?c._zod.run(s,o):e.unionFallback||o.direction==="backward"?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:i,path:[e.discriminator],inst:t}),s)}}),rw=E("$ZodIntersection",(t,e)=>{Oe.init(t,e),t._zod.parse=(r,n)=>{let s=r.value,o=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,l])=>cR(r,c,l)):cR(r,o,i)}});nw=E("$ZodRecord",(t,e)=>{Oe.init(t,e);let r=jt.memoizer;r?.attach(t),t._zod.parse=(n,s)=>{let o=n.value;if(!cs(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let i=[],a=e.keyType._zod.values;if(a&&!e.partial){n.value=r?r.alloc(t,n,{},s):{};let c=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(c.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;let d=e.keyType._zod.run({value:u,issues:[]},s);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(m=>Nr(m,s,er())),input:u,path:[u],inst:t});continue}let f=d.value;if(f==="__proto__")continue;let p=e.valueType._zod.run({value:o[u],issues:[]},s);p instanceof Promise?i.push(p.then(m=>{m.issues.length&&n.issues.push(...Tn(u,m.issues)),n.value[f]=m.value})):(p.issues.length&&n.issues.push(...Tn(u,p.issues)),n.value[f]=p.value)}let l;for(let u in o)if(!c.has(u))if(e.mode==="loose"){if(u==="__proto__")continue;n.value[u]=o[u]}else l=l??[],l.push(u);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:l,continue:!0})}else{n.value=r?r.alloc(t,n,{},s):{};let c;for(let l of Reflect.ownKeys(o)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,l))continue;let u=e.keyType._zod.run({value:l,issues:[]},s);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Qc.test(l)&&u.issues.length){let m=e.keyType._zod.run({value:Number(l),issues:[]},s);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){e.mode==="loose"?n.value[l]=o[l]:a?(c=c??[],c.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>Nr(m,s,er())),input:l,path:[l],inst:t});continue}let f=u.value;if(f==="__proto__")continue;let p=e.valueType._zod.run({value:o[l],issues:[]},s);p instanceof Promise?i.push(p.then(m=>{m.issues.length&&n.issues.push(...Tn(l,m.issues)),n.value[f]=m.value})):(p.issues.length&&n.issues.push(...Tn(l,p.issues)),n.value[f]=p.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}}),sw=E("$ZodEnum",(t,e)=>{Oe.init(t,e);let r=$i(e.entries),n=new Set(r);t._zod.values=n,_e(t,"pattern",s=>{let o=$i(s.def.entries).filter(i=>iv.has(typeof i));return new RegExp(o.length?`^(${o.map(i=>En(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(s,o)=>{let i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:r,input:i,inst:t}),s}}),ow=E("$ZodLiteral",(t,e)=>{Oe.init(t,e);let r=new Set(e.values);t._zod.values=r,_e(t,"pattern",n=>{let s=n.def.values;return new RegExp(s.length?`^(${s.map(o=>typeof o=="string"?En(o):o?En(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(n,s)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}}),iw=E("$ZodTransform",(t,e)=>{Oe.init(t,e),t._zod.optin="optional",jt.memoizer?.guard(t),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pi(t.constructor.name);let s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Cr;return r.value=s,r}});gp=E("$ZodOptional",(t,e)=>{Oe.init(t,e),_e(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",_e(t,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),_e(t,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zc(n.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(r.value===void 0){if(e.innerType._zod.optin!=="defaulted")return r;let s=e.innerType._zod.run({value:r.value,issues:[]},n);return s instanceof Promise?s.then(o=>lR(r,o)):lR(r,s)}return e.innerType._zod.run(r,n)}}),aw=E("$ZodExactOptional",(t,e)=>{gp.init(t,e),_e(t,"values",r=>r.def.innerType._zod.values),_e(t,"pattern",r=>r.def.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),cw=E("$ZodNullable",(t,e)=>{Oe.init(t,e),_e(t,"optin",r=>r.def.innerType._zod.optin),_e(t,"optout",r=>r.def.innerType._zod.optout),_e(t,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zc(n.source)}|null)$`):void 0}),_e(t,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),lw=E("$ZodDefault",(t,e)=>{Oe.init(t,e),t._zod.optin="defaulted",_e(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>uR(o,e)):uR(s,e)}});uw=E("$ZodPrefault",(t,e)=>{Oe.init(t,e),t._zod.optin="defaulted",_e(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),dw=E("$ZodNonOptional",(t,e)=>{Oe.init(t,e),_e(t,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>dR(o,t)):dR(s,t)}});fw=E("$ZodCatch",(t,e)=>{Oe.init(t,e),_e(t,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),_e(t,"optout",r=>r.def.innerType._zod.optout),_e(t,"values",r=>r.def.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let s=e.innerType._zod.run({value:r.value,issues:[]},n);return s instanceof Promise?s.then(o=>fR(r,o,e,n)):fR(r,s,e,n)}}),yp=E("$ZodPipe",(t,e)=>{Oe.init(t,e),_e(t,"values",r=>r.def.in._zod.values),_e(t,"optin",r=>r.def.in._zod.optin),_e(t,"optout",r=>r.def.out._zod.optout),_e(t,"propValues",r=>r.def.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=e.out._zod.run(r,n);return o instanceof Promise?o.then(i=>up(i,e.in,n)):up(o,e.in,n)}let s=e.in._zod.run(r,n);return s instanceof Promise?s.then(o=>up(o,e.out,n)):up(s,e.out,n)}});TR=E("$ZodPreprocess",(t,e)=>{yp.init(t,e)}),pw=E("$ZodReadonly",(t,e)=>{Oe.init(t,e),_e(t,"propValues",r=>r.def.innerType._zod.propValues),_e(t,"values",r=>r.def.innerType._zod.values),_e(t,"optin",r=>r.def.innerType?._zod?.optin),_e(t,"optout",r=>r.def.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(pR):pR(s)}});hw=E("$ZodCustom",(t,e)=>{rt.init(t,e),Oe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(o=>hR(o,r,n,t));hR(s,r,n,t)}})});function OR(t){return t!==null&&typeof t=="object"}function gw(t){return t.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}function bp(t,e,r){let n=IR.get(t);if(n!==void 0)return n?sl:nl;if(e.has(t))return sl;e.add(t);let s=nl,o=u=>{if(s!==sl&&u?._zod){let d=bp(u,e,r);d>s&&(s=d)}},i=(u,d)=>{let f=nl;for(let p of Reflect.ownKeys(u)){let m=Object.getOwnPropertyDescriptor(u,p);if(d&&!m.enumerable)continue;let h=m.get?wp:m.value?._zod?bp(m.value,e,r):nl;h>f&&(f=h)}return f},a=u=>{u>s&&(s=u)},c=t._zod.def,l=c.type;switch(l){case"object":{let u=Ei(c);a(u?i(u,!0):wp),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let u of c.items)o(u);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let u of c.options)o(u);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let u=c._cachedInner??(r?t._zod.innerType:void 0);a(u?bp(u,e,!1):wp);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let f=d.value;if(!(!f||typeof f!="object")){if(f._zod)o(f);else if(Array.isArray(f))for(let p of f)o(p)}}}return e.delete(t),vW(t,s)}function vW(t,e){return e!==wp&&IR.set(t,e===sl),e}function wW(t,e){let r=t.buckets.get(e);return r||(r=new WeakMap,t.buckets.set(e,r)),r}function NR(){return bW}function SW(t,e){let r=t[_w]?.backEdges;return r!==void 0&&OR(e)&&r.has(e)}var yw,_w,PR,IR,nl,wp,sl,_p,vp,bW,CR=$(()=>{St();yw=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},_w="~memo",PR=[];IR=new WeakMap,nl=0,wp=1,sl=2;vp=[],bW={alloc(t,e,r){let n=_p;if(!n)return r;_p=void 0;let s={value:r,issues:null};return n.set(e.value,s),vp.push(s),r},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{let r=t._zod.parse,n=(s,o)=>{if(o.direction!=="backward"&&SW(o,s.value))throw new yw;return r(s,o)};t._zod.parse=n,t._zod.run===r&&(t._zod.run=n)})},attach(t){var e;let r,n=!1,s,o;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{let i=t._zod.parse,a=(c,l)=>{if(r===void 0){let y=bp(t,new Set,!1);if(y===nl)return t._zod.parse=i,t._zod.run===a&&(t._zod.run=i),i(c,l);y===sl||n?r=!0:n=!0}let u=c.value;if(!OR(u))return i(c,l);let d=l[_w];d||(d={buckets:new WeakMap,backEdges:void 0},l[_w]=d);let f;s===l?f=o:(f=wW(d,t),s=l,o=f);let p=f.get(u);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...gw(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;_p=f;let m=vp.length,h=i(c,l);_p=void 0;let g=vp.length>m?vp.pop():void 0;return h instanceof Promise?h.then(y=>(g&&(g.issues=y.issues.length?gw(y.issues):PR),y)):(g&&(g.issues=h.issues.length?gw(h.issues):PR),h)};t._zod.parse=a,t._zod.run===i&&(t._zod.run=a)})}}});function RR(){return{localeError:$W()}}var $W,AR=$(()=>{St();$W=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function s(o,i){return o==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[o]??o}return o=>{switch(o.code){case"invalid_type":{let i=s(o.expected),a=lv(o.input),c=s(a,o.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Qf(o.values[0])}`:`Invalid option: expected one of ${Yf(o.values,"|")}`;case"too_big":{let i=o.exact?"exactly ":o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.exact?"exactly ":o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Yf(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(a=>`'${a}'`).join(" | ")}`:o.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}}});var Sp=$(()=>{});function kW(){return new ww}var zR,ww,eo,bw=$(()=>{ww=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let s={...n,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(zR=globalThis).__zod_globalRegistry??(zR.__zod_globalRegistry=kW());eo=globalThis.__zod_globalRegistry});var jR=$(()=>{});function MR(t){return t.checks&&(t.checks=[...t.checks]),t}function Sw(t,e){return new t(MR({type:"string",...Z(e)}))}function $w(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Z(e)})}function kw(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Z(e)})}function xw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(e)})}function Ew(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(e)})}function Tw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(e)})}function Pw(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(e)})}function Ow(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Z(e)})}function Iw(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(e)})}function Nw(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(e)})}function Cw(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(e)})}function Rw(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(e)})}function Aw(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(e)})}function zw(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Z(e)})}function jw(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(e)})}function Mw(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(e)})}function Lw(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(e)})}function Dw(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(e)})}function qw(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(e)})}function Fw(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Z(e)})}function Zw(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(e)})}function Uw(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Z(e)})}function Vw(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(e)})}function $p(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(e)})}function kp(t,e){return new t({type:"string",format:"date",check:"string_format",...Z(e)})}function xp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Z(e)})}function Ep(t,e){return new t({type:"string",format:"duration",check:"string_format",...Z(e)})}function Bw(t,e){return new t(MR({type:"number",checks:[],...Z(e)}))}function Kw(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(e)})}function Hw(t,e){return new t({type:"boolean",...Z(e)})}function Ww(t,e){return new t({type:"null",...Z(e)})}function Jw(t){return new t({type:"unknown"})}function Gw(t,e){return new t({type:"never",...Z(e)})}function Tp(t,e){return new Sv({check:"less_than",...Z(e),value:t,inclusive:!1})}function ol(t,e){return new Sv({check:"less_than",...Z(e),value:t,inclusive:!0})}function Pp(t,e){return new $v({check:"greater_than",...Z(e),value:t,inclusive:!1})}function il(t,e){return new $v({check:"greater_than",...Z(e),value:t,inclusive:!0})}function Op(t,e){return new BC({check:"multiple_of",...Z(e),value:t})}function Ip(t,e){return new HC({check:"max_length",...Z(e),maximum:t})}function Ii(t,e){return new WC({check:"min_length",...Z(e),minimum:t})}function Np(t,e){return new JC({check:"length_equals",...Z(e),length:t})}function Yw(t,e){return new GC({check:"string_format",format:"regex",...Z(e),pattern:t})}function Xw(t){return new YC({check:"string_format",format:"lowercase",...Z(t)})}function Qw(t){return new XC({check:"string_format",format:"uppercase",...Z(t)})}function eb(t,e){return new QC({check:"string_format",format:"includes",...Z(e),includes:t})}function tb(t,e){return new eR({check:"string_format",format:"starts_with",...Z(e),prefix:t})}function rb(t,e){return new tR({check:"string_format",format:"ends_with",...Z(e),suffix:t})}function ls(t){return new rR({check:"overwrite",tx:t})}function nb(t){return ls(e=>e.normalize(t))}function sb(){return ls(t=>t.trim())}function ob(){return ls(t=>t.toLowerCase())}function ib(){return ls(t=>t.toUpperCase())}function ab(){return ls(t=>nv(t))}function LR(t,e,r){return new t({type:"array",element:e,...Z(r)})}function cb(t,e,r){let n=Z(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function lb(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Z(r)})}function ub(t,e){let r=xW(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(Ti(s,n.value,r._zod.def));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(Ti(o))}},t(n.value,n)),e);return r}function xW(t,e){let r=new rt({check:"custom",...Z(e)});return r._zod.check=t,r}var DR=$(()=>{cp();St()});function al(t,...e){for(let r of e)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&At(t,n,r[n]);return t}function ll(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??eo,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:t?.cycles??"ref",reused:t?.reused??"inline",intersections:[],deferred:[],external:t?.external??void 0}}function nt(t,e,r,n,s){let o=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:n.path,message:s}):e.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(s);return Object.assign(r,o),!0}function Ie(t,e,r={path:[],schemaPath:[]}){var n;let s=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,u);else{let f=i.schema,p=e.processors[s.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);p(t,e,f,u)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),Ie(d,e,u),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&al(i.schema,c),e.io==="input"&&$t(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function qR(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function ul(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;let n=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let s=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,f=t.external.uri??(m=>m);if(d)return{ref:f(d)};let p=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${qR(p)}`}}let c="#",l=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let u=i[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:l+qR(u)}},o=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=s(i);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
288
|
+
|
|
289
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){o(i);continue}if(t.external){let l=t.external.registry.get(i[0])?.id;if(e!==i[0]&&l){o(i);continue}}if(t.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}a.count>1&&t.reused==="ref"&&o(i)}t.external&&(t.sharedDefsExtractedFor=t.external)}function UR(t){let e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;let r=[];for(let n of e){if(!n||typeof n!="object")return;UR(n);let s=Object.keys(n);if(s.length!==1||s[0]!=="type")return;let o=n.type;for(let i of Array.isArray(o)?o:[o]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete t.anyOf,t.type=r.length===1?r[0]:r}function ZR(t){let e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function db(t){let e=[];for(let o of t){if(typeof o!="object"||o.type!=="object")return null;for(let i in o)if(!VR.has(i))return null;e.push(o)}let r={},n=new Set;for(let o of e){for(let i in o.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let l of e){let u=l.properties?.[i]??ZR(l);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let c=a.length===1?a[0]:db(a)??{allOf:a};At(r,i,c)}for(let i of o.required??[])n.add(i)}let s={type:"object",properties:r};if(n.size&&(s.required=[...n]),e.every(o=>o.additionalProperties===!1))s.additionalProperties=!1;else{let o=[];for(let i of e){let a=ZR(i);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?s.additionalProperties=o[0]:o.length>1&&(s.additionalProperties={allOf:o})}return s}function EW(t){let e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(let s of VR)if(s in t)return;let r=e.filter(s=>FR.some(o=>Array.isArray(s[o]))),n=null;if(!r.length)n=db(e);else{let s=r[0],o=FR.find(c=>Array.isArray(s[c]));if(Object.keys(s).length!==1)return;let i=e.filter(c=>c!==s),a=s[o].map(c=>db([...i,c]));if(a.some(c=>!c))return;n={[o]:a}}n&&(delete t.allOf,al(t,n))}function dl(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=t.seen.get(d),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):al(l,m),al(l,u),a._zod.parent===d)for(let g in l)g==="$ref"||g==="allOf"||g in u||delete l[g];if(m.$ref&&p.def)for(let g in l)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(l[g])===JSON.stringify(p.def[g])&&delete l[g]}let f=a._zod.parent;if(f&&f!==d){n(f);let p=t.seen.get(f);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let m in l)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(l[m])===JSON.stringify(p.def[m])&&delete l[m]}t.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(let a of[...t.seen.entries()].reverse())n(a[0]);if(t.target!=="openapi-3.0")for(let a of t.seen.entries())UR(a[1].def??a[1].schema);for(let a of t.deferred)a();if(t.intersections.length){let a=new Map;for(let c of t.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(l):a.set(u,[l])}for(let c of t.intersections)for(let l of a.get(c)??[])EW(l)}}let s={};if(t.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");s.$id=t.external.uri(a)}al(s,r.defId?r.schema:r.def??r.schema);let o=t.metadataRegistry.get(e)?.id;o!==void 0&&s.id===o&&delete s.id;let i=t.external?.defs??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,At(i,c.defId,c.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:cl(e,"input",t.processors),output:cl(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function $t(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return $t(n.element,r);if(n.type==="set")return $t(n.valueType,r);if(n.type==="lazy")return $t(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return $t(n.innerType,r);if(n.type==="intersection")return $t(n.left,r)||$t(n.right,r);if(n.type==="record"||n.type==="map")return $t(n.keyType,r)||$t(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:$t(n.in,r)||$t(n.out,r);if(n.type==="object"){for(let s in n.shape)if($t(n.shape[s],r))return!0;return!1}if(n.type==="union"){for(let s of n.options)if($t(s,r))return!0;return!1}if(n.type==="tuple"){for(let s of n.items)if($t(s,r))return!0;return!!(n.rest&&$t(n.rest,r))}return!1}var VR,FR,BR,cl,Cp=$(()=>{bw();St();VR=new Set(["type","properties","required","additionalProperties"]),FR=["oneOf","anyOf"];BR=(t,e={})=>r=>{let n=ll({...r,processors:e});return Ie(t,n),ul(n,t),dl(n,t)},cl=(t,e,r={})=>n=>{let{libraryOptions:s,target:o}=n??{},i=ll({...s??{},target:o,io:e,processors:r});return Ie(t,i),ul(i,t),dl(i,t)}});function Mt(t){let e={},r=t._zod.def,n=t._zod.traits.has("$ZodCheck")?[t,...r.checks??[]]:r.checks??[];for(let o of n)TW[o._zod.def.check]?.(e,o._zod.def);let s=t._zod.bag;s.minimum!==void 0&&Ni(e,"minimum",s.minimum),s.exclusiveMinimum!==void 0&&Ni(e,"exclusiveMinimum",s.exclusiveMinimum),s.maximum!==void 0&&Ci(e,"maximum",s.maximum),s.exclusiveMaximum!==void 0&&Ci(e,"exclusiveMaximum",s.exclusiveMaximum),s.multipleOf!==void 0&&YR(e,s.multipleOf),s.format!==void 0&&(e.format??(e.format=s.format),s.format.includes("int")&&(e.isInt=!0)),s.mime&&QR(e,s.mime);for(let o of s.patterns??[])XR(e,o);return e}function fl(t){let e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?fl(e.out):e.type==="catch"?fl(e.innerType):t._zod.optin}function fb(t,e,r){if(e.$ref){if(r.has(e))return e;r.add(e);let m=t.get(e)?.def;if(!m)return e;let h=fb(t,m,r);return h===m?e:h}for(let m of["anyOf","oneOf"]){let h=e[m];if(!Array.isArray(h))continue;let g=h.map(y=>fb(t,y,r));g.some((y,w)=>y!==h[w])&&(e={...e,[m]:g})}let n=Array.isArray(e.type)?e.type:[e.type],s=!n.includes("string")&&n.some(m=>m==="number"||m==="integer"),o=e.enum??(e.const!==void 0?[e.const]:void 0);if(!s&&!o?.some(m=>typeof m=="number"))return e;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=e;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),s&&(p.type="string",o||(p.pattern=(n.includes("number")?Qc:wv).source)),p}function IW(t){let e=new Map;for(let n of t.seen.values())n.def&&!e.has(n.schema)&&e.set(n.schema,n);let r=new Map;for(let n of pb.get(t)??[]){let s=t.seen.get(n),o=(s?.def??s?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let i=fb(e,o,new Set);i!==o&&r.set(o,i)}if(r.size)for(let n of t.seen.values())for(let s of[n.schema,n.def]){let o=s&&r.get(s.propertyNames);o&&(s.propertyNames=o)}}function gA(t,e,r,n,s){let o=!1,i=JSON.stringify(t,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(nt(e,r,n,s,"BigInt defaults cannot be represented in JSON Schema"),Nb):JSON.parse(i)}function Mb(t,e){if("_idmap"in t){let n=t,s=ll({...e,processors:GR}),o={};for(let c of n._idmap.entries()){let[l,u]=c;Ie(u,s)}let i={},a={registry:n,uri:e?.uri,defs:o};s.external=a;for(let c of n._idmap.entries()){let[l,u]=c;ul(s,u),At(i,l,dl(s,u))}if(Object.keys(o).length>0){let c=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:o}}return{schemas:i}}let r=ll({...e,processors:GR});return Ie(t,r),ul(r,t),dl(r,t)}var Ni,Ci,KR,YR,XR,QR,eA,HR,WR,JR,TW,PW,OW,tA,hb,mb,gb,rA,nA,yb,sA,oA,_b,iA,vb,aA,wb,bb,cA,lA,uA,dA,Sb,fA,$b,pA,hA,kb,xb,Eb,Tb,mA,pb,Pb,Ob,Ib,Nb,Cb,Rb,Ab,zb,jb,yA,Rp,_A,GR,Lb=$(()=>{el();mw();Cp();St();Ni=(t,e,r)=>{(t[e]===void 0||r>t[e])&&(t[e]=r)},Ci=(t,e,r)=>{(t[e]===void 0||r<t[e])&&(t[e]=r)},KR=(t,e)=>{Ni(t,"minimum",e),Ci(t,"maximum",e)},YR=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},XR=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},QR=(t,e)=>{t.mime=t.mime?t.mime.filter(r=>e.includes(r)):[...e]},eA=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},HR=(t,e)=>Ni(t,"minimum",e.minimum),WR=(t,e)=>Ci(t,"maximum",e.maximum),JR=t=>(e,r)=>{eA(e,r.format);let[n,s]=t[r.format];Ni(e,"minimum",n),Ci(e,"maximum",s)},TW={greater_than:(t,e)=>Ni(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>Ci(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>YR(t,e.value),number_format:JR(Uc),bigint_format:JR(ep),min_length:HR,max_length:WR,length_equals:(t,e)=>KR(t,e.length),min_size:HR,max_size:WR,size_equals:(t,e)=>KR(t,e.size),string_format:(t,e)=>{eA(t,e.format),e.pattern&&XR(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>QR(t,e.mime)};PW={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},OW=new Map([[Uv,CC],[pp,RC]]),tA=t=>OW.get(t)??t,hb=(t,e,r,n)=>{let s=r;s.type="string";let{minimum:o,maximum:i,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Mt(t);if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),a&&(s.format=PW[a]??a,s.format===""&&delete s.format,(a==="time"||u)&&delete s.format),l&&(s.contentEncoding=l),c&&c.size>0){let d=[...c].map(tA);d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},mb=(t,e,r,n)=>{let s=r,{minimum:o,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Mt(t);s.type=u?"integer":"number";let d=typeof l=="number"&&l>=(o??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";if(d?p?(s.minimum=l,s.exclusiveMinimum=!0):s.exclusiveMinimum=l:typeof o=="number"&&(s.minimum=o),f?p?(s.maximum=c,s.exclusiveMaximum=!0):s.exclusiveMaximum=c:typeof i=="number"&&(s.maximum=i),a){let m=new Set;for(let y of a)Number.isFinite(y)&&y!==0?m.add(Math.abs(y)):nt(t,e,s,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[h,...g]=m;h!==void 0&&(s.multipleOf=h),g.length&&(s.allOf=[...s.allOf??[],...g.map(y=>({multipleOf:y}))])}},gb=(t,e,r,n)=>{r.type="boolean"},rA=(t,e,r,n)=>{nt(t,e,r,n,"BigInt cannot be represented in JSON Schema")},nA=(t,e,r,n)=>{nt(t,e,r,n,"Symbols cannot be represented in JSON Schema")},yb=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},sA=(t,e,r,n)=>{nt(t,e,r,n,"Undefined cannot be represented in JSON Schema")},oA=(t,e,r,n)=>{nt(t,e,r,n,"Void cannot be represented in JSON Schema")},_b=(t,e,r,n)=>{r.not={}},iA=(t,e,r,n)=>{},vb=(t,e,r,n)=>{},aA=(t,e,r,n)=>{nt(t,e,r,n,"Date cannot be represented in JSON Schema")},wb=(t,e,r,n)=>{let s=t._zod.def,o=$i(s.entries);if(o.length===0){r.not={};return}o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),r.enum=o},bb=(t,e,r,n)=>{let s=t._zod.def;if(s.values.length===0){r.not={};return}let o=[];for(let i of s.values)if(i===void 0){if(nt(t,e,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(nt(t,e,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(i))}else o.push(i);if(o.length!==0)if(o.length===1){let i=o[0];r.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[i]:r.const=i}else o.every(i=>typeof i=="number")&&(r.type="number"),o.every(i=>typeof i=="string")&&(r.type="string"),o.every(i=>typeof i=="boolean")&&(r.type="boolean"),o.every(i=>i===null)&&(r.type="null"),r.enum=o},cA=(t,e,r,n)=>{nt(t,e,r,n,"NaN cannot be represented in JSON Schema")},lA=(t,e,r,n)=>{let s=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=o.source},uA=(t,e,r,n)=>{let s=r;s.type="string",s.format="binary",s.contentEncoding="binary";let{minimum:o,maximum:i,mime:a}=Mt(t);o!==void 0&&(s.minLength=o),i!==void 0&&(s.maxLength=i),a&&(a.length===0?s.not={}:a.length===1?s.contentMediaType=a[0]:s.anyOf=a.map(c=>({contentMediaType:c})))},dA=(t,e,r,n)=>{r.type="boolean"},Sb=(t,e,r,n)=>{nt(t,e,r,n,"Custom types cannot be represented in JSON Schema")},fA=(t,e,r,n)=>{nt(t,e,r,n,"Function types cannot be represented in JSON Schema")},$b=(t,e,r,n)=>{nt(t,e,r,n,"Transforms cannot be represented in JSON Schema")},pA=(t,e,r,n)=>{nt(t,e,r,n,"Map cannot be represented in JSON Schema")},hA=(t,e,r,n)=>{nt(t,e,r,n,"Set cannot be represented in JSON Schema")},kb=(t,e,r,n)=>{let s=r,o=t._zod.def,{minimum:i,maximum:a}=Mt(t);typeof i=="number"&&(s.minItems=i),typeof a=="number"&&(s.maxItems=a),s.type="array",s.items=Ie(o.element,e,{...n,path:[...n.path,"items"]})};xb=(t,e,r,n)=>{let s=r,o=t._zod.def,i=o.shape;if(Object.getOwnPropertySymbols(i).length&&nt(t,e,s,n,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let l in i)At(s.properties,l,Ie(i[l],e,{...n,path:[...n.path,"properties",l]}));let c=[];for(let l of Object.keys(i)){let u=o.shape[l];(e.io==="input"?fl(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(s.required=c),o.catchall?._zod.def.type==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Ie(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(s.additionalProperties=!1)},Eb=(t,e,r,n)=>{let s=t._zod.def,o=s.inclusive===!1,i=s.options.map((a,c)=>Ie(a,e,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=i:r.anyOf=i},Tb=(t,e,r,n)=>{let s=t._zod.def,o=Ie(s.left,e,{...n,path:[...n.path,"allOf",0]}),i=Ie(s.right,e,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(i)?i.allOf:[i]];r.allOf=c,e.intersections.push(c)},mA=(t,e,r,n)=>{let s=r,o=t._zod.def;s.type="array";let i=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,g)=>Ie(h,e,{...n,path:[...n.path,i,g]})),l=o.rest?Ie(o.rest,e,{...n,path:[...n.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null,u=o.items.length;for(;u>0;){let h=o.items[u-1];if(!(e.io==="input"?fl(h)!==void 0:h._zod.optout==="optional"))break;u--}let d=o.items.length,f=!o.rest;e.target==="draft-2020-12"?(s.prefixItems=c,f?s.items=!1:l&&(s.items=l),u>0&&(s.minItems=u),f&&(s.maxItems=d)):e.target==="openapi-3.0"?(s.items={anyOf:c},l&&s.items.anyOf.push(l),u>0&&(s.minItems=u),f&&(s.maxItems=d)):(s.items=c,f?s.additionalItems=!1:l&&(s.additionalItems=l),u>0&&(s.minItems=u),f&&(s.maxItems=d));let{minimum:p,maximum:m}=Mt(t);typeof p=="number"&&(s.minItems=p),typeof m=="number"&&(s.maxItems=m)};pb=new WeakMap;Pb=(t,e,r,n)=>{let s=r,o=t._zod.def;s.type="object";let i=o.keyType,a=Mt(i).patterns;if(o.mode==="loose"&&a&&a.size>0){let u=Ie(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});s.patternProperties={};for(let d of a)At(s.patternProperties,tA(d).source,u)}else{if(e.target==="draft-07"||e.target==="draft-2020-12"){s.propertyNames=Ie(o.keyType,e,{...n,path:[...n.path,"propertyNames"]});let u=pb.get(e);u||(u=[],pb.set(e,u),e.deferred.push(()=>IW(e))),u.push(t)}s.additionalProperties=Ie(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,l=e.io==="input"&&fl(o.valueType)!==void 0;if(c&&!o.partial&&!l){let u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(s.required=u.map(String))}},Ob=(t,e,r,n)=>{let s=t._zod.def,o=Ie(s.innerType,e,n),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=s.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Ib=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType},Nb=Symbol();Cb=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType;let i=gA(s.defaultValue,t,e,r,n);i!==Nb&&(r.default=i)},Rb=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);if(o.ref=s.innerType,e.io!=="input")return;let i=gA(s.defaultValue,t,e,r,n);i!==Nb&&(r._prefault=i)},Ab=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{nt(t,e,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},zb=(t,e,r,n)=>{let s=t._zod.def,o=s.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?o?s.out:s.in:s.out;Ie(i,e,n);let a=e.seen.get(t);a.ref=i},jb=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType,r.readOnly=!0},yA=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType},Rp=(t,e,r,n)=>{let s=t._zod.def;Ie(s.innerType,e,n);let o=e.seen.get(t);o.ref=s.innerType},_A=(t,e,r,n)=>{let s=t._zod.innerType;Ie(s,e,n);let o=e.seen.get(t);o.ref=s},GR={string:hb,number:mb,boolean:gb,bigint:rA,symbol:nA,null:yb,undefined:sA,void:oA,never:_b,any:iA,unknown:vb,date:aA,enum:wb,literal:bb,nan:cA,template_literal:lA,file:uA,success:dA,custom:Sb,function:fA,transform:$b,map:pA,set:hA,array:kb,object:xb,union:Eb,intersection:Tb,tuple:mA,record:Pb,nullable:Ob,nonoptional:Ib,default:Cb,prefault:Rb,catch:Ab,pipe:zb,readonly:jb,promise:yA,optional:Rp,lazy:_A}});var vA=$(()=>{});var tr=$(()=>{Qs();gC();mv();mw();CR();cp();xv();St();el();Sp();bw();kv();jR();DR();Cp();vA()});var Db=$(()=>{tr()});function qb(t,e){let r={type:"object",shape:t??{},...Z(e)};return new k5(r)}var $5,k5,wA=$(()=>{tr();St();Db();$5=E("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");Oe.init(t,e),t.def=e,t.type=e.type},{get with(){return this.check},set with(t){Qr(this,"with",t)},parse(t,e){return gv(this,t,e,{callee:this.parse})},parseAsync(t,e){return yv(this,t,e,{callee:this.parseAsync})},safeParse(t,e){return Gc(this,t,e)},safeParseAsync(t,e){return Xc(this,t,e)},check(...t){let e=this.def;return this.clone({...e,checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(t,e){return zt(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},apply(t,...e){return e.length===0?t(this):t(this,...e)}}),k5=E("ZodMiniObject",(t,e)=>{ew.init(t,e),$5.init(t,e),dv(t,"shape",r=>r._zod.def.shape,!1)})});var bA=$(()=>{});var SA=$(()=>{});var $A=$(()=>{});var kA=$(()=>{tr();Db();wA();bA();Lb();Sp();SA();$A()});var Fb=$(()=>{kA()});function tn(t){return!!t._zod}function ro(t){let e=Object.values(t);if(e.length===0)return qb({});let r=e.every(tn),n=e.every(s=>!tn(s));if(r)return qb(t);if(n)return RN(t);throw new Error("Mixed Zod versions detected in object shape.")}function us(t,e){return tn(t)?Gc(t,e):t.safeParse(e)}async function Ap(t,e){return tn(t)?await Xc(t,e):await t.safeParseAsync(e)}function ds(t){if(!t)return;let e;if(tn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Ri(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return ro(t)}}if(tn(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function T5(t){return t.length===0?"object root":t.reduce((e,r,n)=>n===0?String(r):typeof r=="number"?`${e}[${r}]`:`${e}.${r}`,"")}function zp(t){if(t&&typeof t=="object"){if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0)return t.issues.map(e=>e.path?.length?`${e.message} at ${T5(e.path)}`:e.message).join(`
|
|
290
|
+
`);if("message"in t&&typeof t.message=="string")return t.message;try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function EA(t){return t.description}function TA(t){if(tn(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function Ai(t){if(tn(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var pl=$(()=>{Fc();Fb()});var Zb=$(()=>{tr()});function jp(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,e,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,e,{value:n,configurable:!0,writable:!0})}})}var PA,A5,rr,Ub=$(()=>{tr();tr();St();PA=new WeakSet([Object.prototype,Error.prototype]);A5=(t,e)=>{sC.init(t,e),t.name="ZodError";let r=Object.getPrototypeOf(t);PA.has(r)||(PA.add(r),jp(r,"format",n=>s=>iC(n,s)),jp(r,"flatten",n=>s=>oC(n,s)),jp(r,"addIssue",n=>s=>{n.issues.push(s),n.message=JSON.stringify(n.issues,ki,2)}),jp(r,"addIssues",n=>s=>{n.issues.push(...s),n.message=JSON.stringify(n.issues,ki,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},rr=E("ZodError",A5,void 0,{Parent:Error})});var OA,IA,NA,CA,RA,AA,zA,jA,MA,LA,DA,qA,Vb=$(()=>{tr();Ub();tr();OA=Hc(rr),IA=Wc(rr),NA=Jc(rr),CA=Yc(rr),RA=cC(rr),AA=lC(rr),zA=uC(rr),jA=dC(rr),MA=fC(rr),LA=pC(rr),DA=hC(rr),qA=mC(rr)});function j5(){jt.localeError||er(RR())}function Lp(){jt.memoizer||er({memoizer:NR()})}function k(t){return Sw(M5,t)}function $e(t){return Bw(KA,t)}function FA(t){return Kw(rJ,t)}function st(t){return Hw(nJ,t)}function HA(t){return Ww(sJ,t)}function Ze(){return Jw(oJ)}function aJ(t){return Gw(iJ,t)}function le(t,e){return LR(cJ,t,e)}function R(t,e){let r={type:"object",shape:t??{},...V.normalizeParams(e)};return new WA(r)}function kt(t,e){return new WA({type:"object",shape:t,catchall:Ze(),...V.normalizeParams(e)})}function je(t,e){return new JA({type:"union",options:t,...V.normalizeParams(e)})}function Kb(t,e,r){return new lJ({type:"union",options:e,discriminator:t,...V.normalizeParams(r)})}function Dp(t,e){return new uJ({type:"intersection",left:t,right:e})}function Ae(t,e,r){return!e||!e._zod?new ZA({type:"record",keyType:k(),valueType:t,...V.normalizeParams(e)}):new ZA({type:"record",keyType:t,valueType:e,...V.normalizeParams(r)})}function Lt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Bb({type:"enum",entries:r,...V.normalizeParams(e)})}function L(t,e){return new dJ({type:"literal",values:Array.isArray(t)?t:[t],...V.normalizeParams(e)})}function GA(t){return new fJ({type:"transform",transform:t})}function Ue(t){return new qp({type:"optional",innerType:t})}function pJ(t){return new YA({type:"optional",innerType:t})}function UA(t){return new hJ({type:"nullable",innerType:t})}function gJ(t,e){return new mJ({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}function _J(t,e){return new yJ({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():V.shallowClone(e)}})}function vJ(t,e){return new XA({type:"nonoptional",innerType:t,...V.normalizeParams(e)})}function bJ(t,e){return new wJ({type:"catch",innerType:t,catchValue:typeof e=="function"?e:V.constantCatch(e)})}function VA(t,e){return new QA({type:"pipe",in:t,out:e})}function kJ(t){return new $J({type:"readonly",innerType:t})}function t1(t,e){return cb(e1,t??(()=>!0),e)}function xJ(t,e={}){return lb(e1,t,e)}function EJ(t,e){return ub(t,e)}function Hb(t,e){return new SJ({type:"pipe",in:GA(t),out:e})}var Ve,BA,M5,He,hl,ml,gl,yl,L5,D5,Mp,q5,F5,Z5,U5,V5,B5,K5,H5,W5,J5,G5,Y5,X5,Q5,eJ,tJ,KA,rJ,nJ,sJ,oJ,iJ,cJ,WA,JA,lJ,uJ,ZA,Bb,dJ,fJ,qp,YA,hJ,mJ,yJ,XA,wJ,QA,SJ,$J,e1,Fp=$(()=>{tr();tr();Lb();Cp();AR();Zb();Vb();Ve=E("ZodType",(t,e)=>(j5(),Oe.init(t,e),t.def=e,t.type=e.type,t),{check(...t){let e=this.def;return this.clone(V.mergeDefs(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return zt(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(xJ(t,e))},superRefine(t,e){return this.check(EJ(t,e))},overwrite(t){return this.check(ls(t))},optional(){return Ue(this)},exactOptional(){return pJ(this)},nullable(){return UA(this)},nullish(){return Ue(UA(this))},nonoptional(t){return vJ(this,t)},array(){return le(this)},or(t){return je([this,t])},and(t){return Dp(this,t)},transform(t){return VA(this,GA(t))},default(t){return gJ(this,t)},prefault(t){return _J(this,t)},catch(t){return bJ(this,t)},pipe(t){return VA(this,t)},readonly(){return kJ(this)},describe(t){let e=this.clone();return eo.add(e,{description:t}),e},meta(...t){if(t.length===0)return eo.get(this);let e=this.clone();return eo.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return V.hide(this,"~standard",{...Tv(this),jsonSchema:{input:cl(this,"input"),output:cl(this,"output")}})},set"~standard"(t){V.own(this,"~standard",t)},parse:function t(e,r){return OA(this,e,r,{callee:t})},parseAsync:async function t(e,r){return await IA(this,e,r,{callee:t})},safeParse(t,e){return NA(this,t,e)},async safeParseAsync(t,e){return CA(this,t,e)},get spa(){return this?.safeParseAsync},set spa(t){V.own(this,"spa",t)},validate(t,e){return op(this,t,e)},validateAsync(t,e){return ip(this,t,e)},encode:function t(e,r){return RA(this,e,r,{callee:t})},decode:function t(e,r){return AA(this,e,r,{callee:t})},encodeAsync:async function t(e,r){return await zA(this,e,r,{callee:t})},decodeAsync:async function t(e,r){return await jA(this,e,r,{callee:t})},safeEncode(t,e){return MA(this,t,e)},safeDecode(t,e){return LA(this,t,e)},async safeEncodeAsync(t,e){return DA(this,t,e)},async safeDecodeAsync(t,e){return qA(this,t,e)},toJSONSchema(t){return BR(this,{})(t)},get description(){return eo.get(this)?.description},get _def(){return this._zod.def}}),BA=E("_ZodString",(t,e)=>{rl.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>hb(t,r,n,s)},V.derived({format:t=>Mt(t).format??null,minLength:t=>Mt(t).minimum??null,maxLength:t=>Mt(t).maximum??null},{regex(...t){return this.check(Yw(...t))},includes(...t){return this.check(eb(...t))},startsWith(...t){return this.check(tb(...t))},endsWith(...t){return this.check(rb(...t))},min(...t){return this.check(Ii(...t))},max(...t){return this.check(Ip(...t))},length(...t){return this.check(Np(...t))},nonempty(...t){return this.check(Ii(1,...t))},lowercase(t){return this.check(Xw(t))},uppercase(t){return this.check(Qw(t))},trim(){return this.check(sb())},normalize(...t){return this.check(nb(...t))},toLowerCase(){return this.check(ob())},toUpperCase(){return this.check(ib())},slugify(){return this.check(ab())}})),M5=E("ZodString",(t,e)=>{rl.init(t,e),BA.init(t,e)},{email(t){return this.check($w(L5,t))},url(t){return this.check(Ow(q5,t))},jwt(t){return this.check(Vw(tJ,t))},emoji(t){return this.check(Iw(F5,t))},guid(t){return this.check(kw(D5,t))},uuid(t){return this.check(xw(Mp,t))},uuidv4(t){return this.check(Ew(Mp,t))},uuidv6(t){return this.check(Tw(Mp,t))},uuidv7(t){return this.check(Pw(Mp,t))},nanoid(t){return this.check(Nw(Z5,t))},cuid(t){return this.check(Cw(U5,t))},cuid2(t){return this.check(Rw(V5,t))},ulid(t){return this.check(Aw(B5,t))},base64(t){return this.check(Fw(X5,t))},base64url(t){return this.check(Zw(Q5,t))},xid(t){return this.check(zw(K5,t))},ksuid(t){return this.check(jw(H5,t))},ipv4(t){return this.check(Mw(W5,t))},ipv6(t){return this.check(Lw(J5,t))},cidrv4(t){return this.check(Dw(G5,t))},cidrv6(t){return this.check(qw(Y5,t))},e164(t){return this.check(Uw(eJ,t))},datetime(t){return this.check($p(hl,t))},date(t){return this.check(kp(ml,t))},time(t){return this.check(xp(gl,t))},duration(t){return this.check(Ep(yl,t))}});He=E("ZodStringFormat",(t,e)=>{Re.init(t,e),BA.init(t,e)}),hl=E("ZodISODateTime",(t,e)=>{_R.init(t,e),He.init(t,e)}),ml=E("ZodISODate",(t,e)=>{vR.init(t,e),He.init(t,e)}),gl=E("ZodISOTime",(t,e)=>{wR.init(t,e),He.init(t,e)}),yl=E("ZodISODuration",(t,e)=>{bR.init(t,e),He.init(t,e)}),L5=E("ZodEmail",(t,e)=>{Iv.init(t,e),He.init(t,e)}),D5=E("ZodGUID",(t,e)=>{Pv.init(t,e),He.init(t,e)}),Mp=E("ZodUUID",(t,e)=>{Ov.init(t,e),He.init(t,e)}),q5=E("ZodURL",(t,e)=>{Nv.init(t,e),He.init(t,e)}),F5=E("ZodEmoji",(t,e)=>{Cv.init(t,e),He.init(t,e)}),Z5=E("ZodNanoID",(t,e)=>{Rv.init(t,e),He.init(t,e)}),U5=E("ZodCUID",(t,e)=>{Av.init(t,e),He.init(t,e)}),V5=E("ZodCUID2",(t,e)=>{zv.init(t,e),He.init(t,e)}),B5=E("ZodULID",(t,e)=>{jv.init(t,e),He.init(t,e)}),K5=E("ZodXID",(t,e)=>{Mv.init(t,e),He.init(t,e)}),H5=E("ZodKSUID",(t,e)=>{Lv.init(t,e),He.init(t,e)}),W5=E("ZodIPv4",(t,e)=>{Dv.init(t,e),He.init(t,e)}),J5=E("ZodIPv6",(t,e)=>{qv.init(t,e),He.init(t,e)}),G5=E("ZodCIDRv4",(t,e)=>{Fv.init(t,e),He.init(t,e)}),Y5=E("ZodCIDRv6",(t,e)=>{Zv.init(t,e),He.init(t,e)}),X5=E("ZodBase64",(t,e)=>{Vv.init(t,e),He.init(t,e)}),Q5=E("ZodBase64URL",(t,e)=>{Bv.init(t,e),He.init(t,e)}),eJ=E("ZodE164",(t,e)=>{Kv.init(t,e),He.init(t,e)}),tJ=E("ZodJWT",(t,e)=>{Hv.init(t,e),He.init(t,e)}),KA=E("ZodNumber",(t,e)=>{hp.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>mb(t,r,n,s),t.isFinite=!0},V.derived({minValue:t=>{let{minimum:e,exclusiveMinimum:r}=Mt(t);return Math.max(e??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:t=>{let{maximum:e,exclusiveMaximum:r}=Mt(t);return Math.min(e??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:t=>{let{isInt:e,multipleOf:r}=Mt(t);return!!e||!!r?.some(Number.isSafeInteger)},format:t=>Mt(t).format??null},{gt(t,e){return this.check(Pp(t,e))},gte(t,e){return this.check(il(t,e))},min(t,e){return this.check(il(t,e))},lt(t,e){return this.check(Tp(t,e))},lte(t,e){return this.check(ol(t,e))},max(t,e){return this.check(ol(t,e))},int(t){return this.check(FA(t))},safe(t){return this.check(FA(t))},positive(t){return this.check(Pp(0,t))},nonnegative(t){return this.check(il(0,t))},negative(t){return this.check(Tp(0,t))},nonpositive(t){return this.check(ol(0,t))},multipleOf(t,e){return this.check(Op(t,e))},step(t,e){return this.check(Op(t,e))},finite(){return this}}));rJ=E("ZodNumberFormat",(t,e)=>{Wv.init(t,e),KA.init(t,e)});nJ=E("ZodBoolean",(t,e)=>{Jv.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>gb(t,r,n,s)});sJ=E("ZodNull",(t,e)=>{Gv.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>yb(t,r,n,s)});oJ=E("ZodUnknown",(t,e)=>{Yv.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>vb(t,r,n,s)});iJ=E("ZodNever",(t,e)=>{Xv.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>_b(t,r,n,s)});cJ=E("ZodArray",(t,e)=>{Lp(),Qv.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>kb(t,r,n,s),t.element=e.element},{min(t,e){return this.check(Ii(t,e))},nonempty(t){return this.check(Ii(1,t))},max(t,e){return this.check(Ip(t,e))},length(t,e){return this.check(Np(t,e))},unwrap(){return this.element}});WA=E("ZodObject",(t,e)=>{Lp(),ER.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>xb(t,r,n,s),V.installLazyProp(t,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Lt(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(V.mergeDefs(this._zod.def,{catchall:t}))},passthrough(){return this.clone(V.mergeDefs(this._zod.def,{catchall:Ze()}))},loose(){return this.clone(V.mergeDefs(this._zod.def,{catchall:Ze()}))},strict(){return this.clone(V.mergeDefs(this._zod.def,{catchall:aJ()}))},strip(){return this.clone(V.mergeDefs(this._zod.def,{catchall:void 0}))},extend(t){return V.extend(this,t)},safeExtend(t){return V.safeExtend(this,t)},merge(t){return V.merge(this,t)},pick(t){return V.pick(this,t)},omit(t){return V.omit(this,t)},partial(...t){return V.partial(qp,this,t[0])},exactPartial(...t){return V.partial(YA,this,t[0],"exactPartial")},required(...t){return V.required(XA,this,t[0])}});JA=E("ZodUnion",(t,e)=>{mp.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Eb(t,r,n,s),t.options=e.options});lJ=E("ZodDiscriminatedUnion",(t,e)=>{JA.init(t,e),tw.init(t,e)});uJ=E("ZodIntersection",(t,e)=>{rw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Tb(t,r,n,s)});ZA=E("ZodRecord",(t,e)=>{Lp(),nw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Pb(t,r,n,s),t.keyType=e.keyType,t.valueType=e.valueType});Bb=E("ZodEnum",(t,e)=>{sw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(n,s,o)=>wb(t,n,s,o),t.enum=e.entries,t.options=[...t._zod.values];let r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Bb({...e,checks:[],...V.normalizeParams(s),entries:o})},t.exclude=(n,s)=>{let o={...e.entries};for(let i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Bb({...e,checks:[],...V.normalizeParams(s),entries:o})}});dJ=E("ZodLiteral",(t,e)=>{ow.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>bb(t,r,n,s),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});fJ=E("ZodTransform",(t,e)=>{Lp(),iw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>$b(t,r,n,s),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pi(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,e));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=t),r.issues.push(V.issue(i))}};let s=e.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});qp=E("ZodOptional",(t,e)=>{gp.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Rp(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});YA=E("ZodExactOptional",(t,e)=>{aw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Rp(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});hJ=E("ZodNullable",(t,e)=>{cw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ob(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});mJ=E("ZodDefault",(t,e)=>{lw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Cb(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});yJ=E("ZodPrefault",(t,e)=>{uw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Rb(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});XA=E("ZodNonOptional",(t,e)=>{dw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ib(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});wJ=E("ZodCatch",(t,e)=>{fw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Ab(t,r,n,s),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});QA=E("ZodPipe",(t,e)=>{yp.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>zb(t,r,n,s),t.in=e.in,t.out=e.out});SJ=E("ZodPreprocess",(t,e)=>{QA.init(t,e),TR.init(t,e)}),$J=E("ZodReadonly",(t,e)=>{pw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>jb(t,r,n,s),t.unwrap=()=>t._zod.def.innerType});e1=E("ZodCustom",(t,e)=>{hw.init(t,e),Ve.init(t,e),t._zod.processJSONSchema=(r,n,s)=>Sb(t,r,n,s)})});var r1,n1=$(()=>{r1||(r1={})});var Zp={};We(Zp,{ZodISODate:()=>ml,ZodISODateTime:()=>hl,ZodISODuration:()=>yl,ZodISOTime:()=>gl,date:()=>PJ,datetime:()=>TJ,duration:()=>IJ,time:()=>OJ});function TJ(t){return $p(hl,t)}function PJ(t){return kp(ml,t)}function OJ(t){return xp(gl,t)}function IJ(t){return Ep(yl,t)}var s1=$(()=>{tr();Fp();Fp()});var o1=$(()=>{});var Wb=$(()=>{tr();Fp();Zb();Ub();Vb();n1();Sp();s1();o1()});var i1=$(()=>{Wb()});var a1=$(()=>{i1()});var Nz={};We(Nz,{AnnotationsSchema:()=>io,AudioContentSchema:()=>Yp,BaseMetadataSchema:()=>no,BlobResourceContentsSchema:()=>l0,BooleanSchemaSchema:()=>az,CallToolRequestParamsSchema:()=>W1,CallToolRequestSchema:()=>ao,CallToolResultSchema:()=>ql,CancelTaskRequestSchema:()=>Rl,CancelTaskResultSchema:()=>o0,CancelledNotificationParamsSchema:()=>u1,CancelledNotificationSchema:()=>$l,ClientCapabilitiesSchema:()=>h1,ClientNotificationSchema:()=>WJ,ClientRequestSchema:()=>HJ,ClientResultSchema:()=>JJ,ClientTasksCapabilitySchema:()=>f1,CompatibilityCallToolResultSchema:()=>VJ,CompleteRequestParamsSchema:()=>Ez,CompleteRequestSchema:()=>Fl,CompleteResultSchema:()=>Tz,ContentBlockSchema:()=>Xp,CreateMessageRequestParamsSchema:()=>oz,CreateMessageRequestSchema:()=>iz,CreateMessageResultSchema:()=>Ui,CreateMessageResultWithToolsSchema:()=>eh,CreateTaskResultSchema:()=>oo,CursorSchema:()=>Yb,DEFAULT_NEGOTIATED_PROTOCOL_VERSION:()=>RJ,ElicitRequestFormParamsSchema:()=>vz,ElicitRequestParamsSchema:()=>bz,ElicitRequestSchema:()=>Sz,ElicitRequestURLParamsSchema:()=>wz,ElicitResultSchema:()=>co,ElicitationCompleteNotificationParamsSchema:()=>$z,ElicitationCompleteNotificationSchema:()=>kz,EmbeddedResourceSchema:()=>q1,EmptyResultSchema:()=>Sl,EnumSchemaSchema:()=>yz,ErrorCode:()=>F,GetPromptRequestParamsSchema:()=>L1,GetPromptRequestSchema:()=>Ll,GetPromptResultSchema:()=>U1,GetTaskPayloadRequestSchema:()=>Il,GetTaskPayloadResultSchema:()=>UJ,GetTaskRequestSchema:()=>Pl,GetTaskResultSchema:()=>Ol,IconSchema:()=>d1,IconsSchema:()=>ji,ImageContentSchema:()=>Gp,ImplementationSchema:()=>s0,InitializeRequestParamsSchema:()=>m1,InitializeRequestSchema:()=>kl,InitializeResultSchema:()=>y1,InitializedNotificationSchema:()=>xl,JSONRPCErrorResponseSchema:()=>bl,JSONRPCErrorSchema:()=>jJ,JSONRPCMessageSchema:()=>n0,JSONRPCNotificationSchema:()=>t0,JSONRPCRequestSchema:()=>e0,JSONRPCResponseSchema:()=>LJ,JSONRPCResultResponseSchema:()=>Kp,JSONRPC_VERSION:()=>vl,LATEST_PROTOCOL_VERSION:()=>Vp,LegacyTitledEnumSchemaSchema:()=>fz,ListChangedOptionsBaseSchema:()=>BJ,ListPromptsRequestSchema:()=>Ml,ListPromptsResultSchema:()=>M1,ListResourceTemplatesRequestSchema:()=>zl,ListResourceTemplatesResultSchema:()=>x1,ListResourcesRequestSchema:()=>Al,ListResourcesResultSchema:()=>k1,ListRootsRequestSchema:()=>Oz,ListRootsResultSchema:()=>th,ListTasksRequestSchema:()=>Nl,ListTasksResultSchema:()=>Cl,ListToolsRequestSchema:()=>Dl,ListToolsResultSchema:()=>H1,LoggingLevelSchema:()=>Zi,LoggingMessageNotificationParamsSchema:()=>Y1,LoggingMessageNotificationSchema:()=>X1,McpError:()=>j,ModelHintSchema:()=>Q1,ModelPreferencesSchema:()=>ez,MultiSelectEnumSchemaSchema:()=>gz,NotificationSchema:()=>sr,NumberSchemaSchema:()=>lz,PaginatedRequestParamsSchema:()=>w1,PaginatedRequestSchema:()=>Mi,PaginatedResultSchema:()=>Li,PingRequestSchema:()=>El,PrimitiveSchemaDefinitionSchema:()=>_z,ProgressNotificationParamsSchema:()=>v1,ProgressNotificationSchema:()=>Tl,ProgressSchema:()=>_1,ProgressTokenSchema:()=>Gb,PromptArgumentSchema:()=>z1,PromptListChangedNotificationSchema:()=>V1,PromptMessageSchema:()=>Z1,PromptReferenceSchema:()=>xz,PromptSchema:()=>j1,RELATED_TASK_META_KEY:()=>Pn,ReadResourceRequestParamsSchema:()=>E1,ReadResourceRequestSchema:()=>jl,ReadResourceResultSchema:()=>T1,RelatedTaskMetadataSchema:()=>l1,RequestIdSchema:()=>wl,RequestSchema:()=>ot,ResourceContentsSchema:()=>i0,ResourceLinkSchema:()=>F1,ResourceListChangedNotificationSchema:()=>P1,ResourceReferenceSchema:()=>KJ,ResourceRequestParamsSchema:()=>Wp,ResourceSchema:()=>u0,ResourceTemplateReferenceSchema:()=>f0,ResourceTemplateSchema:()=>$1,ResourceUpdatedNotificationParamsSchema:()=>R1,ResourceUpdatedNotificationSchema:()=>A1,ResultSchema:()=>it,RoleSchema:()=>Fi,RootSchema:()=>Pz,RootsListChangedNotificationSchema:()=>Iz,SUPPORTED_PROTOCOL_VERSIONS:()=>Jb,SamplingContentSchema:()=>nz,SamplingMessageContentBlockSchema:()=>_l,SamplingMessageSchema:()=>sz,ServerCapabilitiesSchema:()=>g1,ServerNotificationSchema:()=>YJ,ServerRequestSchema:()=>GJ,ServerResultSchema:()=>XJ,ServerTasksCapabilitySchema:()=>p1,SetLevelRequestParamsSchema:()=>G1,SetLevelRequestSchema:()=>Qp,SingleSelectEnumSchemaSchema:()=>pz,StringSchemaSchema:()=>cz,SubscribeRequestParamsSchema:()=>O1,SubscribeRequestSchema:()=>I1,TaskAugmentedRequestParamsSchema:()=>zi,TaskCreationParamsSchema:()=>AJ,TaskMetadataSchema:()=>c1,TaskSchema:()=>Di,TaskStatusNotificationParamsSchema:()=>S1,TaskStatusNotificationSchema:()=>qi,TaskStatusSchema:()=>b1,TextContentSchema:()=>Jp,TextResourceContentsSchema:()=>a0,TitledMultiSelectEnumSchemaSchema:()=>mz,TitledSingleSelectEnumSchemaSchema:()=>dz,ToolAnnotationsSchema:()=>B1,ToolChoiceSchema:()=>tz,ToolExecutionSchema:()=>K1,ToolListChangedNotificationSchema:()=>J1,ToolResultContentSchema:()=>rz,ToolSchema:()=>d0,ToolUseContentSchema:()=>D1,UnsubscribeRequestParamsSchema:()=>N1,UnsubscribeRequestSchema:()=>C1,UntitledMultiSelectEnumSchemaSchema:()=>hz,UntitledSingleSelectEnumSchemaSchema:()=>uz,UrlElicitationRequiredError:()=>Up,assertCompleteRequestPrompt:()=>p0,assertCompleteRequestResourceTemplate:()=>h0,isInitializeRequest:()=>FJ,isInitializedNotification:()=>ZJ,isJSONRPCError:()=>MJ,isJSONRPCErrorResponse:()=>Hp,isJSONRPCNotification:()=>r0,isJSONRPCRequest:()=>Bp,isJSONRPCResponse:()=>zJ,isJSONRPCResultResponse:()=>so,isTaskAugmentedRequestParams:()=>Qb});function p0(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function h0(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Vp,RJ,Jb,Pn,vl,tt,Gb,Yb,AJ,c1,l1,Xb,nr,zi,Qb,ot,ur,sr,it,wl,e0,Bp,t0,r0,Kp,so,zJ,F,bl,jJ,Hp,MJ,n0,LJ,Sl,u1,$l,d1,ji,no,s0,DJ,qJ,f1,p1,h1,m1,kl,FJ,g1,y1,xl,ZJ,El,_1,v1,Tl,w1,Mi,Li,b1,Di,oo,S1,qi,Pl,Ol,Il,UJ,Nl,Cl,Rl,o0,i0,a0,c0,l0,Fi,io,u0,$1,Al,k1,zl,x1,Wp,E1,jl,T1,P1,O1,I1,N1,C1,R1,A1,z1,j1,Ml,M1,L1,Ll,Jp,Gp,Yp,D1,q1,F1,Xp,Z1,U1,V1,B1,K1,d0,Dl,H1,ql,VJ,W1,ao,J1,BJ,Zi,G1,Qp,Y1,X1,Q1,ez,tz,rz,nz,_l,sz,oz,iz,Ui,eh,az,cz,lz,uz,dz,fz,pz,hz,mz,gz,yz,_z,vz,wz,bz,Sz,$z,kz,co,f0,KJ,xz,Ez,Fl,Tz,Pz,Oz,th,Iz,HJ,WJ,JJ,GJ,YJ,XJ,j,Up,lo=$(()=>{a1();Vp="2025-11-25",RJ="2025-03-26",Jb=[Vp,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pn="io.modelcontextprotocol/related-task",vl="2.0",tt=t1(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Gb=je([k(),$e().int()]),Yb=k(),AJ=kt({ttl:$e().optional(),pollInterval:$e().optional()}),c1=R({ttl:$e().optional()}),l1=R({taskId:k()}),Xb=kt({progressToken:Gb.optional(),[Pn]:l1.optional()}),nr=R({_meta:Xb.optional()}),zi=nr.extend({task:c1.optional()}),Qb=t=>zi.safeParse(t).success,ot=R({method:k(),params:nr.loose().optional()}),ur=R({_meta:Xb.optional()}),sr=R({method:k(),params:ur.loose().optional()}),it=kt({_meta:Xb.optional()}),wl=je([k(),$e().int()]),e0=R({jsonrpc:L(vl),id:wl,...ot.shape}).strict(),Bp=t=>e0.safeParse(t).success,t0=R({jsonrpc:L(vl),...sr.shape}).strict(),r0=t=>t0.safeParse(t).success,Kp=R({jsonrpc:L(vl),id:wl,result:it}).strict(),so=t=>Kp.safeParse(t).success,zJ=so;(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",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(F||(F={}));bl=R({jsonrpc:L(vl),id:wl.optional(),error:R({code:$e().int(),message:k(),data:Ze().optional()})}).strict(),jJ=bl,Hp=t=>bl.safeParse(t).success,MJ=Hp,n0=je([e0,t0,Kp,bl]),LJ=je([Kp,bl]),Sl=it.strict(),u1=ur.extend({requestId:wl.optional(),reason:k().optional()}),$l=sr.extend({method:L("notifications/cancelled"),params:u1}),d1=R({src:k(),mimeType:k().optional(),sizes:le(k()).optional(),theme:Lt(["light","dark"]).optional()}),ji=R({icons:le(d1).optional()}),no=R({name:k(),title:k().optional()}),s0=no.extend({...no.shape,...ji.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),DJ=Dp(R({applyDefaults:st().optional()}),Ae(k(),Ze())),qJ=Hb(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Dp(R({form:DJ.optional(),url:tt.optional()}),Ae(k(),Ze()).optional())),f1=kt({list:tt.optional(),cancel:tt.optional(),requests:kt({sampling:kt({createMessage:tt.optional()}).optional(),elicitation:kt({create:tt.optional()}).optional()}).optional()}),p1=kt({list:tt.optional(),cancel:tt.optional(),requests:kt({tools:kt({call:tt.optional()}).optional()}).optional()}),h1=R({experimental:Ae(k(),tt).optional(),sampling:R({context:tt.optional(),tools:tt.optional()}).optional(),elicitation:qJ.optional(),roots:R({listChanged:st().optional()}).optional(),tasks:f1.optional(),extensions:Ae(k(),tt).optional()}),m1=nr.extend({protocolVersion:k(),capabilities:h1,clientInfo:s0}),kl=ot.extend({method:L("initialize"),params:m1}),FJ=t=>kl.safeParse(t).success,g1=R({experimental:Ae(k(),tt).optional(),logging:tt.optional(),completions:tt.optional(),prompts:R({listChanged:st().optional()}).optional(),resources:R({subscribe:st().optional(),listChanged:st().optional()}).optional(),tools:R({listChanged:st().optional()}).optional(),tasks:p1.optional(),extensions:Ae(k(),tt).optional()}),y1=it.extend({protocolVersion:k(),capabilities:g1,serverInfo:s0,instructions:k().optional()}),xl=sr.extend({method:L("notifications/initialized"),params:ur.optional()}),ZJ=t=>xl.safeParse(t).success,El=ot.extend({method:L("ping"),params:nr.optional()}),_1=R({progress:$e(),total:Ue($e()),message:Ue(k())}),v1=R({...ur.shape,..._1.shape,progressToken:Gb}),Tl=sr.extend({method:L("notifications/progress"),params:v1}),w1=nr.extend({cursor:Yb.optional()}),Mi=ot.extend({params:w1.optional()}),Li=it.extend({nextCursor:Yb.optional()}),b1=Lt(["working","input_required","completed","failed","cancelled"]),Di=R({taskId:k(),status:b1,ttl:je([$e(),HA()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:Ue($e()),statusMessage:Ue(k())}),oo=it.extend({task:Di}),S1=ur.merge(Di),qi=sr.extend({method:L("notifications/tasks/status"),params:S1}),Pl=ot.extend({method:L("tasks/get"),params:nr.extend({taskId:k()})}),Ol=it.merge(Di),Il=ot.extend({method:L("tasks/result"),params:nr.extend({taskId:k()})}),UJ=it.loose(),Nl=Mi.extend({method:L("tasks/list")}),Cl=Li.extend({tasks:le(Di)}),Rl=ot.extend({method:L("tasks/cancel"),params:nr.extend({taskId:k()})}),o0=it.merge(Di),i0=R({uri:k(),mimeType:Ue(k()),_meta:Ae(k(),Ze()).optional()}),a0=i0.extend({text:k()}),c0=k().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),l0=i0.extend({blob:c0}),Fi=Lt(["user","assistant"]),io=R({audience:le(Fi).optional(),priority:$e().min(0).max(1).optional(),lastModified:Zp.datetime({offset:!0}).optional()}),u0=R({...no.shape,...ji.shape,uri:k(),description:Ue(k()),mimeType:Ue(k()),size:Ue($e()),annotations:io.optional(),_meta:Ue(kt({}))}),$1=R({...no.shape,...ji.shape,uriTemplate:k(),description:Ue(k()),mimeType:Ue(k()),annotations:io.optional(),_meta:Ue(kt({}))}),Al=Mi.extend({method:L("resources/list")}),k1=Li.extend({resources:le(u0)}),zl=Mi.extend({method:L("resources/templates/list")}),x1=Li.extend({resourceTemplates:le($1)}),Wp=nr.extend({uri:k()}),E1=Wp,jl=ot.extend({method:L("resources/read"),params:E1}),T1=it.extend({contents:le(je([a0,l0]))}),P1=sr.extend({method:L("notifications/resources/list_changed"),params:ur.optional()}),O1=Wp,I1=ot.extend({method:L("resources/subscribe"),params:O1}),N1=Wp,C1=ot.extend({method:L("resources/unsubscribe"),params:N1}),R1=ur.extend({uri:k()}),A1=sr.extend({method:L("notifications/resources/updated"),params:R1}),z1=R({name:k(),description:Ue(k()),required:Ue(st())}),j1=R({...no.shape,...ji.shape,description:Ue(k()),arguments:Ue(le(z1)),_meta:Ue(kt({}))}),Ml=Mi.extend({method:L("prompts/list")}),M1=Li.extend({prompts:le(j1)}),L1=nr.extend({name:k(),arguments:Ae(k(),k()).optional()}),Ll=ot.extend({method:L("prompts/get"),params:L1}),Jp=R({type:L("text"),text:k(),annotations:io.optional(),_meta:Ae(k(),Ze()).optional()}),Gp=R({type:L("image"),data:c0,mimeType:k(),annotations:io.optional(),_meta:Ae(k(),Ze()).optional()}),Yp=R({type:L("audio"),data:c0,mimeType:k(),annotations:io.optional(),_meta:Ae(k(),Ze()).optional()}),D1=R({type:L("tool_use"),name:k(),id:k(),input:Ae(k(),Ze()),_meta:Ae(k(),Ze()).optional()}),q1=R({type:L("resource"),resource:je([a0,l0]),annotations:io.optional(),_meta:Ae(k(),Ze()).optional()}),F1=u0.extend({type:L("resource_link")}),Xp=je([Jp,Gp,Yp,F1,q1]),Z1=R({role:Fi,content:Xp}),U1=it.extend({description:k().optional(),messages:le(Z1)}),V1=sr.extend({method:L("notifications/prompts/list_changed"),params:ur.optional()}),B1=R({title:k().optional(),readOnlyHint:st().optional(),destructiveHint:st().optional(),idempotentHint:st().optional(),openWorldHint:st().optional()}),K1=R({taskSupport:Lt(["required","optional","forbidden"]).optional()}),d0=R({...no.shape,...ji.shape,description:k().optional(),inputSchema:R({type:L("object"),properties:Ae(k(),tt).optional(),required:le(k()).optional()}).catchall(Ze()),outputSchema:R({type:L("object"),properties:Ae(k(),tt).optional(),required:le(k()).optional()}).catchall(Ze()).optional(),annotations:B1.optional(),execution:K1.optional(),_meta:Ae(k(),Ze()).optional()}),Dl=Mi.extend({method:L("tools/list")}),H1=Li.extend({tools:le(d0)}),ql=it.extend({content:le(Xp).default([]),structuredContent:Ae(k(),Ze()).optional(),isError:st().optional()}),VJ=ql.or(it.extend({toolResult:Ze()})),W1=zi.extend({name:k(),arguments:Ae(k(),Ze()).optional()}),ao=ot.extend({method:L("tools/call"),params:W1}),J1=sr.extend({method:L("notifications/tools/list_changed"),params:ur.optional()}),BJ=R({autoRefresh:st().default(!0),debounceMs:$e().int().nonnegative().default(300)}),Zi=Lt(["debug","info","notice","warning","error","critical","alert","emergency"]),G1=nr.extend({level:Zi}),Qp=ot.extend({method:L("logging/setLevel"),params:G1}),Y1=ur.extend({level:Zi,logger:k().optional(),data:Ze()}),X1=sr.extend({method:L("notifications/message"),params:Y1}),Q1=R({name:k().optional()}),ez=R({hints:le(Q1).optional(),costPriority:$e().min(0).max(1).optional(),speedPriority:$e().min(0).max(1).optional(),intelligencePriority:$e().min(0).max(1).optional()}),tz=R({mode:Lt(["auto","required","none"]).optional()}),rz=R({type:L("tool_result"),toolUseId:k().describe("The unique identifier for the corresponding tool call."),content:le(Xp).default([]),structuredContent:R({}).loose().optional(),isError:st().optional(),_meta:Ae(k(),Ze()).optional()}),nz=Kb("type",[Jp,Gp,Yp]),_l=Kb("type",[Jp,Gp,Yp,D1,rz]),sz=R({role:Fi,content:je([_l,le(_l)]),_meta:Ae(k(),Ze()).optional()}),oz=zi.extend({messages:le(sz),modelPreferences:ez.optional(),systemPrompt:k().optional(),includeContext:Lt(["none","thisServer","allServers"]).optional(),temperature:$e().optional(),maxTokens:$e().int(),stopSequences:le(k()).optional(),metadata:tt.optional(),tools:le(d0).optional(),toolChoice:tz.optional()}),iz=ot.extend({method:L("sampling/createMessage"),params:oz}),Ui=it.extend({model:k(),stopReason:Ue(Lt(["endTurn","stopSequence","maxTokens"]).or(k())),role:Fi,content:nz}),eh=it.extend({model:k(),stopReason:Ue(Lt(["endTurn","stopSequence","maxTokens","toolUse"]).or(k())),role:Fi,content:je([_l,le(_l)])}),az=R({type:L("boolean"),title:k().optional(),description:k().optional(),default:st().optional()}),cz=R({type:L("string"),title:k().optional(),description:k().optional(),minLength:$e().optional(),maxLength:$e().optional(),format:Lt(["email","uri","date","date-time"]).optional(),default:k().optional()}),lz=R({type:Lt(["number","integer"]),title:k().optional(),description:k().optional(),minimum:$e().optional(),maximum:$e().optional(),default:$e().optional()}),uz=R({type:L("string"),title:k().optional(),description:k().optional(),enum:le(k()),default:k().optional()}),dz=R({type:L("string"),title:k().optional(),description:k().optional(),oneOf:le(R({const:k(),title:k()})),default:k().optional()}),fz=R({type:L("string"),title:k().optional(),description:k().optional(),enum:le(k()),enumNames:le(k()).optional(),default:k().optional()}),pz=je([uz,dz]),hz=R({type:L("array"),title:k().optional(),description:k().optional(),minItems:$e().optional(),maxItems:$e().optional(),items:R({type:L("string"),enum:le(k())}),default:le(k()).optional()}),mz=R({type:L("array"),title:k().optional(),description:k().optional(),minItems:$e().optional(),maxItems:$e().optional(),items:R({anyOf:le(R({const:k(),title:k()}))}),default:le(k()).optional()}),gz=je([hz,mz]),yz=je([fz,pz,gz]),_z=je([yz,az,cz,lz]),vz=zi.extend({mode:L("form").optional(),message:k(),requestedSchema:R({type:L("object"),properties:Ae(k(),_z),required:le(k()).optional()})}),wz=zi.extend({mode:L("url"),message:k(),elicitationId:k(),url:k().url()}),bz=je([vz,wz]),Sz=ot.extend({method:L("elicitation/create"),params:bz}),$z=ur.extend({elicitationId:k()}),kz=sr.extend({method:L("notifications/elicitation/complete"),params:$z}),co=it.extend({action:Lt(["accept","decline","cancel"]),content:Hb(t=>t===null?void 0:t,Ae(k(),je([k(),$e(),st(),le(k())])).optional())}),f0=R({type:L("ref/resource"),uri:k()}),KJ=f0,xz=R({type:L("ref/prompt"),name:k()}),Ez=nr.extend({ref:je([xz,f0]),argument:R({name:k(),value:k()}),context:R({arguments:Ae(k(),k()).optional()}).optional()}),Fl=ot.extend({method:L("completion/complete"),params:Ez});Tz=it.extend({completion:kt({values:le(k()).max(100),total:Ue($e().int()),hasMore:Ue(st())})}),Pz=R({uri:k().startsWith("file://"),name:k().optional(),_meta:Ae(k(),Ze()).optional()}),Oz=ot.extend({method:L("roots/list"),params:nr.optional()}),th=it.extend({roots:le(Pz)}),Iz=sr.extend({method:L("notifications/roots/list_changed"),params:ur.optional()}),HJ=je([El,kl,Fl,Qp,Ll,Ml,Al,zl,jl,I1,C1,ao,Dl,Pl,Il,Nl,Rl]),WJ=je([$l,Tl,xl,Iz,qi]),JJ=je([Sl,Ui,eh,co,th,Ol,Cl,oo]),GJ=je([El,iz,Sz,Oz,Pl,Il,Nl,Rl]),YJ=je([$l,Tl,X1,A1,P1,J1,V1,qi,kz]),XJ=je([Sl,y1,Tz,U1,M1,k1,x1,T1,ql,H1,Ol,Cl,oo]),j=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===F.UrlElicitationRequired&&n){let s=n;if(s.elicitations)return new Up(s.elicitations,r)}return new t(e,r,n)}},Up=class extends j{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}});function fs(t){return t==="completed"||t==="failed"||t==="cancelled"}var Cz=$(()=>{});var Az,Rz,zz,rh=$(()=>{Az=Symbol("Let zodToJsonSchema decide on which parser to use"),Rz={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},zz=t=>typeof t=="string"?{...Rz,name:t}:{...Rz,...t}});var jz,m0=$(()=>{rh();jz=t=>{let e=zz(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function g0(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function ue(t,e,r,n,s){t[e]=r,g0(t,e,n,s)}var ps=$(()=>{});var nh,sh=$(()=>{nh=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")}});function Be(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?nh(e,t.currentPath):e.join("/")}}var dr=$(()=>{sh()});function Mz(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==O.ZodAny&&(r.items=K(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ue(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ue(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ue(r,"minItems",t.exactLength.value,t.exactLength.message,e),ue(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var y0=$(()=>{Fc();ps();Qe()});function Lz(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?ue(r,"minimum",n.value,n.message,e):ue(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ue(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ue(r,"maximum",n.value,n.message,e):ue(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ue(r,"maximum",n.value,n.message,e));break;case"multipleOf":ue(r,"multipleOf",n.value,n.message,e);break}return r}var _0=$(()=>{ps()});function Dz(){return{type:"boolean"}}var v0=$(()=>{});function oh(t,e){return K(t.type._def,e)}var ih=$(()=>{Qe()});var qz,w0=$(()=>{Qe();qz=(t,e)=>K(t.innerType._def,e)});function b0(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,o)=>b0(t,e,s))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return QJ(t,e)}}var QJ,S0=$(()=>{ps();QJ=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":ue(r,"minimum",n.value,n.message,e);break;case"max":ue(r,"maximum",n.value,n.message,e);break}return r}});function Fz(t,e){return{...K(t.innerType._def,e),default:t.defaultValue()}}var $0=$(()=>{Qe()});function Zz(t,e){return e.effectStrategy==="input"?K(t.schema._def,e):Be(e)}var k0=$(()=>{Qe();dr()});function Uz(t){return{type:"string",enum:Array.from(t.values)}}var x0=$(()=>{});function Vz(t,e){let r=[K(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),K(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,s=[];return r.forEach(o=>{if(eG(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}var eG,E0=$(()=>{Qe();eG=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function Bz(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var T0=$(()=>{});function ah(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ar(r,"email",n.message,e);break;case"format:idn-email":Ar(r,"idn-email",n.message,e);break;case"pattern:zod":xt(r,Rr.email,n.message,e);break}break;case"url":Ar(r,"uri",n.message,e);break;case"uuid":Ar(r,"uuid",n.message,e);break;case"regex":xt(r,n.regex,n.message,e);break;case"cuid":xt(r,Rr.cuid,n.message,e);break;case"cuid2":xt(r,Rr.cuid2,n.message,e);break;case"startsWith":xt(r,RegExp(`^${O0(n.value,e)}`),n.message,e);break;case"endsWith":xt(r,RegExp(`${O0(n.value,e)}$`),n.message,e);break;case"datetime":Ar(r,"date-time",n.message,e);break;case"date":Ar(r,"date",n.message,e);break;case"time":Ar(r,"time",n.message,e);break;case"duration":Ar(r,"duration",n.message,e);break;case"length":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{xt(r,RegExp(O0(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Ar(r,"ipv4",n.message,e),n.version!=="v4"&&Ar(r,"ipv6",n.message,e);break}case"base64url":xt(r,Rr.base64url,n.message,e);break;case"jwt":xt(r,Rr.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&xt(r,Rr.ipv4Cidr,n.message,e),n.version!=="v4"&&xt(r,Rr.ipv6Cidr,n.message,e);break}case"emoji":xt(r,Rr.emoji(),n.message,e);break;case"ulid":{xt(r,Rr.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ar(r,"binary",n.message,e);break}case"contentEncoding:base64":{ue(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{xt(r,Rr.base64,n.message,e);break}}break}case"nanoid":xt(r,Rr.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function O0(t,e){return e.patternStrategy==="escape"?rG(t):t}function rG(t){let e="";for(let r=0;r<t.length;r++)tG.has(t[r])||(e+="\\"),e+=t[r];return e}function Ar(t,e,r,n){t.format||t.anyOf?.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ue(t,"format",e,r,n)}function xt(t,e,r,n){t.pattern||t.allOf?.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Kz(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ue(t,"pattern",Kz(e,n),r,n)}function Kz(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,s="",o=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(o){s+=n[c],o=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],a=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
|
|
291
|
+
]))`;continue}else if(n[c]==="$"){s+=`($|(?=[\r
|
|
292
|
+
]))`;continue}}if(r.s&&n[c]==="."){s+=i?`${n[c]}\r
|
|
293
|
+
`:`[${n[c]}\r
|
|
294
|
+
]`;continue}s+=n[c],n[c]==="\\"?o=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}var P0,Rr,tG,ch=$(()=>{ps();Rr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(P0===void 0&&(P0=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),P0),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};tG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function lh(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===O.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,s)=>({...n,[s]:K(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",s]})??Be(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:K(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===O.ZodString&&t.keyType._def.checks?.length){let{type:n,...s}=ah(t.keyType._def,e);return{...r,propertyNames:s}}else{if(t.keyType?._def.typeName===O.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===O.ZodBranded&&t.keyType._def.type._def.typeName===O.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...s}=oh(t.keyType._def,e);return{...r,propertyNames:s}}}return r}var uh=$(()=>{Fc();Qe();ch();ih();dr()});function Hz(t,e){if(e.mapStrategy==="record")return lh(t,e);let r=K(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Be(e),n=K(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Be(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var I0=$(()=>{Qe();uh();dr()});function Wz(t){let e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),s=Array.from(new Set(n.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}var N0=$(()=>{});function Jz(t){return t.target==="openAi"?void 0:{not:Be({...t,currentPath:[...t.currentPath,"not"]})}}var C0=$(()=>{dr()});function Gz(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var R0=$(()=>{});function Xz(t,e){if(e.target==="openApi3")return Yz(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Zl&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((s,o)=>{let i=Zl[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((s,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){let s=n.filter((o,i,a)=>a.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:r.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(o=>!n.includes(o))],[])};return Yz(t,e)}var Zl,Yz,dh=$(()=>{Qe();Zl={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Yz=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>K(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function Qz(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Zl[t.innerType._def.typeName],nullable:!0}:{type:[Zl[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=K(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=K(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var A0=$(()=>{Qe();dh()});function ej(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",g0(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ue(r,"minimum",n.value,n.message,e):ue(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ue(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ue(r,"maximum",n.value,n.message,e):ue(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ue(r,"maximum",n.value,n.message,e));break;case"multipleOf":ue(r,"multipleOf",n.value,n.message,e);break}return r}var z0=$(()=>{ps()});function tj(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},s=[],o=t.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let l=sG(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let u=K(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});u!==void 0&&(n.properties[a]=u,l||s.push(a))}s.length&&(n.required=s);let i=nG(t,e);return i!==void 0&&(n.additionalProperties=i),n}function nG(t,e){if(t.catchall._def.typeName!=="ZodNever")return K(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function sG(t){try{return t.isOptional()}catch{return!0}}var j0=$(()=>{Qe()});var rj,M0=$(()=>{Qe();dr();rj=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return K(t.innerType._def,e);let r=K(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Be(e)},r]}:Be(e)}});var nj,L0=$(()=>{Qe();nj=(t,e)=>{if(e.pipeStrategy==="input")return K(t.in._def,e);if(e.pipeStrategy==="output")return K(t.out._def,e);let r=K(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=K(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}}});function sj(t,e){return K(t.type._def,e)}var D0=$(()=>{Qe()});function oj(t,e){let n={type:"array",uniqueItems:!0,items:K(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ue(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ue(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var q0=$(()=>{ps();Qe()});function ij(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>K(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:K(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>K(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var F0=$(()=>{Qe()});function aj(t){return{not:Be(t)}}var Z0=$(()=>{dr()});function cj(t){return Be(t)}var U0=$(()=>{dr()});var lj,V0=$(()=>{Qe();lj=(t,e)=>K(t.innerType._def,e)});var uj,B0=$(()=>{Fc();dr();y0();_0();v0();ih();w0();S0();$0();k0();x0();E0();T0();I0();N0();C0();R0();A0();z0();j0();M0();L0();D0();uh();q0();ch();F0();Z0();dh();U0();V0();uj=(t,e,r)=>{switch(e){case O.ZodString:return ah(t,r);case O.ZodNumber:return ej(t,r);case O.ZodObject:return tj(t,r);case O.ZodBigInt:return Lz(t,r);case O.ZodBoolean:return Dz();case O.ZodDate:return b0(t,r);case O.ZodUndefined:return aj(r);case O.ZodNull:return Gz(r);case O.ZodArray:return Mz(t,r);case O.ZodUnion:case O.ZodDiscriminatedUnion:return Xz(t,r);case O.ZodIntersection:return Vz(t,r);case O.ZodTuple:return ij(t,r);case O.ZodRecord:return lh(t,r);case O.ZodLiteral:return Bz(t,r);case O.ZodEnum:return Uz(t);case O.ZodNativeEnum:return Wz(t);case O.ZodNullable:return Qz(t,r);case O.ZodOptional:return rj(t,r);case O.ZodMap:return Hz(t,r);case O.ZodSet:return oj(t,r);case O.ZodLazy:return()=>t.getter()._def;case O.ZodPromise:return sj(t,r);case O.ZodNaN:case O.ZodNever:return Jz(r);case O.ZodEffects:return Zz(t,r);case O.ZodAny:return Be(r);case O.ZodUnknown:return cj(r);case O.ZodDefault:return Fz(t,r);case O.ZodBranded:return oh(t,r);case O.ZodReadonly:return lj(t,r);case O.ZodCatch:return qz(t,r);case O.ZodPipeline:return nj(t,r);case O.ZodFunction:case O.ZodVoid:case O.ZodSymbol:return;default:return(n=>{})(e)}}});function K(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Az)return a}if(n&&!r){let a=oG(n,e);if(a!==void 0)return a}let s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);let o=uj(t,t.typeName,e),i=typeof o=="function"?K(o(),e):o;if(i&&iG(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return s.jsonSchema=i,a}return s.jsonSchema=i,i}var oG,iG,Qe=$(()=>{rh();B0();sh();dr();oG=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:nh(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Be(e)):e.$refStrategy==="seen"?Be(e):void 0}},iG=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var dj=$(()=>{});var K0,H0=$(()=>{Qe();m0();dr();K0=(t,e)=>{let r=jz(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[l,u])=>({...c,[l]:K(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Be(r)}),{}):void 0,s=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=K(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Be(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=s===void 0?n?{...o,[r.definitionPath]:n}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a}});var fj=$(()=>{rh();m0();ps();sh();Qe();dj();dr();y0();_0();v0();ih();w0();S0();$0();k0();x0();E0();T0();I0();N0();C0();R0();A0();z0();j0();M0();L0();D0();V0();uh();q0();ch();F0();Z0();dh();U0();B0();H0();H0()});function aG(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function W0(t,e){return tn(t)?Mb(t,{target:aG(e?.target),io:e?.pipeStrategy??"input"}):K0(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function J0(t){let r=ds(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Ai(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function G0(t,e){let r=us(t,e);if(!r.success)throw r.error;return r.data}var Y0=$(()=>{Fb();pl();fj()});function pj(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function hj(t,e){let r={...t};for(let n in e){let s=n,o=e[s];if(o===void 0)continue;let i=r[s];pj(i)&&pj(o)?r[s]={...i,...o}:r[s]=o}return r}var cG,fh,mj=$(()=>{pl();lo();Cz();Y0();cG=6e4,fh=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._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler($l,r=>{this._oncancel(r)}),this.setNotificationHandler(Tl,r=>{this._onprogress(r)}),this.setRequestHandler(El,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Pl,async(r,n)=>{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new j(F.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Il,async(r,n)=>{let s=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let d=c,f=new j(d.error.code,d.error.message,d.error.data);u(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new j(F.InvalidParams,`Task not found: ${o}`);if(!fs(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(fs(i.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[Pn]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Nl,async(r,n)=>{try{let{tasks:s,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:s,nextCursor:o,_meta:{}}}catch(s){throw new j(F.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(Rl,async(r,n)=>{try{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new j(F.InvalidParams,`Task not found: ${r.params.taskId}`);if(fs(s.status))throw new j(F.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new j(F.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof j?s:new j(F.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:s})}_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),j.fromError(F.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){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let s=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{s?.(o,i),so(o)||Hp(o)?this._onresponse(o):Bp(o)?this._onrequest(o,i):r0(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=j.fromError(F.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,s=this._transport,o=e.params?._meta?.[Pn]?.taskId;if(n===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:F.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},s?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):s?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Qb(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,s?.sessionId):void 0,l={signal:i.signal,sessionId:s?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,f)=>{if(i.signal.aborted)throw new j(F.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:e.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let m=p.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(u,d,p)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,l)).then(async u=>{if(i.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)},async u=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:F.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,s=Number(r),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),so(e))n(e);else{let i=new j(e.error.code,e.error.message,e.error.data);n(i)}return}let s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(so(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),so(e))s(e);else{let i=j.fromError(e.error.code,e.error.message,e.error.data);s(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof j?i:new j(F.InternalError,String(i))}}return}let o;try{let i=await this.request(e,oo,n);if(i.task)o=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new j(F.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},fs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new j(F.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new j(F.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof j?i:new j(F.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((l,u)=>{let d=w=>{u(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Pn]:c}});let m=w=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(w)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(x=>this._onerror(new Error(`Failed to send cancellation: ${x}`)));let b=w instanceof j?w:new j(F.RequestTimeout,String(w));u(b)};this._responseHandlers.set(f,w=>{if(!n?.signal?.aborted){if(w instanceof Error)return u(w);try{let b=us(r,w.result);b.success?l(b.data):u(b.error)}catch(b){u(b)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??cG,g=()=>m(j.fromError(F.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let w=b=>{let x=this._responseHandlers.get(f);x?x(b):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,w),this._enqueueTaskMessage(y,{type:"request",message:p,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(f),u(b)})}else this._transport.send(p,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(f),u(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ol,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Cl,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},o0,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Pn]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Pn]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Pn]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=J0(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{let i=G0(e,s);return Promise.resolve(r(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){let n=J0(e);this._notificationHandlers.set(n,s=>{let o=G0(e,s);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,s)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let s of n)if(s.type==="request"&&Bp(s.message)){let o=s.message.id,i=this._requestResolvers.get(o);i?(i(new j(F.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(e);s?.pollInterval&&(n=s.pollInterval)}catch{}return new Promise((s,o)=>{if(r.aborted){o(new j(F.InvalidRequest,"Request cancelled"));return}let i=setTimeout(s,n);r.addEventListener("abort",()=>{clearTimeout(i),o(new j(F.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!e)throw new Error("No request provided");return await n.createTask(s,e.id,{method:e.method,params:e.params},r)},getTask:async s=>{let o=await n.getTask(s,r);if(!o)throw new j(F.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);let a=await n.getTask(s,r);if(a){let c=qi.parse({method:"notifications/tasks/status",params:a});await this.notification(c),fs(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{let a=await n.getTask(s,r);if(!a)throw new j(F.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(fs(a.status))throw new j(F.InvalidParams,`Cannot update task "${s}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,o,i,r);let c=await n.getTask(s,r);if(c){let l=qi.parse({method:"notifications/tasks/status",params:c});await this.notification(l),fs(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}}});var Bl=_(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.regexpCode=ve.getEsmExportName=ve.getProperty=ve.safeStringify=ve.stringify=ve.strConcat=ve.addCodeArg=ve.str=ve._=ve.nil=ve._Code=ve.Name=ve.IDENTIFIER=ve._CodeOrName=void 0;var Ul=class{};ve._CodeOrName=Ul;ve.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var uo=class extends Ul{constructor(e){if(super(),!ve.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ve.Name=uo;var fr=class extends Ul{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof uo&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ve._Code=fr;ve.nil=new fr("");function gj(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Q0(r,e[n]),r.push(t[++n]);return new fr(r)}ve._=gj;var X0=new fr("+");function yj(t,...e){let r=[Vl(t[0])],n=0;for(;n<e.length;)r.push(X0),Q0(r,e[n]),r.push(X0,Vl(t[++n]));return lG(r),new fr(r)}ve.str=yj;function Q0(t,e){e instanceof fr?t.push(...e._items):e instanceof uo?t.push(e):t.push(fG(e))}ve.addCodeArg=Q0;function lG(t){let e=1;for(;e<t.length-1;){if(t[e]===X0){let r=uG(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function uG(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof uo||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof uo))return`"${t}${e.slice(1)}`}function dG(t,e){return e.emptyStr()?t:t.emptyStr()?e:yj`${t}${e}`}ve.strConcat=dG;function fG(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Vl(Array.isArray(t)?t.join(","):t)}function pG(t){return new fr(Vl(t))}ve.stringify=pG;function Vl(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ve.safeStringify=Vl;function hG(t){return typeof t=="string"&&ve.IDENTIFIER.test(t)?new fr(`.${t}`):gj`[${t}]`}ve.getProperty=hG;function mG(t){if(typeof t=="string"&&ve.IDENTIFIER.test(t))return new fr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ve.getEsmExportName=mG;function gG(t){return new fr(t.toString())}ve.regexpCode=gG});var rS=_(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.ValueScope=qt.ValueScopeName=qt.Scope=qt.varKinds=qt.UsedValueState=void 0;var Dt=Bl(),eS=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ph;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ph||(qt.UsedValueState=ph={}));qt.varKinds={const:new Dt.Name("const"),let:new Dt.Name("let"),var:new Dt.Name("var")};var hh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Dt.Name?e:this.name(e)}name(e){return new Dt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};qt.Scope=hh;var mh=class extends Dt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Dt._)`.${new Dt.Name(r)}[${n}]`}};qt.ValueScopeName=mh;var yG=(0,Dt._)`\n`,tS=class extends hh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?yG:Dt.nil}}get(){return this._scope}name(e){return new mh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(i);if(u)return u}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,s.setValue(r,{property:o,itemIndex:l}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Dt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Dt.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,ph.Started);let u=r(l);if(u){let d=this.opts.es5?qt.varKinds.var:qt.varKinds.const;o=(0,Dt._)`${o}${d} ${l} = ${u};${this.opts._n}`}else if(u=s?.(l))o=(0,Dt._)`${o}${u}${this.opts._n}`;else throw new eS(l);c.set(l,ph.Completed)})}return o}};qt.ValueScope=tS});var se=_(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.or=re.and=re.not=re.CodeGen=re.operators=re.varKinds=re.ValueScopeName=re.ValueScope=re.Scope=re.Name=re.regexpCode=re.stringify=re.getProperty=re.nil=re.strConcat=re.str=re._=void 0;var de=Bl(),zr=rS(),hs=Bl();Object.defineProperty(re,"_",{enumerable:!0,get:function(){return hs._}});Object.defineProperty(re,"str",{enumerable:!0,get:function(){return hs.str}});Object.defineProperty(re,"strConcat",{enumerable:!0,get:function(){return hs.strConcat}});Object.defineProperty(re,"nil",{enumerable:!0,get:function(){return hs.nil}});Object.defineProperty(re,"getProperty",{enumerable:!0,get:function(){return hs.getProperty}});Object.defineProperty(re,"stringify",{enumerable:!0,get:function(){return hs.stringify}});Object.defineProperty(re,"regexpCode",{enumerable:!0,get:function(){return hs.regexpCode}});Object.defineProperty(re,"Name",{enumerable:!0,get:function(){return hs.Name}});var vh=rS();Object.defineProperty(re,"Scope",{enumerable:!0,get:function(){return vh.Scope}});Object.defineProperty(re,"ValueScope",{enumerable:!0,get:function(){return vh.ValueScope}});Object.defineProperty(re,"ValueScopeName",{enumerable:!0,get:function(){return vh.ValueScopeName}});Object.defineProperty(re,"varKinds",{enumerable:!0,get:function(){return vh.varKinds}});re.operators={GT:new de._Code(">"),GTE:new de._Code(">="),LT:new de._Code("<"),LTE:new de._Code("<="),EQ:new de._Code("==="),NEQ:new de._Code("!=="),NOT:new de._Code("!"),OR:new de._Code("||"),AND:new de._Code("&&"),ADD:new de._Code("+")};var On=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},nS=class extends On{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?zr.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Bi(this.rhs,e,r)),this}get names(){return this.rhs instanceof de._CodeOrName?this.rhs.names:{}}},gh=class extends On{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof de.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Bi(this.rhs,e,r),this}get names(){let e=this.lhs instanceof de.Name?{}:{...this.lhs.names};return _h(e,this.rhs)}},sS=class extends gh{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oS=class extends On{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},iS=class extends On{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},aS=class extends On{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},cS=class extends On{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Bi(this.code,e,r),this}get names(){return this.code instanceof de._CodeOrName?this.code.names:{}}},Kl=class extends On{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(_G(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ho(e,r.names),{})}},In=class extends Kl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},lS=class extends Kl{},Vi=class extends In{};Vi.kind="else";var fo=class t extends In{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Vi(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(_j(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Bi(this.condition,e,r),this}get names(){let e=super.names;return _h(e,this.condition),this.else&&ho(e,this.else.names),e}};fo.kind="if";var po=class extends In{};po.kind="for";var uS=class extends po{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Bi(this.iteration,e,r),this}get names(){return ho(super.names,this.iteration.names)}},dS=class extends po{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?zr.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=_h(super.names,this.from);return _h(e,this.to)}},yh=class extends po{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Bi(this.iterable,e,r),this}get names(){return ho(super.names,this.iterable.names)}},Hl=class extends In{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Hl.kind="func";var Wl=class extends Kl{render(e){return"return "+super.render(e)}};Wl.kind="return";var fS=class extends In{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ho(e,this.catch.names),this.finally&&ho(e,this.finally.names),e}},Jl=class extends In{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Jl.kind="catch";var Gl=class extends In{render(e){return"finally"+super.render(e)}};Gl.kind="finally";var pS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
295
|
+
`:""},this._extScope=e,this._scope=new zr.Scope({parent:e}),this._nodes=[new lS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new nS(e,o,n)),o}const(e,r,n){return this._def(zr.varKinds.const,e,r,n)}let(e,r,n){return this._def(zr.varKinds.let,e,r,n)}var(e,r,n){return this._def(zr.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new gh(e,r,n))}add(e,r){return this._leafNode(new sS(e,re.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==de.nil&&this._leafNode(new cS(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,de.addCodeArg)(r,s));return r.push("}"),new de._Code(r)}if(e,r,n){if(this._blockNode(new fo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new fo(e))}else(){return this._elseNode(new Vi)}endIf(){return this._endBlockNode(fo,Vi)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new uS(e),r)}forRange(e,r,n,s,o=this.opts.es5?zr.varKinds.var:zr.varKinds.let){let i=this._scope.toName(e);return this._for(new dS(o,i,r,n),()=>s(i))}forOf(e,r,n,s=zr.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let i=r instanceof de.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,de._)`${i}.length`,a=>{this.var(o,(0,de._)`${i}[${a}]`),n(o)})}return this._for(new yh("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?zr.varKinds.var:zr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,de._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new yh("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(po)}label(e){return this._leafNode(new oS(e))}break(e){return this._leafNode(new iS(e))}return(e){let r=new Wl;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Wl)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new fS;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new Jl(o),r(o)}return n&&(this._currNode=s.finally=new Gl,this.code(n)),this._endBlockNode(Jl,Gl)}throw(e){return this._leafNode(new aS(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=de.nil,n,s){return this._blockNode(new Hl(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Hl)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof fo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};re.CodeGen=pS;function ho(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function _h(t,e){return e instanceof de._CodeOrName?ho(t,e.names):t}function Bi(t,e,r){if(t instanceof de.Name)return n(t);if(!s(t))return t;return new de._Code(t._items.reduce((o,i)=>(i instanceof de.Name&&(i=n(i)),i instanceof de._Code?o.push(...i._items):o.push(i),o),[]));function n(o){let i=r[o.str];return i===void 0||e[o.str]!==1?o:(delete e[o.str],i)}function s(o){return o instanceof de._Code&&o._items.some(i=>i instanceof de.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function _G(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function _j(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,de._)`!${hS(t)}`}re.not=_j;var vG=vj(re.operators.AND);function wG(...t){return t.reduce(vG)}re.and=wG;var bG=vj(re.operators.OR);function SG(...t){return t.reduce(bG)}re.or=SG;function vj(t){return(e,r)=>e===de.nil?r:r===de.nil?e:(0,de._)`${hS(e)} ${t} ${hS(r)}`}function hS(t){return t instanceof de.Name?t:(0,de._)`(${t})`}});var he=_(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;var Ne=se(),$G=Bl();function kG(t){let e={};for(let r of t)e[r]=!0;return e}oe.toHash=kG;function xG(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Sj(t,e),!$j(e,t.self.RULES.all))}oe.alwaysValidSchema=xG;function Sj(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||Ej(t,`unknown keyword: "${o}"`)}oe.checkUnknownRules=Sj;function $j(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}oe.schemaHasRules=$j;function EG(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}oe.schemaHasRulesButRef=EG;function TG({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ne._)`${r}`}return(0,Ne._)`${t}${e}${(0,Ne.getProperty)(n)}`}oe.schemaRefOrVal=TG;function PG(t){return kj(decodeURIComponent(t))}oe.unescapeFragment=PG;function OG(t){return encodeURIComponent(gS(t))}oe.escapeFragment=OG;function gS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=gS;function kj(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=kj;function IG(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}oe.eachItem=IG;function wj({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof Ne.Name?(o instanceof Ne.Name?t(s,o,i):e(s,o,i),i):o instanceof Ne.Name?(e(s,i,o),o):r(o,i);return a===Ne.Name&&!(c instanceof Ne.Name)?n(s,c):c}}oe.mergeEvaluated={props:wj({mergeNames:(t,e,r)=>t.if((0,Ne._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ne._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ne._)`${r} || {}`).code((0,Ne._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ne._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ne._)`${r} || {}`),yS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:xj}),items:wj({mergeNames:(t,e,r)=>t.if((0,Ne._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ne._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ne._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ne._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function xj(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ne._)`{}`);return e!==void 0&&yS(t,r,e),r}oe.evaluatedPropsToName=xj;function yS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Ne._)`${e}${(0,Ne.getProperty)(n)}`,!0))}oe.setEvaluated=yS;var bj={};function NG(t,e){return t.scopeValue("func",{ref:e,code:bj[e.code]||(bj[e.code]=new $G._Code(e.code))})}oe.useFunc=NG;var mS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(mS||(oe.Type=mS={}));function CG(t,e,r){if(t instanceof Ne.Name){let n=e===mS.Num;return r?n?(0,Ne._)`"[" + ${t} + "]"`:(0,Ne._)`"['" + ${t} + "']"`:n?(0,Ne._)`"/" + ${t}`:(0,Ne._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ne.getProperty)(t).toString():"/"+gS(t)}oe.getErrorPath=CG;function Ej(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}oe.checkStrictMode=Ej});var Nn=_(_S=>{"use strict";Object.defineProperty(_S,"__esModule",{value:!0});var mt=se(),RG={data:new mt.Name("data"),valCxt:new mt.Name("valCxt"),instancePath:new mt.Name("instancePath"),parentData:new mt.Name("parentData"),parentDataProperty:new mt.Name("parentDataProperty"),rootData:new mt.Name("rootData"),dynamicAnchors:new mt.Name("dynamicAnchors"),vErrors:new mt.Name("vErrors"),errors:new mt.Name("errors"),this:new mt.Name("this"),self:new mt.Name("self"),scope:new mt.Name("scope"),json:new mt.Name("json"),jsonPos:new mt.Name("jsonPos"),jsonLen:new mt.Name("jsonLen"),jsonPart:new mt.Name("jsonPart")};_S.default=RG});var Yl=_(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.extendErrors=gt.resetErrorsCount=gt.reportExtraError=gt.reportError=gt.keyword$DataError=gt.keywordError=void 0;var me=se(),wh=he(),Et=Nn();gt.keywordError={message:({keyword:t})=>(0,me.str)`must pass "${t}" keyword validation`};gt.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,me.str)`"${t}" keyword must be ${e} ($data)`:(0,me.str)`"${t}" keyword is invalid ($data)`};function AG(t,e=gt.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=Oj(t,e,r);n??(i||a)?Tj(o,c):Pj(s,(0,me._)`[${c}]`)}gt.reportError=AG;function zG(t,e=gt.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=Oj(t,e,r);Tj(s,a),o||i||Pj(n,Et.default.vErrors)}gt.reportExtraError=zG;function jG(t,e){t.assign(Et.default.errors,e),t.if((0,me._)`${Et.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,me._)`${Et.default.vErrors}.length`,e),()=>t.assign(Et.default.vErrors,null)))}gt.resetErrorsCount=jG;function MG({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",s,Et.default.errors,a=>{t.const(i,(0,me._)`${Et.default.vErrors}[${a}]`),t.if((0,me._)`${i}.instancePath === undefined`,()=>t.assign((0,me._)`${i}.instancePath`,(0,me.strConcat)(Et.default.instancePath,o.errorPath))),t.assign((0,me._)`${i}.schemaPath`,(0,me.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,me._)`${i}.schema`,r),t.assign((0,me._)`${i}.data`,n))})}gt.extendErrors=MG;function Tj(t,e){let r=t.const("err",e);t.if((0,me._)`${Et.default.vErrors} === null`,()=>t.assign(Et.default.vErrors,(0,me._)`[${r}]`),(0,me._)`${Et.default.vErrors}.push(${r})`),t.code((0,me._)`${Et.default.errors}++`)}function Pj(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,me._)`new ${t.ValidationError}(${e})`):(r.assign((0,me._)`${n}.errors`,e),r.return(!1))}var mo={keyword:new me.Name("keyword"),schemaPath:new me.Name("schemaPath"),params:new me.Name("params"),propertyName:new me.Name("propertyName"),message:new me.Name("message"),schema:new me.Name("schema"),parentSchema:new me.Name("parentSchema")};function Oj(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,me._)`{}`:LG(t,e,r)}function LG(t,e,r={}){let{gen:n,it:s}=t,o=[DG(s,r),qG(t,r)];return FG(t,e,o),n.object(...o)}function DG({errorPath:t},{instancePath:e}){let r=e?(0,me.str)`${t}${(0,wh.getErrorPath)(e,wh.Type.Str)}`:t;return[Et.default.instancePath,(0,me.strConcat)(Et.default.instancePath,r)]}function qG({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,me.str)`${e}/${t}`;return r&&(s=(0,me.str)`${s}${(0,wh.getErrorPath)(r,wh.Type.Str)}`),[mo.schemaPath,s]}function FG(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:i,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([mo.keyword,s],[mo.params,typeof e=="function"?e(t):e||(0,me._)`{}`]),c.messages&&n.push([mo.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([mo.schema,i],[mo.parentSchema,(0,me._)`${u}${d}`],[Et.default.data,o]),l&&n.push([mo.propertyName,l])}});var Nj=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.boolOrEmptySchema=Ki.topBoolOrEmptySchema=void 0;var ZG=Yl(),UG=se(),VG=Nn(),BG={message:"boolean schema is false"};function KG(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Ij(t,!1):typeof r=="object"&&r.$async===!0?e.return(VG.default.data):(e.assign((0,UG._)`${n}.errors`,null),e.return(!0))}Ki.topBoolOrEmptySchema=KG;function HG(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Ij(t)):r.var(e,!0)}Ki.boolOrEmptySchema=HG;function Ij(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ZG.reportError)(s,BG,void 0,e)}});var vS=_(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.getRules=Hi.isJSONType=void 0;var WG=["string","number","integer","boolean","null","object","array"],JG=new Set(WG);function GG(t){return typeof t=="string"&&JG.has(t)}Hi.isJSONType=GG;function YG(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Hi.getRules=YG});var wS=_(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.shouldUseRule=ms.shouldUseGroup=ms.schemaHasRulesForType=void 0;function XG({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Cj(t,n)}ms.schemaHasRulesForType=XG;function Cj(t,e){return e.rules.some(r=>Rj(t,r))}ms.shouldUseGroup=Cj;function Rj(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ms.shouldUseRule=Rj});var Xl=_(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.reportTypeError=yt.checkDataTypes=yt.checkDataType=yt.coerceAndCheckDataType=yt.getJSONTypes=yt.getSchemaTypes=yt.DataType=void 0;var QG=vS(),e8=wS(),t8=Yl(),X=se(),Aj=he(),Wi;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Wi||(yt.DataType=Wi={}));function r8(t){let e=zj(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}yt.getSchemaTypes=r8;function zj(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(QG.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}yt.getJSONTypes=zj;function n8(t,e){let{gen:r,data:n,opts:s}=t,o=s8(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,e8.schemaHasRulesForType)(t,e[0]));if(i){let a=SS(e,n,s.strictNumbers,Wi.Wrong);r.if(a,()=>{o.length?o8(t,e,o):$S(t)})}return i}yt.coerceAndCheckDataType=n8;var jj=new Set(["string","number","integer","boolean","null"]);function s8(t,e){return e?t.filter(r=>jj.has(r)||e==="array"&&r==="array"):[]}function o8(t,e,r){let{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,X._)`typeof ${s}`),a=n.let("coerced",(0,X._)`undefined`);o.coerceTypes==="array"&&n.if((0,X._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,X._)`${s}[0]`).assign(i,(0,X._)`typeof ${s}`).if(SS(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,X._)`${a} !== undefined`);for(let l of r)(jj.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);n.else(),$S(t),n.endIf(),n.if((0,X._)`${a} !== undefined`,()=>{n.assign(s,a),i8(t,a)});function c(l){switch(l){case"string":n.elseIf((0,X._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,X._)`"" + ${s}`).elseIf((0,X._)`${s} === null`).assign(a,(0,X._)`""`);return;case"number":n.elseIf((0,X._)`${i} == "boolean" || ${s} === null
|
|
296
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,X._)`+${s}`);return;case"integer":n.elseIf((0,X._)`${i} === "boolean" || ${s} === null
|
|
297
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,X._)`+${s}`);return;case"boolean":n.elseIf((0,X._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,X._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,X._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,X._)`${i} === "string" || ${i} === "number"
|
|
298
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,(0,X._)`[${s}]`)}}}function i8({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,X._)`${e} !== undefined`,()=>t.assign((0,X._)`${e}[${r}]`,n))}function bS(t,e,r,n=Wi.Correct){let s=n===Wi.Correct?X.operators.EQ:X.operators.NEQ,o;switch(t){case"null":return(0,X._)`${e} ${s} null`;case"array":o=(0,X._)`Array.isArray(${e})`;break;case"object":o=(0,X._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=i((0,X._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=i();break;default:return(0,X._)`typeof ${e} ${s} ${t}`}return n===Wi.Correct?o:(0,X.not)(o);function i(a=X.nil){return(0,X.and)((0,X._)`typeof ${e} == "number"`,a,r?(0,X._)`isFinite(${e})`:X.nil)}}yt.checkDataType=bS;function SS(t,e,r,n){if(t.length===1)return bS(t[0],e,r,n);let s,o=(0,Aj.toHash)(t);if(o.array&&o.object){let i=(0,X._)`typeof ${e} != "object"`;s=o.null?i:(0,X._)`!${e} || ${i}`,delete o.null,delete o.array,delete o.object}else s=X.nil;o.number&&delete o.integer;for(let i in o)s=(0,X.and)(s,bS(i,e,r,n));return s}yt.checkDataTypes=SS;var a8={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,X._)`{type: ${t}}`:(0,X._)`{type: ${e}}`};function $S(t){let e=c8(t);(0,t8.reportError)(e,a8)}yt.reportTypeError=$S;function c8(t){let{gen:e,data:r,schema:n}=t,s=(0,Aj.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}});var Lj=_(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.assignDefaults=void 0;var Ji=se(),l8=he();function u8(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)Mj(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Mj(t,o,s.default))}bh.assignDefaults=u8;function Mj(t,e,r){let{gen:n,compositeRule:s,data:o,opts:i}=t;if(r===void 0)return;let a=(0,Ji._)`${o}${(0,Ji.getProperty)(e)}`;if(s){(0,l8.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Ji._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Ji._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Ji._)`${a} = ${(0,Ji.stringify)(r)}`)}});var pr=_(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.validateUnion=Ee.validateArray=Ee.usePattern=Ee.callValidateCode=Ee.schemaProperties=Ee.allSchemaProperties=Ee.noPropertyInData=Ee.propertyInData=Ee.isOwnProperty=Ee.hasPropFunc=Ee.reportMissingProp=Ee.checkMissingProp=Ee.checkReportMissingProp=void 0;var Me=se(),kS=he(),gs=Nn(),d8=he();function f8(t,e){let{gen:r,data:n,it:s}=t;r.if(ES(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Me._)`${e}`},!0),t.error()})}Ee.checkReportMissingProp=f8;function p8({gen:t,data:e,it:{opts:r}},n,s){return(0,Me.or)(...n.map(o=>(0,Me.and)(ES(t,e,o,r.ownProperties),(0,Me._)`${s} = ${o}`)))}Ee.checkMissingProp=p8;function h8(t,e){t.setParams({missingProperty:e},!0),t.error()}Ee.reportMissingProp=h8;function Dj(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Me._)`Object.prototype.hasOwnProperty`})}Ee.hasPropFunc=Dj;function xS(t,e,r){return(0,Me._)`${Dj(t)}.call(${e}, ${r})`}Ee.isOwnProperty=xS;function m8(t,e,r,n){let s=(0,Me._)`${e}${(0,Me.getProperty)(r)} !== undefined`;return n?(0,Me._)`${s} && ${xS(t,e,r)}`:s}Ee.propertyInData=m8;function ES(t,e,r,n){let s=(0,Me._)`${e}${(0,Me.getProperty)(r)} === undefined`;return n?(0,Me.or)(s,(0,Me.not)(xS(t,e,r))):s}Ee.noPropertyInData=ES;function qj(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Ee.allSchemaProperties=qj;function g8(t,e){return qj(e).filter(r=>!(0,kS.alwaysValidSchema)(t,e[r]))}Ee.schemaProperties=g8;function y8({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?(0,Me._)`${t}, ${e}, ${n}${s}`:e,d=[[gs.default.instancePath,(0,Me.strConcat)(gs.default.instancePath,o)],[gs.default.parentData,i.parentData],[gs.default.parentDataProperty,i.parentDataProperty],[gs.default.rootData,gs.default.rootData]];i.opts.dynamicRef&&d.push([gs.default.dynamicAnchors,gs.default.dynamicAnchors]);let f=(0,Me._)`${u}, ${r.object(...d)}`;return c!==Me.nil?(0,Me._)`${a}.call(${c}, ${f})`:(0,Me._)`${a}(${f})`}Ee.callValidateCode=y8;var _8=(0,Me._)`new RegExp`;function v8({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,o=s(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Me._)`${s.code==="new RegExp"?_8:(0,d8.useFunc)(t,s)}(${r}, ${n})`})}Ee.usePattern=v8;function w8(t){let{gen:e,data:r,keyword:n,it:s}=t,o=e.name("valid");if(s.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(o,!0),i(()=>e.break()),o;function i(a){let c=e.const("len",(0,Me._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:kS.Type.Num},o),e.if((0,Me.not)(o),a)})}}Ee.validateArray=w8;function b8(t){let{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,kS.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(i,(0,Me._)`${i} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,Me.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}Ee.validateUnion=b8});var Uj=_(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.validateKeywordUsage=rn.validSchemaType=rn.funcKeywordCode=rn.macroKeywordCode=void 0;var Tt=se(),go=Nn(),S8=pr(),$8=Yl();function k8(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=Zj(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Tt.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}rn.macroKeywordCode=k8;function x8(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;T8(c,e);let l=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,u=Zj(n,s,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Fj(t),g(()=>t.error());else{let y=e.async?p():m();e.modifying&&Fj(t),g(()=>E8(t,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,Tt._)`await `),w=>n.assign(d,!1).if((0,Tt._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Tt._)`${w}.errors`),()=>n.throw(w))),y}function m(){let y=(0,Tt._)`${u}.errors`;return n.assign(y,null),h(Tt.nil),y}function h(y=e.async?(0,Tt._)`await `:Tt.nil){let w=c.opts.passContext?go.default.this:go.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Tt._)`${y}${(0,S8.callValidateCode)(t,u,w,b)}`,e.modifying)}function g(y){var w;n.if((0,Tt.not)((w=e.valid)!==null&&w!==void 0?w:d),y)}}rn.funcKeywordCode=x8;function Fj(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Tt._)`${n.parentData}[${n.parentDataProperty}]`))}function E8(t,e){let{gen:r}=t;r.if((0,Tt._)`Array.isArray(${e})`,()=>{r.assign(go.default.vErrors,(0,Tt._)`${go.default.vErrors} === null ? ${e} : ${go.default.vErrors}.concat(${e})`).assign(go.default.errors,(0,Tt._)`${go.default.vErrors}.length`),(0,$8.extendErrors)(t)},()=>t.error())}function T8({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Zj(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Tt.stringify)(r)})}function P8(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}rn.validSchemaType=P8;function O8({schema:t,opts:e,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let i=s.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}rn.validateKeywordUsage=O8});var Bj=_(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.extendSubschemaMode=ys.extendSubschemaData=ys.getSubschema=void 0;var nn=se(),Vj=he();function I8(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,nn._)`${t.schemaPath}${(0,nn.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,nn._)`${t.schemaPath}${(0,nn.getProperty)(e)}${(0,nn.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Vj.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}ys.getSubschema=I8;function N8(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,nn._)`${e.data}${(0,nn.getProperty)(r)}`,!0);c(f),t.errorPath=(0,nn.str)`${l}${(0,Vj.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,nn._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(s!==void 0){let l=s instanceof nn.Name?s:a.let("data",s,!0);c(l),i!==void 0&&(t.propertyName=i)}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ys.extendSubschemaData=N8;function C8(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}ys.extendSubschemaMode=C8});var Ql=_((G_e,Kj)=>{"use strict";Kj.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,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))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(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Wj=_((Y_e,Hj)=>{"use strict";var _s=Hj.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Sh(e,n,s,t,"",t)};_s.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};_s.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};_s.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};_s.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 Sh(t,e,r,n,s,o,i,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,o,i,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in _s.arrayKeywords)for(var f=0;f<d.length;f++)Sh(t,e,r,d[f],s+"/"+u+"/"+f,o,s,u,n,f)}else if(u in _s.propsKeywords){if(d&&typeof d=="object")for(var p in d)Sh(t,e,r,d[p],s+"/"+u+"/"+R8(p),o,s,u,n,p)}else(u in _s.keywords||t.allKeys&&!(u in _s.skipKeywords))&&Sh(t,e,r,d,s+"/"+u,o,s,u,n)}r(n,s,o,i,a,c,l)}}function R8(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var eu=_(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.getSchemaRefs=Ft.resolveUrl=Ft.normalizeId=Ft._getFullPath=Ft.getFullPath=Ft.inlineRef=void 0;var A8=he(),z8=Ql(),j8=Wj(),M8=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function L8(t,e=!0){return typeof t=="boolean"?!0:e===!0?!TS(t):e?Jj(t)<=e:!1}Ft.inlineRef=L8;var D8=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function TS(t){for(let e in t){if(D8.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(TS)||typeof r=="object"&&TS(r))return!0}return!1}function Jj(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!M8.has(r)&&(typeof t[r]=="object"&&(0,A8.eachItem)(t[r],n=>e+=Jj(n)),e===1/0))return 1/0}return e}function Gj(t,e="",r){r!==!1&&(e=Gi(e));let n=t.parse(e);return Yj(t,n)}Ft.getFullPath=Gj;function Yj(t,e){return t.serialize(e).split("#")[0]+"#"}Ft._getFullPath=Yj;var q8=/#\/?$/;function Gi(t){return t?t.replace(q8,""):""}Ft.normalizeId=Gi;function F8(t,e,r){return r=Gi(r),t.resolve(e,r)}Ft.resolveUrl=F8;var Z8=/^[a-z_][-a-z0-9._]*$/i;function U8(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=Gi(t[r]||e),o={"":s},i=Gj(n,s,!1),a={},c=new Set;return j8(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=i+f,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[f]=g;function y(b){let x=this.opts.uriResolver.resolve;if(b=Gi(g?x(g,b):b),c.has(b))throw u(b);c.add(b);let v=this.refs[b];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,b):b!==Gi(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function w(b){if(typeof b=="string"){if(!Z8.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),a;function l(d,f,p){if(f!==void 0&&!z8(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ft.getSchemaRefs=U8});var nu=_(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.getData=vs.KeywordCxt=vs.validateFunctionCode=void 0;var rM=Nj(),Xj=Xl(),OS=wS(),$h=Xl(),V8=Lj(),ru=Uj(),PS=Bj(),D=se(),H=Nn(),B8=eu(),Cn=he(),tu=Yl();function K8(t){if(oM(t)&&(iM(t),sM(t))){J8(t);return}nM(t,()=>(0,rM.topBoolOrEmptySchema)(t))}vs.validateFunctionCode=K8;function nM({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},o){s.code.es5?t.func(e,(0,D._)`${H.default.data}, ${H.default.valCxt}`,n.$async,()=>{t.code((0,D._)`"use strict"; ${Qj(r,s)}`),W8(t,s),t.code(o)}):t.func(e,(0,D._)`${H.default.data}, ${H8(s)}`,n.$async,()=>t.code(Qj(r,s)).code(o))}function H8(t){return(0,D._)`{${H.default.instancePath}="", ${H.default.parentData}, ${H.default.parentDataProperty}, ${H.default.rootData}=${H.default.data}${t.dynamicRef?(0,D._)`, ${H.default.dynamicAnchors}={}`:D.nil}}={}`}function W8(t,e){t.if(H.default.valCxt,()=>{t.var(H.default.instancePath,(0,D._)`${H.default.valCxt}.${H.default.instancePath}`),t.var(H.default.parentData,(0,D._)`${H.default.valCxt}.${H.default.parentData}`),t.var(H.default.parentDataProperty,(0,D._)`${H.default.valCxt}.${H.default.parentDataProperty}`),t.var(H.default.rootData,(0,D._)`${H.default.valCxt}.${H.default.rootData}`),e.dynamicRef&&t.var(H.default.dynamicAnchors,(0,D._)`${H.default.valCxt}.${H.default.dynamicAnchors}`)},()=>{t.var(H.default.instancePath,(0,D._)`""`),t.var(H.default.parentData,(0,D._)`undefined`),t.var(H.default.parentDataProperty,(0,D._)`undefined`),t.var(H.default.rootData,H.default.data),e.dynamicRef&&t.var(H.default.dynamicAnchors,(0,D._)`{}`)})}function J8(t){let{schema:e,opts:r,gen:n}=t;nM(t,()=>{r.$comment&&e.$comment&&cM(t),eY(t),n.let(H.default.vErrors,null),n.let(H.default.errors,0),r.unevaluated&&G8(t),aM(t),nY(t)})}function G8(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,D._)`${r}.evaluated`),e.if((0,D._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,D._)`${t.evaluated}.props`,(0,D._)`undefined`)),e.if((0,D._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,D._)`${t.evaluated}.items`,(0,D._)`undefined`))}function Qj(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function Y8(t,e){if(oM(t)&&(iM(t),sM(t))){X8(t,e);return}(0,rM.boolOrEmptySchema)(t,e)}function sM({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function oM(t){return typeof t.schema!="boolean"}function X8(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&cM(t),tY(t),rY(t);let o=n.const("_errs",H.default.errors);aM(t,o),n.var(e,(0,D._)`${o} === ${H.default.errors}`)}function iM(t){(0,Cn.checkUnknownRules)(t),Q8(t)}function aM(t,e){if(t.opts.jtd)return eM(t,[],!1,e);let r=(0,Xj.getSchemaTypes)(t.schema),n=(0,Xj.coerceAndCheckDataType)(t,r);eM(t,r,!n,e)}function Q8(t){let{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Cn.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function eY(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Cn.checkStrictMode)(t,"default is ignored in the schema root")}function tY(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,B8.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function rY(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function cM({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===!0)t.code((0,D._)`${H.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=(0,D.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,D._)`${H.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function nY(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=t;r.$async?e.if((0,D._)`${H.default.errors} === 0`,()=>e.return(H.default.data),()=>e.throw((0,D._)`new ${s}(${H.default.vErrors})`)):(e.assign((0,D._)`${n}.errors`,H.default.vErrors),o.unevaluated&&sY(t),e.return((0,D._)`${H.default.errors} === 0`))}function sY({gen:t,evaluated:e,props:r,items:n}){r instanceof D.Name&&t.assign((0,D._)`${e}.props`,r),n instanceof D.Name&&t.assign((0,D._)`${e}.items`,n)}function eM(t,e,r,n){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Cn.schemaHasRulesButRef)(o,u))){s.block(()=>uM(t,"$ref",u.all.$ref.definition));return}c.jtd||oY(t,e),s.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,OS.shouldUseGroup)(o,f)&&(f.type?(s.if((0,$h.checkDataType)(f.type,i,c.strictNumbers)),tM(t,f),e.length===1&&e[0]===f.type&&r&&(s.else(),(0,$h.reportTypeError)(t)),s.endIf()):tM(t,f),a||s.if((0,D._)`${H.default.errors} === ${n||0}`))}}function tM(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,V8.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,OS.shouldUseRule)(n,o)&&uM(t,o.keyword,o.definition,e.type)})}function oY(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(iY(t,e),t.opts.allowUnionTypes||aY(t,e),cY(t,t.dataTypes))}function iY(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{lM(t.dataTypes,r)||IS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),uY(t,e)}}function aY(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&IS(t,"use allowUnionTypes to allow union type keyword")}function cY(t,e){let r=t.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0,OS.shouldUseRule)(t.schema,s)){let{type:o}=s.definition;o.length&&!o.some(i=>lY(e,i))&&IS(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function lY(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function lM(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function uY(t,e){let r=[];for(let n of t.dataTypes)lM(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function IS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Cn.checkStrictMode)(t,e,t.opts.strictTypes)}var kh=class{constructor(e,r,n){if((0,ru.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Cn.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",dM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ru.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",H.default.errors))}result(e,r,n){this.failResult((0,D.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,D.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?tu.reportExtraError:tu.reportError)(this,this.def.error,r)}$dataError(){(0,tu.reportError)(this,this.def.$dataError||tu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,tu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=D.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,D.or)((0,D._)`${s} === undefined`,r)),e!==D.nil&&n.assign(e,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==D.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,D.or)(i(),a());function i(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,$h.checkDataTypes)(c,r,o.opts.strictNumbers,$h.DataType.Wrong)}`}return D.nil}function a(){if(s.validateSchema){let c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(e,r){let n=(0,PS.getSubschema)(this.it,e);(0,PS.extendSubschemaData)(n,this.it,e),(0,PS.extendSubschemaMode)(n,e);let s={...this.it,...n,items:void 0,props:void 0};return Y8(s,r),s}mergeEvaluated(e,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Cn.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Cn.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,D.Name)),!0}};vs.KeywordCxt=kh;function uM(t,e,r,n){let s=new kh(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,ru.funcKeywordCode)(s,r):"macro"in r?(0,ru.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,ru.funcKeywordCode)(s,r)}var dY=/^\/(?:[^~]|~0|~1)*$/,fY=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dM(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return H.default.rootData;if(t[0]==="/"){if(!dY.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=H.default.rootData}else{let l=fY.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!s)return o}let i=o,a=s.split("/");for(let l of a)l&&(o=(0,D._)`${o}${(0,D.getProperty)((0,Cn.unescapeJsonPointer)(l))}`,i=(0,D._)`${i} && ${o}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}vs.getData=dM});var xh=_(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var NS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};CS.default=NS});var su=_(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var RS=eu(),AS=class extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,RS.resolveUrl)(e,r,n),this.missingSchema=(0,RS.normalizeId)((0,RS.getFullPath)(e,this.missingRef))}};zS.default=AS});var Th=_(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.resolveSchema=hr.getCompilingSchema=hr.resolveRef=hr.compileSchema=hr.SchemaEnv=void 0;var jr=se(),pY=xh(),yo=Nn(),Mr=eu(),fM=he(),hY=nu(),Yi=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Mr.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};hr.SchemaEnv=Yi;function MS(t){let e=pM.call(this,t);if(e)return e;let r=(0,Mr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new jr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:pY.default,code:(0,jr._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:yo.default.data,parentData:yo.default.parentData,parentDataProperty:yo.default.parentDataProperty,dataNames:[yo.default.data],dataPathArr:[jr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,jr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:jr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,jr._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,hY.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(yo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${yo.default.self}`,`${yo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof jr.Name?void 0:m,items:h instanceof jr.Name?void 0:h,dynamicProps:m instanceof jr.Name,dynamicItems:h instanceof jr.Name},p.source&&(p.source.evaluated=(0,jr.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}hr.compileSchema=MS;function mY(t,e,r){var n;r=(0,Mr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=_Y.call(this,t,r);if(o===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new Yi({schema:i,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=gY.call(this,o)}hr.resolveRef=mY;function gY(t){return(0,Mr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:MS.call(this,t)}function pM(t){for(let e of this._compilations)if(yY(e,t))return e}hr.getCompilingSchema=pM;function yY(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function _Y(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Eh.call(this,t,e)}function Eh(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Mr._getFullPath)(this.opts.uriResolver,r),s=(0,Mr.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return jS.call(this,r,t);let o=(0,Mr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=Eh.call(this,t,i);return typeof a?.schema!="object"?void 0:jS.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||MS.call(this,i),o===(0,Mr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(s=(0,Mr.resolveUrl)(this.opts.uriResolver,s,l)),new Yi({schema:a,schemaId:c,root:t,baseId:s})}return jS.call(this,r,i)}}hr.resolveSchema=Eh;var vY=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function jS(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,fM.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!vY.has(a)&&l&&(e=(0,Mr.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,fM.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Mr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Eh.call(this,n,a)}let{schemaId:i}=this.opts;if(o=o||new Yi({schema:r,schemaId:i,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var hM=_((nve,wY)=>{wY.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var qS=_((sve,wM)=>{"use strict";var bY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gM=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),LS=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yM=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),SY=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function DS(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var $Y=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function mM(t){return t.length=0,!0}function kY(t,e,r){if(t.length){let n=DS(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function xY(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],o=!1,i=!1,a=kY;for(let c=0;c<t.length;c++){let l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(o===!0&&(i=!0),!a(s,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(l==="%"){if(!a(s,n,r))break;a=mM}else{s.push(l);continue}}return s.length&&(a===mM?r.zone=s.join(""):i?n.push(s.join("")):n.push(DS(s))),r.address=n.join(""),r}function _M(t){if(EY(t,":")<2)return{host:t,isIPV6:!1};let e=xY(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function EY(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function TY(t){let e=t,r=[],n=-1,s=0;for(;s=e.length;){if(s===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(s===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(s===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var PY={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},OY=/[@/?#:]/g,IY=/[@/?#]/g;function vM(t,e){let r=e?IY:OY;return r.lastIndex=0,t.replace(r,n=>PY[n])}function NY(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let s=t.slice(n+1,n+3);if(LS(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));e&&yM(i)?r+=i:r+="%"+o,n+=2;continue}}r+=t[n]}return r}function CY(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(LS(n)){let s=n.toUpperCase(),o=String.fromCharCode(parseInt(s,16));o!=="."&&yM(o)?e+=o:e+="%"+s,r+=2;continue}}SY(t[r])?e+=t[r]:e+=escape(t[r])}return e}function RY(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(LS(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function AY(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!gM(r)){let n=_M(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=vM(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}wM.exports={nonSimpleDomain:$Y,recomposeAuthority:AY,reescapeHostDelimiters:vM,normalizePercentEncoding:NY,normalizePathEncoding:CY,escapePreservingEscapes:RY,removeDotSegments:TY,isIPv4:gM,isUUID:bY,normalizeIPv6:_M,stringArrayToHexStripped:DS}});var xM=_((ove,kM)=>{"use strict";var{isUUID:zY}=qS(),jY=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,MY=["http","https","ws","wss","urn","urn:uuid"];function LY(t){return MY.indexOf(t)!==-1}function FS(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function bM(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function SM(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function DY(t){return t.secure=FS(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function qY(t){if((t.port===(FS(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function FY(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(jY);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let s=`${n}:${e.nid||t.nid}`,o=ZS(s);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ZY(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),s=`${r}:${e.nid||n}`,o=ZS(s);o&&(t=o.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function UY(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!zY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function VY(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var $M={scheme:"http",domainHost:!0,parse:bM,serialize:SM},BY={scheme:"https",domainHost:$M.domainHost,parse:bM,serialize:SM},Ph={scheme:"ws",domainHost:!0,parse:DY,serialize:qY},KY={scheme:"wss",domainHost:Ph.domainHost,parse:Ph.parse,serialize:Ph.serialize},HY={scheme:"urn",parse:FY,serialize:ZY,skipNormalize:!0},WY={scheme:"urn:uuid",parse:UY,serialize:VY,skipNormalize:!0},Oh={http:$M,https:BY,ws:Ph,wss:KY,urn:HY,"urn:uuid":WY};Object.setPrototypeOf(Oh,null);function ZS(t){return t&&(Oh[t]||Oh[t.toLowerCase()])||void 0}kM.exports={wsIsSecure:FS,SCHEMES:Oh,isValidSchemeName:LY,getSchemeHandler:ZS}});var VS=_((ive,Ih)=>{"use strict";var{normalizeIPv6:JY,removeDotSegments:ou,recomposeAuthority:GY,normalizePercentEncoding:YY,normalizePathEncoding:XY,escapePreservingEscapes:QY,reescapeHostDelimiters:e7,isIPv4:t7,nonSimpleDomain:r7}=qS(),{SCHEMES:n7,getSchemeHandler:TM}=xM();function s7(t,e){return typeof t=="string"?t=l7(t,e):typeof t=="object"&&(t=Xi(_o(t,e),e)),t}function o7(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=PM(Xi(t,n),Xi(e,n),n,!0);return n.skipEscape=!0,_o(s,n)}function PM(t,e,r,n){let s={};return n||(t=Xi(_o(t,r),r),e=Xi(_o(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(s.scheme=e.scheme,s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=ou(e.path||""),s.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=ou(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=ou(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?s.path="/"+e.path:t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:s.path=e.path,s.path=ou(s.path)),s.query=e.query):(s.path=t.path,e.query!==void 0?s.query=e.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=e.fragment,s}function i7(t,e,r){let n=EM(t,r),s=EM(e,r);return n!==void 0&&s!==void 0&&n.toLowerCase()===s.toLowerCase()}function _o(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),s=[],o=TM(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=YY(r.path):(r.path=QY(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let i=GY(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=ou(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var a7=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function c7(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function OM(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(a7);if(i){n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]);let a=c7(n,i);if(a!==void 0&&(n.error=n.error||a,s=!0),n.host)if(t7(n.host)===!1){let u=JY(n.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=TM(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&o===!1&&r7(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(l){n.error=n.error||"Host's domain name can not be converted to ASCII: "+l}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=e7(unescape(n.host),o))),n.path&&(n.path=XY(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s}}function Xi(t,e){return OM(t,e).parsed}function l7(t,e){return IM(t,e).normalized}function IM(t,e){let{parsed:r,malformedAuthorityOrPort:n}=OM(t,e);return{normalized:n?t:_o(r,e),malformedAuthorityOrPort:n}}function EM(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=IM(t,e);return n?void 0:r}if(typeof t=="object")return _o(t,e)}var US={SCHEMES:n7,normalize:s7,resolve:o7,resolveComponent:PM,equal:i7,serialize:_o,parse:Xi};Ih.exports=US;Ih.exports.default=US;Ih.exports.fastUri=US});var CM=_(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var NM=VS();NM.code='require("ajv/dist/runtime/uri").default';BS.default=NM});var qM=_(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.CodeGen=ut.Name=ut.nil=ut.stringify=ut.str=ut._=ut.KeywordCxt=void 0;var u7=nu();Object.defineProperty(ut,"KeywordCxt",{enumerable:!0,get:function(){return u7.KeywordCxt}});var Qi=se();Object.defineProperty(ut,"_",{enumerable:!0,get:function(){return Qi._}});Object.defineProperty(ut,"str",{enumerable:!0,get:function(){return Qi.str}});Object.defineProperty(ut,"stringify",{enumerable:!0,get:function(){return Qi.stringify}});Object.defineProperty(ut,"nil",{enumerable:!0,get:function(){return Qi.nil}});Object.defineProperty(ut,"Name",{enumerable:!0,get:function(){return Qi.Name}});Object.defineProperty(ut,"CodeGen",{enumerable:!0,get:function(){return Qi.CodeGen}});var d7=xh(),MM=su(),f7=vS(),iu=Th(),p7=se(),au=eu(),Nh=Xl(),HS=he(),RM=hM(),h7=CM(),LM=(t,e)=>new RegExp(t,e);LM.code="new RegExp";var m7=["removeAdditional","useDefaults","coerceTypes"],g7=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y7={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_7={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},AM=200;function v7(t){var e,r,n,s,o,i,a,c,l,u,d,f,p,m,h,g,y,w,b,x,v,S,T,I,A;let U=t.strict,ae=(e=t.code)===null||e===void 0?void 0:e.optimize,J=ae===!0||ae===void 0?1:ae||0,Y=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:LM,Ht=(s=t.uriResolver)!==null&&s!==void 0?s:h7.default;return{strictSchema:(i=(o=t.strictSchema)!==null&&o!==void 0?o:U)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:U)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:U)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:U)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:U)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:J,regExp:Y}:{optimize:J,regExp:Y},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:AM,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:AM,meta:(y=t.meta)!==null&&y!==void 0?y:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(x=t.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(v=t.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(S=t.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(T=t.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=t.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Ht}}var cu=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v7(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new p7.ValueScope({scope:{},prefixes:g7,es5:r,lines:n}),this.logger=x7(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,f7.getRules)(),zM.call(this,y7,e,"NOT SUPPORTED"),zM.call(this,_7,e,"DEPRECATED","warn"),this._metaOpts=$7.call(this),e.formats&&b7.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S7.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),w7.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=RM;n==="id"&&(s={...RM},s.id=s.$id,delete s.$id),r&&e&&this.addMetaSchema(s,s[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let s=n(r);return"$async"in n||(this.errors=n.errors),s}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,e,r);async function s(u,d){await o.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||i.call(this,f)}async function o(u){u&&!this.getSchema(u)&&await s.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof MM.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,s);return this}let o;if(typeof e=="object"){let{schemaId:i}=this.opts;if(o=e[i],o!==void 0&&typeof o!="string")throw new Error(`schema ${i} must be string`)}return r=(0,au.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,s,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(n,e);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(e){let r;for(;typeof(r=jM.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new iu.SchemaEnv({schema:{},schemaId:n});if(r=iu.resolveSchema.call(this,s,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=jM.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,au.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(T7.call(this,n,r),!r)return(0,HS.eachItem)(n,o=>KS.call(this,o)),this;O7.call(this,r);let s={...r,type:(0,Nh.getJSONTypes)(r.type),schemaType:(0,Nh.getJSONTypes)(r.schemaType)};return(0,HS.eachItem)(n,s.type.length===0?o=>KS.call(this,o,s):o=>s.type.forEach(i=>KS.call(this,o,s,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let s=n.rules.findIndex(o=>o.keyword===e);s>=0&&n.rules.splice(s,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let s of r){let o=s.split("/").slice(1),i=e;for(let a of o)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=DM(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let s=e[n];(!r||r.test(n))&&(typeof s=="string"?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,au.normalizeId)(i||n);let l=au.getSchemaRefs.call(this,e,n);return c=new iu.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):iu.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{iu.compileSchema.call(this,e)}finally{this.opts=r}}};cu.ValidationError=d7.default;cu.MissingRefError=MM.default;ut.default=cu;function zM(t,e,r,n="error"){for(let s in t){let o=s;o in e&&this.logger[n](`${r}: option ${s}. ${t[o]}`)}}function jM(t){return t=(0,au.normalizeId)(t),this.schemas[t]||this.refs[t]}function w7(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function b7(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function S7(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function $7(){let t={...this.opts};for(let e of m7)delete t[e];return t}var k7={log(){},warn(){},error(){}};function x7(t){if(t===!1)return k7;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var E7=/^[a-z_$][a-z0-9_$:-]*$/i;function T7(t,e){let{RULES:r}=this;if((0,HS.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!E7.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function KS(t,e,r){var n;let s=e?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},o.rules.push(i)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Nh.getJSONTypes)(e.type),schemaType:(0,Nh.getJSONTypes)(e.schemaType)}};e.before?P7.call(this,i,a,e.before):i.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function P7(t,e,r){let n=t.rules.findIndex(s=>s.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function O7(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=DM(e)),t.validateSchema=this.compile(e,!0))}var I7={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function DM(t){return{anyOf:[t,I7]}}});var FM=_(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var N7={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};WS.default=N7});var BM=_(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.callRef=vo.getValidate=void 0;var C7=su(),ZM=pr(),Zt=se(),ea=Nn(),UM=Th(),Ch=he(),R7={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:l}=o;if((r==="#"||r==="#/")&&s===l.baseId)return d();let u=UM.resolveRef.call(c,l,s,r);if(u===void 0)throw new C7.default(n.opts.uriResolver,s,r);if(u instanceof UM.SchemaEnv)return f(u);return p(u);function d(){if(o===l)return Rh(t,i,o,o.$async);let m=e.scopeValue("root",{ref:l});return Rh(t,(0,Zt._)`${m}.validate`,l,l.$async)}function f(m){let h=VM(t,m);Rh(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Zt.stringify)(m)}:{ref:m}),g=e.name("valid"),y=t.subschema({schema:m,dataTypes:[],schemaPath:Zt.nil,topSchemaRef:h,errSchemaPath:r},g);t.mergeEvaluated(y),t.ok(g)}}};function VM(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Zt._)`${r.scopeValue("wrapper",{ref:e})}.validate`}vo.getValidate=VM;function Rh(t,e,r,n){let{gen:s,it:o}=t,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?ea.default.this:Zt.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=s.let("valid");s.try(()=>{s.code((0,Zt._)`await ${(0,ZM.callValidateCode)(t,e,l)}`),p(e),i||s.assign(m,!0)},h=>{s.if((0,Zt._)`!(${h} instanceof ${o.ValidationError})`,()=>s.throw(h)),f(h),i||s.assign(m,!1)}),t.ok(m)}function d(){t.result((0,ZM.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Zt._)`${m}.errors`;s.assign(ea.default.vErrors,(0,Zt._)`${ea.default.vErrors} === null ? ${h} : ${ea.default.vErrors}.concat(${h})`),s.assign(ea.default.errors,(0,Zt._)`${ea.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=Ch.mergeEvaluated.props(s,g.props,o.props));else{let y=s.var("props",(0,Zt._)`${m}.evaluated.props`);o.props=Ch.mergeEvaluated.props(s,y,o.props,Zt.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=Ch.mergeEvaluated.items(s,g.items,o.items));else{let y=s.var("items",(0,Zt._)`${m}.evaluated.items`);o.items=Ch.mergeEvaluated.items(s,y,o.items,Zt.Name)}}}vo.callRef=Rh;vo.default=R7});var KM=_(JS=>{"use strict";Object.defineProperty(JS,"__esModule",{value:!0});var A7=FM(),z7=BM(),j7=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",A7.default,z7.default];JS.default=j7});var HM=_(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0});var Ah=se(),ws=Ah.operators,zh={maximum:{okStr:"<=",ok:ws.LTE,fail:ws.GT},minimum:{okStr:">=",ok:ws.GTE,fail:ws.LT},exclusiveMaximum:{okStr:"<",ok:ws.LT,fail:ws.GTE},exclusiveMinimum:{okStr:">",ok:ws.GT,fail:ws.LTE}},M7={message:({keyword:t,schemaCode:e})=>(0,Ah.str)`must be ${zh[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ah._)`{comparison: ${zh[t].okStr}, limit: ${e}}`},L7={keyword:Object.keys(zh),type:"number",schemaType:"number",$data:!0,error:M7,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Ah._)`${r} ${zh[e].fail} ${n} || isNaN(${r})`)}};GS.default=L7});var WM=_(YS=>{"use strict";Object.defineProperty(YS,"__esModule",{value:!0});var lu=se(),D7={message:({schemaCode:t})=>(0,lu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,lu._)`{multipleOf: ${t}}`},q7={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:D7,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,lu._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,lu._)`${i} !== parseInt(${i})`;t.fail$data((0,lu._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};YS.default=q7});var GM=_(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});function JM(t){let e=t.length,r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}XS.default=JM;JM.code='require("ajv/dist/runtime/ucs2length").default'});var YM=_(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var wo=se(),F7=he(),Z7=GM(),U7={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,wo.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,wo._)`{limit: ${t}}`},V7={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:U7,code(t){let{keyword:e,data:r,schemaCode:n,it:s}=t,o=e==="maxLength"?wo.operators.GT:wo.operators.LT,i=s.opts.unicode===!1?(0,wo._)`${r}.length`:(0,wo._)`${(0,F7.useFunc)(t.gen,Z7.default)}(${r})`;t.fail$data((0,wo._)`${i} ${o} ${n}`)}};QS.default=V7});var XM=_(e$=>{"use strict";Object.defineProperty(e$,"__esModule",{value:!0});var B7=pr(),K7=he(),ta=se(),H7={message:({schemaCode:t})=>(0,ta.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ta._)`{pattern: ${t}}`},W7={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:H7,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,ta._)`new RegExp`:(0,K7.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,ta._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,ta._)`!${u}`)}else{let c=(0,B7.usePattern)(t,s);t.fail$data((0,ta._)`!${c}.test(${r})`)}}};e$.default=W7});var QM=_(t$=>{"use strict";Object.defineProperty(t$,"__esModule",{value:!0});var uu=se(),J7={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,uu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,uu._)`{limit: ${t}}`},G7={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:J7,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?uu.operators.GT:uu.operators.LT;t.fail$data((0,uu._)`Object.keys(${r}).length ${s} ${n}`)}};t$.default=G7});var eL=_(r$=>{"use strict";Object.defineProperty(r$,"__esModule",{value:!0});var du=pr(),fu=se(),Y7=he(),X7={message:({params:{missingProperty:t}})=>(0,fu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,fu._)`{missingProperty: ${t}}`},Q7={keyword:"required",type:"object",schemaType:"array",$data:!0,error:X7,code(t){let{gen:e,schema:r,schemaCode:n,data:s,$data:o,it:i}=t,{opts:a}=i;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,Y7.checkStrictMode)(i,y,i.opts.strictRequired)}}function l(){if(c||o)t.block$data(fu.nil,d);else for(let p of r)(0,du.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||o){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,du.checkMissingProp)(t,r,p)),(0,du.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,du.noPropertyInData)(e,s,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,du.propertyInData)(e,s,p,a.ownProperties)),e.if((0,fu.not)(m),()=>{t.error(),e.break()})},fu.nil)}}};r$.default=Q7});var tL=_(n$=>{"use strict";Object.defineProperty(n$,"__esModule",{value:!0});var pu=se(),eX={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,pu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,pu._)`{limit: ${t}}`},tX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:eX,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?pu.operators.GT:pu.operators.LT;t.fail$data((0,pu._)`${r}.length ${s} ${n}`)}};n$.default=tX});var jh=_(s$=>{"use strict";Object.defineProperty(s$,"__esModule",{value:!0});var rL=Ql();rL.code='require("ajv/dist/runtime/equal").default';s$.default=rL});var nL=_(i$=>{"use strict";Object.defineProperty(i$,"__esModule",{value:!0});var o$=Xl(),dt=se(),rX=he(),nX=jh(),sX={message:({params:{i:t,j:e}})=>(0,dt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,dt._)`{i: ${t}, j: ${e}}`},oX={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:sX,code(t){let{gen:e,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=t;if(!n&&!s)return;let c=e.let("valid"),l=o.items?(0,o$.getSchemaTypes)(o.items):[];t.block$data(c,u,(0,dt._)`${i} === false`),t.ok(c);function u(){let m=e.let("i",(0,dt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,dt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let g=e.name("item"),y=(0,o$.checkDataTypes)(l,g,a.opts.strictNumbers,o$.DataType.Wrong),w=e.const("indices",(0,dt._)`{}`);e.for((0,dt._)`;${m}--;`,()=>{e.let(g,(0,dt._)`${r}[${m}]`),e.if(y,(0,dt._)`continue`),l.length>1&&e.if((0,dt._)`typeof ${g} == "string"`,(0,dt._)`${g} += "_"`),e.if((0,dt._)`typeof ${w}[${g}] == "number"`,()=>{e.assign(h,(0,dt._)`${w}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,dt._)`${w}[${g}] = ${m}`)})}function p(m,h){let g=(0,rX.useFunc)(e,nX.default),y=e.name("outer");e.label(y).for((0,dt._)`;${m}--;`,()=>e.for((0,dt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,dt._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(y)})))}}};i$.default=oX});var sL=_(c$=>{"use strict";Object.defineProperty(c$,"__esModule",{value:!0});var a$=se(),iX=he(),aX=jh(),cX={message:"must be equal to constant",params:({schemaCode:t})=>(0,a$._)`{allowedValue: ${t}}`},lX={keyword:"const",$data:!0,error:cX,code(t){let{gen:e,data:r,$data:n,schemaCode:s,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,a$._)`!${(0,iX.useFunc)(e,aX.default)}(${r}, ${s})`):t.fail((0,a$._)`${o} !== ${r}`)}};c$.default=lX});var oL=_(l$=>{"use strict";Object.defineProperty(l$,"__esModule",{value:!0});var hu=se(),uX=he(),dX=jh(),fX={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,hu._)`{allowedValues: ${t}}`},pX={keyword:"enum",schemaType:"array",$data:!0,error:fX,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,uX.useFunc)(e,dX.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(s))throw new Error("ajv implementation error");let p=e.const("vSchema",o);u=(0,hu.or)(...s.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,p=>e.if((0,hu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=s[m];return typeof h=="object"&&h!==null?(0,hu._)`${l()}(${r}, ${p}[${m}])`:(0,hu._)`${r} === ${h}`}}};l$.default=pX});var iL=_(u$=>{"use strict";Object.defineProperty(u$,"__esModule",{value:!0});var hX=HM(),mX=WM(),gX=YM(),yX=XM(),_X=QM(),vX=eL(),wX=tL(),bX=nL(),SX=sL(),$X=oL(),kX=[hX.default,mX.default,gX.default,yX.default,_X.default,vX.default,wX.default,bX.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},SX.default,$X.default];u$.default=kX});var f$=_(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.validateAdditionalItems=void 0;var bo=se(),d$=he(),xX={message:({params:{len:t}})=>(0,bo.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,bo._)`{limit: ${t}}`},EX={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:xX,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,d$.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}aL(t,n)}};function aL(t,e){let{gen:r,schema:n,data:s,keyword:o,it:i}=t;i.items=!0;let a=r.const("len",(0,bo._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,bo._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,d$.alwaysValidSchema)(i,n)){let l=r.var("valid",(0,bo._)`${a} <= ${e.length}`);r.if((0,bo.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:d$.Type.Num},l),i.allErrors||r.if((0,bo.not)(l),()=>r.break())})}}mu.validateAdditionalItems=aL;mu.default=EX});var p$=_(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.validateTuple=void 0;var cL=se(),Mh=he(),TX=pr(),PX={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return lL(t,"additionalItems",e);r.items=!0,!(0,Mh.alwaysValidSchema)(r,e)&&t.ok((0,TX.validateArray)(t))}};function lL(t,e,r=t.schema){let{gen:n,parentSchema:s,data:o,keyword:i,it:a}=t;u(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Mh.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,cL._)`${o}.length`);r.forEach((d,f)=>{(0,Mh.alwaysValidSchema)(a,d)||(n.if((0,cL._)`${l} > ${f}`,()=>t.subschema({keyword:i,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let g=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Mh.checkStrictMode)(a,g,f.strictTuples)}}}gu.validateTuple=lL;gu.default=PX});var uL=_(h$=>{"use strict";Object.defineProperty(h$,"__esModule",{value:!0});var OX=p$(),IX={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,OX.validateTuple)(t,"items")};h$.default=IX});var fL=_(m$=>{"use strict";Object.defineProperty(m$,"__esModule",{value:!0});var dL=se(),NX=he(),CX=pr(),RX=f$(),AX={message:({params:{len:t}})=>(0,dL.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,dL._)`{limit: ${t}}`},zX={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:AX,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,NX.alwaysValidSchema)(n,e)&&(s?(0,RX.validateAdditionalItems)(t,s):t.ok((0,CX.validateArray)(t)))}};m$.default=zX});var pL=_(g$=>{"use strict";Object.defineProperty(g$,"__esModule",{value:!0});var mr=se(),Lh=he(),jX={message:({params:{min:t,max:e}})=>e===void 0?(0,mr.str)`must contain at least ${t} valid item(s)`:(0,mr.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,mr._)`{minContains: ${t}}`:(0,mr._)`{minContains: ${t}, maxContains: ${e}}`},MX={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:jX,code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t,i,a,{minContains:c,maxContains:l}=n;o.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=e.const("len",(0,mr._)`${s}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Lh.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Lh.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Lh.alwaysValidSchema)(o,r)){let h=(0,mr._)`${u} >= ${i}`;a!==void 0&&(h=(0,mr._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&i===1?p(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,mr._)`${s}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),g=e.let("count",0);p(h,()=>e.if(h,()=>m(g)))}function p(h,g){e.forRange("i",0,u,y=>{t.subschema({keyword:"contains",dataProp:y,dataPropType:Lh.Type.Num,compositeRule:!0},h),g()})}function m(h){e.code((0,mr._)`${h}++`),a===void 0?e.if((0,mr._)`${h} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,mr._)`${h} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,mr._)`${h} >= ${i}`,()=>e.assign(d,!0)))}}};g$.default=MX});var gL=_(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.validateSchemaDeps=sn.validatePropertyDeps=sn.error=void 0;var y$=se(),LX=he(),yu=pr();sn.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,y$.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,y$._)`{property: ${t},
|
|
299
|
+
missingProperty: ${n},
|
|
300
|
+
depsCount: ${e},
|
|
301
|
+
deps: ${r}}`};var DX={keyword:"dependencies",type:"object",schemaType:"object",error:sn.error,code(t){let[e,r]=qX(t);hL(t,e),mL(t,r)}};function qX({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let s=Array.isArray(t[n])?e:r;s[n]=t[n]}return[e,r]}function hL(t,e=t.schema){let{gen:r,data:n,it:s}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,yu.propertyInData)(r,n,i,s.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors?r.if(c,()=>{for(let l of a)(0,yu.checkReportMissingProp)(t,l)}):(r.if((0,y$._)`${c} && (${(0,yu.checkMissingProp)(t,a,o)})`),(0,yu.reportMissingProp)(t,o),r.else())}}sn.validatePropertyDeps=hL;function mL(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,LX.alwaysValidSchema)(o,e[a])||(r.if((0,yu.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:s,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}sn.validateSchemaDeps=mL;sn.default=DX});var _L=_(_$=>{"use strict";Object.defineProperty(_$,"__esModule",{value:!0});var yL=se(),FX=he(),ZX={message:"property name must be valid",params:({params:t})=>(0,yL._)`{propertyName: ${t.propertyName}}`},UX={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ZX,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,FX.alwaysValidSchema)(s,r))return;let o=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),e.if((0,yL.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};_$.default=UX});var w$=_(v$=>{"use strict";Object.defineProperty(v$,"__esModule",{value:!0});var Dh=pr(),Lr=se(),VX=Nn(),qh=he(),BX={message:"must NOT have additional properties",params:({params:t})=>(0,Lr._)`{additionalProperty: ${t.additionalProperty}}`},KX={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:BX,code(t){let{gen:e,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,qh.alwaysValidSchema)(i,r))return;let l=(0,Dh.allSchemaProperties)(n.properties),u=(0,Dh.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Lr._)`${o} === ${VX.default.errors}`);function d(){e.forIn("key",s,g=>{!l.length&&!u.length?m(g):e.if(f(g),()=>m(g))})}function f(g){let y;if(l.length>8){let w=(0,qh.schemaRefOrVal)(i,n.properties,"properties");y=(0,Dh.isOwnProperty)(e,w,g)}else l.length?y=(0,Lr.or)(...l.map(w=>(0,Lr._)`${g} === ${w}`)):y=Lr.nil;return u.length&&(y=(0,Lr.or)(y,...u.map(w=>(0,Lr._)`${(0,Dh.usePattern)(t,w)}.test(${g})`))),(0,Lr.not)(y)}function p(g){e.code((0,Lr._)`delete ${s}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,qh.alwaysValidSchema)(i,r)){let y=e.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),e.if((0,Lr.not)(y),()=>{t.reset(),p(g)})):(h(g,y),a||e.if((0,Lr.not)(y),()=>e.break()))}}function h(g,y,w){let b={keyword:"additionalProperties",dataProp:g,dataPropType:qh.Type.Str};w===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(b,y)}}};v$.default=KX});var bL=_(S$=>{"use strict";Object.defineProperty(S$,"__esModule",{value:!0});var HX=nu(),vL=pr(),b$=he(),wL=w$(),WX={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&wL.default.code(new HX.KeywordCxt(o,wL.default,"additionalProperties"));let i=(0,vL.allSchemaProperties)(r);for(let d of i)o.definedProperties.add(d);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=b$.mergeEvaluated.props(e,(0,b$.toHash)(i),o.props));let a=i.filter(d=>!(0,b$.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,vL.propertyInData)(e,s,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};S$.default=WX});var xL=_($$=>{"use strict";Object.defineProperty($$,"__esModule",{value:!0});var SL=pr(),Fh=se(),$L=he(),kL=he(),JX={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:s,it:o}=t,{opts:i}=o,a=(0,SL.allSchemaProperties)(r),c=a.filter(h=>(0,$L.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof Fh.Name)&&(o.props=(0,kL.evaluatedPropsToName)(e,o.props));let{props:d}=o;f();function f(){for(let h of a)l&&p(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,$L.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,g=>{e.if((0,Fh._)`${(0,SL.usePattern)(t,h)}.test(${g})`,()=>{let y=c.includes(h);y||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:kL.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,Fh._)`${d}[${g}]`,!0):!y&&!o.allErrors&&e.if((0,Fh.not)(u),()=>e.break())})})}}};$$.default=JX});var EL=_(k$=>{"use strict";Object.defineProperty(k$,"__esModule",{value:!0});var GX=he(),YX={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,GX.alwaysValidSchema)(n,r)){t.fail();return}let s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};k$.default=YX});var TL=_(x$=>{"use strict";Object.defineProperty(x$,"__esModule",{value:!0});var XX=pr(),QX={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:XX.validateUnion,error:{message:"must match a schema in anyOf"}};x$.default=QX});var PL=_(E$=>{"use strict";Object.defineProperty(E$,"__esModule",{value:!0});var Zh=se(),eQ=he(),tQ={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Zh._)`{passingSchemas: ${t.passing}}`},rQ={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:tQ,code(t){let{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(i,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((u,d)=>{let f;(0,eQ.alwaysValidSchema)(s,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Zh._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Zh._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Zh.Name)})})}}};E$.default=rQ});var OL=_(T$=>{"use strict";Object.defineProperty(T$,"__esModule",{value:!0});var nQ=he(),sQ={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=e.name("valid");r.forEach((o,i)=>{if((0,nQ.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};T$.default=sQ});var CL=_(P$=>{"use strict";Object.defineProperty(P$,"__esModule",{value:!0});var Uh=se(),NL=he(),oQ={message:({params:t})=>(0,Uh.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Uh._)`{failingKeyword: ${t.ifClause}}`},iQ={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:oQ,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,NL.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=IL(n,"then"),o=IL(n,"else");if(!s&&!o)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else s?e.if(a,l("then")):e.if((0,Uh.not)(a),l("else"));t.pass(i,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(i,a),t.mergeValidEvaluated(f,i),d?e.assign(d,(0,Uh._)`${u}`):t.setParams({ifClause:u})}}}};function IL(t,e){let r=t.schema[e];return r!==void 0&&!(0,NL.alwaysValidSchema)(t,r)}P$.default=iQ});var RL=_(O$=>{"use strict";Object.defineProperty(O$,"__esModule",{value:!0});var aQ=he(),cQ={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,aQ.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};O$.default=cQ});var AL=_(I$=>{"use strict";Object.defineProperty(I$,"__esModule",{value:!0});var lQ=f$(),uQ=uL(),dQ=p$(),fQ=fL(),pQ=pL(),hQ=gL(),mQ=_L(),gQ=w$(),yQ=bL(),_Q=xL(),vQ=EL(),wQ=TL(),bQ=PL(),SQ=OL(),$Q=CL(),kQ=RL();function xQ(t=!1){let e=[vQ.default,wQ.default,bQ.default,SQ.default,$Q.default,kQ.default,mQ.default,gQ.default,hQ.default,yQ.default,_Q.default];return t?e.push(uQ.default,fQ.default):e.push(lQ.default,dQ.default),e.push(pQ.default),e}I$.default=xQ});var zL=_(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});var Je=se(),EQ={message:({schemaCode:t})=>(0,Je.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Je._)`{format: ${t}}`},TQ={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:EQ,code(t,e){let{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;s?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Je._)`${m}[${i}]`),g=r.let("fType"),y=r.let("format");r.if((0,Je._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Je._)`${h}.type || "string"`).assign(y,(0,Je._)`${h}.validate`),()=>r.assign(g,(0,Je._)`"string"`).assign(y,h)),t.fail$data((0,Je.or)(w(),b()));function w(){return c.strictSchema===!1?Je.nil:(0,Je._)`${i} && !${y}`}function b(){let x=u.$async?(0,Je._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,Je._)`${y}(${n})`,v=(0,Je._)`(typeof ${y} == "function" ? ${x} : ${y}.test(${n}))`;return(0,Je._)`${y} && ${y} !== true && ${g} === ${e} && !${v}`}}function p(){let m=d.formats[o];if(!m){w();return}if(m===!0)return;let[h,g,y]=b(m);h===e&&t.pass(x());function w(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function b(v){let S=v instanceof RegExp?(0,Je.regexpCode)(v):c.code.formats?(0,Je._)`${c.code.formats}${(0,Je.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:v,code:S});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,Je._)`${T}.validate`]:["string",v,T]}function x(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Je._)`await ${y}(${n})`}return typeof g=="function"?(0,Je._)`${y}(${n})`:(0,Je._)`${y}.test(${n})`}}}};N$.default=TQ});var jL=_(C$=>{"use strict";Object.defineProperty(C$,"__esModule",{value:!0});var PQ=zL(),OQ=[PQ.default];C$.default=OQ});var ML=_(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.contentVocabulary=ra.metadataVocabulary=void 0;ra.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ra.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var DL=_(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});var IQ=KM(),NQ=iL(),CQ=AL(),RQ=jL(),LL=ML(),AQ=[IQ.default,NQ.default,(0,CQ.default)(),RQ.default,LL.metadataVocabulary,LL.contentVocabulary];R$.default=AQ});var FL=_(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.DiscrError=void 0;var qL;(function(t){t.Tag="tag",t.Mapping="mapping"})(qL||(Vh.DiscrError=qL={}))});var UL=_(z$=>{"use strict";Object.defineProperty(z$,"__esModule",{value:!0});var na=se(),A$=FL(),ZL=Th(),zQ=su(),jQ=he(),MQ={message:({params:{discrError:t,tagName:e}})=>t===A$.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,na._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},LQ={keyword:"discriminator",type:"object",schemaType:"object",error:MQ,code(t){let{gen:e,data:r,schema:n,parentSchema:s,it:o}=t,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,na._)`${r}${(0,na.getProperty)(a)}`);e.if((0,na._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:A$.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,na._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:A$.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,na.Name),m}function f(){var p;let m={},h=y(s),g=!0;for(let x=0;x<i.length;x++){let v=i[x];if(v?.$ref&&!(0,jQ.schemaHasRulesButRef)(v,o.self.RULES)){let T=v.$ref;if(v=ZL.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),v instanceof ZL.SchemaEnv&&(v=v.schema),v===void 0)throw new zQ.default(o.opts.uriResolver,o.baseId,T)}let S=(p=v?.properties)===null||p===void 0?void 0:p[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(v)),w(S,x)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:x}){return Array.isArray(x)&&x.includes(a)}function w(x,v){if(x.const)b(x.const,v);else if(x.enum)for(let S of x.enum)b(S,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(x,v){if(typeof x!="string"||x in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[x]=v}}}};z$.default=LQ});var VL=_((Wve,DQ)=>{DQ.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 KL=_((Le,j$)=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.MissingRefError=Le.ValidationError=Le.CodeGen=Le.Name=Le.nil=Le.stringify=Le.str=Le._=Le.KeywordCxt=Le.Ajv=void 0;var qQ=qM(),FQ=DL(),ZQ=UL(),BL=VL(),UQ=["/properties"],Bh="http://json-schema.org/draft-07/schema",sa=class extends qQ.default{_addVocabularies(){super._addVocabularies(),FQ.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(ZQ.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(BL,UQ):BL;this.addMetaSchema(e,Bh,!1),this.refs["http://json-schema.org/schema"]=Bh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bh)?Bh:void 0)}};Le.Ajv=sa;j$.exports=Le=sa;j$.exports.Ajv=sa;Object.defineProperty(Le,"__esModule",{value:!0});Le.default=sa;var VQ=nu();Object.defineProperty(Le,"KeywordCxt",{enumerable:!0,get:function(){return VQ.KeywordCxt}});var oa=se();Object.defineProperty(Le,"_",{enumerable:!0,get:function(){return oa._}});Object.defineProperty(Le,"str",{enumerable:!0,get:function(){return oa.str}});Object.defineProperty(Le,"stringify",{enumerable:!0,get:function(){return oa.stringify}});Object.defineProperty(Le,"nil",{enumerable:!0,get:function(){return oa.nil}});Object.defineProperty(Le,"Name",{enumerable:!0,get:function(){return oa.Name}});Object.defineProperty(Le,"CodeGen",{enumerable:!0,get:function(){return oa.CodeGen}});var BQ=xh();Object.defineProperty(Le,"ValidationError",{enumerable:!0,get:function(){return BQ.default}});var KQ=su();Object.defineProperty(Le,"MissingRefError",{enumerable:!0,get:function(){return KQ.default}})});var eD=_(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.formatNames=an.fastFormats=an.fullFormats=void 0;function on(t,e){return{validate:t,compare:e}}an.fullFormats={date:on(GL,q$),time:on(L$(!0),F$),"date-time":on(HL(!0),XL),"iso-time":on(L$(),YL),"iso-date-time":on(HL(),QL),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:XQ,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:oee,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:QQ,int32:{type:"number",validate:ree},int64:{type:"number",validate:nee},float:{type:"number",validate:JL},double:{type:"number",validate:JL},password:!0,binary:!0};an.fastFormats={...an.fullFormats,date:on(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,q$),time:on(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,F$),"date-time":on(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,XL),"iso-time":on(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,YL),"iso-date-time":on(/^\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,QL),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};an.formatNames=Object.keys(an.fullFormats);function HQ(t){return t%4===0&&(t%100!==0||t%400===0)}var WQ=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,JQ=[0,31,28,31,30,31,30,31,31,30,31,30,31];function GL(t){let e=WQ.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],s=+e[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&HQ(r)?29:JQ[n])}function q$(t,e){if(t&&e)return t>e?1:t<e?-1:0}var M$=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function L$(t){return function(r){let n=M$.exec(r);if(!n)return!1;let s=+n[1],o=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||t&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*c,f=s-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function F$(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function YL(t,e){if(!(t&&e))return;let r=M$.exec(t),n=M$.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var D$=/t|\s/i;function HL(t){let e=L$(t);return function(n){let s=n.split(D$);return s.length===2&&GL(s[0])&&e(s[1])}}function XL(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function QL(t,e){if(!(t&&e))return;let[r,n]=t.split(D$),[s,o]=e.split(D$),i=q$(r,s);if(i!==void 0)return i||F$(n,o)}var GQ=/\/|:/,YQ=/^(?:[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;function XQ(t){return GQ.test(t)&&YQ.test(t)}var WL=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function QQ(t){return WL.lastIndex=0,WL.test(t)}var eee=-(2**31),tee=2**31-1;function ree(t){return Number.isInteger(t)&&t<=tee&&t>=eee}function nee(t){return Number.isInteger(t)}function JL(){return!0}var see=/[^\\]\\Z/;function oee(t){if(see.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var wu=_(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.regexpCode=we.getEsmExportName=we.getProperty=we.safeStringify=we.stringify=we.strConcat=we.addCodeArg=we.str=we._=we.nil=we._Code=we.Name=we.IDENTIFIER=we._CodeOrName=void 0;var _u=class{};we._CodeOrName=_u;we.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var So=class extends _u{constructor(e){if(super(),!we.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};we.Name=So;var gr=class extends _u{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof So&&(r[n.str]=(r[n.str]||0)+1),r),{})}};we._Code=gr;we.nil=new gr("");function tD(t,...e){let r=[t[0]],n=0;for(;n<e.length;)U$(r,e[n]),r.push(t[++n]);return new gr(r)}we._=tD;var Z$=new gr("+");function rD(t,...e){let r=[vu(t[0])],n=0;for(;n<e.length;)r.push(Z$),U$(r,e[n]),r.push(Z$,vu(t[++n]));return iee(r),new gr(r)}we.str=rD;function U$(t,e){e instanceof gr?t.push(...e._items):e instanceof So?t.push(e):t.push(lee(e))}we.addCodeArg=U$;function iee(t){let e=1;for(;e<t.length-1;){if(t[e]===Z$){let r=aee(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function aee(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof So||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof So))return`"${t}${e.slice(1)}`}function cee(t,e){return e.emptyStr()?t:t.emptyStr()?e:rD`${t}${e}`}we.strConcat=cee;function lee(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:vu(Array.isArray(t)?t.join(","):t)}function uee(t){return new gr(vu(t))}we.stringify=uee;function vu(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}we.safeStringify=vu;function dee(t){return typeof t=="string"&&we.IDENTIFIER.test(t)?new gr(`.${t}`):tD`[${t}]`}we.getProperty=dee;function fee(t){if(typeof t=="string"&&we.IDENTIFIER.test(t))return new gr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}we.getEsmExportName=fee;function pee(t){return new gr(t.toString())}we.regexpCode=pee});var K$=_(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.ValueScope=Vt.ValueScopeName=Vt.Scope=Vt.varKinds=Vt.UsedValueState=void 0;var Ut=wu(),V$=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Kh;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Kh||(Vt.UsedValueState=Kh={}));Vt.varKinds={const:new Ut.Name("const"),let:new Ut.Name("let"),var:new Ut.Name("var")};var Hh=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ut.Name?e:this.name(e)}name(e){return new Ut.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Vt.Scope=Hh;var Wh=class extends Ut.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ut._)`.${new Ut.Name(r)}[${n}]`}};Vt.ValueScopeName=Wh;var hee=(0,Ut._)`\n`,B$=class extends Hh{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?hee:Ut.nil}}get(){return this._scope}name(e){return new Wh(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let u=a.get(i);if(u)return u}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,s.setValue(r,{property:o,itemIndex:l}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ut._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Ut.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Kh.Started);let u=r(l);if(u){let d=this.opts.es5?Vt.varKinds.var:Vt.varKinds.const;o=(0,Ut._)`${o}${d} ${l} = ${u};${this.opts._n}`}else if(u=s?.(l))o=(0,Ut._)`${o}${u}${this.opts._n}`;else throw new V$(l);c.set(l,Kh.Completed)})}return o}};Vt.ValueScope=B$});var ee=_(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.or=ne.and=ne.not=ne.CodeGen=ne.operators=ne.varKinds=ne.ValueScopeName=ne.ValueScope=ne.Scope=ne.Name=ne.regexpCode=ne.stringify=ne.getProperty=ne.nil=ne.strConcat=ne.str=ne._=void 0;var fe=wu(),Dr=K$(),bs=wu();Object.defineProperty(ne,"_",{enumerable:!0,get:function(){return bs._}});Object.defineProperty(ne,"str",{enumerable:!0,get:function(){return bs.str}});Object.defineProperty(ne,"strConcat",{enumerable:!0,get:function(){return bs.strConcat}});Object.defineProperty(ne,"nil",{enumerable:!0,get:function(){return bs.nil}});Object.defineProperty(ne,"getProperty",{enumerable:!0,get:function(){return bs.getProperty}});Object.defineProperty(ne,"stringify",{enumerable:!0,get:function(){return bs.stringify}});Object.defineProperty(ne,"regexpCode",{enumerable:!0,get:function(){return bs.regexpCode}});Object.defineProperty(ne,"Name",{enumerable:!0,get:function(){return bs.Name}});var Xh=K$();Object.defineProperty(ne,"Scope",{enumerable:!0,get:function(){return Xh.Scope}});Object.defineProperty(ne,"ValueScope",{enumerable:!0,get:function(){return Xh.ValueScope}});Object.defineProperty(ne,"ValueScopeName",{enumerable:!0,get:function(){return Xh.ValueScopeName}});Object.defineProperty(ne,"varKinds",{enumerable:!0,get:function(){return Xh.varKinds}});ne.operators={GT:new fe._Code(">"),GTE:new fe._Code(">="),LT:new fe._Code("<"),LTE:new fe._Code("<="),EQ:new fe._Code("==="),NEQ:new fe._Code("!=="),NOT:new fe._Code("!"),OR:new fe._Code("||"),AND:new fe._Code("&&"),ADD:new fe._Code("+")};var Rn=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},H$=class extends Rn{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Dr.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=aa(this.rhs,e,r)),this}get names(){return this.rhs instanceof fe._CodeOrName?this.rhs.names:{}}},Jh=class extends Rn{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof fe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=aa(this.rhs,e,r),this}get names(){let e=this.lhs instanceof fe.Name?{}:{...this.lhs.names};return Yh(e,this.rhs)}},W$=class extends Jh{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},J$=class extends Rn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},G$=class extends Rn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Y$=class extends Rn{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},X$=class extends Rn{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=aa(this.code,e,r),this}get names(){return this.code instanceof fe._CodeOrName?this.code.names:{}}},bu=class extends Rn{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(mee(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xo(e,r.names),{})}},An=class extends bu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Q$=class extends bu{},ia=class extends An{};ia.kind="else";var $o=class t extends An{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ia(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(nD(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=aa(this.condition,e,r),this}get names(){let e=super.names;return Yh(e,this.condition),this.else&&xo(e,this.else.names),e}};$o.kind="if";var ko=class extends An{};ko.kind="for";var ek=class extends ko{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=aa(this.iteration,e,r),this}get names(){return xo(super.names,this.iteration.names)}},tk=class extends ko{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?Dr.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=Yh(super.names,this.from);return Yh(e,this.to)}},Gh=class extends ko{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=aa(this.iterable,e,r),this}get names(){return xo(super.names,this.iterable.names)}},Su=class extends An{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Su.kind="func";var $u=class extends bu{render(e){return"return "+super.render(e)}};$u.kind="return";var rk=class extends An{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&xo(e,this.catch.names),this.finally&&xo(e,this.finally.names),e}},ku=class extends An{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ku.kind="catch";var xu=class extends An{render(e){return"finally"+super.render(e)}};xu.kind="finally";var nk=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
302
|
+
`:""},this._extScope=e,this._scope=new Dr.Scope({parent:e}),this._nodes=[new Q$]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new H$(e,o,n)),o}const(e,r,n){return this._def(Dr.varKinds.const,e,r,n)}let(e,r,n){return this._def(Dr.varKinds.let,e,r,n)}var(e,r,n){return this._def(Dr.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Jh(e,r,n))}add(e,r){return this._leafNode(new W$(e,ne.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==fe.nil&&this._leafNode(new X$(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,fe.addCodeArg)(r,s));return r.push("}"),new fe._Code(r)}if(e,r,n){if(this._blockNode(new $o(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new $o(e))}else(){return this._elseNode(new ia)}endIf(){return this._endBlockNode($o,ia)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ek(e),r)}forRange(e,r,n,s,o=this.opts.es5?Dr.varKinds.var:Dr.varKinds.let){let i=this._scope.toName(e);return this._for(new tk(o,i,r,n),()=>s(i))}forOf(e,r,n,s=Dr.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let i=r instanceof fe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,fe._)`${i}.length`,a=>{this.var(o,(0,fe._)`${i}[${a}]`),n(o)})}return this._for(new Gh("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?Dr.varKinds.var:Dr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,fe._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new Gh("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(ko)}label(e){return this._leafNode(new J$(e))}break(e){return this._leafNode(new G$(e))}return(e){let r=new $u;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode($u)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new rk;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new ku(o),r(o)}return n&&(this._currNode=s.finally=new xu,this.code(n)),this._endBlockNode(ku,xu)}throw(e){return this._leafNode(new Y$(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=fe.nil,n,s){return this._blockNode(new Su(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Su)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof $o))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};ne.CodeGen=nk;function xo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Yh(t,e){return e instanceof fe._CodeOrName?xo(t,e.names):t}function aa(t,e,r){if(t instanceof fe.Name)return n(t);if(!s(t))return t;return new fe._Code(t._items.reduce((o,i)=>(i instanceof fe.Name&&(i=n(i)),i instanceof fe._Code?o.push(...i._items):o.push(i),o),[]));function n(o){let i=r[o.str];return i===void 0||e[o.str]!==1?o:(delete e[o.str],i)}function s(o){return o instanceof fe._Code&&o._items.some(i=>i instanceof fe.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function mee(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function nD(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,fe._)`!${sk(t)}`}ne.not=nD;var gee=sD(ne.operators.AND);function yee(...t){return t.reduce(gee)}ne.and=yee;var _ee=sD(ne.operators.OR);function vee(...t){return t.reduce(_ee)}ne.or=vee;function sD(t){return(e,r)=>e===fe.nil?r:r===fe.nil?e:(0,fe._)`${sk(e)} ${t} ${sk(r)}`}function sk(t){return t instanceof fe.Name?t:(0,fe._)`(${t})`}});var ge=_(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.checkStrictMode=ie.getErrorPath=ie.Type=ie.useFunc=ie.setEvaluated=ie.evaluatedPropsToName=ie.mergeEvaluated=ie.eachItem=ie.unescapeJsonPointer=ie.escapeJsonPointer=ie.escapeFragment=ie.unescapeFragment=ie.schemaRefOrVal=ie.schemaHasRulesButRef=ie.schemaHasRules=ie.checkUnknownRules=ie.alwaysValidSchema=ie.toHash=void 0;var Ce=ee(),wee=wu();function bee(t){let e={};for(let r of t)e[r]=!0;return e}ie.toHash=bee;function See(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(aD(t,e),!cD(e,t.self.RULES.all))}ie.alwaysValidSchema=See;function aD(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||dD(t,`unknown keyword: "${o}"`)}ie.checkUnknownRules=aD;function cD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ie.schemaHasRules=cD;function $ee(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ie.schemaHasRulesButRef=$ee;function kee({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ce._)`${r}`}return(0,Ce._)`${t}${e}${(0,Ce.getProperty)(n)}`}ie.schemaRefOrVal=kee;function xee(t){return lD(decodeURIComponent(t))}ie.unescapeFragment=xee;function Eee(t){return encodeURIComponent(ik(t))}ie.escapeFragment=Eee;function ik(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ie.escapeJsonPointer=ik;function lD(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ie.unescapeJsonPointer=lD;function Tee(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ie.eachItem=Tee;function oD({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof Ce.Name?(o instanceof Ce.Name?t(s,o,i):e(s,o,i),i):o instanceof Ce.Name?(e(s,i,o),o):r(o,i);return a===Ce.Name&&!(c instanceof Ce.Name)?n(s,c):c}}ie.mergeEvaluated={props:oD({mergeNames:(t,e,r)=>t.if((0,Ce._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ce._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ce._)`${r} || {}`).code((0,Ce._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ce._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ce._)`${r} || {}`),ak(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:uD}),items:oD({mergeNames:(t,e,r)=>t.if((0,Ce._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ce._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ce._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ce._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function uD(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ce._)`{}`);return e!==void 0&&ak(t,r,e),r}ie.evaluatedPropsToName=uD;function ak(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Ce._)`${e}${(0,Ce.getProperty)(n)}`,!0))}ie.setEvaluated=ak;var iD={};function Pee(t,e){return t.scopeValue("func",{ref:e,code:iD[e.code]||(iD[e.code]=new wee._Code(e.code))})}ie.useFunc=Pee;var ok;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(ok||(ie.Type=ok={}));function Oee(t,e,r){if(t instanceof Ce.Name){let n=e===ok.Num;return r?n?(0,Ce._)`"[" + ${t} + "]"`:(0,Ce._)`"['" + ${t} + "']"`:n?(0,Ce._)`"/" + ${t}`:(0,Ce._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ce.getProperty)(t).toString():"/"+ik(t)}ie.getErrorPath=Oee;function dD(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ie.checkStrictMode=dD});var zn=_(ck=>{"use strict";Object.defineProperty(ck,"__esModule",{value:!0});var _t=ee(),Iee={data:new _t.Name("data"),valCxt:new _t.Name("valCxt"),instancePath:new _t.Name("instancePath"),parentData:new _t.Name("parentData"),parentDataProperty:new _t.Name("parentDataProperty"),rootData:new _t.Name("rootData"),dynamicAnchors:new _t.Name("dynamicAnchors"),vErrors:new _t.Name("vErrors"),errors:new _t.Name("errors"),this:new _t.Name("this"),self:new _t.Name("self"),scope:new _t.Name("scope"),json:new _t.Name("json"),jsonPos:new _t.Name("jsonPos"),jsonLen:new _t.Name("jsonLen"),jsonPart:new _t.Name("jsonPart")};ck.default=Iee});var Eu=_(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.extendErrors=vt.resetErrorsCount=vt.reportExtraError=vt.reportError=vt.keyword$DataError=vt.keywordError=void 0;var ye=ee(),Qh=ge(),Pt=zn();vt.keywordError={message:({keyword:t})=>(0,ye.str)`must pass "${t}" keyword validation`};vt.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ye.str)`"${t}" keyword must be ${e} ($data)`:(0,ye.str)`"${t}" keyword is invalid ($data)`};function Nee(t,e=vt.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=hD(t,e,r);n??(i||a)?fD(o,c):pD(s,(0,ye._)`[${c}]`)}vt.reportError=Nee;function Cee(t,e=vt.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=hD(t,e,r);fD(s,a),o||i||pD(n,Pt.default.vErrors)}vt.reportExtraError=Cee;function Ree(t,e){t.assign(Pt.default.errors,e),t.if((0,ye._)`${Pt.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ye._)`${Pt.default.vErrors}.length`,e),()=>t.assign(Pt.default.vErrors,null)))}vt.resetErrorsCount=Ree;function Aee({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",s,Pt.default.errors,a=>{t.const(i,(0,ye._)`${Pt.default.vErrors}[${a}]`),t.if((0,ye._)`${i}.instancePath === undefined`,()=>t.assign((0,ye._)`${i}.instancePath`,(0,ye.strConcat)(Pt.default.instancePath,o.errorPath))),t.assign((0,ye._)`${i}.schemaPath`,(0,ye.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ye._)`${i}.schema`,r),t.assign((0,ye._)`${i}.data`,n))})}vt.extendErrors=Aee;function fD(t,e){let r=t.const("err",e);t.if((0,ye._)`${Pt.default.vErrors} === null`,()=>t.assign(Pt.default.vErrors,(0,ye._)`[${r}]`),(0,ye._)`${Pt.default.vErrors}.push(${r})`),t.code((0,ye._)`${Pt.default.errors}++`)}function pD(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,ye._)`new ${t.ValidationError}(${e})`):(r.assign((0,ye._)`${n}.errors`,e),r.return(!1))}var Eo={keyword:new ye.Name("keyword"),schemaPath:new ye.Name("schemaPath"),params:new ye.Name("params"),propertyName:new ye.Name("propertyName"),message:new ye.Name("message"),schema:new ye.Name("schema"),parentSchema:new ye.Name("parentSchema")};function hD(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ye._)`{}`:zee(t,e,r)}function zee(t,e,r={}){let{gen:n,it:s}=t,o=[jee(s,r),Mee(t,r)];return Lee(t,e,o),n.object(...o)}function jee({errorPath:t},{instancePath:e}){let r=e?(0,ye.str)`${t}${(0,Qh.getErrorPath)(e,Qh.Type.Str)}`:t;return[Pt.default.instancePath,(0,ye.strConcat)(Pt.default.instancePath,r)]}function Mee({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,ye.str)`${e}/${t}`;return r&&(s=(0,ye.str)`${s}${(0,Qh.getErrorPath)(r,Qh.Type.Str)}`),[Eo.schemaPath,s]}function Lee(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:i,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([Eo.keyword,s],[Eo.params,typeof e=="function"?e(t):e||(0,ye._)`{}`]),c.messages&&n.push([Eo.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Eo.schema,i],[Eo.parentSchema,(0,ye._)`${u}${d}`],[Pt.default.data,o]),l&&n.push([Eo.propertyName,l])}});var gD=_(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.boolOrEmptySchema=ca.topBoolOrEmptySchema=void 0;var Dee=Eu(),qee=ee(),Fee=zn(),Zee={message:"boolean schema is false"};function Uee(t){let{gen:e,schema:r,validateName:n}=t;r===!1?mD(t,!1):typeof r=="object"&&r.$async===!0?e.return(Fee.default.data):(e.assign((0,qee._)`${n}.errors`,null),e.return(!0))}ca.topBoolOrEmptySchema=Uee;function Vee(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),mD(t)):r.var(e,!0)}ca.boolOrEmptySchema=Vee;function mD(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Dee.reportError)(s,Zee,void 0,e)}});var lk=_(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.getRules=la.isJSONType=void 0;var Bee=["string","number","integer","boolean","null","object","array"],Kee=new Set(Bee);function Hee(t){return typeof t=="string"&&Kee.has(t)}la.isJSONType=Hee;function Wee(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}la.getRules=Wee});var uk=_(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.shouldUseRule=Ss.shouldUseGroup=Ss.schemaHasRulesForType=void 0;function Jee({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&yD(t,n)}Ss.schemaHasRulesForType=Jee;function yD(t,e){return e.rules.some(r=>_D(t,r))}Ss.shouldUseGroup=yD;function _D(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Ss.shouldUseRule=_D});var Tu=_(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.reportTypeError=wt.checkDataTypes=wt.checkDataType=wt.coerceAndCheckDataType=wt.getJSONTypes=wt.getSchemaTypes=wt.DataType=void 0;var Gee=lk(),Yee=uk(),Xee=Eu(),Q=ee(),vD=ge(),ua;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ua||(wt.DataType=ua={}));function Qee(t){let e=wD(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}wt.getSchemaTypes=Qee;function wD(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Gee.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}wt.getJSONTypes=wD;function ete(t,e){let{gen:r,data:n,opts:s}=t,o=tte(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,Yee.schemaHasRulesForType)(t,e[0]));if(i){let a=fk(e,n,s.strictNumbers,ua.Wrong);r.if(a,()=>{o.length?rte(t,e,o):pk(t)})}return i}wt.coerceAndCheckDataType=ete;var bD=new Set(["string","number","integer","boolean","null"]);function tte(t,e){return e?t.filter(r=>bD.has(r)||e==="array"&&r==="array"):[]}function rte(t,e,r){let{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,Q._)`typeof ${s}`),a=n.let("coerced",(0,Q._)`undefined`);o.coerceTypes==="array"&&n.if((0,Q._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,Q._)`${s}[0]`).assign(i,(0,Q._)`typeof ${s}`).if(fk(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,Q._)`${a} !== undefined`);for(let l of r)(bD.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);n.else(),pk(t),n.endIf(),n.if((0,Q._)`${a} !== undefined`,()=>{n.assign(s,a),nte(t,a)});function c(l){switch(l){case"string":n.elseIf((0,Q._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Q._)`"" + ${s}`).elseIf((0,Q._)`${s} === null`).assign(a,(0,Q._)`""`);return;case"number":n.elseIf((0,Q._)`${i} == "boolean" || ${s} === null
|
|
303
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,Q._)`+${s}`);return;case"integer":n.elseIf((0,Q._)`${i} === "boolean" || ${s} === null
|
|
304
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,Q._)`+${s}`);return;case"boolean":n.elseIf((0,Q._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,Q._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Q._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Q._)`${i} === "string" || ${i} === "number"
|
|
305
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,(0,Q._)`[${s}]`)}}}function nte({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,Q._)`${e} !== undefined`,()=>t.assign((0,Q._)`${e}[${r}]`,n))}function dk(t,e,r,n=ua.Correct){let s=n===ua.Correct?Q.operators.EQ:Q.operators.NEQ,o;switch(t){case"null":return(0,Q._)`${e} ${s} null`;case"array":o=(0,Q._)`Array.isArray(${e})`;break;case"object":o=(0,Q._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=i((0,Q._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=i();break;default:return(0,Q._)`typeof ${e} ${s} ${t}`}return n===ua.Correct?o:(0,Q.not)(o);function i(a=Q.nil){return(0,Q.and)((0,Q._)`typeof ${e} == "number"`,a,r?(0,Q._)`isFinite(${e})`:Q.nil)}}wt.checkDataType=dk;function fk(t,e,r,n){if(t.length===1)return dk(t[0],e,r,n);let s,o=(0,vD.toHash)(t);if(o.array&&o.object){let i=(0,Q._)`typeof ${e} != "object"`;s=o.null?i:(0,Q._)`!${e} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Q.nil;o.number&&delete o.integer;for(let i in o)s=(0,Q.and)(s,dk(i,e,r,n));return s}wt.checkDataTypes=fk;var ste={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Q._)`{type: ${t}}`:(0,Q._)`{type: ${e}}`};function pk(t){let e=ote(t);(0,Xee.reportError)(e,ste)}wt.reportTypeError=pk;function ote(t){let{gen:e,data:r,schema:n}=t,s=(0,vD.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}});var $D=_(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});em.assignDefaults=void 0;var da=ee(),ite=ge();function ate(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)SD(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>SD(t,o,s.default))}em.assignDefaults=ate;function SD(t,e,r){let{gen:n,compositeRule:s,data:o,opts:i}=t;if(r===void 0)return;let a=(0,da._)`${o}${(0,da.getProperty)(e)}`;if(s){(0,ite.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,da._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,da._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,da._)`${a} = ${(0,da.stringify)(r)}`)}});var yr=_(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.validateUnion=Te.validateArray=Te.usePattern=Te.callValidateCode=Te.schemaProperties=Te.allSchemaProperties=Te.noPropertyInData=Te.propertyInData=Te.isOwnProperty=Te.hasPropFunc=Te.reportMissingProp=Te.checkMissingProp=Te.checkReportMissingProp=void 0;var De=ee(),hk=ge(),$s=zn(),cte=ge();function lte(t,e){let{gen:r,data:n,it:s}=t;r.if(gk(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,De._)`${e}`},!0),t.error()})}Te.checkReportMissingProp=lte;function ute({gen:t,data:e,it:{opts:r}},n,s){return(0,De.or)(...n.map(o=>(0,De.and)(gk(t,e,o,r.ownProperties),(0,De._)`${s} = ${o}`)))}Te.checkMissingProp=ute;function dte(t,e){t.setParams({missingProperty:e},!0),t.error()}Te.reportMissingProp=dte;function kD(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,De._)`Object.prototype.hasOwnProperty`})}Te.hasPropFunc=kD;function mk(t,e,r){return(0,De._)`${kD(t)}.call(${e}, ${r})`}Te.isOwnProperty=mk;function fte(t,e,r,n){let s=(0,De._)`${e}${(0,De.getProperty)(r)} !== undefined`;return n?(0,De._)`${s} && ${mk(t,e,r)}`:s}Te.propertyInData=fte;function gk(t,e,r,n){let s=(0,De._)`${e}${(0,De.getProperty)(r)} === undefined`;return n?(0,De.or)(s,(0,De.not)(mk(t,e,r))):s}Te.noPropertyInData=gk;function xD(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Te.allSchemaProperties=xD;function pte(t,e){return xD(e).filter(r=>!(0,hk.alwaysValidSchema)(t,e[r]))}Te.schemaProperties=pte;function hte({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,l){let u=l?(0,De._)`${t}, ${e}, ${n}${s}`:e,d=[[$s.default.instancePath,(0,De.strConcat)($s.default.instancePath,o)],[$s.default.parentData,i.parentData],[$s.default.parentDataProperty,i.parentDataProperty],[$s.default.rootData,$s.default.rootData]];i.opts.dynamicRef&&d.push([$s.default.dynamicAnchors,$s.default.dynamicAnchors]);let f=(0,De._)`${u}, ${r.object(...d)}`;return c!==De.nil?(0,De._)`${a}.call(${c}, ${f})`:(0,De._)`${a}(${f})`}Te.callValidateCode=hte;var mte=(0,De._)`new RegExp`;function gte({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,o=s(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,De._)`${s.code==="new RegExp"?mte:(0,cte.useFunc)(t,s)}(${r}, ${n})`})}Te.usePattern=gte;function yte(t){let{gen:e,data:r,keyword:n,it:s}=t,o=e.name("valid");if(s.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(o,!0),i(()=>e.break()),o;function i(a){let c=e.const("len",(0,De._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:hk.Type.Num},o),e.if((0,De.not)(o),a)})}}Te.validateArray=yte;function _te(t){let{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,hk.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(i,(0,De._)`${i} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,De.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}Te.validateUnion=_te});var PD=_(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.validateKeywordUsage=cn.validSchemaType=cn.funcKeywordCode=cn.macroKeywordCode=void 0;var Ot=ee(),To=zn(),vte=yr(),wte=Eu();function bte(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=TD(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Ot.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}cn.macroKeywordCode=bte;function Ste(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;kte(c,e);let l=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,u=TD(n,s,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&ED(t),g(()=>t.error());else{let y=e.async?p():m();e.modifying&&ED(t),g(()=>$te(t,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,Ot._)`await `),w=>n.assign(d,!1).if((0,Ot._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Ot._)`${w}.errors`),()=>n.throw(w))),y}function m(){let y=(0,Ot._)`${u}.errors`;return n.assign(y,null),h(Ot.nil),y}function h(y=e.async?(0,Ot._)`await `:Ot.nil){let w=c.opts.passContext?To.default.this:To.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Ot._)`${y}${(0,vte.callValidateCode)(t,u,w,b)}`,e.modifying)}function g(y){var w;n.if((0,Ot.not)((w=e.valid)!==null&&w!==void 0?w:d),y)}}cn.funcKeywordCode=Ste;function ED(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ot._)`${n.parentData}[${n.parentDataProperty}]`))}function $te(t,e){let{gen:r}=t;r.if((0,Ot._)`Array.isArray(${e})`,()=>{r.assign(To.default.vErrors,(0,Ot._)`${To.default.vErrors} === null ? ${e} : ${To.default.vErrors}.concat(${e})`).assign(To.default.errors,(0,Ot._)`${To.default.vErrors}.length`),(0,wte.extendErrors)(t)},()=>t.error())}function kte({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function TD(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ot.stringify)(r)})}function xte(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}cn.validSchemaType=xte;function Ete({schema:t,opts:e,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let i=s.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}cn.validateKeywordUsage=Ete});var ID=_(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.extendSubschemaMode=ks.extendSubschemaData=ks.getSubschema=void 0;var ln=ee(),OD=ge();function Tte(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,ln._)`${t.schemaPath}${(0,ln.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,ln._)`${t.schemaPath}${(0,ln.getProperty)(e)}${(0,ln.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,OD.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}ks.getSubschema=Tte;function Pte(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,ln._)`${e.data}${(0,ln.getProperty)(r)}`,!0);c(f),t.errorPath=(0,ln.str)`${l}${(0,OD.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,ln._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(s!==void 0){let l=s instanceof ln.Name?s:a.let("data",s,!0);c(l),i!==void 0&&(t.propertyName=i)}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ks.extendSubschemaData=Pte;function Ote(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}ks.extendSubschemaMode=Ote});var CD=_((uwe,ND)=>{"use strict";var xs=ND.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};tm(e,n,s,t,"",t)};xs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};xs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xs.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 tm(t,e,r,n,s,o,i,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,o,i,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in xs.arrayKeywords)for(var f=0;f<d.length;f++)tm(t,e,r,d[f],s+"/"+u+"/"+f,o,s,u,n,f)}else if(u in xs.propsKeywords){if(d&&typeof d=="object")for(var p in d)tm(t,e,r,d[p],s+"/"+u+"/"+Ite(p),o,s,u,n,p)}else(u in xs.keywords||t.allKeys&&!(u in xs.skipKeywords))&&tm(t,e,r,d,s+"/"+u,o,s,u,n)}r(n,s,o,i,a,c,l)}}function Ite(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Pu=_(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getSchemaRefs=Bt.resolveUrl=Bt.normalizeId=Bt._getFullPath=Bt.getFullPath=Bt.inlineRef=void 0;var Nte=ge(),Cte=Ql(),Rte=CD(),Ate=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function zte(t,e=!0){return typeof t=="boolean"?!0:e===!0?!yk(t):e?RD(t)<=e:!1}Bt.inlineRef=zte;var jte=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function yk(t){for(let e in t){if(jte.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(yk)||typeof r=="object"&&yk(r))return!0}return!1}function RD(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Ate.has(r)&&(typeof t[r]=="object"&&(0,Nte.eachItem)(t[r],n=>e+=RD(n)),e===1/0))return 1/0}return e}function AD(t,e="",r){r!==!1&&(e=fa(e));let n=t.parse(e);return zD(t,n)}Bt.getFullPath=AD;function zD(t,e){return t.serialize(e).split("#")[0]+"#"}Bt._getFullPath=zD;var Mte=/#\/?$/;function fa(t){return t?t.replace(Mte,""):""}Bt.normalizeId=fa;function Lte(t,e,r){return r=fa(r),t.resolve(e,r)}Bt.resolveUrl=Lte;var Dte=/^[a-z_][-a-z0-9._]*$/i;function qte(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=fa(t[r]||e),o={"":s},i=AD(n,s,!1),a={},c=new Set;return Rte(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=i+f,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[f]=g;function y(b){let x=this.opts.uriResolver.resolve;if(b=fa(g?x(g,b):b),c.has(b))throw u(b);c.add(b);let v=this.refs[b];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,b):b!==fa(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function w(b){if(typeof b=="string"){if(!Dte.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),a;function l(d,f,p){if(f!==void 0&&!Cte(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Bt.getSchemaRefs=qte});var Nu=_(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.getData=Es.KeywordCxt=Es.validateFunctionCode=void 0;var qD=gD(),jD=Tu(),vk=uk(),rm=Tu(),Fte=$D(),Iu=PD(),_k=ID(),q=ee(),W=zn(),Zte=Pu(),jn=ge(),Ou=Eu();function Ute(t){if(UD(t)&&(VD(t),ZD(t))){Kte(t);return}FD(t,()=>(0,qD.topBoolOrEmptySchema)(t))}Es.validateFunctionCode=Ute;function FD({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},o){s.code.es5?t.func(e,(0,q._)`${W.default.data}, ${W.default.valCxt}`,n.$async,()=>{t.code((0,q._)`"use strict"; ${MD(r,s)}`),Bte(t,s),t.code(o)}):t.func(e,(0,q._)`${W.default.data}, ${Vte(s)}`,n.$async,()=>t.code(MD(r,s)).code(o))}function Vte(t){return(0,q._)`{${W.default.instancePath}="", ${W.default.parentData}, ${W.default.parentDataProperty}, ${W.default.rootData}=${W.default.data}${t.dynamicRef?(0,q._)`, ${W.default.dynamicAnchors}={}`:q.nil}}={}`}function Bte(t,e){t.if(W.default.valCxt,()=>{t.var(W.default.instancePath,(0,q._)`${W.default.valCxt}.${W.default.instancePath}`),t.var(W.default.parentData,(0,q._)`${W.default.valCxt}.${W.default.parentData}`),t.var(W.default.parentDataProperty,(0,q._)`${W.default.valCxt}.${W.default.parentDataProperty}`),t.var(W.default.rootData,(0,q._)`${W.default.valCxt}.${W.default.rootData}`),e.dynamicRef&&t.var(W.default.dynamicAnchors,(0,q._)`${W.default.valCxt}.${W.default.dynamicAnchors}`)},()=>{t.var(W.default.instancePath,(0,q._)`""`),t.var(W.default.parentData,(0,q._)`undefined`),t.var(W.default.parentDataProperty,(0,q._)`undefined`),t.var(W.default.rootData,W.default.data),e.dynamicRef&&t.var(W.default.dynamicAnchors,(0,q._)`{}`)})}function Kte(t){let{schema:e,opts:r,gen:n}=t;FD(t,()=>{r.$comment&&e.$comment&&KD(t),Yte(t),n.let(W.default.vErrors,null),n.let(W.default.errors,0),r.unevaluated&&Hte(t),BD(t),ere(t)})}function Hte(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,q._)`${r}.evaluated`),e.if((0,q._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,q._)`${t.evaluated}.props`,(0,q._)`undefined`)),e.if((0,q._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,q._)`${t.evaluated}.items`,(0,q._)`undefined`))}function MD(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function Wte(t,e){if(UD(t)&&(VD(t),ZD(t))){Jte(t,e);return}(0,qD.boolOrEmptySchema)(t,e)}function ZD({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function UD(t){return typeof t.schema!="boolean"}function Jte(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&KD(t),Xte(t),Qte(t);let o=n.const("_errs",W.default.errors);BD(t,o),n.var(e,(0,q._)`${o} === ${W.default.errors}`)}function VD(t){(0,jn.checkUnknownRules)(t),Gte(t)}function BD(t,e){if(t.opts.jtd)return LD(t,[],!1,e);let r=(0,jD.getSchemaTypes)(t.schema),n=(0,jD.coerceAndCheckDataType)(t,r);LD(t,r,!n,e)}function Gte(t){let{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,jn.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Yte(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,jn.checkStrictMode)(t,"default is ignored in the schema root")}function Xte(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Zte.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Qte(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function KD({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===!0)t.code((0,q._)`${W.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=(0,q.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,q._)`${W.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function ere(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=t;r.$async?e.if((0,q._)`${W.default.errors} === 0`,()=>e.return(W.default.data),()=>e.throw((0,q._)`new ${s}(${W.default.vErrors})`)):(e.assign((0,q._)`${n}.errors`,W.default.vErrors),o.unevaluated&&tre(t),e.return((0,q._)`${W.default.errors} === 0`))}function tre({gen:t,evaluated:e,props:r,items:n}){r instanceof q.Name&&t.assign((0,q._)`${e}.props`,r),n instanceof q.Name&&t.assign((0,q._)`${e}.items`,n)}function LD(t,e,r,n){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,jn.schemaHasRulesButRef)(o,u))){s.block(()=>WD(t,"$ref",u.all.$ref.definition));return}c.jtd||rre(t,e),s.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,vk.shouldUseGroup)(o,f)&&(f.type?(s.if((0,rm.checkDataType)(f.type,i,c.strictNumbers)),DD(t,f),e.length===1&&e[0]===f.type&&r&&(s.else(),(0,rm.reportTypeError)(t)),s.endIf()):DD(t,f),a||s.if((0,q._)`${W.default.errors} === ${n||0}`))}}function DD(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,Fte.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,vk.shouldUseRule)(n,o)&&WD(t,o.keyword,o.definition,e.type)})}function rre(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(nre(t,e),t.opts.allowUnionTypes||sre(t,e),ore(t,t.dataTypes))}function nre(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{HD(t.dataTypes,r)||wk(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),are(t,e)}}function sre(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&wk(t,"use allowUnionTypes to allow union type keyword")}function ore(t,e){let r=t.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0,vk.shouldUseRule)(t.schema,s)){let{type:o}=s.definition;o.length&&!o.some(i=>ire(e,i))&&wk(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function ire(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function HD(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function are(t,e){let r=[];for(let n of t.dataTypes)HD(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function wk(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,jn.checkStrictMode)(t,e,t.opts.strictTypes)}var nm=class{constructor(e,r,n){if((0,Iu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,jn.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",JD(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Iu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",W.default.errors))}result(e,r,n){this.failResult((0,q.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,q.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,q._)`${r} !== undefined && (${(0,q.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ou.reportExtraError:Ou.reportError)(this,this.def.error,r)}$dataError(){(0,Ou.reportError)(this,this.def.$dataError||Ou.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ou.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=q.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=q.nil,r=q.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,q.or)((0,q._)`${s} === undefined`,r)),e!==q.nil&&n.assign(e,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,q.or)(i(),a());function i(){if(n.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,q._)`${(0,rm.checkDataTypes)(c,r,o.opts.strictNumbers,rm.DataType.Wrong)}`}return q.nil}function a(){if(s.validateSchema){let c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,q._)`!${c}(${r})`}return q.nil}}subschema(e,r){let n=(0,_k.getSubschema)(this.it,e);(0,_k.extendSubschemaData)(n,this.it,e),(0,_k.extendSubschemaMode)(n,e);let s={...this.it,...n,items:void 0,props:void 0};return Wte(s,r),s}mergeEvaluated(e,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=jn.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=jn.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,q.Name)),!0}};Es.KeywordCxt=nm;function WD(t,e,r,n){let s=new nm(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Iu.funcKeywordCode)(s,r):"macro"in r?(0,Iu.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Iu.funcKeywordCode)(s,r)}var cre=/^\/(?:[^~]|~0|~1)*$/,lre=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function JD(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return W.default.rootData;if(t[0]==="/"){if(!cre.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=W.default.rootData}else{let l=lre.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(s=l[2],s==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!s)return o}let i=o,a=s.split("/");for(let l of a)l&&(o=(0,q._)`${o}${(0,q.getProperty)((0,jn.unescapeJsonPointer)(l))}`,i=(0,q._)`${i} && ${o}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Es.getData=JD});var sm=_(Sk=>{"use strict";Object.defineProperty(Sk,"__esModule",{value:!0});var bk=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Sk.default=bk});var Cu=_(xk=>{"use strict";Object.defineProperty(xk,"__esModule",{value:!0});var $k=Pu(),kk=class extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,$k.resolveUrl)(e,r,n),this.missingSchema=(0,$k.normalizeId)((0,$k.getFullPath)(e,this.missingRef))}};xk.default=kk});var im=_(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.resolveSchema=_r.getCompilingSchema=_r.resolveRef=_r.compileSchema=_r.SchemaEnv=void 0;var qr=ee(),ure=sm(),Po=zn(),Fr=Pu(),GD=ge(),dre=Nu(),pa=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Fr.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};_r.SchemaEnv=pa;function Tk(t){let e=YD.call(this,t);if(e)return e;let r=(0,Fr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new qr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:ure.default,code:(0,qr._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Po.default.data,parentData:Po.default.parentData,parentDataProperty:Po.default.parentDataProperty,dataNames:[Po.default.data],dataPathArr:[qr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,qr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:qr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,qr._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,dre.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(Po.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${Po.default.self}`,`${Po.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof qr.Name?void 0:m,items:h instanceof qr.Name?void 0:h,dynamicProps:m instanceof qr.Name,dynamicItems:h instanceof qr.Name},p.source&&(p.source.evaluated=(0,qr.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}_r.compileSchema=Tk;function fre(t,e,r){var n;r=(0,Fr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=mre.call(this,t,r);if(o===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new pa({schema:i,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=pre.call(this,o)}_r.resolveRef=fre;function pre(t){return(0,Fr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Tk.call(this,t)}function YD(t){for(let e of this._compilations)if(hre(e,t))return e}_r.getCompilingSchema=YD;function hre(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function mre(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||om.call(this,t,e)}function om(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Fr._getFullPath)(this.opts.uriResolver,r),s=(0,Fr.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return Ek.call(this,r,t);let o=(0,Fr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=om.call(this,t,i);return typeof a?.schema!="object"?void 0:Ek.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Tk.call(this,i),o===(0,Fr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(s=(0,Fr.resolveUrl)(this.opts.uriResolver,s,l)),new pa({schema:a,schemaId:c,root:t,baseId:s})}return Ek.call(this,r,i)}}_r.resolveSchema=om;var gre=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ek(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,GD.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!gre.has(a)&&l&&(e=(0,Fr.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,GD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=om.call(this,n,a)}let{schemaId:i}=this.opts;if(o=o||new pa({schema:r,schemaId:i,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var XD=_((gwe,yre)=>{yre.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var eq=_(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var QD=VS();QD.code='require("ajv/dist/runtime/uri").default';Pk.default=QD});var cq=_(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.CodeGen=ft.Name=ft.nil=ft.stringify=ft.str=ft._=ft.KeywordCxt=void 0;var _re=Nu();Object.defineProperty(ft,"KeywordCxt",{enumerable:!0,get:function(){return _re.KeywordCxt}});var ha=ee();Object.defineProperty(ft,"_",{enumerable:!0,get:function(){return ha._}});Object.defineProperty(ft,"str",{enumerable:!0,get:function(){return ha.str}});Object.defineProperty(ft,"stringify",{enumerable:!0,get:function(){return ha.stringify}});Object.defineProperty(ft,"nil",{enumerable:!0,get:function(){return ha.nil}});Object.defineProperty(ft,"Name",{enumerable:!0,get:function(){return ha.Name}});Object.defineProperty(ft,"CodeGen",{enumerable:!0,get:function(){return ha.CodeGen}});var vre=sm(),oq=Cu(),wre=lk(),Ru=im(),bre=ee(),Au=Pu(),am=Tu(),Ik=ge(),tq=XD(),Sre=eq(),iq=(t,e)=>new RegExp(t,e);iq.code="new RegExp";var $re=["removeAdditional","useDefaults","coerceTypes"],kre=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),xre={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},Ere={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rq=200;function Tre(t){var e,r,n,s,o,i,a,c,l,u,d,f,p,m,h,g,y,w,b,x,v,S,T,I,A;let U=t.strict,ae=(e=t.code)===null||e===void 0?void 0:e.optimize,J=ae===!0||ae===void 0?1:ae||0,Y=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:iq,Ht=(s=t.uriResolver)!==null&&s!==void 0?s:Sre.default;return{strictSchema:(i=(o=t.strictSchema)!==null&&o!==void 0?o:U)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:U)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:U)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:U)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:U)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:J,regExp:Y}:{optimize:J,regExp:Y},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:rq,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:rq,meta:(y=t.meta)!==null&&y!==void 0?y:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(x=t.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(v=t.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(S=t.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(T=t.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(I=t.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:Ht}}var zu=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Tre(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new bre.ValueScope({scope:{},prefixes:kre,es5:r,lines:n}),this.logger=Rre(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,wre.getRules)(),nq.call(this,xre,e,"NOT SUPPORTED"),nq.call(this,Ere,e,"DEPRECATED","warn"),this._metaOpts=Nre.call(this),e.formats&&Ore.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Ire.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Pre.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=tq;n==="id"&&(s={...tq},s.id=s.$id,delete s.$id),r&&e&&this.addMetaSchema(s,s[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let s=n(r);return"$async"in n||(this.errors=n.errors),s}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,e,r);async function s(u,d){await o.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||i.call(this,f)}async function o(u){u&&!this.getSchema(u)&&await s.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof oq.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,s);return this}let o;if(typeof e=="object"){let{schemaId:i}=this.opts;if(o=e[i],o!==void 0&&typeof o!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Au.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,s,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(n,e);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(e){let r;for(;typeof(r=sq.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Ru.SchemaEnv({schema:{},schemaId:n});if(r=Ru.resolveSchema.call(this,s,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=sq.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Au.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(zre.call(this,n,r),!r)return(0,Ik.eachItem)(n,o=>Ok.call(this,o)),this;Mre.call(this,r);let s={...r,type:(0,am.getJSONTypes)(r.type),schemaType:(0,am.getJSONTypes)(r.schemaType)};return(0,Ik.eachItem)(n,s.type.length===0?o=>Ok.call(this,o,s):o=>s.type.forEach(i=>Ok.call(this,o,s,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let s=n.rules.findIndex(o=>o.keyword===e);s>=0&&n.rules.splice(s,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let s of r){let o=s.split("/").slice(1),i=e;for(let a of o)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=aq(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let s=e[n];(!r||r.test(n))&&(typeof s=="string"?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Au.normalizeId)(i||n);let l=Au.getSchemaRefs.call(this,e,n);return c=new Ru.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Ru.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ru.compileSchema.call(this,e)}finally{this.opts=r}}};zu.ValidationError=vre.default;zu.MissingRefError=oq.default;ft.default=zu;function nq(t,e,r,n="error"){for(let s in t){let o=s;o in e&&this.logger[n](`${r}: option ${s}. ${t[o]}`)}}function sq(t){return t=(0,Au.normalizeId)(t),this.schemas[t]||this.refs[t]}function Pre(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Ore(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Ire(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Nre(){let t={...this.opts};for(let e of $re)delete t[e];return t}var Cre={log(){},warn(){},error(){}};function Rre(t){if(t===!1)return Cre;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Are=/^[a-z_$][a-z0-9_$:-]*$/i;function zre(t,e){let{RULES:r}=this;if((0,Ik.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Are.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ok(t,e,r){var n;let s=e?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},o.rules.push(i)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,am.getJSONTypes)(e.type),schemaType:(0,am.getJSONTypes)(e.schemaType)}};e.before?jre.call(this,i,a,e.before):i.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function jre(t,e,r){let n=t.rules.findIndex(s=>s.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Mre(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=aq(e)),t.validateSchema=this.compile(e,!0))}var Lre={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function aq(t){return{anyOf:[t,Lre]}}});var lq=_(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Dre={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Nk.default=Dre});var pq=_(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.callRef=Oo.getValidate=void 0;var qre=Cu(),uq=yr(),Kt=ee(),ma=zn(),dq=im(),cm=ge(),Fre={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:l}=o;if((r==="#"||r==="#/")&&s===l.baseId)return d();let u=dq.resolveRef.call(c,l,s,r);if(u===void 0)throw new qre.default(n.opts.uriResolver,s,r);if(u instanceof dq.SchemaEnv)return f(u);return p(u);function d(){if(o===l)return lm(t,i,o,o.$async);let m=e.scopeValue("root",{ref:l});return lm(t,(0,Kt._)`${m}.validate`,l,l.$async)}function f(m){let h=fq(t,m);lm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Kt.stringify)(m)}:{ref:m}),g=e.name("valid"),y=t.subschema({schema:m,dataTypes:[],schemaPath:Kt.nil,topSchemaRef:h,errSchemaPath:r},g);t.mergeEvaluated(y),t.ok(g)}}};function fq(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Kt._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Oo.getValidate=fq;function lm(t,e,r,n){let{gen:s,it:o}=t,{allErrors:i,schemaEnv:a,opts:c}=o,l=c.passContext?ma.default.this:Kt.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=s.let("valid");s.try(()=>{s.code((0,Kt._)`await ${(0,uq.callValidateCode)(t,e,l)}`),p(e),i||s.assign(m,!0)},h=>{s.if((0,Kt._)`!(${h} instanceof ${o.ValidationError})`,()=>s.throw(h)),f(h),i||s.assign(m,!1)}),t.ok(m)}function d(){t.result((0,uq.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Kt._)`${m}.errors`;s.assign(ma.default.vErrors,(0,Kt._)`${ma.default.vErrors} === null ? ${h} : ${ma.default.vErrors}.concat(${h})`),s.assign(ma.default.errors,(0,Kt._)`${ma.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=cm.mergeEvaluated.props(s,g.props,o.props));else{let y=s.var("props",(0,Kt._)`${m}.evaluated.props`);o.props=cm.mergeEvaluated.props(s,y,o.props,Kt.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=cm.mergeEvaluated.items(s,g.items,o.items));else{let y=s.var("items",(0,Kt._)`${m}.evaluated.items`);o.items=cm.mergeEvaluated.items(s,y,o.items,Kt.Name)}}}Oo.callRef=lm;Oo.default=Fre});var hq=_(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var Zre=lq(),Ure=pq(),Vre=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Zre.default,Ure.default];Ck.default=Vre});var mq=_(Rk=>{"use strict";Object.defineProperty(Rk,"__esModule",{value:!0});var um=ee(),Ts=um.operators,dm={maximum:{okStr:"<=",ok:Ts.LTE,fail:Ts.GT},minimum:{okStr:">=",ok:Ts.GTE,fail:Ts.LT},exclusiveMaximum:{okStr:"<",ok:Ts.LT,fail:Ts.GTE},exclusiveMinimum:{okStr:">",ok:Ts.GT,fail:Ts.LTE}},Bre={message:({keyword:t,schemaCode:e})=>(0,um.str)`must be ${dm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,um._)`{comparison: ${dm[t].okStr}, limit: ${e}}`},Kre={keyword:Object.keys(dm),type:"number",schemaType:"number",$data:!0,error:Bre,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,um._)`${r} ${dm[e].fail} ${n} || isNaN(${r})`)}};Rk.default=Kre});var gq=_(Ak=>{"use strict";Object.defineProperty(Ak,"__esModule",{value:!0});var ju=ee(),Hre={message:({schemaCode:t})=>(0,ju.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,ju._)`{multipleOf: ${t}}`},Wre={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Hre,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,ju._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,ju._)`${i} !== parseInt(${i})`;t.fail$data((0,ju._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ak.default=Wre});var _q=_(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function yq(t){let e=t.length,r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}zk.default=yq;yq.code='require("ajv/dist/runtime/ucs2length").default'});var vq=_(jk=>{"use strict";Object.defineProperty(jk,"__esModule",{value:!0});var Io=ee(),Jre=ge(),Gre=_q(),Yre={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Io.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Io._)`{limit: ${t}}`},Xre={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Yre,code(t){let{keyword:e,data:r,schemaCode:n,it:s}=t,o=e==="maxLength"?Io.operators.GT:Io.operators.LT,i=s.opts.unicode===!1?(0,Io._)`${r}.length`:(0,Io._)`${(0,Jre.useFunc)(t.gen,Gre.default)}(${r})`;t.fail$data((0,Io._)`${i} ${o} ${n}`)}};jk.default=Xre});var wq=_(Mk=>{"use strict";Object.defineProperty(Mk,"__esModule",{value:!0});var Qre=yr(),ene=ge(),ga=ee(),tne={message:({schemaCode:t})=>(0,ga.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ga._)`{pattern: ${t}}`},rne={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:tne,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,ga._)`new RegExp`:(0,ene.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,ga._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,ga._)`!${u}`)}else{let c=(0,Qre.usePattern)(t,s);t.fail$data((0,ga._)`!${c}.test(${r})`)}}};Mk.default=rne});var bq=_(Lk=>{"use strict";Object.defineProperty(Lk,"__esModule",{value:!0});var Mu=ee(),nne={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Mu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Mu._)`{limit: ${t}}`},sne={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:nne,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Mu.operators.GT:Mu.operators.LT;t.fail$data((0,Mu._)`Object.keys(${r}).length ${s} ${n}`)}};Lk.default=sne});var Sq=_(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var Lu=yr(),Du=ee(),one=ge(),ine={message:({params:{missingProperty:t}})=>(0,Du.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Du._)`{missingProperty: ${t}}`},ane={keyword:"required",type:"object",schemaType:"array",$data:!0,error:ine,code(t){let{gen:e,schema:r,schemaCode:n,data:s,$data:o,it:i}=t,{opts:a}=i;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,one.checkStrictMode)(i,y,i.opts.strictRequired)}}function l(){if(c||o)t.block$data(Du.nil,d);else for(let p of r)(0,Lu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||o){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,Lu.checkMissingProp)(t,r,p)),(0,Lu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,Lu.noPropertyInData)(e,s,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,Lu.propertyInData)(e,s,p,a.ownProperties)),e.if((0,Du.not)(m),()=>{t.error(),e.break()})},Du.nil)}}};Dk.default=ane});var $q=_(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});var qu=ee(),cne={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,qu.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,qu._)`{limit: ${t}}`},lne={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:cne,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?qu.operators.GT:qu.operators.LT;t.fail$data((0,qu._)`${r}.length ${s} ${n}`)}};qk.default=lne});var fm=_(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var kq=Ql();kq.code='require("ajv/dist/runtime/equal").default';Fk.default=kq});var xq=_(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var Zk=Tu(),pt=ee(),une=ge(),dne=fm(),fne={message:({params:{i:t,j:e}})=>(0,pt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,pt._)`{i: ${t}, j: ${e}}`},pne={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:fne,code(t){let{gen:e,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=t;if(!n&&!s)return;let c=e.let("valid"),l=o.items?(0,Zk.getSchemaTypes)(o.items):[];t.block$data(c,u,(0,pt._)`${i} === false`),t.ok(c);function u(){let m=e.let("i",(0,pt._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,pt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let g=e.name("item"),y=(0,Zk.checkDataTypes)(l,g,a.opts.strictNumbers,Zk.DataType.Wrong),w=e.const("indices",(0,pt._)`{}`);e.for((0,pt._)`;${m}--;`,()=>{e.let(g,(0,pt._)`${r}[${m}]`),e.if(y,(0,pt._)`continue`),l.length>1&&e.if((0,pt._)`typeof ${g} == "string"`,(0,pt._)`${g} += "_"`),e.if((0,pt._)`typeof ${w}[${g}] == "number"`,()=>{e.assign(h,(0,pt._)`${w}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,pt._)`${w}[${g}] = ${m}`)})}function p(m,h){let g=(0,une.useFunc)(e,dne.default),y=e.name("outer");e.label(y).for((0,pt._)`;${m}--;`,()=>e.for((0,pt._)`${h} = ${m}; ${h}--;`,()=>e.if((0,pt._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(y)})))}}};Uk.default=pne});var Eq=_(Bk=>{"use strict";Object.defineProperty(Bk,"__esModule",{value:!0});var Vk=ee(),hne=ge(),mne=fm(),gne={message:"must be equal to constant",params:({schemaCode:t})=>(0,Vk._)`{allowedValue: ${t}}`},yne={keyword:"const",$data:!0,error:gne,code(t){let{gen:e,data:r,$data:n,schemaCode:s,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,Vk._)`!${(0,hne.useFunc)(e,mne.default)}(${r}, ${s})`):t.fail((0,Vk._)`${o} !== ${r}`)}};Bk.default=yne});var Tq=_(Kk=>{"use strict";Object.defineProperty(Kk,"__esModule",{value:!0});var Fu=ee(),_ne=ge(),vne=fm(),wne={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Fu._)`{allowedValues: ${t}}`},bne={keyword:"enum",schemaType:"array",$data:!0,error:wne,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,_ne.useFunc)(e,vne.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(s))throw new Error("ajv implementation error");let p=e.const("vSchema",o);u=(0,Fu.or)(...s.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",o,p=>e.if((0,Fu._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=s[m];return typeof h=="object"&&h!==null?(0,Fu._)`${l()}(${r}, ${p}[${m}])`:(0,Fu._)`${r} === ${h}`}}};Kk.default=bne});var Pq=_(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});var Sne=mq(),$ne=gq(),kne=vq(),xne=wq(),Ene=bq(),Tne=Sq(),Pne=$q(),One=xq(),Ine=Eq(),Nne=Tq(),Cne=[Sne.default,$ne.default,kne.default,xne.default,Ene.default,Tne.default,Pne.default,One.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Ine.default,Nne.default];Hk.default=Cne});var Jk=_(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.validateAdditionalItems=void 0;var No=ee(),Wk=ge(),Rne={message:({params:{len:t}})=>(0,No.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,No._)`{limit: ${t}}`},Ane={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Rne,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Wk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Oq(t,n)}};function Oq(t,e){let{gen:r,schema:n,data:s,keyword:o,it:i}=t;i.items=!0;let a=r.const("len",(0,No._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,No._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Wk.alwaysValidSchema)(i,n)){let l=r.var("valid",(0,No._)`${a} <= ${e.length}`);r.if((0,No.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Wk.Type.Num},l),i.allErrors||r.if((0,No.not)(l),()=>r.break())})}}Zu.validateAdditionalItems=Oq;Zu.default=Ane});var Gk=_(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.validateTuple=void 0;var Iq=ee(),pm=ge(),zne=yr(),jne={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Nq(t,"additionalItems",e);r.items=!0,!(0,pm.alwaysValidSchema)(r,e)&&t.ok((0,zne.validateArray)(t))}};function Nq(t,e,r=t.schema){let{gen:n,parentSchema:s,data:o,keyword:i,it:a}=t;u(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=pm.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,Iq._)`${o}.length`);r.forEach((d,f)=>{(0,pm.alwaysValidSchema)(a,d)||(n.if((0,Iq._)`${l} > ${f}`,()=>t.subschema({keyword:i,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let g=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,pm.checkStrictMode)(a,g,f.strictTuples)}}}Uu.validateTuple=Nq;Uu.default=jne});var Cq=_(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var Mne=Gk(),Lne={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Mne.validateTuple)(t,"items")};Yk.default=Lne});var Aq=_(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var Rq=ee(),Dne=ge(),qne=yr(),Fne=Jk(),Zne={message:({params:{len:t}})=>(0,Rq.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Rq._)`{limit: ${t}}`},Une={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Zne,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,Dne.alwaysValidSchema)(n,e)&&(s?(0,Fne.validateAdditionalItems)(t,s):t.ok((0,qne.validateArray)(t)))}};Xk.default=Une});var zq=_(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var vr=ee(),hm=ge(),Vne={message:({params:{min:t,max:e}})=>e===void 0?(0,vr.str)`must contain at least ${t} valid item(s)`:(0,vr.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,vr._)`{minContains: ${t}}`:(0,vr._)`{minContains: ${t}, maxContains: ${e}}`},Bne={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Vne,code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t,i,a,{minContains:c,maxContains:l}=n;o.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=e.const("len",(0,vr._)`${s}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,hm.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,hm.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,hm.alwaysValidSchema)(o,r)){let h=(0,vr._)`${u} >= ${i}`;a!==void 0&&(h=(0,vr._)`${h} && ${u} <= ${a}`),t.pass(h);return}o.items=!0;let d=e.name("valid");a===void 0&&i===1?p(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,vr._)`${s}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),g=e.let("count",0);p(h,()=>e.if(h,()=>m(g)))}function p(h,g){e.forRange("i",0,u,y=>{t.subschema({keyword:"contains",dataProp:y,dataPropType:hm.Type.Num,compositeRule:!0},h),g()})}function m(h){e.code((0,vr._)`${h}++`),a===void 0?e.if((0,vr._)`${h} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,vr._)`${h} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,vr._)`${h} >= ${i}`,()=>e.assign(d,!0)))}}};Qk.default=Bne});var Lq=_(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateSchemaDeps=un.validatePropertyDeps=un.error=void 0;var ex=ee(),Kne=ge(),Vu=yr();un.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,ex.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,ex._)`{property: ${t},
|
|
306
|
+
missingProperty: ${n},
|
|
307
|
+
depsCount: ${e},
|
|
308
|
+
deps: ${r}}`};var Hne={keyword:"dependencies",type:"object",schemaType:"object",error:un.error,code(t){let[e,r]=Wne(t);jq(t,e),Mq(t,r)}};function Wne({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let s=Array.isArray(t[n])?e:r;s[n]=t[n]}return[e,r]}function jq(t,e=t.schema){let{gen:r,data:n,it:s}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,Vu.propertyInData)(r,n,i,s.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors?r.if(c,()=>{for(let l of a)(0,Vu.checkReportMissingProp)(t,l)}):(r.if((0,ex._)`${c} && (${(0,Vu.checkMissingProp)(t,a,o)})`),(0,Vu.reportMissingProp)(t,o),r.else())}}un.validatePropertyDeps=jq;function Mq(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,Kne.alwaysValidSchema)(o,e[a])||(r.if((0,Vu.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:s,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}un.validateSchemaDeps=Mq;un.default=Hne});var qq=_(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:!0});var Dq=ee(),Jne=ge(),Gne={message:"property name must be valid",params:({params:t})=>(0,Dq._)`{propertyName: ${t.propertyName}}`},Yne={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Gne,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,Jne.alwaysValidSchema)(s,r))return;let o=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),e.if((0,Dq.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};tx.default=Yne});var nx=_(rx=>{"use strict";Object.defineProperty(rx,"__esModule",{value:!0});var mm=yr(),Zr=ee(),Xne=zn(),gm=ge(),Qne={message:"must NOT have additional properties",params:({params:t})=>(0,Zr._)`{additionalProperty: ${t.additionalProperty}}`},ese={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Qne,code(t){let{gen:e,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,gm.alwaysValidSchema)(i,r))return;let l=(0,mm.allSchemaProperties)(n.properties),u=(0,mm.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Zr._)`${o} === ${Xne.default.errors}`);function d(){e.forIn("key",s,g=>{!l.length&&!u.length?m(g):e.if(f(g),()=>m(g))})}function f(g){let y;if(l.length>8){let w=(0,gm.schemaRefOrVal)(i,n.properties,"properties");y=(0,mm.isOwnProperty)(e,w,g)}else l.length?y=(0,Zr.or)(...l.map(w=>(0,Zr._)`${g} === ${w}`)):y=Zr.nil;return u.length&&(y=(0,Zr.or)(y,...u.map(w=>(0,Zr._)`${(0,mm.usePattern)(t,w)}.test(${g})`))),(0,Zr.not)(y)}function p(g){e.code((0,Zr._)`delete ${s}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,gm.alwaysValidSchema)(i,r)){let y=e.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),e.if((0,Zr.not)(y),()=>{t.reset(),p(g)})):(h(g,y),a||e.if((0,Zr.not)(y),()=>e.break()))}}function h(g,y,w){let b={keyword:"additionalProperties",dataProp:g,dataPropType:gm.Type.Str};w===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(b,y)}}};rx.default=ese});var Uq=_(ox=>{"use strict";Object.defineProperty(ox,"__esModule",{value:!0});var tse=Nu(),Fq=yr(),sx=ge(),Zq=nx(),rse={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Zq.default.code(new tse.KeywordCxt(o,Zq.default,"additionalProperties"));let i=(0,Fq.allSchemaProperties)(r);for(let d of i)o.definedProperties.add(d);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=sx.mergeEvaluated.props(e,(0,sx.toHash)(i),o.props));let a=i.filter(d=>!(0,sx.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,Fq.propertyInData)(e,s,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ox.default=rse});var Hq=_(ix=>{"use strict";Object.defineProperty(ix,"__esModule",{value:!0});var Vq=yr(),ym=ee(),Bq=ge(),Kq=ge(),nse={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:s,it:o}=t,{opts:i}=o,a=(0,Vq.allSchemaProperties)(r),c=a.filter(h=>(0,Bq.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=e.name("valid");o.props!==!0&&!(o.props instanceof ym.Name)&&(o.props=(0,Kq.evaluatedPropsToName)(e,o.props));let{props:d}=o;f();function f(){for(let h of a)l&&p(h),o.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,Bq.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,g=>{e.if((0,ym._)`${(0,Vq.usePattern)(t,h)}.test(${g})`,()=>{let y=c.includes(h);y||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:Kq.Type.Str},u),o.opts.unevaluated&&d!==!0?e.assign((0,ym._)`${d}[${g}]`,!0):!y&&!o.allErrors&&e.if((0,ym.not)(u),()=>e.break())})})}}};ix.default=nse});var Wq=_(ax=>{"use strict";Object.defineProperty(ax,"__esModule",{value:!0});var sse=ge(),ose={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,sse.alwaysValidSchema)(n,r)){t.fail();return}let s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ax.default=ose});var Jq=_(cx=>{"use strict";Object.defineProperty(cx,"__esModule",{value:!0});var ise=yr(),ase={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ise.validateUnion,error:{message:"must match a schema in anyOf"}};cx.default=ase});var Gq=_(lx=>{"use strict";Object.defineProperty(lx,"__esModule",{value:!0});var _m=ee(),cse=ge(),lse={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,_m._)`{passingSchemas: ${t.passing}}`},use={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lse,code(t){let{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(i,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((u,d)=>{let f;(0,cse.alwaysValidSchema)(s,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,_m._)`${c} && ${i}`).assign(i,!1).assign(a,(0,_m._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),f&&t.mergeEvaluated(f,_m.Name)})})}}};lx.default=use});var Yq=_(ux=>{"use strict";Object.defineProperty(ux,"__esModule",{value:!0});var dse=ge(),fse={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=e.name("valid");r.forEach((o,i)=>{if((0,dse.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};ux.default=fse});var e2=_(dx=>{"use strict";Object.defineProperty(dx,"__esModule",{value:!0});var vm=ee(),Qq=ge(),pse={message:({params:t})=>(0,vm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,vm._)`{failingKeyword: ${t.ifClause}}`},hse={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:pse,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Qq.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=Xq(n,"then"),o=Xq(n,"else");if(!s&&!o)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else s?e.if(a,l("then")):e.if((0,vm.not)(a),l("else"));t.pass(i,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(i,a),t.mergeValidEvaluated(f,i),d?e.assign(d,(0,vm._)`${u}`):t.setParams({ifClause:u})}}}};function Xq(t,e){let r=t.schema[e];return r!==void 0&&!(0,Qq.alwaysValidSchema)(t,r)}dx.default=hse});var t2=_(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:!0});var mse=ge(),gse={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,mse.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};fx.default=gse});var r2=_(px=>{"use strict";Object.defineProperty(px,"__esModule",{value:!0});var yse=Jk(),_se=Cq(),vse=Gk(),wse=Aq(),bse=zq(),Sse=Lq(),$se=qq(),kse=nx(),xse=Uq(),Ese=Hq(),Tse=Wq(),Pse=Jq(),Ose=Gq(),Ise=Yq(),Nse=e2(),Cse=t2();function Rse(t=!1){let e=[Tse.default,Pse.default,Ose.default,Ise.default,Nse.default,Cse.default,$se.default,kse.default,Sse.default,xse.default,Ese.default];return t?e.push(_se.default,wse.default):e.push(yse.default,vse.default),e.push(bse.default),e}px.default=Rse});var n2=_(hx=>{"use strict";Object.defineProperty(hx,"__esModule",{value:!0});var Ge=ee(),Ase={message:({schemaCode:t})=>(0,Ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Ge._)`{format: ${t}}`},zse={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Ase,code(t,e){let{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;s?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Ge._)`${m}[${i}]`),g=r.let("fType"),y=r.let("format");r.if((0,Ge._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Ge._)`${h}.type || "string"`).assign(y,(0,Ge._)`${h}.validate`),()=>r.assign(g,(0,Ge._)`"string"`).assign(y,h)),t.fail$data((0,Ge.or)(w(),b()));function w(){return c.strictSchema===!1?Ge.nil:(0,Ge._)`${i} && !${y}`}function b(){let x=u.$async?(0,Ge._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,Ge._)`${y}(${n})`,v=(0,Ge._)`(typeof ${y} == "function" ? ${x} : ${y}.test(${n}))`;return(0,Ge._)`${y} && ${y} !== true && ${g} === ${e} && !${v}`}}function p(){let m=d.formats[o];if(!m){w();return}if(m===!0)return;let[h,g,y]=b(m);h===e&&t.pass(x());function w(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function b(v){let S=v instanceof RegExp?(0,Ge.regexpCode)(v):c.code.formats?(0,Ge._)`${c.code.formats}${(0,Ge.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:v,code:S});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,Ge._)`${T}.validate`]:["string",v,T]}function x(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ge._)`await ${y}(${n})`}return typeof g=="function"?(0,Ge._)`${y}(${n})`:(0,Ge._)`${y}.test(${n})`}}}};hx.default=zse});var s2=_(mx=>{"use strict";Object.defineProperty(mx,"__esModule",{value:!0});var jse=n2(),Mse=[jse.default];mx.default=Mse});var o2=_(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.contentVocabulary=ya.metadataVocabulary=void 0;ya.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ya.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var a2=_(gx=>{"use strict";Object.defineProperty(gx,"__esModule",{value:!0});var Lse=hq(),Dse=Pq(),qse=r2(),Fse=s2(),i2=o2(),Zse=[Lse.default,Dse.default,(0,qse.default)(),Fse.default,i2.metadataVocabulary,i2.contentVocabulary];gx.default=Zse});var l2=_(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});wm.DiscrError=void 0;var c2;(function(t){t.Tag="tag",t.Mapping="mapping"})(c2||(wm.DiscrError=c2={}))});var d2=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:!0});var _a=ee(),yx=l2(),u2=im(),Use=Cu(),Vse=ge(),Bse={message:({params:{discrError:t,tagName:e}})=>t===yx.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,_a._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Kse={keyword:"discriminator",type:"object",schemaType:"object",error:Bse,code(t){let{gen:e,data:r,schema:n,parentSchema:s,it:o}=t,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,_a._)`${r}${(0,_a.getProperty)(a)}`);e.if((0,_a._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:yx.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,_a._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:yx.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,_a.Name),m}function f(){var p;let m={},h=y(s),g=!0;for(let x=0;x<i.length;x++){let v=i[x];if(v?.$ref&&!(0,Vse.schemaHasRulesButRef)(v,o.self.RULES)){let T=v.$ref;if(v=u2.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),v instanceof u2.SchemaEnv&&(v=v.schema),v===void 0)throw new Use.default(o.opts.uriResolver,o.baseId,T)}let S=(p=v?.properties)===null||p===void 0?void 0:p[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(v)),w(S,x)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:x}){return Array.isArray(x)&&x.includes(a)}function w(x,v){if(x.const)b(x.const,v);else if(x.enum)for(let S of x.enum)b(S,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(x,v){if(typeof x!="string"||x in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[x]=v}}}};_x.default=Kse});var f2=_((sbe,Hse)=>{Hse.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 h2=_((qe,vx)=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.MissingRefError=qe.ValidationError=qe.CodeGen=qe.Name=qe.nil=qe.stringify=qe.str=qe._=qe.KeywordCxt=qe.Ajv=void 0;var Wse=cq(),Jse=a2(),Gse=d2(),p2=f2(),Yse=["/properties"],bm="http://json-schema.org/draft-07/schema",va=class extends Wse.default{_addVocabularies(){super._addVocabularies(),Jse.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Gse.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(p2,Yse):p2;this.addMetaSchema(e,bm,!1),this.refs["http://json-schema.org/schema"]=bm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(bm)?bm:void 0)}};qe.Ajv=va;vx.exports=qe=va;vx.exports.Ajv=va;Object.defineProperty(qe,"__esModule",{value:!0});qe.default=va;var Xse=Nu();Object.defineProperty(qe,"KeywordCxt",{enumerable:!0,get:function(){return Xse.KeywordCxt}});var wa=ee();Object.defineProperty(qe,"_",{enumerable:!0,get:function(){return wa._}});Object.defineProperty(qe,"str",{enumerable:!0,get:function(){return wa.str}});Object.defineProperty(qe,"stringify",{enumerable:!0,get:function(){return wa.stringify}});Object.defineProperty(qe,"nil",{enumerable:!0,get:function(){return wa.nil}});Object.defineProperty(qe,"Name",{enumerable:!0,get:function(){return wa.Name}});Object.defineProperty(qe,"CodeGen",{enumerable:!0,get:function(){return wa.CodeGen}});var Qse=sm();Object.defineProperty(qe,"ValidationError",{enumerable:!0,get:function(){return Qse.default}});var eoe=Cu();Object.defineProperty(qe,"MissingRefError",{enumerable:!0,get:function(){return eoe.default}})});var m2=_(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.formatLimitDefinition=void 0;var toe=h2(),Ur=ee(),Ps=Ur.operators,Sm={formatMaximum:{okStr:"<=",ok:Ps.LTE,fail:Ps.GT},formatMinimum:{okStr:">=",ok:Ps.GTE,fail:Ps.LT},formatExclusiveMaximum:{okStr:"<",ok:Ps.LT,fail:Ps.GTE},formatExclusiveMinimum:{okStr:">",ok:Ps.GT,fail:Ps.LTE}},roe={message:({keyword:t,schemaCode:e})=>(0,Ur.str)`should be ${Sm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ur._)`{comparison: ${Sm[t].okStr}, limit: ${e}}`};ba.formatLimitDefinition={keyword:Object.keys(Sm),type:"string",schemaType:"string",$data:!0,error:roe,code(t){let{gen:e,data:r,schemaCode:n,keyword:s,it:o}=t,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new toe.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let f=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=e.const("fmt",(0,Ur._)`${f}[${c.schemaCode}]`);t.fail$data((0,Ur.or)((0,Ur._)`typeof ${p} != "object"`,(0,Ur._)`${p} instanceof RegExp`,(0,Ur._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${s}": format "${f}" does not define "compare" function`);let m=e.scopeValue("formats",{key:f,ref:p,code:i.code.formats?(0,Ur._)`${i.code.formats}${(0,Ur.getProperty)(f)}`:void 0});t.fail$data(d(m))}function d(f){return(0,Ur._)`${f}.compare(${r}, ${n}) ${Sm[s].fail} 0`}},dependencies:["format"]};var noe=t=>(t.addKeyword(ba.formatLimitDefinition),t);ba.default=noe});var v2=_((Bu,_2)=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});var Sa=eD(),soe=m2(),wx=ee(),g2=new wx.Name("fullFormats"),ooe=new wx.Name("fastFormats"),bx=(t,e={keywords:!0})=>{if(Array.isArray(e))return y2(t,e,Sa.fullFormats,g2),t;let[r,n]=e.mode==="fast"?[Sa.fastFormats,ooe]:[Sa.fullFormats,g2],s=e.formats||Sa.formatNames;return y2(t,s,r,n),e.keywords&&(0,soe.default)(t),t};bx.get=(t,e="full")=>{let n=(e==="fast"?Sa.fastFormats:Sa.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function y2(t,e,r,n){var s,o;(s=(o=t.opts.code).formats)!==null&&s!==void 0||(o.formats=(0,wx._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}_2.exports=Bu=bx;Object.defineProperty(Bu,"__esModule",{value:!0});Bu.default=bx});function ioe(){let t=new w2.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,b2.default)(t),t}var w2,b2,$m,S2=$(()=>{w2=Fe(KL(),1),b2=Fe(v2(),1);$m=class{constructor(e){this._ajv=e??ioe()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var km,$2=$(()=>{lo();km=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],o=Array.isArray(s.content)?s.content:[s.content],i=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(u.size!==d.size||![...u].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Ui,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),s=e.mode??"form";switch(s){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=s==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},co,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}}});function k2(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function x2(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var E2=$(()=>{});var T2={};We(T2,{Server:()=>Ku});var Ku,Sx=$(()=>{mj();lo();S2();pl();$2();E2();Ku=class extends fh{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Zi.options.map((n,s)=>[n,s])),this.isMessageIgnored=(n,s)=>{let o=this._loggingLevels.get(s);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new $m,this.setRequestHandler(kl,n=>this._oninitialize(n)),this.setNotificationHandler(xl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Qp,async(n,s)=>{let o=s.sessionId||s.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=Zi.safeParse(i);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new km(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=hj(this._capabilities,e)}setRequestHandler(e,r){let s=ds(e)?.method;if(!s)throw new Error("Schema is missing a method literal");let o=Ai(s);if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,l)=>{let u=us(ao,c);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new j(F.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,f=await Promise.resolve(r(c,l));if(d.task){let m=us(oo,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new j(F.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=us(ql,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new j(F.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){x2(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&k2(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Jb.includes(r)?r:Vp,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Sl)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],o=s.some(l=>l.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(l=>l.type==="tool_use");if(o){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},eh,r):this.request({method:"sampling/createMessage",params:e},Ui,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let s=e;return this.request({method:"elicitation/create",params:s},co,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let s=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:s},co,r);if(o.action==="accept"&&o.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(o.content);if(!a.valid)throw new j(F.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof j?i:new j(F.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},th,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}});function coe(t){return n0.parse(JSON.parse(t))}function P2(t){return JSON.stringify(t)+`
|
|
309
|
+
`}var aoe,xm,O2=$(()=>{lo();aoe=10*1024*1024,xm=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??aoe}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
310
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),coe(r)}clear(){this._buffer=void 0}}});var kx={};We(kx,{StdioServerTransport:()=>$x});import I2 from"node:process";var $x,xx=$(()=>{O2();$x=class{constructor(e=I2.stdin,r=I2.stdout,n){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=s=>{try{this._readBuffer.append(s),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=s=>{this.onerror?.(s)},this._readBuffer=new xm({maxBufferSize:n?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=P2(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}}});var C2={};We(C2,{runMcpWorkspace:()=>uoe});import{randomUUID as loe}from"node:crypto";import{resolve as N2}from"node:path";var Ex,uoe,doe,R2=$(()=>{"use strict";lt();xr();ar();xN();F_();Ex=t=>{process.stderr.write(`[pix3 mcp] ${t}
|
|
311
|
+
`)},uoe=async t=>{let e=t.projectDir?N2(t.cwd,t.projectDir):Xe(t.cwd)??N2(t.cwd),[{Server:r},{StdioServerTransport:n},s]=await Promise.all([Promise.resolve().then(()=>(Sx(),T2)),Promise.resolve().then(()=>(xx(),kx)),Promise.resolve().then(()=>(lo(),Nz))]),o=new r({name:"pix3",version:be},{capabilities:{tools:{listChanged:!0}},instructions:"Pix3 editor tools for this project folder (run, observe, generate; no scene editing \u2014 edit the files). Pass `expect` {path: sha256 of the bytes you wrote} to play_start / play_restart / game_run so the run is verified against your writes."}),i=loe(),a=new Uf(e,()=>({name:o.getClientVersion()?.name??t.agent??null,session:i})),c=new Bf(a,{log:Ex}),l=!1;o.setRequestHandler(s.ListToolsRequestSchema,async()=>{let g=await c.list();return l=c.hasAdvertisedTools(),{tools:g.map(y=>({...y,inputSchema:{type:"object",...y.inputSchema}}))}}),o.setRequestHandler(s.CallToolRequestSchema,async g=>{let y=g.params.arguments??{},w=await c.call(g.params.name,y);return l||c.list().then(()=>{c.hasAdvertisedTools()&&!l&&(l=!0,o.sendToolListChanged().catch(()=>{}))}),w});try{let g=await a.status();Ex(`workspace server ${g.root} (session ${g.serverSession.slice(0,8)}, editor ${g.holder??"not connected"})`)}catch(g){Ex(g instanceof Yt?g.message:`workspace server check failed: ${g instanceof Error?g.message:String(g)}`)}let u=doe(),d=()=>{a.presence().catch(()=>{})},f=setInterval(d,u);f.unref();let p=!1,m=async()=>{p||(p=!0,clearInterval(f),await a.presence(!0,1e3).catch(()=>{}),await o.close().catch(()=>{}),process.exit(0))};process.on("SIGINT",()=>{m()}),process.on("SIGTERM",()=>{m()}),process.stdin.on("end",()=>{m()});let h=new n;h.onclose=()=>{m()},o.oninitialized=d,await o.connect(h),d()},doe=()=>{let t=Number(process.env.PIX3_PRESENCE_HEARTBEAT_MS);return Number.isFinite(t)&&t>=50?t:cN}});import{randomUUID as foe}from"node:crypto";var Em,Hu,Wu,Tx,Tm,poe,$a,Ju=$(()=>{"use strict";Em=(t,e=!1)=>({content:[{type:"text",text:t}],...e?{isError:!0}:{}}),Hu=(t,e)=>({content:[{type:"text",text:e}],isError:!0,relayFailure:t}),Wu=t=>t.content.flatMap(e=>e.type==="text"?[e.text]:[]).join(`
|
|
312
|
+
`),Tx=t=>!!t&&typeof t=="object"&&!Array.isArray(t),Tm=t=>{if(!Tx(t)||!Array.isArray(t.content))return null;let e=[];for(let r of t.content){if(!Tx(r))return null;if(r.type==="text"&&typeof r.text=="string")e.push({type:"text",text:r.text});else if(r.type==="image"&&typeof r.data=="string"&&typeof r.mimeType=="string")e.push({type:"image",data:r.data,mimeType:r.mimeType});else return null}return{content:e,...t.isError===!0?{isError:!0}:{},...Tx(t._meta)?{_meta:t._meta}:{}}},poe=64,$a=class{parked=new Map;onPark=null;setParkListener(e){this.onPark=e}park(e,r,n,s){if(this.parked.size>=poe)return Promise.resolve(Hu("overloaded","Too many editor calls are already in flight."));let o=`call_${foe().replace(/-/g,"").slice(0,24)}`;return new Promise(i=>{let a=setTimeout(()=>{this.parked.delete(o)&&i(Hu("timeout",`The Pix3 editor did not answer "${e}" within ${Math.round(n/1e3)} s.`))},n);this.parked.set(o,{id:o,name:e,input:r,...s?{extra:s}:{},resolve:i,timer:a,flushed:!1}),this.onPark?.()})}hasUnflushed(){for(let e of this.parked.values())if(!e.flushed)return!0;return!1}takeUnflushed(){let e=[];for(let r of this.parked.values())r.flushed||(r.flushed=!0,e.push({id:r.id,name:r.name,input:r.input,...r.extra?{extra:r.extra}:{}}));return e}requeueDelivered(){for(let e of this.parked.values())e.flushed=!1}resolve(e,r){let n=this.parked.get(e);return n?(this.parked.delete(e),clearTimeout(n.timer),n.resolve(r),!0):!1}cancelAll(e){for(let r of[...this.parked.values()])this.resolve(r.id,Hu("cancelled",e))}get size(){return this.parked.size}}});import{randomBytes as A2,randomUUID as z2}from"node:crypto";import{mkdirSync as moe,rmSync as Px,writeFileSync as goe}from"node:fs";import{createServer as yoe}from"node:http";import{join as j2}from"node:path";var _oe,voe,Pm,M2=$(()=>{"use strict";Ju();lt();xr();xc();ar();_oe=16,voe=32,Pm=class{sessionId=z2();projectDir;relay=new $a;claims=new Map;endedLeases=new Map;options;claimTtlMs;leaseTtlMs;pollTimeoutMs;server=null;boundPort=null;lease=null;waiter=null;lastBrowserHelloAt=null;lastFailedClaimAt=null;constructor(e){this.options=e,this.projectDir=e.projectDir,this.claimTtlMs=e.claimTtlMs??rN,this.leaseTtlMs=e.leaseTtlMs??nN,this.pollTimeoutMs=e.pollTimeoutMs??sN,this.relay.setParkListener(()=>this.flushToWaiter())}get port(){return this.boundPort}async start(){let e=this.options.ports??P_,r=null;for(let n of e){let s=yoe((i,a)=>{this.handle(i,a)});try{await new Promise((i,a)=>{s.once("error",a),s.listen(n,Jt,()=>{s.off("error",a),i()})})}catch(i){r=i;continue}let o=s.address();return this.server=s,this.boundPort=typeof o=="object"&&o?o.port:n,this.boundPort}throw new Error(`No free port for the Pix3 link server in ${e.join(", ")}`+(r instanceof Error?` (${r.message})`:"")+". Another `pix3 mcp` per port is running \u2014 close one of them.")}async close(){for(let r of this.claims.values())clearTimeout(r.timer),Px(r.file,{force:!0});this.claims.clear(),this.relay.cancelAll("The Pix3 link server is shutting down."),this.waiter&&this.answerWaiter([]);let e=this.server;this.server=null,this.boundPort=null,e&&(e.closeAllConnections(),await new Promise(r=>e.close(()=>r())))}status(){return{port:this.boundPort,sessionId:this.sessionId,projectId:Fs(this.projectDir),leased:this.currentLease()!==null,lastBrowserHelloAt:this.lastBrowserHelloAt,lastFailedClaimAt:this.lastFailedClaimAt}}isLeased(){return this.currentLease()!==null}callEditor(e,r,n=si){return this.isLeased()?this.relay.park(e,r,n):Promise.resolve(Em("No Pix3 editor window is connected.",!0))}currentLease(){let e=this.lease;return e?!(this.waiter?.leaseId===e.leaseId)&&Date.now()-e.lastSeen>this.leaseTtlMs?(this.dropLease("expired"),null):e:null}dropLease(e){let r=this.lease;if(r){if(this.options.log?.(`lease ${r.leaseId.slice(0,8)} ${e}`),this.lease=null,this.rememberEnded(r.leaseId,e),this.waiter?.leaseId===r.leaseId){let n=this.waiter;this.clearWaiter(),this.send(n.res,409,{error:"lease_lost",reason:e,message:"Lease lost."},n.origin)}this.relay.requeueDelivered()}}rememberEnded(e,r){if(this.endedLeases.set(e,r),this.endedLeases.size>voe){let n=this.endedLeases.keys().next().value;n!==void 0&&this.endedLeases.delete(n)}}grantLease(){let e={leaseId:z2(),lastSeen:Date.now()};return this.lease=e,this.options.log?.(`lease ${e.leaseId.slice(0,8)} granted`),e}requireLease(e){let r=this.currentLease();if(r&&r.leaseId===e)return r;let n=this.endedLeases.get(e)??"unknown";throw new M(409,"lease_lost","This window does not hold the lease.",{reason:n})}clearWaiter(){this.waiter&&(clearTimeout(this.waiter.timer),this.waiter=null)}answerWaiter(e){let r=this.waiter;r&&(this.clearWaiter(),this.lease?.leaseId===r.leaseId&&(this.lease.lastSeen=Date.now()),this.send(r.res,200,{calls:e},r.origin))}flushToWaiter(){this.waiter&&this.relay.hasUnflushed()&&this.answerWaiter(this.relay.takeUnflushed())}createClaim(){if(this.claims.size>=_oe)throw new M(429,"too_many_claims","Too many pending claims.");let e=`claim-${A2(12).toString("hex")}`,r=`${O_}/${e}`,n=j2(this.projectDir,...r.split("/")),s=A2(32).toString("hex");moe(j2(this.projectDir,...O_.split("/")),{recursive:!0}),goe(n,s+`
|
|
313
|
+
`,{mode:384});let o=setTimeout(()=>{this.claims.delete(s)&&(Px(n,{force:!0}),this.lastFailedClaimAt=Date.now())},this.claimTtlMs);return o.unref(),this.claims.set(s,{nonce:s,file:n,timer:o}),r}consumeNonce(e){let r=typeof e.nonce=="string"?e.nonce.trim():"",n=r?this.claims.get(r):void 0;if(!n)throw this.lastFailedClaimAt=Date.now(),new M(403,"bad_nonce","Nonce does not match a pending claim \u2014 the window has a different folder open, or the claim expired.");this.claims.delete(r),clearTimeout(n.timer),Px(n.file,{force:!0})}leaseReply(e){return{leaseId:e.leaseId,sessionId:this.sessionId,leaseTtlMs:this.leaseTtlMs,pollTimeoutMs:this.pollTimeoutMs}}send(e,r,n,s){Gt(e,r,n,s)}hostAllowed(e){return this.boundPort!==null&&oi(e.headers.host)}async handle(e,r){let n=e.headers.origin,s=typeof n=="string"?n:null;try{if(!this.hostAllowed(e))throw new M(403,"forbidden_host","Forbidden host.");if(!ii(s)){this.options.log?.(`403 origin ${s}`),this.send(r,403,{error:"forbidden_origin",message:"Origin not allowed."},null);return}await this.route(e,r,s)}catch(o){if(o instanceof M){this.send(r,o.status,{error:o.code,message:o.message,...o.extra},o.code==="forbidden_host"?null:s);return}this.options.log?.(`500 ${String(o)}`),this.send(r,500,{error:"internal",message:"Internal error."},s)}}async route(e,r,n){let s=new URL(e.url??"/","http://127.0.0.1"),o=s.pathname,i=e.method??"GET";if(i==="OPTIONS"){let c={"Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"content-type","Access-Control-Max-Age":"600","Cache-Control":"no-store"};n&&(c["Access-Control-Allow-Origin"]=n,c.Vary="Origin"),e.headers["access-control-request-private-network"]==="true"&&(c["Access-Control-Allow-Private-Network"]="true"),r.writeHead(204,c),r.end();return}if(i==="GET"&&o==="/hello"){n&&(this.lastBrowserHelloAt=Date.now());let c=this.options.agent?.()??null;this.send(r,200,{projectId:Fs(this.projectDir),sessionId:this.sessionId,protocol:1,cliVersion:be,agent:c?{name:c,verified:!1}:null,pid:process.pid},n);return}if(i==="POST"&&o==="/claim"){await R_(e),this.send(r,200,{file:this.createClaim()},n);return}if(i==="POST"&&(o==="/claim/confirm"||o==="/claim/takeover")){let c=await Jr(e);if(this.consumeNonce(c),o==="/claim/confirm"){if(this.currentLease())throw new M(409,"busy","Another Pix3 window already serves this agent session.",{sessionId:this.sessionId})}else this.currentLease()&&this.dropLease("taken_over");this.send(r,200,this.leaseReply(this.grantLease()),n);return}if(i==="GET"&&o==="/calls"){let c=this.requireLease(s.searchParams.get("lease")??"");if(c.lastSeen=Date.now(),this.waiter&&this.answerWaiter([]),this.relay.hasUnflushed()){this.send(r,200,{calls:this.relay.takeUnflushed()},n);return}let l=setTimeout(()=>{this.waiter?.res===r&&this.answerWaiter([])},this.pollTimeoutMs);this.waiter={leaseId:c.leaseId,res:r,timer:l,origin:n},r.on("close",()=>{this.waiter?.res===r&&(this.clearWaiter(),this.lease?.leaseId===c.leaseId&&(this.lease.lastSeen=Date.now()))});return}let a=/^\/calls\/([A-Za-z0-9_-]+)$/.exec(o);if(i==="POST"&&a){let c=await Jr(e),l=this.requireLease(typeof c.lease=="string"?c.lease:"");l.lastSeen=Date.now();let u=Tm(c.result);if(!u)throw new M(400,"bad_result",'`result` must be { content: [{ type: "text", text }], isError? }.');if(!this.relay.resolve(a[1],u))throw new M(404,"unknown_call","No pending call with that id.");this.send(r,200,{ok:!0},n);return}throw new M(404,"not_found","Not found.")}}});function Ox(t){return!!t&&typeof t=="object"&&D2 in t}function q2(t){return t[D2]?.complete}var D2,L2,F2=$(()=>{D2=Symbol.for("mcp.completable");(function(t){t.Completable="McpCompletable"})(L2||(L2={}))});var Om,Z2=$(()=>{Om=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,n){if(e.length>r)throw new Error(`${n} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let r=[],n="",s=0,o=0;for(;s<e.length;)if(e[s]==="{"){n&&(r.push(n),n="");let i=e.indexOf("}",s);if(i===-1)throw new Error("Unclosed template expression");if(o++,o>1e4)throw new Error("Template contains too many expressions (max 10000)");let a=e.slice(s+1,i),c=this.getOperator(a),l=a.includes("*"),u=this.getNames(a),d=u[0];for(let f of u)t.validateLength(f,1e6,"Variable name");r.push({name:d,operator:c,names:u,exploded:l}),s=i+1}else n+=e[s],s++;return n&&r.push(n),r}getOperator(e){return["+","#",".","/","?","&"].find(n=>e.startsWith(n))||""}getNames(e){let r=this.getOperator(e);return e.slice(r.length).split(",").map(n=>n.replace("*","").trim()).filter(n=>n.length>0)}encodeValue(e,r){return t.validateLength(e,1e6,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){let i=e.names.map(c=>{let l=r[c];if(l===void 0)return"";let u=Array.isArray(l)?l.map(d=>this.encodeValue(d,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${c}=${u}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){let i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let n=r[e.name];if(n===void 0)return"";let o=(Array.isArray(n)?n:[n]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return o.join(",");case"+":return o.join(",");case"#":return"#"+o.join(",");case".":return"."+o.join(".");case"/":return"/"+o.join("/");default:return o.join(",")}}expand(e){let r="",n=!1;for(let s of this.parts){if(typeof s=="string"){r+=s;continue}let o=this.expandPart(s,e);o&&((s.operator==="?"||s.operator==="&")&&n?r+=o.replace("?","&"):r+=o,(s.operator==="?"||s.operator==="&")&&(n=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let r=[];for(let o of e.names)t.validateLength(o,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let o=0;o<e.names.length;o++){let i=e.names[o],a=o===0?"\\"+e.operator:"&";r.push({pattern:a+this.escapeRegExp(i)+"=([^&]+)",name:i})}return r}let n,s=e.name;switch(e.operator){case"":n=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":n="(.+)";break;case".":n="\\.([^/,]+)";break;case"/":n="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:n="([^/]+)"}return r.push({pattern:n,name:s}),r}match(e){t.validateLength(e,1e6,"URI");let r="^",n=[];for(let a of this.parts)if(typeof a=="string")r+=this.escapeRegExp(a);else{let c=this.partToRegExp(a);for(let{pattern:l,name:u}of c)r+=l,n.push({name:u,exploded:a.exploded})}r+="$",t.validateLength(r,1e6,"Generated regex pattern");let s=new RegExp(r),o=e.match(s);if(!o)return null;let i={};for(let a=0;a<n.length;a++){let{name:c,exploded:l}=n[a],u=o[a+1],d=c.replace("*","");l&&u.includes(",")?i[d]=u.split(","):i[d]=u}return i}}});function boe(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!woe.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,o)=>o.indexOf(n)===s);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Soe(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Ix(t){let e=boe(t);return Soe(t,e.warnings),e.isValid}var woe,U2=$(()=>{woe=/^[A-Za-z0-9._-]{1,128}$/});var Im,V2=$(()=>{Im=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let s={taskSupport:"required",...r.execution};if(s.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,s,r._meta,n)}}});var B2=$(()=>{Wb()});var G2={};We(G2,{McpServer:()=>Nx,ResourceTemplate:()=>Cx});function W2(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function J2(t){return"_def"in t||"_zod"in t||W2(t)}function Rx(t){return typeof t!="object"||t===null||J2(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(W2)}function K2(t){if(t){if(Rx(t))return ro(t);if(!J2(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function koe(t){let e=ds(t);return e?Object.entries(e).map(([r,n])=>{let s=EA(n),o=TA(n);return{name:r,description:s,required:!o}}):[]}function Os(t){let r=ds(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Ai(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function H2(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Nx,Cx,$oe,Gu,Y2=$(()=>{Sx();pl();Y0();lo();F2();Z2();U2();V2();B2();Nx=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ku(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Im(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Os(Dl)),this.server.assertCanSetRequestHandler(Os(ao)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Dl,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let s=Ri(r.inputSchema);return s?W0(s,{strictUnions:!0,pipeStrategy:"input"}):$oe})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let s=Ri(r.outputSchema);s&&(n.outputSchema=W0(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(ao,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new j(F.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new j(F.InvalidParams,`Tool ${e.params.name} disabled`);let s=!!e.params.task,o=n.execution?.taskSupport,i="createTask"in n.handler;if((o==="required"||o==="optional")&&!i)throw new j(F.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!s)throw new j(F.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!s&&i)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return s||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof j&&n.code===F.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let o=Ri(e.inputSchema)??e.inputSchema,i=await Ap(o,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=zp(a);throw new j(F.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new j(F.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let s=Ri(e.outputSchema),o=await Ap(s,r.structuredContent);if(!o.success){let i="error"in o?o.error:"Unknown error",a=zp(i);throw new j(F.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let s=e.handler;if("createTask"in s){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(e.inputSchema){let a=s;return await Promise.resolve(a.createTask(r,i))}else{let a=s;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=s;return await Promise.resolve(i(r,n))}else{let i=s;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let s=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,i={...n,taskStore:n.taskStore},a=s?await Promise.resolve(o.createTask(s,i)):await Promise.resolve(o.createTask(i)),c=a.task.taskId,l=a.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(f=>setTimeout(f,u));let d=await n.taskStore.getTask(c);if(!d)throw new j(F.InternalError,`Task ${c} not found during polling`);l=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Os(Fl)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Fl,async e=>{switch(e.params.ref.type){case"ref/prompt":return p0(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return h0(e),this.handleResourceCompletion(e,e.params.ref);default:throw new j(F.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new j(F.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new j(F.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Gu;let o=ds(n.argsSchema)?.[e.params.argument.name];if(!Ox(o))return Gu;let i=q2(o);if(!i)return Gu;let a=await i(e.params.argument.value,e.params.context);return H2(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Gu;throw new j(F.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return Gu;let o=await s(e.params.argument.value,e.params.context);return H2(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Os(Al)),this.server.assertCanSetRequestHandler(Os(zl)),this.server.assertCanSetRequestHandler(Os(jl)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Al,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([o,i])=>i.enabled).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),s=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let i=await o.resourceTemplate.listCallback(r);for(let a of i.resources)s.push({...o.metadata,...a})}return{resources:[...n,...s]}}),this.server.setRequestHandler(zl,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(jl,async(e,r)=>{let n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new j(F.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(let o of Object.values(this._registeredResourceTemplates)){let i=o.resourceTemplate.uriTemplate.match(n.toString());if(i)return o.readCallback(n,i,r)}throw new j(F.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Os(Ml)),this.server.assertCanSetRequestHandler(Os(Ll)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ml,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?koe(r.argsSchema):void 0}))})),this.server.setRequestHandler(Ll,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new j(F.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new j(F.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let s=Ri(n.argsSchema),o=await Ap(s,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",l=zp(c);throw new j(F.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}let i=o.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let s=n.callback;return await Promise.resolve(s(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());let o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,s,o){let i={name:e,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,s,o){let i={resourceTemplate:n,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredResourceTemplates[e],l.name&&(this._registeredResourceTemplates[l.name]=i)),typeof l.title<"u"&&(i.title=l.title),typeof l.template<"u"&&(i.resourceTemplate=l.template),typeof l.metadata<"u"&&(i.metadata=l.metadata),typeof l.callback<"u"&&(i.readCallback=l.callback),typeof l.enabled<"u"&&(i.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!n.completeCallback(l))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,n,s,o){let i={title:r,description:n,argsSchema:s===void 0?void 0:ro(s),callback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=ro(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,s&&Object.values(s).some(c=>{let l=c instanceof qp?c._def?.innerType:c;return Ox(l)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,n,s,o,i,a,c,l){Ix(e);let u={title:r,description:n,inputSchema:K2(s),outputSchema:K2(o),annotations:i,execution:a,_meta:c,handler:l,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Ix(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=u)),typeof d.title<"u"&&(u.title=d.title),typeof d.description<"u"&&(u.description=d.description),typeof d.paramsSchema<"u"&&(u.inputSchema=ro(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=ro(d.outputSchema)),typeof d.callback<"u"&&(u.handler=d.callback),typeof d.annotations<"u"&&(u.annotations=d.annotations),typeof d._meta<"u"&&(u._meta=d._meta),typeof d.enabled<"u"&&(u.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,s,o,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Rx(c))s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Rx(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(l=>typeof l=="object"&&l!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,n,s,o,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:s,description:o,inputSchema:i,outputSchema:a,annotations:c,_meta:l}=r;return this._createRegisteredTool(e,s,o,i,a,c,{taskSupport:"forbidden"},l,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let s;r.length>1&&(s=r.shift());let o=r[0],i=this._createRegisteredPrompt(e,void 0,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:s,description:o,argsSchema:i}=r,a=this._createRegisteredPrompt(e,s,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Cx=class{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new Om(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}},$oe={type:"object",properties:{}};Gu={completion:{values:[],hasMore:!1}}});var tF={};We(tF,{describeUnlinked:()=>Q2,projectStatus:()=>eF,runMcp:()=>Eoe});import{resolve as X2}from"node:path";var Ax,xoe,Q2,eF,Eoe,rF=$(()=>{"use strict";Ju();M2();lt();ar();Ax=t=>{process.stderr.write(`[pix3 mcp] ${t}
|
|
314
|
+
`)},xoe=3e4,Q2=(t,e,r=Date.now())=>{if(t.port===null)return"The Pix3 link server could not start (every port in 8490\u20138499 is taken), so no editor window can connect to this agent session. Close other `pix3 mcp` processes and restart the agent.";if(t.projectId===null)return`${e} is not a Pix3 project with a project id (no ${xe} with \`metadata.projectId\` here or above). Create one with \`npx @pix3/cli new\`, or start the agent from the project folder.`;let n=s=>s!==null&&r-s<xoe;return n(t.lastFailedClaimAt)?`A Pix3 editor window has a project with this id open, but not THIS folder \u2014 it is a copy, another checkout or a worktree. Open ${e} itself in Pix3 (Open Folder).`:n(t.lastBrowserHelloAt)?`A Pix3 editor window can see this agent but has not connected: it has a different folder open. Open ${e} in Pix3 (Open Folder).`:`The Pix3 editor is not open on this project. Open ${e} in Pix3 (Open Folder, or Recent projects); the window connects to this agent by itself. Files can be edited meanwhile \u2014 the editor picks them up when it opens.`},eF=async t=>t.isLeased()?t.callEditor("project_status",{}):Em(Q2(t.status(),t.projectDir)),Eoe=async t=>{let e=t.projectDir?X2(t.cwd,t.projectDir):Xe(t.cwd)??X2(t.cwd),[{McpServer:r},{StdioServerTransport:n}]=await Promise.all([Promise.resolve().then(()=>(Y2(),G2)),Promise.resolve().then(()=>(xx(),kx))]),s=new r({name:"pix3",version:be}),o=new Pm({projectDir:e,agent:()=>t.agent??s.server.getClientVersion()?.name??null,log:Ax});s.registerTool("project_status",{description:"Whether a Pix3 editor window is connected to this project folder, and what it reports. When none is, says what the user has to open."},async()=>eF(o));try{let l=await o.start();Ax(`link server on http://127.0.0.1:${l} for ${e} (session ${o.sessionId})`)}catch(l){Ax(l instanceof Error?l.message:String(l))}let i=!1,a=async()=>{i||(i=!0,await o.close(),await s.close().catch(()=>{}),process.exit(0))};process.on("SIGINT",()=>{a()}),process.on("SIGTERM",()=>{a()}),process.stdin.on("end",()=>{a()});let c=new n;c.onclose=()=>{a()},await s.connect(c)}});import{createHash as sF}from"node:crypto";import{createReadStream as Toe}from"node:fs";import{lstat as Poe,readdir as Ooe}from"node:fs/promises";import{join as Ioe}from"node:path";var oF,iF,Ns,Noe,Coe,Is,Co,jx,Nm,zx,Yu,aF,cF,Roe,Mx,nF,Aoe,Cm=$(()=>{"use strict";qf();oF=new Set(["node_modules",".git",".yalc",".vscode",".idea","dist","build","out","coverage",".cache"]),iF=/^\..+\.pix3-tmp-[0-9a-f]+$/,Ns=t=>{let e=t.split("/");if(e[0]===Rt||iF.test(e[e.length-1]))return!0;for(let r=0;r<e.length-1;r++)if(oF.has(e[r]))return!0;return!1},Noe=(t,e)=>t===Rt||oF.has(e),Coe=t=>t!==Rt&&A_(t)||iF.test(t.slice(t.lastIndexOf("/")+1)),Is=t=>`${t.ino}:${t.size}:${t.mtimeNs}`,Co=t=>Number(t.mtimeNs/1000000n),jx=t=>new Promise((e,r)=>{let n=sF("sha256"),s=Toe(t);s.on("data",o=>n.update(o)),s.on("error",r),s.on("end",()=>e(n.digest("hex")))}),Nm=class t{entries=new Map;static MAX_ENTRIES=2e5;async hash(e,r,n){let s=Is(n),o=this.entries.get(e);if(o&&o.key===s)return o.sha256;let i=await jx(r);return this.remember(e,s,i),i}remember(e,r,n){this.entries.size>=t.MAX_ENTRIES&&this.entries.clear(),this.entries.set(e,{key:r,sha256:n})}forget(e){this.entries.delete(e)}},zx=t=>t&&typeof t=="object"&&"code"in t?String(t.code):void 0,Yu=async(t,e,r,n,s={})=>{let o=e?Ioe(t,...e.split("/")):t,i=s.internal===!0;if(i?Coe(e):e&&Ns(e))return;let a;try{a=await Poe(o,{bigint:!0})}catch(u){let d=zx(u);if(d==="ENOENT"||d==="ENOTDIR")return;throw u}if(a.isFile()){if(!e)return;let u;try{u=await r.hash(e,o,a)}catch(d){if(zx(d)==="ENOENT")return;throw d}n.set(e,{kind:"file",size:Number(a.size),mtime:Co(a),statKey:Is(a),sha256:u});return}if(!a.isDirectory())return;let c=e.slice(e.lastIndexOf("/")+1);if(!i&&e&&Noe(e,c))return;e&&n.set(e,{kind:"dir",size:0,mtime:Co(a),statKey:Is(a)});let l;try{l=await Ooe(o)}catch(u){let d=zx(u);if(d==="ENOENT"||d==="ENOTDIR")return;throw u}l.sort();for(let u of l)await Yu(t,e?`${e}/${u}`:u,r,n,s)},aF=async(t,e)=>{let r=new Map;return await Yu(t,Rt,e,r,{internal:!0}),r},cF=t=>{let e=[];for(let[r,n]of t)n.kind==="file"&&n.sha256&&e.push(`${r}:${n.sha256}`);return e.sort(),sF("sha256").update(e.join(`
|
|
315
|
+
`)).digest("hex")},Roe=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),Mx=(t,e,r)=>{let n=[],s=[],o=[];for(let[i,a]of[...t])e.some(c=>Roe(i,c))&&(r.has(i)||(t.delete(i),s.push(nF(i,a))));for(let[i,a]of r){let c=t.get(i);t.set(i,a),c?c.kind!==a.kind?(s.push(nF(i,c)),n.push({op:"create",path:i,kind:a.kind,...a.sha256?{sha256:a.sha256}:{}})):a.kind==="file"&&c.sha256!==a.sha256&&o.push({op:"modify",path:i,kind:"file",...a.sha256?{sha256:a.sha256}:{}}):n.push({op:"create",path:i,kind:a.kind,...a.sha256?{sha256:a.sha256}:{}})}return Aoe(s,n,o)},nF=(t,e)=>({op:"delete",path:t,kind:e.kind,...e.sha256?{sha256:e.sha256}:{}}),Aoe=(t,e,r)=>{let n=u=>{let d=new Map;for(let f of u)f.kind==="file"&&f.sha256&&d.set(f.sha256,(d.get(f.sha256)??0)+1);return d},s=n(t),o=n(e),i=[],a=new Set,c=new Set;for(let u of e){let d=u.sha256;if(u.kind!=="file"||!d||s.get(d)!==1||o.get(d)!==1)continue;let f=t.find(p=>p.sha256===d);f&&(a.add(f),c.add(u),i.push({op:"rename",path:u.path,from:f.path,kind:"file",sha256:d}))}let l=u=>u.op==="delete"?{op:"delete",path:u.path,kind:u.kind}:u;return[...t.filter(u=>!a.has(u)).map(l),...i,...e.filter(u=>!c.has(u)),...r].sort((u,d)=>u.path<d.path?-1:u.path>d.path?1:0)}});import{lstat as zoe,readdir as joe,readFile as Moe}from"node:fs/promises";import{join as Lx}from"node:path";var Loe,Doe,qoe,Foe,Rm,lF,uF,dF,fF,pF=$(()=>{"use strict";Cm();Loe=5e3,Doe=".pix3/recovery",qoe=".pix3/merge-log.jsonl",Foe=5e3,Rm=class{entries=[];droppedThrough=0;record(e,r,n){for(let o of r)this.entries.push({seq:e,path:o,origin:n});let s=this.entries.length-Loe;if(s>0){let o=this.entries.splice(0,s);this.droppedThrough=Math.max(this.droppedThrough,o[o.length-1].seq)}}since(e){let r=this.entries.filter(s=>s.seq>e);return{paths:[...new Set(r.map(s=>s.path))].sort(),complete:e>=this.droppedThrough,entries:r}}},lF=t=>t&&typeof t=="object"&&"code"in t?String(t.code):void 0,uF=async(t,e,r)=>{let n=`${Doe}/${encodeURIComponent(e)}`,s=Lx(t,...n.split("/")),o;try{o=await joe(s)}catch(a){let c=lF(a);if(c==="ENOENT"||c==="ENOTDIR")return null;throw a}let i=r.slice(0,8);o.sort((a,c)=>Number(c.includes(i))-Number(a.includes(i))||(a<c?1:-1));for(let a of o){let c=Lx(s,a);try{if(!(await zoe(c)).isFile())continue;if(await jx(c)===r)return`${n}/${a}`}catch{}}return null},dF=async t=>{let e;try{e=await Moe(Lx(t,...qoe.split("/")),"utf8")}catch(n){if(lF(n)==="ENOENT")return[];throw n}let r=[];for(let n of e.split(`
|
|
316
|
+
`))if(n.trim())try{let s=JSON.parse(n);s&&typeof s=="object"&&!Array.isArray(s)&&r.push(s)}catch{}return r},fF=(t,e,r,n)=>t.some(s=>{if(s.file!==e)return!1;if(r&&(s.mergedHash===r||s.hash===r))return!0;if(n===null||typeof s.at!="string")return!1;let o=Date.parse(s.at);return Number.isFinite(o)&&o>=n-Foe})});var Am,hF=$(()=>{"use strict";xr();Am=class{entries=new Map;ttlMs;onChange;last;constructor(e,r=lN){this.onChange=e,this.ttlMs=r,this.last=JSON.stringify(this.snapshot())}touch(e,r){let n=this.entries.get(e);n&&clearTimeout(n.timer);let s=setTimeout(()=>this.drop(e),this.ttlMs);s.unref(),this.entries.set(e,{name:r??n?.name??null,lastSeen:Date.now(),timer:s}),this.emitIfChanged()}leave(e){this.drop(e)}snapshot(){let e=null;for(let r of this.entries.values())(!e||r.lastSeen>=e.lastSeen)&&(e=r);return e?{attached:!0,agent:{name:e.name,verified:!1}}:{attached:!1,agent:null}}close(){for(let e of this.entries.values())clearTimeout(e.timer);this.entries.clear()}drop(e){let r=this.entries.get(e);r&&(clearTimeout(r.timer),this.entries.delete(e),this.emitIfChanged())}emitIfChanged(){let e=this.snapshot(),r=JSON.stringify(e);r!==this.last&&(this.last=r,this.onChange(e))}}});var zm,mF=$(()=>{"use strict";Tc();zm=class{root;workspaceId;limit;windowMs;failures=[];record=null;stamp=void 0;constructor(e){this.root=e.root,this.workspaceId=e.workspaceId,this.limit=e.failureLimit,this.windowMs=e.failureWindowMs}current(){let e=_N(this.root);if(e!==this.stamp){this.stamp=e;let r=Tr(this.root);this.record=r&&r.workspaceId===this.workspaceId?r.token:null}return this.record}check(e){let r=Date.now();if(this.failures=this.failures.filter(s=>r-s<this.windowMs),this.failures.length>=this.limit)return{ok:!1,code:"rate_limited",retryAfter:Math.max(1,Math.ceil((this.windowMs-(r-this.failures[0]))/1e3))};let n=this.current();return n&&yN(e,n)?{ok:!0,tokenHash:n.sha256}:(this.failures.push(r),{ok:!1,code:"unauthorized"})}}});var Zoe,gF,yF=$(()=>{"use strict";Zoe={pix3scene:"text/yaml; charset=utf-8",prefab:"text/yaml; charset=utf-8",pix3anim:"text/yaml; charset=utf-8",yaml:"text/yaml; charset=utf-8",yml:"text/yaml; charset=utf-8",json:"application/json; charset=utf-8",ts:"text/plain; charset=utf-8",tsx:"text/plain; charset=utf-8",js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",md:"text/markdown; charset=utf-8",txt:"text/plain; charset=utf-8",csv:"text/csv; charset=utf-8",atlas:"text/plain; charset=utf-8",html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",xml:"application/xml; charset=utf-8",svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",ktx2:"image/ktx2",mp3:"audio/mpeg",ogg:"audio/ogg",oga:"audio/ogg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",glb:"model/gltf-binary",gltf:"model/gltf+json",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",wasm:"application/wasm"},gF=t=>{let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"application/octet-stream":Zoe[e.slice(r+1).toLowerCase()]??"application/octet-stream"}});var Mn=_((w0e,wF)=>{"use strict";var _F=["nodebuffer","arraybuffer","fragments"],vF=typeof Blob<"u";vF&&_F.push("blob");wF.exports={BINARY_TYPES:_F,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:vF,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Xu=_((b0e,jm)=>{"use strict";var{EMPTY_BUFFER:Uoe}=Mn(),Dx=Buffer[Symbol.species];function Voe(t,e){if(t.length===0)return Uoe;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let s=0;s<t.length;s++){let o=t[s];r.set(o,n),n+=o.length}return n<e?new Dx(r.buffer,r.byteOffset,n):r}function bF(t,e,r,n,s){for(let o=0;o<s;o++)r[n+o]=t[o]^e[o&3]}function SF(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function Boe(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function qx(t){if(qx.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Dx(t):ArrayBuffer.isView(t)?e=new Dx(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),qx.readOnly=!1),e}jm.exports={concat:Voe,mask:bF,toArrayBuffer:Boe,toBuffer:qx,unmask:SF};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=ze("bufferutil");jm.exports.mask=function(e,r,n,s,o){o<48?bF(e,r,n,s,o):t.mask(e,r,n,s,o)},jm.exports.unmask=function(e,r){e.length<32?SF(e,r):t.unmask(e,r)}}catch{}});var xF=_((S0e,kF)=>{"use strict";var $F=Symbol("kDone"),Fx=Symbol("kRun"),Zx=class{constructor(e){this[$F]=()=>{this.pending--,this[Fx]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Fx]()}[Fx](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[$F])}}};kF.exports=Zx});var Ea=_(($0e,OF)=>{"use strict";var Qu=ze("zlib"),EF=Xu(),Koe=xF(),{kStatusCode:TF}=Mn(),Hoe=Buffer[Symbol.species],Woe=Buffer.from([0,0,255,255]),Lm=Symbol("permessage-deflate"),Ln=Symbol("total-length"),ka=Symbol("callback"),Cs=Symbol("buffers"),xa=Symbol("error"),Mm,Ux=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Mm){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Mm=new Koe(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ka];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(s=>!(r.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>s.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let s=r[n];if(s.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(s=s[0],n==="client_max_window_bits"){if(s!==!0){let o=+s;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${s}`);s=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${s}`)}else if(n==="server_max_window_bits"){let o=+s;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${s}`);s=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${s}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=s})}),e}decompress(e,r,n){Mm.add(s=>{this._decompress(e,r,(o,i)=>{s(),n(o,i)})})}compress(e,r,n){Mm.add(s=>{this._compress(e,r,(o,i)=>{s(),n(o,i)})})}_decompress(e,r,n){let s=this._isServer?"client":"server";if(!this._inflate){let o=`${s}_max_window_bits`,i=typeof this.params[o]!="number"?Qu.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=Qu.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Lm]=this,this._inflate[Ln]=0,this._inflate[Cs]=[],this._inflate.on("error",Goe),this._inflate.on("data",PF)}this._inflate[ka]=n,this._inflate.write(e),r&&this._inflate.write(Woe),this._inflate.flush(()=>{let o=this._inflate[xa];if(o){this._inflate.close(),this._inflate=null,n(o);return}let i=EF.concat(this._inflate[Cs],this._inflate[Ln]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ln]=0,this._inflate[Cs]=[],r&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,r,n){let s=this._isServer?"server":"client";if(!this._deflate){let o=`${s}_max_window_bits`,i=typeof this.params[o]!="number"?Qu.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=Qu.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[Ln]=0,this._deflate[Cs]=[],this._deflate.on("data",Joe)}this._deflate[ka]=n,this._deflate.write(e),this._deflate.flush(Qu.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let o=EF.concat(this._deflate[Cs],this._deflate[Ln]);r&&(o=new Hoe(o.buffer,o.byteOffset,o.length-4)),this._deflate[ka]=null,this._deflate[Ln]=0,this._deflate[Cs]=[],r&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),n(null,o)})}};OF.exports=Ux;function Joe(t){this[Cs].push(t),this[Ln]+=t.length}function PF(t){if(this[Ln]+=t.length,this[Lm]._maxPayload<1||this[Ln]<=this[Lm]._maxPayload){this[Cs].push(t);return}this[xa]=new RangeError("Max payload size exceeded"),this[xa].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[xa][TF]=1009,this.removeListener("data",PF),this.reset()}function Goe(t){if(this[Lm]._inflate=null,this[xa]){this[ka](this[xa]);return}t[TF]=1007,this[ka](t)}});var Ta=_((k0e,Dm)=>{"use strict";var{isUtf8:IF}=ze("buffer"),{hasBlob:Yoe}=Mn(),Xoe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Qoe(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Vx(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function eie(t){return Yoe&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}Dm.exports={isBlob:eie,isValidStatusCode:Qoe,isValidUTF8:Vx,tokenChars:Xoe};if(IF)Dm.exports.isValidUTF8=function(t){return t.length<24?Vx(t):IF(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=ze("utf-8-validate");Dm.exports.isValidUTF8=function(e){return e.length<32?Vx(e):t(e)}}catch{}});var Jx=_((x0e,MF)=>{"use strict";var{Writable:tie}=ze("stream"),NF=Ea(),{BINARY_TYPES:rie,EMPTY_BUFFER:CF,kStatusCode:nie,kWebSocket:sie}=Mn(),{concat:Bx,toArrayBuffer:oie,unmask:iie}=Xu(),{isValidStatusCode:aie,isValidUTF8:RF}=Ta(),qm=Buffer[Symbol.species],wr=0,AF=1,zF=2,jF=3,Kx=4,Hx=5,Fm=6,Wx=class extends tie{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||rie[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[sie]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=wr}_write(e,r,n){if(this._opcode===8&&this._state==wr)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new qm(n.buffer,n.byteOffset+e,n.length-e),new qm(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],s=r.length-e;e>=n.length?r.set(this._buffers.shift(),s):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),s),this._buffers[0]=new qm(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case wr:this.getInfo(e);break;case AF:this.getPayloadLength16(e);break;case zF:this.getPayloadLength64(e);break;case jF:this.getMask();break;case Kx:this.getData(e);break;case Hx:case Fm:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(s);return}let n=(r[0]&64)===64;if(n&&!this._extensions[NF.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(s);return}if(n){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(s);return}this._payloadLength===126?this._state=AF:this._payloadLength===127?this._state=zF:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(s);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=jF:this._state=Kx}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Kx}getData(e){let r=CF;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&iie(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(n);return}if(this._compressed){this._state=Hx,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[NF.extensionName].decompress(e,this._fin,(s,o)=>{if(s)return r(s);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(i);return}this._fragments.push(o)}this.dataMessage(r),this._state===wr&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=wr;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=Bx(n,r):this._binaryType==="arraybuffer"?s=oie(Bx(n,r)):this._binaryType==="blob"?s=new Blob(n):s=n,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=wr):(this._state=Fm,setImmediate(()=>{this.emit("message",s,!0),this._state=wr,this.startLoop(e)}))}else{let s=Bx(n,r);if(!this._skipUTF8Validation&&!RF(s)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(o);return}this._state===Hx||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=wr):(this._state=Fm,setImmediate(()=>{this.emit("message",s,!1),this._state=wr,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,CF),this.end();else{let n=e.readUInt16BE(0);if(!aie(n)){let o=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(o);return}let s=new qm(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!RF(s)){let o=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(o);return}this._loop=!1,this.emit("conclude",n,s),this.end()}this._state=wr;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=wr):(this._state=Fm,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=wr,this.startLoop(r)}))}createError(e,r,n,s,o){this._loop=!1,this._errored=!0;let i=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(i,this.createError),i.code=o,i[nie]=s,i}};MF.exports=Wx});var Xx=_((T0e,qF)=>{"use strict";var{Duplex:E0e}=ze("stream"),{randomFillSync:cie}=ze("crypto"),{types:{isUint8Array:lie}}=ze("util"),LF=Ea(),{EMPTY_BUFFER:uie,kWebSocket:die,NOOP:fie}=Mn(),{isBlob:Pa,isValidStatusCode:pie}=Ta(),{mask:DF,toBuffer:Ro}=Xu(),br=Symbol("kByteLength"),hie=Buffer.alloc(4),Zm=8*1024,Ao,Oa=Zm,Vr=0,mie=1,gie=2,Gx=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Vr,this.onerror=fie,this[die]=void 0}static frame(e,r){let n,s=!1,o=2,i=!1;r.mask&&(n=r.maskBuffer||hie,r.generateMask?r.generateMask(n):(Oa===Zm&&(Ao===void 0&&(Ao=Buffer.alloc(Zm)),cie(Ao,0,Zm),Oa=0),n[0]=Ao[Oa++],n[1]=Ao[Oa++],n[2]=Ao[Oa++],n[3]=Ao[Oa++]),i=(n[0]|n[1]|n[2]|n[3])===0,o=6);let a;typeof e=="string"?(!r.mask||i)&&r[br]!==void 0?a=r[br]:(e=Buffer.from(e),a=e.length):(a=e.length,s=r.mask&&r.readOnly&&!i);let c=a;a>=65536?(o+=8,c=127):a>125&&(o+=2,c=126);let l=Buffer.allocUnsafe(s?a+o:o);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(a,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(a,4,6)),r.mask?(l[1]|=128,l[o-4]=n[0],l[o-3]=n[1],l[o-2]=n[2],l[o-1]=n[3],i?[l,e]:s?(DF(e,n,l,o,a),[l]):(DF(e,n,e,0,a),[l,e])):[l,e]}close(e,r,n,s){let o;if(e===void 0)o=uie;else{if(typeof e!="number"||!pie(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");if(o=Buffer.allocUnsafe(2+a),o.writeUInt16BE(e,0),typeof r=="string")o.write(r,2);else if(lie(r))o.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[br]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Vr?this.enqueue([this.dispatch,o,!1,i,s]):this.sendFrame(t.frame(o,i),s)}ping(e,r,n){let s,o;if(typeof e=="string"?(s=Buffer.byteLength(e),o=!1):Pa(e)?(s=e.size,o=!1):(e=Ro(e),s=e.length,o=Ro.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[br]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};Pa(e)?this._state!==Vr?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==Vr?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}pong(e,r,n){let s,o;if(typeof e=="string"?(s=Buffer.byteLength(e),o=!1):Pa(e)?(s=e.size,o=!1):(e=Ro(e),s=e.length,o=Ro.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[br]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};Pa(e)?this._state!==Vr?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==Vr?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}send(e,r,n){let s=this._extensions[LF.extensionName],o=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Pa(e)?(a=e.size,c=!1):(e=Ro(e),a=e.length,c=Ro.readOnly),this._firstFragment?(this._firstFragment=!1,i&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=a>=s._threshold),this._compress=i):(i=!1,o=0),r.fin&&(this._firstFragment=!0);let l={[br]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:o,readOnly:c,rsv1:i};Pa(e)?this._state!==Vr?this.enqueue([this.getBlobData,e,this._compress,l,n]):this.getBlobData(e,this._compress,l,n):this._state!==Vr?this.enqueue([this.dispatch,e,this._compress,l,n]):this.dispatch(e,this._compress,l,n)}getBlobData(e,r,n,s){this._bufferedBytes+=n[br],this._state=gie,e.arrayBuffer().then(o=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(Yx,this,a,s);return}this._bufferedBytes-=n[br];let i=Ro(o);r?this.dispatch(i,r,n,s):(this._state=Vr,this.sendFrame(t.frame(i,n),s),this.dequeue())}).catch(o=>{process.nextTick(yie,this,o,s)})}dispatch(e,r,n,s){if(!r){this.sendFrame(t.frame(e,n),s);return}let o=this._extensions[LF.extensionName];this._bufferedBytes+=n[br],this._state=mie,o.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");Yx(this,c,s);return}this._bufferedBytes-=n[br],this._state=Vr,n.readOnly=!1,this.sendFrame(t.frame(a,n),s),this.dequeue()})}dequeue(){for(;this._state===Vr&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][br],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][br],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};qF.exports=Gx;function Yx(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let s=t._queue[n],o=s[s.length-1];typeof o=="function"&&o(e)}}function yie(t,e,r){Yx(t,e,r),t.onerror(e)}});var JF=_((P0e,WF)=>{"use strict";var{kForOnEventAttribute:ed,kListener:Qx}=Mn(),FF=Symbol("kCode"),ZF=Symbol("kData"),UF=Symbol("kError"),VF=Symbol("kMessage"),BF=Symbol("kReason"),Ia=Symbol("kTarget"),KF=Symbol("kType"),HF=Symbol("kWasClean"),Dn=class{constructor(e){this[Ia]=null,this[KF]=e}get target(){return this[Ia]}get type(){return this[KF]}};Object.defineProperty(Dn.prototype,"target",{enumerable:!0});Object.defineProperty(Dn.prototype,"type",{enumerable:!0});var zo=class extends Dn{constructor(e,r={}){super(e),this[FF]=r.code===void 0?0:r.code,this[BF]=r.reason===void 0?"":r.reason,this[HF]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[FF]}get reason(){return this[BF]}get wasClean(){return this[HF]}};Object.defineProperty(zo.prototype,"code",{enumerable:!0});Object.defineProperty(zo.prototype,"reason",{enumerable:!0});Object.defineProperty(zo.prototype,"wasClean",{enumerable:!0});var Na=class extends Dn{constructor(e,r={}){super(e),this[UF]=r.error===void 0?null:r.error,this[VF]=r.message===void 0?"":r.message}get error(){return this[UF]}get message(){return this[VF]}};Object.defineProperty(Na.prototype,"error",{enumerable:!0});Object.defineProperty(Na.prototype,"message",{enumerable:!0});var td=class extends Dn{constructor(e,r={}){super(e),this[ZF]=r.data===void 0?null:r.data}get data(){return this[ZF]}};Object.defineProperty(td.prototype,"data",{enumerable:!0});var _ie={addEventListener(t,e,r={}){for(let s of this.listeners(t))if(!r[ed]&&s[Qx]===e&&!s[ed])return;let n;if(t==="message")n=function(o,i){let a=new td("message",{data:i?o:o.toString()});a[Ia]=this,Um(e,this,a)};else if(t==="close")n=function(o,i){let a=new zo("close",{code:o,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Ia]=this,Um(e,this,a)};else if(t==="error")n=function(o){let i=new Na("error",{error:o,message:o.message});i[Ia]=this,Um(e,this,i)};else if(t==="open")n=function(){let o=new Dn("open");o[Ia]=this,Um(e,this,o)};else return;n[ed]=!!r[ed],n[Qx]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Qx]===e&&!r[ed]){this.removeListener(t,r);break}}};WF.exports={CloseEvent:zo,ErrorEvent:Na,Event:Dn,EventTarget:_ie,MessageEvent:td};function Um(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var Vm=_((O0e,GF)=>{"use strict";var{tokenChars:rd}=Ta();function dn(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function vie(t){let e=Object.create(null),r=Object.create(null),n=!1,s=!1,o=!1,i,a,c=-1,l=-1,u=-1,d=0;for(;d<t.length;d++)if(l=t.charCodeAt(d),i===void 0)if(u===-1&&rd[l]===1)c===-1&&(c=d);else if(d!==0&&(l===32||l===9))u===-1&&c!==-1&&(u=d);else if(l===59||l===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);u===-1&&(u=d);let p=t.slice(c,u);l===44?(dn(e,p,r),r=Object.create(null)):i=p,c=u=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(a===void 0)if(u===-1&&rd[l]===1)c===-1&&(c=d);else if(l===32||l===9)u===-1&&c!==-1&&(u=d);else if(l===59||l===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);u===-1&&(u=d),dn(r,t.slice(c,u),!0),l===44&&(dn(e,i,r),r=Object.create(null),i=void 0),c=u=-1}else if(l===61&&c!==-1&&u===-1)a=t.slice(c,d),c=u=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(s){if(rd[l]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),s=!1}else if(o)if(rd[l]===1)c===-1&&(c=d);else if(l===34&&c!==-1)o=!1,u=d;else if(l===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(l===34&&t.charCodeAt(d-1)===61)o=!0;else if(u===-1&&rd[l]===1)c===-1&&(c=d);else if(c!==-1&&(l===32||l===9))u===-1&&(u=d);else if(l===59||l===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);u===-1&&(u=d);let p=t.slice(c,u);n&&(p=p.replace(/\\/g,""),n=!1),dn(r,a,p),l===44&&(dn(e,i,r),r=Object.create(null),i=void 0),a=void 0,c=u=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||o||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=d);let f=t.slice(c,u);return i===void 0?dn(e,f,r):(a===void 0?dn(r,f,!0):n?dn(r,a,f.replace(/\\/g,"")):dn(r,a,f),dn(e,i,r)),e}function wie(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(s=>{let o=n[s];return Array.isArray(o)||(o=[o]),o.map(i=>i===!0?s:`${s}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}GF.exports={format:wie,parse:vie}});var Wm=_((C0e,cZ)=>{"use strict";var bie=ze("events"),Sie=ze("https"),$ie=ze("http"),QF=ze("net"),kie=ze("tls"),{randomBytes:xie,createHash:Eie}=ze("crypto"),{Duplex:I0e,Readable:N0e}=ze("stream"),{URL:eE}=ze("url"),Rs=Ea(),Tie=Jx(),Pie=Xx(),{isBlob:Oie}=Ta(),{BINARY_TYPES:YF,CLOSE_TIMEOUT:Iie,EMPTY_BUFFER:Bm,GUID:Nie,kForOnEventAttribute:tE,kListener:Cie,kStatusCode:Rie,kWebSocket:at,NOOP:eZ}=Mn(),{EventTarget:{addEventListener:Aie,removeEventListener:zie}}=JF(),{format:jie,parse:Mie}=Vm(),{toBuffer:Lie}=Xu(),tZ=Symbol("kAborted"),rE=[8,13],qn=["CONNECTING","OPEN","CLOSING","CLOSED"],Die=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Ke=class t extends bie{constructor(e,r,n){super(),this._binaryType=YF[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Bm,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),rZ(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){YF.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let s=new Tie({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),o=new Pie(e,this._extensions,n.generateMask);this._receiver=s,this._sender=o,this._socket=e,s[at]=this,o[at]=this,e[at]=this,s.on("conclude",Zie),s.on("drain",Uie),s.on("error",Vie),s.on("message",Bie),s.on("ping",Kie),s.on("pong",Hie),o.onerror=Wie,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",oZ),e.on("data",Hm),e.on("end",iZ),e.on("error",aZ),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Rs.extensionName]&&this._extensions[Rs.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){or(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),sZ(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){nE(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Bm,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){nE(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Bm,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){nE(this,e,n);return}let s={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Rs.extensionName]||(s.compress=!1),this._sender.send(e||Bm,s,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){or(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(Ke,"CONNECTING",{enumerable:!0,value:qn.indexOf("CONNECTING")});Object.defineProperty(Ke.prototype,"CONNECTING",{enumerable:!0,value:qn.indexOf("CONNECTING")});Object.defineProperty(Ke,"OPEN",{enumerable:!0,value:qn.indexOf("OPEN")});Object.defineProperty(Ke.prototype,"OPEN",{enumerable:!0,value:qn.indexOf("OPEN")});Object.defineProperty(Ke,"CLOSING",{enumerable:!0,value:qn.indexOf("CLOSING")});Object.defineProperty(Ke.prototype,"CLOSING",{enumerable:!0,value:qn.indexOf("CLOSING")});Object.defineProperty(Ke,"CLOSED",{enumerable:!0,value:qn.indexOf("CLOSED")});Object.defineProperty(Ke.prototype,"CLOSED",{enumerable:!0,value:qn.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(Ke.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(Ke.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[tE])return e[Cie];return null},set(e){for(let r of this.listeners(t))if(r[tE]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[tE]:!0})}})});Ke.prototype.addEventListener=Aie;Ke.prototype.removeEventListener=zie;cZ.exports=Ke;function rZ(t,e,r,n){let s={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Iie,protocolVersion:rE[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=s.autoPong,t._closeTimeout=s.closeTimeout,!rE.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${rE.join(", ")})`);let o;if(e instanceof eE)o=e;else try{o=new eE(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}o.protocol==="http:"?o.protocol="ws:":o.protocol==="https:"&&(o.protocol="wss:"),t._url=o.href;let i=o.protocol==="wss:",a=o.protocol==="ws+unix:",c;if(o.protocol!=="ws:"&&!i&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!o.pathname?c="The URL's pathname is empty":o.hash&&(c="The URL contains a fragment identifier"),c){let h=new SyntaxError(c);if(t._redirects===0)throw h;Km(t,h);return}let l=i?443:80,u=xie(16).toString("base64"),d=i?Sie.request:$ie.request,f=new Set,p;if(s.createConnection=s.createConnection||(i?Fie:qie),s.defaultPort=s.defaultPort||l,s.port=o.port||l,s.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},s.path=o.pathname+o.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(p=new Rs({...s.perMessageDeflate,isServer:!1,maxPayload:s.maxPayload}),s.headers["Sec-WebSocket-Extensions"]=jie({[Rs.extensionName]:p.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Die.test(h)||f.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(h)}s.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(o.username||o.password)&&(s.auth=`${o.username}:${o.password}`),a){let h=s.path.split(":");s.socketPath=h[0],s.path=h[1]}let m;if(s.followRedirects){if(t._redirects===0){t._originalIpc=a,t._originalSecure=i,t._originalHostOrSocketPath=a?s.socketPath:o.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[g,y]of Object.entries(h))n.headers[g.toLowerCase()]=y}else if(t.listenerCount("redirect")===0){let h=a?t._originalIpc?s.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:o.host===t._originalHostOrSocketPath;(!h||t._originalSecure&&!i)&&(delete s.headers.authorization,delete s.headers.cookie,h||delete s.headers.host,s.auth=void 0)}s.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),m=t._req=d(s),t._redirects&&t.emit("redirect",t.url,m)}else m=t._req=d(s);s.timeout&&m.on("timeout",()=>{or(t,m,"Opening handshake has timed out")}),m.on("error",h=>{m===null||m[tZ]||(m=t._req=null,Km(t,h))}),m.on("response",h=>{let g=h.headers.location,y=h.statusCode;if(g&&s.followRedirects&&y>=300&&y<400){if(++t._redirects>s.maxRedirects){or(t,m,"Maximum redirects exceeded");return}m.abort();let w;try{w=new eE(g,e)}catch{let x=new SyntaxError(`Invalid URL: ${g}`);Km(t,x);return}rZ(t,w,r,n)}else t.emit("unexpected-response",m,h)||or(t,m,`Unexpected server response: ${h.statusCode}`)}),m.on("upgrade",(h,g,y)=>{if(t.emit("upgrade",h),t.readyState!==Ke.CONNECTING)return;m=t._req=null;let w=h.headers.upgrade;if(w===void 0||w.toLowerCase()!=="websocket"){or(t,g,"Invalid Upgrade header");return}let b=Eie("sha1").update(u+Nie).digest("base64");if(h.headers["sec-websocket-accept"]!==b){or(t,g,"Invalid Sec-WebSocket-Accept header");return}let x=h.headers["sec-websocket-protocol"],v;if(x!==void 0?f.size?f.has(x)||(v="Server sent an invalid subprotocol"):v="Server sent a subprotocol but none was requested":f.size&&(v="Server sent no subprotocol"),v){or(t,g,v);return}x&&(t._protocol=x);let S=h.headers["sec-websocket-extensions"];if(S!==void 0){if(!p){or(t,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let T;try{T=Mie(S)}catch{or(t,g,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(T);if(I.length!==1||I[0]!==Rs.extensionName){or(t,g,"Server indicated an extension that was not requested");return}try{p.accept(T[Rs.extensionName])}catch{or(t,g,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Rs.extensionName]=p}t.setSocket(g,y,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(m,t):m.end()}function Km(t,e){t._readyState=Ke.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function qie(t){return t.path=t.socketPath,QF.connect(t)}function Fie(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=QF.isIP(t.host)?"":t.host),kie.connect(t)}function or(t,e,r){t._readyState=Ke.CLOSING;let n=new Error(r);Error.captureStackTrace(n,or),e.setHeader?(e[tZ]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Km,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function nE(t,e,r){if(e){let n=Oie(e)?e.size:Lie(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${qn[t.readyState]})`);process.nextTick(r,n)}}function Zie(t,e){let r=this[at];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[at]!==void 0&&(r._socket.removeListener("data",Hm),process.nextTick(nZ,r._socket),t===1005?r.close():r.close(t,e))}function Uie(){let t=this[at];t.isPaused||t._socket.resume()}function Vie(t){let e=this[at];e._socket[at]!==void 0&&(e._socket.removeListener("data",Hm),process.nextTick(nZ,e._socket),e.close(t[Rie])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function XF(){this[at].emitClose()}function Bie(t,e){this[at].emit("message",t,e)}function Kie(t){let e=this[at];e._autoPong&&e.pong(t,!this._isServer,eZ),e.emit("ping",t)}function Hie(t){this[at].emit("pong",t)}function nZ(t){t.resume()}function Wie(t){let e=this[at];e.readyState!==Ke.CLOSED&&(e.readyState===Ke.OPEN&&(e._readyState=Ke.CLOSING,sZ(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function sZ(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function oZ(){let t=this[at];if(this.removeListener("close",oZ),this.removeListener("data",Hm),this.removeListener("end",iZ),t._readyState=Ke.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[at]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",XF),t._receiver.on("finish",XF))}function Hm(t){this[at]._receiver.write(t)||this.pause()}function iZ(){let t=this[at];t._readyState=Ke.CLOSING,t._receiver.end(),this.end()}function aZ(){let t=this[at];this.removeListener("error",aZ),this.on("error",eZ),t&&(t._readyState=Ke.CLOSING,this.destroy())}});var fZ=_((A0e,dZ)=>{"use strict";var R0e=Wm(),{Duplex:Jie}=ze("stream");function lZ(t){t.emit("close")}function Gie(){!this.destroyed&&this._writableState.finished&&this.destroy()}function uZ(t){this.removeListener("error",uZ),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Yie(t,e){let r=!0,n=new Jie({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(o,i){let a=!i&&n._readableState.objectMode?o.toString():o;n.push(a)||t.pause()}),t.once("error",function(o){n.destroyed||(r=!1,n.destroy(o))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(s,o){if(t.readyState===t.CLOSED){o(s),process.nextTick(lZ,n);return}let i=!1;t.once("error",function(c){i=!0,o(c)}),t.once("close",function(){i||o(s),process.nextTick(lZ,n)}),r&&t.terminate()},n._final=function(s){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(s)});return}t._socket!==null&&(t._socket._writableState.finished?(s(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){s()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(s,o,i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(s,o,i)});return}t.send(s,i)},n.on("end",Gie),n.on("error",uZ),n}dZ.exports=Yie});var sE=_((z0e,pZ)=>{"use strict";var{tokenChars:Xie}=Ta();function Qie(t){let e=new Set,r=-1,n=-1,s=0;for(s;s<t.length;s++){let i=t.charCodeAt(s);if(n===-1&&Xie[i]===1)r===-1&&(r=s);else if(s!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=s);else if(i===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${s}`);n===-1&&(n=s);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let o=t.slice(r,s);if(e.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);return e.add(o),e}pZ.exports={parse:Qie}});var wZ=_((M0e,vZ)=>{"use strict";var eae=ze("events"),Jm=ze("http"),{Duplex:j0e}=ze("stream"),{createHash:tae}=ze("crypto"),hZ=Vm(),jo=Ea(),rae=sE(),nae=Wm(),{CLOSE_TIMEOUT:sae,GUID:oae,kWebSocket:iae}=Mn(),aae=/^[+/0-9A-Za-z]{22}==$/,mZ=0,gZ=1,_Z=2,oE=class extends eae{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:sae,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:nae,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Jm.createServer((n,s)=>{let o=Jm.STATUS_CODES[426];s.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),s.end(o)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=cae(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,o,i)=>{this.handleUpgrade(s,o,i,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=mZ}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===_Z){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(nd,this);return}if(e&&this.once("close",e),this._state!==gZ)if(this._state=gZ,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(nd,this):process.nextTick(nd,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{nd(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,s){r.on("error",yZ);let o=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Mo(this,e,r,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Mo(this,e,r,400,"Invalid Upgrade header");return}if(o===void 0||!aae.test(o)){Mo(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){Mo(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){sd(r,400);return}let c=e.headers["sec-websocket-protocol"],l=new Set;if(c!==void 0)try{l=rae.parse(c)}catch{Mo(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&u!==void 0){let f=new jo({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let p=hZ.parse(u);p[jo.extensionName]&&(f.accept(p[jo.extensionName]),d[jo.extensionName]=f)}catch{Mo(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(p,m,h,g)=>{if(!p)return sd(r,m||401,h,g);this.completeUpgrade(d,o,l,e,r,n,s)});return}if(!this.options.verifyClient(f))return sd(r,401)}this.completeUpgrade(d,o,l,e,r,n,s)}completeUpgrade(e,r,n,s,o,i,a){if(!o.readable||!o.writable)return o.destroy();if(o[iae])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>mZ)return sd(o,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${tae("sha1").update(r+oae).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,s):n.values().next().value;d&&(l.push(`Sec-WebSocket-Protocol: ${d}`),u._protocol=d)}if(e[jo.extensionName]){let d=e[jo.extensionName].params,f=hZ.format({[jo.extensionName]:[d]});l.push(`Sec-WebSocket-Extensions: ${f}`),u._extensions=e}this.emit("headers",l,s),o.write(l.concat(`\r
|
|
317
|
+
`).join(`\r
|
|
318
|
+
`)),o.removeListener("error",yZ),u.setSocket(o,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(nd,this)})),a(u,s)}};vZ.exports=oE;function cae(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function nd(t){t._state=_Z,t.emit("close")}function yZ(){this.destroy()}function sd(t,e,r,n){r=r||Jm.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Jm.STATUS_CODES[e]}\r
|
|
319
|
+
`+Object.keys(n).map(s=>`${s}: ${n[s]}`).join(`\r
|
|
320
|
+
`)+`\r
|
|
321
|
+
\r
|
|
322
|
+
`+r)}function Mo(t,e,r,n,s,o){if(t.listenerCount("wsClientError")){let i=new Error(s);Error.captureStackTrace(i,Mo),t.emit("wsClientError",i,r,e)}else sd(r,n,s,o)}});var lae,uae,dae,fae,pae,hae,mae,iE,bZ=$(()=>{lae=Fe(fZ(),1),uae=Fe(Vm(),1),dae=Fe(Ea(),1),fae=Fe(Jx(),1),pae=Fe(Xx(),1),hae=Fe(sE(),1),mae=Fe(Wm(),1),iE=Fe(wZ(),1)});import{randomUUID as gae}from"node:crypto";var od,yae,_ae,vae,wae,bae,Gm,SZ=$(()=>{"use strict";bZ();Ju();xr();xc();od=4401,yae=4429,_ae=1003,vae=1001,wae=4409,bae=64*1024*1024,Gm=class{options;wss=new iE.default({noServer:!0,maxPayload:bae,perMessageDeflate:!1});clients=new Set;relay=new $a;lease=null;closed=!1;constructor(e){this.options=e,this.relay.setParkListener(()=>this.flushCalls())}handleUpgrade(e,r,n){let s=(a,c,l)=>{this.options.log(`events: upgrade refused ${a} (${l})`),r.write(`HTTP/1.1 ${a} ${c}\r
|
|
323
|
+
Connection: close\r
|
|
324
|
+
Content-Length: 0\r
|
|
325
|
+
\r
|
|
326
|
+
`),r.destroy()},o=new URL(e.url??"/","http://127.0.0.1");if(!oi(e.headers.host))return s(403,"Forbidden",`host ${JSON.stringify(e.headers.host??null)}`);let i=Df(e);if(!ii(i))return s(403,"Forbidden",`origin ${i}`);if(o.pathname!=="/ws/events")return s(404,"Not Found",`path ${o.pathname}`);if(this.closed)return s(503,"Service Unavailable","server shutting down");this.wss.handleUpgrade(e,r,n,a=>this.onSocket(a))}broadcast(e){let r=JSON.stringify(e);for(let n of this.clients)n.authed&&n.socket.readyState===n.socket.OPEN&&n.socket.send(r)}get leaseState(){return this.lease?"held":"free"}isLeased(){return this.lease!==null}enqueueCall(e,r,n=si,s){return this.lease?this.relay.park(e,r,n,s):Promise.resolve(Hu("no_editor","No Pix3 editor window holds this workspace."))}get holderState(){return this.lease?this.lease.client?"connected":"grace":null}ping(e){let r=Date.now();for(let n of this.clients)if(n.authed){if(r-n.lastSeen>e*3){n.socket.terminate();continue}this.send(n,{type:"ping"})}}enforceToken(e){for(let r of this.clients)!r.authed||r.tokenHash===e||(this.lease?.client===r&&this.endLease("revoked",{requeue:!1}),this.closeClient(r,od,"revoked","The pairing token was rotated or revoked."))}close(){if(!this.closed){this.closed=!0,this.lease?.graceTimer&&clearTimeout(this.lease.graceTimer),this.lease=null,this.relay.cancelAll("The Pix3 workspace server is shutting down.");for(let e of this.clients)e.authTimer&&clearTimeout(e.authTimer),e.socket.close(vae,"server shutting down"),e.socket.terminate();this.clients.clear(),this.wss.close()}}onSocket(e){let r={socket:e,authed:!1,tokenHash:null,lastSeen:Date.now(),authTimer:null,refused:!1};this.clients.add(r),r.authTimer=setTimeout(()=>{r.authed||this.closeClient(r,od,"auth_timeout","No auth frame in time.")},this.options.authTimeoutMs??iN),e.on("message",(n,s)=>this.onFrame(r,n,s)),e.on("close",()=>this.onSocketClosed(r)),e.on("error",()=>e.terminate())}authedCount(){let e=0;for(let r of this.clients)r.authed&&(e+=1);return e}send(e,r){e.socket.readyState===e.socket.OPEN&&e.socket.send(JSON.stringify(r))}error(e,r,n,s={}){this.send(e,{type:"error",error:r,message:n,...s})}closeClient(e,r,n,s){(!e.authed||n==="revoked")&&(this.options.log(`events: auth refused ${r} ${n} (${s})`),e.refused=!0),this.error(e,n,s),e.socket.close(r,n)}onFrame(e,r,n){if(e.lastSeen=Date.now(),n){this.closeClient(e,_ae,"bad_frame","Frames are JSON text.");return}let s;try{let o=Array.isArray(r)?Buffer.concat(r).toString("utf8"):r.toString(),i=JSON.parse(o);if(!C_(i))throw new Error("not an object");s=i}catch{e.authed?this.error(e,"bad_frame","Frames are JSON objects."):this.closeClient(e,od,"unauthorized","The first frame must be JSON.");return}if(!e.authed){this.onAuthFrame(e,s);return}switch(s.type){case"ping":this.send(e,{type:"pong"});return;case"pong":return;case"lease":this.onLeaseFrame(e,s);return;case"call-result":this.onCallResult(e,s);return;default:this.error(e,"unknown_frame","Unknown frame type.")}}onAuthFrame(e,r){if(r.type!=="auth"||typeof r.token!="string"){this.closeClient(e,od,"unauthorized",'The first frame must be {type:"auth", token}.');return}let n=this.options.auth.check(r.token);if(!n.ok){n.code==="rate_limited"?this.closeClient(e,yae,"rate_limited",`Too many failed attempts; retry in ${n.retryAfter} s.`):this.closeClient(e,od,"unauthorized","Wrong or revoked token.");return}e.authed=!0,e.tokenHash=n.tokenHash,this.options.log(`events: socket authenticated (${this.authedCount()} open)`),e.authTimer&&clearTimeout(e.authTimer),e.authTimer=null,this.send(e,this.options.hello())}granted(e,r,n){this.send(e,{type:"lease",state:"granted",leaseId:r.leaseId,resumed:n})}onLeaseFrame(e,r){let n=r.action,s=this.lease;if(n==="acquire"){if(!s)this.grantLease(e);else if(s.client===e)this.granted(e,s,!1);else if(s.client===null&&typeof r.leaseId=="string"&&r.leaseId===s.leaseId)s.graceTimer&&clearTimeout(s.graceTimer),s.graceTimer=null,s.client=e,this.options.log(`lease ${s.leaseId.slice(0,8)} resumed`),this.granted(e,s,!0),this.relay.requeueDelivered(),this.flushCalls();else if(typeof r.leaseId=="string"&&r.leaseId===s.leaseId)this.moveLease(s,e);else{let o=s.client===null,i=o?typeof r.leaseId=="string"?"holder in grace, leaseId does not match":"holder in grace, no leaseId":"another window holds it";this.options.log(`lease acquire refused: busy (${i})`),this.send(e,{type:"lease",state:"busy",inGrace:o})}return}if(n==="takeover"){if(s&&s.client===e){this.granted(e,s,!1);return}s&&this.endLease("taken_over",{requeue:!0}),this.grantLease(e);return}if(n==="release"){s&&s.client===e&&(this.lease=null,this.options.log(`lease ${s.leaseId.slice(0,8)} released`),this.relay.cancelAll("The Pix3 editor window released the workspace.")),this.send(e,{type:"lease",state:"released"});return}this.error(e,"bad_frame","lease.action must be acquire, release or takeover.")}moveLease(e,r){let n=e.client;e.client=r,this.options.log(`lease ${e.leaseId.slice(0,8)} resumed on a new socket`),n&&(this.send(n,{type:"lease",state:"lost",reason:"resumed_elsewhere",leaseId:e.leaseId}),n.socket.close(wae,"lease resumed elsewhere")),this.granted(r,e,!0),this.relay.requeueDelivered(),this.flushCalls()}grantLease(e){let r={leaseId:gae(),client:e,graceTimer:null};this.lease=r,this.options.log(`lease ${r.leaseId.slice(0,8)} granted`),this.granted(e,r,!1),this.flushCalls()}endLease(e,r){let n=this.lease;n&&(this.lease=null,n.graceTimer&&clearTimeout(n.graceTimer),this.options.log(`lease ${n.leaseId.slice(0,8)} ${e}`),n.client&&this.send(n.client,{type:"lease",state:"lost",reason:e,leaseId:n.leaseId}),r.requeue?this.relay.requeueDelivered():this.relay.cancelAll(`The Pix3 editor window lost the workspace lease (${e}).`))}onSocketClosed(e){e.authTimer&&clearTimeout(e.authTimer),!e.authed&&!e.refused&&!this.closed&&this.options.log("events: socket closed by the client before auth"),this.clients.delete(e);let r=this.lease;!r||r.client!==e||this.closed||(r.client=null,r.graceTimer=setTimeout(()=>{this.lease===r&&r.client===null&&this.endLease("expired",{requeue:!1})},this.options.leaseGraceMs??Lf),r.graceTimer.unref())}flushCalls(){let e=this.lease?.client;if(!(!e||e.socket.readyState!==e.socket.OPEN))for(let r of this.relay.takeUnflushed())this.send(e,{...r.extra,type:"call",id:r.id,name:r.name,input:r.input})}onCallResult(e,r){let n=r.id??null;if(this.lease?.client!==e){this.error(e,"not_lease_holder","Only the lease holder answers calls.",{id:n});return}let s=Tm(r.result);if(typeof r.id!="string"||!s){this.error(e,"bad_result",'call-result needs { id, result: { content: [{ type: "text", text }], isError? } }.',{id:n});return}this.relay.resolve(r.id,s)||this.error(e,"unknown_call","No pending call with that id.",{id:n})}}});import{readFileSync as Sae}from"node:fs";import{basename as $ae,join as kae}from"node:path";var $Z,id,aE=$(()=>{"use strict";$Z=Fe(kr(),1);lt();id=t=>{try{let e=(0,$Z.parse)(Sae(kae(t,xe),"utf8"));if(e&&typeof e=="object"){let r=e.metadata;if(r&&typeof r=="object"){let n=r.projectName;if(typeof n=="string"&&n.trim())return n.trim()}}}catch{}return $ae(t)}});import{watch as xae}from"node:fs";import{join as Eae}from"node:path";var Ym,kZ=$(()=>{"use strict";Cm();Ym=class{watchers=new Map;root;onPath;log;warnedLimit=!1;constructor(e,r,n){this.root=e,this.onPath=r,this.log=n}sync(e,r=[]){let n=new Set(["",...r]);for(let s of e)Ns(s)||n.add(s);for(let[s,o]of this.watchers)n.has(s)||(o.close(),this.watchers.delete(s));for(let s of n)this.watchers.has(s)||this.add(s)}close(){for(let e of this.watchers.values())e.close();this.watchers.clear()}get size(){return this.watchers.size}add(e){let r=e?Eae(this.root,...e.split("/")):this.root,n;try{n=xae(r,{persistent:!1},(s,o)=>{let i=typeof o=="string"?o:null;if(i===null){this.onPath(e);return}this.onPath(e?`${e}/${i}`:i)})}catch(s){this.reportError(e,s);return}n.on("error",s=>{n.close(),this.watchers.get(e)===n&&this.watchers.delete(e),this.reportError(e,s),this.onPath(e)}),this.watchers.set(e,n)}reportError(e,r){let n=r&&typeof r=="object"&&"code"in r?String(r.code):"";if(!(n==="ENOENT"||n==="EPERM")){if(n==="ENOSPC"||n==="EMFILE"){this.warnedLimit||(this.warnedLimit=!0,this.log(`file watch limit reached (${n}) \u2014 some folders are not watched; the editor still sees their changes on its next full scan. Raise fs.inotify.max_user_watches to fix.`));return}this.log(`watch ${e||"."}: ${r instanceof Error?r.message:String(r)}`)}}}});import{createHash as hE,randomBytes as cE,randomUUID as Tae}from"node:crypto";import{createWriteStream as xZ}from"node:fs";import{chmod as Pae,lstat as ad,mkdir as Xm,open as EZ,rename as lE,rm as uE,rmdir as Oae,stat as Iae,unlink as Nae}from"node:fs/promises";import{createServer as Cae}from"node:http";import{basename as Rae,dirname as dE,join as Ca}from"node:path";import{Transform as Aae}from"node:stream";import{pipeline as fE}from"node:stream/promises";var TZ,zae,jae,Qm,Mae,PZ,Lae,Dae,qae,Fae,Zae,Ra,pE,Fn,Uae,Vae,OZ,eg,IZ=$(()=>{"use strict";Ju();lt();xr();xc();ar();pF();hF();mF();yF();SZ();qf();aE();Cm();Tc();kZ();TZ=1024*1024*1024,zae=8*1024*1024,jae=2e3,Qm=2e4,Mae=/^[A-Za-z0-9_.:-]{1,128}$/,PZ=12e4,Lae=5e3,Dae=/^[0-9a-f]{64}$/,qae=1e3,Fae="Authorization, Content-Type, If-Match, If-None-Match, X-Mutation-Id, Range",Zae="ETag, Content-Range, Content-Length, Accept-Ranges, X-Mutation-Replayed",Ra=t=>t&&typeof t=="object"&&"code"in t?String(t.code):void 0,pE=t=>t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith("W/")?e.slice(2):e).map(e=>e.startsWith('"')&&e.endsWith('"')&&e.length>=2?e.slice(1,-1):e),Fn=(t,e)=>{let r=t.headers[e];return typeof r=="string"?r:Array.isArray(r)?r.join(", "):null},Uae=(t,e)=>{if(!t)return null;let r=/^bytes=(\d*)-(\d*)$/.exec(t.trim());if(!r)return null;let[,n,s]=r;if(!n&&!s)return null;if(!n){let a=Number(s);return a===0?"unsatisfiable":{start:Math.max(0,e-a),end:e-1}}let o=Number(n),i=s?Math.min(Number(s),e-1):e-1;return o>=e||i<o?"unsatisfiable":{start:o,end:i}},Vae=async t=>{let e=hE("sha256"),r=t.createReadStream({start:0,autoClose:!1});for await(let n of r)e.update(n);return e.digest("hex")},OZ=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return{name:typeof e.name=="string"?e.name.slice(0,120):null,session:typeof e.session=="string"?e.session.slice(0,80):null}},eg=class{serverSession=Tae();root;workspaceId;control=cE(24).toString("base64url");options;log;cache=new Nm;table=new Map;journal=new Map;auth;hub;watcher;server=null;boundPort=null;seq=0;revisionMemo=null;serialTail=Promise.resolve();dirty=new Set;debounceTimer=null;firstDirtyAt=0;pingTimer=null;stateTimer=null;closed=!1;ackHash=null;ackTimer=null;changeLog=new Rm;presence;constructor(e){this.options=e,this.root=e.root,this.log=e.log??(()=>{});let r=Tr(e.root);if(!r)throw new Error(`No workspace identity in ${e.root}/.pix3/workspace.json.`);this.workspaceId=r.workspaceId,this.auth=new zm({root:e.root,workspaceId:r.workspaceId,failureLimit:e.authFailureLimit??10,failureWindowMs:e.authFailureWindowMs??6e4}),this.hub=new Gm({auth:this.auth,hello:()=>this.helloFrame(),log:this.log,authTimeoutMs:e.authTimeoutMs,leaseGraceMs:e.leaseGraceMs}),this.watcher=new Ym(e.root,n=>this.markDirty(n),this.log),this.presence=new Am(n=>{this.log(n.attached?`agent attached (${n.agent?.name??"unnamed"})`:"agent detached"),this.hub.broadcast(this.presenceFrame(n))},e.agentPresenceTtlMs)}get agentPresence(){return this.presence.snapshot()}presenceFrame(e){return{type:"agent-presence",attached:e.attached,agent:e.agent}}get port(){return this.boundPort}revision(){return this.revisionMemo??=cF(this.table),this.revisionMemo}get currentSeq(){return this.seq}async start(){await this.serial(async()=>{let s=new Map;await Yu(this.root,"",this.cache,s),Mx(this.table,[""],s),this.revisionMemo=null,this.syncWatcher(),this.ackHash=await this.currentHashOf(Er,this.ackAbsolute())});let e=this.options.ports??Mf,r=null;for(let s of e){let o=Cae((a,c)=>{this.handle(a,c)});o.on("upgrade",(a,c,l)=>this.hub.handleUpgrade(a,c,l));try{await new Promise((a,c)=>{o.once("error",c),o.listen(s,Jt,()=>{o.off("error",c),a()})})}catch(a){r=a;continue}let i=o.address();this.server=o,this.boundPort=typeof i=="object"&&i?i.port:s;break}if(this.server===null||this.boundPort===null){this.watcher.close();let s=Ra(r)==="EADDRINUSE";throw new Error(e.length===1?`Port ${e[0]} on ${Jt} is ${s?"already in use":"not available"}`+(r instanceof Error&&!s?` (${r.message})`:"")+". Pick another with --port, or omit --port to take the first free one of 8490\u20138499.":`No free port for pix3 serve in ${e[0]}\u2013${e[e.length-1]}.`)}wN(this.root,{pid:process.pid,port:this.boundPort,serverSession:this.serverSession,control:this.control,startedAt:new Date().toISOString()});let n=this.options.pingIntervalMs??aN;return this.pingTimer=setInterval(()=>this.hub.ping(n),n),this.pingTimer.unref(),this.stateTimer=setInterval(()=>this.hub.enforceToken(this.auth.current()?.sha256??null),this.options.stateCheckIntervalMs??2e3),this.stateTimer.unref(),this.boundPort}async close(){if(this.closed)return;this.closed=!0,this.debounceTimer&&clearTimeout(this.debounceTimer),this.ackTimer&&clearTimeout(this.ackTimer),this.pingTimer&&clearInterval(this.pingTimer),this.stateTimer&&clearInterval(this.stateTimer),this.presence.close(),this.watcher.close(),this.hub.close();let e=this.server;this.server=null,e&&(e.closeAllConnections(),await new Promise(r=>e.close(()=>r()))),await this.serialTail.catch(()=>{}),bN(this.root,this.serverSession),this.boundPort=null,this.options.onClosed?.()}get controlSecret(){return this.control}isLeased(){return this.hub.isLeased()}enqueueCall(e,r,n=si,s){return this.hub.enqueueCall(e,r,n,s)}changesSince(e){return this.changeLog.since(e)}serial(e){let r=this.serialTail.then(e,e);return this.serialTail=r.catch(()=>{}),r}nextSeq(){return this.seq+=1,this.seq}logChange(e,r,n){let s=new Set;for(let o of r)if(o.kind==="file")for(let i of o.from?[o.path,o.from]:[o.path])i&&!Ns(i)&&s.add(i);s.size>0&&this.changeLog.record(e,s,n)}syncWatcher(){let e=[];for(let[r,n]of this.table)n.kind==="dir"&&e.push(r);this.watcher.sync(e,[Rt])}async rescan(e){let r=new Map;for(let s of e)await Yu(this.root,s,this.cache,r);let n=Mx(this.table,e,r);return n.length>0&&(this.revisionMemo=null),this.syncWatcher(),n}broadcastChange(e){if(e.length===0)return;let r=this.nextSeq();this.logChange(r,e,"external"),this.hub.broadcast({type:"change",seq:r,revision:this.revision(),events:e})}markDirty(e){if(this.closed)return;if(e===Er||e===Rt){this.noteInternalChange();return}if(e&&Ns(e))return;this.dirty.size===0&&(this.firstDirtyAt=Date.now()),this.dirty.add(e),this.debounceTimer&&clearTimeout(this.debounceTimer);let r=this.options.debounceMs??N_,n=Date.now()-this.firstDirtyAt,s=Math.max(0,Math.min(r,qae-n));this.debounceTimer=setTimeout(()=>{this.flushDirty()},s)}async flushDirty(){this.debounceTimer=null;let e=[...this.dirty].sort();this.dirty=new Set;let r=[];for(let n of e)r.some(s=>s===""||n===s||n.startsWith(`${s}/`))||r.push(n);try{await this.serial(async()=>{this.closed||this.broadcastChange(await this.rescan(r))})}catch(n){this.log(`rescan failed: ${n instanceof Error?n.message:String(n)}`)}}ackAbsolute(){return Ca(this.root,...Er.split("/"))}noteInternalChange(){this.ackTimer&&clearTimeout(this.ackTimer),this.ackTimer=setTimeout(()=>{this.ackTimer=null,this.serial(async()=>{if(this.closed)return;let e=await this.currentHashOf(Er,this.ackAbsolute()),r=this.ackHash;if(e===r)return;this.ackHash=e;let n=e===null?{op:"delete",path:Er,kind:"file"}:{op:r===null?"create":"modify",path:Er,kind:"file",sha256:e};this.broadcastChange([n])}).catch(e=>{this.log(`ack check failed: ${e instanceof Error?e.message:String(e)}`)})},this.options.debounceMs??N_)}async refreshAckHash(...e){e.some(n=>Er===n||Er.startsWith(`${n}/`))&&(this.ackHash=await this.currentHashOf(Er,this.ackAbsolute()))}recordOwnFile(e,r,n){if(e===Er&&(this.ackHash=n),Ns(e))return;let s={kind:"file",size:Number(r.size),mtime:Co(r),statKey:Is(r),sha256:n};this.cache.remember(e,s.statKey,n),this.table.set(e,s),this.revisionMemo=null}async recordAncestors(e){let r=[];for(let s=Ec(e);s!==null;s=Ec(s))r.unshift(s);let n=!1;for(let s of r)if(!(this.table.has(s)||Ns(`${s}/x`)))try{let o=await ad(Ca(this.root,...s.split("/")),{bigint:!0});if(!o.isDirectory())continue;this.table.set(s,{kind:"dir",size:0,mtime:Co(o),statKey:Is(o)}),n=!0}catch{}n&&this.syncWatcher()}authorize(e,r){if(r){let i=Fn(e,"x-pix3-control");if(i&&i===this.control)return}let n=Fn(e,"authorization")??"",s=/^Bearer\s+(\S+)$/i.exec(n.trim()),o=this.auth.check(s?s[1]:"");if(!o.ok)throw o.code==="rate_limited"?new M(429,"rate_limited",`Too many failed attempts; retry in ${o.retryAfter} s.`,{retryAfter:o.retryAfter}):new M(401,"unauthorized","Missing, wrong or revoked token (Authorization: Bearer <token>).")}helloFrame(){return{type:"hello",workspaceId:this.workspaceId,serverSession:this.serverSession,protocol:I_,cliVersion:be,revision:this.revision(),seq:this.seq,root:this.root,projectId:Fs(this.root),projectName:id(this.root),lease:this.hub.leaseState,leaseGraceMs:this.options.leaseGraceMs??Lf,agentPresence:this.presence.snapshot()}}corsHeaders(e){return e?{"Access-Control-Allow-Origin":e,"Access-Control-Expose-Headers":Zae,Vary:"Origin"}:{}}async handle(e,r){let n=Df(e);try{if(!oi(e.headers.host)){Gt(r,403,{error:"forbidden_host",message:"Forbidden host."},null);return}if(!ii(n)){this.log(`403 origin ${n}`),Gt(r,403,{error:"forbidden_origin",message:"Origin not allowed."},null);return}if(e.method==="OPTIONS"){this.preflight(e,r,n);return}await this.route(e,r,n)}catch(s){s instanceof M||this.log(`500 ${e.method} ${e.url}: ${s instanceof Error?s.stack:String(s)}`);let o=this.errorOutcome(s);if(r.headersSent){r.destroy();return}let i=this.corsHeaders(n);o.status===401&&(i["WWW-Authenticate"]="Bearer"),o.status===429&&typeof o.body.retryAfter=="number"&&(i["Retry-After"]=String(o.body.retryAfter)),e.resume(),Gt(r,o.status,o.body,null,i)}}errorOutcome(e){return e instanceof M?{status:e.status,body:{error:e.code,message:e.message,...e.extra}}:{status:500,body:{error:"internal",message:"Internal error."}}}preflight(e,r,n){let s={"Access-Control-Allow-Methods":"GET, HEAD, PUT, POST, OPTIONS","Access-Control-Allow-Headers":Fae,"Access-Control-Max-Age":"600","Cache-Control":"no-store",...this.corsHeaders(n)};e.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),r.writeHead(204,s),r.end()}async route(e,r,n){let s=new URL(e.url??"/","http://127.0.0.1"),o=s.pathname,i=e.method??"GET";if(i==="GET"&&o==="/ws/status"){this.authorize(e,!0),Gt(r,200,this.statusBody(),n,this.corsHeaders(n));return}if(i==="GET"&&o==="/ws/revision"){this.authorize(e,!0),Gt(r,200,{revision:this.revision(),seq:this.seq,serverSession:this.serverSession},n,this.corsHeaders(n));return}if(o.startsWith("/ws/agent/")){await this.agentRoute(e,r,s,i,n);return}if(this.authorize(e,!1),(i==="GET"||i==="HEAD")&&o==="/ws/file"){await this.readFile(e,r,s,n,i==="HEAD");return}if(i==="GET"&&o==="/ws/manifest"){let a=await this.manifest();Gt(r,200,a,n,this.corsHeaders(n));return}if(i==="POST"&&o==="/ws/hash"){let a=await Jr(e);Gt(r,200,await this.hashPaths(a),n,this.corsHeaders(n));return}if(i==="PUT"&&o==="/ws/file"){await this.writeFile(e,r,s,n);return}if(i==="POST"&&(o==="/ws/mkdir"||o==="/ws/delete"||o==="/ws/move")){let a=await Jr(e);await this.jsonMutation(e,r,n,o.slice(4),a);return}throw new M(404,"not_found","Not found.")}async agentRoute(e,r,n,s,o){if(o!==null)throw new M(403,"forbidden_origin","The agent lane is for local processes (pix3 mcp); browsers never call it.");let i=Fn(e,"x-pix3-control");if(!i||i!==this.control)throw new M(401,"unauthorized","The agent lane needs X-Pix3-Control with the control secret from .pix3/workspace.json.");let a=n.pathname,c=l=>Gt(r,200,l,null);if(s==="GET"&&a==="/ws/agent/status"){c({...this.statusBody(),holder:this.hub.holderState,projectName:id(this.root),projectId:Fs(this.root),agentPresence:this.presence.snapshot()});return}if(s==="POST"&&a==="/ws/agent/presence"){let l=await Jr(e),u=OZ(l.agent),d=u?.session??"default";l.leaving===!0?this.presence.leave(d):this.presence.touch(d,u?.name??null),c({agentPresence:this.presence.snapshot()});return}if(s==="GET"&&a==="/ws/agent/tools"){this.requireEditor();let l=await this.enqueueCall("tools_manifest",{},Lae);this.throwRelayFailure(l,"tools_manifest");let u=null;try{let d=JSON.parse(Wu(l));u=d&&typeof d=="object"&&"tools"in d?d.tools:null}catch{u=null}if(!Array.isArray(u))throw new M(502,"bad_editor_reply","The editor sent no tool list.");c({tools:u,serverSession:this.serverSession});return}if(s==="POST"&&a==="/ws/agent/call"){let l=await Jr(e);if(typeof l.name!="string"||!l.name)throw new M(400,"bad_request","`name` must be a tool name.");let u=typeof l.timeoutMs=="number"?l.timeoutMs:PZ,d=Math.max(1e3,Math.min(PZ,u));this.requireEditor();let f=OZ(l.agent);f?.session&&this.presence.touch(f.session,f.name);let p=await this.enqueueCall(l.name,l.input??{},d,f?{agent:{name:f.name,session:f.session,verified:!1}}:void 0);this.throwRelayFailure(p,l.name),c({result:p});return}if(s==="POST"&&a==="/ws/agent/hash"){let l=await Jr(e);c(await this.hashPaths(l));return}if(s==="POST"&&a==="/ws/agent/expect"){let l=await Jr(e);c(await this.compareExpectations(l.expect));return}if(s==="GET"&&a==="/ws/agent/changes"){let l=n.searchParams.get("since")??"0";if(!/^\d{1,15}$/.test(l))throw new M(400,"bad_request","`since` must be a seq number.");await this.serial(async()=>{this.broadcastChange(await this.rescan([""]))});let u=Number(l),{paths:d,complete:f,entries:p}=this.changeLog.since(u);c({since:u,seq:this.seq,revision:this.revision(),paths:d,complete:f,entries:p.map(({seq:m,path:h,origin:g})=>({seq:m,path:h,origin:g}))});return}throw new M(404,"not_found","Not found.")}requireEditor(){if(!this.hub.isLeased())throw new M(409,"no_editor",`The Pix3 editor is not open on this project (or has another folder open). Open ${this.root} in Pix3: File \u2192 Connect to Workspace\u2026, address http://${Jt}:${this.boundPort??"?"} (the token \`pix3 serve\` printed). Files can still be edited meanwhile.`)}throwRelayFailure(e,r){switch(e.relayFailure){case void 0:return;case"timeout":throw new M(504,"no_editor_reply",`The Pix3 editor holds this workspace but did not answer "${r}" in time.`);case"no_editor":throw this.requireEditor(),new M(409,"no_editor",Wu(e));case"cancelled":throw new M(409,"lease_lost",Wu(e));case"overloaded":throw new M(429,"too_many_calls",Wu(e))}}async compareExpectations(e){if(!e||typeof e!="object"||Array.isArray(e))throw new M(400,"bad_request","`expect` must be an object {path: sha256}.");let r=Object.entries(e);if(r.length>Qm)throw new M(413,"too_many_paths",`At most ${Qm} paths.`);let n=new Map;for(let[a,c]of r){let l=vn(a,"expect");if(typeof c!="string"||!Dae.test(c.toLowerCase()))throw new M(400,"bad_request",`expect["${a}"] must be a hex sha256.`);n.set(l,c.toLowerCase())}let{hashes:s}=await this.hashPaths({paths:[...n.keys()]}),o=[],i=null;for(let[a,c]of n){let l=s[a]??null;if(l===c)continue;i??=await dF(this.root);let u=null;if(l!==null)try{u=Co(await ad(Ca(this.root,...a.split("/")),{bigint:!0}))}catch{u=null}let d=fF(i,a,l,u);o.push({path:a,diskHash:l,agentHash:c,recovery:await uF(this.root,a,c),...d?{mergeLog:!0}:{}})}return{matchesAgent:o.length===0,differing:o,hashes:s,seq:this.seq}}statusBody(){return{workspaceId:this.workspaceId,serverSession:this.serverSession,protocol:I_,cliVersion:be,root:this.root,pid:process.pid,port:this.boundPort,revision:this.revision(),seq:this.seq,leased:this.hub.isLeased()}}async manifest(){return this.serial(async()=>{this.broadcastChange(await this.rescan([""]));let e=await aF(this.root,this.cache),r=[...this.table.entries(),...e.entries()].sort(([n],[s])=>n<s?-1:n>s?1:0).map(([n,s])=>({path:n,kind:s.kind,size:s.size,mtime:s.mtime,...s.sha256?{sha256:s.sha256}:{}}));return{workspaceId:this.workspaceId,serverSession:this.serverSession,revision:this.revision(),seq:this.seq,files:r}})}async hashPaths(e){let r=e.paths;if(!Array.isArray(r))throw new M(400,"bad_request","`paths` must be an array of strings.");if(r.length>Qm)throw new M(413,"too_many_paths",`At most ${Qm} paths.`);let n=r.map((o,i)=>vn(o,`paths[${i}]`)),s={};for(let o of n){let i;try{i=await wn(this.root,o,{allowMissing:!0})}catch(a){if(a instanceof M&&a.code==="not_a_directory"){s[o]=null;continue}throw a}if(i.kind!=="file"){s[o]=null;continue}try{let a=await ad(i.absolute,{bigint:!0});s[o]=await this.cache.hash(o,i.absolute,a)}catch(a){if(Ra(a)!=="ENOENT")throw a;s[o]=null}}return{hashes:s,seq:this.seq}}async readFile(e,r,n,s,o){let i=vn(n.searchParams.get("path")??""),a=await wn(this.root,i,{allowMissing:!1});if(a.kind!=="file")throw new M(400,"not_a_file",`${i} is not a file.`);let c=await EZ(a.absolute,"r"),l=!1;try{let u=await c.stat({bigint:!0}),d=Number(u.size),f=null,p;if(d<=zae)f=await c.readFile(),p=hE("sha256").update(f).digest("hex"),this.cache.remember(i,Is(u),p);else{let T=Is(u);p=this.cachedHash(i,T)??await Vae(c),this.cache.remember(i,T,p)}let h={ETag:`"${p}"`,"Accept-Ranges":"bytes","Cache-Control":"private, no-cache","X-Content-Type-Options":"nosniff",...this.corsHeaders(s)},g=Fn(e,"if-none-match");if(g&&pE(g).some(T=>T==="*"||T===p)){r.writeHead(304,h),r.end();return}let y=Uae(Fn(e,"range"),d);if(y==="unsatisfiable"){r.writeHead(416,{...h,"Content-Range":`bytes */${d}`}),r.end();return}let w=y?y.start:0,b=y?y.end:d-1,x=d===0?0:b-w+1,v={...h,"Content-Type":gF(i),"Content-Length":String(x),...y?{"Content-Range":`bytes ${w}-${b}/${d}`}:{}};if(r.writeHead(y?206:200,v),o||x===0){r.end();return}if(f){r.end(y?f.subarray(w,b+1):f);return}l=!0;let S=c.createReadStream({start:w,end:b,autoClose:!0});await fE(S,r).catch(()=>{})}finally{l||await c.close()}}cachedHash(e,r){let n=this.table.get(e);return n&&n.statKey===r&&n.sha256?n.sha256:null}mutationId(e){let r=Fn(e,"x-mutation-id");if(r===null)return null;if(!Mae.test(r))throw new M(400,"bad_mutation_id","X-Mutation-Id must be 1\u2013128 chars of [A-Za-z0-9_.:-].");return r}async journaled(e,r,n,s,o){let i=this.mutationId(e),a=i?this.journal.get(i):void 0;if(i&&a){if(e.resume(),a.fingerprint!==s)throw new M(422,"mutation_id_reused","That X-Mutation-Id was used for a different request.");let u=await a.outcome;Gt(r,u.status,u.body,null,{...this.corsHeaders(n),"X-Mutation-Replayed":"true"});return}let c=o().catch(u=>(u instanceof M||this.log(`mutation failed: ${u instanceof Error?u.stack:String(u)}`),this.errorOutcome(u)));if(i&&(this.journal.set(i,{fingerprint:s,outcome:c}),this.journal.size>jae)){let u=this.journal.keys().next().value;u!==void 0&&this.journal.delete(u)}let l=await c;e.resume(),Gt(r,l.status,l.body,null,this.corsHeaders(n))}async currentHashOf(e,r){try{let n=await ad(r,{bigint:!0});return n.isFile()?await this.cache.hash(e,r,n):null}catch(n){if(Ra(n)==="ENOENT")return null;throw n}}async writeFile(e,r,n,s){let o=vn(n.searchParams.get("path")??""),i=Fn(e,"if-match"),a=Fn(e,"if-none-match"),c=i?pE(i):null,l=a!==null&&pE(a).includes("*"),u=`put
|
|
327
|
+
${o}
|
|
328
|
+
${i??""}
|
|
329
|
+
${a??""}`;await this.journaled(e,r,s,u,()=>this.performPut(e,o,c,l))}async performPut(e,r,n,s){if(Number(Fn(e,"content-length")??"0")>TZ)throw new M(413,"too_large","File too large.");await wn(this.root,r,{allowMissing:!0});let i=Ca(this.root,Rt,"tmp");await Xm(i,{recursive:!0,mode:448});let a=Ca(i,`put-${cE(8).toString("hex")}`),c=!0;try{let{sha256:l,size:u}=await this.streamBodyTo(e,a);return await this.serial(async()=>{let d=await wn(this.root,r,{allowMissing:!0});if(d.kind==="dir"||d.kind==="other")throw new M(409,"not_a_file",`${r} exists and is not a file.`);let f=d.kind==="file"?await this.currentHashOf(r,d.absolute):null;if(s&&f!==null)throw new M(409,"exists",`${r} already exists.`,{currentHash:f});if(n&&!n.includes("*")&&!n.includes(f??""))throw new M(409,"base_mismatch",`${r} changed since the base you edited.`,{currentHash:f});if(n&&n.includes("*")&&f===null)throw new M(409,"base_mismatch",`${r} does not exist.`,{currentHash:null});let p=dE(d.absolute);if(await Xm(p,{recursive:!0}),d.kind==="file"){let g=await Iae(d.absolute);await Pae(a,g.mode&4095)}await this.renameIntoPlace(a,d.absolute),c=!1;let m=await ad(d.absolute,{bigint:!0});await this.recordAncestors(r),this.recordOwnFile(r,m,l);let h=this.nextSeq();return this.logChange(h,[{op:"modify",path:r,kind:"file"}],"editor"),{status:200,body:{path:r,sha256:l,size:u,mtime:Co(m),seq:h}}})}finally{c&&await uE(a,{force:!0})}}async renameIntoPlace(e,r){try{await lE(e,r)}catch(n){if(Ra(n)!=="EXDEV")throw n;let s=Ca(dE(r),`.${Rae(r)}.pix3-tmp-${cE(6).toString("hex")}`),o=await EZ(e,"r");try{await fE(o.createReadStream(),xZ(s,{flags:"wx"}))}finally{await o.close().catch(()=>{})}await lE(s,r),await uE(e,{force:!0})}}async streamBodyTo(e,r){let n=hE("sha256"),s=0,o=new Aae({transform(i,a,c){if(s+=i.length,s>TZ){c(new M(413,"too_large","File too large."));return}n.update(i),c(null,i)}});return await fE(e,o,xZ(r,{flags:"wx"})),{sha256:n.digest("hex"),size:s}}async jsonMutation(e,r,n,s,o){if(s==="mkdir"){let l=vn(o.path);await this.journaled(e,r,n,`mkdir
|
|
330
|
+
${l}`,()=>this.serial(()=>this.performMkdir(l)));return}if(s==="delete"){let l=vn(o.path),u=o.recursive===!0;await this.journaled(e,r,n,`delete
|
|
331
|
+
${l}
|
|
332
|
+
${u}`,()=>this.serial(()=>this.performDelete(l,u)));return}let i=vn(o.from,"from"),a=vn(o.to,"to"),c=o.overwrite===!0;await this.journaled(e,r,n,`move
|
|
333
|
+
${i}
|
|
334
|
+
${a}
|
|
335
|
+
${c}`,()=>this.serial(()=>this.performMove(i,a,c)))}async performMkdir(e){let r=await wn(this.root,e,{allowMissing:!0});if(r.kind==="dir")return{status:200,body:{path:e,created:!1,seq:this.seq}};if(r.kind!==null)throw new M(409,"exists",`${e} exists and is not a directory.`);await Xm(r.absolute,{recursive:!0});let n=await this.rescan([this.topmostNew(e)]),s=this.nextSeq();return this.logChange(s,n,"editor"),{status:200,body:{path:e,created:!0,seq:s}}}topmostNew(e){let r=e;for(let n=Ec(e);n!==null&&!this.table.has(n);n=Ec(n))r=n;return r}async performDelete(e,r){let n=await wn(this.root,e,{allowMissing:!1});if(n.kind==="dir")if(r)await uE(n.absolute,{recursive:!0});else try{await Oae(n.absolute)}catch(i){throw Ra(i)==="ENOTEMPTY"||Ra(i)==="EEXIST"?new M(409,"not_empty",`${e} is not empty; pass recursive: true.`):i}else await Nae(n.absolute);let s=await this.rescan([e]);await this.refreshAckHash(e);let o=this.nextSeq();return this.logChange(o,s,"editor"),{status:200,body:{path:e,kind:n.kind==="dir"?"dir":"file",seq:o}}}async performMove(e,r,n){if(r===e||r.startsWith(`${e}/`))throw new M(400,"bad_move","`to` must not be `from` or inside it.");let s=await wn(this.root,e,{allowMissing:!1}),o=await wn(this.root,r,{allowMissing:!0});if(o.kind!==null){if(!n)throw new M(409,"exists",`${r} already exists.`);if(o.kind==="dir"||s.kind==="dir")throw new M(409,"exists",`${r} exists; only a file may overwrite a file.`)}await Xm(dE(o.absolute),{recursive:!0});for(let[l,u]of this.table)(l===e||l.startsWith(`${e}/`))&&u.sha256&&this.cache.remember(r+l.slice(e.length),u.statKey,u.sha256);await lE(s.absolute,o.absolute);let i=await this.rescan([e,this.topmostNew(r)]);await this.refreshAckHash(e,r);let a=this.table.get(r),c=this.nextSeq();return this.logChange(c,i,"editor"),{status:200,body:{from:e,to:r,kind:s.kind==="dir"?"dir":"file",...a?.sha256?{sha256:a.sha256}:{},seq:c}}}}});import{realpath as Bae}from"node:fs/promises";var Kae,NZ,CZ=$(()=>{"use strict";xr();Tc();IZ();Kae=async(t,e,r)=>{try{let n=await fetch(`http://${Jt}:${t}/ws/status`,{headers:{"X-Pix3-Control":e},signal:AbortSignal.timeout(r)});if(!n.ok)return null;let s=await n.json();return typeof s.workspaceId!="string"||typeof s.serverSession!="string"?null:{workspaceId:s.workspaceId,serverSession:s.serverSession}}catch{return null}},NZ=async t=>{let e=await Bae(t.projectDir),r=SN(e);if(!r.acquired){let n=t.rotateToken?D_(e,{rotateToken:!0}).issuedToken:null,s=Tr(e),o=s?.server;if(s&&o&&o.pid===r.pid){let i=await Kae(o.port,o.control,t.probeTimeoutMs??2e3);if(i&&i.serverSession===o.serverSession&&i.workspaceId===s.workspaceId)return{kind:"running",port:o.port,pid:o.pid,workspaceId:s.workspaceId,serverSession:o.serverSession,issuedToken:n}}return{kind:"unresponsive",pid:r.pid}}try{let n=D_(e,{rotateToken:t.rotateToken===!0}),s=new eg({...t,root:e,onClosed:r.release}),o=await s.start().catch(async i=>{throw await s.close().catch(()=>{}),i});return{kind:"started",server:s,port:o,identity:n}}catch(n){throw r.release(),n}}});var zZ={};We(zZ,{runServe:()=>Jae});import{existsSync as Hae}from"node:fs";import{join as RZ,resolve as AZ}from"node:path";var Wae,Jae,jZ=$(()=>{"use strict";lt();xr();CZ();aE();Wae=t=>{if(!/^\d{1,5}$/.test(t))throw new Error(`--port must be a number, got "${t}".`);let e=Number(t);if(e<1||e>65535)throw new Error(`--port must be 1\u201365535, got ${e}.`);return e},Jae=async t=>{let e=t.projectDir?AZ(t.cwd,t.projectDir):Xe(t.cwd)??AZ(t.cwd);if(!Hae(RZ(e,xe)))return process.stderr.write(`pix3 serve: ${e} is not a Pix3 project (no ${xe}). Run it inside the project folder, or pass --project <dir>.
|
|
336
|
+
`),1;let r=t.port===void 0?Mf:[Wae(t.port)],n=c=>{process.stdout.write(c)},s=await NZ({projectDir:e,ports:r,rotateToken:t.newToken,log:c=>process.stderr.write(`[pix3 serve] ${c}
|
|
337
|
+
`)});if(s.kind==="unresponsive")return process.stderr.write(`pix3 serve: another pix3 serve (pid ${s.pid}) holds ${e} but does not answer. Stop that process, or delete ${RZ(e,".pix3","serve.lock")} if it is not a pix3 serve.
|
|
338
|
+
`),1;if(s.kind==="running")return n(`pix3 serve is already running for ${e}
|
|
339
|
+
Address http://${Jt}:${s.port} (pid ${s.pid})
|
|
340
|
+
`),s.issuedToken&&n(` Token ${s.issuedToken}
|
|
341
|
+
New token issued; the running server now refuses the old one.
|
|
342
|
+
`),0;let{server:o,port:i,identity:a}=s;return n(`Pix3 workspace server
|
|
343
|
+
Project ${id(o.root)}
|
|
344
|
+
Root ${o.root}
|
|
345
|
+
Address http://${Jt}:${i}
|
|
346
|
+
Workspace ${o.workspaceId}
|
|
347
|
+
`),a.issuedToken?n(` Token ${a.issuedToken}
|
|
348
|
+
Shown once: paste it into Pix3 (File \u2192 Connect to Workspace\u2026) with the address.
|
|
349
|
+
`+(a.minted==="moved"?` (This folder was copied from another workspace; it got its own identity.)
|
|
350
|
+
`:"")):n(" Token paired earlier (not shown again); `pix3 serve --new-token` issues a new one.\n"),n(`
|
|
351
|
+
Forward port ${i} to your computer (VS Code: Ports panel, or ssh -L ${i}:127.0.0.1:${i}),
|
|
352
|
+
then connect from Pix3 with the address and token. Ctrl+C stops the server.
|
|
353
|
+
`),await new Promise(c=>{let l=!1,u=()=>{l||(l=!0,o.close().finally(c))};process.once("SIGINT",u),process.once("SIGTERM",u)}),0}});var LZ={};We(LZ,{ACK_FILE:()=>yE,ackFile:()=>sce,appendAck:()=>bE,readAndAck:()=>nce,resolveAckProjectRoot:()=>vE,sha256Bytes:()=>_E,toAckPath:()=>wE});import{createHash as Gae}from"node:crypto";import{mkdirSync as Yae,readFileSync as gE,renameSync as Xae,writeFileSync as Qae}from"node:fs";import{isAbsolute as MZ,join as cd,relative as ece,resolve as mE,sep as tce}from"node:path";var yE,_E,vE,wE,rce,bE,nce,sce,DZ=$(()=>{"use strict";lt();yE=".pix3/ack.json",_E=t=>Gae("sha256").update(t).digest("hex"),vE=(t,e)=>e?mE(t,e):Xe(t)??mE(t),wE=(t,e,r)=>{let n=MZ(r)?r:mE(e,r.replace(/^res:\/\//,"")),s=ece(t,n);if(!s||s.startsWith("..")||MZ(s))throw new Error(`${r} is not inside the project ${t}`);let o=s.split(tce).join("/");if(o===".pix3"||o.startsWith(".pix3/"))throw new Error(`${r} is editor-private (.pix3/)`);return o},rce=t=>{let e;try{e=gE(cd(t,yE),"utf8")}catch{return[]}try{let r=JSON.parse(e),n=r&&typeof r=="object"?r.acks:void 0;return Array.isArray(n)?n.filter(s=>!!s&&typeof s=="object"&&typeof s.path=="string"&&typeof s.sha256=="string"):[]}catch{return[]}},bE=(t,e)=>{let r=rce(t).filter(o=>!(o.path===e.path&&o.sha256===e.sha256));r.push(e);let n=cd(t,yE);Yae(cd(t,".pix3"),{recursive:!0});let s=`${n}.${process.pid}.tmp`;Qae(s,`${JSON.stringify({acks:r},null,2)}
|
|
354
|
+
`),Xae(s,n)},nce=t=>{let e=vE(t.cwd,t.projectDir),r=wE(e,t.cwd,t.file),n=gE(cd(e,r)),s={path:r,sha256:_E(n),at:(t.now?.()??new Date).toISOString()};return bE(e,s),{bytes:n,record:s}},sce=t=>{let e=vE(t.cwd,t.projectDir),r=wE(e,t.cwd,t.file),n=t.hash?.trim().toLowerCase();if(n!==void 0&&!/^[0-9a-f]{64}$/.test(n))throw new Error("--sha256 must be 64 hex characters");n??=_E(gE(cd(e,r)));let s={path:r,sha256:n,at:(t.now?.()??new Date).toISOString()};return bE(e,s),s}});var ld,ke,ud=$(()=>{"use strict";ld=Fe(kr(),1),ke=t=>typeof t=="object"&&t!==null&&!Array.isArray(t)});import{readdirSync as oce,readFileSync as ice}from"node:fs";import{isAbsolute as ace,join as SE,relative as FZ,resolve as qZ,sep as ZZ}from"node:path";var cce,lce,uce,Aa,UZ,VZ,dce,tg=$(()=>{"use strict";cce=Fe(kr(),1);ud();lce=new Set(["node_modules",".git",".pix3","dist",".vite",".cache"]),uce=".pix3scene",Aa=class{root;files;fileSet;textCache=new Map;constructor(e){this.root=qZ(e),this.files=UZ(this.root,this.root).sort(),this.fileSet=new Set(this.files)}has(e){return this.fileSet.has(e)}absolute(e){return SE(this.root,e)}relativeOf(e){let r=FZ(this.root,qZ(e));return r.startsWith("..")||ace(r)?null:r.split(ZZ).join("/")}readText(e){let r=this.textCache.get(e);if(r!==void 0)return r;let n=ice(this.absolute(e),"utf8");return this.textCache.set(e,n),n}scenes(){return this.files.filter(e=>e.endsWith(uce))}},UZ=(t,e)=>{let r=[],n;try{n=oce(e,{withFileTypes:!0})}catch{return r}for(let s of n)if(s.isDirectory()){if(lce.has(s.name))continue;r.push(...UZ(t,SE(e,s.name)))}else s.isFile()&&r.push(FZ(t,SE(e,s.name)).split(ZZ).join("/"));return r},VZ=t=>{let e=t.trim();if(e.length===0)return null;let r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1]?.toLowerCase();if(r&&r!=="res")return null;let s=(r==="res"?e.replace(/^res:\/\//i,""):e).replace(/[?#].*$/,""),o=[];for(let i of s.replace(/\\/g,"/").split("/"))if(!(i===""||i===".")){if(i===".."){if(o.length===0)return null;o.pop();continue}o.push(dce(i))}return o.length===0?null:o.join("/")},dce=t=>{try{return decodeURIComponent(t)}catch{return t}}});var BZ=_(()=>{throw new Error("src\\smoke\\bundle.ts is only available in a checkout of the pix3 repo (the published @pix3/cli ships its bundles prebuilt)")});var HZ={};We(HZ,{SMOKE_WORKER_FILE:()=>rg,TREE_DEFAULTS_FILE:()=>gce,cliPackageRoot:()=>Wt,resolveEsbuild:()=>$E,withSmokeBundle:()=>kE});import{existsSync as fce,mkdtempSync as pce,rmSync as hce}from"node:fs";import{tmpdir as mce}from"node:os";import{join as KZ}from"node:path";var rg,gce,$E,kE,xE=$(()=>{"use strict";Zs();rg="smoke-worker.mjs",gce="tree-defaults.mjs",$E=()=>{try{return import.meta.resolve("esbuild")}catch{return}},kE=async t=>{let e=hf("smoke");if(e&&fce(KZ(e,rg)))return t(e);let r=pce(KZ(mce(),"pix3-smoke-bundle-"));try{let{buildSmokeBundle:n}=await Promise.resolve().then(()=>Fe(BZ(),1));return await n(r),await t(r)}finally{hce(r,{recursive:!0,force:!0})}}});var As,WZ=$(()=>{"use strict";As=t=>"code"in t});import{execFileSync as yce}from"node:child_process";import{realpathSync as _ce}from"node:fs";import{isAbsolute as vce,join as wce,relative as bce,sep as Sce}from"node:path";var $ce,kce,xce,Ece,Tce,Pce,GZ,Oce,EE,YZ,Ice,Nce,Cce,Rce,JZ,Ace,XZ,QZ=$(()=>{"use strict";lt();tg();$ce="scenes/main.pix3scene",kce=/^\s*(?:-\s+)?instance:\s*["']?(?:res:\/\/)?([^"'\s#]+)/gm,xce=/res:\/\/[^"'\s#)]+/g,Ece=/\buser:([A-Za-z_$][\w$]*)/g,Tce=/\bexport\s+(?:default\s+)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/g,Pce=/(^|\/)(prefabs?|ui)\//i,GZ=t=>/\.(ts|mts|js|mjs)$/.test(t)&&!t.endsWith(".d.ts"),Oce=t=>t.endsWith(".pix3scene")||GZ(t),EE=(t,e)=>{try{return t.readText(e)}catch{return""}},YZ=(t,e)=>{let r=[];for(let n of EE(t,e).matchAll(kce))r.push(n[1].replace(/^\/+/,""));return r},Ice=t=>{let e=t.scenes(),r=new Set;for(let n of e)for(let s of YZ(t,n))r.add(s);return e.filter(n=>!r.has(n)&&!Pce.test(n))},Nce=(t,e)=>{let r=n=>n===$ce?0:n===e?1:2;return[...t].sort((n,s)=>r(n)-r(s)||n.localeCompare(s))},Cce=(t,e,r)=>{let n=new Set,s=[e];for(;s.length>0;){let o=s.pop();if(n.has(o))continue;n.add(o);let i=EE(t,o);for(let a of YZ(t,o))s.push(a);for(let a of i.matchAll(xce)){let c=VZ(a[0]);c&&(c.endsWith(".pix3scene")||n.add(c))}for(let a of i.matchAll(Ece))for(let c of r.get(a[1])??[])n.add(c)}return n},Rce=t=>{let e=new Map;for(let r of t.files)if(GZ(r))for(let n of EE(t,r).matchAll(Tce)){let s=e.get(n[1])??[];s.push(r),e.set(n[1],s)}return e},JZ=(t,e)=>{try{return yce("git",["-C",t,...e],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,maxBuffer:64*1024*1024})}catch{return null}},Ace=t=>{let e=JZ(t,["rev-parse","--show-toplevel"])?.trim();if(!e)return null;let r=JZ(t,["status","--porcelain=v1","-z","--untracked-files=all","--","."]);if(r===null)return null;let n=t;try{n=_ce(t)}catch{}let s=new Set,o=r.split("\0");for(let i=0;i<o.length;i++){let a=o[i];if(a.length<4)continue;let c=a.slice(0,2),l=a.slice(3);if((c.includes("R")||c.includes("C"))&&(i+=1),c.includes("D"))continue;let u=bce(n,wce(e,l));u.startsWith("..")||vce(u)||s.add(u.split(Sce).join("/"))}return[...s].sort()},XZ=(t,e)=>{let r=Nce(Ice(t),e.manifestDefault);if(t.scenes().length===0)return{error:"the project has no .pix3scene files."};if(r.length===0)return{error:"every scene is a prefab, a scenes/ui overlay or instanced by another \u2014 name one: pix3 smoke <scene>."};let n=(l,u)=>({mode:"all",scenes:r,reason:l,...u?{changed:u}:{}});if(e.all)return n("--all: every top-level scene");let s=e.changedFiles!==void 0?e.changedFiles:Ace(t.root);if(s===null)return e.changedOnly?{error:"--changed needs git and a project inside a git work tree."}:n("every top-level scene (no git history to narrow it down)");if(s.length===0)return e.changedOnly?{error:"--changed: nothing changed since the last commit."}:n("every top-level scene (nothing changed since the last commit)");if(s.includes(xe))return n(`every top-level scene (${xe} changed)`,s);let o=Rce(t),i=new Map(r.map(l=>[l,Cce(t,l,o)])),a=r.filter(l=>s.some(u=>i.get(l)?.has(u))),c=s.filter(l=>Oce(l)&&!r.some(u=>i.get(u)?.has(l)));if(c.length>0||a.length===0){let l=c.slice(0,3).join(", ")+(c.length>3?", \u2026":"");return n(c.length>0?`every top-level scene (changed ${l} reaches no scene directly)`:"every top-level scene (no changed file is used by a scene)",s)}return{mode:"changed",scenes:a,reason:`scenes reached by files changed since the last commit (${s.length} changed; --all for every scene)`,changed:s}}});var mU={};We(mU,{SMOKE_USAGE:()=>TE,errorSummary:()=>Kce,formatSmokeHuman:()=>IE,formatSmokeJson:()=>NE,formatSmokeSetHuman:()=>pU,formatSmokeSetJson:()=>hU,resolveSmokeScene:()=>iU,runSmoke:()=>cU,runSmokeCli:()=>Bce,runSmokeSet:()=>uU,selectScenesFor:()=>lU,smokeExitCode:()=>CE,smokeSetExitCode:()=>fU});import{existsSync as zce,readFileSync as jce,statSync as Mce}from"node:fs";import{isAbsolute as Lce,join as eU,resolve as PE,sep as tU}from"node:path";import{pathToFileURL as rU}from"node:url";import{Worker as Dce}from"node:worker_threads";var nU,TE,sU,oU,qce,Zn,Fce,iU,Zce,OE,Uce,aU,cU,lU,uU,dU,dd,IE,NE,CE,fU,Vce,pU,hU,Bce,Kce,gU=$(()=>{"use strict";nU=Fe(kr(),1);lt();tg();ud();xE();WZ();QZ();TE=`Usage: pix3 smoke [scene] [--changed | --all] [--frames N] [--timeout S] [--json] [--project <dir>]
|
|
355
|
+
|
|
356
|
+
Run the game headless in Node \u2014 no browser, no editor: the project's scripts compiled, the scene
|
|
357
|
+
loaded by the real loader, N frames of 1/60 s stepped by the real SceneRunner. Reports every
|
|
358
|
+
script throw (onAttach/onStart/onUpdate, with script name, frame and stack), console.error/warn,
|
|
359
|
+
unhandled rejections, missing res:// files and per-frame step time. Nothing is rendered; audio,
|
|
360
|
+
input and network are inert.
|
|
361
|
+
|
|
362
|
+
scene .pix3scene to run (res://, project-relative or a path) \u2014 the surest way to test
|
|
363
|
+
the game: pix3 smoke scenes/main.pix3scene. With no scene, several run one after
|
|
364
|
+
another, a line each: in a git repo with uncommitted changes, the top-level scenes
|
|
365
|
+
those changes reach (the scene, a prefab/overlay it instances, a user: script it
|
|
366
|
+
attaches); otherwise \u2014 or when a changed scene/script reaches none \u2014 every
|
|
367
|
+
top-level scene (not a prefab, not scenes/ui), scenes/main.pix3scene first.
|
|
368
|
+
--changed only the scenes changed files reach (needs git; exit 2 when nothing changed)
|
|
369
|
+
--all every top-level scene, whatever git says
|
|
370
|
+
--frames N frames to step (default 120 = 2 s of game time)
|
|
371
|
+
--timeout S wall-clock limit in seconds (default 20) \u2192 exit 2, E_SMOKE_TIMEOUT
|
|
372
|
+
--json machine-readable report
|
|
373
|
+
--project dir project folder (default: nearest folder with pix3project.yaml)
|
|
374
|
+
|
|
375
|
+
Exit: 0 = no errors, 1 = errors, 2 = could not run (no scene, bundle failure, unsupported, timeout).
|
|
376
|
+
`,sU=120,oU=20,qce=t=>{let e,r=sU,n=oU,s=!1,o=!1,i=!1,a,c=!1,l=(u,d)=>{let f=u.indexOf("=");return f>0?{value:u.slice(f+1),next:d}:{value:t[d+1],next:d+1}};for(let u=0;u<t.length;u++){let d=t[u],f=d.split("=")[0];if(d==="--json")s=!0;else if(d==="--changed")o=!0;else if(d==="--all")i=!0;else if(d==="--help"||d==="-h")c=!0;else if(f==="--frames"||f==="--timeout"||f==="--project"){let{value:p,next:m}=l(d,u);if(u=m,p===void 0||p.startsWith("--"))return{error:`${f} needs a value`};if(f==="--project")a=p;else{let h=Number(p);if(!Number.isFinite(h)||h<=0)return{error:`${f} needs a positive number`};f==="--frames"?r=Math.floor(h):n=h}}else{if(d.startsWith("-"))return{error:`unknown argument ${d}`};if(e===void 0)e=d;else return{error:`one scene at a time (got ${e} and ${d})`}}}return o&&i?{error:"--changed and --all exclude each other"}:e!==void 0&&(o||i)?{error:`${o?"--changed":"--all"} picks the scenes; drop ${e} or the flag`}:{scene:e,changed:o,all:i,frames:r,timeoutSec:n,json:s,project:a,help:c}},Zn=(t,e,r)=>({ok:!1,code:t,reason:e,...r?{scene:r}:{}}),Fce=t=>{let e={viewport:{width:1920,height:1080},localization:null};try{let r=(0,nU.parse)(jce(eU(t,xe),"utf8"));if(!ke(r))return e;let n=ke(r.viewportBaseSize)?r.viewportBaseSize:{},s=typeof n.width=="number"&&n.width>0?n.width:1920,o=typeof n.height=="number"&&n.height>0?n.height:1080,i=typeof r.defaultExportScenePath=="string"&&r.defaultExportScenePath.trim()?r.defaultExportScenePath.trim().replace(/^res:\/\//i,"").replace(/^\/+/,""):void 0;return{viewport:{width:s,height:o},localization:ke(r.localization)?r.localization:null,...i?{defaultScene:i}:{}}}catch{return e}},iU=(t,e,r)=>{let n=[],s=r.replace(/^res:\/\//i,"").replace(/^\/+/,"");n.push(s.split(tU).join("/"));let o=t.relativeOf(Lce(r)?r:PE(e,r));o&&n.push(o);let i=n.find(a=>t.has(a));return i?i.endsWith(".pix3scene")?i:Zn("E_SMOKE_NO_SCENE",`${i} is not a .pix3scene.`):Zn("E_SMOKE_NO_SCENE",`${r} is not a file in the project (${t.root}).`)},Zce=(t,e,r)=>new Promise(n=>{let s=!1,o=new Dce(rU(eU(t,rg)),{workerData:e,stdout:!0,stderr:!0});o.stdout.resume(),o.stderr.resume();let i=c=>{s||(s=!0,clearTimeout(a),o.terminate(),n(c))},a=setTimeout(()=>{i(Zn("E_SMOKE_TIMEOUT",`the run did not finish within ${r} s (a script stuck in a loop, or a scene too heavy for ${e.frames} frames; try --frames or --timeout).`,e.scene))},r*1e3);o.once("message",c=>i(c)),o.once("error",c=>i(Zn("E_SMOKE_CRASH",`the smoke worker crashed: ${c instanceof Error?c.message:String(c)}`,e.scene))),o.once("exit",c=>i(Zn("E_SMOKE_CRASH",`the smoke worker exited (code ${c}) without a report.`,e.scene)))}),OE=t=>{let e=PE(t);return!zce(e)||!Mce(e).isDirectory()?Zn("E_SMOKE_NO_PROJECT",`${e} is not a folder.`):{root:e,project:new Aa(e),manifest:Fce(e)}},Uce=(t,e,r)=>({projectRoot:t.root,scene:e,frames:r.frames??sU,viewport:t.manifest.viewport,localization:t.manifest.localization,esbuildSpecifier:$E(),fallbackResolveDir:Wt()}),aU=async(t,e,r)=>{let n=r.timeoutSec??oU;try{return await kE(async s=>{let o=[];for(let i of e)o.push(await Zce(s,Uce(t,i,r),n));return o})}catch(s){let o=`could not build or load the smoke bundle: ${s instanceof Error?s.message:String(s)}`;return e.map(i=>Zn("E_SMOKE_BUNDLE",o,i))}},cU=async t=>{let e=OE(t.projectRoot);if("code"in e)return e;let r=iU(e.project,t.cwd??e.root,t.scene);if(typeof r!="string")return r;let[n]=await aU(e,[r],t);return n},lU=t=>{let e=OE(t.projectRoot);if("code"in e)return e;let r=XZ(e.project,{manifestDefault:e.manifest.defaultScene,changedOnly:t.changedOnly,all:t.all,...t.changedFiles!==void 0?{changedFiles:t.changedFiles}:{}});return"error"in r?Zn("E_SMOKE_NO_SCENE",r.error):r},uU=async t=>{let e=OE(t.projectRoot);if("code"in e)return e;let r=lU(t);if("code"in r)return r;let n=await aU(e,r.scenes,t);return{ok:n.every(s=>!As(s)&&s.errors.length===0),selection:r.mode,reason:r.reason,...r.changed?{changed:r.changed}:{},runs:n}},dU=(t,e,r)=>{if(!t)return[];let n=rU(e).href;return t.split(`
|
|
377
|
+
`).slice(1).map(s=>s.trim().replaceAll(`${n}/`,"").replaceAll(`${e}${tU}`,"").replaceAll(`${e}/`,"")).filter(s=>s.startsWith("at ")).slice(0,r)},dd=(t,e)=>`${t} ${e}${t===1?"":"s"}`,IE=(t,e)=>{if(As(t))return`pix3 smoke${t.scene?` ${t.scene}`:""}: could not run \u2014 ${t.code}: ${t.reason}
|
|
378
|
+
`;let r=t,n=[],s=r.timingsMs;if(n.push(`pix3 smoke ${r.scene} \u2014 ${r.frames}/${r.framesRequested} frames at 1/60 s: ${dd(r.errors.length,"error")}, ${dd(r.warnings.length,"warning")}`),n.push(` first frame ${r.firstFrameOk?"ok":"NOT ok"} \xB7 nodes ${r.nodes.start} \u2192 ${r.nodes.end} \xB7 scripts ${r.scripts.length}`),n.push(` compile ${s.compile} ms \xB7 load+onStart ${s.load} ms \xB7 frame 1 ${s.firstFrame} ms \xB7 step mean ${s.step.mean} / p95 ${s.step.p95} / max ${s.step.max} ms \xB7 total ${s.total} ms`),r.game){let o=JSON.stringify(r.game.snapshot)??"null";n.push(` game "${r.game.name}" snapshot: ${o.length>160?`${o.slice(0,159)}\u2026`:o}`)}if(r.errors.length>0){n.push("errors:");for(let o of r.errors){let i=[o.script,o.nodeName?`on "${o.nodeName}"`:o.nodeId?`on ${o.nodeId}`:void 0,o.phase?`(${o.phase})`:void 0].filter(Boolean).join(" ");n.push(` frame ${o.frame} ${o.code}${i?` ${i}`:""}: ${o.message}`),o.domAccess&&o.domAccess.length>0&&n.push(` missing browser API read just before: ${o.domAccess.join(", ")}`);for(let a of dU(o.stack,e,3))n.push(` ${a}`)}}if(r.warnings.length>0){n.push("warnings:");for(let o of r.warnings)n.push(` ${o.frame!==void 0?`frame ${o.frame} `:""}${o.code}: ${o.message}${o.count?` (\xD7${o.count})`:""}`)}if(r.notes.length>0){n.push("notes:");for(let o of r.notes)n.push(` ${o}`)}return`${n.join(`
|
|
379
|
+
`)}
|
|
380
|
+
`},NE=(t,e)=>As(t)?`${JSON.stringify(t,null,2)}
|
|
381
|
+
`:`${JSON.stringify({...t,errors:t.errors.map(r=>({...r,...r.stack?{stack:dU(r.stack,e,12).join(`
|
|
382
|
+
`)}:{}}))},null,2)}
|
|
383
|
+
`,CE=t=>As(t)?2:t.errors.length>0?1:0,fU=t=>t.runs.reduce((e,r)=>Math.max(e,CE(r)),0),Vce=t=>{if(As(t))return`could not run (${t.code})`;let e=[dd(t.errors.length,"error"),dd(t.warnings.length,"warning")];return`${t.errors.length>0?"FAILED":"ok"} \u2014 ${t.frames} frames, ${e.join(", ")}`},pU=(t,e)=>{let r=[];r.push(`pix3 smoke: ${dd(t.runs.length,"scene")} \u2014 ${t.reason}`);for(let s of t.runs)r.push(` ${(s.scene??"?").padEnd(32)} ${Vce(s)}`);let n=t.runs.filter(s=>As(s)||s.errors.length>0||s.warnings.length>0||t.runs.length===1);for(let s of n)r.push("",IE(s,e).trimEnd());return t.runs.length>1&&n.length===0&&r.push("Run one scene for its details: pix3 smoke <scene>."),`${r.join(`
|
|
384
|
+
`)}
|
|
385
|
+
`},hU=(t,e)=>`${JSON.stringify({...t,runs:t.runs.map(r=>JSON.parse(NE(r,e)))},null,2)}
|
|
386
|
+
`,Bce=async(t,e)=>{let r=qce(t);if("error"in r)return e.stderr(`pix3 smoke: ${r.error}
|
|
387
|
+
|
|
388
|
+
${TE}`),2;if(r.help)return e.stdout(TE),0;let n=r.project?PE(e.cwd,r.project):Xe(e.cwd),s=n??e.cwd,o={frames:r.frames,timeoutSec:r.timeoutSec,cwd:e.cwd},i;return n?r.scene!==void 0?i=await cU({projectRoot:n,scene:r.scene,...o}):i=await uU({projectRoot:n,changedOnly:r.changed,all:r.all,...o}):i=Zn("E_SMOKE_NO_PROJECT",`no pix3project.yaml in ${e.cwd} or above \u2014 run inside a project or pass --project <dir>.`),"runs"in i?(e.stdout(r.json?hU(i,s):pU(i,s)),fU(i)):(r.json?e.stdout(NE(i,s)):e.stdout(IE(i,s)),CE(i))},Kce=t=>As(t)?[`${t.code}: ${t.reason}`]:t.errors.map(e=>`${e.frame} ${e.code}${e.script?` ${e.script}`:""}: ${e.message}`)});var Hce,Wce,Jce,yU,_U=$(()=>{"use strict";Hce=/^(src\/)?scripts\//,Wce=/extends\s+Script\b/,Jce=/\bexport\s+(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/g,yU=t=>{let e=new Set;for(let r of t.files){if(!Hce.test(r)||r.endsWith(".d.ts")||r.includes(".spec.")||!r.endsWith(".ts")&&!r.endsWith(".js"))continue;let n;try{n=t.readText(r)}catch{continue}if(Wce.test(n))for(let s of n.matchAll(Jce))e.add(`user:${s[1]}`)}return[...e].sort()}});var bU,ja,sg,SU,og,za,ng,vU,wU,$U,kU,xU,Gce,Yce,Xce,RE,EU,TU,AE,Qce,ele,tle,PU,zE,OU,jE,rle,IU,NU=$(()=>{"use strict";bU=Fe(kr(),1);ud();ja=class extends Error{},sg=t=>{let e;try{e=(0,bU.parse)(t,{maxAliasCount:1e3})}catch(r){throw new ja(`not valid YAML: ${(r instanceof Error?r.message:String(r)).split(`
|
|
389
|
+
`)[0]}`)}if(!ke(e)||!Array.isArray(e.root))throw new ja("not a .pix3scene (no `root:` list)");return e},SU=t=>{let e=t.trim(),r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1]?.toLowerCase();return r&&r!=="res"?null:e.replace(/^res:\/\//i,"").replace(/^\/+/,"")||null},og=t=>Array.isArray(t)&&t.every(e=>typeof e=="number")?t:ke(t)&&typeof t.x=="number"&&typeof t.y=="number"?["x","y","z","w"].filter(e=>typeof t[e]=="number").map(e=>t[e]):null,za=t=>Math.round(t*1e4)/1e4,ng=t=>{if(typeof t=="number")return za(t);let e=og(t);return e?e.map(za):t},vU=t=>typeof t=="string"&&/^#[0-9a-f]{3,8}$/i.test(t),wU=t=>t.length===4?`#${[...t.slice(1)].map(e=>e+e).join("")}`.toLowerCase():t.toLowerCase(),$U=(t,e)=>{if(e===void 0)return!1;let r=ng(t),n=ng(e);return typeof r=="number"&&typeof n=="number"?Math.abs(r-n)<1e-6:Array.isArray(r)&&Array.isArray(n)?r.length===n.length&&r.every((s,o)=>$U(s,n[o])):vU(r)&&vU(n)?wU(r)===wU(n):r===null||typeof r!="object"?r===n:JSON.stringify(r)===JSON.stringify(n)},kU=new Set(["transform.position","position","width","height","label"]),xU=t=>{let e=[];for(let[r,n]of Object.entries(t)){let s=ke(n)&&typeof n.url=="string";if(ke(n)&&!s&&og(n)===null)for(let[o,i]of Object.entries(n))e.push([`${r}.${o}`,i]);else e.push([r,n])}return e},Gce=(t,e,r,n)=>{let s={};for(let[o,i]of xU(t)){if(kU.has(o)||r&&(o==="layout.enabled"||o==="layout.horizontalAlign"||o==="layout.verticalAlign")||n&&o==="visible")continue;let a=e?.[o];e&&$U(i,a)||(s[o]=ng(i))}return s},Yce=t=>{let e=ke(t.properties)?Object.keys(t.properties).length:0,r=ke(t.overrides)?t.overrides.byLocalId:void 0;if(ke(r))for(let n of Object.values(r))e+=ke(n)&&ke(n.properties)?Object.keys(n.properties).length:1;return e},Xce=(t,e)=>{let r=SU(t);if(!r||!e)return{};let n=e(r);if(n===null)return{};try{let o=sg(n).root[0];return ke(o)?{...typeof o.type=="string"?{type:o.type}:{},...typeof o.name=="string"?{name:o.name}:{}}:{}}catch{return{}}},RE=t=>t.toLowerCase().replace(/[^a-z0-9]/g,""),EU=t=>(Array.isArray(t.children)?t.children:[]).reduce((r,n)=>r+(ke(n)?1+EU(n):0),0),TU=(t,e={})=>{let r=e.types&&e.types.length>0?new Set(e.types.map(RE)):null,n=(s,o)=>{if(!ke(s))return null;let i=ke(s.properties)?s.properties:{},a=typeof s.instance=="string"?s.instance:void 0,c=a?Xce(a,e.readPrefab):{},l=typeof s.type=="string"?s.type:c.type??null,u=ke(i.transform)?i.transform:{},d=og(u.position??i.position),f=i.width,p=i.height,m=ke(i.layout)?i.layout:null,h=m&&m.enabled===!0?`${String(m.horizontalAlign??"none")}/${String(m.verticalAlign??"none")}`:void 0,g=i.visible===!1,y=(Array.isArray(s.components)?s.components:[]).filter(ke).filter(A=>typeof A.type=="string").map(A=>({type:A.type,...typeof A.id=="string"?{id:A.id}:{},enabled:A.enabled!==!1})),w=Array.isArray(s.groups)?s.groups.filter(A=>typeof A=="string"):[],b=Array.isArray(s.children)?s.children:[],x=e.depth!==void 0&&o>=e.depth,v=x?[]:b.map(A=>n(A,o+1)).filter(A=>A!==null),S=r===null||l!==null&&r.has(RE(l))||a!==void 0&&r.has("instance")||y.some(A=>r.has(RE(A.type)));if(!S&&v.length===0)return null;let T=e.props===!0?a?Object.fromEntries(xU(i).filter(([A])=>!(g&&A==="visible")&&!kU.has(A)).map(([A,U])=>[A,ng(U)])):Gce(i,l?e.defaults?.[l]:void 0,h!==void 0,g):void 0,I=x?EU(s):0;return{id:typeof s.id=="string"?s.id:"?",type:l,...typeof s.name=="string"?{name:s.name}:{},depth:o,...d?{position:d.map(za)}:{},...typeof f=="number"&&typeof p=="number"?{size:[za(f),za(p)]}:{},...h?{layout:h}:{},...g?{hidden:!0}:{},...typeof i.label=="string"?{text:i.label}:{},...w.length>0?{groups:w}:{},components:y,...a?{instance:{path:a,...c.type?{rootType:c.type}:{},...c.name?{rootName:c.name}:{},overrides:Yce(s)}}:{},...T&&Object.keys(T).length>0?{props:T}:{},...S?{}:{context:!0},...I>0?{hiddenBelow:I}:{},children:v}};return t.root.map(s=>n(s,0)).filter(s=>s!==null)},AE=(t,e=40)=>{let r=t.replace(/\s+/g," ");return JSON.stringify(r.length>e?`${r.slice(0,e-1)}\u2026`:r)},Qce=t=>{if(typeof t=="string")return/^[\w#./:-]+$/.test(t)&&t.length>0?t:AE(t,60);if(typeof t=="number"||typeof t=="boolean"||t===null)return String(t);let e=og(t);if(e)return`(${e.map(za).join(",")})`;if(ke(t)&&typeof t.url=="string")return t.url;let r=JSON.stringify(t)??String(t);return r.length>80?`${r.slice(0,79)}\u2026`:r},ele=(t,e)=>`${t} ${e}${t===1?"":"s"}`,tle=t=>{let e=[],r=`${t.type??(t.instance?"Instance":"?")}#${t.id}`;e.push(t.name!==void 0&&t.name!==t.id?`${r} ${AE(t.name)}`:r),t.instance&&e.push(`\u21B3 instance ${t.instance.path} (${ele(t.instance.overrides,"override")})`),t.text!==void 0&&e.push(`text=${AE(t.text,28)}`),t.position&&t.position.some(s=>s!==0)&&e.push(`pos=(${t.position.join(",")})`),t.size&&e.push(`size=${t.size[0]}x${t.size[1]}`),t.layout&&e.push(`layout=${t.layout}`),t.hidden&&e.push("hidden"),t.groups&&e.push(`groups=[${t.groups.join(",")}]`);let n=e.join(" ");return t.components.length>0&&(n+=` components=[${t.components.map(s=>s.enabled?s.type:`${s.type}(off)`).join(", ")}]`),t.hiddenBelow&&(n+=` \u2026 +${t.hiddenBelow} below`),n},PU=t=>{let e=[],r=n=>{let s=" ".repeat(n.depth);if(e.push(`${s}${n.context?"\xB7 ":""}${tle(n)}`),n.props){let o=Object.entries(n.props).map(([i,a])=>`${i}=${Qce(a)}`);o.length>0&&e.push(`${s} ${o.join(" ")}`)}n.children.forEach(r)};return t.forEach(r),e.length>0?`${e.join(`
|
|
390
|
+
`)}
|
|
391
|
+
`:""},zE=t=>t.reduce((e,r)=>e+1+zE(r.children),0),OU=t=>{let e=new Set,r=n=>{ke(n)&&(typeof n.type=="string"&&e.add(n.type),Array.isArray(n.children)&&n.children.forEach(r))};return t.root.forEach(r),[...e].sort()},jE=(t,e)=>{let r;try{r=sg(e)}catch(c){return{path:t,nodes:0,types:{},components:{},instances:[],error:c instanceof Error?c.message:String(c)}}let n={},s={},o=new Set,i=0,a=c=>{if(ke(c)){if(i+=1,typeof c.instance=="string"){let l=SU(c.instance);l&&o.add(l)}else typeof c.type=="string"&&(n[c.type]=(n[c.type]??0)+1);if(Array.isArray(c.components))for(let l of c.components)ke(l)&&typeof l.type=="string"&&(s[l.type]=(s[l.type]??0)+1);Array.isArray(c.children)&&c.children.forEach(a)}};return r.root.forEach(a),{path:t,nodes:i,types:n,components:s,instances:[...o].sort()}},rle=t=>Object.entries(t).sort((e,r)=>r[1]-e[1]||e[0].localeCompare(r[0])),IU=(t,e)=>{let r=`${t.path}${t.entry?" *":""}`.padEnd(e);if(t.error)return`${r} UNPARSABLE: ${t.error}`;let n=rle(t.types).map(([i,a])=>a>1?`${i}\xD7${a}`:i).join(" "),s=[`${r} ${t.kind.padEnd(7)} ${String(t.nodes).padStart(3)} ${t.nodes===1?"node ":"nodes"} ${n}`],o=Object.keys(t.components).sort();return o.length>0&&s.push(`${" ".repeat(e+2)}components: ${o.join(" ")}`),t.instances.length>0&&s.push(`${" ".repeat(e+2)}instances: ${t.instances.join(" ")}`),s.join(`
|
|
392
|
+
`)}});var zU={};We(zU,{TREE_USAGE:()=>LE,runTreeCli:()=>fle});import{existsSync as CU,readFileSync as ig}from"node:fs";import{isAbsolute as RU,join as ag,relative as nle,resolve as ME,sep as sle}from"node:path";import{pathToFileURL as ole}from"node:url";var AU,LE,ile,ale,cle,lle,ule,dle,fle,jU=$(()=>{"use strict";AU=Fe(kr(),1);lt();tg();ud();_U();NU();LE=`Usage: pix3 tree [scene] [--depth N] [--types A,B] [--props] [--json] [--project <dir>]
|
|
393
|
+
|
|
394
|
+
One line per node \u2014 type#id "name", position, size, anchor layout, components, prefab
|
|
395
|
+
instances (\u21B3 instance res://\u2026 (N overrides)) \u2014 indented by depth. Read this instead of the
|
|
396
|
+
whole .pix3scene when you need to find your way around a scene.
|
|
397
|
+
|
|
398
|
+
scene .pix3scene (res://, project-relative or a path). Without one: every scene and
|
|
399
|
+
prefab in the project with node counts, node types and components.
|
|
400
|
+
--depth N stop N levels below the roots (0 = roots only); cut subtrees show "\u2026 +K below"
|
|
401
|
+
--types A,B only nodes of these types (or carrying these components; \`instance\` = prefab
|
|
402
|
+
instances), with their ancestors as "\xB7" context lines
|
|
403
|
+
--props also print each node's properties that differ from the type's defaults
|
|
404
|
+
--json the same as nested JSON
|
|
405
|
+
--project dir project folder (default: nearest folder with pix3project.yaml, else cwd)
|
|
406
|
+
`,ile=t=>{let e,r,n,s=!1,o=!1,i,a=!1;for(let c=0;c<t.length;c++){let l=t[c],u=l.indexOf("="),d=u>0?l.slice(0,u):l;if(l==="--json")o=!0;else if(l==="--props")s=!0;else if(l==="--help"||l==="-h")a=!0;else if(d==="--depth"||d==="--types"||d==="--project"){let f=u>0?l.slice(u+1):t[++c];if(f===void 0||f.startsWith("--"))return{error:`${d} needs a value`};if(d==="--depth"){let p=Number(f);if(!Number.isInteger(p)||p<0)return{error:"--depth needs a whole number \u2265 0"};r=p}else d==="--types"?n=f.split(",").map(p=>p.trim()).filter(Boolean):i=f}else{if(l.startsWith("-"))return{error:`unknown argument ${l}`};if(e===void 0)e=l;else return{error:`one scene at a time (got ${e} and ${l})`}}}return{scene:e,depth:r,types:n,props:s,json:o,project:i,help:a}},ale=(t,e,r)=>[ag(e,t.replace(/^res:\/\//i,"").replace(/^\/+/,"")),RU(t)?t:ME(r,t)].find(s=>CU(s))??null,cle=(t,e)=>{let r=nle(t,e);return r.startsWith("..")||RU(r)?e:r.split(sle).join("/")},lle=async t=>{try{let{TREE_DEFAULTS_FILE:e,withSmokeBundle:r}=await Promise.resolve().then(()=>(xE(),HZ));return await r(async n=>{let o=(await import(ole(ag(n,e)).href)).defaultsForTypes(t);return Object.fromEntries(Object.entries(o).map(([i,a])=>[i,a.defaults]))})}catch(e){return{error:e instanceof Error?e.message:String(e)}}},ule=t=>{let e=ag(t,xe);if(!CU(e))return null;try{let r=(0,AU.parse)(ig(e,"utf8"));if(!ke(r))return{};let n=ke(r.metadata)?r.metadata:{},s=ke(r.viewportBaseSize)?r.viewportBaseSize:null;return{...typeof n.projectName=="string"?{name:n.projectName}:{},...typeof r.projectType=="string"?{projectType:r.projectType}:{},...s&&typeof s.width=="number"&&typeof s.height=="number"?{viewport:`${s.width}x${s.height}`}:{},...typeof r.defaultExportScenePath=="string"&&r.defaultExportScenePath.trim()?{entry:r.defaultExportScenePath.trim().replace(/^res:\/\//i,"")}:{}}}catch{return{}}},dle=(t,e,r)=>{let n=new Aa(t),s=ule(t),o=n.scenes().map(f=>jE(f,n.readText(f))),i=new Set(o.flatMap(f=>f.instances)),a=o.map(f=>({...f,kind:/(^|\/)ui\//.test(f.path)?"overlay":i.has(f.path)||/(^|\/)prefabs?\//.test(f.path)?"prefab":"scene",entry:s?.entry===f.path})),c=yU(n),l=a.filter(f=>f.error).length;if(e.json)return r.stdout(`${JSON.stringify({projectRoot:t,project:s,scripts:c,scenes:a},null,2)}
|
|
407
|
+
`),l>0?1:0;let u=[];if(s){let f=[s.projectType,s.viewport,s.entry?`entry ${s.entry} (*)`:void 0].filter(Boolean).join(", ");u.push(`${s.name?`"${s.name}"`:"Project"}${f?` \u2014 ${f}`:""}`)}else u.push(`${t} (no pix3project.yaml)`);u.push(c.length>0?`scripts: ${c.join(" ")}`:"scripts: none (no Script classes under scripts/ or src/scripts/)"),a.length===0&&u.push("no .pix3scene files");let d=Math.max(0,...a.map(f=>f.path.length+(f.entry?2:0)));for(let f of a)u.push(IU(f,d));return u.push("\n`pix3 tree <scene>` for one scene's nodes (--depth N, --types A,B, --props)."),r.stdout(`${u.join(`
|
|
408
|
+
`)}
|
|
409
|
+
`),l>0?1:0},fle=async(t,e)=>{let r=ile(t);if("error"in r)return e.stderr(`pix3 tree: ${r.error}
|
|
410
|
+
|
|
411
|
+
${LE}`),2;if(r.help)return e.stdout(LE),0;let n=r.project?ME(e.cwd,r.project):Xe(e.cwd)??ME(e.cwd);if(r.scene===void 0)return dle(n,r,e);let s=ale(r.scene,n,e.cwd);if(!s)return e.stderr(`pix3 tree: ${r.scene} not found (looked in ${n} and ${e.cwd}).
|
|
412
|
+
`),2;let o=cle(n,s),i;try{i=sg(ig(s,"utf8"))}catch(p){if(!(p instanceof ja))throw p;return e.stderr(`pix3 tree: ${o} is ${p.message}.
|
|
413
|
+
`),1}let a,c;if(r.props){let p=await lle(OU(i));"error"in p?c=`defaults unavailable (${String(p.error)}): every authored property is shown`:a=p}let l=TU(i,{depth:r.depth,types:r.types,props:r.props,defaults:a,readPrefab:p=>{let m=ag(n,p);try{return ig(m,"utf8")}catch{return null}}});if(r.json)return e.stdout(`${JSON.stringify({scene:o,nodes:l,...c?{note:c}:{}},null,2)}
|
|
414
|
+
`),0;let u=zE(l),d=jE(o,ig(s,"utf8")).nodes,f=[r.types?`matching ${r.types.join(",")} (with ancestors)`:void 0,r.depth!==void 0?`to depth ${r.depth}`:void 0].filter(Boolean);return e.stdout(`${o} \u2014 ${d} node${d===1?"":"s"}${u!==d||f.length>0?`, ${u} shown${f.length>0?` ${f.join(", ")}`:""}`:""}
|
|
415
|
+
${PU(l)}${c?`(${c})
|
|
416
|
+
`:""}`),0}});var fd,Ma,ple,hle,DE,qE,mle,gle,yle,MU,LU,DU,Un,_le,fn,vle,qU,FU,ZU=$(()=>{"use strict";fd=["coin","jump","hit","explosion","powerup","click"],Ma={wave:"square",freq:440,freqEnd:440,slide:0,arpAt:0,arpMul:1,vibratoDepth:0,vibratoHz:0,duty:.5,attack:.002,decay:.05,sustainLevel:.6,sustain:.05,release:.1,lowpassHz:0,lowpassQ:.707,volume:.8},ple={coin:{...Ma,freq:988,freqEnd:988,arpAt:.07,arpMul:4/3,duty:.5,decay:.02,sustainLevel:.7,sustain:.1,release:.18,volume:.7},jump:{...Ma,freq:260,freqEnd:720,slide:.16,duty:.35,decay:.04,sustainLevel:.6,sustain:.06,release:.1,lowpassHz:5e3,volume:.7},hit:{...Ma,wave:"noise",freq:1400,freqEnd:180,slide:.12,attack:.001,decay:.05,sustainLevel:.3,sustain:.02,release:.08,lowpassHz:3200,lowpassQ:1.2,volume:.85},explosion:{...Ma,wave:"noise",freq:520,freqEnd:40,slide:.7,attack:.002,decay:.12,sustainLevel:.55,sustain:.15,release:.5,lowpassHz:1400,lowpassQ:1,volume:.9},powerup:{...Ma,wave:"saw",freq:330,freqEnd:1320,slide:.38,vibratoDepth:.04,vibratoHz:14,attack:.005,decay:.05,sustainLevel:.7,sustain:.25,release:.15,lowpassHz:6e3,volume:.65},click:{...Ma,wave:"square",freq:1800,freqEnd:1200,slide:.02,duty:.25,attack:5e-4,decay:.012,sustainLevel:0,sustain:0,release:.012,lowpassHz:8e3,volume:.6}},hle={coin:["coin","pickup","pick up","collect","gem","ding","bling","money","score","reward"],jump:["jump","hop","leap","spring","bounce","boing"],hit:["hit","hurt","damage","punch","impact","thud","smack","crash","kick","slap"],explosion:["explosion","explode","boom","blast","bomb","kaboom","explod","detonat"],powerup:["powerup","power-up","power up","level up","upgrade","bonus","charge","magic"],click:["click","tap","button","ui","menu","select","tick","toggle","blip"]},DE=(t,e)=>({...t,freq:t.freq*e,freqEnd:t.freqEnd*e}),qE=(t,e)=>({...t,slide:t.slide*e,arpAt:t.arpAt*e,decay:t.decay*e,sustain:t.sustain*e,release:t.release*e}),mle=[{words:["high","bright","tiny","small","light"],apply:t=>DE(t,1.4)},{words:["low","deep","big","heavy","huge"],apply:t=>DE(t,.7)},{words:["short","quick","snappy","fast"],apply:t=>qE(t,.65)},{words:["long","slow"],apply:t=>qE(t,1.6)},{words:["soft","quiet"],apply:t=>({...t,volume:t.volume*.6})}],gle=t=>t.toLowerCase().split(/[^a-z-]+/).filter(Boolean),yle=(t,e)=>{let r=e.split(" ");for(let n=0;n+r.length<=t.length;n++)if(r.every((o,i)=>{let a=t[n+i];return a===o||o.length>=5&&a.startsWith(o)}))return n;return-1},MU=t=>{let e=gle(t),r=fd.find(i=>t.trim().toLowerCase()===i),n=r;if(!n){let i=-1;for(let a of fd)for(let c of[a,...hle[a]]){let l=yle(e,c);l>=0&&(i<0||l<i)&&(i=l,n=a)}}if(!n)return null;let s=ple[n],o=[];if(!r)for(let i of mle){let a=i.words.find(c=>e.includes(c));a&&(s=i.apply(s),o.push(a))}return{preset:n,params:s,modifiers:o}},LU=t=>{let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}},DU=(t,e)=>{let r=LU(e^2654435769),n=i=>1+(r()*2-1)*i,s=n(.15),o=n(.2);return{...qE(DE(t,s),o),freqEnd:t.freqEnd*s*n(.08),duty:Math.min(.9,Math.max(.1,t.duty*n(.25))),vibratoDepth:t.vibratoDepth*n(.3),vibratoHz:t.vibratoHz*n(.2),lowpassHz:t.lowpassHz>0?t.lowpassHz*n(.25):0}},Un=44100,_le=t=>t.attack+t.decay+t.sustain+t.release,fn=(t,e,r)=>Math.min(r,Math.max(e,Number.isFinite(t)?t:e)),vle=(t,e)=>{if(e<t.attack)return e/t.attack;let r=e-t.attack;return r<t.decay?1-(1-t.sustainLevel)*(r/t.decay):(r-=t.decay,r<t.sustain?t.sustainLevel:(r-=t.sustain,r<t.release?t.sustainLevel*(1-r/t.release)**2:0))},qU=(t,e=1)=>{let r={...t,freq:fn(t.freq,10,2e4),freqEnd:fn(t.freqEnd,10,2e4),attack:fn(t.attack,5e-4,5),decay:fn(t.decay,0,5),sustain:fn(t.sustain,0,5),release:fn(t.release,.002,5),sustainLevel:fn(t.sustainLevel,0,1),duty:fn(t.duty,.05,.95),volume:fn(t.volume,0,1),lowpassQ:fn(t.lowpassQ,.5,8)},n=_le(r),s=Math.max(1,Math.round(n*Un)),o=new Float32Array(s),i=LU(e),a=r.slide>0?r.slide:n,c=r.freqEnd/r.freq,l=r.lowpassHz>0&&r.lowpassHz<Un/2,u=1,d=0,f=0,p=0,m=0;if(l){let U=2*Math.PI*r.lowpassHz/Un,ae=Math.sin(U)/(2*r.lowpassQ),J=Math.cos(U),Y=1+ae;u=(1-J)/2/Y,d=(1-J)/Y,f=u,p=-2*J/Y,m=(1-ae)/Y}let h=0,g=0,y=0,w=0,b=0,x=0,v=0,S=i()*2-1,T=0;for(let U=0;U<s;U++){let ae=U/Un,J=r.freq*c**Math.min(1,ae/a);r.arpAt>0&&ae>=r.arpAt&&(J*=r.arpMul),r.vibratoDepth>0&&(J*=1+r.vibratoDepth*Math.sin(2*Math.PI*r.vibratoHz*ae)),v+=J/Un;let Y;switch(r.wave){case"square":Y=v%1<r.duty?1:-1;break;case"saw":Y=2*(v%1)-1;break;case"sine":Y=Math.sin(2*Math.PI*v);break;case"triangle":Y=1-4*Math.abs(v%1-.5);break;case"noise":{let Ht=Math.floor(v*16);Ht!==T&&(T=Ht,S=i()*2-1),Y=S;break}}if(Y*=vle(r,ae),l){let Ht=u*Y+d*h+f*g-p*y-m*w;g=h,h=Y,w=y,y=Ht,Y=Ht}x=Y-b+.995*x,b=Y,o[U]=x}let I=Math.min(s,Math.round(.003*Un));for(let U=0;U<I;U++)o[s-1-U]*=U/I;let A=0;for(let U of o)A=Math.max(A,Math.abs(U));if(A>0){let U=r.volume/A;for(let ae=0;ae<s;ae++)o[ae]*=U}return o},FU=(t,e=Un)=>{let r=t.length*2,n=new ArrayBuffer(44+r),s=new DataView(n),o=(i,a)=>{for(let c=0;c<a.length;c++)s.setUint8(i+c,a.charCodeAt(c))};o(0,"RIFF"),s.setUint32(4,36+r,!0),o(8,"WAVE"),o(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,e,!0),s.setUint32(28,e*2,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),o(36,"data"),s.setUint32(40,r,!0);for(let i=0;i<t.length;i++){let a=Math.max(-1,Math.min(1,t[i]));s.setInt16(44+i*2,Math.round(a<0?a*32768:a*32767),!0)}return new Uint8Array(n)}});var WU={};We(WU,{SFX_USAGE:()=>cg,runSfx:()=>$le});import{mkdirSync as wle,writeFileSync as ble}from"node:fs";import{dirname as UU,relative as VU,resolve as BU,sep as KU}from"node:path";var cg,HU,Sle,$le,JU=$(()=>{"use strict";lt();ZU();cg=`Usage: pix3 sfx <preset|"description"> [--out <file.wav>] [--seed <n>] [--json]
|
|
417
|
+
|
|
418
|
+
Synthesizes a short sound effect offline into a 44.1 kHz 16-bit mono WAV.
|
|
419
|
+
presets ${fd.join(", ")}
|
|
420
|
+
description words that name a preset ("coin pickup", "big explosion"), plus modifiers:
|
|
421
|
+
high/low, short/long, soft
|
|
422
|
+
--out output file (default: audio/<preset>.wav in the project root)
|
|
423
|
+
--seed a variation of the preset (same seed, same sound); default: the preset as tuned
|
|
424
|
+
--json print { path, res, durationMs, preset, seed, modifiers, bytes, peak, params }
|
|
425
|
+
Reference it from a scene or script as res://<path inside the project>.
|
|
426
|
+
`,HU=(t,e=4)=>Number(t.toFixed(e)),Sle=t=>{let e={};for(let[r,n]of Object.entries(t))e[r]=typeof n=="number"?HU(n):n;return e},$le=(t,e)=>{let r,n,s,o=!1;for(let g=0;g<t.length;g++){let y=t[g];if(y==="--help"||y==="-h")return e.stdout(cg),0;if(y==="--json")o=!0;else if(y==="--out"||y==="--seed"){let w=t[g+1];if(w===void 0||w.startsWith("--"))return e.stderr(`pix3 sfx: ${y} needs a value.
|
|
427
|
+
`),2;y==="--out"?n=w:s=w,g++}else if(y.startsWith("--out="))n=y.slice(6);else if(y.startsWith("--seed="))s=y.slice(7);else{if(y.startsWith("--"))return e.stderr(`pix3 sfx: unknown option ${y}.
|
|
428
|
+
|
|
429
|
+
${cg}`),2;r=r===void 0?y:`${r} ${y}`}}if(r===void 0||r.trim()==="")return e.stderr(`pix3 sfx: say which sound.
|
|
430
|
+
|
|
431
|
+
${cg}`),2;let i=null;if(s!==void 0){let g=Number(s);if(!Number.isInteger(g)||g<0||g>4294967295)return e.stderr(`pix3 sfx: --seed takes a whole number 0..4294967295, not "${s}".
|
|
432
|
+
`),2;i=g}let a=MU(r);if(!a)return e.stderr(`pix3 sfx: "${r}" names no preset. Use one of ${fd.join(", ")}, or words like "coin pickup", "big explosion", "button click".
|
|
433
|
+
`),2;if(n!==void 0&&!/\.wav$/i.test(n))return e.stderr(`pix3 sfx: --out must end in .wav (the only format this writes), got "${n}".
|
|
434
|
+
`),2;let c=i===null?a.params:DU(a.params,i),l=qU(c,i??1),u=FU(l),d=n!==void 0?BU(e.cwd,n):BU(Xe(e.cwd)??e.cwd,"audio",`${a.preset}.wav`);wle(UU(d),{recursive:!0}),ble(d,u);let f=0;for(let g of l)f=Math.max(f,Math.abs(g));let p=Xe(UU(d)),m=p?VU(p,d):null,h={path:VU(e.cwd,d).split(KU).join("/"),res:m&&!m.startsWith("..")?`res://${m.split(KU).join("/")}`:null,durationMs:Math.round(l.length/Un*1e3),preset:a.preset,seed:i,modifiers:a.modifiers,bytes:u.byteLength,peak:HU(f,3),params:Sle(c)};if(o)e.stdout(`${JSON.stringify(h,null,2)}
|
|
435
|
+
`);else{let g=[a.modifiers.length>0?a.modifiers.join(" "):null,i!==null?`seed ${i}`:null].filter(Boolean).join(", ");e.stdout(`wrote ${h.path} ${h.preset}${g?` (${g})`:""}, ${h.durationMs} ms, ${(h.bytes/1024).toFixed(1)} KiB${h.res?`
|
|
436
|
+
use it as ${h.res}`:""}
|
|
437
|
+
`)}return 0}});import{resolve as FE}from"node:path";lt();gf();ar();import{existsSync as H3,mkdirSync as UO,readdirSync as BO,readFileSync as VO,writeFileSync as W3}from"node:fs";import{basename as J3,extname as G3,join as hc,relative as Y3,resolve as X3}from"node:path";var Q3=["design","scenes","sprites","scripts","audio","references"],eK=new Set([".pix3scene",".ts",".md",".yaml",".yml",".json",".txt"]),tK=[Jy()],KO=(t,e=t)=>{let r=[];for(let n of BO(e,{withFileTypes:!0})){let s=hc(e,n.name);n.isDirectory()?r.push(...KO(t,s)):n.isFile()&&r.push(Y3(t,s).split("\\").join("/"))}return r.sort()},HO=t=>{let e=X3(t.dir);if(H3(e)&&BO(e).length>0)throw new Error(`${e} is not empty. Choose an empty or new folder for a new project.`);let r=t.template,n=(t.projectName??J3(e)).trim()||"Pix3 Project",s=t.projectId??Vy(),o=[],i=(c,l)=>{let u=hc(e,c);UO(hc(u,".."),{recursive:!0}),W3(u,l),o.push(c)};for(let c of[...Q3,...r.directories])UO(hc(e,c),{recursive:!0});i(xe,Ky(By(r,{projectName:n,projectId:s})));for(let c of KO(r.filesDir)){let l=hc(r.filesDir,c);eK.has(G3(c).toLowerCase())?i(c,VO(l,"utf8").replaceAll("{{PROJECT_NAME}}",n)):i(c,VO(l))}i(".pix3/template.json",JSON.stringify({templateId:r.id,editorVersion:be,createdBy:"@pix3/cli",createdAt:new Date().toISOString()},null,2)+`
|
|
438
|
+
`);let a={dir:e,projectId:s,projectName:n,template:r,files:o};for(let c of t.postCreateSteps??tK)o.push(...c(a));return a};var XO=Fe(kr(),1);Zs();import{existsSync as Go,readdirSync as rK,readFileSync as nK,statSync as sK}from"node:fs";import{join as es,resolve as WO}from"node:path";var oK=["2d","3d"],iK=["mobile","desktop","universal"],aK="3d",cK="universal",JO={width:1920,height:1080},QO=()=>Wt(),lK=()=>{let t=QO(),e=es(t,"..",".."),r=es(e,"src","templates","projects");return WO(e,"packages","pix3-cli")===WO(t)&&Go(es(e,"packages","pix3-runtime"))&&Go(r)?r:null},GO=()=>{let t=lK();return t?[t]:[es(QO(),"templates")]},uK=()=>{let t=process.env.PIX3_TEMPLATES_DIR;if(t)return t;for(let e of GO())if(Go(e)&&sK(e).isDirectory())return e;throw new Error(`No project templates found in ${GO().join(", ")}. The package is incomplete \u2014 reinstall it (published builds carry a templates/ copy).`)},Gy=(t,e)=>{let r=Number(t);return Number.isFinite(r)&&r>0?Math.round(r):e},YO=t=>t&&typeof t=="object"?t:{},dK=(t,e)=>{let r=es(t,e),n=es(r,"template.yaml"),s=es(r,"files");if(!Go(n)||!Go(s))return null;let o={};try{o=YO((0,XO.parse)(nK(n,"utf8")))}catch(d){process.stderr.write(`pix3: failed to parse ${n}: ${String(d)}
|
|
439
|
+
`)}let i=typeof o.projectType=="string"?o.projectType:"",a=typeof o.targetPlatform=="string"?o.targetPlatform:"",c=YO(o.viewport),l=typeof o.entryScene=="string"?o.entryScene.trim():"",u=l?l.replace(/^res:\/\//i,""):void 0;return{id:e,title:typeof o.title=="string"&&o.title.trim()?o.title.trim():e,description:typeof o.description=="string"?o.description.trim():"",projectType:oK.includes(i)?i:aK,targetPlatform:iK.includes(a)?a:cK,viewport:{width:Gy(c.width,JO.width),height:Gy(c.height,JO.height)},order:Gy(o.order,1e3),hidden:o.hidden===!0,isRecipe:Go(es(s,"design","recipe.md")),...u?{entryScenePath:u}:{},directories:Array.isArray(o.directories)?o.directories.filter(d=>typeof d=="string"&&d.length>0):[],filesDir:s}},Yy=(t=uK())=>rK(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>dK(t,e.name)).filter(e=>e!==null).sort((e,r)=>e.order-r.order||e.title.localeCompare(r.title)),eI=(t,e)=>{let r=e.find(o=>o.id===t);if(r)return{template:r};let s=e.filter(o=>!o.hidden).filter(o=>o.id===`recipe-${t}`||o.id.startsWith(`recipe-${t}-`));return s.length===1?{template:s[0]}:s.length>1?{error:`"${t}" is ambiguous: ${s.map(o=>o.id).join(", ")}.`}:{error:`Unknown recipe or template "${t}". Run \`pix3 new\` to list them.`}},tI=t=>{let e=t.replace(/\s+/g," ").trim(),r=/^(.+?[.!?])(\s|$)/.exec(e);return r?r[1]:e};ar();var Xy=`pix3 ${be}
|
|
440
|
+
|
|
441
|
+
Usage:
|
|
442
|
+
pix3 new List recipes and templates
|
|
443
|
+
pix3 new <recipe> [dir] Create a project (dir defaults to the recipe id)
|
|
444
|
+
[--name <project name>]
|
|
445
|
+
pix3 mcp --workspace MCP server for your agent (stdio), relayed through the
|
|
446
|
+
[--project <dir>] running \`pix3 serve\` to the connected Pix3 editor
|
|
447
|
+
pix3 mcp [--project <dir>] (phase-0 prototype) MCP server + FSA loopback link
|
|
448
|
+
[--agent <name>]
|
|
449
|
+
pix3 setup [claude|codex] Print how to register the MCP server with your agent
|
|
450
|
+
pix3 serve [--project <dir>] Serve this project folder to a Pix3 editor over one
|
|
451
|
+
[--port <n>] [--new-token] loopback port (e.g. through VS Code Remote SSH)
|
|
452
|
+
pix3 validate [paths\u2026] [--json] Strict scene check: schema, references, guards, then
|
|
453
|
+
[--no-hydrate] hydration with the real loader (exit 1 on errors)
|
|
454
|
+
pix3 check [--json] validate + TypeScript check of the scripts + merge-log +
|
|
455
|
+
[--no-hydrate] [--offline] version check (exit 1 on errors)
|
|
456
|
+
[--project <dir>]
|
|
457
|
+
pix3 smoke [scene] [--json] Run the game headless in Node for N frames (no browser):
|
|
458
|
+
[--changed | --all] script throws with frame + stack, console errors, missing
|
|
459
|
+
[--frames N] [--timeout S] res:// (exit 1 on errors, 2 when it cannot run). No scene =
|
|
460
|
+
[--project <dir>] the scenes git changes reach, else every top-level scene
|
|
461
|
+
pix3 tree [scene] [--json] One line per node (type#id, pos, size, layout, components,
|
|
462
|
+
[--depth N] [--types A,B] prefab instances); no scene = project overview
|
|
463
|
+
[--props] [--project <dir>]
|
|
464
|
+
pix3 kit [--update] Install (or update) the agent kit: AGENTS.md, CLAUDE.md,
|
|
465
|
+
[--project <dir>] .claude/skills/pix3-*, .mcp.json, script types
|
|
466
|
+
pix3 read <path> Print a project file and confirm to the editor that you
|
|
467
|
+
read exactly these bytes (.pix3/ack.json)
|
|
468
|
+
pix3 ack <path> --sha256 <hash> Confirm you read the version with this byte hash
|
|
469
|
+
pix3 sfx <preset|"text"> Synthesize a sound effect offline into a WAV (coin, jump,
|
|
470
|
+
[--out <file.wav>] hit, explosion, powerup, click; or "big explosion")
|
|
471
|
+
[--seed <n>] [--json]
|
|
472
|
+
pix3 --version
|
|
473
|
+
`;ar();var kle=t=>{let e=[],r=new Map;for(let n=0;n<t.length;n++){let s=t[n];if(s.startsWith("--")){let o=s.indexOf("=");o>0?r.set(s.slice(2,o),s.slice(o+1)):n+1<t.length&&!t[n+1].startsWith("-")?r.set(s.slice(2),t[++n]):r.set(s.slice(2),!0)}else s==="-v"?r.set("version",!0):s==="-h"?r.set("help",!0):e.push(s)}return{positionals:e,flags:r}},pn=(t,e)=>{let r=t.flags.get(e);return typeof r=="string"?r:void 0},xle=()=>{let t=Yy().filter(n=>!n.hidden),e=Math.max(...t.map(n=>n.id.length)),r=(n,s)=>{if(s.length!==0){process.stdout.write(`${n}
|
|
474
|
+
`);for(let o of s)process.stdout.write(` ${o.id.padEnd(e)} ${o.title} \u2014 ${tI(o.description)}
|
|
475
|
+
`);process.stdout.write(`
|
|
476
|
+
`)}};r("Recipes (ship design/recipe.md \u2014 a playable core loop):",t.filter(n=>n.isRecipe)),r("Starter templates:",t.filter(n=>!n.isRecipe)),process.stdout.write(`Create one: pix3 new <id> [dir] (recipes also by short name: pix3 new tapper)
|
|
477
|
+
`)},Ele=async t=>{let[,e,r]=t.positionals;if(!e)return xle(),0;let n=eI(e,Yy());if("error"in n)return process.stderr.write(`pix3: ${n.error}
|
|
478
|
+
`),1;let s=FE(process.cwd(),r??n.template.id),o=f=>{process.stderr.write(`${f}
|
|
479
|
+
`)},{ensureKit:i}=await Promise.resolve().then(()=>(u_(),wI)),{ensureRuntimeTypes:a}=await Promise.resolve().then(()=>(wc(),bf)),{agentKitStep:c}=await Promise.resolve().then(()=>(v_(),OI)),l=await i({log:o}),u=a({log:o}),d=HO({template:n.template,dir:s,projectName:pn(t,"name"),postCreateSteps:[c(l,u)]});return process.stdout.write(`Created ${d.projectName} from ${d.template.id} in ${d.dir}
|
|
480
|
+
${d.files.length} files, project id ${d.projectId}, agent kit ${l.manifest.version}
|
|
481
|
+
|
|
482
|
+
Next: open that folder in Pix3 (Open Folder), or run \`pix3 serve\` in it and connect
|
|
483
|
+
(File \u2192 Connect to Workspace\u2026); then start your agent inside it \u2014 AGENTS.md / CLAUDE.md
|
|
484
|
+
and .claude/skills/ tell it how, .mcp.json connects it, \`pix3 check\` verifies its work.
|
|
485
|
+
`),0},Tle=async()=>{let t=kle(process.argv.slice(2)),e=t.positionals[0];if(t.flags.has("version"))return process.stdout.write(`${be}
|
|
486
|
+
`),0;if(!e||t.flags.has("help")||e==="help")return process.stdout.write(Xy),e||t.flags.has("help")?0:1;switch(e){case"new":return Ele(t);case"check":return(await Promise.resolve().then(()=>(XI(),YI))).runCheck(process.argv.slice(process.argv.indexOf("check")+1),{cwd:process.cwd(),stdout:r=>process.stdout.write(r),stderr:r=>process.stderr.write(r)});case"kit":return(await Promise.resolve().then(()=>(eN(),QI))).runKitCli({cwd:process.cwd(),projectDir:pn(t,"project"),update:t.flags.has("update")});case"mcp":{if(t.flags.has("workspace")){let{runMcpWorkspace:n}=await Promise.resolve().then(()=>(R2(),C2));return await n({cwd:process.cwd(),projectDir:pn(t,"project"),agent:pn(t,"agent")??(process.env.PIX3_AGENT||void 0)}),-1}let{runMcp:r}=await Promise.resolve().then(()=>(rF(),tF));return await r({cwd:process.cwd(),projectDir:pn(t,"project"),agent:pn(t,"agent")??(process.env.PIX3_AGENT||void 0)}),-1}case"setup":{let r=t.positionals[1]??null;if(r!==null&&r!=="claude"&&r!=="codex")return process.stderr.write(`pix3: setup takes claude or codex, not "${r}".
|
|
487
|
+
`),1;let{findProjectRoot:n}=await Promise.resolve().then(()=>(lt(),RO)),{setupInstructions:s}=await Promise.resolve().then(()=>(gf(),ZO)),o=pn(t,"project"),i=o?FE(process.cwd(),o):n(process.cwd())??FE(process.cwd());return process.stdout.write(s(r,i)),0}case"serve":{let{runServe:r}=await Promise.resolve().then(()=>(jZ(),zZ)),n=t.flags.get("port");return n===!0?(process.stderr.write(`pix3: --port needs a number.
|
|
488
|
+
`),1):r({cwd:process.cwd(),projectDir:pn(t,"project"),port:n,newToken:t.flags.has("new-token")})}case"read":case"ack":{let r=t.positionals[1];if(!r)return process.stderr.write(`pix3: ${e} needs a file path.
|
|
489
|
+
`),1;let{ackFile:n,readAndAck:s}=await Promise.resolve().then(()=>(DZ(),LZ)),o=pn(t,"project");if(e==="read")return process.stdout.write(s({cwd:process.cwd(),file:r,projectDir:o}).bytes),0;if(t.flags.get("sha256")===!0)return process.stderr.write(`pix3: --sha256 needs a hash.
|
|
490
|
+
`),1;let i=n({cwd:process.cwd(),file:r,projectDir:o,hash:pn(t,"sha256")});return process.stdout.write(`acked ${i.path} ${i.sha256}
|
|
491
|
+
`),0}case"smoke":return(await Promise.resolve().then(()=>(gU(),mU))).runSmokeCli(process.argv.slice(process.argv.indexOf("smoke")+1),{cwd:process.cwd(),stdout:r=>process.stdout.write(r),stderr:r=>process.stderr.write(r)});case"tree":return(await Promise.resolve().then(()=>(jU(),zU))).runTreeCli(process.argv.slice(process.argv.indexOf("tree")+1),{cwd:process.cwd(),stdout:r=>process.stdout.write(r),stderr:r=>process.stderr.write(r)});case"validate":return(await Promise.resolve().then(()=>($_(),S_))).runValidateCli(process.argv.slice(process.argv.indexOf("validate")+1));case"sfx":return(await Promise.resolve().then(()=>(JU(),WU))).runSfx(process.argv.slice(process.argv.indexOf("sfx")+1),{cwd:process.cwd(),stdout:r=>process.stdout.write(r),stderr:r=>process.stderr.write(r)});default:return process.stderr.write(`pix3: unknown command "${e}".
|
|
492
|
+
|
|
493
|
+
${Xy}`),1}};Tle().then(t=>{t>=0&&(process.exitCode=t)},t=>{process.stderr.write(`pix3: ${t instanceof Error?t.message:String(t)}
|
|
494
|
+
`),process.exitCode=1});
|