buildkeel 0.0.1 → 0.2.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.
Files changed (40) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +35 -3
  3. package/THIRD-PARTY-NOTICES +231 -0
  4. package/antigravity/LICENSE +49 -0
  5. package/antigravity/THIRD-PARTY-NOTICES +231 -0
  6. package/antigravity/bin/bk-launch +38 -0
  7. package/antigravity/bin/bk-launch.cmd +50 -0
  8. package/antigravity/dist/hooks/main.js +20 -0
  9. package/antigravity/dist/server/main.js +479 -0
  10. package/antigravity/package.json +8 -0
  11. package/antigravity/plugin.json +6 -0
  12. package/antigravity/rules/buildkeel.md +72 -0
  13. package/antigravity/skills/bk-adhoc/SKILL.md +49 -0
  14. package/antigravity/skills/bk-approve/SKILL.md +52 -0
  15. package/antigravity/skills/bk-build/SKILL.md +61 -0
  16. package/antigravity/skills/bk-capture/SKILL.md +105 -0
  17. package/antigravity/skills/bk-done/SKILL.md +66 -0
  18. package/antigravity/skills/bk-impact/SKILL.md +53 -0
  19. package/antigravity/skills/bk-init/SKILL.md +42 -0
  20. package/antigravity/skills/bk-migrate/SKILL.md +19 -0
  21. package/antigravity/skills/bk-new/SKILL.md +112 -0
  22. package/antigravity/skills/bk-onboard/SKILL.md +135 -0
  23. package/antigravity/skills/bk-start/SKILL.md +44 -0
  24. package/antigravity/skills/bk-stats/SKILL.md +38 -0
  25. package/antigravity/skills/bk-status/SKILL.md +18 -0
  26. package/antigravity/templates/adhoc.md +15 -0
  27. package/antigravity/templates/bug.md +33 -0
  28. package/antigravity/templates/design.md +48 -0
  29. package/antigravity/templates/epic.md +30 -0
  30. package/antigravity/templates/idea.md +34 -0
  31. package/antigravity/templates/spec-driven/capability.md +28 -0
  32. package/antigravity/templates/spec-driven/proposal.md +39 -0
  33. package/antigravity/templates/spec-driven/spec-change.md +43 -0
  34. package/antigravity/templates/spec-driven/tasks.md +17 -0
  35. package/antigravity/templates/story.md +30 -0
  36. package/antigravity/templates/task.md +21 -0
  37. package/antigravity/templates/test-plan.md +29 -0
  38. package/cli.mjs +220 -0
  39. package/package.json +14 -9
  40. package/bin/buildkeel.js +0 -3
@@ -0,0 +1,479 @@
1
+ import { createRequire as __bkCreateRequire } from 'node:module'; const require = __bkCreateRequire(import.meta.url);
2
+ var nJ=Object.create;var gS=Object.defineProperty;var iJ=Object.getOwnPropertyDescriptor;var oJ=Object.getOwnPropertyNames;var sJ=Object.getPrototypeOf,aJ=Object.prototype.hasOwnProperty;var Sg=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var I=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},go=(e,t)=>{for(var r in t)gS(e,r,{get:t[r],enumerable:!0})},cJ=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of oJ(t))!aJ.call(e,n)&&n!==r&&gS(e,n,{get:()=>t[n],enumerable:!(i=iJ(t,n))||i.enumerable});return e};var Lt=(e,t,r)=>(r=e!=null?nJ(sJ(e)):{},cJ(t||!e||!e.__esModule?gS(r,"default",{value:e,enumerable:!0}):r,e));var Bf=I(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.regexpCode=at.getEsmExportName=at.getProperty=at.safeStringify=at.stringify=at.strConcat=at.addCodeArg=at.str=at._=at.nil=at._Code=at.Name=at.IDENTIFIER=at._CodeOrName=void 0;var Zf=class{};at._CodeOrName=Zf;at.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ua=class extends Zf{constructor(t){if(super(),!at.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};at.Name=Ua;var Hn=class extends Zf{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,i)=>`${r}${i}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,i)=>(i instanceof Ua&&(r[i.str]=(r[i.str]||0)+1),r),{})}};at._Code=Hn;at.nil=new Hn("");function xL(e,...t){let r=[e[0]],i=0;for(;i<t.length;)qT(r,t[i]),r.push(e[++i]);return new Hn(r)}at._=xL;var UT=new Hn("+");function IL(e,...t){let r=[Vf(e[0])],i=0;for(;i<t.length;)r.push(UT),qT(r,t[i]),r.push(UT,Vf(e[++i]));return BX(r),new Hn(r)}at.str=IL;function qT(e,t){t instanceof Hn?e.push(...t._items):t instanceof Ua?e.push(t):e.push(GX(t))}at.addCodeArg=qT;function BX(e){let t=1;for(;t<e.length-1;){if(e[t]===UT){let r=KX(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function KX(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Ua||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Ua))return`"${e}${t.slice(1)}`}function WX(e,t){return t.emptyStr()?e:e.emptyStr()?t:IL`${e}${t}`}at.strConcat=WX;function GX(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Vf(Array.isArray(e)?e.join(","):e)}function HX(e){return new Hn(Vf(e))}at.stringify=HX;function Vf(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}at.safeStringify=Vf;function JX(e){return typeof e=="string"&&at.IDENTIFIER.test(e)?new Hn(`.${e}`):xL`[${e}]`}at.getProperty=JX;function YX(e){if(typeof e=="string"&&at.IDENTIFIER.test(e))return new Hn(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}at.getEsmExportName=YX;function XX(e){return new Hn(e.toString())}at.regexpCode=XX});var VT=I(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.ValueScope=mn.ValueScopeName=mn.Scope=mn.varKinds=mn.UsedValueState=void 0;var fn=Bf(),FT=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},hb;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(hb||(mn.UsedValueState=hb={}));mn.varKinds={const:new fn.Name("const"),let:new fn.Name("let"),var:new fn.Name("var")};var gb=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof fn.Name?t:this.name(t)}name(t){return new fn.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};mn.Scope=gb;var yb=class extends fn.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:i}){this.value=t,this.scopePath=(0,fn._)`.${new fn.Name(r)}[${i}]`}};mn.ValueScopeName=yb;var QX=(0,fn._)`\n`,ZT=class extends gb{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?QX:fn.nil}}get(){return this._scope}name(t){return new yb(t,this._newName(t))}value(t,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,n);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(t,r){let i=this._values[t];if(i)return i.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,fn._)`${t}${i.scopePath}`})}scopeCode(t=this._values,r,i){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(t,r,i={},n){let o=fn.nil;for(let s in t){let a=t[s];if(!a)continue;let c=i[s]=i[s]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,hb.Started);let u=r(l);if(u){let d=this.opts.es5?mn.varKinds.var:mn.varKinds.const;o=(0,fn._)`${o}${d} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))o=(0,fn._)`${o}${u}${this.opts._n}`;else throw new FT(l);c.set(l,hb.Completed)})}return o}};mn.ValueScope=ZT});var Ue=I(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.or=ze.and=ze.not=ze.CodeGen=ze.operators=ze.varKinds=ze.ValueScopeName=ze.ValueScope=ze.Scope=ze.Name=ze.regexpCode=ze.stringify=ze.getProperty=ze.nil=ze.strConcat=ze.str=ze._=void 0;var Je=Bf(),fi=VT(),$s=Bf();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return $s._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return $s.str}});Object.defineProperty(ze,"strConcat",{enumerable:!0,get:function(){return $s.strConcat}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return $s.nil}});Object.defineProperty(ze,"getProperty",{enumerable:!0,get:function(){return $s.getProperty}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return $s.stringify}});Object.defineProperty(ze,"regexpCode",{enumerable:!0,get:function(){return $s.regexpCode}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return $s.Name}});var wb=VT();Object.defineProperty(ze,"Scope",{enumerable:!0,get:function(){return wb.Scope}});Object.defineProperty(ze,"ValueScope",{enumerable:!0,get:function(){return wb.ValueScope}});Object.defineProperty(ze,"ValueScopeName",{enumerable:!0,get:function(){return wb.ValueScopeName}});Object.defineProperty(ze,"varKinds",{enumerable:!0,get:function(){return wb.varKinds}});ze.operators={GT:new Je._Code(">"),GTE:new Je._Code(">="),LT:new Je._Code("<"),LTE:new Je._Code("<="),EQ:new Je._Code("==="),NEQ:new Je._Code("!=="),NOT:new Je._Code("!"),OR:new Je._Code("||"),AND:new Je._Code("&&"),ADD:new Je._Code("+")};var xo=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},BT=class extends xo{constructor(t,r,i){super(),this.varKind=t,this.name=r,this.rhs=i}render({es5:t,_n:r}){let i=t?fi.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=su(this.rhs,t,r)),this}get names(){return this.rhs instanceof Je._CodeOrName?this.rhs.names:{}}},vb=class extends xo{constructor(t,r,i){super(),this.lhs=t,this.rhs=r,this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Je.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=su(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Je.Name?{}:{...this.lhs.names};return bb(t,this.rhs)}},KT=class extends vb{constructor(t,r,i,n){super(t,i,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},WT=class extends xo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},GT=class extends xo{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},HT=class extends xo{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},JT=class extends xo{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=su(this.code,t,r),this}get names(){return this.code instanceof Je._CodeOrName?this.code.names:{}}},Kf=class extends xo{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,i)=>r+i.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let i=t[r].optimizeNodes();Array.isArray(i)?t.splice(r,1,...i):i?t[r]=i:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(t,r)||(eQ(t,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Za(t,r.names),{})}},Io=class extends Kf{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},YT=class extends Kf{},ou=class extends Io{};ou.kind="else";var qa=class e extends Io{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new ou(i):i}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(TL(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=su(this.condition,t,r),this}get names(){let t=super.names;return bb(t,this.condition),this.else&&Za(t,this.else.names),t}};qa.kind="if";var Fa=class extends Io{};Fa.kind="for";var XT=class extends Fa{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=su(this.iteration,t,r),this}get names(){return Za(super.names,this.iteration.names)}},QT=class extends Fa{constructor(t,r,i,n){super(),this.varKind=t,this.name=r,this.from=i,this.to=n}render(t){let r=t.es5?fi.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){let t=bb(super.names,this.from);return bb(t,this.to)}},$b=class extends Fa{constructor(t,r,i,n){super(),this.loop=t,this.varKind=r,this.name=i,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=su(this.iterable,t,r),this}get names(){return Za(super.names,this.iterable.names)}},Wf=class extends Io{constructor(t,r,i){super(),this.name=t,this.args=r,this.async=i}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Wf.kind="func";var Gf=class extends Kf{render(t){return"return "+super.render(t)}};Gf.kind="return";var eP=class extends Io{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var i,n;return super.optimizeNames(t,r),(i=this.catch)===null||i===void 0||i.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Za(t,this.catch.names),this.finally&&Za(t,this.finally.names),t}},Hf=class extends Io{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Hf.kind="catch";var Jf=class extends Io{render(t){return"finally"+super.render(t)}};Jf.kind="finally";var tP=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new fi.Scope({parent:t}),this._nodes=[new YT]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let i=this._extScope.value(t,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new BT(t,o,i)),o}const(t,r,i){return this._def(fi.varKinds.const,t,r,i)}let(t,r,i){return this._def(fi.varKinds.let,t,r,i)}var(t,r,i){return this._def(fi.varKinds.var,t,r,i)}assign(t,r,i){return this._leafNode(new vb(t,r,i))}add(t,r){return this._leafNode(new KT(t,ze.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Je.nil&&this._leafNode(new JT(t)),this}object(...t){let r=["{"];for(let[i,n]of t)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,Je.addCodeArg)(r,n));return r.push("}"),new Je._Code(r)}if(t,r,i){if(this._blockNode(new qa(t)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new qa(t))}else(){return this._elseNode(new ou)}endIf(){return this._endBlockNode(qa,ou)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new XT(t),r)}forRange(t,r,i,n,o=this.opts.es5?fi.varKinds.var:fi.varKinds.let){let s=this._scope.toName(t);return this._for(new QT(o,s,r,i),()=>n(s))}forOf(t,r,i,n=fi.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let s=r instanceof Je.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Je._)`${s}.length`,a=>{this.var(o,(0,Je._)`${s}[${a}]`),i(o)})}return this._for(new $b("of",n,o,r),()=>i(o))}forIn(t,r,i,n=this.opts.es5?fi.varKinds.var:fi.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Je._)`Object.keys(${r})`,i);let o=this._scope.toName(t);return this._for(new $b("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(Fa)}label(t){return this._leafNode(new WT(t))}break(t){return this._leafNode(new GT(t))}return(t){let r=new Gf;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Gf)}try(t,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new eP;if(this._blockNode(n),this.code(t),r){let o=this.name("e");this._currNode=n.catch=new Hf(o),r(o)}return i&&(this._currNode=n.finally=new Jf,this.code(i)),this._endBlockNode(Hf,Jf)}throw(t){return this._leafNode(new HT(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||t!==void 0&&i!==t)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Je.nil,i,n){return this._blockNode(new Wf(t,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Wf)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let i=this._currNode;if(i instanceof t||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof qa))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};ze.CodeGen=tP;function Za(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function bb(e,t){return t instanceof Je._CodeOrName?Za(e,t.names):e}function su(e,t,r){if(e instanceof Je.Name)return i(e);if(!n(e))return e;return new Je._Code(e._items.reduce((o,s)=>(s instanceof Je.Name&&(s=i(s)),s instanceof Je._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||t[o.str]!==1?o:(delete t[o.str],s)}function n(o){return o instanceof Je._Code&&o._items.some(s=>s instanceof Je.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function eQ(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function TL(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Je._)`!${rP(e)}`}ze.not=TL;var tQ=PL(ze.operators.AND);function rQ(...e){return e.reduce(tQ)}ze.and=rQ;var nQ=PL(ze.operators.OR);function iQ(...e){return e.reduce(nQ)}ze.or=iQ;function PL(e){return(t,r)=>t===Je.nil?r:r===Je.nil?t:(0,Je._)`${rP(t)} ${e} ${rP(r)}`}function rP(e){return e instanceof Je.Name?e:(0,Je._)`(${e})`}});var Qe=I(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.checkStrictMode=qe.getErrorPath=qe.Type=qe.useFunc=qe.setEvaluated=qe.evaluatedPropsToName=qe.mergeEvaluated=qe.eachItem=qe.unescapeJsonPointer=qe.escapeJsonPointer=qe.escapeFragment=qe.unescapeFragment=qe.schemaRefOrVal=qe.schemaHasRulesButRef=qe.schemaHasRules=qe.checkUnknownRules=qe.alwaysValidSchema=qe.toHash=void 0;var Ct=Ue(),oQ=Bf();function sQ(e){let t={};for(let r of e)t[r]=!0;return t}qe.toHash=sQ;function aQ(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(AL(e,t),!EL(t,e.self.RULES.all))}qe.alwaysValidSchema=aQ;function AL(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=i.RULES.keywords;for(let o in t)n[o]||jL(e,`unknown keyword: "${o}"`)}qe.checkUnknownRules=AL;function EL(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}qe.schemaHasRules=EL;function cQ(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}qe.schemaHasRulesButRef=cQ;function lQ({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ct._)`${r}`}return(0,Ct._)`${e}${t}${(0,Ct.getProperty)(i)}`}qe.schemaRefOrVal=lQ;function uQ(e){return OL(decodeURIComponent(e))}qe.unescapeFragment=uQ;function dQ(e){return encodeURIComponent(iP(e))}qe.escapeFragment=dQ;function iP(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}qe.escapeJsonPointer=iP;function OL(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}qe.unescapeJsonPointer=OL;function pQ(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}qe.eachItem=pQ;function RL({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let c=s===void 0?o:s instanceof Ct.Name?(o instanceof Ct.Name?e(n,o,s):t(n,o,s),s):o instanceof Ct.Name?(t(n,s,o),o):r(o,s);return a===Ct.Name&&!(c instanceof Ct.Name)?i(n,c):c}}qe.mergeEvaluated={props:RL({mergeNames:(e,t,r)=>e.if((0,Ct._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Ct._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Ct._)`${r} || {}`).code((0,Ct._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Ct._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Ct._)`${r} || {}`),oP(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:NL}),items:RL({mergeNames:(e,t,r)=>e.if((0,Ct._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Ct._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Ct._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Ct._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function NL(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Ct._)`{}`);return t!==void 0&&oP(e,r,t),r}qe.evaluatedPropsToName=NL;function oP(e,t,r){Object.keys(r).forEach(i=>e.assign((0,Ct._)`${t}${(0,Ct.getProperty)(i)}`,!0))}qe.setEvaluated=oP;var CL={};function fQ(e,t){return e.scopeValue("func",{ref:t,code:CL[t.code]||(CL[t.code]=new oQ._Code(t.code))})}qe.useFunc=fQ;var nP;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(nP||(qe.Type=nP={}));function mQ(e,t,r){if(e instanceof Ct.Name){let i=t===nP.Num;return r?i?(0,Ct._)`"[" + ${e} + "]"`:(0,Ct._)`"['" + ${e} + "']"`:i?(0,Ct._)`"/" + ${e}`:(0,Ct._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ct.getProperty)(e).toString():"/"+iP(e)}qe.getErrorPath=mQ;function jL(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}qe.checkStrictMode=jL});var To=I(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});var Mr=Ue(),hQ={data:new Mr.Name("data"),valCxt:new Mr.Name("valCxt"),instancePath:new Mr.Name("instancePath"),parentData:new Mr.Name("parentData"),parentDataProperty:new Mr.Name("parentDataProperty"),rootData:new Mr.Name("rootData"),dynamicAnchors:new Mr.Name("dynamicAnchors"),vErrors:new Mr.Name("vErrors"),errors:new Mr.Name("errors"),this:new Mr.Name("this"),self:new Mr.Name("self"),scope:new Mr.Name("scope"),json:new Mr.Name("json"),jsonPos:new Mr.Name("jsonPos"),jsonLen:new Mr.Name("jsonLen"),jsonPart:new Mr.Name("jsonPart")};sP.default=hQ});var Yf=I(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.extendErrors=Lr.resetErrorsCount=Lr.reportExtraError=Lr.reportError=Lr.keyword$DataError=Lr.keywordError=void 0;var et=Ue(),_b=Qe(),Qr=To();Lr.keywordError={message:({keyword:e})=>(0,et.str)`must pass "${e}" keyword validation`};Lr.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,et.str)`"${e}" keyword must be ${t} ($data)`:(0,et.str)`"${e}" keyword is invalid ($data)`};function gQ(e,t=Lr.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:a}=n,c=ML(e,t,r);i??(s||a)?zL(o,c):DL(n,(0,et._)`[${c}]`)}Lr.reportError=gQ;function yQ(e,t=Lr.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,a=ML(e,t,r);zL(n,a),o||s||DL(i,Qr.default.vErrors)}Lr.reportExtraError=yQ;function vQ(e,t){e.assign(Qr.default.errors,t),e.if((0,et._)`${Qr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,et._)`${Qr.default.vErrors}.length`,t),()=>e.assign(Qr.default.vErrors,null)))}Lr.resetErrorsCount=vQ;function $Q({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Qr.default.errors,a=>{e.const(s,(0,et._)`${Qr.default.vErrors}[${a}]`),e.if((0,et._)`${s}.instancePath === undefined`,()=>e.assign((0,et._)`${s}.instancePath`,(0,et.strConcat)(Qr.default.instancePath,o.errorPath))),e.assign((0,et._)`${s}.schemaPath`,(0,et.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,et._)`${s}.schema`,r),e.assign((0,et._)`${s}.data`,i))})}Lr.extendErrors=$Q;function zL(e,t){let r=e.const("err",t);e.if((0,et._)`${Qr.default.vErrors} === null`,()=>e.assign(Qr.default.vErrors,(0,et._)`[${r}]`),(0,et._)`${Qr.default.vErrors}.push(${r})`),e.code((0,et._)`${Qr.default.errors}++`)}function DL(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,et._)`new ${e.ValidationError}(${t})`):(r.assign((0,et._)`${i}.errors`,t),r.return(!1))}var Va={keyword:new et.Name("keyword"),schemaPath:new et.Name("schemaPath"),params:new et.Name("params"),propertyName:new et.Name("propertyName"),message:new et.Name("message"),schema:new et.Name("schema"),parentSchema:new et.Name("parentSchema")};function ML(e,t,r){let{createErrors:i}=e.it;return i===!1?(0,et._)`{}`:bQ(e,t,r)}function bQ(e,t,r={}){let{gen:i,it:n}=e,o=[wQ(n,r),_Q(e,r)];return kQ(e,t,o),i.object(...o)}function wQ({errorPath:e},{instancePath:t}){let r=t?(0,et.str)`${e}${(0,_b.getErrorPath)(t,_b.Type.Str)}`:e;return[Qr.default.instancePath,(0,et.strConcat)(Qr.default.instancePath,r)]}function _Q({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,et.str)`${t}/${e}`;return r&&(n=(0,et.str)`${n}${(0,_b.getErrorPath)(r,_b.Type.Str)}`),[Va.schemaPath,n]}function kQ(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;i.push([Va.keyword,n],[Va.params,typeof t=="function"?t(e):t||(0,et._)`{}`]),c.messages&&i.push([Va.message,typeof r=="function"?r(e):r]),c.verbose&&i.push([Va.schema,s],[Va.parentSchema,(0,et._)`${u}${d}`],[Qr.default.data,o]),l&&i.push([Va.propertyName,l])}});var UL=I(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.boolOrEmptySchema=au.topBoolOrEmptySchema=void 0;var SQ=Yf(),xQ=Ue(),IQ=To(),TQ={message:"boolean schema is false"};function PQ(e){let{gen:t,schema:r,validateName:i}=e;r===!1?LL(e,!1):typeof r=="object"&&r.$async===!0?t.return(IQ.default.data):(t.assign((0,xQ._)`${i}.errors`,null),t.return(!0))}au.topBoolOrEmptySchema=PQ;function RQ(e,t){let{gen:r,schema:i}=e;i===!1?(r.var(t,!1),LL(e)):r.var(t,!0)}au.boolOrEmptySchema=RQ;function LL(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,SQ.reportError)(n,TQ,void 0,t)}});var aP=I(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.getRules=cu.isJSONType=void 0;var CQ=["string","number","integer","boolean","null","object","array"],AQ=new Set(CQ);function EQ(e){return typeof e=="string"&&AQ.has(e)}cu.isJSONType=EQ;function OQ(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}cu.getRules=OQ});var cP=I(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.shouldUseRule=bs.shouldUseGroup=bs.schemaHasRulesForType=void 0;function NQ({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&qL(e,i)}bs.schemaHasRulesForType=NQ;function qL(e,t){return t.rules.some(r=>FL(e,r))}bs.shouldUseGroup=qL;function FL(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(i=>e[i]!==void 0))}bs.shouldUseRule=FL});var Xf=I(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.reportTypeError=Ur.checkDataTypes=Ur.checkDataType=Ur.coerceAndCheckDataType=Ur.getJSONTypes=Ur.getSchemaTypes=Ur.DataType=void 0;var jQ=aP(),zQ=cP(),DQ=Yf(),Te=Ue(),ZL=Qe(),lu;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(lu||(Ur.DataType=lu={}));function MQ(e){let t=VL(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ur.getSchemaTypes=MQ;function VL(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(jQ.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ur.getJSONTypes=VL;function LQ(e,t){let{gen:r,data:i,opts:n}=e,o=UQ(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,zQ.schemaHasRulesForType)(e,t[0]));if(s){let a=uP(t,i,n.strictNumbers,lu.Wrong);r.if(a,()=>{o.length?qQ(e,t,o):dP(e)})}return s}Ur.coerceAndCheckDataType=LQ;var BL=new Set(["string","number","integer","boolean","null"]);function UQ(e,t){return t?e.filter(r=>BL.has(r)||t==="array"&&r==="array"):[]}function qQ(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",(0,Te._)`typeof ${n}`),a=i.let("coerced",(0,Te._)`undefined`);o.coerceTypes==="array"&&i.if((0,Te._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,Te._)`${n}[0]`).assign(s,(0,Te._)`typeof ${n}`).if(uP(t,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,Te._)`${a} !== undefined`);for(let l of r)(BL.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);i.else(),dP(e),i.endIf(),i.if((0,Te._)`${a} !== undefined`,()=>{i.assign(n,a),FQ(e,a)});function c(l){switch(l){case"string":i.elseIf((0,Te._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Te._)`"" + ${n}`).elseIf((0,Te._)`${n} === null`).assign(a,(0,Te._)`""`);return;case"number":i.elseIf((0,Te._)`${s} == "boolean" || ${n} === null
4
+ || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,Te._)`+${n}`);return;case"integer":i.elseIf((0,Te._)`${s} === "boolean" || ${n} === null
5
+ || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,Te._)`+${n}`);return;case"boolean":i.elseIf((0,Te._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,Te._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,Te._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,Te._)`${s} === "string" || ${s} === "number"
6
+ || ${s} === "boolean" || ${n} === null`).assign(a,(0,Te._)`[${n}]`)}}}function FQ({gen:e,parentData:t,parentDataProperty:r},i){e.if((0,Te._)`${t} !== undefined`,()=>e.assign((0,Te._)`${t}[${r}]`,i))}function lP(e,t,r,i=lu.Correct){let n=i===lu.Correct?Te.operators.EQ:Te.operators.NEQ,o;switch(e){case"null":return(0,Te._)`${t} ${n} null`;case"array":o=(0,Te._)`Array.isArray(${t})`;break;case"object":o=(0,Te._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s((0,Te._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return(0,Te._)`typeof ${t} ${n} ${e}`}return i===lu.Correct?o:(0,Te.not)(o);function s(a=Te.nil){return(0,Te.and)((0,Te._)`typeof ${t} == "number"`,a,r?(0,Te._)`isFinite(${t})`:Te.nil)}}Ur.checkDataType=lP;function uP(e,t,r,i){if(e.length===1)return lP(e[0],t,r,i);let n,o=(0,ZL.toHash)(e);if(o.array&&o.object){let s=(0,Te._)`typeof ${t} != "object"`;n=o.null?s:(0,Te._)`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=Te.nil;o.number&&delete o.integer;for(let s in o)n=(0,Te.and)(n,lP(s,t,r,i));return n}Ur.checkDataTypes=uP;var ZQ={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Te._)`{type: ${e}}`:(0,Te._)`{type: ${t}}`};function dP(e){let t=VQ(e);(0,DQ.reportError)(t,ZQ)}Ur.reportTypeError=dP;function VQ(e){let{gen:t,data:r,schema:i}=e,n=(0,ZL.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var WL=I(kb=>{"use strict";Object.defineProperty(kb,"__esModule",{value:!0});kb.assignDefaults=void 0;var uu=Ue(),BQ=Qe();function KQ(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)KL(e,n,r[n].default);else t==="array"&&Array.isArray(i)&&i.forEach((n,o)=>KL(e,o,n.default))}kb.assignDefaults=KQ;function KL(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let a=(0,uu._)`${o}${(0,uu.getProperty)(t)}`;if(n){(0,BQ.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,uu._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,uu._)`${c} || ${a} === null || ${a} === ""`),i.if(c,(0,uu._)`${a} = ${(0,uu.stringify)(r)}`)}});var Jn=I(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.validateUnion=xt.validateArray=xt.usePattern=xt.callValidateCode=xt.schemaProperties=xt.allSchemaProperties=xt.noPropertyInData=xt.propertyInData=xt.isOwnProperty=xt.hasPropFunc=xt.reportMissingProp=xt.checkMissingProp=xt.checkReportMissingProp=void 0;var Nt=Ue(),pP=Qe(),ws=To(),WQ=Qe();function GQ(e,t){let{gen:r,data:i,it:n}=e;r.if(mP(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Nt._)`${t}`},!0),e.error()})}xt.checkReportMissingProp=GQ;function HQ({gen:e,data:t,it:{opts:r}},i,n){return(0,Nt.or)(...i.map(o=>(0,Nt.and)(mP(e,t,o,r.ownProperties),(0,Nt._)`${n} = ${o}`)))}xt.checkMissingProp=HQ;function JQ(e,t){e.setParams({missingProperty:t},!0),e.error()}xt.reportMissingProp=JQ;function GL(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Nt._)`Object.prototype.hasOwnProperty`})}xt.hasPropFunc=GL;function fP(e,t,r){return(0,Nt._)`${GL(e)}.call(${t}, ${r})`}xt.isOwnProperty=fP;function YQ(e,t,r,i){let n=(0,Nt._)`${t}${(0,Nt.getProperty)(r)} !== undefined`;return i?(0,Nt._)`${n} && ${fP(e,t,r)}`:n}xt.propertyInData=YQ;function mP(e,t,r,i){let n=(0,Nt._)`${t}${(0,Nt.getProperty)(r)} === undefined`;return i?(0,Nt.or)(n,(0,Nt.not)(fP(e,t,r))):n}xt.noPropertyInData=mP;function HL(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}xt.allSchemaProperties=HL;function XQ(e,t){return HL(t).filter(r=>!(0,pP.alwaysValidSchema)(e,t[r]))}xt.schemaProperties=XQ;function QQ({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,c,l){let u=l?(0,Nt._)`${e}, ${t}, ${i}${n}`:t,d=[[ws.default.instancePath,(0,Nt.strConcat)(ws.default.instancePath,o)],[ws.default.parentData,s.parentData],[ws.default.parentDataProperty,s.parentDataProperty],[ws.default.rootData,ws.default.rootData]];s.opts.dynamicRef&&d.push([ws.default.dynamicAnchors,ws.default.dynamicAnchors]);let p=(0,Nt._)`${u}, ${r.object(...d)}`;return c!==Nt.nil?(0,Nt._)`${a}.call(${c}, ${p})`:(0,Nt._)`${a}(${p})`}xt.callValidateCode=QQ;var eee=(0,Nt._)`new RegExp`;function tee({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Nt._)`${n.code==="new RegExp"?eee:(0,WQ.useFunc)(e,n)}(${r}, ${i})`})}xt.usePattern=tee;function ree(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(o,!0),s(()=>t.break()),o;function s(a){let c=t.const("len",(0,Nt._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:pP.Type.Num},o),t.if((0,Nt.not)(o),a)})}}xt.validateArray=ree;function nee(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,pP.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:i,schemaProp:l,compositeRule:!0},a);t.assign(s,(0,Nt._)`${s} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,Nt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}xt.validateUnion=nee});var XL=I(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.validateKeywordUsage=Vi.validSchemaType=Vi.funcKeywordCode=Vi.macroKeywordCode=void 0;var en=Ue(),Ba=To(),iee=Jn(),oee=Yf();function see(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,a=t.macro.call(s.self,n,o,s),c=YL(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:en.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Vi.macroKeywordCode=see;function aee(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:c}=e;lee(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,s,c):t.validate,u=YL(i,n,l),d=i.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&JL(e),g(()=>e.error());else{let y=t.async?f():m();t.modifying&&JL(e),g(()=>cee(e,y))}}function f(){let y=i.let("ruleErrs",null);return i.try(()=>h((0,en._)`await `),v=>i.assign(d,!1).if((0,en._)`${v} instanceof ${c.ValidationError}`,()=>i.assign(y,(0,en._)`${v}.errors`),()=>i.throw(v))),y}function m(){let y=(0,en._)`${u}.errors`;return i.assign(y,null),h(en.nil),y}function h(y=t.async?(0,en._)`await `:en.nil){let v=c.opts.passContext?Ba.default.this:Ba.default.self,b=!("compile"in t&&!a||t.schema===!1);i.assign(d,(0,en._)`${y}${(0,iee.callValidateCode)(e,u,v,b)}`,t.modifying)}function g(y){var v;i.if((0,en.not)((v=t.valid)!==null&&v!==void 0?v:d),y)}}Vi.funcKeywordCode=aee;function JL(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,en._)`${i.parentData}[${i.parentDataProperty}]`))}function cee(e,t){let{gen:r}=e;r.if((0,en._)`Array.isArray(${t})`,()=>{r.assign(Ba.default.vErrors,(0,en._)`${Ba.default.vErrors} === null ? ${t} : ${Ba.default.vErrors}.concat(${t})`).assign(Ba.default.errors,(0,en._)`${Ba.default.vErrors}.length`),(0,oee.extendErrors)(e)},()=>e.error())}function lee({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function YL(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,en.stringify)(r)})}function uee(e,t,r=!1){return!t.length||t.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}Vi.validSchemaType=uee;function dee({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Vi.validateKeywordUsage=dee});var eU=I(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.extendSubschemaMode=_s.extendSubschemaData=_s.getSubschema=void 0;var Bi=Ue(),QL=Qe();function pee(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Bi._)`${e.schemaPath}${(0,Bi.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Bi._)`${e.schemaPath}${(0,Bi.getProperty)(t)}${(0,Bi.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,QL.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}_s.getSubschema=pee;function fee(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",(0,Bi._)`${t.data}${(0,Bi.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Bi.str)`${l}${(0,QL.getErrorPath)(r,i,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Bi._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let l=n instanceof Bi.Name?n:a.let("data",n,!0);c(l),s!==void 0&&(e.propertyName=s)}o&&(e.dataTypes=o);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}_s.extendSubschemaData=fee;function mee(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(e.compositeRule=i),n!==void 0&&(e.createErrors=n),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}_s.extendSubschemaMode=mee});var Qf=I((sAe,tU)=>{"use strict";tU.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var nU=I((aAe,rU)=>{"use strict";var ks=rU.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Sb(t,i,n,e,"",e)};ks.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ks.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ks.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ks.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 Sb(e,t,r,i,n,o,s,a,c,l){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,a,c,l);for(var u in i){var d=i[u];if(Array.isArray(d)){if(u in ks.arrayKeywords)for(var p=0;p<d.length;p++)Sb(e,t,r,d[p],n+"/"+u+"/"+p,o,n,u,i,p)}else if(u in ks.propsKeywords){if(d&&typeof d=="object")for(var f in d)Sb(e,t,r,d[f],n+"/"+u+"/"+hee(f),o,n,u,i,f)}else(u in ks.keywords||e.allKeys&&!(u in ks.skipKeywords))&&Sb(e,t,r,d,n+"/"+u,o,n,u,i)}r(i,n,o,s,a,c,l)}}function hee(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var em=I(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.getSchemaRefs=hn.resolveUrl=hn.normalizeId=hn._getFullPath=hn.getFullPath=hn.inlineRef=void 0;var gee=Qe(),yee=Qf(),vee=nU(),$ee=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function bee(e,t=!0){return typeof e=="boolean"?!0:t===!0?!hP(e):t?iU(e)<=t:!1}hn.inlineRef=bee;var wee=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hP(e){for(let t in e){if(wee.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(hP)||typeof r=="object"&&hP(r))return!0}return!1}function iU(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!$ee.has(r)&&(typeof e[r]=="object"&&(0,gee.eachItem)(e[r],i=>t+=iU(i)),t===1/0))return 1/0}return t}function oU(e,t="",r){r!==!1&&(t=du(t));let i=e.parse(t);return sU(e,i)}hn.getFullPath=oU;function sU(e,t){return e.serialize(t).split("#")[0]+"#"}hn._getFullPath=sU;var _ee=/#\/?$/;function du(e){return e?e.replace(_ee,""):""}hn.normalizeId=du;function kee(e,t,r){return r=du(r),e.resolve(t,r)}hn.resolveUrl=kee;var See=/^[a-z_][-a-z0-9._]*$/i;function xee(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=du(e[r]||t),o={"":n},s=oU(i,n,!1),a={},c=new Set;return vee(e,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),o[p]=g;function y(b){let _=this.opts.uriResolver.resolve;if(b=du(g?_(g,b):b),c.has(b))throw u(b);c.add(b);let k=this.refs[b];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?l(d,k.schema,b):b!==du(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function v(b){if(typeof b=="string"){if(!See.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),a;function l(d,p,f){if(p!==void 0&&!yee(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}hn.getSchemaRefs=xee});var nm=I(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.getData=Ss.KeywordCxt=Ss.validateFunctionCode=void 0;var dU=UL(),aU=Xf(),yP=cP(),xb=Xf(),Iee=WL(),rm=XL(),gP=eU(),ae=Ue(),be=To(),Tee=em(),Po=Qe(),tm=Yf();function Pee(e){if(mU(e)&&(hU(e),fU(e))){Aee(e);return}pU(e,()=>(0,dU.topBoolOrEmptySchema)(e))}Ss.validateFunctionCode=Pee;function pU({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){n.code.es5?e.func(t,(0,ae._)`${be.default.data}, ${be.default.valCxt}`,i.$async,()=>{e.code((0,ae._)`"use strict"; ${cU(r,n)}`),Cee(e,n),e.code(o)}):e.func(t,(0,ae._)`${be.default.data}, ${Ree(n)}`,i.$async,()=>e.code(cU(r,n)).code(o))}function Ree(e){return(0,ae._)`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?(0,ae._)`, ${be.default.dynamicAnchors}={}`:ae.nil}}={}`}function Cee(e,t){e.if(be.default.valCxt,()=>{e.var(be.default.instancePath,(0,ae._)`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,(0,ae._)`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,(0,ae._)`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,(0,ae._)`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef&&e.var(be.default.dynamicAnchors,(0,ae._)`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{e.var(be.default.instancePath,(0,ae._)`""`),e.var(be.default.parentData,(0,ae._)`undefined`),e.var(be.default.parentDataProperty,(0,ae._)`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef&&e.var(be.default.dynamicAnchors,(0,ae._)`{}`)})}function Aee(e){let{schema:t,opts:r,gen:i}=e;pU(e,()=>{r.$comment&&t.$comment&&yU(e),zee(e),i.let(be.default.vErrors,null),i.let(be.default.errors,0),r.unevaluated&&Eee(e),gU(e),Lee(e)})}function Eee(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,ae._)`${r}.evaluated`),t.if((0,ae._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,ae._)`${e.evaluated}.props`,(0,ae._)`undefined`)),t.if((0,ae._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,ae._)`${e.evaluated}.items`,(0,ae._)`undefined`))}function cU(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,ae._)`/*# sourceURL=${r} */`:ae.nil}function Oee(e,t){if(mU(e)&&(hU(e),fU(e))){Nee(e,t);return}(0,dU.boolOrEmptySchema)(e,t)}function fU({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function mU(e){return typeof e.schema!="boolean"}function Nee(e,t){let{schema:r,gen:i,opts:n}=e;n.$comment&&r.$comment&&yU(e),Dee(e),Mee(e);let o=i.const("_errs",be.default.errors);gU(e,o),i.var(t,(0,ae._)`${o} === ${be.default.errors}`)}function hU(e){(0,Po.checkUnknownRules)(e),jee(e)}function gU(e,t){if(e.opts.jtd)return lU(e,[],!1,t);let r=(0,aU.getSchemaTypes)(e.schema),i=(0,aU.coerceAndCheckDataType)(e,r);lU(e,r,!i,t)}function jee(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,Po.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function zee(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Po.checkStrictMode)(e,"default is ignored in the schema root")}function Dee(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Tee.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Mee(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function yU({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code((0,ae._)`${be.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,ae.str)`${i}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,ae._)`${be.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function Lee(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;r.$async?t.if((0,ae._)`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw((0,ae._)`new ${n}(${be.default.vErrors})`)):(t.assign((0,ae._)`${i}.errors`,be.default.vErrors),o.unevaluated&&Uee(e),t.return((0,ae._)`${be.default.errors} === 0`))}function Uee({gen:e,evaluated:t,props:r,items:i}){r instanceof ae.Name&&e.assign((0,ae._)`${t}.props`,r),i instanceof ae.Name&&e.assign((0,ae._)`${t}.items`,i)}function lU(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Po.schemaHasRulesButRef)(o,u))){n.block(()=>$U(e,"$ref",u.all.$ref.definition));return}c.jtd||qee(e,t),n.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,yP.shouldUseGroup)(o,p)&&(p.type?(n.if((0,xb.checkDataType)(p.type,s,c.strictNumbers)),uU(e,p),t.length===1&&t[0]===p.type&&r&&(n.else(),(0,xb.reportTypeError)(e)),n.endIf()):uU(e,p),a||n.if((0,ae._)`${be.default.errors} === ${i||0}`))}}function uU(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;n&&(0,Iee.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,yP.shouldUseRule)(i,o)&&$U(e,o.keyword,o.definition,t.type)})}function qee(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Fee(e,t),e.opts.allowUnionTypes||Zee(e,t),Vee(e,e.dataTypes))}function Fee(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{vU(e.dataTypes,r)||vP(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Kee(e,t)}}function Zee(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&vP(e,"use allowUnionTypes to allow union type keyword")}function Vee(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,yP.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>Bee(t,s))&&vP(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Bee(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function vU(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Kee(e,t){let r=[];for(let i of e.dataTypes)vU(t,i)?r.push(i):t.includes("integer")&&i==="number"&&r.push("integer");e.dataTypes=r}function vP(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Po.checkStrictMode)(e,t,e.opts.strictTypes)}var Ib=class{constructor(t,r,i){if((0,rm.validateKeywordUsage)(t,r,i),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=i,this.data=t.data,this.schema=t.schema[i],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Po.schemaRefOrVal)(t,this.schema,i,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",bU(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,rm.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",be.default.errors))}result(t,r,i){this.failResult((0,ae.not)(t),r,i)}failResult(t,r,i){this.gen.if(t),i?i():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,ae.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,ae._)`${r} !== undefined && (${(0,ae.or)(this.invalid$data(),t)})`)}error(t,r,i){if(r){this.setParams(r),this._error(t,i),this.setParams({});return}this._error(t,i)}_error(t,r){(t?tm.reportExtraError:tm.reportError)(this,this.def.error,r)}$dataError(){(0,tm.reportError)(this,this.def.$dataError||tm.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,tm.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,i=ae.nil){this.gen.block(()=>{this.check$data(t,i),r()})}check$data(t=ae.nil,r=ae.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,ae.or)((0,ae._)`${n} === undefined`,r)),t!==ae.nil&&i.assign(t,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),t!==ae.nil&&i.assign(t,!1)),i.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,ae.or)(s(),a());function s(){if(i.length){if(!(r instanceof ae.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,ae._)`${(0,xb.checkDataTypes)(c,r,o.opts.strictNumbers,xb.DataType.Wrong)}`}return ae.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,ae._)`!${c}(${r})`}return ae.nil}}subschema(t,r){let i=(0,gP.getSubschema)(this.it,t);(0,gP.extendSubschemaData)(i,this.it,t),(0,gP.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return Oee(n,r),n}mergeEvaluated(t,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&t.props!==void 0&&(i.props=Po.mergeEvaluated.props(n,t.props,i.props,r)),i.items!==!0&&t.items!==void 0&&(i.items=Po.mergeEvaluated.items(n,t.items,i.items,r)))}mergeValidEvaluated(t,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,ae.Name)),!0}};Ss.KeywordCxt=Ib;function $U(e,t,r,i){let n=new Ib(e,r,t);"code"in r?r.code(n,i):n.$data&&r.validate?(0,rm.funcKeywordCode)(n,r):"macro"in r?(0,rm.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,rm.funcKeywordCode)(n,r)}var Wee=/^\/(?:[^~]|~0|~1)*$/,Gee=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function bU(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!Wee.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=be.default.rootData}else{let l=Gee.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=t)throw new Error(c("property/index",u));return i[t-u]}if(u>t)throw new Error(c("data",u));if(o=r[t-u],!n)return o}let s=o,a=n.split("/");for(let l of a)l&&(o=(0,ae._)`${o}${(0,ae.getProperty)((0,Po.unescapeJsonPointer)(l))}`,s=(0,ae._)`${s} && ${o}`);return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}Ss.getData=bU});var Tb=I(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});var $P=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};bP.default=$P});var im=I(kP=>{"use strict";Object.defineProperty(kP,"__esModule",{value:!0});var wP=em(),_P=class extends Error{constructor(t,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,wP.resolveUrl)(t,r,i),this.missingSchema=(0,wP.normalizeId)((0,wP.getFullPath)(t,this.missingRef))}};kP.default=_P});var Rb=I(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.resolveSchema=Yn.getCompilingSchema=Yn.resolveRef=Yn.compileSchema=Yn.SchemaEnv=void 0;var mi=Ue(),Hee=Tb(),Ka=To(),hi=em(),wU=Qe(),Jee=nm(),pu=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let i;typeof t.schema=="object"&&(i=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,hi.normalizeId)(i?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=i?.$async,this.refs={}}};Yn.SchemaEnv=pu;function xP(e){let t=_U.call(this,e);if(t)return t;let r=(0,hi.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new mi.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;e.$async&&(a=s.scopeValue("Error",{ref:Hee.default,code:(0,mi._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let l={gen:s,allErrors:this.opts.allErrors,data:Ka.default.data,parentData:Ka.default.parentData,parentDataProperty:Ka.default.parentDataProperty,dataNames:[Ka.default.data],dataPathArr:[mi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,mi.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:mi.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,mi._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,Jee.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(Ka.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let f=new Function(`${Ka.default.self}`,`${Ka.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=l;f.evaluated={props:m instanceof mi.Name?void 0:m,items:h instanceof mi.Name?void 0:h,dynamicProps:m instanceof mi.Name,dynamicItems:h instanceof mi.Name},f.source&&(f.source.evaluated=(0,mi.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Yn.compileSchema=xP;function Yee(e,t,r){var i;r=(0,hi.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=ete.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new pu({schema:s,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=Xee.call(this,o)}Yn.resolveRef=Yee;function Xee(e){return(0,hi.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:xP.call(this,e)}function _U(e){for(let t of this._compilations)if(Qee(t,e))return t}Yn.getCompilingSchema=_U;function Qee(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function ete(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Pb.call(this,e,t)}function Pb(e,t){let r=this.opts.uriResolver.parse(t),i=(0,hi._getFullPath)(this.opts.uriResolver,r),n=(0,hi.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return SP.call(this,r,e);let o=(0,hi.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=Pb.call(this,e,s);return typeof a?.schema!="object"?void 0:SP.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||xP.call(this,s),o===(0,hi.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,hi.resolveUrl)(this.opts.uriResolver,n,l)),new pu({schema:a,schemaId:c,root:e,baseId:n})}return SP.call(this,r,s)}}Yn.resolveSchema=Pb;var tte=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function SP(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,wU.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!tte.has(a)&&l&&(t=(0,hi.resolveUrl)(this.opts.uriResolver,t,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,wU.schemaHasRulesButRef)(r,this.RULES)){let a=(0,hi.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Pb.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new pu({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o}});var kU=I((fAe,rte)=>{rte.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 AP=I((mAe,CU)=>{"use strict";var nte=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),TP=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),ite=RegExp.prototype.test.bind(/^\d*$/u),Wa=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),PP=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),xU=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),RP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),ote=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),gn=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)gn[t]="%"+e[t>>4]+e[t&15]}function qr(e){return e<2048?gn[192|e>>6]+gn[128|e&63]:e<65536?gn[224|e>>12]+gn[128|e>>6&63]+gn[128|e&63]:gn[240|e>>18]+gn[128|e>>12&63]+gn[128|e>>6&63]+gn[128|e&63]}function ste(e){let t="",r=0,i=0;for(i=0;i<e.length;i++)if(r=e[i].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var ate=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),cte=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),lte=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),ute=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function dte(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!lte(e[t])){if(e[t]==="%"&&t+2<e.length&&Wa(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function SU(e){let t=-1,r=0,i=-1,n=0;for(let a=0;a<e.length;a++)e[a]==="0"?(i===-1&&(i=a),n++,n>r&&(r=n,t=i)):(i=-1,n=0);if(r<2)return e.join(":");let o=e.slice(0,t).join(":"),s=e.slice(t+r).join(":");return o+"::"+s}function pte(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),i=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),i.length===1&&i[0]===""&&(i.length=0));let n=r.concat(i),o=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||t!==-1&&i.length===0||!TP(c))return;o+=2;continue}if(!ate(c))return;n[a]=parseInt(c,16).toString(16),o++}if(t===-1)return o!==8?void 0:SU(n);if(o>=8)return;let s=n.slice(0,r.length);for(let a=o;a<8;a++)s.push("0");for(let a=r.length;a<n.length;a++)s.push(n[a]);return SU(s)}function IP(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let i=t?e.slice(1,-1):e;if(t&&cte(i))return i=i.toLowerCase(),{host:`[${i}]`,escapedHost:i,isIPV6:!1,isIPVFuture:!0};if(fte(i,":")<2)return{host:e,isIPV6:!1,error:t};let n="",o=i.indexOf("%");if(o!==-1){let a=i.slice(o,o+3).toLowerCase()==="%25"?3:1;if(n=i.slice(o+a),!dte(n))return{host:e,isIPV6:!1,error:!0};i=i.slice(0,o)}let s=pte(i);return s===void 0?{host:e,isIPV6:!1,error:!0}:{host:s+(n?"%"+n:""),escapedHost:s+(n?"%25"+n:""),isIPV6:!0}}function fte(e,t){let r=0;for(let i=0;i<e.length;i++)e[i]===t&&r++;return r}function mte(e){let t=e,r=[],i=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var hte={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},gte=/[@/?#:]/g,yte=/[@/?#]/g;function IU(e,t){let r=t?yte:gte;return r.lastIndex=0,e.replace(r,i=>hte[i])}function TU(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Wa(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));t&&PP(s)?r+=s:r+="%"+o,i+=2;continue}}r+=e[i]}return r}function vte(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Wa(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));s!=="."&&PP(s)?t+=s:t+="%"+o,r+=2;continue}}if(xU(i))t+=i;else{let n=e.charCodeAt(r);if(n<128)t+=RU(n)?i:gn[n];else if(n<55296||n>57343)t+=qr(n);else if(n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=qr(65536+(n-55296<<10)+(o-56320)),r++):t+=qr(65533)}else t+=qr(65533)}}return t}function $te(e,t=!1){let r="",i=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Wa(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(o==="/"&&(i=!1),xU(o)&&(o!==":"||!i))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=gn[s];else if(s<55296||s>57343)r+=qr(s);else if(s<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=qr(65536+(s-55296<<10)+(a-56320)),n++):r+=qr(65533)}else r+=qr(65533)}}return r}function CP(e,t){let r="";for(let i=0;i<e.length;i++){let n=e[i];if(n==="%"&&i+2<e.length){let o=e.slice(i+1,i+3);if(Wa(o)){r+="%"+o.toUpperCase(),i+=2;continue}}if(t(n))r+=n;else{let o=e.charCodeAt(i);if(o<128)r+=gn[o];else if(o<55296||o>57343)r+=qr(o);else if(o<=56319&&i+1<e.length){let s=e.charCodeAt(i+1);s>=56320&&s<=57343?(r+=qr(65536+(o-55296<<10)+(s-56320)),i++):r+=qr(65533)}else r+=qr(65533)}}return r}function PU(e){return CP(e,ote)}function bte(e){return CP(e,RP)}function wte(e){return CP(e,RP)}function RU(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function _te(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Wa(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));PP(s)?t+=s:t+="%"+o,r+=2;continue}}if(RP(i))t+=i;else{let n=e.charCodeAt(r);if(n<128)t+=RU(n)?i:gn[n];else if(n<55296||n>57343)t+=qr(n);else if(n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=qr(65536+(n-55296<<10)+(o-56320)),r++):t+=qr(65533)}else t+=qr(65533)}}return t}function kte(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Wa(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Ste(e){let t=[];if(e.userinfo!==void 0&&(t.push(PU(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!TP(r)){let i=IP(r);i.isIPV6!==!0&&i.isIPVFuture!==!0&&(r=TU(r,!0),i=IP(r)),i.isIPV6===!0||i.isIPVFuture===!0?r=`[${i.escapedHost}]`:r=IU(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!ite(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}CU.exports={nonSimpleDomain:ute,recomposeAuthority:Ste,reescapeHostDelimiters:IU,normalizePercentEncoding:TU,normalizePathEncoding:vte,serializePathEncoding:$te,normalizeQueryFragmentEncoding:_te,encodeUserinfo:PU,encodeQuery:bte,encodeFragment:wte,escapePreservingEscapes:kte,removeDotSegments:mte,isIPv4:TP,isUUID:nte,normalizeIPv6:IP,stringArrayToHexStripped:ste}});var jU=I((hAe,NU)=>{"use strict";var{isUUID:xte}=AP(),Ite=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Tte=["http","https","ws","wss","urn","urn:uuid"];function Pte(e){return Tte.indexOf(e)!==-1}function EP(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function AU(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function EU(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Rte(e){return e.secure=EP(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Cte(e){if((e.port===(EP(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function Ate(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Ite);if(r&&r[0]===e.path){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=OP(n);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Ete(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=OP(n);o&&(e=o.serialize(e,t));let s=e,a=e.nss;return s.path=`${i||t.nid}:${a}`,t.skipEscape=!0,s}function Ote(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!xte(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Nte(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var OU={scheme:"http",domainHost:!0,parse:AU,serialize:EU},jte={scheme:"https",domainHost:OU.domainHost,parse:AU,serialize:EU},Cb={scheme:"ws",domainHost:!0,parse:Rte,serialize:Cte},zte={scheme:"wss",domainHost:Cb.domainHost,parse:Cb.parse,serialize:Cb.serialize},Dte={scheme:"urn",parse:Ate,serialize:Ete,skipNormalize:!0},Mte={scheme:"urn:uuid",parse:Ote,serialize:Nte,skipNormalize:!0},Ab={http:OU,https:jte,ws:Cb,wss:zte,urn:Dte,"urn:uuid":Mte};Object.setPrototypeOf(Ab,null);function OP(e){return e&&(Ab[e]||Ab[e.toLowerCase()])||void 0}NU.exports={wsIsSecure:EP,SCHEMES:Ab,isValidSchemeName:Pte,getSchemeHandler:OP}});var MP=I((gAe,Nb)=>{"use strict";var{normalizeIPv6:UU,removeDotSegments:sm,recomposeAuthority:Lte,normalizePercentEncoding:NP,normalizePathEncoding:Ute,serializePathEncoding:zU,normalizeQueryFragmentEncoding:DU,encodeQuery:qte,encodeFragment:Fte,reescapeHostDelimiters:Zte,isIPv4:qU,nonSimpleDomain:Vte}=AP(),{SCHEMES:FU,getSchemeHandler:jP}=jU(),ZU=/^[A-Za-z][A-Za-z0-9+.-]*$/u,VU="URI scheme is malformed.";function MU(e){let t=unescape(String(e));if(!ZU.test(t))throw new TypeError(VU);return t}function Bte(e,t){return typeof e=="string"?e=Qte(e,t):typeof e=="object"&&(e=Ob(Ga(e,t),t)),e}function Kte(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Eb(e,i),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:m,malformedScheme:h}=Eb(t,i);if(o||d||s||p||a||f||c||m||l||h)throw new Error(n.error||u.error||"URI is malformed.");let g=BU(n,u,i,!0),y=jP(r&&r.scheme||g.scheme),v=g.host,b=v!==void 0&&v!==""&&(qU(v)||UU(v).isIPV6);KU(g,r||{},y,b);let _=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(g.error&&!_)throw new Error(g.error);return i.skipEscape=!0,Ga(g,i)}function BU(e,t,r,i){let n={};return i||(e=Ob(Ga(e,r),r),t=Ob(Ga(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=sm(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=sm(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=sm(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=sm(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function Wte(e,t,r){let i=LU(e,r),n=LU(t,r);return i!==void 0&&n!==void 0&&i===n}function Ga(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[];r.scheme&&(r.scheme=MU(r.scheme));let o=jP(i.scheme||r.scheme);o&&o.serialize&&o.serialize(r,i);let s=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!i.skipEscape&&r.scheme===void 0&&!s;r.path!==void 0&&(i.skipEscape?r.path=NP(r.path):r.path=zU(r.path,a)),i.reference!=="suffix"&&r.scheme&&(r.scheme=MU(r.scheme),n.push(r.scheme,":"));let c=Lte(r);if(c!==void 0&&(i.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let l=r.path;!i.absolutePath&&(!o||!o.absolutePath)&&(l=sm(l)),a&&(l=zU(l,!0)),c===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),n.push(l)}return r.query!==void 0&&n.push("?",qte(r.query)),r.fragment!==void 0&&n.push("#",Fte(r.fragment)),n.join("")}var Gte=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Hte=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Jte=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Yte(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function om(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function zP(e){return e[0]==="["&&e[e.length-1]==="]"}function Xte(e){let t=e[4];return om(e[3])||t!==void 0&&!zP(t)&&om(t)||om(e[6])||om(e[7])||om(e[8])}function KU(e,t,r,i){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!zP(e.host)&&(t.domainHost||r&&r.domainHost)&&i===!1&&Vte(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function Eb(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1,s=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(Hte);d!==null&&d[1].indexOf("\\")!==-1&&(i.error="URI authority must not contain a literal backslash.",n=!0);let p=e.match(Jte);if(p!==null){let m=p[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(i.error=i.error||"URI authority must not contain a literal backslash.",n=!0):m.length!==h.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",n=!0))}let f=e.match(Gte);if(f){if(i.scheme=f[1],i.userinfo=f[3],i.host=f[4],i.port=parseInt(f[5],10),i.path=f[6]||"",i.query=f[7],i.fragment=f[8],i.scheme!==void 0){let g=unescape(i.scheme);ZU.test(g)?i.scheme=g.toLowerCase():(i.error=i.error||VU,l=!0)}o=Xte(f),o&&(i.error=i.error||"URI contains malformed percent-encoding."),isNaN(i.port)&&(i.port=f[5]);let m=Yte(i,f);if(m!==void 0&&(i.error=i.error||m,n=!0),i.host)if(qU(i.host)===!1){let y=zP(i.host),v=i.host.indexOf("[")!==-1||i.host.indexOf("]")!==-1,b=UU(i.host);u=b.isIPV6||b.isIPVFuture===!0,c=v&&(!y||b.error===!0),i.host=u?b.host:b.host.toLowerCase(),c&&(i.error=i.error||"URI host is malformed.",n=!0)}else u=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference="same-document":i.scheme===void 0?i.reference="relative":i.fragment===void 0?i.reference="absolute":i.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let h=jP(r.scheme||i.scheme);if(c||(a=KU(i,r,h,u)),e.indexOf("%")!==-1&&i.host!==void 0&&!c){let g=u?i.host:NP(i.host,!0);u||(g=NP(g.toLowerCase())),i.host=Zte(g,u)}(!h||h&&!h.skipNormalize)&&(i.path&&(i.path=Ute(i.path)),i.query&&(i.query=DU(i.query)),i.fragment&&(i.fragment=DU(i.fragment))),h&&h.parse&&(h.parse(i,r),h===FU.urn&&i.nid===void 0&&(s=!0))}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:l}}function Ob(e,t){return Eb(e,t).parsed}function Qte(e,t){return WU(e,t).normalized}function WU(e,t){let{parsed:r,malformedAuthorityOrPort:i,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:a}=Eb(e,t);return{normalized:i||n||o||s||a?e:Ga(r,t),malformedAuthorityOrPort:i,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:a}}function LU(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Ga(e,t)}catch{return}let{normalized:i,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:c}=WU(r,t);return n||o||s||a||c?void 0:i}var DP={SCHEMES:FU,normalize:Bte,resolve:Kte,resolveComponent:BU,equal:Wte,serialize:Ga,parse:Ob};Nb.exports=DP;Nb.exports.default=DP;Nb.exports.fastUri=DP});var HU=I(LP=>{"use strict";Object.defineProperty(LP,"__esModule",{value:!0});var GU=MP();GU.code='require("ajv/dist/runtime/uri").default';LP.default=GU});var nq=I(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.CodeGen=Rr.Name=Rr.nil=Rr.stringify=Rr.str=Rr._=Rr.KeywordCxt=void 0;var ere=nm();Object.defineProperty(Rr,"KeywordCxt",{enumerable:!0,get:function(){return ere.KeywordCxt}});var fu=Ue();Object.defineProperty(Rr,"_",{enumerable:!0,get:function(){return fu._}});Object.defineProperty(Rr,"str",{enumerable:!0,get:function(){return fu.str}});Object.defineProperty(Rr,"stringify",{enumerable:!0,get:function(){return fu.stringify}});Object.defineProperty(Rr,"nil",{enumerable:!0,get:function(){return fu.nil}});Object.defineProperty(Rr,"Name",{enumerable:!0,get:function(){return fu.Name}});Object.defineProperty(Rr,"CodeGen",{enumerable:!0,get:function(){return fu.CodeGen}});var tre=Tb(),eq=im(),rre=aP(),am=Rb(),nre=Ue(),cm=em(),jb=Xf(),qP=Qe(),JU=kU(),ire=HU(),tq=(e,t)=>new RegExp(e,t);tq.code="new RegExp";var ore=["removeAdditional","useDefaults","coerceTypes"],sre=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),are={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."},cre={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},YU=200;function lre(e){var t,r,i,n,o,s,a,c,l,u,d,p,f,m,h,g,y,v,b,_,k,x,S,C,E;let U=e.strict,V=(t=e.code)===null||t===void 0?void 0:t.optimize,X=V===!0||V===void 0?1:V||0,J=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:tq,it=(n=e.uriResolver)!==null&&n!==void 0?n:ire.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:U)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:U)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:U)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:U)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:U)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:X,regExp:J}:{optimize:X,regExp:J},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:YU,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:YU,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(S=e.validateFormats)!==null&&S!==void 0?S:!0,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(E=e.int32range)!==null&&E!==void 0?E:!0,uriResolver:it}}var lm=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...lre(t)};let{es5:r,lines:i}=this.opts.code;this.scope=new nre.ValueScope({scope:{},prefixes:sre,es5:r,lines:i}),this.logger=hre(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,rre.getRules)(),XU.call(this,are,t,"NOT SUPPORTED"),XU.call(this,cre,t,"DEPRECATED","warn"),this._metaOpts=fre.call(this),t.formats&&dre.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&pre.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),ure.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:i}=this.opts,n=JU;i==="id"&&(n={...JU},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[i],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let i;if(typeof t=="string"){if(i=this.getSchema(t),!i)throw new Error(`no schema with key or ref "${t}"`)}else i=this.compile(t);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(t,r){let i=this._addSchema(t,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,t,r);async function n(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof eq.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.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]=i(u))}finally{delete this._loading[u]}}}addSchema(t,r,i,n=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,i,n);return this}let o;if(typeof t=="object"){let{schemaId:s}=this.opts;if(o=t[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,cm.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,i,r,n,!0),this}addMetaSchema(t,r,i=this.opts.validateSchema){return this.addSchema(t,r,!0,i),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let i;if(i=t.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,t);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(t){let r;for(;typeof(r=QU.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:i}=this.opts,n=new am.SchemaEnv({schema:{},schemaId:i});if(r=am.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=QU.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let i=t[this.opts.schemaId];return i&&(i=(0,cm.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let i;if(typeof t=="string")i=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof t=="object"&&r===void 0){if(r=t,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(yre.call(this,i,r),!r)return(0,qP.eachItem)(i,o=>UP.call(this,o)),this;$re.call(this,r);let n={...r,type:(0,jb.getJSONTypes)(r.type),schemaType:(0,jb.getJSONTypes)(r.schemaType)};return(0,qP.eachItem)(i,n.type.length===0?o=>UP.call(this,o,n):o=>n.type.forEach(s=>UP.call(this,o,n,s))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let i of r.rules){let n=i.rules.findIndex(o=>o.keyword===t);n>=0&&i.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:i="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(t,r){let i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let o=n.split("/").slice(1),s=t;for(let a of o)s=s[a];for(let a in i){let c=i[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=s[a];l&&u&&(s[a]=rq(u))}}return t}_removeAllSchemas(t,r){for(let i in t){let n=t[i];(!r||r.test(i))&&(typeof n=="string"?delete t[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[i]))}}_addSchema(t,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;i=(0,cm.normalizeId)(s||i);let l=cm.getSchemaRefs.call(this,t,i);return c=new am.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:i,localRefs:l}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):am.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{am.compileSchema.call(this,t)}finally{this.opts=r}}};lm.ValidationError=tre.default;lm.MissingRefError=eq.default;Rr.default=lm;function XU(e,t,r,i="error"){for(let n in e){let o=n;o in t&&this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function QU(e){return e=(0,cm.normalizeId)(e),this.schemas[e]||this.refs[e]}function ure(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function dre(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function pre(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function fre(){let e={...this.opts};for(let t of ore)delete e[t];return e}var mre={log(){},warn(){},error(){}};function hre(e){if(e===!1)return mre;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var gre=/^[a-z_$][a-z0-9_$:-]*$/i;function yre(e,t){let{RULES:r}=this;if((0,qP.eachItem)(e,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!gre.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function UP(e,t,r){var i;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,jb.getJSONTypes)(t.type),schemaType:(0,jb.getJSONTypes)(t.schemaType)}};t.before?vre.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,(i=t.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function vre(e,t,r){let i=e.rules.findIndex(n=>n.keyword===r);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function $re(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=rq(t)),e.validateSchema=this.compile(t,!0))}var bre={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function rq(e){return{anyOf:[e,bre]}}});var iq=I(FP=>{"use strict";Object.defineProperty(FP,"__esModule",{value:!0});var wre={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};FP.default=wre});var cq=I(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.callRef=Ha.getValidate=void 0;var _re=im(),oq=Jn(),yn=Ue(),mu=To(),sq=Rb(),zb=Qe(),kre={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:c}=i,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=sq.resolveRef.call(c,l,n,r);if(u===void 0)throw new _re.default(i.opts.uriResolver,n,r);if(u instanceof sq.SchemaEnv)return p(u);return f(u);function d(){if(o===l)return Db(e,s,o,o.$async);let m=t.scopeValue("root",{ref:l});return Db(e,(0,yn._)`${m}.validate`,l,l.$async)}function p(m){let h=aq(e,m);Db(e,h,m,m.$async)}function f(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,yn.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:yn.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function aq(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,yn._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Ha.getValidate=aq;function Db(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:a,opts:c}=o,l=c.passContext?mu.default.this:yn.nil;i?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,yn._)`await ${(0,oq.callValidateCode)(e,t,l)}`),f(t),s||n.assign(m,!0)},h=>{n.if((0,yn._)`!(${h} instanceof ${o.ValidationError})`,()=>n.throw(h)),p(h),s||n.assign(m,!1)}),e.ok(m)}function d(){e.result((0,oq.callValidateCode)(e,t,l),()=>f(t),()=>p(t))}function p(m){let h=(0,yn._)`${m}.errors`;n.assign(mu.default.vErrors,(0,yn._)`${mu.default.vErrors} === null ? ${h} : ${mu.default.vErrors}.concat(${h})`),n.assign(mu.default.errors,(0,yn._)`${mu.default.vErrors}.length`)}function f(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=zb.mergeEvaluated.props(n,g.props,o.props));else{let y=n.var("props",(0,yn._)`${m}.evaluated.props`);o.props=zb.mergeEvaluated.props(n,y,o.props,yn.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=zb.mergeEvaluated.items(n,g.items,o.items));else{let y=n.var("items",(0,yn._)`${m}.evaluated.items`);o.items=zb.mergeEvaluated.items(n,y,o.items,yn.Name)}}}Ha.callRef=Db;Ha.default=kre});var lq=I(ZP=>{"use strict";Object.defineProperty(ZP,"__esModule",{value:!0});var Sre=iq(),xre=cq(),Ire=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Sre.default,xre.default];ZP.default=Ire});var uq=I(VP=>{"use strict";Object.defineProperty(VP,"__esModule",{value:!0});var Mb=Ue(),xs=Mb.operators,Lb={maximum:{okStr:"<=",ok:xs.LTE,fail:xs.GT},minimum:{okStr:">=",ok:xs.GTE,fail:xs.LT},exclusiveMaximum:{okStr:"<",ok:xs.LT,fail:xs.GTE},exclusiveMinimum:{okStr:">",ok:xs.GT,fail:xs.LTE}},Tre={message:({keyword:e,schemaCode:t})=>(0,Mb.str)`must be ${Lb[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Mb._)`{comparison: ${Lb[e].okStr}, limit: ${t}}`},Pre={keyword:Object.keys(Lb),type:"number",schemaType:"number",$data:!0,error:Tre,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,Mb._)`${r} ${Lb[t].fail} ${i} || isNaN(${r})`)}};VP.default=Pre});var dq=I(BP=>{"use strict";Object.defineProperty(BP,"__esModule",{value:!0});var um=Ue(),Rre={message:({schemaCode:e})=>(0,um.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,um._)`{multipleOf: ${e}}`},Cre={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Rre,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),a=o?(0,um._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,um._)`${s} !== parseInt(${s})`;e.fail$data((0,um._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};BP.default=Cre});var fq=I(KP=>{"use strict";Object.defineProperty(KP,"__esModule",{value:!0});function pq(e){let t=e.length,r=0,i=0,n;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),(n&64512)===56320&&i++);return r}KP.default=pq;pq.code='require("ajv/dist/runtime/ucs2length").default'});var mq=I(WP=>{"use strict";Object.defineProperty(WP,"__esModule",{value:!0});var Ja=Ue(),Are=Qe(),Ere=fq(),Ore={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Ja.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Ja._)`{limit: ${e}}`},Nre={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Ore,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Ja.operators.GT:Ja.operators.LT,s=n.opts.unicode===!1?(0,Ja._)`${r}.length`:(0,Ja._)`${(0,Are.useFunc)(e.gen,Ere.default)}(${r})`;e.fail$data((0,Ja._)`${s} ${o} ${i}`)}};WP.default=Nre});var hq=I(GP=>{"use strict";Object.defineProperty(GP,"__esModule",{value:!0});var jre=Jn(),zre=Qe(),hu=Ue(),Dre={message:({schemaCode:e})=>(0,hu.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,hu._)`{pattern: ${e}}`},Mre={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Dre,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=s.opts.code,l=c.code==="new RegExp"?(0,hu._)`new RegExp`:(0,zre.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,hu._)`${l}(${o}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,hu._)`!${u}`)}else{let c=(0,jre.usePattern)(e,n);e.fail$data((0,hu._)`!${c}.test(${r})`)}}};GP.default=Mre});var gq=I(HP=>{"use strict";Object.defineProperty(HP,"__esModule",{value:!0});var dm=Ue(),Lre={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,dm.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,dm._)`{limit: ${e}}`},Ure={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Lre,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?dm.operators.GT:dm.operators.LT;e.fail$data((0,dm._)`Object.keys(${r}).length ${n} ${i}`)}};HP.default=Ure});var yq=I(JP=>{"use strict";Object.defineProperty(JP,"__esModule",{value:!0});var pm=Jn(),fm=Ue(),qre=Qe(),Fre={message:({params:{missingProperty:e}})=>(0,fm.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,fm._)`{missingProperty: ${e}}`},Zre={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Fre,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?l():u(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,qre.checkStrictMode)(s,y,s.opts.strictRequired)}}function l(){if(c||o)e.block$data(fm.nil,d);else for(let f of r)(0,pm.checkReportMissingProp)(e,f)}function u(){let f=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>p(f,m)),e.ok(m)}else t.if((0,pm.checkMissingProp)(e,r,f)),(0,pm.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",i,f=>{e.setParams({missingProperty:f}),t.if((0,pm.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function p(f,m){e.setParams({missingProperty:f}),t.forOf(f,i,()=>{t.assign(m,(0,pm.propertyInData)(t,n,f,a.ownProperties)),t.if((0,fm.not)(m),()=>{e.error(),t.break()})},fm.nil)}}};JP.default=Zre});var vq=I(YP=>{"use strict";Object.defineProperty(YP,"__esModule",{value:!0});var mm=Ue(),Vre={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,mm.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,mm._)`{limit: ${e}}`},Bre={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Vre,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?mm.operators.GT:mm.operators.LT;e.fail$data((0,mm._)`${r}.length ${n} ${i}`)}};YP.default=Bre});var Ub=I(XP=>{"use strict";Object.defineProperty(XP,"__esModule",{value:!0});var $q=Qf();$q.code='require("ajv/dist/runtime/equal").default';XP.default=$q});var bq=I(eR=>{"use strict";Object.defineProperty(eR,"__esModule",{value:!0});var QP=Xf(),Cr=Ue(),Kre=Qe(),Wre=Ub(),Gre={message:({params:{i:e,j:t}})=>(0,Cr.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Cr._)`{i: ${e}, j: ${t}}`},Hre={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Gre,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=e;if(!i&&!n)return;let c=t.let("valid"),l=o.items?(0,QP.getSchemaTypes)(o.items):[];e.block$data(c,u,(0,Cr._)`${s} === false`),e.ok(c);function u(){let m=t.let("i",(0,Cr._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Cr._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function p(m,h){let g=t.name("item"),y=(0,QP.checkDataTypes)(l,g,a.opts.strictNumbers,QP.DataType.Wrong),v=t.const("indices",(0,Cr._)`{}`);t.for((0,Cr._)`;${m}--;`,()=>{t.let(g,(0,Cr._)`${r}[${m}]`),t.if(y,(0,Cr._)`continue`),l.length>1&&t.if((0,Cr._)`typeof ${g} == "string"`,(0,Cr._)`${g} += "_"`),t.if((0,Cr._)`typeof ${v}[${g}] == "number"`,()=>{t.assign(h,(0,Cr._)`${v}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Cr._)`${v}[${g}] = ${m}`)})}function f(m,h){let g=(0,Kre.useFunc)(t,Wre.default),y=t.name("outer");t.label(y).for((0,Cr._)`;${m}--;`,()=>t.for((0,Cr._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Cr._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};eR.default=Hre});var wq=I(rR=>{"use strict";Object.defineProperty(rR,"__esModule",{value:!0});var tR=Ue(),Jre=Qe(),Yre=Ub(),Xre={message:"must be equal to constant",params:({schemaCode:e})=>(0,tR._)`{allowedValue: ${e}}`},Qre={keyword:"const",$data:!0,error:Xre,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;i||o&&typeof o=="object"?e.fail$data((0,tR._)`!${(0,Jre.useFunc)(t,Yre.default)}(${r}, ${n})`):e.fail((0,tR._)`${o} !== ${r}`)}};rR.default=Qre});var _q=I(nR=>{"use strict";Object.defineProperty(nR,"__esModule",{value:!0});var hm=Ue(),ene=Qe(),tne=Ub(),rne={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,hm._)`{allowedValues: ${e}}`},nne={keyword:"enum",schemaType:"array",$data:!0,error:rne,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,l=()=>c??(c=(0,ene.useFunc)(t,tne.default)),u;if(a||i)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",o);u=(0,hm.or)(...n.map((m,h)=>p(f,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,f=>t.if((0,hm._)`${l()}(${r}, ${f})`,()=>t.assign(u,!0).break()))}function p(f,m){let h=n[m];return typeof h=="object"&&h!==null?(0,hm._)`${l()}(${r}, ${f}[${m}])`:(0,hm._)`${r} === ${h}`}}};nR.default=nne});var kq=I(iR=>{"use strict";Object.defineProperty(iR,"__esModule",{value:!0});var ine=uq(),one=dq(),sne=mq(),ane=hq(),cne=gq(),lne=yq(),une=vq(),dne=bq(),pne=wq(),fne=_q(),mne=[ine.default,one.default,sne.default,ane.default,cne.default,lne.default,une.default,dne.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},pne.default,fne.default];iR.default=mne});var sR=I(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});gm.validateAdditionalItems=void 0;var Ya=Ue(),oR=Qe(),hne={message:({params:{len:e}})=>(0,Ya.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ya._)`{limit: ${e}}`},gne={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hne,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,oR.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sq(e,i)}};function Sq(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let a=r.const("len",(0,Ya._)`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass((0,Ya._)`${a} <= ${t.length}`);else if(typeof i=="object"&&!(0,oR.alwaysValidSchema)(s,i)){let l=r.var("valid",(0,Ya._)`${a} <= ${t.length}`);r.if((0,Ya.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:oR.Type.Num},l),s.allErrors||r.if((0,Ya.not)(l),()=>r.break())})}}gm.validateAdditionalItems=Sq;gm.default=gne});var aR=I(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});ym.validateTuple=void 0;var xq=Ue(),qb=Qe(),yne=Jn(),vne={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Iq(e,"additionalItems",t);r.items=!0,!(0,qb.alwaysValidSchema)(r,t)&&e.ok((0,yne.validateArray)(e))}};function Iq(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=e;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=qb.mergeEvaluated.items(i,r.length,a.items));let c=i.name("valid"),l=i.const("len",(0,xq._)`${o}.length`);r.forEach((d,p)=>{(0,qb.alwaysValidSchema)(a,d)||(i.if((0,xq._)`${l} > ${p}`,()=>e.subschema({keyword:s,schemaProp:p,dataProp:p},c)),e.ok(c))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,qb.checkStrictMode)(a,g,p.strictTuples)}}}ym.validateTuple=Iq;ym.default=vne});var Tq=I(cR=>{"use strict";Object.defineProperty(cR,"__esModule",{value:!0});var $ne=aR(),bne={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,$ne.validateTuple)(e,"items")};cR.default=bne});var Rq=I(lR=>{"use strict";Object.defineProperty(lR,"__esModule",{value:!0});var Pq=Ue(),wne=Qe(),_ne=Jn(),kne=sR(),Sne={message:({params:{len:e}})=>(0,Pq.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Pq._)`{limit: ${e}}`},xne={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Sne,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;i.items=!0,!(0,wne.alwaysValidSchema)(i,t)&&(n?(0,kne.validateAdditionalItems)(e,n):e.ok((0,_ne.validateArray)(e)))}};lR.default=xne});var Cq=I(uR=>{"use strict";Object.defineProperty(uR,"__esModule",{value:!0});var Xn=Ue(),Fb=Qe(),Ine={message:({params:{min:e,max:t}})=>t===void 0?(0,Xn.str)`must contain at least ${e} valid item(s)`:(0,Xn.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Xn._)`{minContains: ${e}}`:(0,Xn._)`{minContains: ${e}, maxContains: ${t}}`},Tne={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Ine,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,a,{minContains:c,maxContains:l}=i;o.opts.next?(s=c===void 0?1:c,a=l):s=1;let u=t.const("len",(0,Xn._)`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Fb.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Fb.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Fb.alwaysValidSchema)(o,r)){let h=(0,Xn._)`${u} >= ${s}`;a!==void 0&&(h=(0,Xn._)`${h} && ${u} <= ${a}`),e.pass(h);return}o.items=!0;let d=t.name("valid");a===void 0&&s===1?f(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,Xn._)`${n}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),g=t.let("count",0);f(h,()=>t.if(h,()=>m(g)))}function f(h,g){t.forRange("i",0,u,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Fb.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,Xn._)`${h}++`),a===void 0?t.if((0,Xn._)`${h} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,Xn._)`${h} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,Xn._)`${h} >= ${s}`,()=>t.assign(d,!0)))}}};uR.default=Tne});var Oq=I(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.validateSchemaDeps=Ki.validatePropertyDeps=Ki.error=void 0;var dR=Ue(),Pne=Qe(),vm=Jn();Ki.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return(0,dR.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,dR._)`{property: ${e},
7
+ missingProperty: ${i},
8
+ depsCount: ${t},
9
+ deps: ${r}}`};var Rne={keyword:"dependencies",type:"object",schemaType:"object",error:Ki.error,code(e){let[t,r]=Cne(e);Aq(e,t),Eq(e,r)}};function Cne({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function Aq(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,vm.propertyInData)(r,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,vm.checkReportMissingProp)(e,l)}):(r.if((0,dR._)`${c} && (${(0,vm.checkMissingProp)(e,a,o)})`),(0,vm.reportMissingProp)(e,o),r.else())}}Ki.validatePropertyDeps=Aq;function Eq(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let a in t)(0,Pne.alwaysValidSchema)(o,t[a])||(r.if((0,vm.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}Ki.validateSchemaDeps=Eq;Ki.default=Rne});var jq=I(pR=>{"use strict";Object.defineProperty(pR,"__esModule",{value:!0});var Nq=Ue(),Ane=Qe(),Ene={message:"property name must be valid",params:({params:e})=>(0,Nq._)`{propertyName: ${e.propertyName}}`},One={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Ene,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Ane.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,Nq.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}};pR.default=One});var mR=I(fR=>{"use strict";Object.defineProperty(fR,"__esModule",{value:!0});var Zb=Jn(),gi=Ue(),Nne=To(),Vb=Qe(),jne={message:"must NOT have additional properties",params:({params:e})=>(0,gi._)`{additionalProperty: ${e.additionalProperty}}`},zne={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jne,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Vb.alwaysValidSchema)(s,r))return;let l=(0,Zb.allSchemaProperties)(i.properties),u=(0,Zb.allSchemaProperties)(i.patternProperties);d(),e.ok((0,gi._)`${o} === ${Nne.default.errors}`);function d(){t.forIn("key",n,g=>{!l.length&&!u.length?m(g):t.if(p(g),()=>m(g))})}function p(g){let y;if(l.length>8){let v=(0,Vb.schemaRefOrVal)(s,i.properties,"properties");y=(0,Zb.isOwnProperty)(t,v,g)}else l.length?y=(0,gi.or)(...l.map(v=>(0,gi._)`${g} === ${v}`)):y=gi.nil;return u.length&&(y=(0,gi.or)(y,...u.map(v=>(0,gi._)`${(0,Zb.usePattern)(e,v)}.test(${g})`))),(0,gi.not)(y)}function f(g){t.code((0,gi._)`delete ${n}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Vb.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,gi.not)(y),()=>{e.reset(),f(g)})):(h(g,y),a||t.if((0,gi.not)(y),()=>t.break()))}}function h(g,y,v){let b={keyword:"additionalProperties",dataProp:g,dataPropType:Vb.Type.Str};v===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};fR.default=zne});var Mq=I(gR=>{"use strict";Object.defineProperty(gR,"__esModule",{value:!0});var Dne=nm(),zq=Jn(),hR=Qe(),Dq=mR(),Mne={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&Dq.default.code(new Dne.KeywordCxt(o,Dq.default,"additionalProperties"));let s=(0,zq.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=hR.mergeEvaluated.props(t,(0,hR.toHash)(s),o.props));let a=s.filter(d=>!(0,hR.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,zq.propertyInData)(t,n,d,o.opts.ownProperties)),u(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};gR.default=Mne});var Fq=I(yR=>{"use strict";Object.defineProperty(yR,"__esModule",{value:!0});var Lq=Jn(),Bb=Ue(),Uq=Qe(),qq=Qe(),Lne={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,a=(0,Lq.allSchemaProperties)(r),c=a.filter(h=>(0,Uq.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&n.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof Bb.Name)&&(o.props=(0,qq.evaluatedPropsToName)(t,o.props));let{props:d}=o;p();function p(){for(let h of a)l&&f(h),o.allErrors?m(h):(t.var(u,!0),m(h),t.if(u))}function f(h){for(let g in l)new RegExp(h).test(g)&&(0,Uq.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,Bb._)`${(0,Lq.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:qq.Type.Str},u),o.opts.unevaluated&&d!==!0?t.assign((0,Bb._)`${d}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,Bb.not)(u),()=>t.break())})})}}};yR.default=Lne});var Zq=I(vR=>{"use strict";Object.defineProperty(vR,"__esModule",{value:!0});var Une=Qe(),qne={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Une.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};vR.default=qne});var Vq=I($R=>{"use strict";Object.defineProperty($R,"__esModule",{value:!0});var Fne=Jn(),Zne={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Fne.validateUnion,error:{message:"must match a schema in anyOf"}};$R.default=Zne});var Bq=I(bR=>{"use strict";Object.defineProperty(bR,"__esModule",{value:!0});var Kb=Ue(),Vne=Qe(),Bne={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Kb._)`{passingSchemas: ${e.passing}}`},Kne={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Bne,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(s,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;(0,Vne.alwaysValidSchema)(n,u)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Kb._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Kb._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),p&&e.mergeEvaluated(p,Kb.Name)})})}}};bR.default=Kne});var Kq=I(wR=>{"use strict";Object.defineProperty(wR,"__esModule",{value:!0});var Wne=Qe(),Gne={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,Wne.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};wR.default=Gne});var Hq=I(_R=>{"use strict";Object.defineProperty(_R,"__esModule",{value:!0});var Wb=Ue(),Gq=Qe(),Hne={message:({params:e})=>(0,Wb.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Wb._)`{failingKeyword: ${e.ifClause}}`},Jne={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Hne,code(e){let{gen:t,parentSchema:r,it:i}=e;r.then===void 0&&r.else===void 0&&(0,Gq.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=Wq(i,"then"),o=Wq(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else n?t.if(a,l("then")):t.if((0,Wb.not)(a),l("else"));e.pass(s,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);t.assign(s,a),e.mergeValidEvaluated(p,s),d?t.assign(d,(0,Wb._)`${u}`):e.setParams({ifClause:u})}}}};function Wq(e,t){let r=e.schema[t];return r!==void 0&&!(0,Gq.alwaysValidSchema)(e,r)}_R.default=Jne});var Jq=I(kR=>{"use strict";Object.defineProperty(kR,"__esModule",{value:!0});var Yne=Qe(),Xne={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Yne.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};kR.default=Xne});var Yq=I(SR=>{"use strict";Object.defineProperty(SR,"__esModule",{value:!0});var Qne=sR(),eie=Tq(),tie=aR(),rie=Rq(),nie=Cq(),iie=Oq(),oie=jq(),sie=mR(),aie=Mq(),cie=Fq(),lie=Zq(),uie=Vq(),die=Bq(),pie=Kq(),fie=Hq(),mie=Jq();function hie(e=!1){let t=[lie.default,uie.default,die.default,pie.default,fie.default,mie.default,oie.default,sie.default,iie.default,aie.default,cie.default];return e?t.push(eie.default,rie.default):t.push(Qne.default,tie.default),t.push(nie.default),t}SR.default=hie});var Xq=I(xR=>{"use strict";Object.defineProperty(xR,"__esModule",{value:!0});var tr=Ue(),gie={message:({schemaCode:e})=>(0,tr.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,tr._)`{format: ${e}}`},yie={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:gie,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,tr._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,tr._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,tr._)`${h}.type || "string"`).assign(y,(0,tr._)`${h}.validate`),()=>r.assign(g,(0,tr._)`"string"`).assign(y,h)),e.fail$data((0,tr.or)(v(),b()));function v(){return c.strictSchema===!1?tr.nil:(0,tr._)`${s} && !${y}`}function b(){let _=u.$async?(0,tr._)`(${h}.async ? await ${y}(${i}) : ${y}(${i}))`:(0,tr._)`${y}(${i})`,k=(0,tr._)`(typeof ${y} == "function" ? ${_} : ${y}.test(${i}))`;return(0,tr._)`${y} && ${y} !== true && ${g} === ${t} && !${k}`}}function f(){let m=d.formats[o];if(!m){v();return}if(m===!0)return;let[h,g,y]=b(m);h===t&&e.pass(_());function v(){if(c.strictSchema===!1){d.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function b(k){let x=k instanceof RegExp?(0,tr.regexpCode)(k):c.code.formats?(0,tr._)`${c.code.formats}${(0,tr.getProperty)(o)}`:void 0,S=r.scopeValue("formats",{key:o,ref:k,code:x});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,tr._)`${S}.validate`]:["string",k,S]}function _(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,tr._)`await ${y}(${i})`}return typeof g=="function"?(0,tr._)`${y}(${i})`:(0,tr._)`${y}.test(${i})`}}}};xR.default=yie});var Qq=I(IR=>{"use strict";Object.defineProperty(IR,"__esModule",{value:!0});var vie=Xq(),$ie=[vie.default];IR.default=$ie});var e4=I(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.contentVocabulary=gu.metadataVocabulary=void 0;gu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var r4=I(TR=>{"use strict";Object.defineProperty(TR,"__esModule",{value:!0});var bie=lq(),wie=kq(),_ie=Yq(),kie=Qq(),t4=e4(),Sie=[bie.default,wie.default,(0,_ie.default)(),kie.default,t4.metadataVocabulary,t4.contentVocabulary];TR.default=Sie});var i4=I(Gb=>{"use strict";Object.defineProperty(Gb,"__esModule",{value:!0});Gb.DiscrError=void 0;var n4;(function(e){e.Tag="tag",e.Mapping="mapping"})(n4||(Gb.DiscrError=n4={}))});var s4=I(RR=>{"use strict";Object.defineProperty(RR,"__esModule",{value:!0});var yu=Ue(),PR=i4(),o4=Rb(),xie=im(),Iie=Qe(),Tie={message:({params:{discrError:e,tagName:t}})=>e===PR.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,yu._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Pie={keyword:"discriminator",type:"object",schemaType:"object",error:Tie,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,yu._)`${r}${(0,yu.getProperty)(a)}`);t.if((0,yu._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:PR.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let f=p();t.if(!1);for(let m in f)t.elseIf((0,yu._)`${l} === ${m}`),t.assign(c,d(f[m]));t.else(),e.error(!1,{discrError:PR.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(h,yu.Name),m}function p(){var f;let m={},h=y(n),g=!0;for(let _=0;_<s.length;_++){let k=s[_];if(k?.$ref&&!(0,Iie.schemaHasRulesButRef)(k,o.self.RULES)){let S=k.$ref;if(k=o4.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,S),k instanceof o4.SchemaEnv&&(k=k.schema),k===void 0)throw new xie.default(o.opts.uriResolver,o.baseId,S)}let x=(f=k?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(k)),v(x,_)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:_}){return Array.isArray(_)&&_.includes(a)}function v(_,k){if(_.const)b(_.const,k);else if(_.enum)for(let x of _.enum)b(x,k);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(_,k){if(typeof _!="string"||_ in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[_]=k}}}};RR.default=Pie});var a4=I((iEe,Rie)=>{Rie.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 l4=I((jt,CR)=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.MissingRefError=jt.ValidationError=jt.CodeGen=jt.Name=jt.nil=jt.stringify=jt.str=jt._=jt.KeywordCxt=jt.Ajv=void 0;var Cie=nq(),Aie=r4(),Eie=s4(),c4=a4(),Oie=["/properties"],Hb="http://json-schema.org/draft-07/schema",vu=class extends Cie.default{_addVocabularies(){super._addVocabularies(),Aie.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Eie.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(c4,Oie):c4;this.addMetaSchema(t,Hb,!1),this.refs["http://json-schema.org/schema"]=Hb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Hb)?Hb:void 0)}};jt.Ajv=vu;CR.exports=jt=vu;CR.exports.Ajv=vu;Object.defineProperty(jt,"__esModule",{value:!0});jt.default=vu;var Nie=nm();Object.defineProperty(jt,"KeywordCxt",{enumerable:!0,get:function(){return Nie.KeywordCxt}});var $u=Ue();Object.defineProperty(jt,"_",{enumerable:!0,get:function(){return $u._}});Object.defineProperty(jt,"str",{enumerable:!0,get:function(){return $u.str}});Object.defineProperty(jt,"stringify",{enumerable:!0,get:function(){return $u.stringify}});Object.defineProperty(jt,"nil",{enumerable:!0,get:function(){return $u.nil}});Object.defineProperty(jt,"Name",{enumerable:!0,get:function(){return $u.Name}});Object.defineProperty(jt,"CodeGen",{enumerable:!0,get:function(){return $u.CodeGen}});var jie=Tb();Object.defineProperty(jt,"ValidationError",{enumerable:!0,get:function(){return jie.default}});var zie=im();Object.defineProperty(jt,"MissingRefError",{enumerable:!0,get:function(){return zie.default}})});var y4=I(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.formatNames=Gi.fastFormats=Gi.fullFormats=void 0;function Wi(e,t){return{validate:e,compare:t}}Gi.fullFormats={date:Wi(f4,NR),time:Wi(ER(!0),jR),"date-time":Wi(u4(!0),h4),"iso-time":Wi(ER(),m4),"iso-date-time":Wi(u4(),g4),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Fie,"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:Hie,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:Zie,int32:{type:"number",validate:Kie},int64:{type:"number",validate:Wie},float:{type:"number",validate:p4},double:{type:"number",validate:p4},password:!0,binary:!0};Gi.fastFormats={...Gi.fullFormats,date:Wi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,NR),time:Wi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jR),"date-time":Wi(/^\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,h4),"iso-time":Wi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m4),"iso-date-time":Wi(/^\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,g4),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};Gi.formatNames=Object.keys(Gi.fullFormats);function Die(e){return e%4===0&&(e%100!==0||e%400===0)}var Mie=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Lie=[0,31,28,31,30,31,30,31,31,30,31,30,31];function f4(e){let t=Mie.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&Die(r)?29:Lie[i])}function NR(e,t){if(e&&t)return e>t?1:e<t?-1:0}var AR=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ER(e){return function(r){let i=AR.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],a=i[4],c=i[5]==="-"?-1:1,l=+(i[6]||0),u=+(i[7]||0);if(l>23||u>59||e&&!a)return!1;if(n<=23&&o<=59&&s<60)return!0;let d=o-u*c,p=n-l*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&s<61}}function jR(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(r&&i)return r-i}function m4(e,t){if(!(e&&t))return;let r=AR.exec(e),i=AR.exec(t);if(r&&i)return e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t?1:e<t?-1:0}var OR=/t|\s/i;function u4(e){let t=ER(e);return function(i){let n=i.split(OR);return n.length===2&&f4(n[0])&&t(n[1])}}function h4(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(r&&i)return r-i}function g4(e,t){if(!(e&&t))return;let[r,i]=e.split(OR),[n,o]=t.split(OR),s=NR(r,n);if(s!==void 0)return s||jR(i,o)}var Uie=/\/|:/,qie=/^(?:[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 Fie(e){return Uie.test(e)&&qie.test(e)}var d4=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Zie(e){return d4.lastIndex=0,d4.test(e)}var Vie=-(2**31),Bie=2**31-1;function Kie(e){return Number.isInteger(e)&&e<=Bie&&e>=Vie}function Wie(e){return Number.isInteger(e)}function p4(){return!0}var Gie=/[^\\]\\Z/;function Hie(e){if(Gie.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var wm=I(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.regexpCode=ct.getEsmExportName=ct.getProperty=ct.safeStringify=ct.stringify=ct.strConcat=ct.addCodeArg=ct.str=ct._=ct.nil=ct._Code=ct.Name=ct.IDENTIFIER=ct._CodeOrName=void 0;var $m=class{};ct._CodeOrName=$m;ct.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Xa=class extends $m{constructor(t){if(super(),!ct.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ct.Name=Xa;var Qn=class extends $m{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,i)=>`${r}${i}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,i)=>(i instanceof Xa&&(r[i.str]=(r[i.str]||0)+1),r),{})}};ct._Code=Qn;ct.nil=new Qn("");function v4(e,...t){let r=[e[0]],i=0;for(;i<t.length;)DR(r,t[i]),r.push(e[++i]);return new Qn(r)}ct._=v4;var zR=new Qn("+");function $4(e,...t){let r=[bm(e[0])],i=0;for(;i<t.length;)r.push(zR),DR(r,t[i]),r.push(zR,bm(e[++i]));return Jie(r),new Qn(r)}ct.str=$4;function DR(e,t){t instanceof Qn?e.push(...t._items):t instanceof Xa?e.push(t):e.push(Qie(t))}ct.addCodeArg=DR;function Jie(e){let t=1;for(;t<e.length-1;){if(e[t]===zR){let r=Yie(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Yie(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Xa||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Xa))return`"${e}${t.slice(1)}`}function Xie(e,t){return t.emptyStr()?e:e.emptyStr()?t:$4`${e}${t}`}ct.strConcat=Xie;function Qie(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:bm(Array.isArray(e)?e.join(","):e)}function eoe(e){return new Qn(bm(e))}ct.stringify=eoe;function bm(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ct.safeStringify=bm;function toe(e){return typeof e=="string"&&ct.IDENTIFIER.test(e)?new Qn(`.${e}`):v4`[${e}]`}ct.getProperty=toe;function roe(e){if(typeof e=="string"&&ct.IDENTIFIER.test(e))return new Qn(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ct.getEsmExportName=roe;function noe(e){return new Qn(e.toString())}ct.regexpCode=noe});var UR=I($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.ValueScope=$n.ValueScopeName=$n.Scope=$n.varKinds=$n.UsedValueState=void 0;var vn=wm(),MR=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Jb;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Jb||($n.UsedValueState=Jb={}));$n.varKinds={const:new vn.Name("const"),let:new vn.Name("let"),var:new vn.Name("var")};var Yb=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof vn.Name?t:this.name(t)}name(t){return new vn.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};$n.Scope=Yb;var Xb=class extends vn.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:i}){this.value=t,this.scopePath=(0,vn._)`.${new vn.Name(r)}[${i}]`}};$n.ValueScopeName=Xb;var ioe=(0,vn._)`\n`,LR=class extends Yb{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ioe:vn.nil}}get(){return this._scope}name(t){return new Xb(t,this._newName(t))}value(t,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let u=a.get(s);if(u)return u}else a=this._values[o]=new Map;a.set(s,n);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(t,r){let i=this._values[t];if(i)return i.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,vn._)`${t}${i.scopePath}`})}scopeCode(t=this._values,r,i){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(t,r,i={},n){let o=vn.nil;for(let s in t){let a=t[s];if(!a)continue;let c=i[s]=i[s]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Jb.Started);let u=r(l);if(u){let d=this.opts.es5?$n.varKinds.var:$n.varKinds.const;o=(0,vn._)`${o}${d} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))o=(0,vn._)`${o}${u}${this.opts._n}`;else throw new MR(l);c.set(l,Jb.Completed)})}return o}};$n.ValueScope=LR});var Ee=I(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.or=De.and=De.not=De.CodeGen=De.operators=De.varKinds=De.ValueScopeName=De.ValueScope=De.Scope=De.Name=De.regexpCode=De.stringify=De.getProperty=De.nil=De.strConcat=De.str=De._=void 0;var Ye=wm(),yi=UR(),Is=wm();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return Is._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return Is.str}});Object.defineProperty(De,"strConcat",{enumerable:!0,get:function(){return Is.strConcat}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return Is.nil}});Object.defineProperty(De,"getProperty",{enumerable:!0,get:function(){return Is.getProperty}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return Is.stringify}});Object.defineProperty(De,"regexpCode",{enumerable:!0,get:function(){return Is.regexpCode}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return Is.Name}});var rw=UR();Object.defineProperty(De,"Scope",{enumerable:!0,get:function(){return rw.Scope}});Object.defineProperty(De,"ValueScope",{enumerable:!0,get:function(){return rw.ValueScope}});Object.defineProperty(De,"ValueScopeName",{enumerable:!0,get:function(){return rw.ValueScopeName}});Object.defineProperty(De,"varKinds",{enumerable:!0,get:function(){return rw.varKinds}});De.operators={GT:new Ye._Code(">"),GTE:new Ye._Code(">="),LT:new Ye._Code("<"),LTE:new Ye._Code("<="),EQ:new Ye._Code("==="),NEQ:new Ye._Code("!=="),NOT:new Ye._Code("!"),OR:new Ye._Code("||"),AND:new Ye._Code("&&"),ADD:new Ye._Code("+")};var Ro=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},qR=class extends Ro{constructor(t,r,i){super(),this.varKind=t,this.name=r,this.rhs=i}render({es5:t,_n:r}){let i=t?yi.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=wu(this.rhs,t,r)),this}get names(){return this.rhs instanceof Ye._CodeOrName?this.rhs.names:{}}},Qb=class extends Ro{constructor(t,r,i){super(),this.lhs=t,this.rhs=r,this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Ye.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=wu(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Ye.Name?{}:{...this.lhs.names};return tw(t,this.rhs)}},FR=class extends Qb{constructor(t,r,i,n){super(t,i,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},ZR=class extends Ro{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},VR=class extends Ro{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},BR=class extends Ro{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},KR=class extends Ro{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=wu(this.code,t,r),this}get names(){return this.code instanceof Ye._CodeOrName?this.code.names:{}}},_m=class extends Ro{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,i)=>r+i.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let i=t[r].optimizeNodes();Array.isArray(i)?t.splice(r,1,...i):i?t[r]=i:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(t,r)||(ooe(t,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>tc(t,r.names),{})}},Co=class extends _m{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},WR=class extends _m{},bu=class extends Co{};bu.kind="else";var Qa=class e extends Co{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new bu(i):i}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(b4(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=wu(this.condition,t,r),this}get names(){let t=super.names;return tw(t,this.condition),this.else&&tc(t,this.else.names),t}};Qa.kind="if";var ec=class extends Co{};ec.kind="for";var GR=class extends ec{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=wu(this.iteration,t,r),this}get names(){return tc(super.names,this.iteration.names)}},HR=class extends ec{constructor(t,r,i,n){super(),this.varKind=t,this.name=r,this.from=i,this.to=n}render(t){let r=t.es5?yi.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){let t=tw(super.names,this.from);return tw(t,this.to)}},ew=class extends ec{constructor(t,r,i,n){super(),this.loop=t,this.varKind=r,this.name=i,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=wu(this.iterable,t,r),this}get names(){return tc(super.names,this.iterable.names)}},km=class extends Co{constructor(t,r,i){super(),this.name=t,this.args=r,this.async=i}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};km.kind="func";var Sm=class extends _m{render(t){return"return "+super.render(t)}};Sm.kind="return";var JR=class extends Co{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var i,n;return super.optimizeNames(t,r),(i=this.catch)===null||i===void 0||i.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&tc(t,this.catch.names),this.finally&&tc(t,this.finally.names),t}},xm=class extends Co{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};xm.kind="catch";var Im=class extends Co{render(t){return"finally"+super.render(t)}};Im.kind="finally";var YR=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
10
+ `:""},this._extScope=t,this._scope=new yi.Scope({parent:t}),this._nodes=[new WR]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let i=this._extScope.value(t,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new qR(t,o,i)),o}const(t,r,i){return this._def(yi.varKinds.const,t,r,i)}let(t,r,i){return this._def(yi.varKinds.let,t,r,i)}var(t,r,i){return this._def(yi.varKinds.var,t,r,i)}assign(t,r,i){return this._leafNode(new Qb(t,r,i))}add(t,r){return this._leafNode(new FR(t,De.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Ye.nil&&this._leafNode(new KR(t)),this}object(...t){let r=["{"];for(let[i,n]of t)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,Ye.addCodeArg)(r,n));return r.push("}"),new Ye._Code(r)}if(t,r,i){if(this._blockNode(new Qa(t)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Qa(t))}else(){return this._elseNode(new bu)}endIf(){return this._endBlockNode(Qa,bu)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new GR(t),r)}forRange(t,r,i,n,o=this.opts.es5?yi.varKinds.var:yi.varKinds.let){let s=this._scope.toName(t);return this._for(new HR(o,s,r,i),()=>n(s))}forOf(t,r,i,n=yi.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let s=r instanceof Ye.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Ye._)`${s}.length`,a=>{this.var(o,(0,Ye._)`${s}[${a}]`),i(o)})}return this._for(new ew("of",n,o,r),()=>i(o))}forIn(t,r,i,n=this.opts.es5?yi.varKinds.var:yi.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Ye._)`Object.keys(${r})`,i);let o=this._scope.toName(t);return this._for(new ew("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(ec)}label(t){return this._leafNode(new ZR(t))}break(t){return this._leafNode(new VR(t))}return(t){let r=new Sm;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Sm)}try(t,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new JR;if(this._blockNode(n),this.code(t),r){let o=this.name("e");this._currNode=n.catch=new xm(o),r(o)}return i&&(this._currNode=n.finally=new Im,this.code(i)),this._endBlockNode(xm,Im)}throw(t){return this._leafNode(new BR(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||t!==void 0&&i!==t)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Ye.nil,i,n){return this._blockNode(new km(t,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(km)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let i=this._currNode;if(i instanceof t||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Qa))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};De.CodeGen=YR;function tc(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function tw(e,t){return t instanceof Ye._CodeOrName?tc(e,t.names):e}function wu(e,t,r){if(e instanceof Ye.Name)return i(e);if(!n(e))return e;return new Ye._Code(e._items.reduce((o,s)=>(s instanceof Ye.Name&&(s=i(s)),s instanceof Ye._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||t[o.str]!==1?o:(delete t[o.str],s)}function n(o){return o instanceof Ye._Code&&o._items.some(s=>s instanceof Ye.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function ooe(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function b4(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Ye._)`!${XR(e)}`}De.not=b4;var soe=w4(De.operators.AND);function aoe(...e){return e.reduce(soe)}De.and=aoe;var coe=w4(De.operators.OR);function loe(...e){return e.reduce(coe)}De.or=loe;function w4(e){return(t,r)=>t===Ye.nil?r:r===Ye.nil?t:(0,Ye._)`${XR(t)} ${e} ${XR(r)}`}function XR(e){return e instanceof Ye.Name?e:(0,Ye._)`(${e})`}});var tt=I(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.checkStrictMode=Fe.getErrorPath=Fe.Type=Fe.useFunc=Fe.setEvaluated=Fe.evaluatedPropsToName=Fe.mergeEvaluated=Fe.eachItem=Fe.unescapeJsonPointer=Fe.escapeJsonPointer=Fe.escapeFragment=Fe.unescapeFragment=Fe.schemaRefOrVal=Fe.schemaHasRulesButRef=Fe.schemaHasRules=Fe.checkUnknownRules=Fe.alwaysValidSchema=Fe.toHash=void 0;var At=Ee(),uoe=wm();function doe(e){let t={};for(let r of e)t[r]=!0;return t}Fe.toHash=doe;function poe(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(S4(e,t),!x4(t,e.self.RULES.all))}Fe.alwaysValidSchema=poe;function S4(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=i.RULES.keywords;for(let o in t)n[o]||P4(e,`unknown keyword: "${o}"`)}Fe.checkUnknownRules=S4;function x4(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Fe.schemaHasRules=x4;function foe(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Fe.schemaHasRulesButRef=foe;function moe({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,At._)`${r}`}return(0,At._)`${e}${t}${(0,At.getProperty)(i)}`}Fe.schemaRefOrVal=moe;function hoe(e){return I4(decodeURIComponent(e))}Fe.unescapeFragment=hoe;function goe(e){return encodeURIComponent(eC(e))}Fe.escapeFragment=goe;function eC(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Fe.escapeJsonPointer=eC;function I4(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Fe.unescapeJsonPointer=I4;function yoe(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Fe.eachItem=yoe;function _4({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let c=s===void 0?o:s instanceof At.Name?(o instanceof At.Name?e(n,o,s):t(n,o,s),s):o instanceof At.Name?(t(n,s,o),o):r(o,s);return a===At.Name&&!(c instanceof At.Name)?i(n,c):c}}Fe.mergeEvaluated={props:_4({mergeNames:(e,t,r)=>e.if((0,At._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,At._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,At._)`${r} || {}`).code((0,At._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,At._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,At._)`${r} || {}`),tC(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:T4}),items:_4({mergeNames:(e,t,r)=>e.if((0,At._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,At._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,At._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,At._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function T4(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,At._)`{}`);return t!==void 0&&tC(e,r,t),r}Fe.evaluatedPropsToName=T4;function tC(e,t,r){Object.keys(r).forEach(i=>e.assign((0,At._)`${t}${(0,At.getProperty)(i)}`,!0))}Fe.setEvaluated=tC;var k4={};function voe(e,t){return e.scopeValue("func",{ref:t,code:k4[t.code]||(k4[t.code]=new uoe._Code(t.code))})}Fe.useFunc=voe;var QR;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(QR||(Fe.Type=QR={}));function $oe(e,t,r){if(e instanceof At.Name){let i=t===QR.Num;return r?i?(0,At._)`"[" + ${e} + "]"`:(0,At._)`"['" + ${e} + "']"`:i?(0,At._)`"/" + ${e}`:(0,At._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,At.getProperty)(e).toString():"/"+eC(e)}Fe.getErrorPath=$oe;function P4(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Fe.checkStrictMode=P4});var Ao=I(rC=>{"use strict";Object.defineProperty(rC,"__esModule",{value:!0});var Fr=Ee(),boe={data:new Fr.Name("data"),valCxt:new Fr.Name("valCxt"),instancePath:new Fr.Name("instancePath"),parentData:new Fr.Name("parentData"),parentDataProperty:new Fr.Name("parentDataProperty"),rootData:new Fr.Name("rootData"),dynamicAnchors:new Fr.Name("dynamicAnchors"),vErrors:new Fr.Name("vErrors"),errors:new Fr.Name("errors"),this:new Fr.Name("this"),self:new Fr.Name("self"),scope:new Fr.Name("scope"),json:new Fr.Name("json"),jsonPos:new Fr.Name("jsonPos"),jsonLen:new Fr.Name("jsonLen"),jsonPart:new Fr.Name("jsonPart")};rC.default=boe});var Tm=I(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.extendErrors=Zr.resetErrorsCount=Zr.reportExtraError=Zr.reportError=Zr.keyword$DataError=Zr.keywordError=void 0;var rt=Ee(),nw=tt(),tn=Ao();Zr.keywordError={message:({keyword:e})=>(0,rt.str)`must pass "${e}" keyword validation`};Zr.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,rt.str)`"${e}" keyword must be ${t} ($data)`:(0,rt.str)`"${e}" keyword is invalid ($data)`};function woe(e,t=Zr.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:a}=n,c=A4(e,t,r);i??(s||a)?R4(o,c):C4(n,(0,rt._)`[${c}]`)}Zr.reportError=woe;function _oe(e,t=Zr.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,a=A4(e,t,r);R4(n,a),o||s||C4(i,tn.default.vErrors)}Zr.reportExtraError=_oe;function koe(e,t){e.assign(tn.default.errors,t),e.if((0,rt._)`${tn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,rt._)`${tn.default.vErrors}.length`,t),()=>e.assign(tn.default.vErrors,null)))}Zr.resetErrorsCount=koe;function Soe({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,tn.default.errors,a=>{e.const(s,(0,rt._)`${tn.default.vErrors}[${a}]`),e.if((0,rt._)`${s}.instancePath === undefined`,()=>e.assign((0,rt._)`${s}.instancePath`,(0,rt.strConcat)(tn.default.instancePath,o.errorPath))),e.assign((0,rt._)`${s}.schemaPath`,(0,rt.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,rt._)`${s}.schema`,r),e.assign((0,rt._)`${s}.data`,i))})}Zr.extendErrors=Soe;function R4(e,t){let r=e.const("err",t);e.if((0,rt._)`${tn.default.vErrors} === null`,()=>e.assign(tn.default.vErrors,(0,rt._)`[${r}]`),(0,rt._)`${tn.default.vErrors}.push(${r})`),e.code((0,rt._)`${tn.default.errors}++`)}function C4(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,rt._)`new ${e.ValidationError}(${t})`):(r.assign((0,rt._)`${i}.errors`,t),r.return(!1))}var rc={keyword:new rt.Name("keyword"),schemaPath:new rt.Name("schemaPath"),params:new rt.Name("params"),propertyName:new rt.Name("propertyName"),message:new rt.Name("message"),schema:new rt.Name("schema"),parentSchema:new rt.Name("parentSchema")};function A4(e,t,r){let{createErrors:i}=e.it;return i===!1?(0,rt._)`{}`:xoe(e,t,r)}function xoe(e,t,r={}){let{gen:i,it:n}=e,o=[Ioe(n,r),Toe(e,r)];return Poe(e,t,o),i.object(...o)}function Ioe({errorPath:e},{instancePath:t}){let r=t?(0,rt.str)`${e}${(0,nw.getErrorPath)(t,nw.Type.Str)}`:e;return[tn.default.instancePath,(0,rt.strConcat)(tn.default.instancePath,r)]}function Toe({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,rt.str)`${t}/${e}`;return r&&(n=(0,rt.str)`${n}${(0,nw.getErrorPath)(r,nw.Type.Str)}`),[rc.schemaPath,n]}function Poe(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;i.push([rc.keyword,n],[rc.params,typeof t=="function"?t(e):t||(0,rt._)`{}`]),c.messages&&i.push([rc.message,typeof r=="function"?r(e):r]),c.verbose&&i.push([rc.schema,s],[rc.parentSchema,(0,rt._)`${u}${d}`],[tn.default.data,o]),l&&i.push([rc.propertyName,l])}});var O4=I(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.boolOrEmptySchema=_u.topBoolOrEmptySchema=void 0;var Roe=Tm(),Coe=Ee(),Aoe=Ao(),Eoe={message:"boolean schema is false"};function Ooe(e){let{gen:t,schema:r,validateName:i}=e;r===!1?E4(e,!1):typeof r=="object"&&r.$async===!0?t.return(Aoe.default.data):(t.assign((0,Coe._)`${i}.errors`,null),t.return(!0))}_u.topBoolOrEmptySchema=Ooe;function Noe(e,t){let{gen:r,schema:i}=e;i===!1?(r.var(t,!1),E4(e)):r.var(t,!0)}_u.boolOrEmptySchema=Noe;function E4(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Roe.reportError)(n,Eoe,void 0,t)}});var nC=I(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.getRules=ku.isJSONType=void 0;var joe=["string","number","integer","boolean","null","object","array"],zoe=new Set(joe);function Doe(e){return typeof e=="string"&&zoe.has(e)}ku.isJSONType=Doe;function Moe(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ku.getRules=Moe});var iC=I(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.shouldUseRule=Ts.shouldUseGroup=Ts.schemaHasRulesForType=void 0;function Loe({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&N4(e,i)}Ts.schemaHasRulesForType=Loe;function N4(e,t){return t.rules.some(r=>j4(e,r))}Ts.shouldUseGroup=N4;function j4(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(i=>e[i]!==void 0))}Ts.shouldUseRule=j4});var Pm=I(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.reportTypeError=Vr.checkDataTypes=Vr.checkDataType=Vr.coerceAndCheckDataType=Vr.getJSONTypes=Vr.getSchemaTypes=Vr.DataType=void 0;var Uoe=nC(),qoe=iC(),Foe=Tm(),Pe=Ee(),z4=tt(),Su;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Su||(Vr.DataType=Su={}));function Zoe(e){let t=D4(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Vr.getSchemaTypes=Zoe;function D4(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Uoe.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Vr.getJSONTypes=D4;function Voe(e,t){let{gen:r,data:i,opts:n}=e,o=Boe(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,qoe.schemaHasRulesForType)(e,t[0]));if(s){let a=sC(t,i,n.strictNumbers,Su.Wrong);r.if(a,()=>{o.length?Koe(e,t,o):aC(e)})}return s}Vr.coerceAndCheckDataType=Voe;var M4=new Set(["string","number","integer","boolean","null"]);function Boe(e,t){return t?e.filter(r=>M4.has(r)||t==="array"&&r==="array"):[]}function Koe(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",(0,Pe._)`typeof ${n}`),a=i.let("coerced",(0,Pe._)`undefined`);o.coerceTypes==="array"&&i.if((0,Pe._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,Pe._)`${n}[0]`).assign(s,(0,Pe._)`typeof ${n}`).if(sC(t,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,Pe._)`${a} !== undefined`);for(let l of r)(M4.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);i.else(),aC(e),i.endIf(),i.if((0,Pe._)`${a} !== undefined`,()=>{i.assign(n,a),Woe(e,a)});function c(l){switch(l){case"string":i.elseIf((0,Pe._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Pe._)`"" + ${n}`).elseIf((0,Pe._)`${n} === null`).assign(a,(0,Pe._)`""`);return;case"number":i.elseIf((0,Pe._)`${s} == "boolean" || ${n} === null
11
+ || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,Pe._)`+${n}`);return;case"integer":i.elseIf((0,Pe._)`${s} === "boolean" || ${n} === null
12
+ || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,Pe._)`+${n}`);return;case"boolean":i.elseIf((0,Pe._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,Pe._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,Pe._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,Pe._)`${s} === "string" || ${s} === "number"
13
+ || ${s} === "boolean" || ${n} === null`).assign(a,(0,Pe._)`[${n}]`)}}}function Woe({gen:e,parentData:t,parentDataProperty:r},i){e.if((0,Pe._)`${t} !== undefined`,()=>e.assign((0,Pe._)`${t}[${r}]`,i))}function oC(e,t,r,i=Su.Correct){let n=i===Su.Correct?Pe.operators.EQ:Pe.operators.NEQ,o;switch(e){case"null":return(0,Pe._)`${t} ${n} null`;case"array":o=(0,Pe._)`Array.isArray(${t})`;break;case"object":o=(0,Pe._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s((0,Pe._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return(0,Pe._)`typeof ${t} ${n} ${e}`}return i===Su.Correct?o:(0,Pe.not)(o);function s(a=Pe.nil){return(0,Pe.and)((0,Pe._)`typeof ${t} == "number"`,a,r?(0,Pe._)`isFinite(${t})`:Pe.nil)}}Vr.checkDataType=oC;function sC(e,t,r,i){if(e.length===1)return oC(e[0],t,r,i);let n,o=(0,z4.toHash)(e);if(o.array&&o.object){let s=(0,Pe._)`typeof ${t} != "object"`;n=o.null?s:(0,Pe._)`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=Pe.nil;o.number&&delete o.integer;for(let s in o)n=(0,Pe.and)(n,oC(s,t,r,i));return n}Vr.checkDataTypes=sC;var Goe={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Pe._)`{type: ${e}}`:(0,Pe._)`{type: ${t}}`};function aC(e){let t=Hoe(e);(0,Foe.reportError)(t,Goe)}Vr.reportTypeError=aC;function Hoe(e){let{gen:t,data:r,schema:i}=e,n=(0,z4.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var U4=I(iw=>{"use strict";Object.defineProperty(iw,"__esModule",{value:!0});iw.assignDefaults=void 0;var xu=Ee(),Joe=tt();function Yoe(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)L4(e,n,r[n].default);else t==="array"&&Array.isArray(i)&&i.forEach((n,o)=>L4(e,o,n.default))}iw.assignDefaults=Yoe;function L4(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let a=(0,xu._)`${o}${(0,xu.getProperty)(t)}`;if(n){(0,Joe.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,xu._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,xu._)`${c} || ${a} === null || ${a} === ""`),i.if(c,(0,xu._)`${a} = ${(0,xu.stringify)(r)}`)}});var ei=I(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateUnion=It.validateArray=It.usePattern=It.callValidateCode=It.schemaProperties=It.allSchemaProperties=It.noPropertyInData=It.propertyInData=It.isOwnProperty=It.hasPropFunc=It.reportMissingProp=It.checkMissingProp=It.checkReportMissingProp=void 0;var zt=Ee(),cC=tt(),Ps=Ao(),Xoe=tt();function Qoe(e,t){let{gen:r,data:i,it:n}=e;r.if(uC(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,zt._)`${t}`},!0),e.error()})}It.checkReportMissingProp=Qoe;function ese({gen:e,data:t,it:{opts:r}},i,n){return(0,zt.or)(...i.map(o=>(0,zt.and)(uC(e,t,o,r.ownProperties),(0,zt._)`${n} = ${o}`)))}It.checkMissingProp=ese;function tse(e,t){e.setParams({missingProperty:t},!0),e.error()}It.reportMissingProp=tse;function q4(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,zt._)`Object.prototype.hasOwnProperty`})}It.hasPropFunc=q4;function lC(e,t,r){return(0,zt._)`${q4(e)}.call(${t}, ${r})`}It.isOwnProperty=lC;function rse(e,t,r,i){let n=(0,zt._)`${t}${(0,zt.getProperty)(r)} !== undefined`;return i?(0,zt._)`${n} && ${lC(e,t,r)}`:n}It.propertyInData=rse;function uC(e,t,r,i){let n=(0,zt._)`${t}${(0,zt.getProperty)(r)} === undefined`;return i?(0,zt.or)(n,(0,zt.not)(lC(e,t,r))):n}It.noPropertyInData=uC;function F4(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}It.allSchemaProperties=F4;function nse(e,t){return F4(t).filter(r=>!(0,cC.alwaysValidSchema)(e,t[r]))}It.schemaProperties=nse;function ise({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,c,l){let u=l?(0,zt._)`${e}, ${t}, ${i}${n}`:t,d=[[Ps.default.instancePath,(0,zt.strConcat)(Ps.default.instancePath,o)],[Ps.default.parentData,s.parentData],[Ps.default.parentDataProperty,s.parentDataProperty],[Ps.default.rootData,Ps.default.rootData]];s.opts.dynamicRef&&d.push([Ps.default.dynamicAnchors,Ps.default.dynamicAnchors]);let p=(0,zt._)`${u}, ${r.object(...d)}`;return c!==zt.nil?(0,zt._)`${a}.call(${c}, ${p})`:(0,zt._)`${a}(${p})`}It.callValidateCode=ise;var ose=(0,zt._)`new RegExp`;function sse({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,zt._)`${n.code==="new RegExp"?ose:(0,Xoe.useFunc)(e,n)}(${r}, ${i})`})}It.usePattern=sse;function ase(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(o,!0),s(()=>t.break()),o;function s(a){let c=t.const("len",(0,zt._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:cC.Type.Num},o),t.if((0,zt.not)(o),a)})}}It.validateArray=ase;function cse(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,cC.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:i,schemaProp:l,compositeRule:!0},a);t.assign(s,(0,zt._)`${s} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,zt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}It.validateUnion=cse});var B4=I(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateKeywordUsage=Hi.validSchemaType=Hi.funcKeywordCode=Hi.macroKeywordCode=void 0;var rn=Ee(),nc=Ao(),lse=ei(),use=Tm();function dse(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,a=t.macro.call(s.self,n,o,s),c=V4(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:rn.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Hi.macroKeywordCode=dse;function pse(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:c}=e;mse(c,t);let l=!a&&t.compile?t.compile.call(c.self,o,s,c):t.validate,u=V4(i,n,l),d=i.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&Z4(e),g(()=>e.error());else{let y=t.async?f():m();t.modifying&&Z4(e),g(()=>fse(e,y))}}function f(){let y=i.let("ruleErrs",null);return i.try(()=>h((0,rn._)`await `),v=>i.assign(d,!1).if((0,rn._)`${v} instanceof ${c.ValidationError}`,()=>i.assign(y,(0,rn._)`${v}.errors`),()=>i.throw(v))),y}function m(){let y=(0,rn._)`${u}.errors`;return i.assign(y,null),h(rn.nil),y}function h(y=t.async?(0,rn._)`await `:rn.nil){let v=c.opts.passContext?nc.default.this:nc.default.self,b=!("compile"in t&&!a||t.schema===!1);i.assign(d,(0,rn._)`${y}${(0,lse.callValidateCode)(e,u,v,b)}`,t.modifying)}function g(y){var v;i.if((0,rn.not)((v=t.valid)!==null&&v!==void 0?v:d),y)}}Hi.funcKeywordCode=pse;function Z4(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,rn._)`${i.parentData}[${i.parentDataProperty}]`))}function fse(e,t){let{gen:r}=e;r.if((0,rn._)`Array.isArray(${t})`,()=>{r.assign(nc.default.vErrors,(0,rn._)`${nc.default.vErrors} === null ? ${t} : ${nc.default.vErrors}.concat(${t})`).assign(nc.default.errors,(0,rn._)`${nc.default.vErrors}.length`),(0,use.extendErrors)(e)},()=>e.error())}function mse({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function V4(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,rn.stringify)(r)})}function hse(e,t,r=!1){return!t.length||t.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}Hi.validSchemaType=hse;function gse({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Hi.validateKeywordUsage=gse});var W4=I(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.extendSubschemaMode=Rs.extendSubschemaData=Rs.getSubschema=void 0;var Ji=Ee(),K4=tt();function yse(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Ji._)`${e.schemaPath}${(0,Ji.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Ji._)`${e.schemaPath}${(0,Ji.getProperty)(t)}${(0,Ji.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,K4.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Rs.getSubschema=yse;function vse(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,p=a.let("data",(0,Ji._)`${t.data}${(0,Ji.getProperty)(r)}`,!0);c(p),e.errorPath=(0,Ji.str)`${l}${(0,K4.getErrorPath)(r,i,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Ji._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let l=n instanceof Ji.Name?n:a.let("data",n,!0);c(l),s!==void 0&&(e.propertyName=s)}o&&(e.dataTypes=o);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}Rs.extendSubschemaData=vse;function $se(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(e.compositeRule=i),n!==void 0&&(e.createErrors=n),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}Rs.extendSubschemaMode=$se});var H4=I((bEe,G4)=>{"use strict";var Cs=G4.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};ow(t,i,n,e,"",e)};Cs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Cs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Cs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Cs.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 ow(e,t,r,i,n,o,s,a,c,l){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,a,c,l);for(var u in i){var d=i[u];if(Array.isArray(d)){if(u in Cs.arrayKeywords)for(var p=0;p<d.length;p++)ow(e,t,r,d[p],n+"/"+u+"/"+p,o,n,u,i,p)}else if(u in Cs.propsKeywords){if(d&&typeof d=="object")for(var f in d)ow(e,t,r,d[f],n+"/"+u+"/"+bse(f),o,n,u,i,f)}else(u in Cs.keywords||e.allKeys&&!(u in Cs.skipKeywords))&&ow(e,t,r,d,n+"/"+u,o,n,u,i)}r(i,n,o,s,a,c,l)}}function bse(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Rm=I(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.getSchemaRefs=bn.resolveUrl=bn.normalizeId=bn._getFullPath=bn.getFullPath=bn.inlineRef=void 0;var wse=tt(),_se=Qf(),kse=H4(),Sse=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function xse(e,t=!0){return typeof e=="boolean"?!0:t===!0?!dC(e):t?J4(e)<=t:!1}bn.inlineRef=xse;var Ise=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function dC(e){for(let t in e){if(Ise.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(dC)||typeof r=="object"&&dC(r))return!0}return!1}function J4(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Sse.has(r)&&(typeof e[r]=="object"&&(0,wse.eachItem)(e[r],i=>t+=J4(i)),t===1/0))return 1/0}return t}function Y4(e,t="",r){r!==!1&&(t=Iu(t));let i=e.parse(t);return X4(e,i)}bn.getFullPath=Y4;function X4(e,t){return e.serialize(t).split("#")[0]+"#"}bn._getFullPath=X4;var Tse=/#\/?$/;function Iu(e){return e?e.replace(Tse,""):""}bn.normalizeId=Iu;function Pse(e,t,r){return r=Iu(r),e.resolve(t,r)}bn.resolveUrl=Pse;var Rse=/^[a-z_][-a-z0-9._]*$/i;function Cse(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=Iu(e[r]||t),o={"":n},s=Y4(i,n,!1),a={},c=new Set;return kse(e,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=s+p,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),o[p]=g;function y(b){let _=this.opts.uriResolver.resolve;if(b=Iu(g?_(g,b):b),c.has(b))throw u(b);c.add(b);let k=this.refs[b];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?l(d,k.schema,b):b!==Iu(h)&&(b[0]==="#"?(l(d,a[b],b),a[b]=d):this.refs[b]=h),b}function v(b){if(typeof b=="string"){if(!Rse.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),a;function l(d,p,f){if(p!==void 0&&!_se(d,p))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}bn.getSchemaRefs=Cse});var Em=I(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.getData=As.KeywordCxt=As.validateFunctionCode=void 0;var nF=O4(),Q4=Pm(),fC=iC(),sw=Pm(),Ase=U4(),Am=B4(),pC=W4(),ce=Ee(),we=Ao(),Ese=Rm(),Eo=tt(),Cm=Tm();function Ose(e){if(sF(e)&&(aF(e),oF(e))){zse(e);return}iF(e,()=>(0,nF.topBoolOrEmptySchema)(e))}As.validateFunctionCode=Ose;function iF({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){n.code.es5?e.func(t,(0,ce._)`${we.default.data}, ${we.default.valCxt}`,i.$async,()=>{e.code((0,ce._)`"use strict"; ${eF(r,n)}`),jse(e,n),e.code(o)}):e.func(t,(0,ce._)`${we.default.data}, ${Nse(n)}`,i.$async,()=>e.code(eF(r,n)).code(o))}function Nse(e){return(0,ce._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${e.dynamicRef?(0,ce._)`, ${we.default.dynamicAnchors}={}`:ce.nil}}={}`}function jse(e,t){e.if(we.default.valCxt,()=>{e.var(we.default.instancePath,(0,ce._)`${we.default.valCxt}.${we.default.instancePath}`),e.var(we.default.parentData,(0,ce._)`${we.default.valCxt}.${we.default.parentData}`),e.var(we.default.parentDataProperty,(0,ce._)`${we.default.valCxt}.${we.default.parentDataProperty}`),e.var(we.default.rootData,(0,ce._)`${we.default.valCxt}.${we.default.rootData}`),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,ce._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{e.var(we.default.instancePath,(0,ce._)`""`),e.var(we.default.parentData,(0,ce._)`undefined`),e.var(we.default.parentDataProperty,(0,ce._)`undefined`),e.var(we.default.rootData,we.default.data),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,ce._)`{}`)})}function zse(e){let{schema:t,opts:r,gen:i}=e;iF(e,()=>{r.$comment&&t.$comment&&lF(e),qse(e),i.let(we.default.vErrors,null),i.let(we.default.errors,0),r.unevaluated&&Dse(e),cF(e),Vse(e)})}function Dse(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,ce._)`${r}.evaluated`),t.if((0,ce._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,ce._)`${e.evaluated}.props`,(0,ce._)`undefined`)),t.if((0,ce._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,ce._)`${e.evaluated}.items`,(0,ce._)`undefined`))}function eF(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,ce._)`/*# sourceURL=${r} */`:ce.nil}function Mse(e,t){if(sF(e)&&(aF(e),oF(e))){Lse(e,t);return}(0,nF.boolOrEmptySchema)(e,t)}function oF({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function sF(e){return typeof e.schema!="boolean"}function Lse(e,t){let{schema:r,gen:i,opts:n}=e;n.$comment&&r.$comment&&lF(e),Fse(e),Zse(e);let o=i.const("_errs",we.default.errors);cF(e,o),i.var(t,(0,ce._)`${o} === ${we.default.errors}`)}function aF(e){(0,Eo.checkUnknownRules)(e),Use(e)}function cF(e,t){if(e.opts.jtd)return tF(e,[],!1,t);let r=(0,Q4.getSchemaTypes)(e.schema),i=(0,Q4.coerceAndCheckDataType)(e,r);tF(e,r,!i,t)}function Use(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,Eo.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function qse(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Eo.checkStrictMode)(e,"default is ignored in the schema root")}function Fse(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Ese.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Zse(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function lF({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code((0,ce._)`${we.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,ce.str)`${i}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,ce._)`${we.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function Vse(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;r.$async?t.if((0,ce._)`${we.default.errors} === 0`,()=>t.return(we.default.data),()=>t.throw((0,ce._)`new ${n}(${we.default.vErrors})`)):(t.assign((0,ce._)`${i}.errors`,we.default.vErrors),o.unevaluated&&Bse(e),t.return((0,ce._)`${we.default.errors} === 0`))}function Bse({gen:e,evaluated:t,props:r,items:i}){r instanceof ce.Name&&e.assign((0,ce._)`${t}.props`,r),i instanceof ce.Name&&e.assign((0,ce._)`${t}.items`,i)}function tF(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Eo.schemaHasRulesButRef)(o,u))){n.block(()=>dF(e,"$ref",u.all.$ref.definition));return}c.jtd||Kse(e,t),n.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){(0,fC.shouldUseGroup)(o,p)&&(p.type?(n.if((0,sw.checkDataType)(p.type,s,c.strictNumbers)),rF(e,p),t.length===1&&t[0]===p.type&&r&&(n.else(),(0,sw.reportTypeError)(e)),n.endIf()):rF(e,p),a||n.if((0,ce._)`${we.default.errors} === ${i||0}`))}}function rF(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;n&&(0,Ase.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,fC.shouldUseRule)(i,o)&&dF(e,o.keyword,o.definition,t.type)})}function Kse(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Wse(e,t),e.opts.allowUnionTypes||Gse(e,t),Hse(e,e.dataTypes))}function Wse(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{uF(e.dataTypes,r)||mC(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Yse(e,t)}}function Gse(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&mC(e,"use allowUnionTypes to allow union type keyword")}function Hse(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,fC.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>Jse(t,s))&&mC(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Jse(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function uF(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Yse(e,t){let r=[];for(let i of e.dataTypes)uF(t,i)?r.push(i):t.includes("integer")&&i==="number"&&r.push("integer");e.dataTypes=r}function mC(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Eo.checkStrictMode)(e,t,e.opts.strictTypes)}var aw=class{constructor(t,r,i){if((0,Am.validateKeywordUsage)(t,r,i),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=i,this.data=t.data,this.schema=t.schema[i],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Eo.schemaRefOrVal)(t,this.schema,i,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",pF(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Am.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",we.default.errors))}result(t,r,i){this.failResult((0,ce.not)(t),r,i)}failResult(t,r,i){this.gen.if(t),i?i():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,ce.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,ce._)`${r} !== undefined && (${(0,ce.or)(this.invalid$data(),t)})`)}error(t,r,i){if(r){this.setParams(r),this._error(t,i),this.setParams({});return}this._error(t,i)}_error(t,r){(t?Cm.reportExtraError:Cm.reportError)(this,this.def.error,r)}$dataError(){(0,Cm.reportError)(this,this.def.$dataError||Cm.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Cm.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,i=ce.nil){this.gen.block(()=>{this.check$data(t,i),r()})}check$data(t=ce.nil,r=ce.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,ce.or)((0,ce._)`${n} === undefined`,r)),t!==ce.nil&&i.assign(t,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),t!==ce.nil&&i.assign(t,!1)),i.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,ce.or)(s(),a());function s(){if(i.length){if(!(r instanceof ce.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,ce._)`${(0,sw.checkDataTypes)(c,r,o.opts.strictNumbers,sw.DataType.Wrong)}`}return ce.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,ce._)`!${c}(${r})`}return ce.nil}}subschema(t,r){let i=(0,pC.getSubschema)(this.it,t);(0,pC.extendSubschemaData)(i,this.it,t),(0,pC.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return Mse(n,r),n}mergeEvaluated(t,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&t.props!==void 0&&(i.props=Eo.mergeEvaluated.props(n,t.props,i.props,r)),i.items!==!0&&t.items!==void 0&&(i.items=Eo.mergeEvaluated.items(n,t.items,i.items,r)))}mergeValidEvaluated(t,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,ce.Name)),!0}};As.KeywordCxt=aw;function dF(e,t,r,i){let n=new aw(e,r,t);"code"in r?r.code(n,i):n.$data&&r.validate?(0,Am.funcKeywordCode)(n,r):"macro"in r?(0,Am.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Am.funcKeywordCode)(n,r)}var Xse=/^\/(?:[^~]|~0|~1)*$/,Qse=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function pF(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return we.default.rootData;if(e[0]==="/"){if(!Xse.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=we.default.rootData}else{let l=Qse.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=t)throw new Error(c("property/index",u));return i[t-u]}if(u>t)throw new Error(c("data",u));if(o=r[t-u],!n)return o}let s=o,a=n.split("/");for(let l of a)l&&(o=(0,ce._)`${o}${(0,ce.getProperty)((0,Eo.unescapeJsonPointer)(l))}`,s=(0,ce._)`${s} && ${o}`);return s;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}As.getData=pF});var cw=I(gC=>{"use strict";Object.defineProperty(gC,"__esModule",{value:!0});var hC=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gC.default=hC});var Om=I($C=>{"use strict";Object.defineProperty($C,"__esModule",{value:!0});var yC=Rm(),vC=class extends Error{constructor(t,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,yC.resolveUrl)(t,r,i),this.missingSchema=(0,yC.normalizeId)((0,yC.getFullPath)(t,this.missingRef))}};$C.default=vC});var uw=I(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.resolveSchema=ti.getCompilingSchema=ti.resolveRef=ti.compileSchema=ti.SchemaEnv=void 0;var vi=Ee(),eae=cw(),ic=Ao(),$i=Rm(),fF=tt(),tae=Em(),Tu=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let i;typeof t.schema=="object"&&(i=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,$i.normalizeId)(i?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=i?.$async,this.refs={}}};ti.SchemaEnv=Tu;function wC(e){let t=mF.call(this,e);if(t)return t;let r=(0,$i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new vi.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;e.$async&&(a=s.scopeValue("Error",{ref:eae.default,code:(0,vi._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let l={gen:s,allErrors:this.opts.allErrors,data:ic.default.data,parentData:ic.default.parentData,parentDataProperty:ic.default.parentDataProperty,dataNames:[ic.default.data],dataPathArr:[vi.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,vi.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:vi.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,vi._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,tae.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();u=`${s.scopeRefs(ic.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let f=new Function(`${ic.default.self}`,`${ic.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=l;f.evaluated={props:m instanceof vi.Name?void 0:m,items:h instanceof vi.Name?void 0:h,dynamicProps:m instanceof vi.Name,dynamicItems:h instanceof vi.Name},f.source&&(f.source.evaluated=(0,vi.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}ti.compileSchema=wC;function rae(e,t,r){var i;r=(0,$i.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=oae.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new Tu({schema:s,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=nae.call(this,o)}ti.resolveRef=rae;function nae(e){return(0,$i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:wC.call(this,e)}function mF(e){for(let t of this._compilations)if(iae(t,e))return t}ti.getCompilingSchema=mF;function iae(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function oae(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||lw.call(this,e,t)}function lw(e,t){let r=this.opts.uriResolver.parse(t),i=(0,$i._getFullPath)(this.opts.uriResolver,r),n=(0,$i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return bC.call(this,r,e);let o=(0,$i.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=lw.call(this,e,s);return typeof a?.schema!="object"?void 0:bC.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||wC.call(this,s),o===(0,$i.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,$i.resolveUrl)(this.opts.uriResolver,n,l)),new Tu({schema:a,schemaId:c,root:e,baseId:n})}return bC.call(this,r,s)}}ti.resolveSchema=lw;var sae=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function bC(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,fF.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!sae.has(a)&&l&&(t=(0,$i.resolveUrl)(this.opts.uriResolver,t,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,fF.schemaHasRulesButRef)(r,this.RULES)){let a=(0,$i.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=lw.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new Tu({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o}});var hF=I((IEe,aae)=>{aae.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 yF=I(_C=>{"use strict";Object.defineProperty(_C,"__esModule",{value:!0});var gF=MP();gF.code='require("ajv/dist/runtime/uri").default';_C.default=gF});var xF=I(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.CodeGen=Ar.Name=Ar.nil=Ar.stringify=Ar.str=Ar._=Ar.KeywordCxt=void 0;var cae=Em();Object.defineProperty(Ar,"KeywordCxt",{enumerable:!0,get:function(){return cae.KeywordCxt}});var Pu=Ee();Object.defineProperty(Ar,"_",{enumerable:!0,get:function(){return Pu._}});Object.defineProperty(Ar,"str",{enumerable:!0,get:function(){return Pu.str}});Object.defineProperty(Ar,"stringify",{enumerable:!0,get:function(){return Pu.stringify}});Object.defineProperty(Ar,"nil",{enumerable:!0,get:function(){return Pu.nil}});Object.defineProperty(Ar,"Name",{enumerable:!0,get:function(){return Pu.Name}});Object.defineProperty(Ar,"CodeGen",{enumerable:!0,get:function(){return Pu.CodeGen}});var lae=cw(),_F=Om(),uae=nC(),Nm=uw(),dae=Ee(),jm=Rm(),dw=Pm(),SC=tt(),vF=hF(),pae=yF(),kF=(e,t)=>new RegExp(e,t);kF.code="new RegExp";var fae=["removeAdditional","useDefaults","coerceTypes"],mae=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),hae={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."},gae={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$F=200;function yae(e){var t,r,i,n,o,s,a,c,l,u,d,p,f,m,h,g,y,v,b,_,k,x,S,C,E;let U=e.strict,V=(t=e.code)===null||t===void 0?void 0:t.optimize,X=V===!0||V===void 0?1:V||0,J=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:kF,it=(n=e.uriResolver)!==null&&n!==void 0?n:pae.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:U)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:U)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:U)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:U)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:U)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:X,regExp:J}:{optimize:X,regExp:J},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:$F,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:$F,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(S=e.validateFormats)!==null&&S!==void 0?S:!0,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(E=e.int32range)!==null&&E!==void 0?E:!0,uriResolver:it}}var zm=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...yae(t)};let{es5:r,lines:i}=this.opts.code;this.scope=new dae.ValueScope({scope:{},prefixes:mae,es5:r,lines:i}),this.logger=kae(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,uae.getRules)(),bF.call(this,hae,t,"NOT SUPPORTED"),bF.call(this,gae,t,"DEPRECATED","warn"),this._metaOpts=wae.call(this),t.formats&&$ae.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&bae.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),vae.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:i}=this.opts,n=vF;i==="id"&&(n={...vF},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[i],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let i;if(typeof t=="string"){if(i=this.getSchema(t),!i)throw new Error(`no schema with key or ref "${t}"`)}else i=this.compile(t);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(t,r){let i=this._addSchema(t,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,t,r);async function n(u,d){await o.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||s.call(this,p)}async function o(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof _F.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.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]=i(u))}finally{delete this._loading[u]}}}addSchema(t,r,i,n=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,i,n);return this}let o;if(typeof t=="object"){let{schemaId:s}=this.opts;if(o=t[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,jm.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,i,r,n,!0),this}addMetaSchema(t,r,i=this.opts.validateSchema){return this.addSchema(t,r,!0,i),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let i;if(i=t.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,t);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(t){let r;for(;typeof(r=wF.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:i}=this.opts,n=new Nm.SchemaEnv({schema:{},schemaId:i});if(r=Nm.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=wF.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let i=t[this.opts.schemaId];return i&&(i=(0,jm.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let i;if(typeof t=="string")i=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof t=="object"&&r===void 0){if(r=t,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(xae.call(this,i,r),!r)return(0,SC.eachItem)(i,o=>kC.call(this,o)),this;Tae.call(this,r);let n={...r,type:(0,dw.getJSONTypes)(r.type),schemaType:(0,dw.getJSONTypes)(r.schemaType)};return(0,SC.eachItem)(i,n.type.length===0?o=>kC.call(this,o,n):o=>n.type.forEach(s=>kC.call(this,o,n,s))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let i of r.rules){let n=i.rules.findIndex(o=>o.keyword===t);n>=0&&i.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:i="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(t,r){let i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let o=n.split("/").slice(1),s=t;for(let a of o)s=s[a];for(let a in i){let c=i[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=s[a];l&&u&&(s[a]=SF(u))}}return t}_removeAllSchemas(t,r){for(let i in t){let n=t[i];(!r||r.test(i))&&(typeof n=="string"?delete t[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[i]))}}_addSchema(t,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;i=(0,jm.normalizeId)(s||i);let l=jm.getSchemaRefs.call(this,t,i);return c=new Nm.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:i,localRefs:l}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Nm.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Nm.compileSchema.call(this,t)}finally{this.opts=r}}};zm.ValidationError=lae.default;zm.MissingRefError=_F.default;Ar.default=zm;function bF(e,t,r,i="error"){for(let n in e){let o=n;o in t&&this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function wF(e){return e=(0,jm.normalizeId)(e),this.schemas[e]||this.refs[e]}function vae(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $ae(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function bae(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function wae(){let e={...this.opts};for(let t of fae)delete e[t];return e}var _ae={log(){},warn(){},error(){}};function kae(e){if(e===!1)return _ae;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Sae=/^[a-z_$][a-z0-9_$:-]*$/i;function xae(e,t){let{RULES:r}=this;if((0,SC.eachItem)(e,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!Sae.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function kC(e,t,r){var i;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,dw.getJSONTypes)(t.type),schemaType:(0,dw.getJSONTypes)(t.schemaType)}};t.before?Iae.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,(i=t.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function Iae(e,t,r){let i=e.rules.findIndex(n=>n.keyword===r);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Tae(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=SF(t)),e.validateSchema=this.compile(t,!0))}var Pae={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function SF(e){return{anyOf:[e,Pae]}}});var IF=I(xC=>{"use strict";Object.defineProperty(xC,"__esModule",{value:!0});var Rae={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};xC.default=Rae});var CF=I(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.callRef=oc.getValidate=void 0;var Cae=Om(),TF=ei(),wn=Ee(),Ru=Ao(),PF=uw(),pw=tt(),Aae={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:c}=i,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=PF.resolveRef.call(c,l,n,r);if(u===void 0)throw new Cae.default(i.opts.uriResolver,n,r);if(u instanceof PF.SchemaEnv)return p(u);return f(u);function d(){if(o===l)return fw(e,s,o,o.$async);let m=t.scopeValue("root",{ref:l});return fw(e,(0,wn._)`${m}.validate`,l,l.$async)}function p(m){let h=RF(e,m);fw(e,h,m,m.$async)}function f(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,wn.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:wn.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function RF(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,wn._)`${r.scopeValue("wrapper",{ref:t})}.validate`}oc.getValidate=RF;function fw(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:a,opts:c}=o,l=c.passContext?Ru.default.this:wn.nil;i?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,wn._)`await ${(0,TF.callValidateCode)(e,t,l)}`),f(t),s||n.assign(m,!0)},h=>{n.if((0,wn._)`!(${h} instanceof ${o.ValidationError})`,()=>n.throw(h)),p(h),s||n.assign(m,!1)}),e.ok(m)}function d(){e.result((0,TF.callValidateCode)(e,t,l),()=>f(t),()=>p(t))}function p(m){let h=(0,wn._)`${m}.errors`;n.assign(Ru.default.vErrors,(0,wn._)`${Ru.default.vErrors} === null ? ${h} : ${Ru.default.vErrors}.concat(${h})`),n.assign(Ru.default.errors,(0,wn._)`${Ru.default.vErrors}.length`)}function f(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=pw.mergeEvaluated.props(n,g.props,o.props));else{let y=n.var("props",(0,wn._)`${m}.evaluated.props`);o.props=pw.mergeEvaluated.props(n,y,o.props,wn.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=pw.mergeEvaluated.items(n,g.items,o.items));else{let y=n.var("items",(0,wn._)`${m}.evaluated.items`);o.items=pw.mergeEvaluated.items(n,y,o.items,wn.Name)}}}oc.callRef=fw;oc.default=Aae});var AF=I(IC=>{"use strict";Object.defineProperty(IC,"__esModule",{value:!0});var Eae=IF(),Oae=CF(),Nae=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Eae.default,Oae.default];IC.default=Nae});var EF=I(TC=>{"use strict";Object.defineProperty(TC,"__esModule",{value:!0});var mw=Ee(),Es=mw.operators,hw={maximum:{okStr:"<=",ok:Es.LTE,fail:Es.GT},minimum:{okStr:">=",ok:Es.GTE,fail:Es.LT},exclusiveMaximum:{okStr:"<",ok:Es.LT,fail:Es.GTE},exclusiveMinimum:{okStr:">",ok:Es.GT,fail:Es.LTE}},jae={message:({keyword:e,schemaCode:t})=>(0,mw.str)`must be ${hw[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mw._)`{comparison: ${hw[e].okStr}, limit: ${t}}`},zae={keyword:Object.keys(hw),type:"number",schemaType:"number",$data:!0,error:jae,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,mw._)`${r} ${hw[t].fail} ${i} || isNaN(${r})`)}};TC.default=zae});var OF=I(PC=>{"use strict";Object.defineProperty(PC,"__esModule",{value:!0});var Dm=Ee(),Dae={message:({schemaCode:e})=>(0,Dm.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Dm._)`{multipleOf: ${e}}`},Mae={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Dae,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),a=o?(0,Dm._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Dm._)`${s} !== parseInt(${s})`;e.fail$data((0,Dm._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};PC.default=Mae});var jF=I(RC=>{"use strict";Object.defineProperty(RC,"__esModule",{value:!0});function NF(e){let t=e.length,r=0,i=0,n;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),(n&64512)===56320&&i++);return r}RC.default=NF;NF.code='require("ajv/dist/runtime/ucs2length").default'});var zF=I(CC=>{"use strict";Object.defineProperty(CC,"__esModule",{value:!0});var sc=Ee(),Lae=tt(),Uae=jF(),qae={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,sc.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,sc._)`{limit: ${e}}`},Fae={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:qae,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?sc.operators.GT:sc.operators.LT,s=n.opts.unicode===!1?(0,sc._)`${r}.length`:(0,sc._)`${(0,Lae.useFunc)(e.gen,Uae.default)}(${r})`;e.fail$data((0,sc._)`${s} ${o} ${i}`)}};CC.default=Fae});var DF=I(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});var Zae=ei(),Vae=tt(),Cu=Ee(),Bae={message:({schemaCode:e})=>(0,Cu.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Cu._)`{pattern: ${e}}`},Kae={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Bae,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=s.opts.code,l=c.code==="new RegExp"?(0,Cu._)`new RegExp`:(0,Vae.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,Cu._)`${l}(${o}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,Cu._)`!${u}`)}else{let c=(0,Zae.usePattern)(e,n);e.fail$data((0,Cu._)`!${c}.test(${r})`)}}};AC.default=Kae});var MF=I(EC=>{"use strict";Object.defineProperty(EC,"__esModule",{value:!0});var Mm=Ee(),Wae={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Mm.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Mm._)`{limit: ${e}}`},Gae={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Wae,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?Mm.operators.GT:Mm.operators.LT;e.fail$data((0,Mm._)`Object.keys(${r}).length ${n} ${i}`)}};EC.default=Gae});var LF=I(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});var Lm=ei(),Um=Ee(),Hae=tt(),Jae={message:({params:{missingProperty:e}})=>(0,Um.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Um._)`{missingProperty: ${e}}`},Yae={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Jae,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?l():u(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,Hae.checkStrictMode)(s,y,s.opts.strictRequired)}}function l(){if(c||o)e.block$data(Um.nil,d);else for(let f of r)(0,Lm.checkReportMissingProp)(e,f)}function u(){let f=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>p(f,m)),e.ok(m)}else t.if((0,Lm.checkMissingProp)(e,r,f)),(0,Lm.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",i,f=>{e.setParams({missingProperty:f}),t.if((0,Lm.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function p(f,m){e.setParams({missingProperty:f}),t.forOf(f,i,()=>{t.assign(m,(0,Lm.propertyInData)(t,n,f,a.ownProperties)),t.if((0,Um.not)(m),()=>{e.error(),t.break()})},Um.nil)}}};OC.default=Yae});var UF=I(NC=>{"use strict";Object.defineProperty(NC,"__esModule",{value:!0});var qm=Ee(),Xae={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,qm.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,qm._)`{limit: ${e}}`},Qae={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Xae,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?qm.operators.GT:qm.operators.LT;e.fail$data((0,qm._)`${r}.length ${n} ${i}`)}};NC.default=Qae});var gw=I(jC=>{"use strict";Object.defineProperty(jC,"__esModule",{value:!0});var qF=Qf();qF.code='require("ajv/dist/runtime/equal").default';jC.default=qF});var FF=I(DC=>{"use strict";Object.defineProperty(DC,"__esModule",{value:!0});var zC=Pm(),Er=Ee(),ece=tt(),tce=gw(),rce={message:({params:{i:e,j:t}})=>(0,Er.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Er._)`{i: ${e}, j: ${t}}`},nce={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:rce,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=e;if(!i&&!n)return;let c=t.let("valid"),l=o.items?(0,zC.getSchemaTypes)(o.items):[];e.block$data(c,u,(0,Er._)`${s} === false`),e.ok(c);function u(){let m=t.let("i",(0,Er._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Er._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function p(m,h){let g=t.name("item"),y=(0,zC.checkDataTypes)(l,g,a.opts.strictNumbers,zC.DataType.Wrong),v=t.const("indices",(0,Er._)`{}`);t.for((0,Er._)`;${m}--;`,()=>{t.let(g,(0,Er._)`${r}[${m}]`),t.if(y,(0,Er._)`continue`),l.length>1&&t.if((0,Er._)`typeof ${g} == "string"`,(0,Er._)`${g} += "_"`),t.if((0,Er._)`typeof ${v}[${g}] == "number"`,()=>{t.assign(h,(0,Er._)`${v}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Er._)`${v}[${g}] = ${m}`)})}function f(m,h){let g=(0,ece.useFunc)(t,tce.default),y=t.name("outer");t.label(y).for((0,Er._)`;${m}--;`,()=>t.for((0,Er._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Er._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};DC.default=nce});var ZF=I(LC=>{"use strict";Object.defineProperty(LC,"__esModule",{value:!0});var MC=Ee(),ice=tt(),oce=gw(),sce={message:"must be equal to constant",params:({schemaCode:e})=>(0,MC._)`{allowedValue: ${e}}`},ace={keyword:"const",$data:!0,error:sce,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;i||o&&typeof o=="object"?e.fail$data((0,MC._)`!${(0,ice.useFunc)(t,oce.default)}(${r}, ${n})`):e.fail((0,MC._)`${o} !== ${r}`)}};LC.default=ace});var VF=I(UC=>{"use strict";Object.defineProperty(UC,"__esModule",{value:!0});var Fm=Ee(),cce=tt(),lce=gw(),uce={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Fm._)`{allowedValues: ${e}}`},dce={keyword:"enum",schemaType:"array",$data:!0,error:uce,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,l=()=>c??(c=(0,cce.useFunc)(t,lce.default)),u;if(a||i)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",o);u=(0,Fm.or)(...n.map((m,h)=>p(f,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,f=>t.if((0,Fm._)`${l()}(${r}, ${f})`,()=>t.assign(u,!0).break()))}function p(f,m){let h=n[m];return typeof h=="object"&&h!==null?(0,Fm._)`${l()}(${r}, ${f}[${m}])`:(0,Fm._)`${r} === ${h}`}}};UC.default=dce});var BF=I(qC=>{"use strict";Object.defineProperty(qC,"__esModule",{value:!0});var pce=EF(),fce=OF(),mce=zF(),hce=DF(),gce=MF(),yce=LF(),vce=UF(),$ce=FF(),bce=ZF(),wce=VF(),_ce=[pce.default,fce.default,mce.default,hce.default,gce.default,yce.default,vce.default,$ce.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},bce.default,wce.default];qC.default=_ce});var ZC=I(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});Zm.validateAdditionalItems=void 0;var ac=Ee(),FC=tt(),kce={message:({params:{len:e}})=>(0,ac.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ac._)`{limit: ${e}}`},Sce={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:kce,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,FC.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}KF(e,i)}};function KF(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let a=r.const("len",(0,ac._)`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass((0,ac._)`${a} <= ${t.length}`);else if(typeof i=="object"&&!(0,FC.alwaysValidSchema)(s,i)){let l=r.var("valid",(0,ac._)`${a} <= ${t.length}`);r.if((0,ac.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:FC.Type.Num},l),s.allErrors||r.if((0,ac.not)(l),()=>r.break())})}}Zm.validateAdditionalItems=KF;Zm.default=Sce});var VC=I(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});Vm.validateTuple=void 0;var WF=Ee(),yw=tt(),xce=ei(),Ice={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return GF(e,"additionalItems",t);r.items=!0,!(0,yw.alwaysValidSchema)(r,t)&&e.ok((0,xce.validateArray)(e))}};function GF(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=e;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=yw.mergeEvaluated.items(i,r.length,a.items));let c=i.name("valid"),l=i.const("len",(0,WF._)`${o}.length`);r.forEach((d,p)=>{(0,yw.alwaysValidSchema)(a,d)||(i.if((0,WF._)`${l} > ${p}`,()=>e.subschema({keyword:s,schemaProp:p,dataProp:p},c)),e.ok(c))});function u(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,yw.checkStrictMode)(a,g,p.strictTuples)}}}Vm.validateTuple=GF;Vm.default=Ice});var HF=I(BC=>{"use strict";Object.defineProperty(BC,"__esModule",{value:!0});var Tce=VC(),Pce={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Tce.validateTuple)(e,"items")};BC.default=Pce});var YF=I(KC=>{"use strict";Object.defineProperty(KC,"__esModule",{value:!0});var JF=Ee(),Rce=tt(),Cce=ei(),Ace=ZC(),Ece={message:({params:{len:e}})=>(0,JF.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,JF._)`{limit: ${e}}`},Oce={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ece,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;i.items=!0,!(0,Rce.alwaysValidSchema)(i,t)&&(n?(0,Ace.validateAdditionalItems)(e,n):e.ok((0,Cce.validateArray)(e)))}};KC.default=Oce});var XF=I(WC=>{"use strict";Object.defineProperty(WC,"__esModule",{value:!0});var ri=Ee(),vw=tt(),Nce={message:({params:{min:e,max:t}})=>t===void 0?(0,ri.str)`must contain at least ${e} valid item(s)`:(0,ri.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ri._)`{minContains: ${e}}`:(0,ri._)`{minContains: ${e}, maxContains: ${t}}`},jce={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Nce,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,a,{minContains:c,maxContains:l}=i;o.opts.next?(s=c===void 0?1:c,a=l):s=1;let u=t.const("len",(0,ri._)`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,vw.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,vw.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,vw.alwaysValidSchema)(o,r)){let h=(0,ri._)`${u} >= ${s}`;a!==void 0&&(h=(0,ri._)`${h} && ${u} <= ${a}`),e.pass(h);return}o.items=!0;let d=t.name("valid");a===void 0&&s===1?f(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,ri._)`${n}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),g=t.let("count",0);f(h,()=>t.if(h,()=>m(g)))}function f(h,g){t.forRange("i",0,u,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:vw.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,ri._)`${h}++`),a===void 0?t.if((0,ri._)`${h} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,ri._)`${h} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,ri._)`${h} >= ${s}`,()=>t.assign(d,!0)))}}};WC.default=jce});var tZ=I(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.validateSchemaDeps=Yi.validatePropertyDeps=Yi.error=void 0;var GC=Ee(),zce=tt(),Bm=ei();Yi.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return(0,GC.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,GC._)`{property: ${e},
14
+ missingProperty: ${i},
15
+ depsCount: ${t},
16
+ deps: ${r}}`};var Dce={keyword:"dependencies",type:"object",schemaType:"object",error:Yi.error,code(e){let[t,r]=Mce(e);QF(e,t),eZ(e,r)}};function Mce({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function QF(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Bm.propertyInData)(r,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,Bm.checkReportMissingProp)(e,l)}):(r.if((0,GC._)`${c} && (${(0,Bm.checkMissingProp)(e,a,o)})`),(0,Bm.reportMissingProp)(e,o),r.else())}}Yi.validatePropertyDeps=QF;function eZ(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let a in t)(0,zce.alwaysValidSchema)(o,t[a])||(r.if((0,Bm.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}Yi.validateSchemaDeps=eZ;Yi.default=Dce});var nZ=I(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0});var rZ=Ee(),Lce=tt(),Uce={message:"property name must be valid",params:({params:e})=>(0,rZ._)`{propertyName: ${e.propertyName}}`},qce={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uce,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,Lce.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,rZ.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}};HC.default=qce});var YC=I(JC=>{"use strict";Object.defineProperty(JC,"__esModule",{value:!0});var $w=ei(),bi=Ee(),Fce=Ao(),bw=tt(),Zce={message:"must NOT have additional properties",params:({params:e})=>(0,bi._)`{additionalProperty: ${e.additionalProperty}}`},Vce={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Zce,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,bw.alwaysValidSchema)(s,r))return;let l=(0,$w.allSchemaProperties)(i.properties),u=(0,$w.allSchemaProperties)(i.patternProperties);d(),e.ok((0,bi._)`${o} === ${Fce.default.errors}`);function d(){t.forIn("key",n,g=>{!l.length&&!u.length?m(g):t.if(p(g),()=>m(g))})}function p(g){let y;if(l.length>8){let v=(0,bw.schemaRefOrVal)(s,i.properties,"properties");y=(0,$w.isOwnProperty)(t,v,g)}else l.length?y=(0,bi.or)(...l.map(v=>(0,bi._)`${g} === ${v}`)):y=bi.nil;return u.length&&(y=(0,bi.or)(y,...u.map(v=>(0,bi._)`${(0,$w.usePattern)(e,v)}.test(${g})`))),(0,bi.not)(y)}function f(g){t.code((0,bi._)`delete ${n}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,bw.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,bi.not)(y),()=>{e.reset(),f(g)})):(h(g,y),a||t.if((0,bi.not)(y),()=>t.break()))}}function h(g,y,v){let b={keyword:"additionalProperties",dataProp:g,dataPropType:bw.Type.Str};v===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};JC.default=Vce});var sZ=I(QC=>{"use strict";Object.defineProperty(QC,"__esModule",{value:!0});var Bce=Em(),iZ=ei(),XC=tt(),oZ=YC(),Kce={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&oZ.default.code(new Bce.KeywordCxt(o,oZ.default,"additionalProperties"));let s=(0,iZ.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=XC.mergeEvaluated.props(t,(0,XC.toHash)(s),o.props));let a=s.filter(d=>!(0,XC.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,iZ.propertyInData)(t,n,d,o.opts.ownProperties)),u(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};QC.default=Kce});var uZ=I(eA=>{"use strict";Object.defineProperty(eA,"__esModule",{value:!0});var aZ=ei(),ww=Ee(),cZ=tt(),lZ=tt(),Wce={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,a=(0,aZ.allSchemaProperties)(r),c=a.filter(h=>(0,cZ.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&n.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof ww.Name)&&(o.props=(0,lZ.evaluatedPropsToName)(t,o.props));let{props:d}=o;p();function p(){for(let h of a)l&&f(h),o.allErrors?m(h):(t.var(u,!0),m(h),t.if(u))}function f(h){for(let g in l)new RegExp(h).test(g)&&(0,cZ.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,ww._)`${(0,aZ.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:lZ.Type.Str},u),o.opts.unevaluated&&d!==!0?t.assign((0,ww._)`${d}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,ww.not)(u),()=>t.break())})})}}};eA.default=Wce});var dZ=I(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});var Gce=tt(),Hce={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Gce.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};tA.default=Hce});var pZ=I(rA=>{"use strict";Object.defineProperty(rA,"__esModule",{value:!0});var Jce=ei(),Yce={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Jce.validateUnion,error:{message:"must match a schema in anyOf"}};rA.default=Yce});var fZ=I(nA=>{"use strict";Object.defineProperty(nA,"__esModule",{value:!0});var _w=Ee(),Xce=tt(),Qce={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,_w._)`{passingSchemas: ${e.passing}}`},ele={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Qce,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(s,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;(0,Xce.alwaysValidSchema)(n,u)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,_w._)`${c} && ${s}`).assign(s,!1).assign(a,(0,_w._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),p&&e.mergeEvaluated(p,_w.Name)})})}}};nA.default=ele});var mZ=I(iA=>{"use strict";Object.defineProperty(iA,"__esModule",{value:!0});var tle=tt(),rle={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,tle.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};iA.default=rle});var yZ=I(oA=>{"use strict";Object.defineProperty(oA,"__esModule",{value:!0});var kw=Ee(),gZ=tt(),nle={message:({params:e})=>(0,kw.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,kw._)`{failingKeyword: ${e.ifClause}}`},ile={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:nle,code(e){let{gen:t,parentSchema:r,it:i}=e;r.then===void 0&&r.else===void 0&&(0,gZ.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=hZ(i,"then"),o=hZ(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else n?t.if(a,l("then")):t.if((0,kw.not)(a),l("else"));e.pass(s,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);t.assign(s,a),e.mergeValidEvaluated(p,s),d?t.assign(d,(0,kw._)`${u}`):e.setParams({ifClause:u})}}}};function hZ(e,t){let r=e.schema[t];return r!==void 0&&!(0,gZ.alwaysValidSchema)(e,r)}oA.default=ile});var vZ=I(sA=>{"use strict";Object.defineProperty(sA,"__esModule",{value:!0});var ole=tt(),sle={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,ole.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};sA.default=sle});var $Z=I(aA=>{"use strict";Object.defineProperty(aA,"__esModule",{value:!0});var ale=ZC(),cle=HF(),lle=VC(),ule=YF(),dle=XF(),ple=tZ(),fle=nZ(),mle=YC(),hle=sZ(),gle=uZ(),yle=dZ(),vle=pZ(),$le=fZ(),ble=mZ(),wle=yZ(),_le=vZ();function kle(e=!1){let t=[yle.default,vle.default,$le.default,ble.default,wle.default,_le.default,fle.default,mle.default,ple.default,hle.default,gle.default];return e?t.push(cle.default,ule.default):t.push(ale.default,lle.default),t.push(dle.default),t}aA.default=kle});var bZ=I(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});var rr=Ee(),Sle={message:({schemaCode:e})=>(0,rr.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,rr._)`{format: ${e}}`},xle={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Sle,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,rr._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,rr._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,rr._)`${h}.type || "string"`).assign(y,(0,rr._)`${h}.validate`),()=>r.assign(g,(0,rr._)`"string"`).assign(y,h)),e.fail$data((0,rr.or)(v(),b()));function v(){return c.strictSchema===!1?rr.nil:(0,rr._)`${s} && !${y}`}function b(){let _=u.$async?(0,rr._)`(${h}.async ? await ${y}(${i}) : ${y}(${i}))`:(0,rr._)`${y}(${i})`,k=(0,rr._)`(typeof ${y} == "function" ? ${_} : ${y}.test(${i}))`;return(0,rr._)`${y} && ${y} !== true && ${g} === ${t} && !${k}`}}function f(){let m=d.formats[o];if(!m){v();return}if(m===!0)return;let[h,g,y]=b(m);h===t&&e.pass(_());function v(){if(c.strictSchema===!1){d.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function b(k){let x=k instanceof RegExp?(0,rr.regexpCode)(k):c.code.formats?(0,rr._)`${c.code.formats}${(0,rr.getProperty)(o)}`:void 0,S=r.scopeValue("formats",{key:o,ref:k,code:x});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,rr._)`${S}.validate`]:["string",k,S]}function _(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,rr._)`await ${y}(${i})`}return typeof g=="function"?(0,rr._)`${y}(${i})`:(0,rr._)`${y}.test(${i})`}}}};cA.default=xle});var wZ=I(lA=>{"use strict";Object.defineProperty(lA,"__esModule",{value:!0});var Ile=bZ(),Tle=[Ile.default];lA.default=Tle});var _Z=I(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.contentVocabulary=Au.metadataVocabulary=void 0;Au.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Au.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var SZ=I(uA=>{"use strict";Object.defineProperty(uA,"__esModule",{value:!0});var Ple=AF(),Rle=BF(),Cle=$Z(),Ale=wZ(),kZ=_Z(),Ele=[Ple.default,Rle.default,(0,Cle.default)(),Ale.default,kZ.metadataVocabulary,kZ.contentVocabulary];uA.default=Ele});var IZ=I(Sw=>{"use strict";Object.defineProperty(Sw,"__esModule",{value:!0});Sw.DiscrError=void 0;var xZ;(function(e){e.Tag="tag",e.Mapping="mapping"})(xZ||(Sw.DiscrError=xZ={}))});var PZ=I(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});var Eu=Ee(),dA=IZ(),TZ=uw(),Ole=Om(),Nle=tt(),jle={message:({params:{discrError:e,tagName:t}})=>e===dA.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Eu._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},zle={keyword:"discriminator",type:"object",schemaType:"object",error:jle,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,Eu._)`${r}${(0,Eu.getProperty)(a)}`);t.if((0,Eu._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:dA.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let f=p();t.if(!1);for(let m in f)t.elseIf((0,Eu._)`${l} === ${m}`),t.assign(c,d(f[m]));t.else(),e.error(!1,{discrError:dA.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(h,Eu.Name),m}function p(){var f;let m={},h=y(n),g=!0;for(let _=0;_<s.length;_++){let k=s[_];if(k?.$ref&&!(0,Nle.schemaHasRulesButRef)(k,o.self.RULES)){let S=k.$ref;if(k=TZ.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,S),k instanceof TZ.SchemaEnv&&(k=k.schema),k===void 0)throw new Ole.default(o.opts.uriResolver,o.baseId,S)}let x=(f=k?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(k)),v(x,_)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:_}){return Array.isArray(_)&&_.includes(a)}function v(_,k){if(_.const)b(_.const,k);else if(_.enum)for(let x of _.enum)b(x,k);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(_,k){if(typeof _!="string"||_ in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[_]=k}}}};pA.default=zle});var RZ=I((mOe,Dle)=>{Dle.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 AZ=I((Dt,fA)=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.MissingRefError=Dt.ValidationError=Dt.CodeGen=Dt.Name=Dt.nil=Dt.stringify=Dt.str=Dt._=Dt.KeywordCxt=Dt.Ajv=void 0;var Mle=xF(),Lle=SZ(),Ule=PZ(),CZ=RZ(),qle=["/properties"],xw="http://json-schema.org/draft-07/schema",Ou=class extends Mle.default{_addVocabularies(){super._addVocabularies(),Lle.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Ule.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(CZ,qle):CZ;this.addMetaSchema(t,xw,!1),this.refs["http://json-schema.org/schema"]=xw}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(xw)?xw:void 0)}};Dt.Ajv=Ou;fA.exports=Dt=Ou;fA.exports.Ajv=Ou;Object.defineProperty(Dt,"__esModule",{value:!0});Dt.default=Ou;var Fle=Em();Object.defineProperty(Dt,"KeywordCxt",{enumerable:!0,get:function(){return Fle.KeywordCxt}});var Nu=Ee();Object.defineProperty(Dt,"_",{enumerable:!0,get:function(){return Nu._}});Object.defineProperty(Dt,"str",{enumerable:!0,get:function(){return Nu.str}});Object.defineProperty(Dt,"stringify",{enumerable:!0,get:function(){return Nu.stringify}});Object.defineProperty(Dt,"nil",{enumerable:!0,get:function(){return Nu.nil}});Object.defineProperty(Dt,"Name",{enumerable:!0,get:function(){return Nu.Name}});Object.defineProperty(Dt,"CodeGen",{enumerable:!0,get:function(){return Nu.CodeGen}});var Zle=cw();Object.defineProperty(Dt,"ValidationError",{enumerable:!0,get:function(){return Zle.default}});var Vle=Om();Object.defineProperty(Dt,"MissingRefError",{enumerable:!0,get:function(){return Vle.default}})});var EZ=I(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.formatLimitDefinition=void 0;var Ble=AZ(),wi=Ee(),Os=wi.operators,Iw={formatMaximum:{okStr:"<=",ok:Os.LTE,fail:Os.GT},formatMinimum:{okStr:">=",ok:Os.GTE,fail:Os.LT},formatExclusiveMaximum:{okStr:"<",ok:Os.LT,fail:Os.GTE},formatExclusiveMinimum:{okStr:">",ok:Os.GT,fail:Os.LTE}},Kle={message:({keyword:e,schemaCode:t})=>(0,wi.str)`should be ${Iw[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,wi._)`{comparison: ${Iw[e].okStr}, limit: ${t}}`};ju.formatLimitDefinition={keyword:Object.keys(Iw),type:"string",schemaType:"string",$data:!0,error:Kle,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new Ble.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let p=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),f=t.const("fmt",(0,wi._)`${p}[${c.schemaCode}]`);e.fail$data((0,wi.or)((0,wi._)`typeof ${f} != "object"`,(0,wi._)`${f} instanceof RegExp`,(0,wi._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:f,code:s.code.formats?(0,wi._)`${s.code.formats}${(0,wi.getProperty)(p)}`:void 0});e.fail$data(d(m))}function d(p){return(0,wi._)`${p}.compare(${r}, ${i}) ${Iw[n].fail} 0`}},dependencies:["format"]};var Wle=e=>(e.addKeyword(ju.formatLimitDefinition),e);ju.default=Wle});var zZ=I((Km,jZ)=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var zu=y4(),Gle=EZ(),mA=Ee(),OZ=new mA.Name("fullFormats"),Hle=new mA.Name("fastFormats"),hA=(e,t={keywords:!0})=>{if(Array.isArray(t))return NZ(e,t,zu.fullFormats,OZ),e;let[r,i]=t.mode==="fast"?[zu.fastFormats,Hle]:[zu.fullFormats,OZ],n=t.formats||zu.formatNames;return NZ(e,n,r,i),t.keywords&&(0,Gle.default)(e),e};hA.get=(e,t="full")=>{let i=(t==="fast"?zu.fastFormats:zu.fullFormats)[e];if(!i)throw new Error(`Unknown format "${e}"`);return i};function NZ(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=(0,mA._)`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}jZ.exports=Km=hA;Object.defineProperty(Km,"__esModule",{value:!0});Km.default=hA});var nt=I(Or=>{"use strict";var bA=Symbol.for("yaml.alias"),e6=Symbol.for("yaml.document"),Ew=Symbol.for("yaml.map"),t6=Symbol.for("yaml.pair"),wA=Symbol.for("yaml.scalar"),Ow=Symbol.for("yaml.seq"),Oo=Symbol.for("yaml.node.type"),sue=e=>!!e&&typeof e=="object"&&e[Oo]===bA,aue=e=>!!e&&typeof e=="object"&&e[Oo]===e6,cue=e=>!!e&&typeof e=="object"&&e[Oo]===Ew,lue=e=>!!e&&typeof e=="object"&&e[Oo]===t6,r6=e=>!!e&&typeof e=="object"&&e[Oo]===wA,uue=e=>!!e&&typeof e=="object"&&e[Oo]===Ow;function n6(e){if(e&&typeof e=="object")switch(e[Oo]){case Ew:case Ow:return!0}return!1}function due(e){if(e&&typeof e=="object")switch(e[Oo]){case bA:case Ew:case wA:case Ow:return!0}return!1}var pue=e=>(r6(e)||n6(e))&&!!e.anchor;Or.ALIAS=bA;Or.DOC=e6;Or.MAP=Ew;Or.NODE_TYPE=Oo;Or.PAIR=t6;Or.SCALAR=wA;Or.SEQ=Ow;Or.hasAnchor=pue;Or.isAlias=sue;Or.isCollection=n6;Or.isDocument=aue;Or.isMap=cue;Or.isNode=due;Or.isPair=lue;Or.isScalar=r6;Or.isSeq=uue});var Gm=I(_A=>{"use strict";var fr=nt(),_n=Symbol("break visit"),i6=Symbol("skip children"),Qi=Symbol("remove node");function Nw(e,t){let r=o6(t);fr.isDocument(e)?Du(null,e.contents,r,Object.freeze([e]))===Qi&&(e.contents=null):Du(null,e,r,Object.freeze([]))}Nw.BREAK=_n;Nw.SKIP=i6;Nw.REMOVE=Qi;function Du(e,t,r,i){let n=s6(e,t,r,i);if(fr.isNode(n)||fr.isPair(n))return a6(e,i,n),Du(e,n,r,i);if(typeof n!="symbol"){if(fr.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=Du(o,t.items[o],r,i);if(typeof s=="number")o=s-1;else{if(s===_n)return _n;s===Qi&&(t.items.splice(o,1),o-=1)}}}else if(fr.isPair(t)){i=Object.freeze(i.concat(t));let o=Du("key",t.key,r,i);if(o===_n)return _n;o===Qi&&(t.key=null);let s=Du("value",t.value,r,i);if(s===_n)return _n;s===Qi&&(t.value=null)}}return n}async function jw(e,t){let r=o6(t);fr.isDocument(e)?await Mu(null,e.contents,r,Object.freeze([e]))===Qi&&(e.contents=null):await Mu(null,e,r,Object.freeze([]))}jw.BREAK=_n;jw.SKIP=i6;jw.REMOVE=Qi;async function Mu(e,t,r,i){let n=await s6(e,t,r,i);if(fr.isNode(n)||fr.isPair(n))return a6(e,i,n),Mu(e,n,r,i);if(typeof n!="symbol"){if(fr.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await Mu(o,t.items[o],r,i);if(typeof s=="number")o=s-1;else{if(s===_n)return _n;s===Qi&&(t.items.splice(o,1),o-=1)}}}else if(fr.isPair(t)){i=Object.freeze(i.concat(t));let o=await Mu("key",t.key,r,i);if(o===_n)return _n;o===Qi&&(t.key=null);let s=await Mu("value",t.value,r,i);if(s===_n)return _n;s===Qi&&(t.value=null)}}return n}function o6(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function s6(e,t,r,i){if(typeof r=="function")return r(e,t,i);if(fr.isMap(t))return r.Map?.(e,t,i);if(fr.isSeq(t))return r.Seq?.(e,t,i);if(fr.isPair(t))return r.Pair?.(e,t,i);if(fr.isScalar(t))return r.Scalar?.(e,t,i);if(fr.isAlias(t))return r.Alias?.(e,t,i)}function a6(e,t,r){let i=t[t.length-1];if(fr.isCollection(i))i.items[e]=r;else if(fr.isPair(i))e==="key"?i.key=r:i.value=r;else if(fr.isDocument(i))i.contents=r;else{let n=fr.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}_A.visit=Nw;_A.visitAsync=jw});var kA=I(l6=>{"use strict";var c6=nt(),fue=Gm(),mue={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hue=e=>e.replace(/[!,[\]{}]/g,t=>mue[t]),Hm=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(n)}catch(s){return r(String(s)),null}return i==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,i]of Object.entries(this.tags))if(t.startsWith(i))return r+hue(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&c6.isNode(t.contents)){let o={};fue.visit(t.contents,(s,a)=>{c6.isNode(a)&&a.tag&&(o[a.tag]=!0)}),n=Object.keys(o)}else n=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
17
+ `)}};Hm.defaultYaml={explicit:!1,version:"1.2"};Hm.defaultTags={"!!":"tag:yaml.org,2002:"};l6.Directives=Hm});var zw=I(Jm=>{"use strict";var u6=nt(),gue=Gm();function yue(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function d6(e){let t=new Set;return gue.visit(e,{Value(r,i){i.anchor&&t.add(i.anchor)}}),t}function p6(e,t){for(let r=1;;++r){let i=`${e}${r}`;if(!t.has(i))return i}}function vue(e,t){let r=[],i=new Map,n=null;return{onAnchor:o=>{r.push(o),n??(n=d6(e));let s=p6(t,n);return n.add(s),s},setAnchors:()=>{for(let o of r){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(u6.isScalar(s.node)||u6.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:i}}Jm.anchorIsValid=yue;Jm.anchorNames=d6;Jm.createNodeAnchors=vue;Jm.findNewAnchor=p6});var SA=I(f6=>{"use strict";function Ym(e,t,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,o=i.length;n<o;++n){let s=i[n],a=Ym(e,i,String(n),s);a===void 0?delete i[n]:a!==s&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let o=i.get(n),s=Ym(e,i,n,o);s===void 0?i.delete(n):s!==o&&i.set(n,s)}else if(i instanceof Set)for(let n of Array.from(i)){let o=Ym(e,i,n,n);o===void 0?i.delete(n):o!==n&&(i.delete(n),i.add(o))}else for(let[n,o]of Object.entries(i)){let s=Ym(e,i,n,o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}return e.call(t,r,i)}f6.applyReviver=Ym});var js=I(h6=>{"use strict";var $ue=nt();function m6(e,t,r){if(Array.isArray(e))return e.map((i,n)=>m6(i,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!$ue.hasAnchor(e))return e.toJSON(t,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=o=>{i.res=o,delete r.onCreate};let n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}h6.toJS=m6});var Dw=I(y6=>{"use strict";var bue=SA(),g6=nt(),wue=js(),xA=class{constructor(t){Object.defineProperty(this,g6.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:o}={}){if(!g6.isDocument(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=wue.toJS(this,"",s);if(typeof n=="function")for(let{count:c,res:l}of s.anchors.values())n(l,c);return typeof o=="function"?bue.applyReviver(o,{"":a},"",a):a}};y6.NodeBase=xA});var Xm=I(v6=>{"use strict";var _ue=zw(),kue=Gm(),Lu=nt(),Sue=Dw(),xue=js(),IA=class extends Sue.NodeBase{constructor(t){super(Lu.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],kue.visit(t,{Node:(o,s)=>{(Lu.isAlias(s)||Lu.hasAnchor(s))&&i.push(s)}}),r&&(r.aliasResolveCache=i));let n;for(let o of i){if(o===this)break;o.anchor===this.source&&(n=o)}if(n&&r){let{anchors:o,doc:s,maxAliasCount:a}=r,c=o.get(n);if(c||(xue.toJS(n,null,r),c=o.get(n)),c?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=Mw(s,n,o)),c.count*c.aliasCount>a)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}}return n}toJSON(t,r){if(!r)return{source:this.source};let i=this.resolve(r.doc,r);if(!i){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(n)}return r.anchors.get(i).res}toString(t,r,i){let n=`*${this.source}`;if(t){if(_ue.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${n} `}return n}};function Mw(e,t,r){if(Lu.isAlias(t)){let i=t.resolve(e),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(Lu.isCollection(t)){let i=0;for(let n of t.items){let o=Mw(e,n,r);o>i&&(i=o)}return i}else if(Lu.isPair(t)){let i=Mw(e,t.key,r),n=Mw(e,t.value,r);return Math.max(i,n)}return 1}v6.Alias=IA});var or=I(TA=>{"use strict";var Iue=nt(),Tue=Dw(),Pue=js(),Rue=e=>!e||typeof e!="function"&&typeof e!="object",zs=class extends Tue.NodeBase{constructor(t){super(Iue.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:Pue.toJS(this.value,t,r)}toString(){return String(this.value)}};zs.BLOCK_FOLDED="BLOCK_FOLDED";zs.BLOCK_LITERAL="BLOCK_LITERAL";zs.PLAIN="PLAIN";zs.QUOTE_DOUBLE="QUOTE_DOUBLE";zs.QUOTE_SINGLE="QUOTE_SINGLE";TA.Scalar=zs;TA.isScalarValue=Rue});var Qm=I(b6=>{"use strict";var Cue=Xm(),cc=nt(),$6=or(),Aue="tag:yaml.org,2002:";function Eue(e,t,r){if(t){let i=r.filter(o=>o.tag===t),n=i.find(o=>!o.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(i=>i.identify?.(e)&&!i.format)}function Oue(e,t,r){if(cc.isDocument(e)&&(e=e.contents),cc.isNode(e))return e;if(cc.isPair(e)){let d=r.schema[cc.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(i&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=n(e)),new Cue.Alias(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=Aue+t.slice(2));let l=Eue(e,t,s.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new $6.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?s[cc.MAP]:Symbol.iterator in Object(e)?s[cc.SEQ]:s[cc.MAP]}o&&(o(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new $6.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}b6.createNode=Oue});var Uw=I(Lw=>{"use strict";var Nue=Qm(),eo=nt(),jue=Dw();function PA(e,t,r){let i=r;for(let n=t.length-1;n>=0;--n){let o=t[n];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return Nue.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var w6=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,RA=class extends jue.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(i=>eo.isNode(i)||eo.isPair(i)?i.clone(t):i),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(w6(t))this.add(r);else{let[i,...n]=t,o=this.get(i,!0);if(eo.isCollection(o))o.addIn(n,r);else if(o===void 0&&this.schema)this.set(i,PA(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[r,...i]=t;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(eo.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(t,r){let[i,...n]=t,o=this.get(i,!0);return n.length===0?!r&&eo.isScalar(o)?o.value:o:eo.isCollection(o)?o.getIn(n,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!eo.isPair(r))return!1;let i=r.value;return i==null||t&&eo.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[r,...i]=t;if(i.length===0)return this.has(r);let n=this.get(r,!0);return eo.isCollection(n)?n.hasIn(i):!1}setIn(t,r){let[i,...n]=t;if(n.length===0)this.set(i,r);else{let o=this.get(i,!0);if(eo.isCollection(o))o.setIn(n,r);else if(o===void 0&&this.schema)this.set(i,PA(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Lw.Collection=RA;Lw.collectionFromPath=PA;Lw.isEmptyPath=w6});var eh=I(qw=>{"use strict";var zue=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function CA(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Due=(e,t,r)=>e.endsWith(`
18
+ `)?CA(r,t):r.includes(`
19
+ `)?`
20
+ `+CA(r,t):(e.endsWith(" ")?"":" ")+r;qw.indentComment=CA;qw.lineComment=Due;qw.stringifyComment=zue});var k6=I(th=>{"use strict";var Mue="flow",AA="block",Fw="quoted";function Lue(e,t,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!n||n<0)return e;n<o&&(o=0);let c=Math.max(1+o,1+n-t.length);if(e.length<=c)return e;let l=[],u={},d=n-t.length;typeof i=="number"&&(i>n-Math.max(2,o)?l.push(0):d=n-i);let p,f,m=!1,h=-1,g=-1,y=-1;r===AA&&(h=_6(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(r===Fw&&b==="\\"){switch(g=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(b===`
21
+ `)r===AA&&(h=_6(e,h,t.length)),d=h+t.length+c,p=void 0;else{if(b===" "&&f&&f!==" "&&f!==`
22
+ `&&f!==" "){let _=e[h+1];_&&_!==" "&&_!==`
23
+ `&&_!==" "&&(p=h)}if(h>=d)if(p)l.push(p),d=p+c,p=void 0;else if(r===Fw){for(;f===" "||f===" ";)f=b,b=e[h+=1],m=!0;let _=h>y+1?h-2:g-1;if(u[_])return e;l.push(_),u[_]=!0,d=_+c,p=void 0}else m=!0}f=b}if(m&&a&&a(),l.length===0)return e;s&&s();let v=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let _=l[b],k=l[b+1]||e.length;_===0?v=`
24
+ ${t}${e.slice(0,k)}`:(r===Fw&&u[_]&&(v+=`${e[_]}\\`),v+=`
25
+ ${t}${e.slice(_+1,k)}`)}return v}function _6(e,t,r){let i=t,n=t+1,o=e[n];for(;o===" "||o===" ";)if(t<n+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
26
+ `);i=t,n=t+1,o=e[n]}return i}th.FOLD_BLOCK=AA;th.FOLD_FLOW=Mue;th.FOLD_QUOTED=Fw;th.foldFlowLines=Lue});var nh=I(S6=>{"use strict";var _i=or(),Ds=k6(),Vw=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Bw=e=>/^(%|---|\.\.\.)/m.test(e);function Uue(e,t,r){if(!t||t<0)return!1;let i=t-r,n=e.length;if(n<=i)return!1;for(let o=0,s=0;o<n;++o)if(e[o]===`
27
+ `){if(o-s>i)return!0;if(s=o+1,n-s<=i)return!1}return!0}function rh(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(Bw(e)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(s+=r.slice(a,c)+`
28
+
29
+ `;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)s+=`
30
+ `,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,i?s:Ds.foldFlowLines(s,o,Ds.FOLD_QUOTED,Vw(t,!1))}function EA(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
31
+ `)||/[ \t]\n|\n[ \t]/.test(e))return rh(e,t);let r=t.indent||(Bw(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
32
+ ${r}`)+"'";return t.implicitKey?i:Ds.foldFlowLines(i,r,Ds.FOLD_FLOW,Vw(t,!1))}function Uu(e,t){let{singleQuote:r}=t.options,i;if(r===!1)i=rh;else{let n=e.includes('"'),o=e.includes("'");n&&!o?i=EA:o&&!n?i=rh:i=r?EA:rh}return i(e,t)}var OA;try{OA=new RegExp(`(^|(?<!
33
+ ))
34
+ +(?!
35
+ |$)`,"g")}catch{OA=/\n+(?!\n|$)/g}function Zw({comment:e,type:t,value:r},i,n,o){let{blockQuote:s,commentString:a,lineWidth:c}=i.options;if(!s||/\n[\t ]+$/.test(r))return Uu(r,i);let l=i.indent||(i.forceBlockIndent||Bw(r)?" ":""),u=s==="literal"?!0:s==="folded"||t===_i.Scalar.BLOCK_FOLDED?!1:t===_i.Scalar.BLOCK_LITERAL?!0:!Uue(r,c,l.length);if(!r)return u?`|
36
+ `:`>
37
+ `;let d,p;for(p=r.length;p>0;--p){let k=r[p-1];if(k!==`
38
+ `&&k!==" "&&k!==" ")break}let f=r.substring(p),m=f.indexOf(`
39
+ `);m===-1?d="-":r===f||m!==f.length-1?(d="+",o&&o()):d="",f&&(r=r.slice(0,-f.length),f[f.length-1]===`
40
+ `&&(f=f.slice(0,-1)),f=f.replace(OA,`$&${l}`));let h=!1,g,y=-1;for(g=0;g<r.length;++g){let k=r[g];if(k===" ")h=!0;else if(k===`
41
+ `)y=g;else break}let v=r.substring(0,y<g?y+1:g);v&&(r=r.substring(v.length),v=v.replace(/\n+/g,`$&${l}`));let _=(h?l?"2":"1":"")+d;if(e&&(_+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!u){let k=r.replace(/\n+/g,`
42
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),x=!1,S=Vw(i,!0);s!=="folded"&&t!==_i.Scalar.BLOCK_FOLDED&&(S.onOverflow=()=>{x=!0});let C=Ds.foldFlowLines(`${v}${k}${f}`,l,Ds.FOLD_BLOCK,S);if(!x)return`>${_}
43
+ ${l}${C}`}return r=r.replace(/\n+/g,`$&${l}`),`|${_}
44
+ ${l}${v}${r}${f}`}function que(e,t,r,i){let{type:n,value:o}=e,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&o.includes(`
45
+ `)||u&&/[[\]{},]/.test(o))return Uu(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
46
+ `)?Uu(o,t):Zw(e,t,r,i);if(!a&&!u&&n!==_i.Scalar.PLAIN&&o.includes(`
47
+ `))return Zw(e,t,r,i);if(Bw(o)){if(c==="")return t.forceBlockIndent=!0,Zw(e,t,r,i);if(a&&c===l)return Uu(o,t)}let d=o.replace(/\n+/g,`$&
48
+ ${c}`);if(s){let p=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:f,tags:m}=t.doc.schema;if(m.some(p)||f?.some(p))return Uu(o,t)}return a?d:Ds.foldFlowLines(d,c,Ds.FOLD_FLOW,Vw(t,!1))}function Fue(e,t,r,i){let{implicitKey:n,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==_i.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=_i.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case _i.Scalar.BLOCK_FOLDED:case _i.Scalar.BLOCK_LITERAL:return n||o?Uu(s.value,t):Zw(s,t,r,i);case _i.Scalar.QUOTE_DOUBLE:return rh(s.value,t);case _i.Scalar.QUOTE_SINGLE:return EA(s.value,t);case _i.Scalar.PLAIN:return que(s,t,r,i);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,p=n&&u||d;if(l=c(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}S6.stringifyString=Fue});var ih=I(NA=>{"use strict";var Zue=zw(),Ms=nt(),Vue=eh(),Bue=nh();function Kue(e,t){let r=Object.assign({blockQuote:!0,commentString:Vue.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},e.schema.toStringOptions,t),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function Wue(e,t){if(t.tag){let n=e.filter(o=>o.tag===t.tag);if(n.length>0)return n.find(o=>o.format===t.format)??n[0]}let r,i;if(Ms.isScalar(t)){i=t.value;let n=e.filter(o=>o.identify?.(i));if(n.length>1){let o=n.filter(s=>s.test);o.length>0&&(n=o)}r=n.find(o=>o.format===t.format)??n.find(o=>!o.format)}else i=t,r=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function Gue(e,t,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],o=(Ms.isScalar(e)||Ms.isCollection(e))&&e.anchor;o&&Zue.anchorIsValid(o)&&(r.add(o),n.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&n.push(i.directives.tagString(s)),n.join(" ")}function Hue(e,t,r,i){if(Ms.isPair(e))return e.toString(t,r,i);if(Ms.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,o=Ms.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=Wue(t.doc.schema.tags,o));let s=Gue(o,n,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof n.stringify=="function"?n.stringify(o,t,r,i):Ms.isScalar(o)?Bue.stringifyString(o,t,r,i):o.toString(t,r,i);return s?Ms.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
49
+ ${t.indent}${a}`:a}NA.createStringifyContext=Kue;NA.stringify=Hue});var P6=I(T6=>{"use strict";var No=nt(),x6=or(),I6=ih(),oh=eh();function Jue({key:e,value:t},r,i,n){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,p=No.isNode(e)&&e.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(No.isCollection(e)||!No.isNode(e)&&typeof e=="object"){let S="With simple keys, collection cannot be used as a key value";throw new Error(S)}}let f=!d&&(!e||p&&t==null&&!r.inFlow||No.isCollection(e)||(No.isScalar(e)?e.type===x6.Scalar.BLOCK_FOLDED||e.type===x6.Scalar.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!f&&(d||!o),indent:a+c});let m=!1,h=!1,g=I6.stringify(e,r,()=>m=!0,()=>h=!0);if(!f&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(r.inFlow){if(o||t==null)return m&&i&&i(),g===""?"?":f?`? ${g}`:g}else if(o&&!d||t==null&&f)return g=`? ${g}`,p&&!m?g+=oh.lineComment(g,r.indent,l(p)):h&&n&&n(),g;m&&(p=null),f?(p&&(g+=oh.lineComment(g,r.indent,l(p))),g=`? ${g}
50
+ ${a}:`):(g=`${g}:`,p&&(g+=oh.lineComment(g,r.indent,l(p))));let y,v,b;No.isNode(t)?(y=!!t.spaceBefore,v=t.commentBefore,b=t.comment):(y=!1,v=null,b=null,t&&typeof t=="object"&&(t=s.createNode(t))),r.implicitKey=!1,!f&&!p&&No.isScalar(t)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!f&&No.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let _=!1,k=I6.stringify(t,r,()=>_=!0,()=>h=!0),x=" ";if(p||y||v){if(x=y?`
51
+ `:"",v){let S=l(v);x+=`
52
+ ${oh.indentComment(S,r.indent)}`}k===""&&!r.inFlow?x===`
53
+ `&&b&&(x=`
54
+
55
+ `):x+=`
56
+ ${r.indent}`}else if(!f&&No.isCollection(t)){let S=k[0],C=k.indexOf(`
57
+ `),E=C!==-1,U=r.inFlow??t.flow??t.items.length===0;if(E||!U){let V=!1;if(E&&(S==="&"||S==="!")){let X=k.indexOf(" ");S==="&"&&X!==-1&&X<C&&k[X+1]==="!"&&(X=k.indexOf(" ",X+1)),(X===-1||C<X)&&(V=!0)}V||(x=`
58
+ ${r.indent}`)}}else(k===""||k[0]===`
59
+ `)&&(x="");return g+=x+k,r.inFlow?_&&i&&i():b&&!_?g+=oh.lineComment(g,r.indent,l(b)):h&&n&&n(),g}T6.stringifyPair=Jue});var zA=I(jA=>{"use strict";var R6=Sg("process");function Yue(e,...t){e==="debug"&&console.log(...t)}function Xue(e,t){(e==="debug"||e==="warn")&&(typeof R6.emitWarning=="function"?R6.emitWarning(t):console.warn(t))}jA.debug=Yue;jA.warn=Xue});var Jw=I(Hw=>{"use strict";var Gw=nt(),C6=or(),Kw="<<",Ww={identify:e=>e===Kw||typeof e=="symbol"&&e.description===Kw,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new C6.Scalar(Symbol(Kw)),{addToJSMap:A6}),stringify:()=>Kw},Que=(e,t)=>(Ww.identify(t)||Gw.isScalar(t)&&(!t.type||t.type===C6.Scalar.PLAIN)&&Ww.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===Ww.tag&&r.default);function A6(e,t,r){let i=E6(e,r);if(Gw.isSeq(i))for(let n of i.items)DA(e,t,n);else if(Array.isArray(i))for(let n of i)DA(e,t,n);else DA(e,t,i)}function DA(e,t,r){let i=E6(e,r);if(!Gw.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[o,s]of n)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function E6(e,t){return e&&Gw.isAlias(t)?t.resolve(e.doc,e):t}Hw.addMergeToJSMap=A6;Hw.isMergeKey=Que;Hw.merge=Ww});var LA=I(j6=>{"use strict";var ede=zA(),O6=Jw(),tde=ih(),N6=nt(),MA=js();function rde(e,t,{key:r,value:i}){if(N6.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,i);else if(O6.isMergeKey(e,r))O6.addMergeToJSMap(e,t,i);else{let n=MA.toJS(r,"",e);if(t instanceof Map)t.set(n,MA.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let o=nde(r,n,e),s=MA.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function nde(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(N6.isNode(e)&&r?.doc){let i=tde.createStringifyContext(r.doc,{});i.anchors=new Set;for(let o of r.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!r.mapKeyWarned){let o=JSON.stringify(n);o.length>40&&(o=o.substring(0,36)+'..."'),ede.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 n}return JSON.stringify(t)}j6.addPairToJSMap=rde});var Ls=I(UA=>{"use strict";var z6=Qm(),ide=P6(),ode=LA(),Yw=nt();function sde(e,t,r){let i=z6.createNode(e,void 0,r),n=z6.createNode(t,void 0,r);return new Xw(i,n)}var Xw=class e{constructor(t,r=null){Object.defineProperty(this,Yw.NODE_TYPE,{value:Yw.PAIR}),this.key=t,this.value=r}clone(t){let{key:r,value:i}=this;return Yw.isNode(r)&&(r=r.clone(t)),Yw.isNode(i)&&(i=i.clone(t)),new e(r,i)}toJSON(t,r){let i=r?.mapAsMap?new Map:{};return ode.addPairToJSMap(r,i,this)}toString(t,r,i){return t?.doc?ide.stringifyPair(this,t,r,i):JSON.stringify(this)}};UA.Pair=Xw;UA.createPair=sde});var qA=I(M6=>{"use strict";var lc=nt(),D6=ih(),Qw=eh();function ade(e,t,r){return(t.inFlow??e.flow?lde:cde)(e,t,r)}function cde({comment:e,items:t},r,{blockItemPrefix:i,flowChars:n,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,p=[];for(let m=0;m<t.length;++m){let h=t[m],g=null;if(lc.isNode(h))!d&&h.spaceBefore&&p.push(""),e_(r,p,h.commentBefore,d),h.comment&&(g=h.comment);else if(lc.isPair(h)){let v=lc.isNode(h.key)?h.key:null;v&&(!d&&v.spaceBefore&&p.push(""),e_(r,p,v.commentBefore,d))}d=!1;let y=D6.stringify(h,u,()=>g=null,()=>d=!0);g&&(y+=Qw.lineComment(y,o,l(g))),d&&g&&(d=!1),p.push(i+y)}let f;if(p.length===0)f=n.start+n.end;else{f=p[0];for(let m=1;m<p.length;++m){let h=p[m];f+=h?`
60
+ ${c}${h}`:`
61
+ `}}return e?(f+=`
62
+ `+Qw.indentComment(l(e),c),a&&a()):d&&s&&s(),f}function lde({items:e},t,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;i+=o;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;m<e.length;++m){let h=e[m],g=null;if(lc.isNode(h))h.spaceBefore&&d.push(""),e_(t,d,h.commentBefore,!1),h.comment&&(g=h.comment);else if(lc.isPair(h)){let v=lc.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&d.push(""),e_(t,d,v.commentBefore,!1),v.comment&&(l=!0));let b=lc.isNode(h.value)?h.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(l=!0)):h.value==null&&v?.comment&&(g=v.comment)}g&&(l=!0);let y=D6.stringify(h,c,()=>g=null);l||(l=d.length>u||y.includes(`
63
+ `)),m<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((v,b)=>v+b.length+2,2)+(y.length+2)>t.options.lineWidth)),l&&(y+=",")),g&&(y+=Qw.lineComment(y,i,a(g))),d.push(y),u=d.length}let{start:p,end:f}=r;if(d.length===0)return p+f;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=t.options.lineWidth>0&&m>t.options.lineWidth}if(l){let m=p;for(let h of d)m+=h?`
64
+ ${o}${n}${h}`:`
65
+ `;return`${m}
66
+ ${n}${f}`}else return`${p}${s}${d.join(" ")}${s}${f}`}function e_({indent:e,options:{commentString:t}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let o=Qw.indentComment(t(i),e);r.push(o.trimStart())}}M6.stringifyCollection=ade});var qs=I(ZA=>{"use strict";var ude=qA(),dde=LA(),pde=Uw(),Us=nt(),t_=Ls(),fde=or();function sh(e,t){let r=Us.isScalar(t)?t.value:t;for(let i of e)if(Us.isPair(i)&&(i.key===t||i.key===r||Us.isScalar(i.key)&&i.key.value===r))return i}var FA=class extends pde.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Us.MAP,t),this.items=[]}static from(t,r,i){let{keepUndefined:n,replacer:o}=i,s=new this(t),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||n)&&s.items.push(t_.createPair(c,l,i))};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 t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,r){let i;Us.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new t_.Pair(t,t?.value):i=new t_.Pair(t.key,t.value);let n=sh(this.items,i.key),o=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);Us.isScalar(n.value)&&fde.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(t){let r=sh(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let n=sh(this.items,t)?.value;return(!r&&Us.isScalar(n)?n.value:n)??void 0}has(t){return!!sh(this.items,t)}set(t,r){this.add(new t_.Pair(t,r),!0)}toJSON(t,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let o of this.items)dde.addPairToJSMap(r,n,o);return n}toString(t,r,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Us.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),ude.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:r})}};ZA.YAMLMap=FA;ZA.findPair=sh});var qu=I(U6=>{"use strict";var mde=nt(),L6=qs(),hde={collection:"map",default:!0,nodeClass:L6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return mde.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>L6.YAMLMap.from(e,t,r)};U6.map=hde});var Fs=I(q6=>{"use strict";var gde=Qm(),yde=qA(),vde=Uw(),n_=nt(),$de=or(),bde=js(),VA=class extends vde.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(n_.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=r_(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let i=r_(t);if(typeof i!="number")return;let n=this.items[i];return!r&&n_.isScalar(n)?n.value:n}has(t){let r=r_(t);return typeof r=="number"&&r<this.items.length}set(t,r){let i=r_(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];n_.isScalar(n)&&$de.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(t,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let o of this.items)i.push(bde.toJS(o,String(n++),r));return i}toString(t,r,i){return t?yde.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(t,r,i){let{replacer:n}=i,o=new this(t);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof n=="function"){let c=r instanceof Set?a:String(s++);a=n.call(r,c,a)}o.items.push(gde.createNode(a,void 0,i))}}return o}};function r_(e){let t=n_.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}q6.YAMLSeq=VA});var Fu=I(Z6=>{"use strict";var wde=nt(),F6=Fs(),_de={collection:"seq",default:!0,nodeClass:F6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return wde.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>F6.YAMLSeq.from(e,t,r)};Z6.seq=_de});var ah=I(V6=>{"use strict";var kde=nh(),Sde={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,i){return t=Object.assign({actualString:!0},t),kde.stringifyString(e,t,r,i)}};V6.string=Sde});var i_=I(W6=>{"use strict";var B6=or(),K6={identify:e=>e==null,createNode:()=>new B6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new B6.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&K6.test.test(e)?e:t.options.nullStr};W6.nullTag=K6});var BA=I(H6=>{"use strict";var xde=or(),G6={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new xde.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&G6.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?r.options.trueStr:r.options.falseStr}};H6.boolTag=G6});var Zu=I(J6=>{"use strict";function Ide({format:e,minFractionDigits:t,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}J6.stringifyNumber=Ide});var WA=I(o_=>{"use strict";var Tde=or(),KA=Zu(),Pde={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:KA.stringifyNumber},Rde={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():KA.stringifyNumber(e)}},Cde={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Tde.Scalar(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:KA.stringifyNumber};o_.float=Cde;o_.floatExp=Rde;o_.floatNaN=Pde});var HA=I(a_=>{"use strict";var Y6=Zu(),s_=e=>typeof e=="bigint"||Number.isInteger(e),GA=(e,t,r,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),r);function X6(e,t,r){let{value:i}=e;return s_(i)&&i>=0?r+i.toString(t):Y6.stringifyNumber(e)}var Ade={identify:e=>s_(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>GA(e,2,8,r),stringify:e=>X6(e,8,"0o")},Ede={identify:s_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>GA(e,0,10,r),stringify:Y6.stringifyNumber},Ode={identify:e=>s_(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>GA(e,2,16,r),stringify:e=>X6(e,16,"0x")};a_.int=Ede;a_.intHex=Ode;a_.intOct=Ade});var eV=I(Q6=>{"use strict";var Nde=qu(),jde=i_(),zde=Fu(),Dde=ah(),Mde=BA(),JA=WA(),YA=HA(),Lde=[Nde.map,zde.seq,Dde.string,jde.nullTag,Mde.boolTag,YA.intOct,YA.int,YA.intHex,JA.floatNaN,JA.floatExp,JA.float];Q6.schema=Lde});var nV=I(rV=>{"use strict";var Ude=or(),qde=qu(),Fde=Fu();function tV(e){return typeof e=="bigint"||Number.isInteger(e)}var c_=({value:e})=>JSON.stringify(e),Zde=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:c_},{identify:e=>e==null,createNode:()=>new Ude.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:c_},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:c_},{identify:tV,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>tV(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:c_}],Vde={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Bde=[qde.map,Fde.seq].concat(Zde,Vde);rV.schema=Bde});var QA=I(iV=>{"use strict";var ch=Sg("buffer"),XA=or(),Kde=nh(),Wde={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof ch.Buffer=="function")return ch.Buffer.from(e,"base64");if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},i,n,o){if(!r)return"";let s=r,a;if(typeof ch.Buffer=="function")a=s instanceof ch.Buffer?s.toString("base64"):ch.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=XA.Scalar.BLOCK_LITERAL),t!==XA.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let d=0,p=0;d<l;++d,p+=c)u[d]=a.substr(p,c);a=u.join(t===XA.Scalar.BLOCK_LITERAL?`
67
+ `:" ")}return Kde.stringifyString({comment:e,type:t,value:a},i,n,o)}};iV.binary=Wde});var d_=I(u_=>{"use strict";var l_=nt(),eE=Ls(),Gde=or(),Hde=Fs();function oV(e,t){if(l_.isSeq(e))for(let r=0;r<e.items.length;++r){let i=e.items[r];if(!l_.isPair(i)){if(l_.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new eE.Pair(new Gde.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
68
+ ${n.key.commentBefore}`:i.commentBefore),i.comment){let o=n.value??n.key;o.comment=o.comment?`${i.comment}
69
+ ${o.comment}`:i.comment}i=n}e.items[r]=l_.isPair(i)?i:new eE.Pair(i)}}else t("Expected a sequence for this tag");return e}function sV(e,t,r){let{replacer:i}=r,n=new Hde.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;n.items.push(eE.createPair(a,c,r))}return n}var Jde={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:oV,createNode:sV};u_.createPairs=sV;u_.pairs=Jde;u_.resolvePairs=oV});var nE=I(rE=>{"use strict";var aV=nt(),tE=js(),lh=qs(),Yde=Fs(),cV=d_(),uc=class e extends Yde.YAMLSeq{constructor(){super(),this.add=lh.YAMLMap.prototype.add.bind(this),this.delete=lh.YAMLMap.prototype.delete.bind(this),this.get=lh.YAMLMap.prototype.get.bind(this),this.has=lh.YAMLMap.prototype.has.bind(this),this.set=lh.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let o,s;if(aV.isPair(n)?(o=tE.toJS(n.key,"",r),s=tE.toJS(n.value,o,r)):o=tE.toJS(n,"",r),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,r,i){let n=cV.createPairs(t,r,i),o=new this;return o.items=n.items,o}};uc.tag="tag:yaml.org,2002:omap";var Xde={collection:"seq",identify:e=>e instanceof Map,nodeClass:uc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=cV.resolvePairs(e,t),i=[];for(let{key:n}of r.items)aV.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new uc,r)},createNode:(e,t,r)=>uc.from(e,t,r)};rE.YAMLOMap=uc;rE.omap=Xde});var fV=I(iE=>{"use strict";var lV=or();function uV({value:e,source:t},r){return t&&(e?dV:pV).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var dV={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new lV.Scalar(!0),stringify:uV},pV={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new lV.Scalar(!1),stringify:uV};iE.falseTag=pV;iE.trueTag=dV});var mV=I(p_=>{"use strict";var Qde=or(),oE=Zu(),epe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:oE.stringifyNumber},tpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():oE.stringifyNumber(e)}},rpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Qde.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let i=e.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:oE.stringifyNumber};p_.float=rpe;p_.floatExp=tpe;p_.floatNaN=epe});var gV=I(dh=>{"use strict";var hV=Zu(),uh=e=>typeof e=="bigint"||Number.isInteger(e);function f_(e,t,r,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return n==="-"?BigInt(-1)*s:s}let o=parseInt(e,r);return n==="-"?-1*o:o}function sE(e,t,r){let{value:i}=e;if(uh(i)){let n=i.toString(t);return i<0?"-"+r+n.substr(1):r+n}return hV.stringifyNumber(e)}var npe={identify:uh,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>f_(e,2,2,r),stringify:e=>sE(e,2,"0b")},ipe={identify:uh,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>f_(e,1,8,r),stringify:e=>sE(e,8,"0")},ope={identify:uh,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>f_(e,0,10,r),stringify:hV.stringifyNumber},spe={identify:uh,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>f_(e,2,16,r),stringify:e=>sE(e,16,"0x")};dh.int=ope;dh.intBin=npe;dh.intHex=spe;dh.intOct=ipe});var cE=I(aE=>{"use strict";var g_=nt(),m_=Ls(),h_=qs(),dc=class e extends h_.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let r;g_.isPair(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new m_.Pair(t.key,null):r=new m_.Pair(t,null),h_.findPair(this.items,r.key)||this.items.push(r)}get(t,r){let i=h_.findPair(this.items,t);return!r&&g_.isPair(i)?g_.isScalar(i.key)?i.key.value:i.key:i}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=h_.findPair(this.items,t);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new m_.Pair(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(t,r,i){let{replacer:n}=i,o=new this(t);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof n=="function"&&(s=n.call(r,s,s)),o.items.push(m_.createPair(s,null,i));return o}};dc.tag="tag:yaml.org,2002:set";var ape={collection:"map",identify:e=>e instanceof Set,nodeClass:dc,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>dc.from(e,t,r),resolve(e,t){if(g_.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new dc,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};aE.YAMLSet=dc;aE.set=ape});var uE=I(y_=>{"use strict";var cpe=Zu();function lE(e,t){let r=e[0],i=r==="-"||r==="+"?e.substring(1):e,n=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*n(60)+n(a),n(0));return r==="-"?n(-1)*o:o}function yV(e){let{value:t}=e,r=s=>s;if(typeof t=="bigint")r=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return cpe.stringifyNumber(e);let i="";t<0&&(i="-",t*=r(-1));let n=r(60),o=[t%n];return t<60?o.unshift(0):(t=(t-o[0])/n,o.unshift(t%n),t>=60&&(t=(t-o[0])/n,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var lpe={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>lE(e,r),stringify:yV},upe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>lE(e,!1),stringify:yV},vV={identify:e=>e 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(e){let t=e.match(vV.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,i-1,n,o||0,s||0,a||0,c),u=t[8];if(u&&u!=="Z"){let d=lE(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};y_.floatTime=upe;y_.intTime=lpe;y_.timestamp=vV});var wV=I(bV=>{"use strict";var dpe=qu(),ppe=i_(),fpe=Fu(),mpe=ah(),hpe=QA(),$V=fV(),dE=mV(),v_=gV(),gpe=Jw(),ype=nE(),vpe=d_(),$pe=cE(),pE=uE(),bpe=[dpe.map,fpe.seq,mpe.string,ppe.nullTag,$V.trueTag,$V.falseTag,v_.intBin,v_.intOct,v_.int,v_.intHex,dE.floatNaN,dE.floatExp,dE.float,hpe.binary,gpe.merge,ype.omap,vpe.pairs,$pe.set,pE.intTime,pE.floatTime,pE.timestamp];bV.schema=bpe});var AV=I(hE=>{"use strict";var xV=qu(),wpe=i_(),IV=Fu(),_pe=ah(),kpe=BA(),fE=WA(),mE=HA(),Spe=eV(),xpe=nV(),TV=QA(),ph=Jw(),PV=nE(),RV=d_(),_V=wV(),CV=cE(),$_=uE(),kV=new Map([["core",Spe.schema],["failsafe",[xV.map,IV.seq,_pe.string]],["json",xpe.schema],["yaml11",_V.schema],["yaml-1.1",_V.schema]]),SV={binary:TV.binary,bool:kpe.boolTag,float:fE.float,floatExp:fE.floatExp,floatNaN:fE.floatNaN,floatTime:$_.floatTime,int:mE.int,intHex:mE.intHex,intOct:mE.intOct,intTime:$_.intTime,map:xV.map,merge:ph.merge,null:wpe.nullTag,omap:PV.omap,pairs:RV.pairs,seq:IV.seq,set:CV.set,timestamp:$_.timestamp},Ipe={"tag:yaml.org,2002:binary":TV.binary,"tag:yaml.org,2002:merge":ph.merge,"tag:yaml.org,2002:omap":PV.omap,"tag:yaml.org,2002:pairs":RV.pairs,"tag:yaml.org,2002:set":CV.set,"tag:yaml.org,2002:timestamp":$_.timestamp};function Tpe(e,t,r){let i=kV.get(t);if(i&&!e)return r&&!i.includes(ph.merge)?i.concat(ph.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let o=Array.from(kV.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)n=n.concat(o);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(ph.merge)),n.reduce((o,s)=>{let a=typeof s=="string"?SV[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(SV).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},[])}hE.coreKnownTags=Ipe;hE.getTags=Tpe});var vE=I(EV=>{"use strict";var gE=nt(),Ppe=qu(),Rpe=Fu(),Cpe=ah(),b_=AV(),Ape=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,yE=class e{constructor({compat:t,customTags:r,merge:i,resolveKnownTags:n,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?b_.getTags(t,"compat"):t?b_.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=n?b_.coreKnownTags:{},this.tags=b_.getTags(r,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,gE.MAP,{value:Ppe.map}),Object.defineProperty(this,gE.SCALAR,{value:Cpe.string}),Object.defineProperty(this,gE.SEQ,{value:Rpe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ape:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};EV.Schema=yE});var NV=I(OV=>{"use strict";var Epe=nt(),$E=ih(),fh=eh();function Ope(e,t){let r=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(r.push(c),i=!0):e.directives.docStart&&(i=!0)}i&&r.push("---");let n=$E.createStringifyContext(e,t),{commentString:o}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");let c=o(e.commentBefore);r.unshift(fh.indentComment(c,""))}let s=!1,a=null;if(e.contents){if(Epe.isNode(e.contents)){if(e.contents.spaceBefore&&i&&r.push(""),e.contents.commentBefore){let u=o(e.contents.commentBefore);r.push(fh.indentComment(u,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>s=!0,l=$E.stringify(e.contents,n,()=>a=null,c);a&&(l+=fh.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push($E.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);c.includes(`
70
+ `)?(r.push("..."),r.push(fh.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(fh.indentComment(o(c),"")))}return r.join(`
71
+ `)+`
72
+ `}OV.stringifyDocument=Ope});var mh=I(jV=>{"use strict";var Npe=Xm(),Vu=Uw(),ni=nt(),jpe=Ls(),zpe=js(),Dpe=vE(),Mpe=NV(),bE=zw(),Lpe=SA(),Upe=Qm(),wE=kA(),_E=class e{constructor(t,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ni.NODE_TYPE,{value:ni.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=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"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new wE.Directives({version:s}),this.setSchema(s,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[ni.NODE_TYPE]:{value:ni.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ni.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Bu(this.contents)&&this.contents.add(t)}addIn(t,r){Bu(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let i=bE.anchorNames(this);t.anchor=!r||i.has(r)?bE.findNewAnchor(r||"a",i):r}return new Npe.Alias(t.anchor)}createNode(t,r,i){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){let g=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=r.filter(g).map(String);y.length>0&&(r=r.concat(y)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:l,tag:u}=i??{},{onAnchor:d,setAnchors:p,sourceObjects:f}=bE.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:n,schema:this.schema,sourceObjects:f},h=Upe.createNode(t,u,m);return a&&ni.isCollection(h)&&(h.flow=!0),p(),h}createPair(t,r,i={}){let n=this.createNode(t,null,i),o=this.createNode(r,null,i);return new jpe.Pair(n,o)}delete(t){return Bu(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Vu.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Bu(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return ni.isCollection(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return Vu.isEmptyPath(t)?!r&&ni.isScalar(this.contents)?this.contents.value:this.contents:ni.isCollection(this.contents)?this.contents.getIn(t,r):void 0}has(t){return ni.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Vu.isEmptyPath(t)?this.contents!==void 0:ni.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=Vu.collectionFromPath(this.schema,[t],r):Bu(this.contents)&&this.contents.set(t,r)}setIn(t,r){Vu.isEmptyPath(t)?this.contents=r:this.contents==null?this.contents=Vu.collectionFromPath(this.schema,Array.from(t),r):Bu(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new wE.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new wE.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new Dpe.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=zpe.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:u}of a.anchors.values())o(u,l);return typeof s=="function"?Lpe.applyReviver(s,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return Mpe.stringifyDocument(this,t)}};function Bu(e){if(ni.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}jV.Document=_E});var yh=I(gh=>{"use strict";var hh=class extends Error{constructor(t,r,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=r}},kE=class extends hh{constructor(t,r,i){super("YAMLParseError",t,r,i)}},SE=class extends hh{constructor(t,r,i){super("YAMLWarning",t,r,i)}},qpe=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>t.linePos(a));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let o=n-1,s=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
73
+ `),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===i&&c.col>n&&(a=Math.max(1,Math.min(c.col-n,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
74
+
75
+ ${s}
76
+ ${l}
77
+ `}};gh.YAMLError=hh;gh.YAMLParseError=kE;gh.YAMLWarning=SE;gh.prettifyError=qpe});var vh=I(zV=>{"use strict";function Fpe(e,{flow:t,indicator:r,next:i,offset:n,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",p="",f=!1,m=!1,h=null,g=null,y=null,v=null,b=null,_=null,k=null;for(let C of e)switch(m&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&o(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&C.type!=="comment"&&C.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),C.type){case"space":!t&&(r!=="doc-start"||i?.type!=="flow-collection")&&C.source.includes(" ")&&(h=C),u=!0;break;case"comment":{u||o(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let E=C.source.substring(1)||" ";d?d+=p+E:d=E,p="",l=!1;break}case"newline":l?d?d+=C.source:(!_||r!=="seq-item-ind")&&(c=!0):p+=C.source,l=!0,f=!0,(g||y)&&(v=C),u=!0;break;case"anchor":g&&o(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&o(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=C,k??(k=C.offset),l=!1,u=!1,m=!0;break;case"tag":{y&&o(C,"MULTIPLE_TAGS","A node can have at most one tag"),y=C,k??(k=C.offset),l=!1,u=!1,m=!0;break}case r:(g||y)&&o(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),_&&o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${t??"collection"}`),_=C,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&o(C,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=C,l=!1,u=!1;break}default:o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),l=!1,u=!1}let x=e[e.length-1],S=x?x.offset+x.source.length:n;return m&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:_,spaceBefore:c,comment:d,hasNewline:f,anchor:g,tag:y,newlineAfterProp:v,end:S,start:k??S}}zV.resolveProps=Fpe});var w_=I(DV=>{"use strict";function xE(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
78
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(xE(t.key)||xE(t.value))return!0}return!1;default:return!0}}DV.containsNewline=xE});var IE=I(MV=>{"use strict";var Zpe=w_();function Vpe(e,t,r){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Zpe.containsNewline(t)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}MV.flowIndentCheck=Vpe});var TE=I(UV=>{"use strict";var LV=nt();function Bpe(e,t,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(o,s)=>o===s||LV.isScalar(o)&&LV.isScalar(s)&&o.value===s.value;return t.some(o=>n(o.key,r))}UV.mapIncludes=Bpe});var KV=I(BV=>{"use strict";var qV=Ls(),Kpe=qs(),FV=vh(),Wpe=w_(),ZV=IE(),Gpe=TE(),VV="All mapping items must start at the same column";function Hpe({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=o?.nodeClass??Kpe.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,l=null;for(let u of i.items){let{start:d,key:p,sep:f,value:m}=u,h=FV.resolveProps(d,{indicator:"explicit-key-ind",next:p??f?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),g=!h.found;if(g){if(p&&(p.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==i.indent&&n(c,"BAD_INDENT",VV)),!h.anchor&&!h.tag&&!f){l=h.end,h.comment&&(a.comment?a.comment+=`
79
+ `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Wpe.containsNewline(p))&&n(p??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==i.indent&&n(c,"BAD_INDENT",VV);r.atKey=!0;let y=h.end,v=p?e(r,p,h,n):t(r,y,d,null,h,n);r.schema.compat&&ZV.flowIndentCheck(i.indent,p,n),r.atKey=!1,Gpe.mapIncludes(r,a.items,v)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let b=FV.resolveProps(f??[],{indicator:"map-value-ind",next:m,offset:v.range[2],onError:n,parentIndent:i.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=b.end,b.found){g&&(m?.type==="block-map"&&!b.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<b.found.offset-1024&&n(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=m?e(r,m,b,n):t(r,c,f,null,b,n);r.schema.compat&&ZV.flowIndentCheck(i.indent,m,n),c=_.range[2];let k=new qV.Pair(v,_);r.options.keepSourceTokens&&(k.srcToken=u),a.items.push(k)}else{g&&n(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(v.comment?v.comment+=`
80
+ `+b.comment:v.comment=b.comment);let _=new qV.Pair(v);r.options.keepSourceTokens&&(_.srcToken=u),a.items.push(_)}}return l&&l<c&&n(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,l??c],a}BV.resolveBlockMap=Hpe});var GV=I(WV=>{"use strict";var Jpe=Fs(),Ype=vh(),Xpe=IE();function Qpe({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=o?.nodeClass??Jpe.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,l=null;for(let{start:u,value:d}of i.items){let p=Ype.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||d)d?.type==="block-seq"?n(p.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let f=d?e(r,d,p,n):t(r,p.end,u,null,p,n);r.schema.compat&&Xpe.flowIndentCheck(i.indent,d,n),c=f.range[2],a.items.push(f)}return a.range=[i.offset,c,l??c],a}WV.resolveBlockSeq=Qpe});var Ku=I(HV=>{"use strict";function efe(e,t,r,i){let n="";if(e){let o=!1,s="";for(let a of e){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";n?n+=s+u:n=u,s="";break}case"newline":n&&(s+=c),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:n,offset:t}}HV.resolveEnd=efe});var QV=I(XV=>{"use strict";var tfe=nt(),rfe=Ls(),JV=qs(),nfe=Fs(),ife=Ku(),YV=vh(),ofe=w_(),sfe=TE(),PE="Block collections are not allowed within flow collections",RE=e=>e&&(e.type==="block-map"||e.type==="block-seq");function afe({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?JV.YAMLMap:nfe.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let g=0;g<i.items.length;++g){let y=i.items[g],{start:v,key:b,sep:_,value:k}=y,x=YV.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:b??_?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!_&&!k){g===0&&x.comma?n(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<i.items.length-1&&n(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),x.comment&&(l.comment?l.comment+=`
81
+ `+x.comment:l.comment=x.comment),d=x.end;continue}!s&&r.options.strict&&ofe.containsNewline(b)&&n(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)x.comma&&n(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(x.comma||n(x.start,"MISSING_CHAR",`Missing , between ${a} items`),x.comment){let S="";e:for(let C of v)switch(C.type){case"comma":case"space":break;case"comment":S=C.source.substring(1);break e;default:break e}if(S){let C=l.items[l.items.length-1];tfe.isPair(C)&&(C=C.value??C.key),C.comment?C.comment+=`
82
+ `+S:C.comment=S,x.comment=x.comment.substring(S.length+1)}}if(!s&&!_&&!x.found){let S=k?e(r,k,x,n):t(r,x.end,_,null,x,n);l.items.push(S),d=S.range[2],RE(k)&&n(S.range,"BLOCK_IN_FLOW",PE)}else{r.atKey=!0;let S=x.end,C=b?e(r,b,x,n):t(r,S,v,null,x,n);RE(b)&&n(C.range,"BLOCK_IN_FLOW",PE),r.atKey=!1;let E=YV.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:k,offset:C.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(E.found){if(!s&&!x.found&&r.options.strict){if(_)for(let X of _){if(X===E.found)break;if(X.type==="newline"){n(X,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}x.start<E.found.offset-1024&&n(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?n(k,"MISSING_CHAR",`Missing space after : in ${a}`):n(E.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let U=k?e(r,k,E,n):E.found?t(r,E.end,_,null,E,n):null;U?RE(k)&&n(U.range,"BLOCK_IN_FLOW",PE):E.comment&&(C.comment?C.comment+=`
83
+ `+E.comment:C.comment=E.comment);let V=new rfe.Pair(C,U);if(r.options.keepSourceTokens&&(V.srcToken=y),s){let X=l;sfe.mapIncludes(r,X.items,C)&&n(S,"DUPLICATE_KEY","Map keys must be unique"),X.items.push(V)}else{let X=new JV.YAMLMap(r.schema);X.flow=!0,X.items.push(V);let J=(U??C).range;X.range=[C.range[0],J[1],J[2]],l.items.push(X)}d=U?U.range[2]:E.end}}let p=s?"}":"]",[f,...m]=i.end,h=d;if(f?.source===p)h=f.offset+f.source.length;else{let g=a[0].toUpperCase()+a.substring(1),y=u?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;n(d,u?"MISSING_CHAR":"BAD_INDENT",y),f&&f.source.length!==1&&m.unshift(f)}if(m.length>0){let g=ife.resolveEnd(m,h,r.options.strict,n);g.comment&&(l.comment?l.comment+=`
84
+ `+g.comment:l.comment=g.comment),l.range=[i.offset,h,g.offset]}else l.range=[i.offset,h,h];return l}XV.resolveFlowCollection=afe});var t2=I(e2=>{"use strict";var cfe=nt(),lfe=or(),ufe=qs(),dfe=Fs(),pfe=KV(),ffe=GV(),mfe=QV();function CE(e,t,r,i,n,o){let s=r.type==="block-map"?pfe.resolveBlockMap(e,t,r,i,o):r.type==="block-seq"?ffe.resolveBlockSeq(e,t,r,i,o):mfe.resolveFlowCollection(e,t,r,i,o),a=s.constructor;return n==="!"||n===a.tagName?(s.tag=a.tagName,s):(n&&(s.tag=n),s)}function hfe(e,t,r,i,n){let o=i.tag,s=o?t.directives.tagName(o.source,p=>n(o,"TAG_RESOLVE_FAILED",p)):null;if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:f}=i,m=p&&o?p.offset>o.offset?p:o:p??o;m&&(!f||f.offset<m.offset)&&n(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||!s||s==="!"||s===ufe.YAMLMap.tagName&&a==="map"||s===dfe.YAMLSeq.tagName&&a==="seq")return CE(e,t,r,n,s);let c=t.schema.tags.find(p=>p.tag===s&&p.collection===a);if(!c){let p=t.schema.knownTags[s];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?n(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):n(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),CE(e,t,r,n,s)}let l=CE(e,t,r,n,s,c),u=c.resolve?.(l,p=>n(o,"TAG_RESOLVE_FAILED",p),t.options)??l,d=cfe.isNode(u)?u:new lfe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}e2.composeCollection=hfe});var EE=I(r2=>{"use strict";var AE=or();function gfe(e,t,r){let i=t.offset,n=yfe(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let o=n.mode===">"?AE.Scalar.BLOCK_FOLDED:AE.Scalar.BLOCK_LITERAL,s=t.source?vfe(t.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=n.chomp==="+"&&s.length>0?`
85
+ `.repeat(Math.max(1,s.length-1)):"",g=i+n.length;return t.source&&(g+=t.source.length),{value:h,type:o,comment:n.comment,range:[i,g,g]}}let c=t.indent+n.indent,l=t.offset+n.length,u=0;for(let h=0;h<a;++h){let[g,y]=s[h];if(y===""||y==="\r")n.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"),n.indent===0&&(c=g.length),u=h,c===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let h=s.length-1;h>=a;--h)s[h][0].length>c&&(a=h+1);let d="",p="",f=!1;for(let h=0;h<u;++h)d+=s[h][0].slice(c)+`
86
+ `;for(let h=u;h<a;++h){let[g,y]=s[h];l+=g.length+y.length+1;let v=y[y.length-1]==="\r";if(v&&(y=y.slice(0,-1)),y&&g.length<c){let _=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(l-y.length-(v?2:1),"BAD_INDENT",_),g=""}o===AE.Scalar.BLOCK_LITERAL?(d+=p+g.slice(c)+y,p=`
87
+ `):g.length>c||y[0]===" "?(p===" "?p=`
88
+ `:!f&&p===`
89
+ `&&(p=`
90
+
91
+ `),d+=p+g.slice(c)+y,p=`
92
+ `,f=!0):y===""?p===`
93
+ `?d+=`
94
+ `:p=`
95
+ `:(d+=p+y,p=" ",f=!1)}switch(n.chomp){case"-":break;case"+":for(let h=a;h<s.length;++h)d+=`
96
+ `+s[h][0].slice(c);d[d.length-1]!==`
97
+ `&&(d+=`
98
+ `);break;default:d+=`
99
+ `}let m=i+n.length+t.source.length;return{value:d,type:o,comment:n.comment,range:[i,m,m]}}function yfe({offset:e,props:t},r,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],o=n[0],s=0,a="",c=-1;for(let p=1;p<n.length;++p){let f=n[p];if(!a&&(f==="-"||f==="+"))a=f;else{let m=Number(f);!s&&m?s=m:c===-1&&(c=e+p)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let l=!1,u="",d=n.length;for(let p=1;p<t.length;++p){let f=t[p];switch(f.type){case"space":l=!0;case"newline":d+=f.source.length;break;case"comment":r&&!l&&i(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=f.source.length,u=f.source.substring(1);break;case"error":i(f,"UNEXPECTED_TOKEN",f.message),d+=f.source.length;break;default:{let m=`Unexpected token in block scalar header: ${f.type}`;i(f,"UNEXPECTED_TOKEN",m);let h=f.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:d}}function vfe(e){let t=e.split(/\n( *)/),r=t[0],i=r.match(/^( *)/),o=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}r2.resolveBlockScalar=gfe});var NE=I(i2=>{"use strict";var OE=or(),$fe=Ku();function bfe(e,t,r){let{offset:i,type:n,source:o,end:s}=e,a,c,l=(p,f,m)=>r(i+p,f,m);switch(n){case"scalar":a=OE.Scalar.PLAIN,c=wfe(o,l);break;case"single-quoted-scalar":a=OE.Scalar.QUOTE_SINGLE,c=_fe(o,l);break;case"double-quoted-scalar":a=OE.Scalar.QUOTE_DOUBLE,c=kfe(o,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let u=i+o.length,d=$fe.resolveEnd(s,u,t,r);return{value:c,type:a,comment:d.comment,range:[i,u,d.offset]}}function wfe(e,t){let r="";switch(e[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 ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),n2(e)}function _fe(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),n2(e.slice(1,-1)).replace(/''/g,"'")}function n2(e){let t=/(.*?)\r?\n/sy,r=t.exec(e);if(!r)return e;let i,n;try{i=new RegExp("(?<![ ])[ ]+$"),n=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{i=/[ \t]+$/,n=/^[ \t]+|[ \t]+$/g}let o=r[1].replace(i,""),s=" ",a=t.lastIndex;for(;r=t.exec(e);){let l=r[1].replace(n,"");l===""?s===`
100
+ `?o+=s:s=`
101
+ `:(o+=s+l,s=" "),a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function kfe(e,t){let r="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
102
+ `))if(n===`
103
+ `){let{fold:o,offset:s}=Sfe(e,i);r+=o,i=s}else if(n==="\\"){let o=e[++i],s=xfe[o];if(s)r+=s;else if(o===`
104
+ `)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
105
+ `)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=Ife(e,i+1,a,t),i+=a}else{let a=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(n===" "||n===" "){let o=i,s=e[i+1];for(;s===" "||s===" ";)s=e[++i+1];s!==`
106
+ `&&!(s==="\r"&&e[i+2]===`
107
+ `)&&(r+=i>o?e.slice(o,i+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function Sfe(e,t){let r="",i=e[t+1];for(;(i===" "||i===" "||i===`
108
+ `||i==="\r")&&!(i==="\r"&&e[t+2]!==`
109
+ `);)i===`
110
+ `&&(r+=`
111
+ `),t+=1,i=e[t+1];return r||(r=" "),{fold:r,offset:t}}var xfe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
112
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ife(e,t,r,i){let n=e.substr(t,r),s=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,r+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}i2.resolveFlowScalar=bfe});var a2=I(s2=>{"use strict";var pc=nt(),o2=or(),Tfe=EE(),Pfe=NE();function Rfe(e,t,r,i){let{value:n,type:o,comment:s,range:a}=t.type==="block-scalar"?Tfe.resolveBlockScalar(e,t,i):Pfe.resolveFlowScalar(t,e.options.strict,i),c=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[pc.SCALAR]:c?l=Cfe(e.schema,n,c,r,i):t.type==="scalar"?l=Afe(e,n,t,i):l=e.schema[pc.SCALAR];let u;try{let d=l.resolve(n,p=>i(r??t,"TAG_RESOLVE_FAILED",p),e.options);u=pc.isScalar(d)?d:new o2.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);i(r??t,"TAG_RESOLVE_FAILED",p),u=new o2.Scalar(n)}return u.range=a,u.source=n,o&&(u.type=o),c&&(u.tag=c),l.format&&(u.format=l.format),s&&(u.comment=s),u}function Cfe(e,t,r,i,n){if(r==="!")return e[pc.SCALAR];let o=[];for(let a of e.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(t))return a;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[pc.SCALAR])}function Afe({atKey:e,directives:t,schema:r},i,n,o){let s=r.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(i))||r[pc.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(i))??r[pc.SCALAR];if(s.tag!==a.tag){let c=t.tagString(s.tag),l=t.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(n,"TAG_RESOLVE_FAILED",u,!0)}}return s}s2.composeScalar=Rfe});var l2=I(c2=>{"use strict";function Efe(e,t,r){if(t){r??(r=t.length);for(let i=r-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}c2.emptyScalarPosition=Efe});var p2=I(zE=>{"use strict";var Ofe=Xm(),Nfe=nt(),jfe=t2(),u2=a2(),zfe=Ku(),Dfe=l2(),Mfe={composeNode:d2,composeEmptyNode:jE};function d2(e,t,r,i){let n=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(t.type){case"alias":l=Lfe(e,t,i),(a||c)&&i(t,"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=u2.composeScalar(e,t,c,i),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=jfe.composeCollection(Mfe,e,t,r,i),a&&(l.anchor=a.source.substring(1))}catch(d){let p=d instanceof Error?d.message:String(d);i(t,"RESOURCE_EXHAUSTION",p)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=jE(e,t.offset,void 0,null,r,i)),a&&l.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Nfe.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?l.comment=s:l.commentBefore=s),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function jE(e,t,r,i,{spaceBefore:n,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Dfe.emptyScalarPosition(t,r,i),indent:-1,source:""},d=u2.composeScalar(e,u,a,l);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function Lfe({options:e},{offset:t,source:r,end:i},n){let o=new Ofe.Alias(r.substring(1));o.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+r.length,a=zfe.resolveEnd(i,s,e.strict,n);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}zE.composeEmptyNode=jE;zE.composeNode=d2});var h2=I(m2=>{"use strict";var Ufe=mh(),f2=p2(),qfe=Ku(),Ffe=vh();function Zfe(e,t,{offset:r,start:i,value:n,end:o},s){let a=Object.assign({_directives:t},e),c=new Ufe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Ffe.resolveProps(i,{indicator:"doc-start",next:n??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?f2.composeNode(l,n,u,s):f2.composeEmptyNode(l,u.end,i,null,u,s);let d=c.contents.range[2],p=qfe.resolveEnd(o,d,!1,s);return p.comment&&(c.comment=p.comment),c.range=[r,d,p.offset],c}m2.composeDoc=Zfe});var ME=I(v2=>{"use strict";var Vfe=Sg("process"),Bfe=kA(),Kfe=mh(),$h=yh(),g2=nt(),Wfe=h2(),Gfe=Ku();function bh(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function y2(e){let t="",r=!1,i=!1;for(let n=0;n<e.length;++n){let o=e[n];switch(o[0]){case"#":t+=(t===""?"":i?`
113
+
114
+ `:`
115
+ `)+(o.substring(1)||" "),r=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:t,afterEmptyLine:i}}var DE=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,o)=>{let s=bh(r);o?this.warnings.push(new $h.YAMLWarning(s,i,n)):this.errors.push(new $h.YAMLParseError(s,i,n))},this.directives=new Bfe.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:i,afterEmptyLine:n}=y2(this.prelude);if(i){let o=t.contents;if(r)t.comment=t.comment?`${t.comment}
116
+ ${i}`:i;else if(n||t.directives.docStart||!o)t.commentBefore=i;else if(g2.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];g2.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
117
+ ${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
118
+ ${s}`:i}}if(r){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:y2(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(r,i)}*next(t){switch(Vfe.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(r,i,n)=>{let o=bh(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=Wfe.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"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(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new $h.YAMLParseError(bh(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new $h.YAMLParseError(bh(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=Gfe.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
119
+ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new $h.YAMLParseError(bh(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new Kfe.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};v2.Composer=DE});var w2=I(__=>{"use strict";var Hfe=EE(),Jfe=NE(),Yfe=yh(),$2=nh();function Xfe(e,t=!0,r){if(e){let i=(n,o,s)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(a,o,s);else throw new Yfe.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Jfe.resolveFlowScalar(e,t,i);case"block-scalar":return Hfe.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Qfe(e,t){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:o=-1,type:s="PLAIN"}=t,a=$2.stringifyString({type:s,value:e},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:i,source:`
120
+ `}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
121
+ `),u=a.substring(0,l),d=a.substring(l+1)+`
122
+ `,p=[{type:"block-scalar-header",offset:o,indent:i,source:u}];return b2(p,c)||p.push({type:"newline",offset:-1,indent:i,source:`
123
+ `}),{type:"block-scalar",offset:o,indent:i,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:c};default:return{type:"scalar",offset:o,indent:i,source:a,end:c}}}function eme(e,t,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:o=!1,type:s}=r,a="indent"in e?e.indent:null;if(i&&typeof a=="number"&&(a+=2),!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=$2.stringifyString({type:s,value:t},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":tme(e,c);break;case'"':LE(e,c,"double-quoted-scalar");break;case"'":LE(e,c,"single-quoted-scalar");break;default:LE(e,c,"scalar")}}function tme(e,t){let r=t.indexOf(`
124
+ `),i=t.substring(0,r),n=t.substring(r+1)+`
125
+ `;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=n}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];b2(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
126
+ `});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:n})}}function b2(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function LE(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let o of i)o.offset+=n;delete e.props,Object.assign(e,{type:r,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
127
+ `};delete e.items,Object.assign(e,{type:r,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:r,indent:i,source:t,end:n})}}}__.createScalarToken=Qfe;__.resolveAsScalar=Xfe;__.setScalarValue=eme});var k2=I(_2=>{"use strict";var rme=e=>"type"in e?S_(e):k_(e);function S_(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=S_(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=k_(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=k_(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=k_(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function k_({start:e,key:t,sep:r,value:i}){let n="";for(let o of e)n+=o.source;if(t&&(n+=S_(t)),r)for(let o of r)n+=o.source;return i&&(n+=S_(i)),n}_2.stringify=rme});var T2=I(I2=>{"use strict";var UE=Symbol("break visit"),nme=Symbol("skip children"),S2=Symbol("remove item");function fc(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),x2(Object.freeze([]),e,t)}fc.BREAK=UE;fc.SKIP=nme;fc.REMOVE=S2;fc.itemAtPath=(e,t)=>{let r=e;for(let[i,n]of t){let o=r?.[i];if(o&&"items"in o)r=o.items[n];else return}return r};fc.parentCollection=(e,t)=>{let r=fc.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function x2(e,t,r){let i=r(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let o=t[n];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=x2(Object.freeze(e.concat([[n,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===UE)return UE;a===S2&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}I2.visit=fc});var x_=I(kn=>{"use strict";var qE=w2(),ime=k2(),ome=T2(),FE="\uFEFF",ZE="",VE="",BE="",sme=e=>!!e&&"items"in e,ame=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function cme(e){switch(e){case FE:return"<BOM>";case ZE:return"<DOC>";case VE:return"<FLOW_END>";case BE:return"<SCALAR>";default:return JSON.stringify(e)}}function lme(e){switch(e){case FE:return"byte-order-mark";case ZE:return"doc-mode";case VE:return"flow-error-end";case BE:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
128
+ `:case`\r
129
+ `: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(e[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}kn.createScalarToken=qE.createScalarToken;kn.resolveAsScalar=qE.resolveAsScalar;kn.setScalarValue=qE.setScalarValue;kn.stringify=ime.stringify;kn.visit=ome.visit;kn.BOM=FE;kn.DOCUMENT=ZE;kn.FLOW_END=VE;kn.SCALAR=BE;kn.isCollection=sme;kn.isScalar=ame;kn.prettyToken=cme;kn.tokenType=lme});var GE=I(R2=>{"use strict";var wh=x_();function ki(e){switch(e){case void 0:case" ":case`
130
+ `:case"\r":case" ":return!0;default:return!1}}var P2=new Set("0123456789ABCDEFabcdef"),ume=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),I_=new Set(",[]{}"),dme=new Set(` ,[]{}
131
+ \r `),KE=e=>!e||dme.has(e),WE=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(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
132
+ `?!0:r==="\r"?this.buffer[t+1]===`
133
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let i=0;for(;r===" ";)r=this.buffer[++i+t];if(r==="\r"){let n=this.buffer[i+t+1];if(n===`
134
+ `||!n&&!this.atEnd)return t+i+1}return r===`
135
+ `||i>=this.indentNext||!r&&!this.atEnd?t+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ki(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
136
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===wh.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){r=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[r-1];if(o===" "||o===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield wh.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&ki(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&&!ki(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ki(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.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(KE),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,i=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&ki(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield wh.FLOW_END,yield*this.parseLineStart();let o=0;for(;n[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),n[o]){case void 0:return"flow";case"#":return yield*this.pushCount(n.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(KE),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||ki(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")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 i=this.buffer.substring(0,r),n=i.indexOf(`
137
+ `,this.pos);if(n!==-1){for(;n!==-1;){let o=this.continueScalar(n+1);if(o===-1)break;n=i.indexOf(`
138
+ `,o)}n!==-1&&(r=n-(i[n-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 t=this.pos;for(;;){let r=this.buffer[++t];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=>ki(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":r+=1;break;case`
139
+ `:t=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
140
+ `)break}default:break e}if(!i&&!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(t+1);if(o===-1)break;t=this.buffer.indexOf(`
141
+ `,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
142
+ `;)i=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
143
+ `&&o>=this.pos&&o+1+r>a)t=o;else break}while(!0);return yield wh.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let o=this.buffer[i+1];if(ki(o)||t&&I_.has(o))break;r=i}else if(ki(n)){let o=this.buffer[i+1];if(n==="\r"&&(o===`
144
+ `?(i+=1,n=`
145
+ `,o=this.buffer[i+1]):r=i),o==="#"||t&&I_.has(o))break;if(n===`
146
+ `){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&I_.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield wh.SCALAR,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(KE),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(ki(i)||r&&I_.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!ki(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(ume.has(r))r=this.buffer[++t];else if(r==="%"&&P2.has(this.buffer[t+1])&&P2.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
147
+ `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
148
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||t&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(t){let r=this.pos,i=this.buffer[r];for(;!t(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};R2.Lexer=WE});var JE=I(C2=>{"use strict";var HE=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,i=this.lineStarts.length;for(;r<i;){let o=r+i>>1;this.lineStarts[o]<t?r=o+1:i=o}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let n=this.lineStarts[r-1];return{line:r,col:t-n+1}}}};C2.LineCounter=HE});var XE=I(j2=>{"use strict";var pme=Sg("process"),A2=x_(),fme=GE();function Zs(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function E2(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function N2(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function T_(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Wu(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function P_(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function O2(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Zs(t.start,"explicit-key-ind")&&!Zs(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,N2(t.value)?t.value.end?P_(t.value.end,t.sep):t.value.end=t.sep:P_(t.start,t.sep),delete t.sep)}var YE=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new fme.Lexer,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,r))yield*this.next(i);r||(yield*this.end())}*next(t){if(this.source=t,pme.env.LOG_TOKENS&&console.log("|",A2.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=A2.tokenType(t);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+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??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 i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&O2(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&E2(n.start)===-1&&(r.indent===0||n.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{E2(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=T_(this.peek(2)),i=Wu(r),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
149
+ `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
150
+ `,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.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)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){P_(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(n&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(o.push(this.sourceToken),t.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):n||r.value?(o.push(this.sourceToken),t.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)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Zs(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(N2(r.key)&&!Zs(r.sep,"newline")){let s=Wu(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:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Zs(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Wu(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Zs(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 s=this.flowScalar(this.type);n||r.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Zs(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 i&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){P_(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||Zs(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.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?t.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 n=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=T_(i),o=Wu(n);O2(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
151
+ `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
152
+ `,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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=T_(t),i=Wu(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=T_(t),i=Wu(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};j2.Parser=YE});var U2=I(kh=>{"use strict";var z2=ME(),mme=mh(),_h=yh(),hme=zA(),gme=nt(),yme=JE(),D2=XE();function M2(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new yme.LineCounter||null,prettyErrors:t}}function vme(e,t={}){let{lineCounter:r,prettyErrors:i}=M2(t),n=new D2.Parser(r?.addNewLine),o=new z2.Composer(t),s=Array.from(o.compose(n.parse(e)));if(i&&r)for(let a of s)a.errors.forEach(_h.prettifyError(e,r)),a.warnings.forEach(_h.prettifyError(e,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function L2(e,t={}){let{lineCounter:r,prettyErrors:i}=M2(t),n=new D2.Parser(r?.addNewLine),o=new z2.Composer(t),s=null;for(let a of o.compose(n.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new _h.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(s.errors.forEach(_h.prettifyError(e,r)),s.warnings.forEach(_h.prettifyError(e,r))),s}function $me(e,t,r){let i;typeof t=="function"?i=t:r===void 0&&t&&typeof t=="object"&&(r=t);let n=L2(e,r);if(!n)return null;if(n.warnings.forEach(o=>hme.warn(n.options.logLevel,o)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function bme(e,t,r){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=r??t??{};if(!n)return}return gme.isDocument(e)&&!i?e.toString(r):new mme.Document(e,i,r).toString(r)}kh.parse=$me;kh.parseAllDocuments=vme;kh.parseDocument=L2;kh.stringify=bme});var Vt=I(ht=>{"use strict";var wme=ME(),_me=mh(),kme=vE(),QE=yh(),Sme=Xm(),Vs=nt(),xme=Ls(),Ime=or(),Tme=qs(),Pme=Fs(),Rme=x_(),Cme=GE(),Ame=JE(),Eme=XE(),R_=U2(),q2=Gm();ht.Composer=wme.Composer;ht.Document=_me.Document;ht.Schema=kme.Schema;ht.YAMLError=QE.YAMLError;ht.YAMLParseError=QE.YAMLParseError;ht.YAMLWarning=QE.YAMLWarning;ht.Alias=Sme.Alias;ht.isAlias=Vs.isAlias;ht.isCollection=Vs.isCollection;ht.isDocument=Vs.isDocument;ht.isMap=Vs.isMap;ht.isNode=Vs.isNode;ht.isPair=Vs.isPair;ht.isScalar=Vs.isScalar;ht.isSeq=Vs.isSeq;ht.Pair=xme.Pair;ht.Scalar=Ime.Scalar;ht.YAMLMap=Tme.YAMLMap;ht.YAMLSeq=Pme.YAMLSeq;ht.CST=Rme;ht.Lexer=Cme.Lexer;ht.LineCounter=Ame.LineCounter;ht.Parser=Eme.Parser;ht.parse=R_.parse;ht.parseAllDocuments=R_.parseAllDocuments;ht.parseDocument=R_.parseDocument;ht.stringify=R_.stringify;ht.visit=q2.visit;ht.visitAsync=q2.visitAsync});import jM from"node:process";var $={};go($,{$brand:()=>AS,$input:()=>Qx,$output:()=>Xx,INVALID:()=>Gr,NEVER:()=>CS,TimePrecision:()=>s0,ZodAny:()=>vI,ZodArray:()=>_I,ZodBase64:()=>I$,ZodBase64URL:()=>T$,ZodBigInt:()=>jl,ZodBigIntFormat:()=>C$,ZodBoolean:()=>Nl,ZodCIDRv4:()=>S$,ZodCIDRv6:()=>x$,ZodCUID:()=>y$,ZodCUID2:()=>v$,ZodCatch:()=>qI,ZodCodec:()=>hf,ZodCompileAsyncError:()=>si,ZodCompileUnsupportedError:()=>Le,ZodCreditCard:()=>fI,ZodCustom:()=>gf,ZodCustomStringFormat:()=>Oa,ZodDate:()=>uf,ZodDefault:()=>jI,ZodDiscriminatedUnion:()=>SI,ZodE164:()=>P$,ZodEmail:()=>f$,ZodEmoji:()=>h$,ZodEnum:()=>Al,ZodError:()=>sY,ZodExactOptional:()=>O$,ZodFile:()=>AI,ZodFirstPartyTypeKind:()=>tT,ZodFunction:()=>YI,ZodGUID:()=>m$,ZodIBAN:()=>mI,ZodIPv4:()=>_$,ZodIPv6:()=>k$,ZodISODate:()=>ls,ZodISODateTime:()=>cs,ZodISODuration:()=>ds,ZodISOTime:()=>us,ZodInstanceOf:()=>eT,ZodIntersection:()=>xI,ZodIssueCode:()=>lY,ZodJWT:()=>R$,ZodKSUID:()=>w$,ZodLazy:()=>GI,ZodLiteral:()=>CI,ZodMAC:()=>pI,ZodMap:()=>PI,ZodNaN:()=>ZI,ZodNanoID:()=>g$,ZodNever:()=>bI,ZodNonOptional:()=>N$,ZodNull:()=>yI,ZodNullable:()=>NI,ZodNumber:()=>Ol,ZodNumberFormat:()=>Na,ZodObject:()=>df,ZodOptional:()=>ja,ZodPipe:()=>mf,ZodPrefault:()=>DI,ZodPreprocess:()=>VI,ZodPromise:()=>JI,ZodReadonly:()=>BI,ZodRealError:()=>pn,ZodRecord:()=>Cl,ZodSet:()=>RI,ZodString:()=>El,ZodStringFormat:()=>bt,ZodSuccess:()=>UI,ZodSymbol:()=>hI,ZodTemplateLiteral:()=>WI,ZodTransform:()=>EI,ZodTuple:()=>II,ZodType:()=>ke,ZodULID:()=>$$,ZodURL:()=>cf,ZodUUID:()=>qi,ZodUndefined:()=>gI,ZodUnion:()=>pf,ZodUnknown:()=>$I,ZodVoid:()=>wI,ZodXID:()=>b$,ZodXor:()=>kI,_ZodString:()=>p$,_default:()=>zI,_function:()=>QD,any:()=>ND,array:()=>Ne,base64:()=>mD,base64url:()=>hD,bigint:()=>RD,boolean:()=>er,catch:()=>FI,check:()=>eM,cidrv4:()=>pD,cidrv6:()=>fD,clone:()=>ot,codec:()=>HD,coerce:()=>nT,compile:()=>n0,config:()=>Wt,core:()=>ci,creditCard:()=>yD,cuid:()=>iD,cuid2:()=>oD,currencyCode:()=>kD,custom:()=>j$,date:()=>zD,decode:()=>oI,decodeAsync:()=>aI,deepPartial:()=>pM,describe:()=>tM,discriminatedUnion:()=>ff,e164:()=>gD,email:()=>G1,emoji:()=>rD,encode:()=>iI,encodeAsync:()=>sI,endsWith:()=>$l,enum:()=>Ir,exactOptional:()=>OI,file:()=>BD,flattenError:()=>fp,float32:()=>xD,float64:()=>ID,formatError:()=>mp,fromJSONSchema:()=>uM,function:()=>QD,getDiscriminatedOption:()=>Gx,getErrorMap:()=>dY,globalRegistry:()=>Sr,gt:()=>Li,gte:()=>Nn,guid:()=>H1,hash:()=>SD,hex:()=>_D,hostname:()=>wD,httpUrl:()=>tD,iban:()=>vD,includes:()=>yl,input:()=>mM,instanceof:()=>nM,int:()=>u$,int32:()=>TD,int64:()=>CD,intersection:()=>zl,invertCodec:()=>JD,ipv4:()=>lD,ipv6:()=>dD,iso:()=>za,json:()=>oM,jwt:()=>$D,keyof:()=>DD,ksuid:()=>cD,lazy:()=>HI,length:()=>Ca,literal:()=>ne,locales:()=>dl,looseObject:()=>xr,looseRecord:()=>qD,lowercase:()=>hl,lt:()=>Mi,lte:()=>On,mac:()=>uD,map:()=>FD,maxLength:()=>Ra,maxSize:()=>ns,memoizer:()=>Ap,meta:()=>rM,mime:()=>wl,minLength:()=>bo,minSize:()=>Ui,multipleOf:()=>rs,nan:()=>GD,nanoid:()=>nD,nativeEnum:()=>VD,negative:()=>Wv,never:()=>A$,nonnegative:()=>Hv,nonoptional:()=>LI,nonpositive:()=>Gv,normalize:()=>_l,null:()=>lf,nullable:()=>af,nullish:()=>KD,number:()=>st,object:()=>Y,optional:()=>$t,output:()=>hM,overwrite:()=>ai,parse:()=>eI,parseAsync:()=>tI,partialRecord:()=>UD,pipe:()=>d$,positive:()=>Kv,prefault:()=>MI,preprocess:()=>yf,prettifyError:()=>zS,promise:()=>XD,properties:()=>bl,property:()=>Jv,readonly:()=>KI,record:()=>wt,refine:()=>XI,regex:()=>ml,regexes:()=>En,registry:()=>$v,safeDecode:()=>lI,safeDecodeAsync:()=>dI,safeEncode:()=>cI,safeEncodeAsync:()=>uI,safeParse:()=>rI,safeParseAsync:()=>nI,set:()=>ZD,setErrorMap:()=>uY,size:()=>Pa,slugify:()=>Il,startsWith:()=>vl,strictObject:()=>MD,string:()=>A,stringFormat:()=>bD,stringbool:()=>iM,success:()=>WD,superRefine:()=>QI,symbol:()=>ED,templateLiteral:()=>YD,toJSONSchema:()=>Aa,toLowerCase:()=>Sl,toUpperCase:()=>xl,toZod:()=>op,transform:()=>E$,treeifyError:()=>jS,trim:()=>kl,tuple:()=>TI,uint32:()=>PD,uint64:()=>AD,ulid:()=>sD,undefined:()=>OD,union:()=>mt,unknown:()=>St,uppercase:()=>gl,url:()=>eD,util:()=>O,uuid:()=>J1,uuidv4:()=>Y1,uuidv6:()=>X1,uuidv7:()=>Q1,validate:()=>tl,validateAsync:()=>rl,void:()=>jD,withParser:()=>bv,xid:()=>aD,xor:()=>LD});var ci={};go(ci,{$ZodAny:()=>Oy,$ZodArray:()=>My,$ZodAsyncError:()=>un,$ZodBase64:()=>yy,$ZodBase64URL:()=>$y,$ZodBigInt:()=>xp,$ZodBigIntFormat:()=>Ry,$ZodBoolean:()=>ol,$ZodCIDRv4:()=>fy,$ZodCIDRv6:()=>hy,$ZodCUID:()=>oy,$ZodCUID2:()=>sy,$ZodCatch:()=>rv,$ZodCheck:()=>vt,$ZodCheckBigIntFormat:()=>_x,$ZodCheckEndsWith:()=>Nx,$ZodCheckGreaterThan:()=>Vg,$ZodCheckIncludes:()=>Ex,$ZodCheckLengthEquals:()=>Px,$ZodCheckLessThan:()=>Zg,$ZodCheckLowerCase:()=>Cx,$ZodCheckMaxLength:()=>Ix,$ZodCheckMaxSize:()=>kx,$ZodCheckMimeType:()=>Dx,$ZodCheckMinLength:()=>Tx,$ZodCheckMinSize:()=>Sx,$ZodCheckMultipleOf:()=>bx,$ZodCheckNumberFormat:()=>wx,$ZodCheckOverwrite:()=>Mx,$ZodCheckProperties:()=>zx,$ZodCheckProperty:()=>jx,$ZodCheckRegex:()=>Rx,$ZodCheckSizeEquals:()=>xx,$ZodCheckStartsWith:()=>Ox,$ZodCheckStringFormat:()=>nl,$ZodCheckUpperCase:()=>Ax,$ZodCodec:()=>al,$ZodCreditCard:()=>_y,$ZodCustom:()=>cv,$ZodCustomStringFormat:()=>Ty,$ZodCyclicError:()=>pv,$ZodDate:()=>Dy,$ZodDefault:()=>Xy,$ZodDiscriminatedUnion:()=>qy,$ZodE164:()=>by,$ZodEmail:()=>Xg,$ZodEmoji:()=>ny,$ZodEncodeError:()=>es,$ZodEnum:()=>Ky,$ZodError:()=>NS,$ZodExactOptional:()=>Jy,$ZodFile:()=>Gy,$ZodFunction:()=>sv,$ZodGUID:()=>Jg,$ZodIBAN:()=>Sy,$ZodIPv4:()=>uy,$ZodIPv6:()=>dy,$ZodISODate:()=>Vx,$ZodISODateTime:()=>Zx,$ZodISODuration:()=>Kx,$ZodISOTime:()=>Bx,$ZodIntersection:()=>Fy,$ZodJWT:()=>Iy,$ZodKSUID:()=>ly,$ZodLazy:()=>cl,$ZodLiteral:()=>Wy,$ZodMAC:()=>py,$ZodMap:()=>Vy,$ZodNaN:()=>nv,$ZodNanoID:()=>iy,$ZodNever:()=>jy,$ZodNonOptional:()=>ev,$ZodNull:()=>Ey,$ZodNullable:()=>Yy,$ZodNumber:()=>Sp,$ZodNumberFormat:()=>Py,$ZodObject:()=>Ly,$ZodObjectJIT:()=>Wx,$ZodOptional:()=>Tp,$ZodPipe:()=>Pp,$ZodPrefault:()=>Qy,$ZodPreprocess:()=>Hx,$ZodPromise:()=>av,$ZodReadonly:()=>iv,$ZodRealError:()=>dn,$ZodRecord:()=>Zy,$ZodRegistry:()=>vv,$ZodSet:()=>By,$ZodString:()=>ts,$ZodStringFormat:()=>ut,$ZodSuccess:()=>tv,$ZodSymbol:()=>Cy,$ZodTemplateLiteral:()=>ov,$ZodTransform:()=>Hy,$ZodTuple:()=>Ip,$ZodType:()=>$e,$ZodULID:()=>ay,$ZodURL:()=>ry,$ZodUUID:()=>Yg,$ZodUndefined:()=>Ay,$ZodUnion:()=>sl,$ZodUnknown:()=>Ny,$ZodVoid:()=>zy,$ZodXID:()=>cy,$ZodXor:()=>Uy,$brand:()=>AS,$constructor:()=>P,$input:()=>Qx,$output:()=>Xx,Doc:()=>ka,INVALID:()=>Gr,JSONSchema:()=>B1,JSONSchemaGenerator:()=>a$,NEVER:()=>CS,TimePrecision:()=>s0,URL_BAD_FORMAT:()=>qx,URL_UNPARSEABLE:()=>$p,ZodCompileAsyncError:()=>si,ZodCompileUnsupportedError:()=>Le,_any:()=>Uv,_array:()=>d0,_base64:()=>Jp,_base64url:()=>Yp,_bigint:()=>Nv,_boolean:()=>Ov,_catch:()=>G8,_check:()=>R1,_cidrv4:()=>Gp,_cidrv6:()=>Hp,_coercedBigint:()=>l0,_coercedBoolean:()=>c0,_coercedDate:()=>u0,_coercedNumber:()=>a0,_coercedString:()=>o0,_creditCard:()=>xv,_cuid:()=>qp,_cuid2:()=>Fp,_custom:()=>Xv,_date:()=>Vv,_decode:()=>Eg,_decodeAsync:()=>Ng,_default:()=>B8,_discriminatedUnion:()=>O8,_e164:()=>Xp,_email:()=>Op,_emoji:()=>Lp,_encode:()=>Ag,_encodeAsync:()=>Og,_endsWith:()=>$l,_enum:()=>L8,_file:()=>Yv,_float32:()=>Rv,_float64:()=>Cv,_gt:()=>Li,_gte:()=>Nn,_guid:()=>Np,_iban:()=>Iv,_includes:()=>yl,_int:()=>Pv,_int32:()=>Av,_int64:()=>jv,_intersection:()=>N8,_ipv4:()=>Kp,_ipv6:()=>Wp,_isoDate:()=>tf,_isoDateTime:()=>ef,_isoDuration:()=>nf,_isoTime:()=>rf,_jwt:()=>Qp,_ksuid:()=>Bp,_lazy:()=>X8,_length:()=>Ca,_literal:()=>q8,_lowercase:()=>hl,_lt:()=>Mi,_lte:()=>On,_mac:()=>Sv,_map:()=>D8,_max:()=>On,_maxLength:()=>Ra,_maxSize:()=>ns,_mime:()=>wl,_min:()=>Nn,_minLength:()=>bo,_minSize:()=>Ui,_multipleOf:()=>rs,_nan:()=>Bv,_nanoid:()=>Up,_nativeEnum:()=>U8,_negative:()=>Wv,_never:()=>Fv,_nonnegative:()=>Hv,_nonoptional:()=>K8,_nonpositive:()=>Gv,_normalize:()=>_l,_null:()=>Lv,_nullable:()=>V8,_number:()=>Tv,_optional:()=>Z8,_overwrite:()=>ai,_parse:()=>Hc,_parseAsync:()=>Jc,_pipe:()=>H8,_positive:()=>Kv,_promise:()=>Q8,_properties:()=>bl,_property:()=>Jv,_readonly:()=>J8,_record:()=>z8,_refine:()=>Qv,_regex:()=>ml,_safeDecode:()=>zg,_safeDecodeAsync:()=>Mg,_safeEncode:()=>jg,_safeEncodeAsync:()=>Dg,_safeParse:()=>Yc,_safeParseAsync:()=>Qc,_set:()=>M8,_size:()=>Pa,_slugify:()=>Il,_startsWith:()=>vl,_string:()=>kv,_stringFormat:()=>is,_stringbool:()=>n$,_success:()=>W8,_superRefine:()=>e$,_symbol:()=>Dv,_templateLiteral:()=>Y8,_toLowerCase:()=>Sl,_toUpperCase:()=>xl,_transform:()=>F8,_trim:()=>kl,_tuple:()=>j8,_uint32:()=>Ev,_uint64:()=>zv,_ulid:()=>Zp,_undefined:()=>Mv,_union:()=>A8,_unknown:()=>qv,_uppercase:()=>gl,_url:()=>fl,_uuid:()=>jp,_uuidv4:()=>zp,_uuidv6:()=>Dp,_uuidv7:()=>Mp,_void:()=>Zv,_xid:()=>Vp,_xor:()=>E8,base64Charset:()=>gy,base64urlCharset:()=>kp,canParseURL:()=>Fx,clone:()=>ot,compile:()=>n0,compileFn:()=>wv,config:()=>Wt,createStandardJSONSchemaMethod:()=>Tl,createToJSONSchemaMethod:()=>f0,decode:()=>Cj,decodeAsync:()=>Ej,describe:()=>t$,encode:()=>Rj,encodeAsync:()=>Aj,extractDefs:()=>ss,finalize:()=>as,flattenError:()=>fp,formatError:()=>mp,getDiscriminatedOption:()=>Gx,globalConfig:()=>vr,globalRegistry:()=>Sr,handleUnrepresentable:()=>ur,initializeContext:()=>os,isBackEdge:()=>mv,isRecursiveSchema:()=>fv,isValidBase64:()=>_p,isValidBase64URL:()=>vy,isValidCIDRv6:()=>my,isValidCreditCard:()=>wy,isValidIBAN:()=>ky,isValidIPv6:()=>wp,isValidJWT:()=>xy,locales:()=>dl,memoizer:()=>Ap,mergeValues:()=>il,meta:()=>r$,parse:()=>ba,parseAsync:()=>wa,parseURLObject:()=>rz,prettifyError:()=>zS,process:()=>ft,processSchema:()=>ft,regexes:()=>En,registry:()=>$v,safeDecode:()=>Nj,safeDecodeAsync:()=>zj,safeEncode:()=>Oj,safeEncodeAsync:()=>jj,safeParse:()=>Xc,safeParseAsync:()=>el,standardProps:()=>Hg,stripTabAndNewline:()=>bp,toDotPath:()=>Tj,toJSONSchema:()=>Aa,toZod:()=>op,treeifyError:()=>jS,urlHostnameOk:()=>ey,urlProtocolOk:()=>ty,util:()=>O,validate:()=>tl,validateAsync:()=>rl,validateURL:()=>Qg,version:()=>Lx,withParser:()=>bv});var O={};go(O,{BIGINT_FORMAT_RANGES:()=>lp,CONSTANT_CATCH:()=>Rg,Class:()=>$S,NUMBER_FORMAT_RANGES:()=>cp,aborted:()=>Wr,allowsEval:()=>_S,assert:()=>fJ,assertEqual:()=>lJ,assertIs:()=>dJ,assertNever:()=>pJ,assertNotEqual:()=>uJ,assignProp:()=>kr,attachSchema:()=>Pg,base64ToUint8Array:()=>wj,base64urlToUint8Array:()=>xJ,cached:()=>Bc,captureStackTrace:()=>Ig,cleanEnum:()=>SJ,cleanRegex:()=>vo,clone:()=>ot,cloneDef:()=>gJ,codePointLength:()=>$a,constantCatch:()=>PS,createTransparentProxy:()=>_J,defineLazy:()=>bS,defineLazyInternal:()=>Ie,derived:()=>RJ,esc:()=>Kr,escapeRegex:()=>Bn,explicitlyAborted:()=>xS,extend:()=>hj,finalizeIssue:()=>ln,floatSafeRemainder:()=>sp,getElementAtPath:()=>yJ,getEnumValues:()=>Zc,getLengthableOrigin:()=>dp,getParsedType:()=>wJ,getSizableOrigin:()=>up,hexToUint8Array:()=>TJ,hide:()=>pp,installLazyProp:()=>TS,isObject:()=>va,isPlainObject:()=>Vn,issue:()=>Gc,joinValues:()=>R,jsonStringifyReplacer:()=>Vc,members:()=>IS,merge:()=>vj,mergeDefs:()=>Zn,normalizeParams:()=>F,nullish:()=>xg,numKeys:()=>bJ,objectClone:()=>mJ,omit:()=>mj,optionalKeys:()=>SS,own:()=>Di,parsedType:()=>j,partial:()=>$j,pick:()=>fj,prefixIssues:()=>cn,primitiveTypes:()=>kS,promiseAllObject:()=>vJ,propertyKeyTypes:()=>ap,randomString:()=>$J,rawShape:()=>Kc,required:()=>bj,safeExtend:()=>yj,shallowClone:()=>Wc,slugify:()=>wS,stringifyPrimitive:()=>N,toZod:()=>op,uint8ArrayToBase64:()=>_j,uint8ArrayToBase64url:()=>IJ,uint8ArrayToHex:()=>PJ,unwrapMessage:()=>Fc});function lJ(e){return e}function uJ(e){return e}function op(){return e=>e}function dJ(e){}function pJ(e){throw new Error("Unexpected value in exhaustive check")}function fJ(e){}function Zc(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function R(e,t="|"){return e.map(r=>N(r)).join(t)}function Vc(e,t){return typeof t=="bigint"?t.toString():t}var vS=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Bc(e){return new vS(e)}function xg(e){return e==null}function vo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function sp(e,t){let r=e/t,i=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var uj=Symbol("evaluating");function bS(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==uj)return i===void 0&&(i=uj,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function mJ(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function kr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Kc(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function yo(e){return Kc(e._zod.def)??e._zod.def.shape}function dj(e,t,r){Object.defineProperty(e,t,{get(){let i=r();return kr(this,t,i),i},enumerable:!0,configurable:!0})}function pj(e,t,r){t in e?kr(e,t,r):e[t]=r}function ya(e,t,r,i){let n=yo(t);for(let o of r){let s=Object.getOwnPropertyDescriptor(n,o);s.enumerable&&(s.get?dj(e,o,()=>{let a=t._zod.def.shape[o];return i?i(a,o):a}):pj(e,o,i?i(s.value,o):s.value))}}function hJ(e,t){for(let r of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,r);i.enumerable&&(i.get?dj(e,r,()=>t[r]):pj(e,r,i.value))}}function Zn(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function gJ(e){return Zn(e._zod.def)}function yJ(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function vJ(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function $J(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function Kr(e){return JSON.stringify(e)}function wS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ig="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function va(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _S=Bc(()=>{if(vr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Vn(e){if(va(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(va(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Wc(e){return Vn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function bJ(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var wJ=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ap=new Set(["string","number","symbol"]),kS=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function F(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function _J(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function N(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function SS(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var cp={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]},lp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function fj(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return ya(o,e,Tg(e,t)),ot(e,Zn(r,{shape:o,checks:[]}))}function Tg(e,t){let r=yo(e),i=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&i.push(n)}return i}function mj(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Tg(e,t)),s={};return ya(s,e,Reflect.ownKeys(yo(e)).filter(a=>!o.has(a))),ot(e,Zn(r,{shape:s,checks:[]}))}function hj(e,t){if(!Vn(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=yo(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ot(e,Zn(e._zod.def,{shape:gj(e,t)}))}function gj(e,t){let r={};return ya(r,e,Reflect.ownKeys(yo(e))),hJ(r,t),r}function yj(e,t){if(!Vn(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ot(e,Zn(e._zod.def,{shape:gj(e,t)}))}function vj(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ya(r,e,Reflect.ownKeys(yo(e))),ya(r,t,Reflect.ownKeys(yo(t)));let i=Zn(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ot(e,i)}function $j(e,t,r,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let a=r?new Set(Tg(t,r)):void 0,c={};return ya(c,t,Reflect.ownKeys(yo(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),ot(t,Zn(t._zod.def,{shape:c,checks:[]}))}function bj(e,t,r){let i=r?new Set(Tg(t,r)):void 0,n={};return ya(n,t,Reflect.ownKeys(yo(t)),(o,s)=>i&&!i.has(s)?o:new e({type:"nonoptional",innerType:o})),ot(t,Zn(t._zod.def,{shape:n}))}function Wr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xS(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function cn(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Fc(e){return typeof e=="string"?e:e?.message}function Pg(e,t,r){var i;for(let n=t;n<e.length;n++)(i=e[n]).schema??(i.schema=r)}function ln(e,t,r){var i;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Fc(e.inst?._zod.def?.error?.(e))??Fc(o?.(e))??Fc(t?.error?.(e))??Fc(r.customError?.(e))??Fc(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function up(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var kJ=/[\uD800-\uDBFF]/;function $a(e){let t=e.length;if(!kJ.test(e))return t;let r=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(r--,i++);return r}function dp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function j(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Gc(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function SJ(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function wj(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function _j(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function xJ(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return wj(t+r)}function IJ(e){return _j(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function TJ(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function PJ(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var $S=class{constructor(...t){}};function IS(e,t){for(let r in t){let i=Object.getOwnPropertyDescriptor(t,r);i.get?Object.defineProperty(e,r,{...i,enumerable:!1}):CJ(e,r,i.value)}}function Di(e,t,r,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:r}),r}function pp(e,t,r){return Di(e,t,r,!1)}function RJ(e,t){for(let r in e){let i=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Di(this,r,i(this))},set(n){Di(this,r,n)}})}return t}function CJ(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Di(this,t,r.bind(this))},set(i){Di(this,t,i)}})}function AJ(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var yS,Qo=!1,EJ={configurable:!0,get(){Qo=!0}};function Ie(e,t,r){let i=Object.getPrototypeOf(e._zod);if(t in i&&yS!==e._zod){yS=void 0;return}yS=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,EJ);let n=Qo;Qo=!1;try{let o=r(this);return Qo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Qo=Qo||n,o}catch(o){throw delete this[t],Qo=Qo||n,o}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function TS(e,t,r,i){let n=AJ(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Rg="~constantCatch";function PS(e){let t=()=>e;return t[Rg]=!0,t}var kj,CS=Object.freeze({status:"aborted"}),RS={value:void 0,enumerable:!1},Sj="captureStackTrace"in Error?Error:null;function OJ(e){let t=Sj;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Sj=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function P(e,t,r,i){let n={};function o(p){this.def=p,this.constr=d,this.traits=new Set}o.prototype=n;let s=r,a=s&&new WeakSet;function c(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{RS.value=new o(f);try{Object.defineProperty(p,"_zod",RS)}finally{RS.value=void 0}}if(p._zod.traits.add(e),t(p,f),a){let h=Object.getPrototypeOf(p),g=p._zod.constr.prototype,y=h;for(;y&&y!==g;)y=Object.getPrototypeOf(y);let v=y??h;a.has(v)||(a.add(v),IS(v,s))}let m=d.prototype;for(let h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in p||(p[h]=m[h].bind(p)))}let l=i?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(p){let f=i?.Parent?OJ(u):this;c(f,p);let m=f._zod.deferred;if(m){for(let g of m)g();f._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(f),f}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>i?.Parent&&p instanceof i.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var AS=Symbol("zod_brand"),un=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},es=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(kj=globalThis).__zod_globalConfig??(kj.__zod_globalConfig={});var vr=globalThis.__zod_globalConfig;function Wt(e){return e&&Object.assign(vr,e),vr}function NJ(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Vc,2)),e.message}function jJ(e){this._zod.message=e}var zJ={get:NJ,set:jJ,enumerable:!0,configurable:!0},OS={value:void 0,enumerable:!1},xj=new WeakSet([Object.prototype,Error.prototype]),Ij=(e,t)=>{e.name="$ZodError",OS.value=t,Object.defineProperty(e,"issues",OS),OS.value=void 0,Object.defineProperty(e,"message",zJ);let r=Object.getPrototypeOf(e);xj.has(r)||(xj.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},NS=P("$ZodError",Ij),dn=P("$ZodError",Ij,void 0,{Parent:Error});function DJ(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function fp(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?DJ(r,n.path[0],()=>[]).push(t(n)):i.push(t(n));return{formErrors:i,fieldErrors:r}}function mp(e,t=r=>r.message){let r={_errors:[]},i=(n,o=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(t(s));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(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[u];d&&p._errors.push(t(s)),c=p,l++}}}};return i(e),r}function jS(e,t=r=>r.message){let r={errors:[]},i=(n,o=[])=>{var s;for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0){r.errors.push(t(a));continue}let l=r,u=0;for(;u<c.length;){let d=c[u],p=u===c.length-1;typeof d=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,d)||Object.defineProperty(l.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[d]):(l.items??(l.items=[]),(s=l.items)[d]??(s[d]={errors:[]}),l=l.items[d]),p&&l.errors.push(t(a)),u++}}};return i(e),r}function Tj(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function zS(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${Tj(i.path)}`);return t.join(`
153
+ `)}function Cg(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Hc=e=>{let t=(r,i,n,o)=>{let s=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:i,issues:[]},s);if(a instanceof Promise)throw new un;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>ln(l,s,Wt())));throw Ig(c,o?.callee??t),c}return a.value};return t},ba=Hc(dn),Jc=e=>{let t=async(r,i,n,o)=>{let s=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:i,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??e)(a.issues.map(l=>ln(l,s,Wt())));throw Ig(c,o?.callee??t),c}return a.value};return t},wa=Jc(dn),Yc=e=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new un;return o.issues.length?Pj(e,o.issues,n):{success:!0,data:o.value}},Xc=Yc(dn);function Pj(e,t,r){let i;return{success:!1,get error(){return i||(i=new e(t.map(n=>ln(n,r,Wt()))),t=void 0,r=void 0),i},set error(n){i=n,t=void 0,r=void 0}}}var Qc=e=>async(t,r,i)=>{let n=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?Pj(e,o.issues,n):{success:!0,data:o.value}},el=Qc(dn),LJ=Symbol.for("zod.compile.invalid"),UJ=Symbol.for("zod.compile.fallback"),tl=((e,t,r)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==LJ)return!0;if(i.definite===!0&&r===void 0)return!1}return qJ(e,t,r)});function qJ(e,t,r){let i=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,o;if(n?(i[UJ]=!0,o=n({value:t,issues:[]},i)):o=e._zod.run({value:t,issues:[]},i),o instanceof Promise)throw new un;return o.issues.length===0}var rl=async(e,t,r)=>{let i=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length===0},Ag=e=>{let t=Hc(e),r=(i,n,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(i,n,a,Cg(r,s))};return r},Rj=Ag(dn),Eg=e=>{let t=Hc(e),r=(i,n,o,s)=>t(i,n,o,Cg(r,s));return r},Cj=Eg(dn),Og=e=>{let t=Jc(e),r=async(i,n,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(i,n,a,Cg(r,s))};return r},Aj=Og(dn),Ng=e=>{let t=Jc(e),r=async(i,n,o,s)=>await t(i,n,o,Cg(r,s));return r},Ej=Ng(dn),jg=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Yc(e)(t,r,n)},Oj=jg(dn),zg=e=>(t,r,i)=>Yc(e)(t,r,i),Nj=zg(dn),Dg=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Qc(e)(t,r,n)},jj=Dg(dn),Mg=e=>async(t,r,i)=>Qc(e)(t,r,i),zj=Mg(dn);var En={};go(En,{anyString:()=>lx,base64:()=>ex,base64url:()=>tx,bigint:()=>dx,boolean:()=>px,browserEmail:()=>HJ,cidrv4:()=>XS,cidrv6:()=>QS,creditCard:()=>Lg,cuid:()=>MS,cuid2:()=>LS,currencyCode:()=>ox,date:()=>sx,datetime:()=>cx,domain:()=>nx,duration:()=>BS,e164:()=>ix,email:()=>WS,emoji:()=>GS,extendedDuration:()=>FJ,guid:()=>KS,hex:()=>yx,hostname:()=>rx,html5Email:()=>KJ,httpProtocol:()=>hp,iban:()=>Ug,idnEmail:()=>GJ,integer:()=>gp,ipv4:()=>HS,ipv6:()=>JS,ksuid:()=>FS,lowercase:()=>hx,mac:()=>YS,md5_base64:()=>QJ,md5_base64url:()=>e3,md5_hex:()=>XJ,nanoid:()=>ZS,nanoidOfLength:()=>VS,null:()=>fx,number:()=>$o,rfc5322Email:()=>WJ,sha1_base64:()=>r3,sha1_base64url:()=>n3,sha1_hex:()=>t3,sha256_base64:()=>o3,sha256_base64url:()=>s3,sha256_hex:()=>i3,sha384_base64:()=>c3,sha384_base64url:()=>l3,sha384_hex:()=>a3,sha512_base64:()=>d3,sha512_base64url:()=>p3,sha512_hex:()=>u3,string:()=>ux,time:()=>ax,ulid:()=>US,undefined:()=>mx,unicodeEmail:()=>Dj,uppercase:()=>gx,uuid:()=>_a,uuid4:()=>ZJ,uuid6:()=>VJ,uuid7:()=>BJ,xid:()=>qS});var MS=/^[cC][0-9a-z]{6,}$/,LS=/^[0-9a-z]+$/,US=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,qS=/^[0-9a-vA-V]{20}$/,FS=/^[A-Za-z0-9]{27}$/,ZS=/^[a-zA-Z0-9_-]{21}$/;function VS(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var BS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,FJ=/^[-+]?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)?)??$/,KS=/^([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})$/,_a=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,ZJ=_a(4),VJ=_a(6),BJ=_a(7),WS=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,WJ=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Dj=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,GJ=Dj,HJ=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,JJ="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function GS(){return new RegExp(JJ,"u")}var HS=/^(?:(?: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])$/,JS=/^(([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}|:))$/,YS=e=>{let t=Bn(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},XS=/^((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])$/,QS=/^(([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])$/,ex=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tx=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,rx=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,nx=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,hp=/^https?$/,ix=/^\+[1-9]\d{6,14}$/,Lg=/^\d(?:[ -]?\d){11,18}$/,ox=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Ug=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Mj="(?:(?:\\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])))";function YJ(e){return new RegExp(`^${e}$`)}var sx=YJ(Mj);function DS(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ax(e){return new RegExp(`^${DS(e)}$`)}function cx(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${DS({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${r}|${DS({precision:e.precision})}`:r;return new RegExp(`^${Mj}T(?:${i})$`)}var lx=/^[\s\S]{0,}$/,ux=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},dx=/^-?\d+n?$/,gp=/^-?\d+$/,$o=/^-?\d+(?:\.\d+)?$/,px=/^(?:true|false)$/i,fx=/^null$/i;var mx=/^undefined$/i;var hx=/^[^A-Z]*$/,gx=/^[^a-z]*$/,yx=/^[0-9a-fA-F]*$/;function yp(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function vp(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var XJ=/^[0-9a-fA-F]{32}$/,QJ=yp(22,"=="),e3=vp(22),t3=/^[0-9a-fA-F]{40}$/,r3=yp(27,"="),n3=vp(27),i3=/^[0-9a-fA-F]{64}$/,o3=yp(43,"="),s3=vp(43),a3=/^[0-9a-fA-F]{96}$/,c3=yp(64,""),l3=vp(64),u3=/^[0-9a-fA-F]{128}$/,d3=yp(86,"=="),p3=vp(86);var vt=P("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),vx=e=>{let t=e.value;return!xg(t)&&t.size!==void 0},$x=e=>{let t=e.value;return!xg(t)&&t.length!==void 0},qg={number:"number",bigint:"bigint",object:"date"},Zg=P("$ZodCheckLessThan",(e,t)=>{vt.init(e,t);let r=qg[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:qg[typeof i.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vg=P("$ZodCheckGreaterThan",(e,t)=>{vt.init(e,t);let r=qg[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:qg[typeof i.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bx=P("$ZodCheckMultipleOf",(e,t)=>{vt.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):sp(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wx=P("$ZodCheckNumberFormat",(e,t)=>{vt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,o]=cp[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),_x=P("$ZodCheckBigIntFormat",(e,t)=>{vt.init(e,t);let[r,i]=lp[t.format];e._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),kx=P("$ZodCheckMaxSize",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=vx),e._zod.check=i=>{let n=i.value;n.size<=t.maximum||i.issues.push({origin:up(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Sx=P("$ZodCheckMinSize",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=vx),e._zod.check=i=>{let n=i.value;n.size>=t.minimum||i.issues.push({origin:up(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),xx=P("$ZodCheckSizeEquals",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=vx),e._zod.check=i=>{let n=i.value,o=n.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:up(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Ix=P("$ZodCheckMaxLength",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=$x),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>t.maximum?$a(n):o)<=t.maximum)return;let a=dp(n);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Tx=P("$ZodCheckMinLength",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=$x),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>=t.minimum&&o<t.minimum*2?$a(n):o)>=t.minimum)return;let a=dp(n);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Px=P("$ZodCheckLengthEquals",(e,t)=>{var r;vt.init(e,t),(r=e._zod.def).when??(r.when=$x),e._zod.check=i=>{let n=i.value,o=n.length,s=typeof n=="string"&&o>=t.length&&o<=t.length*2?$a(n):o;if(s===t.length)return;let a=dp(n),c=s>t.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),nl=P("$ZodCheckStringFormat",(e,t)=>{var r,i;vt.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),Rx=P("$ZodCheckRegex",(e,t)=>{nl.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Cx=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hx),nl.init(e,t)}),Ax=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gx),nl.init(e,t)}),Ex=P("$ZodCheckIncludes",(e,t)=>{vt.init(e,t);let r=Bn(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=i,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ox=P("$ZodCheckStartsWith",(e,t)=>{vt.init(e,t);let r=new RegExp(`^${Bn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Nx=P("$ZodCheckEndsWith",(e,t)=>{vt.init(e,t);let r=new RegExp(`.*${Bn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Fg(e,t,r){e.issues.length&&t.issues.push(...cn(r,e.issues))}var jx=P("$ZodCheckProperty",(e,t)=>{vt.init(e,t),e._zod.check=r=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>Fg(n,r,t.property));Fg(i,r,t.property)}}),zx=P("$ZodCheckProperties",(e,t)=>{vt.init(e,t),pp(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let n=i.value,o;for(let[s,a]of r){let c=a._zod.run({value:n[s],issues:[]},{});c instanceof Promise?(o??(o=[]),o.push(c.then(l=>Fg(l,i,s)))):Fg(c,i,s)}if(o)return Promise.all(o).then(()=>{})}}),Dx=P("$ZodCheckMimeType",(e,t)=>{vt.init(e,t);let r=new Set(t.mime);e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),Mx=P("$ZodCheckOverwrite",(e,t)=>{vt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ka=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
154
+ `).filter(s=>s),n=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
155
+ ${r.join(`
156
+ `)}
157
+ };`)(...Object.values(this.closed))}};var Lx={major:4,minor:6,patch:5};var $e=P("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Lx;let i=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,l)=>{if(a.memo)return a;let u=Wr(a),d;for(let p of c){if(p._zod.def.when){if(xS(a)||!p._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,m=p._zod.check(a);if(m instanceof Promise&&l?.async===!1)throw new un;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==f&&(Pg(a.issues,f,e),u||(u=Wr(a,f)))});else{if(a.issues.length===f)continue;Pg(a.issues,f,e),u||(u=Wr(a,f))}}return d?d.then(()=>a):a},s=(a,c,l)=>{if(Wr(a))return a.aborted=!0,a;let u=o(c,n,l);if(u instanceof Promise){if(l.async===!1)throw new un;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,a,c)):s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new un;return l.then(u=>o(u,n,c))}return o(l,n,c)}}},{get"~standard"(){return pp(this,"~standard",Hg(this))},set"~standard"(e){Di(this,"~standard",e)}}),tz=(e,t)=>e.issues.length?{issues:e.issues.map(r=>ln(r,t,Wt()))}:{value:e.value};async function f3(e,t){let r={async:!0};return tz(await e._zod.run({value:t,issues:[]},r),r)}function Hg(e){return{validate:t=>{let r={async:!1};try{let i=e._zod.run({value:t,issues:[]},r);if(!(i instanceof Promise))return tz(i,r)}catch{}return f3(e,t)},vendor:"zod",version:1}}var ts=P("$ZodString",(e,t)=>{$e.init(e,t),e._zod.pattern=t.pattern??lx,e._zod.parse=(r,i)=>{if(t.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:e}),r}}),ut=P("$ZodStringFormat",(e,t)=>{nl.init(e,t),ts.init(e,t)}),Jg=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=KS),ut.init(e,t)}),Yg=P("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_a(i))}else t.pattern??(t.pattern=_a());ut.init(e,t)}),Xg=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=WS),ut.init(e,t)}),qx=1,$p=2;function Fx(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Qg(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Fx(e)||$p:rz(e,t)}function rz(e,t){if(!t.normalize&&t.protocol?.source===hp.source&&!/^https?:\/\//i.test(e))return qx;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??$p}return new URL(e)}catch{return $p}}var m3=/[\t\n\r]/g;function bp(e){return e.replace(m3,"")}function ey(e,t){return t.lastIndex=0,t.test(e.hostname)}function ty(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ry=P("$ZodURL",(e,t)=>{ut.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),n=Qg(i,t);if(n===qx){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===$p){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=bp(i);return}t.hostname&&!ey(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!ty(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:bp(i);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ny=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=GS()),ut.init(e,t)}),iy=P("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ZS:VS(t.length)),ut.init(e,t)}),oy=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=MS),ut.init(e,t)}),sy=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=LS),ut.init(e,t)}),ay=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=US),ut.init(e,t)}),cy=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qS),ut.init(e,t)}),ly=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=FS),ut.init(e,t)}),Zx=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=cx(t)),ut.init(e,t)}),Vx=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sx),ut.init(e,t)}),Bx=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ax(t)),ut.init(e,t)}),Kx=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=BS),ut.init(e,t)}),uy=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=HS),ut.init(e,t)}),h3=/^[0-9a-fA-F:.]+$/;function wp(e){return h3.test(e)?Fx(`http://[${e}]`):!1}var dy=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=JS),ut.init(e,t),e._zod.check=r=>{wp(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),py=P("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=YS(t.delimiter)),ut.init(e,t)}),fy=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=XS),ut.init(e,t)});function my(e){let t=e.split("/");if(t.length!==2)return!1;let[r,i]=t;if(!i)return!1;let n=Number(i);return`${n}`!==i||n<0||n>128?!1:wp(r)}var hy=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=QS),ut.init(e,t),e._zod.check=r=>{my(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function _p(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var gy=/^[0-9a-zA-Z+/]*={0,2}$/,yy=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gy),ut.init(e,t),e._zod.check=r=>{_p(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),kp=/^[A-Za-z0-9_-]*$/;function vy(e){if(!kp.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _p(r)}var $y=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kp),ut.init(e,t),e._zod.check=r=>{vy(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),by=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ix),ut.init(e,t)}),g3=/[- ]/g;function y3(e){let t=e.length,r=1,i=0;for(;t;){let n=e.charCodeAt(--t)-48;r^=1,i+=r?[0,2,4,6,8,1,3,5,7,9][n]:n}return i%10===0}function wy(e){return Lg.test(e)?y3(e.replace(g3,"")):!1}var _y=P("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Lg),ut.init(e,t),e._zod.check=r=>{wy(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function v3(e){let t=0,r=e.length;for(let i=4;i<r;i++){let n=e.charCodeAt(i);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}for(let i=0;i<4;i++){let n=e.charCodeAt(i);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}return t===1}function ky(e){return Ug.test(e)?v3(e):!1}var Sy=P("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Ug),ut.init(e,t),e._zod.check=r=>{ky(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function xy(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Iy=P("$ZodJWT",(e,t)=>{ut.init(e,t),e._zod.check=r=>{xy(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ty=P("$ZodCustomStringFormat",(e,t)=>{ut.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Sp=P("$ZodNumber",(e,t)=>{$e.init(e,t),e._zod.pattern=$o,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),Py=P("$ZodNumberFormat",(e,t)=>{wx.init(e,t),Sp.init(e,t)}),ol=P("$ZodBoolean",(e,t)=>{$e.init(e,t),e._zod.pattern=px,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),xp=P("$ZodBigInt",(e,t)=>{$e.init(e,t),e._zod.pattern=dx,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Ry=P("$ZodBigIntFormat",(e,t)=>{_x.init(e,t),xp.init(e,t)}),Cy=P("$ZodSymbol",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Ay=P("$ZodUndefined",(e,t)=>{$e.init(e,t),e._zod.pattern=mx,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Ey=P("$ZodNull",(e,t)=>{$e.init(e,t),e._zod.pattern=fx,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Oy=P("$ZodAny",(e,t)=>{$e.init(e,t),e._zod.parse=r=>r}),Ny=P("$ZodUnknown",(e,t)=>{$e.init(e,t),e._zod.parse=r=>r}),jy=P("$ZodNever",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),zy=P("$ZodVoid",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Dy=P("$ZodDate",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:e}),r}});function Uj(e,t,r){e.issues.length&&t.issues.push(...cn(r,e.issues)),t.value[r]=e.value}var My=P("$ZodArray",(e,t)=>{$e.init(e,t);let r=vr.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),i;i.value=r?r.alloc(e,i,Array(o.length),n):Array(o.length);let s=[],a=n?.abortEarly;for(let c=0;c<o.length;c++){let l=o[c],u=t.element._zod.run({value:l,issues:[]},n);if(u instanceof Promise)s.push(u.then(d=>Uj(d,i,c)));else if(Uj(u,i,c),a&&u.issues.length!==0&&Wr(u))break}return s.length?Promise.all(s).then(()=>i):i}});function Gg(e,t,r,i,n,o){let s=r in i,a=o==="optional";if(!(!s&&a&&n==="optional")){if(e.issues.length){if(n!==void 0&&a&&!s)return;t.issues.push(...cn(r,e.issues))}if(!s&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||n==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var $3=[];function nz(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),i=r.length?r:$3,n=i.length?[...t,...i]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let o=SS(e.shape);return{...e,allKeys:n,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function iz(e,t,r,i,n,o,s){let a=[],c=n.keySet,l=n.catchall._zod,u=l.def.type,d=l.optin,p=l.optout,f=0;for(let m in t){if(s&&r.issues.length!==f){if(Wr(r,f))break;f=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:t[m],issues:[]},i);h instanceof Promise?e.push(h.then(g=>Gg(g,r,m,t,d,p))):Gg(h,r,m,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Ly=P("$ZodObject",(e,t)=>{$e.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),i=r?.get?r.get.raw:t.shape??{};if(i){let l=()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=i,Object.defineProperty(t,"shape",{get:l})}let n=Bc(()=>nz(t));Ie(e,"propValues",l=>{let u=l.def.shape,d={};for(let p in u){let f=u[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||kr(d,p,new Set);for(let m of f.values)d[p].add(m);f.optin!==void 0&&d[p].add(void 0)}}return d});let o=va,s=t.catchall,a,c=vr.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=n.value);let d=l.value;if(!o(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let p=[],f=a.shape,m=u?.abortEarly,h=l.issues.length;for(let g of a.allKeys){if(m&&l.issues.length!==h){if(Wr(l,h))break;h=l.issues.length}if(g==="__proto__")continue;let y=f[g],v=y._zod.optin,b=y._zod.optout,_=y._zod.run({value:d[g],issues:[]},u);_ instanceof Promise?p.push(_.then(k=>Gg(k,l,g,d,v,b))):Gg(_,l,g,d,v,b)}return s?iz(p,d,l,u,n.value,e,m===!0):p.length?Promise.all(p).then(()=>l):l}}),Wx=P("$ZodObjectJIT",(e,t)=>{Ly.init(e,t);let r=e._zod.parse,i=Bc(()=>nz(t)),n=vr.memoizer,o=f=>{let m=i.value,h=m.symbolKeys,g=new ka(["payload","ctx"],{shape:f,inst:e,memo:n,syms:h}),y=k=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,v=(k,x)=>`
158
+ let ${k}_ab = false;
159
+ for (let i = 0; i < ${k}.issues.length; i++) {
160
+ const iss = ${k}.issues[i];
161
+ iss.path = iss.path ? [${x}, ...iss.path] : [${x}];
162
+ payload.issues.push(iss);
163
+ if (iss.continue !== true) ${k}_ab = true;
164
+ }
165
+ if (${k}_ab && ctx && ctx.abortEarly) {
166
+ payload.value = newResult;
167
+ return payload;
168
+ }`;g.write("const input = payload.value;");let b=Object.create(null),_=0;for(let k of m.allKeys)b[k]=`key_${_++}`;g.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of m.allKeys){if(k==="__proto__")continue;let x=b[k],S=typeof k=="symbol"?`syms[${h.indexOf(k)}]`:Kr(k),C=`${S} in input`,E=f[k],U=E?._zod?.optin,V=U!==void 0,X=E?._zod?.optout==="optional";if(g.write(`const ${x} = ${y(S)};`),V&&X){let J=U==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;g.write(`
169
+ const ${x}_present = ${C};
170
+ if (!${x}.issues.length || ${x}_present) {
171
+ if (${x}.issues.length) {${v(x,S)}
172
+ }
173
+
174
+ if (${J}) {
175
+ newResult[${S}] = ${x}.value;
176
+ }
177
+ }
178
+
179
+ `)}else V?(g.write(`
180
+ if (${x}.issues.length) {${v(x,S)}
181
+ }
182
+ `),U==="defaulted"?g.write(`newResult[${S}] = ${x}.value;`):g.write(`
183
+ if (${x}.value !== undefined || ${C}) {
184
+ newResult[${S}] = ${x}.value;
185
+ }
186
+ `)):g.write(`
187
+ const ${x}_present = ${C};
188
+ if (${x}.issues.length) {${v(x,S)}
189
+ }
190
+ if (!${x}_present && !${x}.issues.length) {
191
+ payload.issues.push({
192
+ code: "invalid_type",
193
+ expected: "nonoptional",
194
+ input: undefined,
195
+ path: [${S}]
196
+ });
197
+ if (ctx && ctx.abortEarly) {
198
+ payload.value = newResult;
199
+ return payload;
200
+ }
201
+ }
202
+
203
+ if (${x}_present) {
204
+ newResult[${S}] = ${x}.value;
205
+ }
206
+
207
+ `)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},s,a=va,c=!vr.jitless,u=c&&_S.value,d=t.catchall,p;e._zod.parse=(f,m)=>{p??(p=i.value);let h=f.value;return a(h)?c&&u&&m?.async===!1&&m.jitless!==!0?(s||(s=o(t.shape)),f=s(f,m),d?iz([],h,f,m,p,e,m?.abortEarly===!0):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function qj(e,t,r,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let n=e.filter(o=>!Wr(o));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>ln(s,i,Wt())))}),t)}var sl=P("$ZodUnion",(e,t)=>{$e.init(e,t),Ie(e,"optin",i=>i.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":i.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),Ie(e,"optout",i=>i.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ie(e,"values",i=>{if(i.def.options.every(n=>n._zod.values))return new Set(i.def.options.flatMap(n=>Array.from(n._zod.values)))}),Ie(e,"pattern",i=>{if(i.def.options.every(n=>n._zod.pattern)){let n=i.def.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>vo(o.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},n);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>qj(a,i,e,n)):qj(s,i,e,n)}});function Fj(e,t,r,i){let n=[];for(let o=0;o<e.length;o++)e[o].issues.length===0&&n.push(o);return n.length===1?(t.value=e[n[0]].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>ln(s,i,Wt())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:n}),t)}var Uy=P("$ZodXor",(e,t)=>{sl.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},n);c instanceof Promise?(s.push(c),o=!0):s.push(c)}return o?Promise.all(s).then(a=>Fj(a,i,e,n)):Fj(s,i,e,n)}});function Gx(e,t){let r=e._zod,i=r.bag.optionsMap;i||(i=oz(r.def),r.bag.optionsMap=i);let n=i.get(t);if(n===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return n}function oz(e){let t=new Map;for(let r of e.options){let i=r._zod.propValues?.[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of i)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var qy=P("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,sl.init(e,t);let r=e._zod.parse;Ie(e,"propValues",n=>{let o={},s=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);c[n.def.discriminator]?.has(void 0)&&s++;for(let[l,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(o,l)||kr(o,l,new Set);for(let d of u)o[l].add(d)}}return!n.def.unionFallback&&s>1&&o[n.def.discriminator]?.delete(void 0),o}),t.options.forEach((n,o)=>{let s=Kc(n._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${o}"`)});let i=Bc(()=>oz(t));e._zod.parse=(n,o)=>{let s=n.value;if(!va(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=s?.[t.discriminator],c=i.value.get(a);return c&&(a!==void 0||o.direction!=="backward")?c._zod.run(n,o):t.unionFallback||o.direction==="backward"?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()).filter(l=>i.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),n)}}),Fy=P("$ZodIntersection",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{let n=r.value,o=t.left._zod.run({value:n,issues:[]},i),s=t.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([c,l])=>Zj(r,c,l)):Zj(r,o,s)}});function il(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Vn(e)&&Vn(t)){let r=Object.keys(t),i=Object.keys(e).filter(o=>r.indexOf(o)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let o of i){if(o==="__proto__")continue;let s=il(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n[o]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i<e.length;i++){let n=e[i],o=t[i],s=il(n,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Zj(e,t,r){let i=new Map,n,o=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)n??(n=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let p=String(l.path[0]);o.has(p)||o.set(p,l),d=[p]}else return!1;for(let p of d)i.has(p)||i.set(p,{}),i.get(p)[u]=!0;return!0};for(let l of t.issues)s(l,"l")||e.issues.push(l);for(let l of r.issues)s(l,"r")||e.issues.push(l);let a=[...i].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=n?a.filter(u=>n.keys.includes(u)):[];l.length&&e.issues.push({...n,keys:l});for(let u of a)!l.includes(u)&&o.has(u)&&e.issues.push(o.get(u))}let c=il(t.value,r.value);if(!c.valid){if(Wr(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ip=P("$ZodTuple",(e,t)=>{$e.init(e,t);let r=t.items,i=vr.memoizer;i?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=i?i.alloc(e,n,[],o):[];let a=[],c=Vj(r,"optin"),l=Vj(r,"optout");if(!t.rest){if(s.length<c)return n.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),n;s.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=new Array(r.length),d=t.rest?o?.abortEarly:void 0,p=!1;for(let f=0;f<r.length;f++){let m=r[f]._zod.run({value:s[f],issues:[]},o);m instanceof Promise?a.push(m.then(h=>{u[f]=h})):(u[f]=m,d&&!p&&m.issues.length&&(p=Wr(m)))}if(t.rest&&!p){let f=r.length-1,m=s.slice(r.length),h=n.issues.length;for(let g of m){if(d&&n.issues.length!==h){if(Wr(n,h))break;h=n.issues.length}f++;let y=t.rest._zod.run({value:g,issues:[]},o);y instanceof Promise?a.push(y.then(v=>Bj(v,n,f))):Bj(y,n,f)}}return a.length?Promise.all(a).then(()=>Kj(u,n,r,s,l)):Kj(u,n,r,s,l)}});function Vj(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Bj(e,t,r){e.issues.length&&t.issues.push(...cn(r,e.issues)),t.value[r]=e.value}function Kj(e,t,r,i,n){for(let o=0;o<r.length;o++){let s=e[o],a=o<i.length;if(!a&&o>=n&&r[o]._zod.optin==="optional"){t.value.length=o;break}if(s.issues.length){if(!a&&o>=n){t.value.length=o;break}t.issues.push(...cn(o,s.issues))}t.value[o]=s.value}for(let o=t.value.length-1;o>=i.length&&(r[o]._zod.optout==="optional"&&t.value[o]===void 0);o--)t.value.length=o;return t}var Zy=P("$ZodRecord",(e,t)=>{$e.init(e,t);let r=vr.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!Vn(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),i;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){i.value=r?r.alloc(e,i,{},n):{};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=t.keyType._zod.run({value:u,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(m=>ln(m,n,Wt())),input:u,path:[u],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:o[u],issues:[]},n);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&i.issues.push(...cn(u,m.issues)),i.value[p]=m.value})):(f.issues.length&&i.issues.push(...cn(u,f.issues)),i.value[p]=f.value)}let l;for(let u in o)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;i.value[u]=o[u]}else l=l??[],l.push(u);l&&l.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}else{i.value=r?r.alloc(e,i,{},n):{};let c;for(let l of Reflect.ownKeys(o)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&$o.test(l)&&u.issues.length){let m=t.keyType._zod.run({value:Number(l),issues:[]},n);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){t.mode==="loose"?i.value[l]=o[l]:a?(c=c??[],c.push(l)):i.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>ln(m,n,Wt())),input:l,path:[l],inst:e});continue}let p=u.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:o[l],issues:[]},n);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&i.issues.push(...cn(l,m.issues)),i.value[p]=m.value})):(f.issues.length&&i.issues.push(...cn(l,f.issues)),i.value[p]=f.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),Vy=P("$ZodMap",(e,t)=>{$e.init(e,t);let r=vr.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!(o instanceof Map))return i.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),i;let s=[];i.value=r?r.alloc(e,i,new Map,n):new Map;let a=n?.abortEarly,c=i.issues.length;for(let[l,u]of o){if(a&&i.issues.length!==c){if(Wr(i,c))break;c=i.issues.length}let d=t.keyType._zod.run({value:l,issues:[]},n),p=t.valueType._zod.run({value:u,issues:[]},n);d instanceof Promise||p instanceof Promise?s.push(Promise.all([d,p]).then(([f,m])=>{Wj(f,m,i,l,o,e,n)})):Wj(d,p,i,l,o,e,n)}return s.length?Promise.all(s).then(()=>i):i}});function Wj(e,t,r,i,n,o,s){e.issues.length&&(ap.has(typeof i)?r.issues.push(...cn(i,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:o,issues:e.issues.map(a=>ln(a,s,Wt()))})),t.issues.length&&(ap.has(typeof i)?r.issues.push(...cn(i,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:t.issues.map(a=>ln(a,s,Wt()))})),r.value.set(e.value,t.value)}var By=P("$ZodSet",(e,t)=>{$e.init(e,t);let r=vr.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!(o instanceof Set))return i.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),i;let s=[];i.value=r?r.alloc(e,i,new Set,n):new Set;let a=n?.abortEarly,c=i.issues.length;for(let l of o){if(a&&i.issues.length!==c){if(Wr(i,c))break;c=i.issues.length}let u=t.valueType._zod.run({value:l,issues:[]},n);u instanceof Promise?s.push(u.then(d=>Gj(d,i))):Gj(u,i)}return s.length?Promise.all(s).then(()=>i):i}});function Gj(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Ky=P("$ZodEnum",(e,t)=>{$e.init(e,t);let r=Zc(t.entries),i=new Set(r);e._zod.values=i,Ie(e,"pattern",n=>{let o=Zc(n.def.entries).filter(s=>ap.has(typeof s));return new RegExp(o.length?`^(${o.map(s=>Bn(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return i.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Wy=P("$ZodLiteral",(e,t)=>{$e.init(e,t);let r=new Set(t.values);e._zod.values=r,Ie(e,"pattern",i=>{let n=i.def.values;return new RegExp(n.length?`^(${n.map(o=>typeof o=="string"?Bn(o):o?Bn(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,n)=>{let o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}}),Gy=P("$ZodFile",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Hy=P("$ZodTransform",(e,t)=>{$e.init(e,t),e._zod.optin="optional",vr.memoizer?.guard(e),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new es(e.constructor.name);let n=t.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new un;return r.value=n,r}});function Hj(e,t){return e.value=t.issues.length?void 0:t.value,e}var Tp=P("$ZodOptional",(e,t)=>{$e.init(e,t),Ie(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Ie(e,"values",r=>{let i=r.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),Ie(e,"pattern",r=>{let i=r.def.innerType._zod.pattern;return i?new RegExp(`^(${vo(i.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},i);return n instanceof Promise?n.then(o=>Hj(r,o)):Hj(r,n)}return t.innerType._zod.run(r,i)}}),Jy=P("$ZodExactOptional",(e,t)=>{Tp.init(e,t),Ie(e,"values",r=>r.def.innerType._zod.values),Ie(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,i)=>t.innerType._zod.run(r,i)}),Yy=P("$ZodNullable",(e,t)=>{$e.init(e,t),Ie(e,"optin",r=>r.def.innerType._zod.optin),Ie(e,"optout",r=>r.def.innerType._zod.optout),Ie(e,"pattern",r=>{let i=r.def.innerType._zod.pattern;return i?new RegExp(`^(${vo(i.source)}|null)$`):void 0}),Ie(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)}),Xy=P("$ZodDefault",(e,t)=>{$e.init(e,t),e._zod.optin="defaulted",Ie(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>Jj(o,t)):Jj(n,t)}});function Jj(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Qy=P("$ZodPrefault",(e,t)=>{$e.init(e,t),e._zod.optin="defaulted",Ie(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,i))}),ev=P("$ZodNonOptional",(e,t)=>{$e.init(e,t),Ie(e,"values",r=>{let i=r.def.innerType._zod.values;return i?new Set([...i].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,i)=>{let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>Yj(o,e)):Yj(n,e)}});function Yj(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var tv=P("$ZodSuccess",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new es("ZodSuccess");let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}});function Xj(e,t,r,i){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>ln(n,i,Wt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var rv=P("$ZodCatch",(e,t)=>{$e.init(e,t),Ie(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Ie(e,"optout",r=>r.def.innerType._zod.optout),Ie(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);let n=t.innerType._zod.run({value:r.value,issues:[]},i);return n instanceof Promise?n.then(o=>Xj(r,o,t,i)):Xj(r,n,t,i)}}),nv=P("$ZodNaN",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Pp=P("$ZodPipe",(e,t)=>{$e.init(e,t),Ie(e,"values",r=>r.def.in._zod.values),Ie(e,"optin",r=>r.def.in._zod.optin),Ie(e,"optout",r=>r.def.out._zod.optout),Ie(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){let o=t.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Bg(s,t.in,i)):Bg(o,t.in,i)}let n=t.in._zod.run(r,i);return n instanceof Promise?n.then(o=>Bg(o,t.out,i)):Bg(n,t.out,i)}});function Bg(e,t,r){return e.issues.some(i=>i.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var al=P("$ZodCodec",(e,t)=>{$e.init(e,t),Ie(e,"values",r=>r.def.in._zod.values),Ie(e,"optin",r=>r.def.in._zod.optin),Ie(e,"optout",r=>r.def.out._zod.optout),Ie(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,i)=>{if((i.direction||"forward")==="forward"){let o=t.in._zod.run(r,i);return o instanceof Promise?o.then(s=>Kg(s,t,i)):Kg(o,t,i)}else{let o=t.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Kg(s,t,i)):Kg(o,t,i)}}});function Kg(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(o=>Wg(e,o,t.out,r)):Wg(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(o=>Wg(e,o,t.in,r)):Wg(e,n,t.in,r)}}function Wg(e,t,r,i){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},i)}var Hx=P("$ZodPreprocess",(e,t)=>{Pp.init(e,t)}),iv=P("$ZodReadonly",(e,t)=>{$e.init(e,t),Ie(e,"propValues",r=>r.def.innerType._zod.propValues),Ie(e,"values",r=>r.def.innerType._zod.values),Ie(e,"optin",r=>r.def.innerType?._zod?.optin),Ie(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(Qj):Qj(n)}});function Qj(e){return e.memo||(e.value=Object.freeze(e.value)),e}function b3(e){let t=e._zod.def,r=t.pattern,i=!!t.format?.includes("int"),n,o;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(r=c.pattern),i||(i=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;l!==void 0&&(n===void 0||l>n)&&(n=l),u!==void 0&&(o===void 0||u<o)&&(o=u)}if(r)return r.source;if(n!==void 0&&o!==void 0&&n>o)return"(?!)";if(n!==void 0||o!==void 0)return ux({minimum:n,maximum:o}).source;let s=e._zod.pattern;return(i&&s===$o?gp:s)?.source}function Ux(e){let t=e._zod.def,r=e._zod.pattern?.source,i=t.innerType??e._zod.innerType;if(i){let n=i._zod.pattern?.source,o=Ux(i);return r&&n&&o&&o!==n?r.replace(vo(n),()=>vo(o)):r}if(t.options){let n=t.options.map(Ux);if(n.every(Boolean))return`^(${n.map(o=>vo(o)).join("|")})$`}return b3(e)}var ov=P("$ZodTemplateLiteral",(e,t)=>{$e.init(e,t);let r=[];for(let i of t.parts)if(typeof i=="object"&&i!==null){let n=Ux(i);if(!n)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);r.push(vo(n))}else if(i===null||kS.has(typeof i))r.push(Bn(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"string",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i)}),sv=P("$ZodFunction",(e,t)=>($e.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...i){let n=e._def.input?ba(e._def.input,i):i,o=Reflect.apply(r,this,n);return e._def.output?ba(e._def.output,o):o},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...i){let n=e._def.input?await wa(e._def.input,i):i,o=await Reflect.apply(r,this,n);return e._def.output?await wa(e._def.output,o):o},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,i)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let i=e.constructor;return Array.isArray(r[0])?new i({type:"function",input:new Ip({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new i({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let i=e.constructor;return new i({type:"function",input:e._def.input,output:r})},e)),av=P("$ZodPromise",(e,t)=>{$e.init(e,t),e._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},i))}),cl=P("$ZodLazy",(e,t)=>{$e.init(e,t),bS(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),Ie(e,"pattern",r=>r.innerType?._zod?.pattern),Ie(e,"propValues",r=>r.innerType?._zod?.propValues),Ie(e,"optin",r=>r.innerType?._zod?.optin??void 0),Ie(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,i)=>e._zod.innerType._zod.run(r,i)}),cv=P("$ZodCustom",(e,t)=>{vt.init(e,t),$e.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{let i=r.value,n=t.fn(i);if(n instanceof Promise)return n.then(o=>ez(o,r,i,e));ez(n,r,i,e)}});function ez(e,t,r,i){if(!e){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),t.issues.push(Gc(n))}}var pv=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Yx="~memo",az=[];function cz(e){return e!==null&&typeof e=="object"}function Jx(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var lz=new WeakMap,ll=0,dv=1,Rp=2;function Cp(e,t,r){let i=lz.get(e);if(i!==void 0)return i?Rp:ll;if(t.has(e))return Rp;t.add(e);let n=ll,o=u=>{if(n!==Rp&&u?._zod){let d=Cp(u,t,r);d>n&&(n=d)}},s=(u,d)=>{let p=ll;for(let f of Reflect.ownKeys(u)){let m=Object.getOwnPropertyDescriptor(u,f);if(d&&!m.enumerable)continue;let h=m.get?dv:m.value?._zod?Cp(m.value,t,r):ll;h>p&&(p=h)}return p},a=u=>{u>n&&(n=u)},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Kc(c);a(u?s(u,!0):dv),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?e._zod.innerType:void 0);a(u?Cp(u,t,!1):dv);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 p=d.value;if(!(!p||typeof p!="object")){if(p._zod)o(p);else if(Array.isArray(p))for(let f of p)o(f)}}}return t.delete(e),w3(e,n)}function w3(e,t){return t!==dv&&lz.set(e,t===Rp),t}function fv(e){return Cp(e,new Set,!0)!==ll}function _3(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var lv,uv=[],k3={alloc(e,t,r){let i=lv;if(!i)return r;lv=void 0;let n={value:r,issues:null};return i.set(t.value,n),uv.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,i=(n,o)=>{if(o.direction!=="backward"&&mv(o,n.value))throw new pv;return r(n,o)};e._zod.parse=i,e._zod.run===r&&(e._zod.run=i)})},attach(e){var t;let r,i=!1,n,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(r===void 0){let y=Cp(e,new Set,!1);if(y===ll)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,l);y===Rp||i?r=!0:i=!0}let u=c.value;if(!cz(u))return s(c,l);let d=l[Yx];d||(d={buckets:new WeakMap,backEdges:void 0},l[Yx]=d);let p;n===l?p=o:(p=_3(d,e),n=l,o=p);let f=p.get(u);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Jx(f.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),c;lv=p;let m=uv.length,h=s(c,l);lv=void 0;let g=uv.length>m?uv.pop():void 0;return h instanceof Promise?h.then(y=>(g&&(g.issues=y.issues.length?Jx(y.issues):az),y)):(g&&(g.issues=h.issues.length?Jx(h.issues):az),h)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Ap(){return k3}function mv(e,t){let r=e[Yx]?.backEdges;return r!==void 0&&cz(t)&&r.has(t)}var dl={};go(dl,{ar:()=>uz,az:()=>dz,be:()=>fz,bg:()=>mz,bn:()=>hz,ca:()=>gz,ckb:()=>yz,cs:()=>vz,da:()=>$z,de:()=>bz,el:()=>wz,en:()=>hv,eo:()=>_z,es:()=>kz,fa:()=>Sz,fi:()=>xz,fr:()=>Iz,frCA:()=>Tz,gu:()=>Pz,he:()=>Rz,hi:()=>Cz,hr:()=>Az,hu:()=>Ez,hy:()=>Nz,id:()=>jz,is:()=>zz,it:()=>Dz,ja:()=>Mz,ka:()=>Lz,kh:()=>Uz,km:()=>gv,kn:()=>qz,ko:()=>Fz,lt:()=>Vz,mk:()=>Bz,ms:()=>Kz,ne:()=>Wz,nl:()=>Gz,nn:()=>Hz,no:()=>Jz,ota:()=>Yz,pl:()=>Qz,ps:()=>Xz,pt:()=>e1,ptBR:()=>t1,ro:()=>r1,ru:()=>i1,sk:()=>o1,sl:()=>s1,sv:()=>a1,ta:()=>c1,tg:()=>l1,th:()=>u1,tk:()=>d1,tr:()=>p1,ua:()=>f1,uk:()=>yv,ur:()=>m1,uz:()=>h1,vi:()=>g1,yo:()=>$1,zhCN:()=>y1,zhTW:()=>v1});var S3=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},map:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",mac:"\u0639\u0646\u0648\u0627\u0646 MAC",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",credit_card:"\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",currency_code:"\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",iban:"IBAN",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${N(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${r[o.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${R(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function uz(){return{localeError:S3()}}var x3=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"},map:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??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",credit_card:"kredit kart\u0131 n\xF6mr\u0259si",currency_code:"valyuta kodu",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${a}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${N(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[o.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function dz(){return{localeError:x3()}}function pz(e,t,r,i){let n=Math.abs(e),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?t:o>=2&&o<=4?r:i}var I3=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",mac:"MAC \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",credit_card:"\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},i={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${N(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=pz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=pz(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${R(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function fz(){return{localeError:I3()}}var T3=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${N(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function mz(){return{localeError:T3()}}var P3=()=>{let e={string:{unit:"\u0985\u0995\u09CD\u09B7\u09B0",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},file:{unit:"\u09AC\u09BE\u0987\u099F",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},array:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},set:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},map:{unit:"\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"}};function t(n){return e[n]??null}let r={regex:"\u0987\u09A8\u09AA\u09C1\u099F",email:"\u0987\u09AE\u09C7\u0987\u09B2 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",url:"URL",emoji:"\u0987\u09AE\u09CB\u099C\u09BF",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u09A4\u09BE\u09B0\u09BF\u0996 \u0993 \u09B8\u09AE\u09AF\u09BC",date:"ISO \u09A4\u09BE\u09B0\u09BF\u0996",time:"ISO \u09B8\u09AE\u09AF\u09BC",duration:"ISO \u09B8\u09AE\u09AF\u09BC\u0995\u09BE\u09B2",ipv4:"IPv4 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",ipv6:"IPv6 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",mac:"MAC \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",cidrv4:"IPv4 \u09B0\u09C7\u099E\u09CD\u099C",cidrv6:"IPv6 \u09B0\u09C7\u099E\u09CD\u099C",base64:"base64-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",base64url:"base64url-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",json_string:"JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",e164:"E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",credit_card:"\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",currency_code:"\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",iban:"IBAN",jwt:"JWT",template_literal:"\u0987\u09A8\u09AA\u09C1\u099F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${o}, \u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4 ${a}`}case"invalid_value":return n.values.length===1?`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${N(n.values[0])}`:`\u0985\u09AC\u09C8\u09A7 \u0985\u09AA\u09B6\u09A8: ${R(n.values," | ")} \u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 \u098F\u0995\u099F\u09BF \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${o}${n.maximum.toString()} ${s.unit??"\u098F\u09B2\u09BF\u09AE\u09C7\u09A8\u09CD\u099F"} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${o}${n.maximum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${o}${n.minimum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.prefix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C1\u09B0\u09C1 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="ends_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.suffix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C7\u09B7 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="includes"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.includes}" \u0985\u09A8\u09CD\u09A4\u09B0\u09CD\u09AD\u09C1\u0995\u09CD\u09A4 \u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="regex"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: ${o.pattern} \u09AA\u09CD\u09AF\u09BE\u099F\u09BE\u09B0\u09CD\u09A8 \u09AE\u09BF\u09B2\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09AC\u09C8\u09A7 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0985\u09AC\u09C8\u09A7 \u09A8\u09AE\u09CD\u09AC\u09B0: ${n.divisor} \u098F\u09B0 \u0997\u09C1\u09A3\u09BF\u09A4\u0995 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`;case"unrecognized_keys":return`\u0985\u099A\u09C7\u09A8\u09BE \u0995\u09C0${n.keys.length>1?"\u0997\u09C1\u09B2\u09CB":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u0995\u09C0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0985\u09AC\u09C8\u09A7 \u09A1\u09BF\u09B8\u0995\u09CD\u09B0\u09BF\u09AE\u09BF\u09A8\u09C7\u099F\u09B0 \u09AE\u09BE\u09A8\u0964 \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F";case"invalid_element":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u09AE\u09BE\u09A8`;default:return"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"}}};function hz(){return{localeError:P3()}}var R3=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"},map:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",mac:"adre\xE7a MAC",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de targeta de cr\xE8dit",currency_code:"codi de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${a}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${N(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${R(n.values," o ")}`;case"too_big":{let o=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${o} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${o} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function gz(){return{localeError:R3()}}var C3=()=>{let e={string:{unit:"\u067E\u06CC\u062A",verb:"\u0628\u06CE\u062A"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u0628\u06CE\u062A"},array:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},set:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},map:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"}};function t(n){return e[n]??null}let r={regex:"regex",email:"\u0626\u06CC\u0645\u06D5\u06CC\u06B5",url:"\u0628\u06D5\u0633\u062A\u06D5\u0631 (URL)",emoji:"\u0626\u06CC\u0645\u06C6\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0695\u06CE\u06A9\u06D5\u0648\u062A \u0648 \u06A9\u0627\u062A",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",time:"\u06A9\u0627\u062A",duration:"\u0645\u0627\u0648\u06D5",ipv4:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv4",ipv6:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv6",mac:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC MAC",cidrv4:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv4",cidrv6:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv6",base64:"\u062F\u06D5\u0642\u06CC base64",base64url:"\u062F\u06D5\u0642\u06CC base64url",json_string:"\u062F\u06D5\u0642\u06CC JSON",e164:"\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",credit_card:"\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",currency_code:"\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",iban:"IBAN",jwt:"JWT",template_literal:"\u062A\u06CE\u06A9\u0631\u062F\u06D5"},i={nan:"NaN",string:"\u0646\u0648\u0648\u0633\u06CC\u0646",number:"\u0698\u0645\u0627\u0631\u06D5",boolean:"boolean",array:"array",object:"object",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",integer:"\u0698\u0645\u0627\u0631\u06D5",float:"\u0698\u0645\u0627\u0631\u06D5",null:"null",undefined:"undefined",function:"function",symbol:"symbol",unknown:"unknown",promise:"promise",void:"void",never:"never",map:"map",set:"set"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s,c=["\u0627","\u0648","\u06C6","\u0648\u0648","\u06D5","\u06CC","\u06CE"].some(u=>a.endsWith(u))?"\u06CC\u06D5":"\u06D5",l=/^[a-zA-Z]+$/.test(a);return s==="null"||s==="undefined"?"\u062F\u0627\u0648\u0627\u06A9\u0631\u0627\u0648\u06D5":`\u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${o} \u0628\u06CE\u062A\u060C \u0628\u06D5\u06B5\u0627\u0645 ${a}${l?"":c}`}case"invalid_value":return n.values.length===1?`\u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0648\u0633\u062A\u06D5: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${N(n.values[0])} \u0628\u06CE\u062A`:`\u0647\u06D5\u06B5\u0628\u0698\u0627\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 \u06CC\u06D5\u06A9\u06CE\u06A9 \u0628\u06CE\u062A \u0644\u06D5 ${R(n.values,"|")}`;case"too_big":{let o=t(n.origin);return o?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} ${o.unit} ${o.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} \u0628\u06CE\u062A`}case"too_small":{let o=t(n.origin);return o?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} ${o.unit} ${o.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} \u0628\u06CE\u062A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u062F\u06D5\u0633\u062A\u067E\u06CE\u0628\u06A9\u0627\u062A \u0628\u06D5 "${o.prefix}"`:o.format==="ends_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u06A9\u06C6\u062A\u0627\u06CC\u06CC\u0628\u06CE\u062A \u0628\u06D5 "${o.suffix}"`:o.format==="includes"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 "${o.includes}" \u0644\u06D5\u062E\u06C6\u0628\u06AF\u0631\u06CE\u062A`:o.format==="regex"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0644\u06D5\u06AF\u06D5\u06B5 \u067E\u0627\u062A\u06CE\u0631\u0646\u06CC ${o.pattern} \u0628\u06AF\u0648\u0646\u062C\u06CE\u062A`:`\u0628\u06D5\u0647\u0627\u06CC ${r[o.format]??n.format} \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`}case"not_multiple_of":return`\u0698\u0645\u0627\u0631\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u062F\u06D5\u0628\u06CE\u062A \u0686\u06D5\u0646\u062F \u0647\u06CE\u0646\u062F\u06D5 \u0628\u06CE\u062A \u0628\u06C6 ${n.divisor}`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648: ${R(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A \u0644\u06D5 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0628\u06D5\u0647\u0627\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648 \u0647\u06D5\u06CC\u06D5. \u0628\u06D5\u0647\u0627\u06CC \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648: ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u06CC\u06D5\u06A9\u06AF\u0631\u062A\u0646\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A";case"invalid_element":return`${n.origin} \u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`;default:return"\u062A\u06CE\u06A9\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A"}}};function yz(){return{localeError:C3()}}var A3=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"},map:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditn\xED karty",currency_code:"k\xF3d m\u011Bny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${N(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${R(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function vz(){return{localeError:A3()}}var E3=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"},map:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kreditkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`:`Ugyldigt input: forventede ${o}, fik ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${N(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${o} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`For lille: forventede ${a} ${s.verb} ${o} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function $z(){return{localeError:E3()}}var O3=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"},map:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",mac:"MAC-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",credit_card:"Kreditkartennummer",currency_code:"W\xE4hrungscode",iban:"IBAN",jwt:"JWT",template_literal:"Eingabe"},i={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${a}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${N(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ist`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ist`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function bz(){return{localeError:O3()}}var N3=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(n){return e[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",credit_card:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",currency_code:"\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",iban:"IBAN",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${N(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${R(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function wz(){return{localeError:N3()}}var j3=()=>{let e={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 t(o){return e[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"},i={nan:"NaN"};function n(o,s){return o==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):i[o]??o}return o=>{switch(o.code){case"invalid_type":{let s=n(o.expected),a=j(o.input),c=n(a,o.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${N(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{let s=o.exact?"exactly ":o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.exact?"exactly ":o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.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":""}: ${R(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"}}};function hv(){return{localeError:j3()}}var z3=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"},map:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",mac:"MAC-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",credit_card:"kreditkarta numero",currency_code:"valuta kodo",iban:"IBAN",jwt:"JWT",template_literal:"enigo"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${a}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${N(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function _z(){return{localeError:z3()}}var D3=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",mac:"direcci\xF3n MAC",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de tarjeta de cr\xE9dito",currency_code:"c\xF3digo de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${N(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${o}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${i[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${i[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function kz(){return{localeError:D3()}}var M3=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},map:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",mac:"MAC \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",credit_card:"\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",currency_code:"\u06A9\u062F \u0627\u0631\u0632",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${N(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${R(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[o.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${R(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function Sz(){return{localeError:M3()}}var L3=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},map:{unit:"alkiota",subject:"kuvauksen"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",mac:"MAC-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",credit_card:"luottokortin numero",currency_code:"valuuttakoodi",iban:"IBAN",jwt:"JWT",template_literal:"templaattimerkkijono"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${a}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${N(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${o}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${o}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${r[o.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${R(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function xz(){return{localeError:L3()}}var U3=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"expression r\xE9guli\xE8re",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne de caract\xE8res encod\xE9e en base64",base64url:"cha\xEEne de caract\xE8res encod\xE9e en base64url",json_string:"cha\xEEne de caract\xE8res JSON",e164:"num\xE9ro au format E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},i={string:"cha\xEEne de caract\xE8res",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"record",map:"map",set:"ensemble",file:"fichier",nonoptional:"non optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instance de ${n.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${a} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${N(n.values[0])} attendu`:`Option invalide : une valeur parmi ${R(n.values,"|")} attendue`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Trop grand : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Trop petit : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne de caract\xE8res invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne de caract\xE8res invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne de caract\xE8res invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne de caract\xE8res invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function Iz(){return{localeError:U3()}}var q3=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"},map:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${a}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${N(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u2264":"<",s=t(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${o}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u2265":">",s=t(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function Tz(){return{localeError:q3()}}var F3=()=>{let e={string:{unit:"\u0A85\u0A95\u0ACD\u0AB7\u0AB0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},file:{unit:"\u0AAC\u0ABE\u0AAF\u0A9F",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},array:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},set:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},map:{unit:"\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"}};function t(n){return e[n]??null}let r={regex:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F",email:"\u0A88\u0AAE\u0AC7\u0A87\u0AB2 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",url:"URL",emoji:"\u0A87\u0AAE\u0ACB\u0A9C\u0AC0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96 \u0A85\u0AA8\u0AC7 \u0AB8\u0AAE\u0AAF",date:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96",time:"ISO \u0AB8\u0AAE\u0AAF",duration:"ISO \u0A85\u0AB5\u0AA7\u0ABF",ipv4:"IPv4 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",ipv6:"IPv6 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",mac:"MAC \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",cidrv4:"IPv4 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",cidrv6:"IPv6 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",base64:"base64-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",base64url:"base64url-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",json_string:"JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",e164:"E.164 \u0AA8\u0A82\u0AAC\u0AB0",credit_card:"\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",currency_code:"\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",iban:"IBAN",jwt:"JWT",template_literal:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${o}, \u0AAA\u0ACD\u0AB0\u0ABE\u0AAA\u0ACD\u0AA4 ${a}`}case"invalid_value":return n.values.length===1?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${N(n.values[0])}`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB5\u0ABF\u0A95\u0AB2\u0ACD\u0AAA: ${R(n.values," | ")} \u0AAE\u0ABE\u0AA7\u0ACD\u0AAF\u0AAE\u0AA5\u0AC0 \u0A8F\u0A95 \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${o}${n.maximum.toString()} ${s.unit??"\u0A8F\u0AB2\u0ABF\u0AAE\u0AC7\u0AA8\u0ACD\u0A9F"} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${o}${n.maximum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${o}${n.minimum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.prefix}" \u0AA5\u0AC0 \u0AB6\u0AB0\u0AC2 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="ends_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.suffix}" \u0AAA\u0AB0 \u0AB8\u0AAE\u0ABE\u0AAA\u0ACD\u0AA4 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="includes"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.includes}" \u0AB6\u0ABE\u0AAE\u0AC7\u0AB2 \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="regex"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: \u0AAA\u0AC7\u0A9F\u0AB0\u0ACD\u0AA8 ${o.pattern} \u0AB8\u0ABE\u0AA5\u0AC7 \u0AAE\u0AC7\u0AB3 \u0A96\u0ABE\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA8\u0A82\u0AAC\u0AB0: ${n.divisor} \u0AA8\u0ACB \u0A97\u0AC1\u0AA3\u0ABE\u0A82\u0A95 \u0AB9\u0ACB\u0AB5\u0ACB \u0A9C\u0ACB\u0A88\u0A8F`;case"unrecognized_keys":return`\u0A93\u0AB3\u0A96\u0AC0 \u0AB6\u0A95\u0ABE\u0AA4\u0ABE \u0AA8\u0AB9\u0AC0\u0A82 \u0AA4\u0AC7 \u0A95\u0AC0${n.keys.length>1?"\u0A93":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A95\u0AC0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA1\u0ABF\u0AB8\u0ACD\u0A95\u0ACD\u0AB0\u0ABF\u0AAE\u0ABF\u0AA8\u0AC7\u0A9F\u0AB0 \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF. \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F";case"invalid_element":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF`;default:return"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"}}};function Pz(){return{localeError:F3()}}var Z3=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=l=>l?e[l]:void 0,i=l=>{let u=r(l);return u?u.label:l??e.unknown.label},n=l=>`\u05D4${i(l)}`,o=l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=l=>l?t[l]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},uuidv4:{label:"UUIDv4",gender:"m"},uuidv6:{label:"UUIDv6",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},mac:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA MAC",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},credit_card:{label:"\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",gender:"m"},currency_code:{label:"\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2",gender:"m"},iban:{label:"IBAN",gender:"m"},jwt:{label:"JWT",gender:"m"},template_literal:{label:"\u05E7\u05DC\u05D8",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let u=l.expected,d=c[u??""]??i(u),p=j(l.input),f=c[p]??e[p]?.label??p;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${N(l.values[0])}`;let u=l.values.map(f=>N(f));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=s(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=l.inclusive?`${l.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=l.inclusive?"<=":"<",f=o(l.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()}`}case"too_small":{let u=s(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let g=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`}let h=l.inclusive?`${l.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=l.inclusive?">=":">",f=o(l.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()}`}case"invalid_format":{let u=l;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=a[u.format],p=d?.label??u.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${R(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function Rz(){return{localeError:Z3()}}var V3=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},file:{unit:"\u092C\u093E\u0907\u091F\u094D\u0938",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0924\u093F\u0925\u093F \u0914\u0930 \u0938\u092E\u092F",date:"ISO \u0924\u093F\u0925\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u092A\u0924\u093E",ipv6:"IPv6 \u092A\u0924\u093E",mac:"MAC \u092A\u0924\u093E",cidrv4:"IPv4 \u0936\u094D\u0930\u0947\u0923\u0940",cidrv6:"IPv6 \u0936\u094D\u0930\u0947\u0923\u0940",base64:"Base64-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",base64url:"Base64URL-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",e164:"E.164 \u0938\u0902\u0916\u094D\u092F\u093E",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${o}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${a}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${N(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u094B\u0902 \u092E\u0947\u0902 \u0938\u0947 \u090F\u0915 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} \u092E\u0947\u0902 ${o}${n.maximum} ${s.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} ${o}${n.maximum} \u0939\u094B`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} \u092E\u0947\u0902 ${o}${n.minimum} ${s.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} ${o}${n.minimum} \u0939\u094B`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${o.prefix}" \u0938\u0947 \u0936\u0941\u0930\u0942 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${o.suffix}" \u092A\u0930 \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u0907\u0938\u092E\u0947\u0902 "${o.includes}" \u0936\u093E\u092E\u093F\u0932 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u092A\u0948\u091F\u0930\u094D\u0928 ${o.pattern} \u0938\u0947 \u092E\u0947\u0932 \u0916\u093E\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: \u092F\u0939 ${n.divisor} \u0915\u093E \u0917\u0941\u0923\u091C \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u0902\u091C\u0940${n.keys.length>1?"\u092F\u093E\u0901":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u0902\u091C\u0940: ${n.origin} \u092E\u0947\u0902`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u0947\u0902`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function Cz(){return{localeError:V3()}}var B3=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",credit_card:"broj kreditne kartice",currency_code:"kod valute",iban:"IBAN",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${a}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${N(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${o}${n.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${o}${n.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${r[o.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${R(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${i[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function Az(){return{localeError:B3()}}var K3=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"},map:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",mac:"MAC c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",credit_card:"hitelk\xE1rtyasz\xE1m",currency_code:"p\xE9nznemk\xF3d",iban:"IBAN",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${N(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${o}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[o.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function Ez(){return{localeError:K3()}}function Oz(e,t,r){return Math.abs(e)===1?t:r}function ul(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}var W3=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},map:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",mac:"MAC \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",credit_card:"\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",currency_code:"\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",iban:"IBAN",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},i={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${N(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=Oz(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ul(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ul(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=Oz(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ul(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${ul(n.origin)} \u056C\u056B\u0576\u056B ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[o.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${R(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${ul(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${ul(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function Nz(){return{localeError:W3()}}var G3=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"},map:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",credit_card:"nomor kartu kredit",currency_code:"kode mata uang",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${N(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${r[o.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function jz(){return{localeError:G3()}}var H3=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"},map:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",credit_card:"kreditkortan\xFAmer",currency_code:"gjaldmi\xF0ilsk\xF3\xF0i",iban:"IBAN",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${N(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${R(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function zz(){return{localeError:H3()}}var J3=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"},map:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",mac:"indirizzo MAC",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",credit_card:"numero di carta di credito",currency_code:"codice valuta",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`:`Input non valido: atteso ${o}, ricevuto ${a}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${N(n.values[0])}`:`Opzione non valida: atteso uno tra ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${o}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${o}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${r[o.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${R(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function Dz(){return{localeError:J3()}}var Y3=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},map:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",mac:"MAC\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",credit_card:"\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",currency_code:"\u901A\u8CA8\u30B3\u30FC\u30C9",iban:"IBAN",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},i={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${N(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${R(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${R(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function Mz(){return{localeError:Y3()}}var X3=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},map:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",mac:"MAC \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",credit_card:"\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",currency_code:"\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",iban:"IBAN",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},i={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${N(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${R(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${R(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function Lz(){return{localeError:X3()}}var Q3=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},map:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",mac:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 MAC",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",credit_card:"\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",currency_code:"\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",iban:"IBAN",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},i={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${N(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${R(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function gv(){return{localeError:Q3()}}function Uz(){return gv()}var e5=()=>{let e={string:{unit:"\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},file:{unit:"\u0CAC\u0CC8\u0C9F\u0CCD\u200C\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},array:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},set:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},map:{unit:"entries",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"}};function t(n){return e[n]??null}let r={regex:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD",email:"email \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",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 \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95\u0CA6 \u0CB8\u0CAE\u0CAF",date:"ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95",time:"ISO \u0CB8\u0CAE\u0CAF",duration:"ISO \u0C85\u0CB5\u0CA7\u0CBF",ipv4:"IPv4 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",ipv6:"IPv6 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",mac:"MAC \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",cidrv4:"IPv4 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",cidrv6:"IPv6 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",base64:"base64-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",base64url:"base64url-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",json_string:"JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",e164:"E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",credit_card:"\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",currency_code:"\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",iban:"IBAN",jwt:"JWT",template_literal:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${o}, \u0CB8\u0CCD\u0CB5\u0CC0\u0C95\u0CB0\u0CBF\u0CB8\u0CBF\u0CA6\u0CA8\u0CC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${N(n.values[0])}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C86\u0CAF\u0CCD\u0C95\u0CC6: \u0C87\u0CB5\u0CC1\u0C97\u0CB3\u0CB2\u0CCD\u0CB2\u0CBF \u0C92\u0C82\u0CA6\u0CA8\u0CCD\u0CA8\u0CC1 \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${o}${n.maximum.toString()} ${s.unit??"\u0C85\u0C82\u0CB6\u0C97\u0CB3\u0CC1"}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0C8E\u0C82\u0CA6\u0CC1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${o}${n.minimum.toString()} ${s.unit}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0C8E\u0C82\u0CA6\u0CC1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0CAA\u0CCD\u0CB0\u0CBE\u0CB0\u0C82\u0CAD\u0CBF\u0CB8\u0CAC\u0CC7\u0C95\u0CC1 "${o.prefix}"`:o.format==="ends_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0C95\u0CCA\u0CA8\u0CC6\u0C97\u0CCA\u0CB3\u0CCD\u0CB3\u0CAC\u0CC7\u0C95\u0CC1 "${o.suffix}"`:o.format==="includes"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C92\u0CB3\u0C97\u0CCA\u0C82\u0CA1\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 "${o.includes}"`:o.format==="regex"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0C97\u0CC6 \u0CB9\u0CCA\u0C82\u0CA6\u0CBF\u0C95\u0CC6\u0CAF\u0CBE\u0C97\u0CAC\u0CC7\u0C95\u0CC1 ${o.pattern}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6: \u0CAC\u0CB9\u0CC1\u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6\u0CAF\u0CBE\u0C97\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 ${n.divisor}`;case"unrecognized_keys":return`\u0C97\u0CC1\u0CB0\u0CC1\u0CA4\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CA6 \u0C95\u0CC0 ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0C95\u0CC0 \u0C87\u0CA8\u0CCD ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CA4\u0CBE\u0CB0\u0CA4\u0CAE\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF. \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD";case"invalid_element":return`\u0CB0\u0CB2\u0CCD\u0CB2\u0CBF \u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF ${n.origin}`;default:return"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD"}}};function qz(){return{localeError:e5()}}var t5=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"},map:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",mac:"MAC \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",credit_card:"\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",currency_code:"\uD1B5\uD654 \uCF54\uB4DC",iban:"IBAN",jwt:"JWT",template_literal:"\uC785\uB825"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${N(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${R(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${o}${s}`}case"too_small":{let o=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[o.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${R(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function Fz(){return{localeError:t5()}}var Ep=e=>e.charAt(0).toUpperCase()+e.slice(1);function Zz(e){let t=Math.abs(e),r=t%10,i=t%100;return i>=11&&i<=19||r===0?"many":r===1?"one":"few"}var r5=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,o,s,a){let c=e[n]??null;return c===null?c:{unit:c.unit[o],verb:c.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",mac:"MAC adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",credit_card:"kredito kortel\u0117s numeris",currency_code:"valiutos kodas",iban:"IBAN",jwt:"JWT",template_literal:"\u012Fvestis"},i={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${o}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${N(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${R(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=i[n.origin]??n.origin,s=t(n.origin,Zz(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Ep(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Ep(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let o=i[n.origin]??n.origin,s=t(n.origin,Zz(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Ep(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Ep(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${R(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=i[n.origin]??n.origin;return`${Ep(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function Vz(){return{localeError:r5()}}var n5=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},map:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",mac:"MAC \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",credit_card:"\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},i={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${N(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${R(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function Bz(){return{localeError:n5()}}var i5=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"},map:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",credit_card:"nombor kad kredit",currency_code:"kod mata wang",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`:`Input tidak sah: dijangka ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${N(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${r[o.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Kz(){return{localeError:i5()}}var o5=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},file:{unit:"\u092C\u093E\u0907\u091F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0907\u092E\u0947\u0932 \u0920\u0947\u0917\u093E\u0928\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u092E\u093F\u0924\u093F \u0930 \u0938\u092E\u092F",date:"ISO \u092E\u093F\u0924\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u0920\u0947\u0917\u093E\u0928\u093E",ipv6:"IPv6 \u0920\u0947\u0917\u093E\u0928\u093E",mac:"MAC \u0920\u0947\u0917\u093E\u0928\u093E",cidrv4:"IPv4 \u0926\u093E\u092F\u0930\u093E",cidrv6:"IPv6 \u0926\u093E\u092F\u0930\u093E",base64:"base64-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",base64url:"base64url-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",e164:"E.164 \u0928\u092E\u094D\u092C\u0930",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${o}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${a}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${N(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u0939\u0930\u0942 \u092E\u0927\u094D\u092F\u0947 \u090F\u0915 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} \u092E\u093E ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} ${o}${n.maximum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} \u092E\u093E ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} ${o}${n.minimum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.prefix}" \u092C\u093E\u091F \u0938\u0941\u0930\u0941 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.suffix}" \u092E\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.includes}" \u0938\u092E\u093E\u0935\u0947\u0936 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: \u0922\u093E\u0901\u091A\u093E ${o.pattern} \u0938\u0901\u0917 \u092E\u0947\u0932 \u0916\u093E\u0928\u0941\u092A\u0930\u094D\u091B`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: ${n.divisor} \u0915\u094B \u0917\u0941\u0923\u091C \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u091E\u094D\u091C\u0940${n.keys.length>1?"\u0939\u0930\u0942":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u091E\u094D\u091C\u0940: ${n.origin} \u092E\u093E`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u093E`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function Wz(){return{localeError:o5()}}var s5=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"},map:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",mac:"MAC-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",credit_card:"creditcardnummer",currency_code:"valutacode",iban:"IBAN",jwt:"JWT",template_literal:"invoer"},i={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${o}, ontving ${a}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${N(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} is`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} is`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Gz(){return{localeError:s5()}}var a5=()=>{let e={string:{unit:"teikn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"element",verb:"\xE5 innehalde"},set:{unit:"element",verb:"\xE5 innehalde"},map:{unit:"element",verb:"\xE5 innehalde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varigheit",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkoda streng",base64url:"base64url-enkoda streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tal",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventa instanceof ${n.expected}, fekk ${a}`:`Ugyldig input: forventa ${o}, fekk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventa ${N(n.values[0])}`:`Ugyldig val: forventa eitt av ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventa ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventa ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 slutte med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 innehalde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tal: m\xE5 vere eit multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjende n\xF8klar":"Ukjend n\xF8kkel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Hz(){return{localeError:a5()}}var c5=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"},map:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`:`Ugyldig input: forventet ${o}, fikk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${N(n.values[0])}`:`Ugyldig valg: forventet en av ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function Jz(){return{localeError:c5()}}var l5=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"},map:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",mac:"MAC ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",credit_card:"i'tib\xE2r kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${N(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=n;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[o.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function Yz(){return{localeError:l5()}}var u5=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},map:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",mac:"\u062F MAC \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",credit_card:"\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",currency_code:"\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${N(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${R(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[o.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${R(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function Xz(){return{localeError:u5()}}var d5=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"},map:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",mac:"adres MAC",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",credit_card:"numer karty kredytowej",currency_code:"kod waluty",iban:"IBAN",jwt:"JWT",template_literal:"wej\u015Bcie"},i={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${a}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${N(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[o.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function Qz(){return{localeError:d5()}}var p5=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(s){return e[s]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"o intervalo de endere\xE7os IPv4",cidrv6:"o intervalo de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},i={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:i.masculine},number:{name:"n\xFAmero",articles:i.masculine},int:{name:"n\xFAmero inteiro",articles:i.masculine},boolean:{name:"valor booleano",articles:i.masculine},bigint:{name:"n\xFAmero bigint",articles:i.masculine},symbol:{name:"s\xEDmbolo",articles:i.masculine},undefined:{name:'valor "undefined"',articles:i.masculine},null:{name:'valor "nulo"',articles:i.masculine},never:{name:'valor "never"',articles:i.masculine},void:{name:'valor "void"',articles:i.masculine},date:{name:"data",articles:i.feminine},array:{name:"vetor",articles:i.masculine},object:{name:"objeto",articles:i.masculine},tuple:{name:"tuplo",articles:i.masculine},record:{name:"registo",articles:i.masculine},map:{name:"mapa",articles:i.masculine},set:{name:"conjunto",articles:i.masculine},file:{name:"ficheiro",articles:i.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:i.masculine},nan:{name:'valor "NaN"',articles:i.masculine},function:{name:"fun\xE7\xE3o",articles:i.feminine}};function o(s,a){let c=n[s]??{name:`valor "${s}"`,articles:i.masculine};return`${c.articles[a]} ${c.name}`}return s=>{switch(s.code){case"invalid_type":{let a=o(s.expected,"indefinite"),c=j(s.input),l=o(c,"indefinite");return`Entrada inv\xE1lida: esperava ${a}, recebeu ${l}`}case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: esperava ${N(s.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${R(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=t(s.origin);return c?`Demasiado grande: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=t(s.origin);return c?`Demasiado pequeno: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.minimum.toString()} ${c.unit??"elementos"}`:`Demasiado pequeno: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar por "${a.prefix}"`:a.format==="ends_with"?`Texto inv\xE1lido: deve terminar em "${a.suffix}"`:a.format==="includes"?`Texto inv\xE1lido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${a.pattern}`:`Formato d${r[a.format]??s.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":{let a=s.keys.length>1?"s":"";return`Chave${a} inv\xE1lida${a}: ${R(s.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${s.options.map(c=>`'${c}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function e1(){return{localeError:p5()}}var f5=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(s){return e[s]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"a faixa de endere\xE7os IPv4",cidrv6:"a faixa de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},i={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:i.masculine},number:{name:"n\xFAmero",articles:i.masculine},int:{name:"n\xFAmero inteiro",articles:i.masculine},boolean:{name:"valor booleano",articles:i.masculine},bigint:{name:"n\xFAmero bigint",articles:i.masculine},symbol:{name:"s\xEDmbolo",articles:i.masculine},undefined:{name:'valor "undefined"',articles:i.masculine},null:{name:'valor "nulo"',articles:i.masculine},never:{name:'valor "never"',articles:i.masculine},void:{name:'valor "void"',articles:i.masculine},date:{name:"data",articles:i.feminine},array:{name:"vetor",articles:i.masculine},object:{name:"objeto",articles:i.masculine},tuple:{name:"tupla",articles:i.feminine},record:{name:"registro",articles:i.masculine},map:{name:"mapa",articles:i.masculine},set:{name:"conjunto",articles:i.masculine},file:{name:"arquivo",articles:i.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:i.masculine},nan:{name:'valor "NaN"',articles:i.masculine},function:{name:"fun\xE7\xE3o",articles:i.feminine}};function o(s,a){let c=n[s]??{name:`valor "${s}"`,articles:i.masculine};return`${c.articles[a]} ${c.name}`}return s=>{switch(s.code){case"invalid_type":{let a=o(s.expected,"indefinite"),c=j(s.input),l=o(c,"indefinite");return`Entrada inv\xE1lida: esperava ${a}, recebeu ${l}`}case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: esperava ${N(s.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${R(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=t(s.origin);return c?`Grande demais: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.maximum.toString()} ${c.unit??"elementos"}`:`Grande demais: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=t(s.origin);return c?`Pequeno demais: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.minimum.toString()} ${c.unit??"elementos"}`:`Pequeno demais: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${a.prefix}"`:a.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${a.suffix}"`:a.format==="includes"?`Texto inv\xE1lido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${a.pattern}`:`Formato d${r[a.format]??s.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":{let a=s.keys.length>1?"s":"";return`Chave${a} inv\xE1lida${a}: ${R(s.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${s.options.map(c=>`'${c}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function t1(){return{localeError:f5()}}var m5=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(n){return e[n]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",credit_card:"num\u0103r de card de credit",currency_code:"cod valutar",iban:"IBAN",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${a}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${N(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${r[o.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${R(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function r1(){return{localeError:m5()}}function n1(e,t,r,i){let n=Math.abs(e),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?t:o>=2&&o<=4?r:i}var h5=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${N(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=n1(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=n1(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function i1(){return{localeError:h5()}}var g5=()=>{let e={string:{unit:"znakov",verb:"ma\u0165"},file:{unit:"bajtov",verb:"ma\u0165"},array:{unit:"prvkov",verb:"ma\u0165"},set:{unit:"prvkov",verb:"ma\u0165"},map:{unit:"polo\u017Eiek",verb:"ma\u0165"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rny v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"d\xE1tum a \u010Das vo form\xE1te ISO",date:"d\xE1tum vo form\xE1te ISO",time:"\u010Das vo form\xE1te ISO",duration:"doba trvania ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64",base64url:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64url",json_string:"re\u0165azec vo form\xE1te JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditnej karty",currency_code:"k\xF3d meny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"re\u0165azec",function:"funkcia",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 instanceof ${n.expected}, obdr\u017Ean\xE9 ${a}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${o}, obdr\u017Ean\xE9 ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${N(n.values[0])}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE1 jedna z hodn\xF4t ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${o}${n.maximum.toString()} ${s.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${o}${n.minimum.toString()} ${s.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD re\u0165azec: mus\xED za\u010D\xEDna\u0165 na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD re\u0165azec: mus\xED kon\u010Di\u0165 na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD re\u0165azec: mus\xED obsahova\u0165 "${o.includes}"`:o.format==="regex"?`Neplatn\xFD re\u0165azec: mus\xED zodpoveda\u0165 vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED by\u0165 n\xE1sobkom ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1me kl\xFA\u010De: ${R(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xFA\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function o1(){return{localeError:g5()}}var y5=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"},map:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",mac:"MAC naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",credit_card:"\u0161tevilka kreditne kartice",currency_code:"koda valute",iban:"IBAN",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${a}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${N(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${o}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${o}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${r[o.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${R(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function s1(){return{localeError:y5()}}var v5=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"},map:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-adress",ipv6:"IPv6-adress",mac:"MAC-adress",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",credit_card:"kreditkortsnummer",currency_code:"valutakod",iban:"IBAN",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${a}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${N(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${r[o.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function a1(){return{localeError:v5()}}var $5=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},map:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",mac:"MAC \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",credit_card:"\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",currency_code:"\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${N(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${R(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function c1(){return{localeError:$5()}}var b5=()=>{let e={string:{unit:"\u0430\u043B\u043E\u043C\u0430\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},file:{unit:"\u0431\u0430\u0439\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},array:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},set:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},map:{unit:"\u0441\u0430\u0431\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0443\u0440\u0443\u0434",email:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 email",url:"URL",emoji:"\u044D\u043C\u043E\u04B7\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0441\u0430\u043D\u0430\u0432\u0443 \u0432\u0430\u049B\u0442\u0438 ISO",date:"\u0441\u0430\u043D\u0430\u0438 ISO",time:"\u0432\u0430\u049B\u0442\u0438 ISO",duration:"\u0434\u0430\u0432\u043E\u043C\u043D\u043E\u043A\u0438\u0438 ISO",ipv4:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv4",ipv6:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv6",mac:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 MAC",cidrv4:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv4",cidrv6:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv6",base64:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64",base64url:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64url",json_string:"\u0441\u0430\u0442\u0440\u0438 JSON",e164:"\u0440\u0430\u049B\u0430\u043C\u0438 E.164",credit_card:"\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",currency_code:"\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0443\u0440\u0443\u0434"},i={nan:"NaN",number:"\u0440\u0430\u049B\u0430\u043C",string:"\u0441\u0430\u0442\u0440",array:"\u043C\u0430\u0441\u0441\u0438\u0432",object:"\u043E\u0431\u044A\u0435\u043A\u0442",date:"\u0441\u0430\u043D\u0430"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${o} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442, ${a} \u0433\u0438\u0440\u0438\u0444\u0442\u0430 \u0448\u0443\u0434`}case"invalid_value":return n.values.length===1?`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${N(n.values[0])} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:`\u0418\u043D\u0442\u0438\u0445\u043E\u0431\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u044F\u043A\u0435 \u0430\u0437 ${R(n.values,"|")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${o}${n.maximum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${o}${n.minimum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${o.prefix}" \u043E\u0493\u043E\u0437 \u0448\u0430\u0432\u0430\u0434`:o.format==="ends_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${o.suffix}" \u0430\u043D\u04B7\u043E\u043C \u0451\u0431\u0430\u0434`:o.format==="includes"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 "${o.includes}"-\u0440\u043E \u0434\u0430\u0440 \u0431\u0430\u0440 \u0433\u0438\u0440\u0430\u0434`:o.format==="regex"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 \u043D\u0430\u043C\u0443\u043D\u0430\u0438 ${o.pattern} \u043C\u0443\u0432\u043E\u0444\u0438\u049B\u0430\u0442 \u043A\u0443\u043D\u0430\u0434`:`${r[o.format]??n.format}-\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`}case"not_multiple_of":return`\u0420\u0430\u049B\u0430\u043C\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 ${n.divisor} \u0431\u0435 \u0431\u0430\u049B\u0438\u044F \u0442\u0430\u049B\u0441\u0438\u043C \u0448\u0430\u0432\u0430\u0434`;case"unrecognized_keys":return`\u041A\u0430\u043B\u0438\u0434${n.keys.length>1?"\u04B3\u043E\u0438":"\u0438"} \u043D\u043E\u043C\u0430\u044A\u043B\u0443\u043C: ${R(n.keys,", ")}`;case"invalid_key":return`\u041A\u0430\u043B\u0438\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442\u0438 \u0434\u0438\u0441\u043A\u0440\u0438\u043C\u0438\u043D\u0430\u0442\u043E\u0440: ${n.options.map(s=>`'${s}'`).join(" | ")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442";case"invalid_element":return`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;default:return"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442"}}};function l1(){return{localeError:b5()}}var w5=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},map:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",mac:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",credit_card:"\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",currency_code:"\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",iban:"IBAN",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},i={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${N(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${R(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function u1(){return{localeError:w5()}}var _5=()=>{let e={string:{unit:"simwol",verb:"bolmaly"},file:{unit:"ba\xFDt",verb:"bolmaly"},array:{unit:"elementler",verb:"bolmaly"},set:{unit:"elementler",verb:"bolmaly"},map:{unit:"elementler",verb:"bolmaly"}};function t(n){return e[n]??null}let r={regex:"giri\u015F",email:"e-po\xE7ta salgysy",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 sene we wagt",date:"ISO sene",time:"ISO wagt",duration:"ISO wagt aralygy",ipv4:"IPv4 salgysy",ipv6:"IPv6 salgysy",mac:"MAC salgysy",cidrv4:"IPv4 aralygy",cidrv6:"IPv6 aralygy",base64:"base64 bilen \u015Fifrlenen setir",base64url:"base64url bilen \u015Fifrlenen setir",json_string:"JSON setiri",e164:"E.164 nomeri",credit_card:"kredit kartyny\u0148 nomeri",currency_code:"wal\xFDuta kody",iban:"IBAN",jwt:"JWT",template_literal:"\u015Fablon"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return`N\xE4dogry baha: gara\u015Fylan ${o} \xFDerine ${a} alyndy`}case"invalid_value":return n.values.length===1?`N\xE4dogry baha: ${N(n.values[0])} bolmaly`:`N\xE4dogry sa\xFDlaw: a\u015Fakdakylardan biri bolmaly: ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${o} ${n.maximum.toString()} ${s.unit??"element"}`:`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`N\xE4dogry setir: "${o.prefix}" bilen ba\u015Flamaly`:o.format==="ends_with"?`N\xE4dogry setir: "${o.suffix}" bilen gutarmaly`:o.format==="includes"?`N\xE4dogry setir: "${o.includes}" saklamaly`:o.format==="regex"?`N\xE4dogry setir: ${o.pattern} nusga la\xFDyk bolmaly`:`N\xE4dogry ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xE4dogry san: ${n.divisor} bilen galyndysyz b\xF6l\xFCnmeli`;case"unrecognized_keys":return`Tanalma\xFDan a\xE7ar${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde n\xE4dogry a\xE7ar`;case"invalid_union":return"N\xE4dogry baha";case"invalid_element":return`${n.origin} i\xE7inde n\xE4dogry baha`;default:return"N\xE4dogry baha"}}};function d1(){return{localeError:_5()}}var k5=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},map:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",mac:"MAC adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",credit_card:"kredi kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"\u015Eablon dizesi"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${N(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function p1(){return{localeError:k5()}}var S5=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",mac:"\u0430\u0434\u0440\u0435\u0441\u0430 MAC",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${N(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${R(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function yv(){return{localeError:S5()}}function f1(){return yv()}var x5=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},map:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",mac:"\u0627\u06CC\u0645 \u0627\u06D2 \u0633\u06CC \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",credit_card:"\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",currency_code:"\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",iban:"IBAN",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},i={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${N(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${R(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${o}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${o}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${R(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function m1(){return{localeError:x5()}}var I5=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",credit_card:"kredit karta raqami",currency_code:"valyuta kodi",iban:"IBAN",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${a}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${N(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[o.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function h1(){return{localeError:I5()}}var T5=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},map:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",mac:"\u0111\u1ECBa ch\u1EC9 MAC",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",credit_card:"s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",currency_code:"m\xE3 ti\u1EC1n t\u1EC7",iban:"IBAN",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},i={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${N(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${r[o.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${R(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function g1(){return{localeError:T5()}}var P5=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"},map:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",mac:"MAC\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",credit_card:"\u4FE1\u7528\u5361\u53F7",currency_code:"\u8D27\u5E01\u4EE3\u7801",iban:"IBAN",jwt:"JWT",template_literal:"\u8F93\u5165"},i={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${N(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${r[o.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function y1(){return{localeError:P5()}}var R5=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},map:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",mac:"MAC \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",credit_card:"\u4FE1\u7528\u5361\u865F",currency_code:"\u8CA8\u5E63\u4EE3\u78BC",iban:"IBAN",jwt:"JWT",template_literal:"\u8F38\u5165"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${N(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${R(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function v1(){return{localeError:R5()}}var C5=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"},map:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",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:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",mac:"\xE0d\xEDr\u1EB9\u0301s\xEC MAC",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",credit_card:"n\u1ECDmba kaadi gbese",currency_code:"koodu ow\xF3",iban:"IBAN",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},i={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=j(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${N(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${R(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${o}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.maximum}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${o}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.minimum}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${r[o.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${R(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function $1(){return{localeError:C5()}}var b1,Xx=Symbol("ZodOutput"),Qx=Symbol("ZodInput"),vv=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let n={...i,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function $v(){return new vv}(b1=globalThis).__zod_globalRegistry??(b1.__zod_globalRegistry=$v());var Sr=globalThis.__zod_globalRegistry;var Gr=Symbol.for("zod.compile.invalid"),w1=Symbol.for("zod.compile.fallback"),si=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Le=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function E5(e,t){try{return wv(e,{assertOnly:!0})}catch{return t}}function n0(e,t){try{let r=wv(e),i=bv(e,r);return i._zod.bag.validator=E5(e,r),i}catch(r){if(t?.strict)throw r;return e}}function bv(e,t){if(fv(e))throw new Le("a schema whose subtree contains a reference cycle");let r=ot(e),i=e._zod.run,n=i.__originalRun??i,o=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[w1]||a&&mv(a,s.value))return n(s,a);let c=t(s.value);return c!==Gr?(s.value=c,s):(a&&(a[w1]=!0),n(s,a))};return o.__originalRun=n,r._zod.bag.fallbackRun=n,r._zod.bag.validator=t,r._zod.run=o,i.__originalRun||O5(r,e,t),r}function O5(e,t,r){let i=e,n=t;if(typeof n.safeParse=="function"){let o=n.safeParse;i.safeParse=(s,a)=>{let c=r(s);return c!==Gr?{success:!0,data:c}:o(s,a)}}if(typeof n.parse=="function"){let o=n.parse;i.parse=(s,a)=>{let c=r(s);return c!==Gr?c:o(s,a)}}}function wv(e,t){let r=!0;try{r=fv(e)}catch{}if(r)throw new Le("a schema whose subtree contains a reference cycle");let i={constants:new Map,constantCounter:0,varCounter:0,definite:!0},n=new ka(["input"]),o=Ut(n,i,e,"input",!t?.assertOnly);n.write(o===null?"return true;":`return ${o};`);let s=["INVALID",...i.constants.keys()],a=[Gr,...i.constants.values()],c=n.content.join(`
208
+ `),l=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
209
+ ${c}`:c:"",u=Function,d=`return (input) => {
210
+ ${c}
211
+ }`,p;try{p=new u(...s,d)(...a)}catch(f){throw new Le(`this schema (generated code failed to evaluate: ${f.message})`)}return t?.debug&&(p.code=l),p.definite=i.definite,p}function he(e,t){for(let[i,n]of e.constants)if(n===t)return i;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Ia(e,t){return e.definite=!1,he(e,t)}function ue(e){return`v${e.varCounter++}`}function N5(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Gr;let i=r;return i.issues.length===0?i.value:Gr}function zr(e,t,r,i,n=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return Ut(e,t,r,i,n)}catch(l){if(!(l instanceof Le)||!l.islandable)throw l;if(e.content.length=o,t.constants.size>s){let u=Array.from(t.constants.keys()).slice(s);for(let d of u)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,j5(e,t,r,i)}}function j5(e,t,r,i){t.definite=!1;let n=he(t,r),o=he(t,N5),s=ue(t);return e.write(`const ${s} = ${o}(${n}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var z5=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function D5(e,t,r,i){let n=r._zod.def.checks;if(!n||n.length===0)return i;let o=i;for(let s of n){let a=s._zod.def;if(a.when&&!z5.has(a.check))throw new Le('check with a custom "when" condition');switch(a.check){case"greater_than":M5(e,t,a,o);break;case"less_than":L5(e,t,a,o);break;case"multiple_of":U5(e,t,a,o);break;case"number_format":T1(e,a,o);break;case"min_length":{let c=Sa(a.minimum,"min_length"),l=e0(e,t,o,`${o}.length >= ${c} && ${o}.length < ${a.minimum*2}`);e.write(`if (${l} < ${c}) return INVALID;`);break}case"max_length":{let c=Sa(a.maximum,"max_length"),l=e0(e,t,o,`${o}.length > ${c}`);e.write(`if (${l} > ${c}) return INVALID;`);break}case"length_equals":{let c=Sa(a.length,"length_equals"),l=e0(e,t,o,`${o}.length >= ${c} && ${o}.length <= ${a.length*2}`);e.write(`if (${l} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${Sa(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${Sa(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${Sa(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=P1(e,t,a,o);break;case"custom":o=K5(e,t,s,o);break;case"bigint_format":q5(e,a,o);break;case"mime_type":F5(e,t,a,o);break;case"property":V5(e,t,a,o);break;case"properties":Z5(e,t,a,o);break;case"overwrite":{let c=ue(t);B5(e,t,s,o,c),o=c;break}default:throw new Le(`check type ${a.check}`)}}return o}function e0(e,t,r,i){let n=he(t,$a),o=ue(t);return e.write(`const ${o} = typeof ${r} === "string" && ${i} ? ${n}(${r}) : ${r}.length;`),o}function Sa(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Le(`${t} bound of type ${typeof e}`);return`${e}`}function I1(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Le("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Le("comparison check with Invalid Date bound");return he(e,t)}throw new Le(`comparison check bound of type ${typeof t}`)}function M5(e,t,r,i){let n=r.inclusive?"<":"<=";e.write(`if (${i} ${n} ${I1(t,r.value)}) return INVALID;`)}function L5(e,t,r,i){let n=r.inclusive?">":">=";e.write(`if (${i} ${n} ${I1(t,r.value)}) return INVALID;`)}function U5(e,t,r,i){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Le("multiple_of check with a zero divisor");e.write(`if (${i} % ${r.value}n !== 0n) return INVALID;`)}else{let n=he(t,sp);e.write(`if (${n}(${i}, ${Sa(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function T1(e,t,r){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Le(`number format ${i}`)}}function q5(e,t,r){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Le(`bigint format ${i}`)}}function F5(e,t,r,i){let n=r.mime;if(n&&n.length>0){let o=he(t,new Set(n));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function Z5(e,t,r,i){if(r.when)throw new Le('check with a custom "when" condition');e.write(`if (${i} == null) return INVALID;`);let n=r.shape;for(let o of Reflect.ownKeys(n)){let s=typeof o=="symbol"?he(t,o):Kr(o),a=ue(t);e.write(`const ${a} = ${i}[${s}];`),zr(e,t,n[o],a,!1)}}function V5(e,t,r,i){let n=`${i}[${JSON.stringify(r.property)}]`;Ut(e,t,r.schema,n)}function B5(e,t,r,i,n){let o=r._zod.def.tx;if(!o)throw new Le("overwrite check without a transform function");if(Ta(o))throw new si("z.compile: async overwrite transforms are not supported");let s=he(t,o);e.write(`const ${n} = ${s}(${i});`)}function t0(){throw new un}function i0(e){this.issues.push(e)}function K5(e,t,r,i){let n=r._zod.def;if(n.fn){if(Ta(n.fn))throw new si("z.compile: async .refine() predicates are not supported");let o=Ia(t,n.fn),s=he(t,t0),a=ue(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(r._zod.check){if(Ta(r._zod.check))throw new si("z.compile: async .superRefine() / check functions are not supported");let o=r._zod.check,a=Ia(t,l=>{let u={value:l,issues:[],addIssue:i0};return o(u)instanceof Promise&&t0(),u.issues.length===0?u.value:Gr}),c=ue(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new Le("custom check without a predicate or check function")}var W5=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function P1(e,t,r,i,n=!0){let o=r.format;if(o==="base64"){let l=he(t,_p);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(o==="base64url"){let l=he(t,vy);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(o==="jwt"){let l=he(t,xy),u=he(t,r.alg??null);return e.write(`if (!${l}(${i}, ${u})) return INVALID;`),i}if(o==="ipv6"){let l=he(t,wp);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(o==="cidrv6"){let l=he(t,my);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(o==="credit_card"){let l=he(t,wy);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(o==="iban"){let l=he(t,ky);return e.write(`if (!${l}(${i})) return INVALID;`),i}let s=r;if(o==="url"||o==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let l=he(t,Qg),u=he(t,r),d=ue(t),p=ue(t);if(e.write(`const ${d} = ${i}.trim();`),e.write(`const ${p} = ${l}(${d}, ${u});`),e.write(`if (typeof ${p} === "number") return INVALID;`),s.hostname!==void 0){let h=he(t,ey);e.write(`if (!${h}(${p}, ${u}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let h=he(t,ty);e.write(`if (!${h}(${p}, ${u}.protocol)) return INVALID;`)}if(!n)return null;let f=ue(t),m=s.normalize?`${p}.href`:`${he(t,bp)}(${d})`;return e.write(`const ${f} = ${m};`),f}let a=r.fn;if(a){if(Ta(a))throw new Le(`async string format ${o}`);let l=he(t,a);return e.write(`if (!${l}(${i})) return INVALID;`),i}if(W5.has(o)&&r.pattern){let l=he(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${i})) return INVALID;`),i}let c=r.format;switch(c){case"regex":throw new Le("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${Kr(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${i}.slice(0, ${l.length}) !== ${Kr(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${i}.slice(-${l.length}) !== ${Kr(l)}) return INVALID;`);break}default:throw new Le(`string format ${c}`)}return i}function Ut(e,t,r,i,n=!0){let o=r._zod.def,s=o.type;if(o.coerce)throw new Le(`coercion (z.coerce.${s}())`);let a=n||!!o.checks?.length,c;switch(s){case"string":c=G5(e,t,r,i,a);break;case"number":c=H5(e,r,i);break;case"boolean":c=J5(e,i);break;case"bigint":c=Y5(e,r,i);break;case"symbol":c=X5(e,i);break;case"undefined":c=Q5(e,i);break;case"null":c=e8(e,i);break;case"any":case"unknown":c=i;break;case"never":e.write("return INVALID;"),c=i;break;case"void":c=t8(e,i);break;case"nan":c=r8(e,i);break;case"date":c=n8(e,i);break;case"object":c=i8(e,t,r,i,a);break;case"optional":c=o8(e,t,r,i,a);break;case"nullable":c=c8(e,t,r,i,a);break;case"array":c=l8(e,t,r,i,a);break;case"literal":c=u8(e,t,r,i);break;case"enum":c=d8(e,t,r,i);break;case"readonly":{let l=k1(e,t,r,i),u=ue(t);e.write(`const ${u} = Object.freeze(${l});`),c=u;break}case"success":k1(e,t,r,i),c="true";break;case"default":case"prefault":c=p8(e,t,r,i);break;case"nonoptional":c=f8(e,t,r,i);break;case"tuple":c=m8(e,t,r,i);break;case"union":c=h8(e,t,r,i);break;case"intersection":c=v8(e,t,r,i);break;case"record":c=$8(e,t,r,i);break;case"map":c=w8(e,t,r,i);break;case"set":c=_8(e,t,r,i);break;case"file":c=k8(e,i);break;case"template_literal":c=S8(e,t,r,i);break;case"lazy":c=x8(e,t,r,i);break;case"pipe":c=I8(e,t,r,i);break;case"custom":c=T8(e,t,r,i);break;case"transform":c=C8(e,t,r,i);break;case"catch":c=R8(e,t,r,i);break;default:throw new Le(`schema type ${s}`)}return c===null?null:D5(e,t,r,c)}function G5(e,t,r,i,n=!0){e.write(`if (typeof ${i} !== "string") return INVALID;`);let o=r._zod.def;return o.format===void 0?i:P1(e,t,o,i,n)}function H5(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&T1(e,{format:i.format},r),r}function J5(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Y5(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function X5(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Q5(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function e8(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function t8(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function r8(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function n8(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function i8(e,t,r,i,n=!0){let o=r._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),l=c.length?[...a,...c]:a,u=v=>typeof v=="symbol"?he(t,v):Kr(v),d=v=>typeof v=="symbol"?`[${u(v)}]`:Kr(v),p=s;if(a.includes("__proto__"))throw new Le('object shape key "__proto__"');let f=new Map;for(let v of l){let b=p[v],_=u(v),k=ue(t);if(e.write(`const ${k} = ${i}[${_}];`),b._zod.optin!==void 0){let x=ue(t);e.write(`let ${x} = (() => {`),e.indented(S=>{let C=zr(S,t,b,k);S.write(`return ${C};`)}),e.write("})();"),b._zod.optout==="optional"?(e.write(`if (${x} === INVALID) {`),e.indented(S=>{S.write(`if (${_} in ${i}) return INVALID;`),S.write(`${x} = undefined;`)}),e.write("}")):e.write(`if (${x} === INVALID) return INVALID;`),f.set(v,x)}else{a8(b)&&e.write(`if (!(${_} in ${i})) return INVALID;`);let x=zr(e,t,b,k,n);x!==null&&f.set(v,x)}}let m=o.catchall,h="none";if(m){let v=m._zod.def.type;if(v==="never"){let b=a.map(_=>`k !== ${Kr(_)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(_=>{_.write(`if (${b}) return INVALID;`)}),e.write("}")}else(v==="unknown"||v==="any")&&!m._zod.def.checks?.length?h="passthrough":h="schema"}let g=ue(t),y=l.some(v=>_1(p[v])||r0(p[v]));if(!n){if(h==="schema"){let v=a.length>0?he(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(b=>{b.write('if (k === "__proto__") continue;'),v&&b.write(`if (${v}.has(k)) continue;`);let _=ue(t);b.write(`const ${_} = ${i}[k];`),zr(b,t,m,_,!1)}),e.write("}")}return null}if(y){e.write(`const ${g} = {};`);for(let v of l){let b=u(v),_=f.get(v);r0(p[v])?e.write(`if (${b} in ${i}) ${g}[${b}] = ${_};`):_1(p[v])?e.write(`if (${_} !== undefined || ${b} in ${i}) ${g}[${b}] = ${_};`):e.write(`${g}[${b}] = ${_};`)}}else{let v=l.map(b=>`${d(b)}: ${f.get(b)}`).join(", ");e.write(`const ${g} = { ${v} };`)}if(h!=="none"){let v=a.length>0?he(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented(b=>{if(b.write('if (k === "__proto__") continue;'),v&&b.write(`if (${v}.has(k)) continue;`),h==="passthrough")b.write(`${g}[k] = ${i}[k];`);else{let _=ue(t);b.write(`const ${_} = ${i}[k];`);let k=zr(b,t,m,_);b.write(`${g}[k] = ${k};`)}}),e.write("}")}return g}function o8(e,t,r,i,n=!0){let o=r._zod.def;if(s8(r))return Ut(e,t,o.innerType,i,n);if(o.innerType._zod.optin==="defaulted"){let a=ue(t),c=ue(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`const ${c} = (() => {`),l.indented(u=>{let d=Ut(u,t,o.innerType,i);u.write(`return ${d};`)}),l.write("})();"),l.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(l=>{let u=Ut(l,t,o.innerType,i);l.write(`${a} = ${u};`)}),e.write("}"),a}let s=n?ue(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let c=Ut(a,t,o.innerType,i,n);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function s8(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function a8(e){return e._zod.optin===void 0&&xa(e)}function xa(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?xa(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?xa(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(xa):!0;case"intersection":return!t.left||!t.right?!0:xa(t.left)&&xa(t.right);case"pipe":return t.in?xa(t.in):!0;default:return!0}}function r0(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function _1(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&pl(e)}function pl(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?pl(t.innerType):!0;case"union":return t.options?t.options.some(pl):!0;case"intersection":return!t.left||!t.right||pl(t.left)||pl(t.right);case"pipe":return t.out?pl(t.out):!0;default:return!0}}function c8(e,t,r,i,n=!0){let o=r._zod.def,s=n?ue(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let c=Ut(a,t,o.innerType,i,n);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function l8(e,t,r,i,n=!0){let o=r._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`);let s=n?ue(t):null,a=ue(t),c=ue(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(l=>{l.write(`const ${c} = ${i}[${a}];`);let u=zr(l,t,o.element,c,n);s&&u!==null&&l.write(`${s}[${a}] = ${u};`)}),e.write("}"),s}function u8(e,t,r,i){let o=r._zod.def.values;if(o.length!==1){let a=he(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=he(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${Kr(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new Le(`literal type ${typeof s}`);return i}function d8(e,t,r,i){let n=r._zod.values;if(!n)throw new Le("enum schema without enumerated values");let o=he(t,n);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function k1(e,t,r,i){let n=r._zod.def;return Ut(e,t,n.innerType,i)}function p8(e,t,r,i){let n=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return Ut(e,t,n.innerType,i);let c=he(t,s),l=ue(t);return e.write(`let ${l} = ${i};`),e.write(`if (${i} === undefined) ${l} = ${c}();`),Ut(e,t,n.innerType,l)}let a=ue(t);if(s){let c=he(t,s),l=he(t,Wc);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(u=>{u.write(`${a} = ${l}(${c}());`)}),e.write("} else {"),e.indented(u=>{let d=Ut(u,t,n.innerType,i);u.write(`${a} = ${d} === undefined ? ${l}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(c=>{let l=Ut(c,t,n.innerType,i);c.write(`${a} = ${l};`)}),e.write("}");return a}function f8(e,t,r,i){let n=r._zod.def,o=Ut(e,t,n.innerType,i),s=ue(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function m8(e,t,r,i){let n=r._zod.def,o=n.items,s=n.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=S1(o,"optin"),c=S1(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let l=ue(t);e.write(`const ${l} = [];`);for(let u=0;u<o.length;u++){let d=o[u];if(u>=c)e.write(`if (${l}.length === ${u}) {`),e.indented(p=>{p.write(`if (${u} < ${i}.length) {`),p.indented(f=>{let m=ue(t);f.write(`const ${m} = ${i}[${u}];`);let h=zr(f,t,d,m);f.write(`${l}[${u}] = ${h};`)}),p.write("} else {"),p.indented(f=>{if(r0(d)){f.write(`${l}.length = ${u};`);return}let m=ue(t),h=ue(t);f.write(`const ${m} = undefined;`),f.write(`const ${h} = (() => {`),f.indented(g=>{let y=zr(g,t,d,m);g.write(`return ${y};`)}),f.write("})();"),f.write(`if (${h} === INVALID || ${h} === undefined) ${l}.length = ${u};`),f.write(`else ${l}[${u}] = ${h};`)}),p.write("}")}),e.write("}");else{let p=ue(t);e.write(`const ${p} = ${i}[${u}];`);let f=zr(e,t,d,p);e.write(`${l}[${u}] = ${f};`)}}if(s){let u=ue(t),d=ue(t);e.write(`for (let ${u} = ${o.length}; ${u} < ${i}.length; ${u}++) {`),e.indented(p=>{p.write(`const ${d} = ${i}[${u}];`);let f=zr(p,t,s,d);p.write(`${l}[${u}] = ${f};`)}),e.write("}")}return l}function S1(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function h8(e,t,r,i){let n=r._zod.def,o=n.options;if(n.discriminator)return g8(e,t,n,i);if(n.inclusive===!1)throw new Le("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return Ut(e,t,o[0],i);if(o.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(o.flatMap(u=>u._zod.def.values)),l=he(t,c);return e.write(`if (!${l}.has(${i})) return INVALID;`),i}let a=ue(t);e.write(`let ${a};`);for(let c=0;c<o.length;c++){let l=o[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(u=>{let d=Ut(u,t,l,i);u.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function g8(e,t,r,i){if(r.unionFallback)throw new Le("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),i;let n=ue(t),o=ue(t);e.write(`const ${n} = ${i}?.[${Kr(r.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let c of r.options){let l=c._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Le("discriminated union option without static discriminator values");for(let p of l){if(a.has(p))throw new Le(`duplicate discriminator value ${String(p)}`);a.add(p)}let u=Array.from(l,p=>y8(t,n,p)),d=s?"if":"else if";e.write(`${d} (${u.join(" || ")}) {`),e.indented(p=>{let f=Ut(p,t,c,i);p.write(`${o} = ${f};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function y8(e,t,r){if(typeof r=="string")return`${t} === ${Kr(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let i=he(e,r);return`${t} === ${i}`}throw new Le(`literal discriminator value ${String(r)}`)}function v8(e,t,r,i){let n=r._zod.def;t.definite=!1;let o=zr(e,t,n.left,i),s=zr(e,t,n.right,i),a=he(t,il),c=ue(t);return e.write(`const ${c} = ${a}(${o}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function $8(e,t,r,i){let n=r._zod.def,o=he(t,Vn);e.write(`if (!${o}(${i})) return INVALID;`);let s=ue(t),a=ue(t),c=ue(t);e.write(`const ${s} = {};`);let l=n,u=l.partial?void 0:n.keyType._zod.values;if(u){let f=[];for(let h of u){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new Le(`record key value ${String(h)}`);let g=typeof h=="number"?h.toString():h;if(g==="__proto__")throw new Le('record key "__proto__"');f.push(g);let y=he(t,h),v=Ut(e,t,n.keyType,y),b=ue(t);e.write(`const ${b} = ${i}[${b8(t,g)}];`);let _=zr(e,t,n.valueType,b);e.write(`${s}[${v}] = ${_};`)}let m=he(t,new Set(f));return e.write(`for (const ${a} in ${i}) {`),e.indented(h=>{h.write(`if (${m}.has(${a})) continue;`),l.mode==="loose"?h.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):h.write("return INVALID;")}),e.write("}"),s}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let f=n.mode==="loose",m=wv(n.keyType);m.definite===!1&&(t.definite=!1);let h=he(t,m),g=he(t,$o),y=ue(t);return x1(e,t,i,a,v=>{v.write(`let ${y} = ${h}(${a});`),v.write(`if (${y} === INVALID && typeof ${a} === "string" && ${g}.test(${a})) ${y} = ${h}(Number(${a}));`),f?v.write(`if (${y} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):v.write(`if (${y} === INVALID) return INVALID;`),v.write(`if (${y} === "__proto__") continue;`);let b=ue(t);v.write(`const ${b} = ${i}[${a}];`);let _=zr(v,t,n.valueType,b);v.write(`${s}[${y}] = ${_};`)}),s}return x1(e,t,i,a,f=>{f.write(`const ${c} = ${i}[${a}];`);let m=zr(f,t,n.valueType,c);f.write(`${s}[${a}] = ${m};`)},"return INVALID;"),s}function x1(e,t,r,i,n,o){let s=he(t,Object.prototype.propertyIsEnumerable),a=ue(t),c=ue(t),l=ue(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(u=>{u.write(`const ${i} = ${c}[${l}];`),u.write(`if (${i} === "__proto__" || !${s}.call(${r}, ${i})) continue;`),n(u)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(u=>{u.write(`const ${i} = ${a}[${l}];`),u.write(`if (!${s}.call(${r}, ${i})) continue;`),o?u.write(o):n(u)}),e.write("}")}function b8(e,t){return typeof t=="string"?Kr(t):he(e,t)}function w8(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`);let o=ue(t),s=ue(t),a=ue(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(c=>{let l=Ut(c,t,n.keyType,s),u=Ut(c,t,n.valueType,a);c.write(`${o}.set(${l}, ${u});`)}),e.write("}"),o}function _8(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`);let o=ue(t),s=ue(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let c=Ut(a,t,n.valueType,s);a.write(`${o}.add(${c});`)}),e.write("}"),o}function k8(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function S8(e,t,r,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let o=he(t,n);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function x8(e,t,r,i){let n=r._zod.def,o=Ia(t,n.getter),s=he(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${o}();`),c.write(`${s}.parser = function(input) {`),c.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=ue(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function I8(e,t,r,i){let n=r._zod.def,o=Ut(e,t,n.in,i);if(n.transform){if(Ta(n.transform))throw new si("z.compile: async transforms in pipes are not supported");let s=n.transform,c=Ia(t,u=>{let d={value:u,issues:[],addIssue:i0},p=s(u,d);return p instanceof Promise?Gr:d.issues.length===0?p:Gr}),l=ue(t);return e.write(`const ${l} = ${c}(${o});`),e.write(`if (${l} === INVALID) return INVALID;`),Ut(e,t,n.out,l)}else return Ut(e,t,n.out,o)}function Ta(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function T8(e,t,r,i){let n=r._zod.def;if(n.fn){if(Ta(n.fn))throw new si("z.compile: async custom predicates are not supported");let o=Ia(t,n.fn),s=he(t,t0),a=ue(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new Le("custom schema without a predicate function");return i}function P8(e,t,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return Gr;let n=i;return n.issues.length===0?n.value:t()}function R8(e,t,r,i){let n=r._zod.def;if(!n.catchValue[Rg])throw new Le("catch with a callback (only a constant catch value compiles)",!1);let o=ue(t);e.write(`let ${o} = (() => {`),e.indented(l=>{let u=zr(l,t,n.innerType,i);l.write(`return ${u};`)}),e.write("})();");let s=he(t,n.innerType),a=Ia(t,n.catchValue),c=he(t,P8);return e.write(`if (${o} === INVALID) {`),e.indented(l=>{l.write(`${o} = ${c}(${s}, ${a}, ${i});`),l.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function C8(e,t,r,i){let n=r._zod.def;if(n.transform){if(Ta(n.transform))throw new si("z.compile: async transforms are not supported");let o=n.transform,a=Ia(t,l=>{let u={value:l,issues:[],addIssue:i0},d=o(l,u);return d instanceof Promise?Gr:u.issues.length===0?d:Gr}),c=ue(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return i}function _v(e){return e.checks&&(e.checks=[...e.checks]),e}function kv(e,t){return new e(_v({type:"string",...F(t)}))}function o0(e,t){return new e(_v({type:"string",coerce:!0,...F(t)}))}function Op(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...F(t)})}function Np(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...F(t)})}function jp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...F(t)})}function zp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...F(t)})}function Dp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...F(t)})}function Mp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...F(t)})}function fl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...F(t)})}function Lp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...F(t)})}function Up(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...F(t)})}function qp(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...F(t)})}function Fp(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...F(t)})}function Zp(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...F(t)})}function Vp(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...F(t)})}function Bp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...F(t)})}function Kp(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...F(t)})}function Wp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...F(t)})}function Sv(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...F(t)})}function Gp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...F(t)})}function Hp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...F(t)})}function Jp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...F(t)})}function Yp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...F(t)})}function Xp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...F(t)})}function xv(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...F(t)})}function Iv(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...F(t)})}function Qp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...F(t)})}var s0={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function ef(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...F(t)})}function tf(e,t){return new e({type:"string",format:"date",check:"string_format",...F(t)})}function rf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...F(t)})}function nf(e,t){return new e({type:"string",format:"duration",check:"string_format",...F(t)})}function Tv(e,t){return new e(_v({type:"number",checks:[],...F(t)}))}function a0(e,t){return new e(_v({type:"number",coerce:!0,checks:[],...F(t)}))}function Pv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...F(t)})}function Rv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...F(t)})}function Cv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...F(t)})}function Av(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...F(t)})}function Ev(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...F(t)})}function Ov(e,t){return new e({type:"boolean",...F(t)})}function c0(e,t){return new e({type:"boolean",coerce:!0,...F(t)})}function Nv(e,t){return new e({type:"bigint",...F(t)})}function l0(e,t){return new e({type:"bigint",coerce:!0,...F(t)})}function jv(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...F(t)})}function zv(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...F(t)})}function Dv(e,t){return new e({type:"symbol",...F(t)})}function Mv(e,t){return new e({type:"undefined",...F(t)})}function Lv(e,t){return new e({type:"null",...F(t)})}function Uv(e){return new e({type:"any"})}function qv(e){return new e({type:"unknown"})}function Fv(e,t){return new e({type:"never",...F(t)})}function Zv(e,t){return new e({type:"void",...F(t)})}function Vv(e,t){return new e({type:"date",...F(t)})}function u0(e,t){return new e({type:"date",coerce:!0,...F(t)})}function Bv(e,t){return new e({type:"nan",...F(t)})}function Mi(e,t){return new Zg({check:"less_than",...F(t),value:e,inclusive:!1})}function On(e,t){return new Zg({check:"less_than",...F(t),value:e,inclusive:!0})}function Li(e,t){return new Vg({check:"greater_than",...F(t),value:e,inclusive:!1})}function Nn(e,t){return new Vg({check:"greater_than",...F(t),value:e,inclusive:!0})}function Kv(e){return Li(0,e)}function Wv(e){return Mi(0,e)}function Gv(e){return On(0,e)}function Hv(e){return Nn(0,e)}function rs(e,t){return new bx({check:"multiple_of",...F(t),value:e})}function ns(e,t){return new kx({check:"max_size",...F(t),maximum:e})}function Ui(e,t){return new Sx({check:"min_size",...F(t),minimum:e})}function Pa(e,t){return new xx({check:"size_equals",...F(t),size:e})}function Ra(e,t){return new Ix({check:"max_length",...F(t),maximum:e})}function bo(e,t){return new Tx({check:"min_length",...F(t),minimum:e})}function Ca(e,t){return new Px({check:"length_equals",...F(t),length:e})}function ml(e,t){return new Rx({check:"string_format",format:"regex",...F(t),pattern:e})}function hl(e){return new Cx({check:"string_format",format:"lowercase",...F(e)})}function gl(e){return new Ax({check:"string_format",format:"uppercase",...F(e)})}function yl(e,t){return new Ex({check:"string_format",format:"includes",...F(t),includes:e})}function vl(e,t){return new Ox({check:"string_format",format:"starts_with",...F(t),prefix:e})}function $l(e,t){return new Nx({check:"string_format",format:"ends_with",...F(t),suffix:e})}function Jv(e,t,r){return new jx({check:"property",property:e,schema:t,...F(r)})}function bl(e,t){return new zx({check:"properties",shape:e,...F(t)})}function wl(e,t){return new Dx({check:"mime_type",mime:e,...F(t)})}function ai(e){return new Mx({check:"overwrite",tx:e})}function _l(e){return ai(t=>t.normalize(e))}function kl(){return ai(e=>e.trim())}function Sl(){return ai(e=>e.toLowerCase())}function xl(){return ai(e=>e.toUpperCase())}function Il(){return ai(e=>wS(e))}function d0(e,t,r){return new e({type:"array",element:t,...F(r)})}function A8(e,t,r){return new e({type:"union",options:t,...F(r)})}function E8(e,t,r){return new e({type:"union",options:t,inclusive:!1,...F(r)})}function O8(e,t,r,i){return new e({type:"union",options:r,discriminator:t,...F(i)})}function N8(e,t,r){return new e({type:"intersection",left:t,right:r})}function j8(e,t,r,i){let n=r instanceof $e,o=n?i:r,s=n?r:null;return new e({type:"tuple",items:t,rest:s,...F(o)})}function z8(e,t,r,i){return new e({type:"record",keyType:t,valueType:r,...F(i)})}function D8(e,t,r,i){return new e({type:"map",keyType:t,valueType:r,...F(i)})}function M8(e,t,r){return new e({type:"set",valueType:t,...F(r)})}function L8(e,t,r){let i=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:i,...F(r)})}function U8(e,t,r){return new e({type:"enum",entries:t,...F(r)})}function q8(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...F(r)})}function Yv(e,t){return new e({type:"file",...F(t)})}function F8(e,t){return new e({type:"transform",transform:t})}function Z8(e,t){return new e({type:"optional",innerType:t})}function V8(e,t){return new e({type:"nullable",innerType:t})}function B8(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wc(r)}})}function K8(e,t,r){return new e({type:"nonoptional",innerType:t,...F(r)})}function W8(e,t){return new e({type:"success",innerType:t})}function G8(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:PS(r)})}function H8(e,t,r){return new e({type:"pipe",in:t,out:r})}function J8(e,t){return new e({type:"readonly",innerType:t})}function Y8(e,t,r){return new e({type:"template_literal",parts:t,...F(r)})}function X8(e,t){return new e({type:"lazy",getter:t})}function Q8(e,t){return new e({type:"promise",innerType:t})}function Xv(e,t,r){let i=F(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function Qv(e,t,r){return new e({type:"custom",check:"custom",fn:t,...F(r)})}function e$(e,t){let r=R1(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(Gc(n,i.value,r._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),i.issues.push(Gc(o))}},e(i.value,i)),t);return r}function R1(e,t){let r=new vt({check:"custom",...F(t)});return r._zod.check=e,r}function t$(e){let t=new vt({check:"describe"});return t._zod.onattach=[r=>{let i=Sr.get(r)??{};Sr.add(r,{...i,description:e})}],t._zod.check=()=>{},t}function r$(e){let t=new vt({check:"meta"});return t._zod.onattach=[r=>{let i=Sr.get(r)??{};Sr.add(r,{...i,...e})}],t._zod.check=()=>{},t}function n$(e,t){let r=F(t),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let o=new Set(i),s=new Set(n),a=e.Codec??al,c=e.Boolean??ol,l=e.String??ts,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new a({type:"pipe",in:u,out:d,transform:((f,m)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:p,continue:!1}),{})}),reverseTransform:((f,m)=>f===!0?i[0]||"true":n[0]||"false"),error:r.error});return p._zod.bag.truthy=i,p._zod.bag.falsy=n,p._zod.bag.case=r.case??"insensitive",p}function is(e,t,r,i={}){let n=F(i),o={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(o.pattern=r),new e(o)}function of(e,...t){for(let r of t)for(let i of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,i)&&kr(e,i,r[i]);return e}function os(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Sr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ur(e,t,r,i,n){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:n}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(n);return Object.assign(r,o),!0}function ft(e,t,r={path:[],schemaPath:[]}){var i;let n=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let p=s.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,p,u)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),ft(d,t,u),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&of(s.schema,c),t.io==="input"&&Hr(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function C1(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ss(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=i.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let n=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,p=e.external.uri??(m=>m);if(d)return{ref:p(d)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${C1(f)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+C1(u)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=n(s);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
212
+
213
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function O1(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let i of t){if(!i||typeof i!="object")return;O1(i);let n=Object.keys(i);if(n.length!==1||n[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var N1=new Set(["type","properties","required","additionalProperties"]),A1=["oneOf","anyOf"];function E1(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function p0(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!N1.has(s))return null;t.push(o)}let r={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let l of t){let u=l.properties?.[s]??E1(l);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let c=a.length===1?a[0]:p0(a)??{allOf:a};kr(r,s,c)}for(let s of o.required??[])i.add(s)}let n={type:"object",properties:r};if(i.size&&(n.required=[...i]),t.every(o=>o.additionalProperties===!1))n.additionalProperties=!1;else{let o=[];for(let s of t){let a=E1(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?n.additionalProperties=o[0]:o.length>1&&(n.additionalProperties={allOf:o})}return n}function eY(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of N1)if(n in e)return;let r=t.filter(n=>A1.some(o=>Array.isArray(n[o]))),i=null;if(!r.length)i=p0(t);else{let n=r[0],o=A1.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let s=t.filter(c=>c!==n),a=n[o].map(c=>p0([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,of(e,i))}function as(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){i(d);let f=e.seen.get(d),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):of(l,m),of(l,u),a._zod.parent===d)for(let g in l)g==="$ref"||g==="allOf"||g in u||delete l[g];if(m.$ref&&f.def)for(let g in l)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g])&&delete l[g]}let p=a._zod.parent;if(p&&p!==d){i(p);let f=e.seen.get(p);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let m in l)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(l[m])===JSON.stringify(f.def[m])&&delete l[m]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())O1(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.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 e.intersections)for(let l of a.get(c)??[])eY(l)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}of(n,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&n.id===o&&delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,kr(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Tl(t,"input",e.processors),output:Tl(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Hr(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Hr(i.element,r);if(i.type==="set")return Hr(i.valueType,r);if(i.type==="lazy")return Hr(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return Hr(i.innerType,r);if(i.type==="intersection")return Hr(i.left,r)||Hr(i.right,r);if(i.type==="record"||i.type==="map")return Hr(i.keyType,r)||Hr(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Hr(i.in,r)||Hr(i.out,r);if(i.type==="object"){for(let n in i.shape)if(Hr(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(Hr(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(Hr(n,r))return!0;return!!(i.rest&&Hr(i.rest,r))}return!1}var f0=(e,t={})=>r=>{let i=os({...r,processors:t});return ft(e,i),ss(i,e),as(i,e)},Tl=(e,t,r={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=os({...n??{},target:o,io:t,processors:r});return ft(e,s),ss(s,e),as(s,e)};var Pl=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Rl=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},j1=(e,t)=>{Pl(e,"minimum",t),Rl(e,"maximum",t)},L1=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},U1=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},q1=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},F1=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},z1=(e,t)=>Pl(e,"minimum",t.minimum),D1=(e,t)=>Rl(e,"maximum",t.maximum),M1=e=>(t,r)=>{F1(t,r.format);let[i,n]=e[r.format];Pl(t,"minimum",i),Rl(t,"maximum",n)},tY={greater_than:(e,t)=>Pl(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Rl(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>L1(e,t.value),number_format:M1(cp),bigint_format:M1(lp),min_length:z1,max_length:D1,length_equals:(e,t)=>j1(e,t.length),min_size:z1,max_size:D1,size_equals:(e,t)=>j1(e,t.size),string_format:(e,t)=>{F1(e,t.format),t.pattern&&U1(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>q1(e,t.mime)};function dr(e){let t={},r=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let o of i)tY[o._zod.def.check]?.(t,o._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Pl(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Pl(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Rl(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Rl(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&L1(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&q1(t,n.mime);for(let o of n.patterns??[])U1(t,o);return t}var rY={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nY=new Map([[gy,ex],[kp,tx]]),Z1=e=>nY.get(e)??e,g0=(e,t,r,i)=>{let n=r;n.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=dr(e);if(typeof o=="number"&&(n.minLength=o),typeof s=="number"&&(n.maxLength=s),a&&(n.format=rY[a]??a,n.format===""&&delete n.format,(a==="time"||u)&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){let d=[...c].map(Z1);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},y0=(e,t,r,i)=>{let n=r,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=dr(e);n.type=u?"integer":"number";let d=typeof l=="number"&&l>=(o??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof o=="number"&&(n.minimum=o),p?f?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof s=="number"&&(n.maximum=s),a){let m=new Set;for(let y of a)Number.isFinite(y)&&y!==0?m.add(Math.abs(y)):ur(e,t,n,i,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[h,...g]=m;h!==void 0&&(n.multipleOf=h),g.length&&(n.allOf=[...n.allOf??[],...g.map(y=>({multipleOf:y}))])}},v0=(e,t,r,i)=>{r.type="boolean"},$0=(e,t,r,i)=>{ur(e,t,r,i,"BigInt cannot be represented in JSON Schema")},b0=(e,t,r,i)=>{ur(e,t,r,i,"Symbols cannot be represented in JSON Schema")},w0=(e,t,r,i)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},_0=(e,t,r,i)=>{ur(e,t,r,i,"Undefined cannot be represented in JSON Schema")},k0=(e,t,r,i)=>{ur(e,t,r,i,"Void cannot be represented in JSON Schema")},S0=(e,t,r,i)=>{r.not={}},x0=(e,t,r,i)=>{},I0=(e,t,r,i)=>{},T0=(e,t,r,i)=>{ur(e,t,r,i,"Date cannot be represented in JSON Schema")},P0=(e,t,r,i)=>{let n=e._zod.def,o=Zc(n.entries);if(o.length===0){r.not={};return}o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},R0=(e,t,r,i)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let o=[];for(let s of n.values)if(s===void 0){if(ur(e,t,r,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ur(e,t,r,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},C0=(e,t,r,i)=>{ur(e,t,r,i,"NaN cannot be represented in JSON Schema")},A0=(e,t,r,i)=>{let n=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},E0=(e,t,r,i)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=dr(e);o!==void 0&&(n.minLength=o),s!==void 0&&(n.maxLength=s),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(c=>({contentMediaType:c})))},O0=(e,t,r,i)=>{r.type="boolean"},N0=(e,t,r,i)=>{ur(e,t,r,i,"Custom types cannot be represented in JSON Schema")},j0=(e,t,r,i)=>{ur(e,t,r,i,"Function types cannot be represented in JSON Schema")},z0=(e,t,r,i)=>{ur(e,t,r,i,"Transforms cannot be represented in JSON Schema")},D0=(e,t,r,i)=>{ur(e,t,r,i,"Map cannot be represented in JSON Schema")},M0=(e,t,r,i)=>{ur(e,t,r,i,"Set cannot be represented in JSON Schema")},L0=(e,t,r,i)=>{let n=r,o=e._zod.def,{minimum:s,maximum:a}=dr(e);typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=ft(o.element,t,{...i,path:[...i.path,"items"]})};function sf(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?sf(t.out):t.type==="catch"?sf(t.innerType):e._zod.optin}var U0=(e,t,r,i)=>{let n=r,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&ur(e,t,n,i,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let l in s)kr(n.properties,l,ft(s[l],t,{...i,path:[...i.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=o.shape[l];(t.io==="input"?sf(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(n.required=c),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall?o.catchall&&(n.additionalProperties=ft(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},o$=(e,t,r,i)=>{let n=e._zod.def,o=n.inclusive===!1,s=n.options.map((a,c)=>ft(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},q0=(e,t,r,i)=>{let n=e._zod.def,o=ft(n.left,t,{...i,path:[...i.path,"allOf",0]}),s=ft(n.right,t,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},F0=(e,t,r,i)=>{let n=r,o=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,g)=>ft(h,t,{...i,path:[...i.path,s,g]})),l=o.rest?ft(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,u=o.items.length;for(;u>0;){let h=o.items[u-1];if(!(t.io==="input"?sf(h)!==void 0:h._zod.optout==="optional"))break;u--}let d=o.items.length,p=!o.rest;t.target==="draft-2020-12"?(n.prefixItems=c,p?n.items=!1:l&&(n.items=l),u>0&&(n.minItems=u),p&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:c},l&&n.items.anyOf.push(l),u>0&&(n.minItems=u),p&&(n.maxItems=d)):(n.items=c,p?n.additionalItems=!1:l&&(n.additionalItems=l),u>0&&(n.minItems=u),p&&(n.maxItems=d));let{minimum:f,maximum:m}=dr(e);typeof f=="number"&&(n.minItems=f),typeof m=="number"&&(n.maxItems=m)};function m0(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let h=m0(e,m,r);return h===m?t:h}for(let m of["anyOf","oneOf"]){let h=t[m];if(!Array.isArray(h))continue;let g=h.map(y=>m0(e,y,r));g.some((y,v)=>y!==h[v])&&(t={...t,[m]:g})}let i=Array.isArray(t.type)?t.type:[t.type],n=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!o?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:p,...f}=t;return f.enum?f.enum=f.enum.map(m=>typeof m=="number"?String(m):m):typeof f.const=="number"&&(f.const=String(f.const)),n&&(f.type="string",o||(f.pattern=(i.includes("number")?$o:gp).source)),f}var h0=new WeakMap;function iY(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let r=new Map;for(let i of h0.get(e)??[]){let n=e.seen.get(i),o=(n?.def??n?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let s=m0(t,o,new Set);s!==o&&r.set(o,s)}if(r.size)for(let i of e.seen.values())for(let n of[i.schema,i.def]){let o=n&&r.get(n.propertyNames);o&&(n.propertyNames=o)}}var Z0=(e,t,r,i)=>{let n=r,o=e._zod.def;n.type="object";let s=o.keyType,a=dr(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let u=ft(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)kr(n.patternProperties,Z1(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ft(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let u=h0.get(t);u||(u=[],h0.set(t,u),t.deferred.push(()=>iY(t))),u.push(e)}n.additionalProperties=ft(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&sf(o.valueType)!==void 0;if(c&&!o.partial&&!l){let u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(n.required=u.map(String))}},V0=(e,t,r,i)=>{let n=e._zod.def,o=ft(n.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},B0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},K0=Symbol();function V1(e,t,r,i,n){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(ur(t,r,i,n,"BigInt defaults cannot be represented in JSON Schema"),K0):JSON.parse(s)}var W0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType;let s=V1(n.defaultValue,e,t,r,i);s!==K0&&(r.default=s)},G0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);if(o.ref=n.innerType,t.io!=="input")return;let s=V1(n.defaultValue,e,t,r,i);s!==K0&&(r._prefault=s)},H0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{ur(e,t,r,i,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},J0=(e,t,r,i)=>{let n=e._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?n.out:n.in:n.out;ft(s,t,i);let a=t.seen.get(e);a.ref=s},Y0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType,r.readOnly=!0},X0=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},s$=(e,t,r,i)=>{let n=e._zod.def;ft(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},Q0=(e,t,r,i)=>{let n=e._zod.innerType;ft(n,t,i);let o=t.seen.get(e);o.ref=n},i$={string:g0,number:y0,boolean:v0,bigint:$0,symbol:b0,null:w0,undefined:_0,void:k0,never:S0,any:x0,unknown:I0,date:T0,enum:P0,literal:R0,nan:C0,template_literal:A0,file:E0,success:O0,custom:N0,function:j0,transform:z0,map:D0,set:M0,array:L0,object:U0,union:o$,intersection:q0,tuple:F0,record:Z0,nullable:V0,nonoptional:B0,default:W0,prefault:G0,catch:H0,pipe:J0,readonly:Y0,promise:X0,optional:s$,lazy:Q0};function Aa(e,t){if("_idmap"in e){let i=e,n=os({...t,processors:i$}),o={};for(let c of i._idmap.entries()){let[l,u]=c;ft(u,n)}let s={},a={registry:i,uri:t?.uri,defs:o};n.external=a;for(let c of i._idmap.entries()){let[l,u]=c;ss(n,u),kr(s,l,as(n,u))}if(Object.keys(o).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=os({...t,processors:i$});return ft(e,r),ss(r,e),as(r,e)}var a$=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=os({processors:i$,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return ft(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ss(this.ctx,t);let i=as(this.ctx,t),{"~standard":n,...o}=i;return o}};var B1={};var Dl={};go(Dl,{ZodAny:()=>vI,ZodArray:()=>_I,ZodBase64:()=>I$,ZodBase64URL:()=>T$,ZodBigInt:()=>jl,ZodBigIntFormat:()=>C$,ZodBoolean:()=>Nl,ZodCIDRv4:()=>S$,ZodCIDRv6:()=>x$,ZodCUID:()=>y$,ZodCUID2:()=>v$,ZodCatch:()=>qI,ZodCodec:()=>hf,ZodCreditCard:()=>fI,ZodCustom:()=>gf,ZodCustomStringFormat:()=>Oa,ZodDate:()=>uf,ZodDefault:()=>jI,ZodDiscriminatedUnion:()=>SI,ZodE164:()=>P$,ZodEmail:()=>f$,ZodEmoji:()=>h$,ZodEnum:()=>Al,ZodExactOptional:()=>O$,ZodFile:()=>AI,ZodFunction:()=>YI,ZodGUID:()=>m$,ZodIBAN:()=>mI,ZodIPv4:()=>_$,ZodIPv6:()=>k$,ZodISODate:()=>ls,ZodISODateTime:()=>cs,ZodISODuration:()=>ds,ZodISOTime:()=>us,ZodInstanceOf:()=>eT,ZodIntersection:()=>xI,ZodJWT:()=>R$,ZodKSUID:()=>w$,ZodLazy:()=>GI,ZodLiteral:()=>CI,ZodMAC:()=>pI,ZodMap:()=>PI,ZodNaN:()=>ZI,ZodNanoID:()=>g$,ZodNever:()=>bI,ZodNonOptional:()=>N$,ZodNull:()=>yI,ZodNullable:()=>NI,ZodNumber:()=>Ol,ZodNumberFormat:()=>Na,ZodObject:()=>df,ZodOptional:()=>ja,ZodPipe:()=>mf,ZodPrefault:()=>DI,ZodPreprocess:()=>VI,ZodPromise:()=>JI,ZodReadonly:()=>BI,ZodRecord:()=>Cl,ZodSet:()=>RI,ZodString:()=>El,ZodStringFormat:()=>bt,ZodSuccess:()=>UI,ZodSymbol:()=>hI,ZodTemplateLiteral:()=>WI,ZodTransform:()=>EI,ZodTuple:()=>II,ZodType:()=>ke,ZodULID:()=>$$,ZodURL:()=>cf,ZodUUID:()=>qi,ZodUndefined:()=>gI,ZodUnion:()=>pf,ZodUnknown:()=>$I,ZodVoid:()=>wI,ZodXID:()=>b$,ZodXor:()=>kI,_ZodString:()=>p$,_default:()=>zI,_function:()=>QD,any:()=>ND,array:()=>Ne,base64:()=>mD,base64url:()=>hD,bigint:()=>RD,boolean:()=>er,catch:()=>FI,check:()=>eM,cidrv4:()=>pD,cidrv6:()=>fD,codec:()=>HD,creditCard:()=>yD,cuid:()=>iD,cuid2:()=>oD,currencyCode:()=>kD,custom:()=>j$,date:()=>zD,describe:()=>tM,discriminatedUnion:()=>ff,e164:()=>gD,email:()=>G1,emoji:()=>rD,enum:()=>Ir,exactOptional:()=>OI,file:()=>BD,float32:()=>xD,float64:()=>ID,function:()=>QD,guid:()=>H1,hash:()=>SD,hex:()=>_D,hostname:()=>wD,httpUrl:()=>tD,iban:()=>vD,instanceof:()=>nM,int:()=>u$,int32:()=>TD,int64:()=>CD,intersection:()=>zl,invertCodec:()=>JD,ipv4:()=>lD,ipv6:()=>dD,json:()=>oM,jwt:()=>$D,keyof:()=>DD,ksuid:()=>cD,lazy:()=>HI,literal:()=>ne,looseObject:()=>xr,looseRecord:()=>qD,mac:()=>uD,map:()=>FD,meta:()=>rM,nan:()=>GD,nanoid:()=>nD,nativeEnum:()=>VD,never:()=>A$,nonoptional:()=>LI,null:()=>lf,nullable:()=>af,nullish:()=>KD,number:()=>st,object:()=>Y,optional:()=>$t,partialRecord:()=>UD,pipe:()=>d$,prefault:()=>MI,preprocess:()=>yf,promise:()=>XD,readonly:()=>KI,record:()=>wt,refine:()=>XI,set:()=>ZD,strictObject:()=>MD,string:()=>A,stringFormat:()=>bD,stringbool:()=>iM,success:()=>WD,superRefine:()=>QI,symbol:()=>ED,templateLiteral:()=>YD,transform:()=>E$,tuple:()=>TI,uint32:()=>PD,uint64:()=>AD,ulid:()=>sD,undefined:()=>OD,union:()=>mt,unknown:()=>St,url:()=>eD,uuid:()=>J1,uuidv4:()=>Y1,uuidv6:()=>X1,uuidv7:()=>Q1,void:()=>jD,xid:()=>aD,xor:()=>LD});var c$={};go(c$,{endsWith:()=>$l,gt:()=>Li,gte:()=>Nn,includes:()=>yl,length:()=>Ca,lowercase:()=>hl,lt:()=>Mi,lte:()=>On,maxLength:()=>Ra,maxSize:()=>ns,mime:()=>wl,minLength:()=>bo,minSize:()=>Ui,multipleOf:()=>rs,negative:()=>Wv,nonnegative:()=>Hv,nonpositive:()=>Gv,normalize:()=>_l,overwrite:()=>ai,positive:()=>Kv,properties:()=>bl,property:()=>Jv,regex:()=>ml,size:()=>Pa,slugify:()=>Il,startsWith:()=>vl,toLowerCase:()=>Sl,toUpperCase:()=>xl,trim:()=>kl,uppercase:()=>gl});var K1=new WeakSet([Object.prototype,Error.prototype]);function l$(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=r(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var W1=(e,t)=>{NS.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);K1.has(r)||(K1.add(r),l$(r,"format",i=>n=>mp(i,n)),l$(r,"flatten",i=>n=>fp(i,n)),l$(r,"addIssue",i=>n=>{i.issues.push(n),i.message=JSON.stringify(i.issues,Vc,2)}),l$(r,"addIssues",i=>n=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,Vc,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},sY=P("ZodError",W1),pn=P("ZodError",W1,void 0,{Parent:Error});var eI=Hc(pn),tI=Jc(pn),rI=Yc(pn),nI=Qc(pn),iI=Ag(pn),oI=Eg(pn),sI=Og(pn),aI=Ng(pn),cI=jg(pn),lI=zg(pn),uI=Dg(pn),dI=Mg(pn);function cY(){vr.localeError||Wt(hv())}function Ea(){vr.memoizer||Wt({memoizer:Ap()})}var ke=P("ZodType",(e,t)=>(cY(),$e.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(O.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ot(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(XI(e,t))},superRefine(e,t){return this.check(QI(e,t))},overwrite(e){return this.check(ai(e))},optional(){return $t(this)},exactOptional(){return OI(this)},nullable(){return af(this)},nullish(){return $t(af(this))},nonoptional(e){return LI(this,e)},array(){return Ne(this)},or(e){return mt([this,e])},and(e){return zl(this,e)},transform(e){return d$(this,E$(e))},default(e){return zI(this,e)},prefault(e){return MI(this,e)},catch(e){return FI(this,e)},pipe(e){return d$(this,e)},readonly(){return KI(this)},describe(e){let t=this.clone();return Sr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Sr.get(this);let t=this.clone();return Sr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return O.hide(this,"~standard",{...Hg(this),jsonSchema:{input:Tl(this,"input"),output:Tl(this,"output")}})},set"~standard"(e){O.own(this,"~standard",e)},parse:function e(t,r){return eI(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await tI(this,t,r,{callee:e})},safeParse(e,t){return rI(this,e,t)},async safeParseAsync(e,t){return nI(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){O.own(this,"spa",e)},validate(e,t){return tl(this,e,t)},validateAsync(e,t){return rl(this,e,t)},encode:function e(t,r){return iI(this,t,r,{callee:e})},decode:function e(t,r){return oI(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await sI(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await aI(this,t,r,{callee:e})},safeEncode(e,t){return cI(this,e,t)},safeDecode(e,t){return lI(this,e,t)},async safeEncodeAsync(e,t){return uI(this,e,t)},async safeDecodeAsync(e,t){return dI(this,e,t)},toJSONSchema(e){return f0(this,{})(e)},get description(){return Sr.get(this)?.description},get _def(){return this._zod.def}}),p$=P("_ZodString",(e,t)=>{ts.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>g0(e,r,i,n)},O.derived({format:e=>dr(e).format??null,minLength:e=>dr(e).minimum??null,maxLength:e=>dr(e).maximum??null},{regex(...e){return this.check(ml(...e))},includes(...e){return this.check(yl(...e))},startsWith(...e){return this.check(vl(...e))},endsWith(...e){return this.check($l(...e))},min(...e){return this.check(bo(...e))},max(...e){return this.check(Ra(...e))},length(...e){return this.check(Ca(...e))},nonempty(...e){return this.check(bo(1,...e))},lowercase(e){return this.check(hl(e))},uppercase(e){return this.check(gl(e))},trim(){return this.check(kl())},normalize(...e){return this.check(_l(...e))},toLowerCase(){return this.check(Sl())},toUpperCase(){return this.check(xl())},slugify(){return this.check(Il())}})),El=P("ZodString",(e,t)=>{ts.init(e,t),p$.init(e,t)},{email(e){return this.check(Op(f$,e))},url(e){return this.check(fl(cf,e))},jwt(e){return this.check(Qp(R$,e))},emoji(e){return this.check(Lp(h$,e))},guid(e){return this.check(Np(m$,e))},uuid(e){return this.check(jp(qi,e))},uuidv4(e){return this.check(zp(qi,e))},uuidv6(e){return this.check(Dp(qi,e))},uuidv7(e){return this.check(Mp(qi,e))},nanoid(e){return this.check(Up(g$,e))},cuid(e){return this.check(qp(y$,e))},cuid2(e){return this.check(Fp(v$,e))},ulid(e){return this.check(Zp($$,e))},base64(e){return this.check(Jp(I$,e))},base64url(e){return this.check(Yp(T$,e))},xid(e){return this.check(Vp(b$,e))},ksuid(e){return this.check(Bp(w$,e))},ipv4(e){return this.check(Kp(_$,e))},ipv6(e){return this.check(Wp(k$,e))},cidrv4(e){return this.check(Gp(S$,e))},cidrv6(e){return this.check(Hp(x$,e))},e164(e){return this.check(Xp(P$,e))},datetime(e){return this.check(ef(cs,e))},date(e){return this.check(tf(ls,e))},time(e){return this.check(rf(us,e))},duration(e){return this.check(nf(ds,e))}});function A(e){return kv(El,e)}var bt=P("ZodStringFormat",(e,t)=>{ut.init(e,t),p$.init(e,t)}),cs=P("ZodISODateTime",(e,t)=>{Zx.init(e,t),bt.init(e,t)}),ls=P("ZodISODate",(e,t)=>{Vx.init(e,t),bt.init(e,t)}),us=P("ZodISOTime",(e,t)=>{Bx.init(e,t),bt.init(e,t)}),ds=P("ZodISODuration",(e,t)=>{Kx.init(e,t),bt.init(e,t)}),f$=P("ZodEmail",(e,t)=>{Xg.init(e,t),bt.init(e,t)});function G1(e){return Op(f$,e)}var m$=P("ZodGUID",(e,t)=>{Jg.init(e,t),bt.init(e,t)});function H1(e){return Np(m$,e)}var qi=P("ZodUUID",(e,t)=>{Yg.init(e,t),bt.init(e,t)});function J1(e){return jp(qi,e)}function Y1(e){return zp(qi,e)}function X1(e){return Dp(qi,e)}function Q1(e){return Mp(qi,e)}var cf=P("ZodURL",(e,t)=>{ry.init(e,t),bt.init(e,t)});function eD(e){return fl(cf,e)}function tD(e){return fl(cf,{protocol:hp,hostname:nx,...O.normalizeParams(e)})}var h$=P("ZodEmoji",(e,t)=>{ny.init(e,t),bt.init(e,t)});function rD(e){return Lp(h$,e)}var g$=P("ZodNanoID",(e,t)=>{iy.init(e,t),bt.init(e,t)});function nD(e){return Up(g$,e)}var y$=P("ZodCUID",(e,t)=>{oy.init(e,t),bt.init(e,t)});function iD(e){return qp(y$,e)}var v$=P("ZodCUID2",(e,t)=>{sy.init(e,t),bt.init(e,t)});function oD(e){return Fp(v$,e)}var $$=P("ZodULID",(e,t)=>{ay.init(e,t),bt.init(e,t)});function sD(e){return Zp($$,e)}var b$=P("ZodXID",(e,t)=>{cy.init(e,t),bt.init(e,t)});function aD(e){return Vp(b$,e)}var w$=P("ZodKSUID",(e,t)=>{ly.init(e,t),bt.init(e,t)});function cD(e){return Bp(w$,e)}var _$=P("ZodIPv4",(e,t)=>{uy.init(e,t),bt.init(e,t)});function lD(e){return Kp(_$,e)}var pI=P("ZodMAC",(e,t)=>{py.init(e,t),bt.init(e,t)});function uD(e){return Sv(pI,e)}var k$=P("ZodIPv6",(e,t)=>{dy.init(e,t),bt.init(e,t)});function dD(e){return Wp(k$,e)}var S$=P("ZodCIDRv4",(e,t)=>{fy.init(e,t),bt.init(e,t)});function pD(e){return Gp(S$,e)}var x$=P("ZodCIDRv6",(e,t)=>{hy.init(e,t),bt.init(e,t)});function fD(e){return Hp(x$,e)}var I$=P("ZodBase64",(e,t)=>{yy.init(e,t),bt.init(e,t)});function mD(e){return Jp(I$,e)}var T$=P("ZodBase64URL",(e,t)=>{$y.init(e,t),bt.init(e,t)});function hD(e){return Yp(T$,e)}var P$=P("ZodE164",(e,t)=>{by.init(e,t),bt.init(e,t)});function gD(e){return Xp(P$,e)}var fI=P("ZodCreditCard",(e,t)=>{_y.init(e,t),bt.init(e,t)});function yD(e){return xv(fI,e)}var mI=P("ZodIBAN",(e,t)=>{Sy.init(e,t),bt.init(e,t)});function vD(e){return Iv(mI,e)}var R$=P("ZodJWT",(e,t)=>{Iy.init(e,t),bt.init(e,t)});function $D(e){return Qp(R$,e)}var Oa=P("ZodCustomStringFormat",(e,t)=>{Ty.init(e,t),bt.init(e,t)});function bD(e,t,r={}){return is(Oa,e,t,r)}function wD(e){return is(Oa,"hostname",rx,e)}function _D(e){return is(Oa,"hex",yx,e)}function kD(e){return is(Oa,"currency_code",ox,e)}function SD(e,t){let r=t?.enc??"hex",i=`${e}_${r}`,n=En[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return is(Oa,i,n,t)}var Ol=P("ZodNumber",(e,t)=>{Sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>y0(e,r,i,n),e.isFinite=!0},O.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=dr(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=dr(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=dr(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>dr(e).format??null},{gt(e,t){return this.check(Li(e,t))},gte(e,t){return this.check(Nn(e,t))},min(e,t){return this.check(Nn(e,t))},lt(e,t){return this.check(Mi(e,t))},lte(e,t){return this.check(On(e,t))},max(e,t){return this.check(On(e,t))},int(e){return this.check(u$(e))},safe(e){return this.check(u$(e))},positive(e){return this.check(Li(0,e))},nonnegative(e){return this.check(Nn(0,e))},negative(e){return this.check(Mi(0,e))},nonpositive(e){return this.check(On(0,e))},multipleOf(e,t){return this.check(rs(e,t))},step(e,t){return this.check(rs(e,t))},finite(){return this}}));function st(e){return Tv(Ol,e)}var Na=P("ZodNumberFormat",(e,t)=>{Py.init(e,t),Ol.init(e,t)});function u$(e){return Pv(Na,e)}function xD(e){return Rv(Na,e)}function ID(e){return Cv(Na,e)}function TD(e){return Av(Na,e)}function PD(e){return Ev(Na,e)}var Nl=P("ZodBoolean",(e,t)=>{ol.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>v0(e,r,i,n)});function er(e){return Ov(Nl,e)}var jl=P("ZodBigInt",(e,t)=>{xp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>$0(e,r,i,n)},O.derived({minValue:e=>dr(e).minimum??null,maxValue:e=>dr(e).maximum??null,format:e=>dr(e).format??null},{gte(e,t){return this.check(Nn(e,t))},min(e,t){return this.check(Nn(e,t))},gt(e,t){return this.check(Li(e,t))},lt(e,t){return this.check(Mi(e,t))},lte(e,t){return this.check(On(e,t))},max(e,t){return this.check(On(e,t))},positive(e){return this.check(Li(BigInt(0),e))},negative(e){return this.check(Mi(BigInt(0),e))},nonpositive(e){return this.check(On(BigInt(0),e))},nonnegative(e){return this.check(Nn(BigInt(0),e))},multipleOf(e,t){return this.check(rs(e,t))}}));function RD(e){return Nv(jl,e)}var C$=P("ZodBigIntFormat",(e,t)=>{Ry.init(e,t),jl.init(e,t)});function CD(e){return jv(C$,e)}function AD(e){return zv(C$,e)}var hI=P("ZodSymbol",(e,t)=>{Cy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>b0(e,r,i,n)});function ED(e){return Dv(hI,e)}var gI=P("ZodUndefined",(e,t)=>{Ay.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>_0(e,r,i,n)});function OD(e){return Mv(gI,e)}var yI=P("ZodNull",(e,t)=>{Ey.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>w0(e,r,i,n)});function lf(e){return Lv(yI,e)}var vI=P("ZodAny",(e,t)=>{Oy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>x0(e,r,i,n)});function ND(){return Uv(vI)}var $I=P("ZodUnknown",(e,t)=>{Ny.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>I0(e,r,i,n)});function St(){return qv($I)}var bI=P("ZodNever",(e,t)=>{jy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>S0(e,r,i,n)});function A$(e){return Fv(bI,e)}var wI=P("ZodVoid",(e,t)=>{zy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>k0(e,r,i,n)});function jD(e){return Zv(wI,e)}var uf=P("ZodDate",(e,t)=>{Dy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>T0(e,r,i,n),e.min=(r,i)=>e.check(Nn(r,i)),e.max=(r,i)=>e.check(On(r,i))},O.derived({minDate:e=>{let{minimum:t}=dr(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=dr(e);return t?new Date(t):null}},{}));function zD(e){return Vv(uf,e)}var _I=P("ZodArray",(e,t)=>{Ea(),My.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>L0(e,r,i,n),e.element=t.element},{min(e,t){return this.check(bo(e,t))},nonempty(e){return this.check(bo(1,e))},max(e,t){return this.check(Ra(e,t))},length(e,t){return this.check(Ca(e,t))},unwrap(){return this.element}});function Ne(e,t){return d0(_I,e,t)}function DD(e){let t=e._zod.def.shape;return Ir(Object.keys(t))}var df=P("ZodObject",(e,t)=>{Ea(),Wx.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>U0(e,r,i,n),O.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ir(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(O.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(O.mergeDefs(this._zod.def,{catchall:St()}))},loose(){return this.clone(O.mergeDefs(this._zod.def,{catchall:St()}))},strict(){return this.clone(O.mergeDefs(this._zod.def,{catchall:A$()}))},strip(){return this.clone(O.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return O.extend(this,e)},safeExtend(e){return O.safeExtend(this,e)},merge(e){return O.merge(this,e)},pick(e){return O.pick(this,e)},omit(e){return O.omit(this,e)},partial(...e){return O.partial(ja,this,e[0])},exactPartial(...e){return O.partial(O$,this,e[0],"exactPartial")},required(...e){return O.required(N$,this,e[0])}});function Y(e,t){let r={type:"object",shape:e??{},...O.normalizeParams(t)};return new df(r)}function MD(e,t){return new df({type:"object",shape:e,catchall:A$(),...O.normalizeParams(t)})}function xr(e,t){return new df({type:"object",shape:e,catchall:St(),...O.normalizeParams(t)})}var pf=P("ZodUnion",(e,t)=>{sl.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>o$(e,r,i,n),e.options=t.options});function mt(e,t){return new pf({type:"union",options:e,...O.normalizeParams(t)})}var kI=P("ZodXor",(e,t)=>{pf.init(e,t),Uy.init(e,t),e._zod.processJSONSchema=(r,i,n)=>o$(e,r,i,n),e.options=t.options});function LD(e,t){return new kI({type:"union",options:e,inclusive:!1,...O.normalizeParams(t)})}var SI=P("ZodDiscriminatedUnion",(e,t)=>{pf.init(e,t),qy.init(e,t)});function ff(e,t,r){return new SI({type:"union",options:t,discriminator:e,...O.normalizeParams(r)})}var xI=P("ZodIntersection",(e,t)=>{Fy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>q0(e,r,i,n)});function zl(e,t){return new xI({type:"intersection",left:e,right:t})}var II=P("ZodTuple",(e,t)=>{Ea(),Ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>F0(e,r,i,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new ja({type:"optional",innerType:t}))})}});function TI(e,t,r){let i=t instanceof $e,n=i?r:t,o=i?t:null;return new II({type:"tuple",items:e,rest:o,...O.normalizeParams(n)})}var Cl=P("ZodRecord",(e,t)=>{Ea(),Zy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Z0(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType});function wt(e,t,r){return!t||!t._zod?new Cl({type:"record",keyType:A(),valueType:e,...O.normalizeParams(t)}):new Cl({type:"record",keyType:e,valueType:t,...O.normalizeParams(r)})}function UD(e,t,r){return new Cl({type:"record",keyType:e,valueType:t,...O.normalizeParams(r),partial:!0})}function qD(e,t,r){return new Cl({type:"record",keyType:e,valueType:t,mode:"loose",...O.normalizeParams(r)})}var PI=P("ZodMap",(e,t)=>{Ea(),Vy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>D0(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ui(...r)),e.nonempty=r=>e.check(Ui(1,r)),e.max=(...r)=>e.check(ns(...r)),e.size=(...r)=>e.check(Pa(...r))});function FD(e,t,r){return new PI({type:"map",keyType:e,valueType:t,...O.normalizeParams(r)})}var RI=P("ZodSet",(e,t)=>{Ea(),By.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>M0(e,r,i,n),e.min=(...r)=>e.check(Ui(...r)),e.nonempty=r=>e.check(Ui(1,r)),e.max=(...r)=>e.check(ns(...r)),e.size=(...r)=>e.check(Pa(...r))});function ZD(e,t){return new RI({type:"set",valueType:e,...O.normalizeParams(t)})}var Al=P("ZodEnum",(e,t)=>{Ky.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(i,n,o)=>P0(e,i,n,o),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{let o={};for(let s of i)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Al({...t,checks:[],...O.normalizeParams(n),entries:o})},e.exclude=(i,n)=>{let o={...t.entries};for(let s of i)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Al({...t,checks:[],...O.normalizeParams(n),entries:o})}});function Ir(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Al({type:"enum",entries:r,...O.normalizeParams(t)})}function VD(e,t){return new Al({type:"enum",entries:e,...O.normalizeParams(t)})}var CI=P("ZodLiteral",(e,t)=>{Wy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>R0(e,r,i,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ne(e,t){return new CI({type:"literal",values:Array.isArray(e)?e:[e],...O.normalizeParams(t)})}var AI=P("ZodFile",(e,t)=>{Gy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>E0(e,r,i,n),e.min=(r,i)=>e.check(Ui(r,i)),e.max=(r,i)=>e.check(ns(r,i)),e.mime=(r,i)=>e.check(wl(Array.isArray(r)?r:[r],i))});function BD(e){return Yv(AI,e)}var EI=P("ZodTransform",(e,t)=>{Ea(),Hy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>z0(e,r,i,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new es(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(O.issue(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(O.issue(s))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r)):(r.value=n,r)}});function E$(e){return new EI({type:"transform",transform:e})}var ja=P("ZodOptional",(e,t)=>{Tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>s$(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function $t(e){return new ja({type:"optional",innerType:e})}var O$=P("ZodExactOptional",(e,t)=>{Jy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>s$(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function OI(e){return new O$({type:"optional",innerType:e})}var NI=P("ZodNullable",(e,t)=>{Yy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>V0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function af(e){return new NI({type:"nullable",innerType:e})}function KD(e){return $t(af(e))}var jI=P("ZodDefault",(e,t)=>{Xy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>W0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zI(e,t){return new jI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var DI=P("ZodPrefault",(e,t)=>{Qy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>G0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function MI(e,t){return new DI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var N$=P("ZodNonOptional",(e,t)=>{ev.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>B0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function LI(e,t){return new N$({type:"nonoptional",innerType:e,...O.normalizeParams(t)})}var UI=P("ZodSuccess",(e,t)=>{tv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>O0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function WD(e){return new UI({type:"success",innerType:e})}var qI=P("ZodCatch",(e,t)=>{rv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>H0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function FI(e,t){return new qI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:O.constantCatch(t)})}var ZI=P("ZodNaN",(e,t)=>{nv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>C0(e,r,i,n)});function GD(e){return Bv(ZI,e)}var mf=P("ZodPipe",(e,t)=>{Pp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>J0(e,r,i,n),e.in=t.in,e.out=t.out});function d$(e,t){return new mf({type:"pipe",in:e,out:t})}var hf=P("ZodCodec",(e,t)=>{mf.init(e,t),al.init(e,t)});function HD(e,t,r){return new hf({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function JD(e){let t=e._zod.def;return new hf({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var VI=P("ZodPreprocess",(e,t)=>{mf.init(e,t),Hx.init(e,t)}),BI=P("ZodReadonly",(e,t)=>{iv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Y0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function KI(e){return new BI({type:"readonly",innerType:e})}var WI=P("ZodTemplateLiteral",(e,t)=>{ov.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>A0(e,r,i,n)});function YD(e,t){return new WI({type:"template_literal",parts:e,...O.normalizeParams(t)})}var GI=P("ZodLazy",(e,t)=>{cl.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Q0(e,r,i,n),e.unwrap=()=>e._zod.def.getter()});function HI(e){return new GI({type:"lazy",getter:e})}var JI=P("ZodPromise",(e,t)=>{av.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>X0(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function XD(e){return new JI({type:"promise",innerType:e})}var YI=P("ZodFunction",(e,t)=>{sv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>j0(e,r,i,n)});function QD(e){return new YI({type:"function",input:Array.isArray(e?.input)?TI(e?.input):e?.input??Ne(St()),output:e?.output??St()})}var gf=P("ZodCustom",(e,t)=>{cv.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,i,n)=>N0(e,r,i,n)});function eM(e){let t=new vt({check:"custom"});return t._zod.check=e,t}function j$(e,t){return Xv(gf,e??(()=>!0),t)}function XI(e,t={}){return Qv(gf,e,t)}function QI(e,t){return e$(e,t)}var tM=t$,rM=r$,eT=P("ZodInstanceOf",(e,t)=>{gf.init(e,t)},{properties(e,t){return this.check(bl(e,t))}});function nM(e,t={}){let r=new eT({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...O.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var iM=(...e)=>n$({Codec:hf,Boolean:Nl,String:El},...e);function oM(e){let t=HI(()=>mt([A(e),st(),er(),lf(),Ne(t),wt(A(),t)]));return t}function yf(e,t){return new VI({type:"pipe",in:E$(e),out:t})}var lY={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function uY(e){Wt({customError:e})}function dY(){return Wt().customError}var tT;tT||(tT={});var za={};go(za,{ZodISODate:()=>ls,ZodISODateTime:()=>cs,ZodISODuration:()=>ds,ZodISOTime:()=>us,date:()=>fY,datetime:()=>pY,duration:()=>hY,time:()=>mY});function pY(e){return ef(cs,e)}function fY(e){return tf(ls,e)}function mY(e){return rf(us,e)}function hY(e){return nf(ds,e)}var G={...Dl,...c$,iso:za},gY=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function yY(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function sM(e,t){return e.map((r,i)=>i<t?r:r.optional())}function vY(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function $Y(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){let n=r[1]===void 0?void 0:vY(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function bY(e,t){return G.transform(i=>i).check(i=>{let n=i.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let o=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function rT(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let i=String(e);return`${r[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=rT(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),n=[];for(let o of i){let s=rT(e[o],t);if(s===null)return null;n.push(`${o.length}:${o}=${s}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var wY=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),_Y=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function vf(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(vf):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>wY.has(t)?vf(r):!_Y.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(vf))}function aM(e){return e===1?"element":"elements"}function kY(e,t){return G.transform(i=>i).check(i=>{let n=i.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<n.length;s++){let a=rT(n[s],new Set);if(a===null)continue;let c=o.get(a);if(c===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:n,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of n)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${aM(o)}; found ${a}`,input:n,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${aM(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function cM(e,t){if(e!==!1)return e===void 0||e===!0?G.any():Jr(e,t)}var SY=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function lM(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return G.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return G.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let o=$Y(n,t),s=Jr(o,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return G.null();if(n.length===0)return G.never();if(n.length===1)return G.literal(n[0]);if(n.every(s=>typeof s=="string"))return G.enum(n);let o=n.map(s=>G.literal(s));return o.length<2?o[0]:G.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return G.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(o=>{let s={...e,type:o};return lM(s,t)});return n.length===0?G.never():n.length===1?n[0]:G.union(n)}if(!r)return G.any();let i;switch(r){case"string":{let n=G.string();if(e.format){let o=e.format;o==="email"?n=n.check(G.email()):o==="uri"||o==="uri-reference"?n=n.check(G.url()):o==="uuid"||o==="guid"?n=n.check(G.uuid()):o==="date-time"?n=n.check(G.iso.datetime({offset:!0})):o==="date"?n=n.check(G.iso.date()):o==="time"?n=n.check(G.regex(SY)):o==="duration"?n=n.check(G.iso.duration()):o==="hostname"?n=n.check(G.hostname()):o==="ipv4"?n=n.check(G.ipv4()):o==="ipv6"?n=n.check(G.ipv6()):o==="mac"?n=n.check(G.mac()):o==="cidr"?n=n.check(G.cidrv4()):o==="cidr-v6"?n=n.check(G.cidrv6()):o==="base64"?n=n.check(G.base64()):o==="base64url"?n=n.check(G.base64url()):o==="e164"?n=n.check(G.e164()):o==="credit_card"?n=n.check(G.creditCard()):o==="iban"?n=n.check(G.iban()):o==="jwt"?n=n.check(G.jwt()):o==="emoji"?n=n.check(G.emoji()):o==="nanoid"?n=n.check(G.nanoid()):o==="cuid"?n=n.check(G.cuid()):o==="cuid2"?n=n.check(G.cuid2()):o==="ulid"?n=n.check(G.ulid()):o==="xid"?n=n.check(G.xid()):o==="ksuid"&&(n=n.check(G.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?G.number().int():G.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),i=n;break}case"boolean":{i=G.boolean();break}case"null":{i=G.null();break}case"object":{let n={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?Jr(e.additionalProperties,t):void 0;for(let[d,p]of Object.entries(o)){let f=Jr(p,t);kr(n,d,s.has(d)?f:f.optional())}if(e.patternProperties){let d=e.patternProperties,p=Object.keys(d),f=[];for(let h of p){let g=Jr(d[h],t),y=G.string().regex(new RegExp(h));f.push(G.looseRecord(y,g))}let m=[];if(Object.keys(n).length>0&&m.push(G.object(n).passthrough()),m.push(...f),m.length===0)i=G.object({}).passthrough();else if(m.length===1)i=m[0];else{let h=G.intersection(m[0],m[1]);for(let g=2;g<m.length;g++)h=G.intersection(h,m[g]);i=h}if(e.additionalProperties===!1){let h=Object.keys(n),g=p.map(v=>new RegExp(v)),y=i;i=i.check(v=>{if(!Vn(v.value))return;let b=[];for(let _ of Object.keys(v.value))h.includes(_)||g.some(k=>k.test(_))||b.push(_);b.length&&v.issues.push({code:"unrecognized_keys",keys:b,input:v.value,inst:y})})}}else{let d=G.object(n);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,u=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let p=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Jr(p,t)}i=bY(i,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let n=e.prefixItems,o=e.items;if(n&&Array.isArray(n)){let s=typeof e.minItems=="number"?e.minItems:0,a=n.map(d=>Jr(d,t)),c=sM(a,s),l=Array.isArray(o)?void 0:cM(o,t),u=G.tuple(c);i=l?u.rest(l):u,typeof e.minItems=="number"&&(i=i.check(G.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(G.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>Jr(d,t)),c=sM(a,s),l=cM(e.additionalItems,t),u=G.tuple(c);i=l?u.rest(l):u,typeof e.minItems=="number"&&(i=i.check(G.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(G.maxLength(e.maxItems)))}else if(o!==void 0){let s=Jr(o,t),a=G.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=G.array(G.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=kY(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Jr(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return i}function Jr(e,t){if(typeof e=="boolean")return e?G.any():G.never();let r=lM(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>Jr(l,t)),c=G.union(a);r=i?G.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>Jr(l,t)),c=G.xor(a);r=i?G.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=i?r:G.any();else{let a=i?r:Jr(e.allOf[0],t),c=i?0:1;for(let l=c;l<e.allOf.length;l++)a=G.intersection(a,Jr(e.allOf[l],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=G.nullable(r)),e.readOnly===!0&&(r=G.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(n[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(n[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!vf(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(n[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!vf(e.contains)&&(n.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(n[a]=e[a])}for(let a of Object.keys(e))gY.has(a)||kr(n,a,e[a]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function uM(e,t){if(typeof e=="boolean")return e?G.any():G.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=yY(r,t?.defaultTarget),n=r.$defs||r.definitions||{},o={version:i,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Sr};return Jr(r,o)}var dM=Symbol("z.visit/resolving");function $f(e,t){let r=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function n(s){let a=i.get(s);if(a===dM)return new cl({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,dM);let c=o(s),l=r(c,c!==s);return i.set(s,l),l}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let l=a.shape,u=Object.keys(l),d=!1,p={};for(let m of u){let h=n(l[m]);h!==l[m]&&(d=!0),p[m]=h}let f=a.catchall;return a.catchall&&(f=n(a.catchall),f!==a.catchall&&(d=!0)),d?ot(s,{...a,shape:p,catchall:f}):s}case"array":{let l=n(a.element);return l===a.element?s:ot(s,{...a,element:l})}case"tuple":{let l=a.items,u=!1,d=[];for(let f of l){let m=n(f);m!==f&&(u=!0),d.push(m)}let p=a.rest;return a.rest&&(p=n(a.rest),p!==a.rest&&(u=!0)),u?ot(s,{...a,items:d,rest:p}):s}case"record":case"map":{let l=n(a.keyType),u=n(a.valueType);return l===a.keyType&&u===a.valueType?s:ot(s,{...a,keyType:l,valueType:u})}case"set":{let l=n(a.valueType);return l===a.valueType?s:ot(s,{...a,valueType:l})}case"union":{let l=a.options,u=!1,d=[];for(let p of l){let f=n(p);f!==p&&(u=!0),d.push(f)}return u?ot(s,{...a,options:d}):s}case"intersection":{let l=n(a.left),u=n(a.right);return l===a.left&&u===a.right?s:ot(s,{...a,left:l,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=n(a.innerType);return l===a.innerType?s:ot(s,{...a,innerType:l})}case"pipe":{let l=n(a.in),u=n(a.out);return l===a.in&&u===a.out?s:ot(s,{...a,in:l,out:u})}case"function":{let l=n(a.input),u=n(a.output);return l===a.input&&u===a.output?s:ot(s,{...a,input:l,output:u})}case"lazy":{let l=a.getter,{_cachedInner:u,...d}=a;return ot(s,{...d,getter:()=>n(l())})}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":return s;default:return s}}return n(e)}function pM(e){return $f(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:mt(r.options)}})}function xY(e,t){if(!t?.length)return e;let r=e._zod.def;return ot(e,Zn(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function fM(e){return xY(e.out,e.checks)}function IY(e){return e.in._zod.traits.has("$ZodTransform")?fM(e):e.in}function mM(e){return $f(e,{pipe:t=>IY(t._zod.def),default:(t,r)=>r?$t(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function hM(e){return $f(e,{pipe:t=>fM(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var nT={};go(nT,{bigint:()=>CY,boolean:()=>RY,date:()=>AY,number:()=>PY,string:()=>TY});function TY(e){return o0(El,e)}function PY(e){return a0(Ol,e)}function RY(e){return c0(Nl,e)}function CY(e){return l0(jl,e)}function AY(e){return u0(uf,e)}var oT="2025-11-25";var gM=[oT,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ps="io.modelcontextprotocol/related-task",D$="2.0",pr=j$(e=>e!==null&&(typeof e=="object"||typeof e=="function")),yM=mt([A(),st().int()]),vM=A(),$Ie=xr({ttl:st().optional(),pollInterval:st().optional()}),EY=Y({ttl:st().optional()}),OY=Y({taskId:A()}),sT=xr({progressToken:yM.optional(),[ps]:OY.optional()}),jn=Y({_meta:sT.optional()}),bf=jn.extend({task:EY.optional()}),$M=e=>bf.safeParse(e).success,Tr=Y({method:A(),params:jn.loose().optional()}),Kn=Y({_meta:sT.optional()}),Wn=Y({method:A(),params:Kn.loose().optional()}),Pr=xr({_meta:sT.optional()}),M$=mt([A(),st().int()]),bM=Y({jsonrpc:ne(D$),id:M$,...Tr.shape}).strict(),aT=e=>bM.safeParse(e).success,wM=Y({jsonrpc:ne(D$),...Wn.shape}).strict(),_M=e=>wM.safeParse(e).success,cT=Y({jsonrpc:ne(D$),id:M$,result:Pr}).strict(),wf=e=>cT.safeParse(e).success;var de;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(de||(de={}));var lT=Y({jsonrpc:ne(D$),id:M$.optional(),error:Y({code:st().int(),message:A(),data:St().optional()})}).strict();var kM=e=>lT.safeParse(e).success;var SM=mt([bM,wM,cT,lT]),bIe=mt([cT,lT]),L$=Pr.strict(),NY=Kn.extend({requestId:M$.optional(),reason:A().optional()}),U$=Wn.extend({method:ne("notifications/cancelled"),params:NY}),jY=Y({src:A(),mimeType:A().optional(),sizes:Ne(A()).optional(),theme:Ir(["light","dark"]).optional()}),_f=Y({icons:Ne(jY).optional()}),Ml=Y({name:A(),title:A().optional()}),xM=Ml.extend({...Ml.shape,..._f.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),zY=zl(Y({applyDefaults:er().optional()}),wt(A(),St())),DY=yf(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zl(Y({form:zY.optional(),url:pr.optional()}),wt(A(),St()).optional())),MY=xr({list:pr.optional(),cancel:pr.optional(),requests:xr({sampling:xr({createMessage:pr.optional()}).optional(),elicitation:xr({create:pr.optional()}).optional()}).optional()}),LY=xr({list:pr.optional(),cancel:pr.optional(),requests:xr({tools:xr({call:pr.optional()}).optional()}).optional()}),UY=Y({experimental:wt(A(),pr).optional(),sampling:Y({context:pr.optional(),tools:pr.optional()}).optional(),elicitation:DY.optional(),roots:Y({listChanged:er().optional()}).optional(),tasks:MY.optional(),extensions:wt(A(),pr).optional()}),qY=jn.extend({protocolVersion:A(),capabilities:UY,clientInfo:xM}),uT=Tr.extend({method:ne("initialize"),params:qY});var FY=Y({experimental:wt(A(),pr).optional(),logging:pr.optional(),completions:pr.optional(),prompts:Y({listChanged:er().optional()}).optional(),resources:Y({subscribe:er().optional(),listChanged:er().optional()}).optional(),tools:Y({listChanged:er().optional()}).optional(),tasks:LY.optional(),extensions:wt(A(),pr).optional()}),ZY=Pr.extend({protocolVersion:A(),capabilities:FY,serverInfo:xM,instructions:A().optional()}),dT=Wn.extend({method:ne("notifications/initialized"),params:Kn.optional()});var q$=Tr.extend({method:ne("ping"),params:jn.optional()}),VY=Y({progress:st(),total:$t(st()),message:$t(A())}),BY=Y({...Kn.shape,...VY.shape,progressToken:yM}),F$=Wn.extend({method:ne("notifications/progress"),params:BY}),KY=jn.extend({cursor:vM.optional()}),kf=Tr.extend({params:KY.optional()}),Sf=Pr.extend({nextCursor:vM.optional()}),WY=Ir(["working","input_required","completed","failed","cancelled"]),xf=Y({taskId:A(),status:WY,ttl:mt([st(),lf()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:$t(st()),statusMessage:$t(A())}),Ll=Pr.extend({task:xf}),GY=Kn.merge(xf),If=Wn.extend({method:ne("notifications/tasks/status"),params:GY}),Z$=Tr.extend({method:ne("tasks/get"),params:jn.extend({taskId:A()})}),V$=Pr.merge(xf),B$=Tr.extend({method:ne("tasks/result"),params:jn.extend({taskId:A()})}),wIe=Pr.loose(),K$=kf.extend({method:ne("tasks/list")}),W$=Sf.extend({tasks:Ne(xf)}),G$=Tr.extend({method:ne("tasks/cancel"),params:jn.extend({taskId:A()})}),IM=Pr.merge(xf),TM=Y({uri:A(),mimeType:$t(A()),_meta:wt(A(),St()).optional()}),PM=TM.extend({text:A()}),pT=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),RM=TM.extend({blob:pT}),Tf=Ir(["user","assistant"]),Ul=Y({audience:Ne(Tf).optional(),priority:st().min(0).max(1).optional(),lastModified:za.datetime({offset:!0}).optional()}),CM=Y({...Ml.shape,..._f.shape,uri:A(),description:$t(A()),mimeType:$t(A()),size:$t(st()),annotations:Ul.optional(),_meta:$t(xr({}))}),HY=Y({...Ml.shape,..._f.shape,uriTemplate:A(),description:$t(A()),mimeType:$t(A()),annotations:Ul.optional(),_meta:$t(xr({}))}),H$=kf.extend({method:ne("resources/list")}),JY=Sf.extend({resources:Ne(CM)}),J$=kf.extend({method:ne("resources/templates/list")}),YY=Sf.extend({resourceTemplates:Ne(HY)}),fT=jn.extend({uri:A()}),XY=fT,Y$=Tr.extend({method:ne("resources/read"),params:XY}),QY=Pr.extend({contents:Ne(mt([PM,RM]))}),e7=Wn.extend({method:ne("notifications/resources/list_changed"),params:Kn.optional()}),t7=fT,r7=Tr.extend({method:ne("resources/subscribe"),params:t7}),n7=fT,i7=Tr.extend({method:ne("resources/unsubscribe"),params:n7}),o7=Kn.extend({uri:A()}),s7=Wn.extend({method:ne("notifications/resources/updated"),params:o7}),a7=Y({name:A(),description:$t(A()),required:$t(er())}),c7=Y({...Ml.shape,..._f.shape,description:$t(A()),arguments:$t(Ne(a7)),_meta:$t(xr({}))}),X$=kf.extend({method:ne("prompts/list")}),l7=Sf.extend({prompts:Ne(c7)}),u7=jn.extend({name:A(),arguments:wt(A(),A()).optional()}),Q$=Tr.extend({method:ne("prompts/get"),params:u7}),mT=Y({type:ne("text"),text:A(),annotations:Ul.optional(),_meta:wt(A(),St()).optional()}),hT=Y({type:ne("image"),data:pT,mimeType:A(),annotations:Ul.optional(),_meta:wt(A(),St()).optional()}),gT=Y({type:ne("audio"),data:pT,mimeType:A(),annotations:Ul.optional(),_meta:wt(A(),St()).optional()}),d7=Y({type:ne("tool_use"),name:A(),id:A(),input:wt(A(),St()),_meta:wt(A(),St()).optional()}),p7=Y({type:ne("resource"),resource:mt([PM,RM]),annotations:Ul.optional(),_meta:wt(A(),St()).optional()}),f7=CM.extend({type:ne("resource_link")}),yT=mt([mT,hT,gT,f7,p7]),m7=Y({role:Tf,content:yT}),h7=Pr.extend({description:A().optional(),messages:Ne(m7)}),g7=Wn.extend({method:ne("notifications/prompts/list_changed"),params:Kn.optional()}),y7=Y({title:A().optional(),readOnlyHint:er().optional(),destructiveHint:er().optional(),idempotentHint:er().optional(),openWorldHint:er().optional()}),v7=Y({taskSupport:Ir(["required","optional","forbidden"]).optional()}),AM=Y({...Ml.shape,..._f.shape,description:A().optional(),inputSchema:Y({type:ne("object"),properties:wt(A(),pr).optional(),required:Ne(A()).optional()}).catchall(St()),outputSchema:Y({type:ne("object"),properties:wt(A(),pr).optional(),required:Ne(A()).optional()}).catchall(St()).optional(),annotations:y7.optional(),execution:v7.optional(),_meta:wt(A(),St()).optional()}),eb=kf.extend({method:ne("tools/list")}),$7=Sf.extend({tools:Ne(AM)}),tb=Pr.extend({content:Ne(yT).default([]),structuredContent:wt(A(),St()).optional(),isError:er().optional()}),_Ie=tb.or(Pr.extend({toolResult:St()})),b7=bf.extend({name:A(),arguments:wt(A(),St()).optional()}),ql=Tr.extend({method:ne("tools/call"),params:b7}),w7=Wn.extend({method:ne("notifications/tools/list_changed"),params:Kn.optional()}),kIe=Y({autoRefresh:er().default(!0),debounceMs:st().int().nonnegative().default(300)}),Pf=Ir(["debug","info","notice","warning","error","critical","alert","emergency"]),_7=jn.extend({level:Pf}),vT=Tr.extend({method:ne("logging/setLevel"),params:_7}),k7=Kn.extend({level:Pf,logger:A().optional(),data:St()}),S7=Wn.extend({method:ne("notifications/message"),params:k7}),x7=Y({name:A().optional()}),I7=Y({hints:Ne(x7).optional(),costPriority:st().min(0).max(1).optional(),speedPriority:st().min(0).max(1).optional(),intelligencePriority:st().min(0).max(1).optional()}),T7=Y({mode:Ir(["auto","required","none"]).optional()}),P7=Y({type:ne("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:Ne(yT).default([]),structuredContent:Y({}).loose().optional(),isError:er().optional(),_meta:wt(A(),St()).optional()}),R7=ff("type",[mT,hT,gT]),z$=ff("type",[mT,hT,gT,d7,P7]),C7=Y({role:Tf,content:mt([z$,Ne(z$)]),_meta:wt(A(),St()).optional()}),A7=bf.extend({messages:Ne(C7),modelPreferences:I7.optional(),systemPrompt:A().optional(),includeContext:Ir(["none","thisServer","allServers"]).optional(),temperature:st().optional(),maxTokens:st().int(),stopSequences:Ne(A()).optional(),metadata:pr.optional(),tools:Ne(AM).optional(),toolChoice:T7.optional()}),E7=Tr.extend({method:ne("sampling/createMessage"),params:A7}),Rf=Pr.extend({model:A(),stopReason:$t(Ir(["endTurn","stopSequence","maxTokens"]).or(A())),role:Tf,content:R7}),$T=Pr.extend({model:A(),stopReason:$t(Ir(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:Tf,content:mt([z$,Ne(z$)])}),O7=Y({type:ne("boolean"),title:A().optional(),description:A().optional(),default:er().optional()}),N7=Y({type:ne("string"),title:A().optional(),description:A().optional(),minLength:st().optional(),maxLength:st().optional(),format:Ir(["email","uri","date","date-time"]).optional(),default:A().optional()}),j7=Y({type:Ir(["number","integer"]),title:A().optional(),description:A().optional(),minimum:st().optional(),maximum:st().optional(),default:st().optional()}),z7=Y({type:ne("string"),title:A().optional(),description:A().optional(),enum:Ne(A()),default:A().optional()}),D7=Y({type:ne("string"),title:A().optional(),description:A().optional(),oneOf:Ne(Y({const:A(),title:A()})),default:A().optional()}),M7=Y({type:ne("string"),title:A().optional(),description:A().optional(),enum:Ne(A()),enumNames:Ne(A()).optional(),default:A().optional()}),L7=mt([z7,D7]),U7=Y({type:ne("array"),title:A().optional(),description:A().optional(),minItems:st().optional(),maxItems:st().optional(),items:Y({type:ne("string"),enum:Ne(A())}),default:Ne(A()).optional()}),q7=Y({type:ne("array"),title:A().optional(),description:A().optional(),minItems:st().optional(),maxItems:st().optional(),items:Y({anyOf:Ne(Y({const:A(),title:A()}))}),default:Ne(A()).optional()}),F7=mt([U7,q7]),Z7=mt([M7,L7,F7]),V7=mt([Z7,O7,N7,j7]),B7=bf.extend({mode:ne("form").optional(),message:A(),requestedSchema:Y({type:ne("object"),properties:wt(A(),V7),required:Ne(A()).optional()})}),K7=bf.extend({mode:ne("url"),message:A(),elicitationId:A(),url:A().url()}),W7=mt([B7,K7]),G7=Tr.extend({method:ne("elicitation/create"),params:W7}),H7=Kn.extend({elicitationId:A()}),J7=Wn.extend({method:ne("notifications/elicitation/complete"),params:H7}),Fl=Pr.extend({action:Ir(["accept","decline","cancel"]),content:yf(e=>e===null?void 0:e,wt(A(),mt([A(),st(),er(),Ne(A())])).optional())}),Y7=Y({type:ne("ref/resource"),uri:A()});var X7=Y({type:ne("ref/prompt"),name:A()}),Q7=jn.extend({ref:mt([X7,Y7]),argument:Y({name:A(),value:A()}),context:Y({arguments:wt(A(),A()).optional()}).optional()}),rb=Tr.extend({method:ne("completion/complete"),params:Q7});function EM(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function OM(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var eX=Pr.extend({completion:xr({values:Ne(A()).max(100),total:$t(st().int()),hasMore:$t(er())})}),tX=Y({uri:A().startsWith("file://"),name:A().optional(),_meta:wt(A(),St()).optional()}),rX=Tr.extend({method:ne("roots/list"),params:jn.optional()}),bT=Pr.extend({roots:Ne(tX)}),wT=Wn.extend({method:ne("notifications/roots/list_changed"),params:Kn.optional()}),SIe=mt([q$,uT,rb,vT,Q$,X$,H$,J$,Y$,r7,i7,ql,eb,Z$,B$,K$,G$]),xIe=mt([U$,F$,dT,wT,If]),IIe=mt([L$,Rf,$T,Fl,bT,V$,W$,Ll]),TIe=mt([q$,E7,G7,rX,Z$,B$,K$,G$]),PIe=mt([U$,F$,S7,s7,e7,w7,g7,If,J7]),RIe=mt([L$,ZY,eX,h7,l7,JY,YY,QY,tb,$7,V$,W$,Ll]),ie=class e extends Error{constructor(t,r,i){super(`MCP error ${t}: ${r}`),this.code=t,this.data=i,this.name="McpError"}static fromError(t,r,i){if(t===de.UrlElicitationRequired&&i){let n=i;if(n.elicitations)return new iT(n.elicitations,r)}return new e(t,r,i)}},iT=class extends ie{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(de.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var nX=10*1024*1024,nb=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??nX}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
214
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),iX(r)}clear(){this._buffer=void 0}};function iX(e){return SM.parse(JSON.parse(e))}function NM(e){return JSON.stringify(e)+`
215
+ `}var ib=class{constructor(t=jM.stdin,r=jM.stdout,i){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new nb({maxBufferSize:i?.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 t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}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(t){return new Promise(r=>{let i=NM(t);this._stdout.write(i)?r():this._stdout.once("drain",r)})}};var _T=["claude-code","antigravity"],zM=e=>_T.includes(e);function oX(e,t){return e==="antigravity"?`/bk-${t}`:`/bk:${t}`}function kT(e,t){return e.replace(/\{\{bk:([a-z][a-z-]*)\}\}/g,(r,i)=>oX(t,i))}var Be;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=n=>{let o=e.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of o)s[a]=n[a];return e.objectValues(s)},e.objectValues=n=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(Be||(Be={}));var DM;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(DM||(DM={}));var Q=Be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wo=e=>{switch(typeof e){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:e===null?Q.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Q.promise:typeof Map<"u"&&e instanceof Map?Q.map:typeof Set<"u"&&e instanceof Set?Q.set:typeof Date<"u"&&e instanceof Date?Q.date:Q.object;default:return Q.unknown}};var q=Be.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"]);var zn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let a=i,c=0;for(;c<s.path.length;){let l=s.path[c],u=c===s.path.length-1;if(l==="_errors"){u&&a._errors.push(r(s)),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(s)),c++}}};return n(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),i=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(t(n))}else i.push(t(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};zn.create=e=>new zn(e);var sX=(e,t)=>{let r;switch(e.code){case q.invalid_type:e.received===Q.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case q.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Be.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:r=`Unrecognized key(s) in object: ${Be.joinValues(e.keys,", ")}`;break;case q.invalid_union:r="Invalid input";break;case q.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Be.joinValues(e.options)}`;break;case q.invalid_enum_value:r=`Invalid enum value. Expected ${Be.joinValues(e.options)}, received '${e.received}'`;break;case q.invalid_arguments:r="Invalid function arguments";break;case q.invalid_return_type:r="Invalid function return type";break;case q.invalid_date:r="Invalid date";break;case q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Be.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case q.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case q.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case q.custom:r="Invalid input";break;case q.invalid_intersection_types:r="Intersection results could not be merged";break;case q.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case q.not_finite:r="Number must be finite";break;default:r=t.defaultError,Be.assertNever(e)}return{message:r}},fs=sX;var aX=fs;function Cf(){return aX}var ob=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let a="",c=i.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:t,defaultError:a}).message;return{...n,path:o,message:a}};function W(e,t){let r=Cf(),i=ob({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===fs?void 0:fs].filter(n=>!!n)});e.common.issues.push(i)}var Dr=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let i=[];for(let n of r){if(n.status==="aborted")return ge;n.status==="dirty"&&t.dirty(),i.push(n.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return ge;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:t.value,value:i}}},ge=Object.freeze({status:"aborted"}),Zl=e=>({status:"dirty",value:e}),Yr=e=>({status:"valid",value:e}),ST=e=>e.status==="aborted",xT=e=>e.status==="dirty",Da=e=>e.status==="valid",Af=e=>typeof Promise<"u"&&e instanceof Promise;var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));var Gn=class{constructor(t,r,i,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=i,this._key=n}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}},MM=(e,t)=>{if(Da(t))return{success:!0,data:t.value};if(!e.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 zn(e.common.issues);return this._error=r,this._error}}};function Se(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var je=class{get description(){return this._def.description}_getType(t){return wo(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:wo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Dr,ctx:{common:t.parent.common,data:t.data,parsedType:wo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Af(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let i=this.safeParse(t,r);if(i.success)return i.data;throw i.error}safeParse(t,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wo(t)},n=this._parseSync({data:t,path:i.path,parent:i});return MM(i,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wo(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return Da(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>Da(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let i=await this.safeParseAsync(t,r);if(i.success)return i.data;throw i.error}async safeParseAsync(t,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wo(t)},n=this._parse({data:t,path:i.path,parent:i}),o=await(Af(n)?n:Promise.resolve(n));return MM(i,o)}refine(t,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=t(n),a=()=>o.addIssue({code:q.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((i,n)=>t(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(t){return new ui({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 li.create(this,this._def)}nullable(){return So.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hs.create(this)}promise(){return Ma.create(this,this._def)}or(t){return Gl.create([this,t],this._def)}and(t){return Hl.create(this,t,this._def)}transform(t){return new ui({...Se(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new eu({...Se(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new sb({typeName:Z.ZodBranded,type:this,...Se(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new tu({...Se(this._def),innerType:this,catchValue:r,typeName:Z.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ab.create(this,t)}readonly(){return ru.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},cX=/^c[^\s-]{8,}$/i,lX=/^[0-9a-z]+$/,uX=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dX=/^[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,pX=/^[a-z0-9_-]{21}$/i,fX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mX=/^[-+]?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)?)??$/,hX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gX="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",IT,yX=/^(?:(?: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])$/,vX=/^(?:(?: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])$/,$X=/^(([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]))$/,bX=/^(([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])$/,wX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_X=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,LM="((\\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])))",kX=new RegExp(`^${LM}$`);function UM(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function SX(e){return new RegExp(`^${UM(e)}$`)}function xX(e){let t=`${LM}T${UM(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function IX(e,t){return!!((t==="v4"||!t)&&yX.test(e)||(t==="v6"||!t)&&$X.test(e))}function TX(e,t){if(!fX.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function PX(e,t){return!!((t==="v4"||!t)&&vX.test(e)||(t==="v6"||!t)&&bX.test(e))}var Bl=class e extends je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Q.string){let o=this._getOrReturnCtx(t);return W(o,{code:q.invalid_type,expected:Q.string,received:o.parsedType}),ge}let i=new Dr,n;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(n=this._getOrReturnCtx(t,n),W(n,{code:q.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(n=this._getOrReturnCtx(t,n),W(n,{code:q.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(n=this._getOrReturnCtx(t,n),s?W(n,{code:q.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&W(n,{code:q.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")hX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"email",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")IT||(IT=new RegExp(gX,"u")),IT.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"emoji",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")dX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"uuid",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")pX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"nanoid",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")cX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"cuid",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")lX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"cuid2",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")uX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"ulid",code:q.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),W(n,{validation:"url",code:q.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"regex",code:q.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?xX(o).test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?kX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?SX(o).test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{code:q.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?mX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"duration",code:q.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?IX(t.data,o.version)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"ip",code:q.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?TX(t.data,o.alg)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"jwt",code:q.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?PX(t.data,o.version)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"cidr",code:q.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?wX.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"base64",code:q.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?_X.test(t.data)||(n=this._getOrReturnCtx(t,n),W(n,{validation:"base64url",code:q.invalid_string,message:o.message}),i.dirty()):Be.assertNever(o);return{status:i.value,value:t.data}}_regex(t,r,i){return this.refinement(n=>t.test(n),{validation:r,code:q.invalid_string,...re.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Bl.create=e=>new Bl({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...Se(e)});function RX(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}var Ef=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Q.number){let o=this._getOrReturnCtx(t);return W(o,{code:q.invalid_type,expected:Q.number,received:o.parsedType}),ge}let i,n=new Dr;for(let o of this._def.checks)o.kind==="int"?Be.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),W(i,{code:q.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?RX(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),W(i,{code:q.not_finite,message:o.message}),n.dirty()):Be.assertNever(o);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:re.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Be.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Ef.create=e=>new Ef({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...Se(e)});var Of=class e extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Q.bigint)return this._getInvalidInput(t);let i,n=new Dr;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),W(i,{code:q.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Be.assertNever(o);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return W(r,{code:q.invalid_type,expected:Q.bigint,received:r.parsedType}),ge}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:re.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Of.create=e=>new Of({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...Se(e)});var Nf=class extends je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Q.boolean){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.boolean,received:i.parsedType}),ge}return Yr(t.data)}};Nf.create=e=>new Nf({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...Se(e)});var jf=class e extends je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Q.date){let o=this._getOrReturnCtx(t);return W(o,{code:q.invalid_type,expected:Q.date,received:o.parsedType}),ge}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return W(o,{code:q.invalid_date}),ge}let i=new Dr,n;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(n=this._getOrReturnCtx(t,n),W(n,{code:q.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(n=this._getOrReturnCtx(t,n),W(n,{code:q.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):Be.assertNever(o);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};jf.create=e=>new jf({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...Se(e)});var zf=class extends je{_parse(t){if(this._getType(t)!==Q.symbol){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.symbol,received:i.parsedType}),ge}return Yr(t.data)}};zf.create=e=>new zf({typeName:Z.ZodSymbol,...Se(e)});var Kl=class extends je{_parse(t){if(this._getType(t)!==Q.undefined){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.undefined,received:i.parsedType}),ge}return Yr(t.data)}};Kl.create=e=>new Kl({typeName:Z.ZodUndefined,...Se(e)});var Wl=class extends je{_parse(t){if(this._getType(t)!==Q.null){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.null,received:i.parsedType}),ge}return Yr(t.data)}};Wl.create=e=>new Wl({typeName:Z.ZodNull,...Se(e)});var Df=class extends je{constructor(){super(...arguments),this._any=!0}_parse(t){return Yr(t.data)}};Df.create=e=>new Df({typeName:Z.ZodAny,...Se(e)});var ms=class extends je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Yr(t.data)}};ms.create=e=>new ms({typeName:Z.ZodUnknown,...Se(e)});var Fi=class extends je{_parse(t){let r=this._getOrReturnCtx(t);return W(r,{code:q.invalid_type,expected:Q.never,received:r.parsedType}),ge}};Fi.create=e=>new Fi({typeName:Z.ZodNever,...Se(e)});var Mf=class extends je{_parse(t){if(this._getType(t)!==Q.undefined){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.void,received:i.parsedType}),ge}return Yr(t.data)}};Mf.create=e=>new Mf({typeName:Z.ZodVoid,...Se(e)});var hs=class e extends je{_parse(t){let{ctx:r,status:i}=this._processInputParams(t),n=this._def;if(r.parsedType!==Q.array)return W(r,{code:q.invalid_type,expected:Q.array,received:r.parsedType}),ge;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(W(r,{code:s?q.too_big:q.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(W(r,{code:q.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(W(r,{code:q.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Gn(r,s,r.path,a)))).then(s=>Dr.mergeArray(i,s));let o=[...r.data].map((s,a)=>n.type._parseSync(new Gn(r,s,r.path,a)));return Dr.mergeArray(i,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};hs.create=(e,t)=>new hs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...Se(t)});function Vl(e){if(e instanceof Dn){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=li.create(Vl(i))}return new Dn({...e._def,shape:()=>t})}else return e instanceof hs?new hs({...e._def,type:Vl(e.element)}):e instanceof li?li.create(Vl(e.unwrap())):e instanceof So?So.create(Vl(e.unwrap())):e instanceof ko?ko.create(e.items.map(t=>Vl(t))):e}var Dn=class e extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Be.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Q.object){let l=this._getOrReturnCtx(t);return W(l,{code:q.invalid_type,expected:Q.object,received:l.parsedType}),ge}let{status:i,ctx:n}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Fi&&this._def.unknownKeys==="strip"))for(let l in n.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let u=o[l],d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Gn(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Fi){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(l==="strict")a.length>0&&(W(n,{code:q.unrecognized_keys,keys:a}),i.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=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Gn(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>Dr.mergeObjectSync(i,l)):Dr.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let i of Be.objectKeys(t))t[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let i of Be.objectKeys(this.shape))t[i]||(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}deepPartial(){return Vl(this)}partial(t){let r={};for(let i of Be.objectKeys(this.shape)){let n=this.shape[i];t&&!t[i]?r[i]=n:r[i]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let i of Be.objectKeys(this.shape))if(t&&!t[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof li;)o=o._def.innerType;r[i]=o}return new e({...this._def,shape:()=>r})}keyof(){return qM(Be.objectKeys(this.shape))}};Dn.create=(e,t)=>new Dn({shape:()=>e,unknownKeys:"strip",catchall:Fi.create(),typeName:Z.ZodObject,...Se(t)});Dn.strictCreate=(e,t)=>new Dn({shape:()=>e,unknownKeys:"strict",catchall:Fi.create(),typeName:Z.ZodObject,...Se(t)});Dn.lazycreate=(e,t)=>new Dn({shape:e,unknownKeys:"strip",catchall:Fi.create(),typeName:Z.ZodObject,...Se(t)});var Gl=class extends je{_parse(t){let{ctx:r}=this._processInputParams(t),i=this._def.options;function n(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new zn(a.ctx.common.issues));return W(r,{code:q.invalid_union,unionErrors:s}),ge}if(r.common.async)return Promise.all(i.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let c of i){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&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new zn(c));return W(r,{code:q.invalid_union,unionErrors:a}),ge}}get options(){return this._def.options}};Gl.create=(e,t)=>new Gl({options:e,typeName:Z.ZodUnion,...Se(t)});var _o=e=>e instanceof Jl?_o(e.schema):e instanceof ui?_o(e.innerType()):e instanceof Yl?[e.value]:e instanceof Xl?e.options:e instanceof Ql?Be.objectValues(e.enum):e instanceof eu?_o(e._def.innerType):e instanceof Kl?[void 0]:e instanceof Wl?[null]:e instanceof li?[void 0,..._o(e.unwrap())]:e instanceof So?[null,..._o(e.unwrap())]:e instanceof sb||e instanceof ru?_o(e.unwrap()):e instanceof tu?_o(e._def.innerType):[],TT=class e extends je{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Q.object)return W(r,{code:q.invalid_type,expected:Q.object,received:r.parsedType}),ge;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);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}):(W(r,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ge)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,i){let n=new Map;for(let o of r){let s=_o(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);n.set(a,o)}}return new e({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...Se(i)})}};function PT(e,t){let r=wo(e),i=wo(t);if(e===t)return{valid:!0,data:e};if(r===Q.object&&i===Q.object){let n=Be.objectKeys(t),o=Be.objectKeys(e).filter(a=>n.indexOf(a)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of o){if(a==="__proto__")continue;let c=PT(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Q.array&&i===Q.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=PT(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===Q.date&&i===Q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Hl=class extends je{_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=(o,s)=>{if(ST(o)||ST(s))return ge;let a=PT(o.value,s.value);return a.valid?((xT(o)||xT(s))&&r.dirty(),{status:r.value,value:a.data}):(W(i,{code:q.invalid_intersection_types}),ge)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Hl.create=(e,t,r)=>new Hl({left:e,right:t,typeName:Z.ZodIntersection,...Se(r)});var ko=class e extends je{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Q.array)return W(i,{code:q.invalid_type,expected:Q.array,received:i.parsedType}),ge;if(i.data.length<this._def.items.length)return W(i,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ge;!this._def.rest&&i.data.length>this._def.items.length&&(W(i,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Gn(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>Dr.mergeArray(r,s)):Dr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ko.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:e,typeName:Z.ZodTuple,rest:null,...Se(t)})};var RT=class e extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Q.object)return W(i,{code:q.invalid_type,expected:Q.object,received:i.parsedType}),ge;let n=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)n.push({key:o._parse(new Gn(i,a,i.path,a)),value:s._parse(new Gn(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Dr.mergeObjectAsync(r,n):Dr.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,i){return r instanceof je?new e({keyType:t,valueType:r,typeName:Z.ZodRecord,...Se(i)}):new e({keyType:Bl.create(),valueType:t,typeName:Z.ZodRecord,...Se(r)})}},Lf=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Q.map)return W(i,{code:q.invalid_type,expected:Q.map,received:i.parsedType}),ge;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,c],l)=>({key:n._parse(new Gn(i,a,i.path,[l,"key"])),value:o._parse(new Gn(i,c,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ge;(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 s){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ge;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(l.value,u.value)}return{status:r.value,value:a}}}};Lf.create=(e,t,r)=>new Lf({valueType:t,keyType:e,typeName:Z.ZodMap,...Se(r)});var Uf=class e extends je{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Q.set)return W(i,{code:q.invalid_type,expected:Q.set,received:i.parsedType}),ge;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(W(i,{code:q.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(W(i,{code:q.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ge;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let a=[...i.data.values()].map((c,l)=>o._parse(new Gn(i,c,i.path,l)));return i.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Uf.create=(e,t)=>new Uf({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...Se(t)});var CT=class e extends je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Q.function)return W(r,{code:q.invalid_type,expected:Q.function,received:r.parsedType}),ge;function i(a,c){return ob({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cf(),fs].filter(l=>!!l),issueData:{code:q.invalid_arguments,argumentsError:c}})}function n(a,c){return ob({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cf(),fs].filter(l=>!!l),issueData:{code:q.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ma){let a=this;return Yr(async function(...c){let l=new zn([]),u=await a._def.args.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw l.addIssue(n(d,f)),l})})}else{let a=this;return Yr(function(...c){let l=a._def.args.safeParse(c,o);if(!l.success)throw new zn([i(c,l.error)]);let u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new zn([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ko.create(t).rest(ms.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,i){return new e({args:t||ko.create([]).rest(ms.create()),returns:r||ms.create(),typeName:Z.ZodFunction,...Se(i)})}},Jl=class extends je{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Jl.create=(e,t)=>new Jl({getter:e,typeName:Z.ZodLazy,...Se(t)});var Yl=class extends je{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return W(r,{received:r.data,code:q.invalid_literal,expected:this._def.value}),ge}return{status:"valid",value:t.data}}get value(){return this._def.value}};Yl.create=(e,t)=>new Yl({value:e,typeName:Z.ZodLiteral,...Se(t)});function qM(e,t){return new Xl({values:e,typeName:Z.ZodEnum,...Se(t)})}var Xl=class e extends je{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),i=this._def.values;return W(r,{expected:Be.joinValues(i),received:r.parsedType,code:q.invalid_type}),ge}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),i=this._def.values;return W(r,{received:r.data,code:q.invalid_enum_value,options:i}),ge}return Yr(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...r})}};Xl.create=qM;var Ql=class extends je{_parse(t){let r=Be.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==Q.string&&i.parsedType!==Q.number){let n=Be.objectValues(r);return W(i,{expected:Be.joinValues(n),received:i.parsedType,code:q.invalid_type}),ge}if(this._cache||(this._cache=new Set(Be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=Be.objectValues(r);return W(i,{received:i.data,code:q.invalid_enum_value,options:n}),ge}return Yr(t.data)}get enum(){return this._def.values}};Ql.create=(e,t)=>new Ql({values:e,typeName:Z.ZodNativeEnum,...Se(t)});var Ma=class extends je{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Q.promise&&r.common.async===!1)return W(r,{code:q.invalid_type,expected:Q.promise,received:r.parsedType}),ge;let i=r.parsedType===Q.promise?r.data:Promise.resolve(r.data);return Yr(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ma.create=(e,t)=>new Ma({type:e,typeName:Z.ZodPromise,...Se(t)});var ui=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=this._def.effect||null,o={addIssue:s=>{W(i,s),s.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ge;let c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?ge:c.status==="dirty"?Zl(c.value):r.value==="dirty"?Zl(c.value):c});{if(r.value==="aborted")return ge;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?ge:a.status==="dirty"?Zl(a.value):r.value==="dirty"?Zl(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,o);if(i.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(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?ge:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?ge:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Da(s))return ge;let a=n.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>Da(s)?Promise.resolve(n.transform(s.value,o)).then(a=>({status:r.value,value:a})):ge);Be.assertNever(n)}};ui.create=(e,t,r)=>new ui({schema:e,typeName:Z.ZodEffects,effect:t,...Se(r)});ui.createWithPreprocess=(e,t,r)=>new ui({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...Se(r)});var li=class extends je{_parse(t){return this._getType(t)===Q.undefined?Yr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};li.create=(e,t)=>new li({innerType:e,typeName:Z.ZodOptional,...Se(t)});var So=class extends je{_parse(t){return this._getType(t)===Q.null?Yr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};So.create=(e,t)=>new So({innerType:e,typeName:Z.ZodNullable,...Se(t)});var eu=class extends je{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return r.parsedType===Q.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};eu.create=(e,t)=>new eu({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Se(t)});var tu=class extends je{_parse(t){let{ctx:r}=this._processInputParams(t),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Af(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};tu.create=(e,t)=>new tu({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Se(t)});var qf=class extends je{_parse(t){if(this._getType(t)!==Q.nan){let i=this._getOrReturnCtx(t);return W(i,{code:q.invalid_type,expected:Q.nan,received:i.parsedType}),ge}return{status:"valid",value:t.data}}};qf.create=e=>new qf({typeName:Z.ZodNaN,...Se(e)});var sb=class extends je{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},ab=class e extends je{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?ge:o.status==="dirty"?(r.dirty(),Zl(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?ge:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(t,r){return new e({in:t,out:r,typeName:Z.ZodPipeline})}},ru=class extends je{_parse(t){let r=this._def.innerType._parse(t),i=n=>(Da(n)&&(n.value=Object.freeze(n.value)),n);return Af(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};ru.create=(e,t)=>new ru({innerType:e,typeName:Z.ZodReadonly,...Se(t)});var eTe={object:Dn.lazycreate},Z;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));var tTe=Bl.create,rTe=Ef.create,nTe=qf.create,iTe=Of.create,oTe=Nf.create,sTe=jf.create,aTe=zf.create,cTe=Kl.create,lTe=Wl.create,uTe=Df.create,dTe=ms.create,pTe=Fi.create,fTe=Mf.create,mTe=hs.create,FM=Dn.create,hTe=Dn.strictCreate,gTe=Gl.create,yTe=TT.create,vTe=Hl.create,$Te=ko.create,bTe=RT.create,wTe=Lf.create,_Te=Uf.create,kTe=CT.create,STe=Jl.create,xTe=Yl.create,ITe=Xl.create,TTe=Ql.create,PTe=Ma.create,RTe=ui.create,CTe=li.create,ATe=So.create,ETe=ui.createWithPreprocess,OTe=ab.create;var AX=P("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");$e.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){Di(this,"with",e)},parse(e,t){return ba(this,e,t,{callee:this.parse})},parseAsync(e,t){return wa(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Xc(this,e,t)},safeParseAsync(e,t){return el(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return ot(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var EX=P("ZodMiniObject",(e,t)=>{Ly.init(e,t),AX.init(e,t),TS(e,"shape",r=>r._zod.def.shape,!1)});function AT(e,t){let r={type:"object",shape:e??{},...F(t)};return new EX(r)}function Zi(e){return!!e._zod}function La(e){let t=Object.values(e);if(t.length===0)return AT({});let r=t.every(Zi),i=t.every(n=>!Zi(n));if(r)return AT(e);if(i)return FM(e);throw new Error("Mixed Zod versions detected in object shape.")}function gs(e,t){return Zi(e)?Xc(e,t):e.safeParse(t)}async function cb(e,t){return Zi(e)?await el(e,t):await e.safeParseAsync(t)}function ys(e){if(!e)return;let t;if(Zi(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function nu(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return La(e)}}if(Zi(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function NX(e){return e.length===0?"object root":e.reduce((t,r,i)=>i===0?String(r):typeof r=="number"?`${t}[${r}]`:`${t}.${r}`,"")}function lb(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(t=>t.path?.length?`${t.message} at ${NX(t.path)}`:t.message).join(`
216
+ `);if("message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function ZM(e){return e.description}function VM(e){if(Zi(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function iu(e){if(Zi(e)){let o=e._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=e._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 i=e.value;if(i!==void 0)return i}function vs(e){return e==="completed"||e==="failed"||e==="cancelled"}var KM=Symbol("Let zodToJsonSchema decide on which parser to use");var BM={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"},WM=e=>typeof e=="string"?{...BM,name:e}:{...BM,...e};var GM=e=>{let t=WM(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function ET(e,t,r,i){i?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function He(e,t,r,i,n){e[t]=r,ET(e,t,i,n)}var ub=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function qt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?ub(t,e.currentPath):t.join("/")}}function HM(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Z.ZodAny&&(r.items=ye(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&He(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&He(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(He(r,"minItems",e.exactLength.value,e.exactLength.message,t),He(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function JM(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":t.target==="jsonSchema7"?i.inclusive?He(r,"minimum",i.value,i.message,t):He(r,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(r.exclusiveMinimum=!0),He(r,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?He(r,"maximum",i.value,i.message,t):He(r,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(r.exclusiveMaximum=!0),He(r,"maximum",i.value,i.message,t));break;case"multipleOf":He(r,"multipleOf",i.value,i.message,t);break}return r}function YM(){return{type:"boolean"}}function db(e,t){return ye(e.type._def,t)}var XM=(e,t)=>ye(e.innerType._def,t);function OT(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>OT(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return jX(e,t)}}var jX=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":He(r,"minimum",i.value,i.message,t);break;case"max":He(r,"maximum",i.value,i.message,t);break}return r};function QM(e,t){return{...ye(e.innerType._def,t),default:e.defaultValue()}}function eL(e,t){return t.effectStrategy==="input"?ye(e.schema._def,t):qt(t)}function tL(e){return{type:"string",enum:Array.from(e.values)}}var zX=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function rL(e,t){let r=[ye(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ye(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(o=>{if(zX(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(i=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function nL(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var NT,di={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:()=>(NT===void 0&&(NT=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),NT),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-_]*$/};function pb(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":He(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":He(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":pi(r,"email",i.message,t);break;case"format:idn-email":pi(r,"idn-email",i.message,t);break;case"pattern:zod":Xr(r,di.email,i.message,t);break}break;case"url":pi(r,"uri",i.message,t);break;case"uuid":pi(r,"uuid",i.message,t);break;case"regex":Xr(r,i.regex,i.message,t);break;case"cuid":Xr(r,di.cuid,i.message,t);break;case"cuid2":Xr(r,di.cuid2,i.message,t);break;case"startsWith":Xr(r,RegExp(`^${jT(i.value,t)}`),i.message,t);break;case"endsWith":Xr(r,RegExp(`${jT(i.value,t)}$`),i.message,t);break;case"datetime":pi(r,"date-time",i.message,t);break;case"date":pi(r,"date",i.message,t);break;case"time":pi(r,"time",i.message,t);break;case"duration":pi(r,"duration",i.message,t);break;case"length":He(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,t),He(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{Xr(r,RegExp(jT(i.value,t)),i.message,t);break}case"ip":{i.version!=="v6"&&pi(r,"ipv4",i.message,t),i.version!=="v4"&&pi(r,"ipv6",i.message,t);break}case"base64url":Xr(r,di.base64url,i.message,t);break;case"jwt":Xr(r,di.jwt,i.message,t);break;case"cidr":{i.version!=="v6"&&Xr(r,di.ipv4Cidr,i.message,t),i.version!=="v4"&&Xr(r,di.ipv6Cidr,i.message,t);break}case"emoji":Xr(r,di.emoji(),i.message,t);break;case"ulid":{Xr(r,di.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{pi(r,"binary",i.message,t);break}case"contentEncoding:base64":{He(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{Xr(r,di.base64,i.message,t);break}}break}case"nanoid":Xr(r,di.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function jT(e,t){return t.patternStrategy==="escape"?MX(e):e}var DX=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function MX(e){let t="";for(let r=0;r<e.length;r++)DX.has(e[r])||(t+="\\"),t+=e[r];return t}function pi(e,t,r,i){e.format||e.anyOf?.some(n=>n.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})):He(e,"format",t,r,i)}function Xr(e,t,r,i){e.pattern||e.allOf?.some(n=>n.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:iL(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})):He(e,"pattern",iL(t,i),r,i)}function iL(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,a=!1;for(let c=0;c<i.length;c++){if(o){n+=i[c],o=!1;continue}if(r.i){if(s){if(i[c].match(/[a-z]/)){a?(n+=i[c],n+=`${i[c-2]}-${i[c]}`.toUpperCase(),a=!1):i[c+1]==="-"&&i[c+2]?.match(/[a-z]/)?(n+=i[c],a=!0):n+=`${i[c]}${i[c].toUpperCase()}`;continue}}else if(i[c].match(/[a-z]/)){n+=`[${i[c]}${i[c].toUpperCase()}]`;continue}}if(r.m){if(i[c]==="^"){n+=`(^|(?<=[\r
217
+ ]))`;continue}else if(i[c]==="$"){n+=`($|(?=[\r
218
+ ]))`;continue}}if(r.s&&i[c]==="."){n+=s?`${i[c]}\r
219
+ `:`[${i[c]}\r
220
+ ]`;continue}n+=i[c],i[c]==="\\"?o=!0:s&&i[c]==="]"?s=!1:!s&&i[c]==="["&&(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function fb(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===Z.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:ye(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??qt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:ye(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Z.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=pb(e.keyType._def,t);return{...r,propertyNames:n}}else{if(e.keyType?._def.typeName===Z.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===Z.ZodBranded&&e.keyType._def.type._def.typeName===Z.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=db(e.keyType._def,t);return{...r,propertyNames:n}}}return r}function oL(e,t){if(t.mapStrategy==="record")return fb(e,t);let r=ye(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||qt(t),i=ye(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||qt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function sL(e){let t=e.values,i=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),n=Array.from(new Set(i.map(o=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function aL(e){return e.target==="openAi"?void 0:{not:qt({...e,currentPath:[...e.currentPath,"not"]})}}function cL(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ff={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function uL(e,t){if(t.target==="openApi3")return lL(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(i=>i._def.typeName in Ff&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=Ff[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,a)=>a.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter(o=>!i.includes(o))],[])};return lL(e,t)}var lL=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>ye(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function dL(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Ff[e.innerType._def.typeName],nullable:!0}:{type:[Ff[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let i=ye(e.innerType._def,{...t,currentPath:[...t.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let r=ye(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function pL(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",ET(r,"type",i.message,t);break;case"min":t.target==="jsonSchema7"?i.inclusive?He(r,"minimum",i.value,i.message,t):He(r,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(r.exclusiveMinimum=!0),He(r,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?He(r,"maximum",i.value,i.message,t):He(r,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(r.exclusiveMaximum=!0),He(r,"maximum",i.value,i.message,t));break;case"multipleOf":He(r,"multipleOf",i.value,i.message,t);break}return r}function fL(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let l=UX(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let u=ye(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});u!==void 0&&(i.properties[a]=u,l||n.push(a))}n.length&&(i.required=n);let s=LX(e,t);return s!==void 0&&(i.additionalProperties=s),i}function LX(e,t){if(e.catchall._def.typeName!=="ZodNever")return ye(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function UX(e){try{return e.isOptional()}catch{return!0}}var mL=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return ye(e.innerType._def,t);let r=ye(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:qt(t)},r]}:qt(t)};var hL=(e,t)=>{if(t.pipeStrategy==="input")return ye(e.in._def,t);if(t.pipeStrategy==="output")return ye(e.out._def,t);let r=ye(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=ye(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter(n=>n!==void 0)}};function gL(e,t){return ye(e.type._def,t)}function yL(e,t){let i={type:"array",uniqueItems:!0,items:ye(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&He(i,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&He(i,"maxItems",e.maxSize.value,e.maxSize.message,t),i}function vL(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>ye(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:ye(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>ye(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function $L(e){return{not:qt(e)}}function bL(e){return qt(e)}var wL=(e,t)=>ye(e.innerType._def,t);var _L=(e,t,r)=>{switch(t){case Z.ZodString:return pb(e,r);case Z.ZodNumber:return pL(e,r);case Z.ZodObject:return fL(e,r);case Z.ZodBigInt:return JM(e,r);case Z.ZodBoolean:return YM();case Z.ZodDate:return OT(e,r);case Z.ZodUndefined:return $L(r);case Z.ZodNull:return cL(r);case Z.ZodArray:return HM(e,r);case Z.ZodUnion:case Z.ZodDiscriminatedUnion:return uL(e,r);case Z.ZodIntersection:return rL(e,r);case Z.ZodTuple:return vL(e,r);case Z.ZodRecord:return fb(e,r);case Z.ZodLiteral:return nL(e,r);case Z.ZodEnum:return tL(e);case Z.ZodNativeEnum:return sL(e);case Z.ZodNullable:return dL(e,r);case Z.ZodOptional:return mL(e,r);case Z.ZodMap:return oL(e,r);case Z.ZodSet:return yL(e,r);case Z.ZodLazy:return()=>e.getter()._def;case Z.ZodPromise:return gL(e,r);case Z.ZodNaN:case Z.ZodNever:return aL(r);case Z.ZodEffects:return eL(e,r);case Z.ZodAny:return qt(r);case Z.ZodUnknown:return bL(r);case Z.ZodDefault:return QM(e,r);case Z.ZodBranded:return db(e,r);case Z.ZodReadonly:return wL(e,r);case Z.ZodCatch:return XM(e,r);case Z.ZodPipeline:return hL(e,r);case Z.ZodFunction:case Z.ZodVoid:case Z.ZodSymbol:return;default:return(i=>{})(t)}};function ye(e,t,r=!1){let i=t.seen.get(e);if(t.override){let a=t.override?.(e,t,i,r);if(a!==KM)return a}if(i&&!r){let a=qX(i,t);if(a!==void 0)return a}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=_L(e,e.typeName,t),s=typeof o=="function"?ye(o(),t):o;if(s&&FX(e,t,s),t.postProcess){let a=t.postProcess(s,e,t);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var qX=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:ub(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),qt(t)):t.$refStrategy==="seen"?qt(t):void 0}},FX=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var zT=(e,t)=>{let r=GM(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,u])=>({...c,[l]:ye(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??qt(r)}),{}):void 0,n=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=ye(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??qt(r),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(o.title=s),r.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[r.openAiAnyTypeName]||(i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]: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};function ZX(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function DT(e,t){return Zi(e)?Aa(e,{target:ZX(t?.target),io:t?.pipeStrategy??"input"}):zT(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function MT(e){let r=ys(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=iu(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function LT(e,t){let r=gs(e,t);if(!r.success)throw r.error;return r.data}var VX=6e4,mb=class{constructor(t){this._options=t,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(U$,r=>{this._oncancel(r)}),this.setNotificationHandler(F$,r=>{this._onprogress(r)}),this.setRequestHandler(q$,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Z$,async(r,i)=>{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new ie(de.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(B$,async(r,i)=>{let n=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,i.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,p=new ie(d.error.code,d.error.message,d.error.data);u(p)}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:i.requestId})}}let s=await this._taskStore.getTask(o,i.sessionId);if(!s)throw new ie(de.InvalidParams,`Task not found: ${o}`);if(!vs(s.status))return await this._waitForTaskUpdate(o,i.signal),await n();if(vs(s.status)){let a=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[ps]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(K$,async(r,i)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,i.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new ie(de.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(G$,async(r,i)=>{try{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new ie(de.InvalidParams,`Task not found: ${r.params.taskId}`);if(vs(n.status))throw new ie(de.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new ie(de.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(n){throw n instanceof ie?n:new ie(de.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,i,n,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),ie.fromError(de.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){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=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{n?.(o,s),wf(o)||kM(o)?this._onresponse(o):aT(o)?this._onrequest(o,s):_M(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let r=ie.fromError(de.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,r){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,o=t.params?._meta?.[ps]?.taskId;if(i===void 0){let u={jsonrpc:"2.0",id:t.id,error:{code:de.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=$M(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,l={signal:s.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async u=>{if(s.signal.aborted)return;let d={relatedRequestId:t.id};o&&(d.relatedTask={taskId:o}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(s.signal.aborted)throw new ie(de.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(u,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,l)).then(async u=>{if(s.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async u=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(u.code)?u.code:de.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()},n?.sessionId):await n?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...i}=t.params,n=Number(r),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(c);return}o(i)}_onresponse(t){let r=Number(t.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),wf(t))i(t);else{let s=new ie(t.error.code,t.error.message,t.error.data);i(s)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(wf(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),wf(t))n(t);else{let s=ie.fromError(t.error.code,t.error.message,t.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,i){let{task:n}=i??{};if(!n){try{yield{type:"result",result:await this.request(t,r,i)}}catch(s){yield{type:"error",error:s instanceof ie?s:new ie(de.InternalError,String(s))}}return}let o;try{let s=await this.request(t,Ll,i);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new ie(de.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:a},vs(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)}:a.status==="failed"?yield{type:"error",error:new ie(de.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new ie(de.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),i?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof ie?s:new ie(de.InternalError,String(s))}}}request(t,r,i){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:c}=i??{};return new Promise((l,u)=>{let d=v=>{u(v)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(v){d(v);return}i?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};i?.onprogress&&(this._progressHandlers.set(p,i.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ps]:c}});let m=v=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(_=>this._onerror(new Error(`Failed to send cancellation: ${_}`)));let b=v instanceof ie?v:new ie(de.RequestTimeout,String(v));u(b)};this._responseHandlers.set(p,v=>{if(!i?.signal?.aborted){if(v instanceof Error)return u(v);try{let b=gs(r,v.result);b.success?l(b.data):u(b.error)}catch(b){u(b)}}}),i?.signal?.addEventListener("abort",()=>{m(i?.signal?.reason)});let h=i?.timeout??VX,g=()=>m(ie.fromError(de.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,i?.maxTotalTimeout,g,i?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let v=b=>{let _=this._responseHandlers.get(p);_?_(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(y,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),u(b)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(v=>{this._cleanupTimeout(p),u(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},V$,r)}async getTaskResult(t,r,i){return this.request({method:"tasks/result",params:t},r,i)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},W$,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},IM,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let i=r?.relatedTask?.taskId;if(i){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ps]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ps]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ps]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let i=MT(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(n,o)=>{let s=LT(t,n);return Promise.resolve(r(s,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let i=MT(t);this._notificationHandlers.set(i,n=>{let o=LT(t,n);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,i){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,i,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,r);for(let n of i)if(n.type==="request"&&aT(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);s?(s(new ie(de.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let i=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(i=n.pollInterval)}catch{}return new Promise((n,o)=>{if(r.aborted){o(new ie(de.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,i);r.addEventListener("abort",()=>{clearTimeout(s),o(new ie(de.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await i.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let o=await i.getTask(n,r);if(!o)throw new ie(de.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await i.storeTaskResult(n,o,s,r);let a=await i.getTask(n,r);if(a){let c=If.parse({method:"notifications/tasks/status",params:a});await this.notification(c),vs(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>i.getTaskResult(n,r),updateTaskStatus:async(n,o,s)=>{let a=await i.getTask(n,r);if(!a)throw new ie(de.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(vs(a.status))throw new ie(de.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(n,o,s,r);let c=await i.getTask(n,r);if(c){let l=If.parse({method:"notifications/tasks/status",params:c});await this.notification(l),vs(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>i.listTasks(n,r)}}};function kL(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function SL(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];kL(s)&&kL(o)?r[n]={...s,...o}:r[n]=o}return r}var DZ=Lt(l4(),1),MZ=Lt(zZ(),1);function Jle(){let e=new DZ.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,MZ.default)(e),e}var Tw=class{constructor(t){this._ajv=t??Jle()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>r(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Pw=class{constructor(t){this._server=t}requestStream(t,r,i){return this._server.requestStream(t,r,i)}createMessageStream(t,r){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(s){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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==d.size||![...u].every(p=>d.has(p)))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:t},Rf,r)}elicitInputStream(t,r){let i=this._server.getClientCapabilities(),n=t.mode??"form";switch(n){case"url":{if(!i?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=n==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Fl,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,i){return this._server.getTaskResult({taskId:t},r,i)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function LZ(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function UZ(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Rw=class extends mb{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Pf.options.map((i,n)=>[i,n])),this.isMessageIgnored=(i,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Tw,this.setRequestHandler(uT,i=>this._oninitialize(i)),this.setNotificationHandler(dT,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(vT,async(i,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=i.params,a=Pf.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Pw(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=SL(this._capabilities,t)}setRequestHandler(t,r){let n=ys(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let o=iu(n);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=gs(ql,c);if(!u.success){let m=u.error instanceof Error?u.error.message:String(u.error);throw new ie(de.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=u.data,p=await Promise.resolve(r(c,l));if(d.task){let m=gs(Ll,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new ie(de.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=gs(tb,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new ie(de.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);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 ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);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 ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);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 ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){UZ(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&LZ(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:gM.includes(r)?r:oT,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"},L$)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(l=>l.type==="tool_use");if(o){if(n.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(n.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 t.tools?this.request({method:"sampling/createMessage",params:t},$T,r):this.request({method:"sampling/createMessage",params:t},Rf,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=t;return this.request({method:"elicitation/create",params:n},Fl,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Fl,r);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!a.valid)throw new ie(de.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof ie?s:new ie(de.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(t,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:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},bT,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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"})}};var FZ=Symbol.for("mcp.completable");function gA(e){return!!e&&typeof e=="object"&&FZ in e}function ZZ(e){return e[FZ]?.complete}var qZ;(function(e){e.Completable="McpCompletable"})(qZ||(qZ={}));var Yle=/^[A-Za-z0-9._-]{1,128}$/;function Xle(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Yle.test(e)){let r=e.split("").filter(i=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map(i=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Qle(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)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 yA(e){let t=Xle(e);return Qle(e,t.warnings),t.isValid}var Cw=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,i){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,i)}};var Aw=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Rw(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Cw(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ns(eb)),this.server.assertCanSetRequestHandler(Ns(ql)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(eb,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let i={name:t,title:r.title,description:r.description,inputSchema:(()=>{let n=nu(r.inputSchema);return n?DT(n,{strictUnions:!0,pipeStrategy:"input"}):eue})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=nu(r.outputSchema);n&&(i.outputSchema=DT(n,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(ql,async(t,r)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new ie(de.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new ie(de.InvalidParams,`Tool ${t.params.name} disabled`);let n=!!t.params.task,o=i.execution?.taskSupport,s="createTask"in i.handler;if((o==="required"||o==="optional")&&!s)throw new ie(de.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new ie(de.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(i,t,r);let a=await this.validateToolInput(i,t.params.arguments,t.params.name),c=await this.executeToolHandler(i,a,r);return n||await this.validateToolOutput(i,c,t.params.name),c}catch(i){if(i instanceof ie&&i.code===de.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,i){if(!t.inputSchema)return;let o=nu(t.inputSchema)??t.inputSchema,s=await cb(o,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=lb(a);throw new ie(de.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${c}`)}return s.data}async validateToolOutput(t,r,i){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new ie(de.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let n=nu(t.outputSchema),o=await cb(n,r.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",a=lb(s);throw new ie(de.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${a}`)}}async executeToolHandler(t,r,i){let n=t.handler;if("createTask"in n){if(!i.taskStore)throw new Error("No task store provided.");let s={...i,taskStore:i.taskStore};if(t.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,s))}else{let a=n;return await Promise.resolve(a.createTask(s))}}if(t.inputSchema){let s=n;return await Promise.resolve(s(r,i))}else{let s=n;return await Promise.resolve(s(i))}}async handleAutomaticTaskPolling(t,r,i){if(!i.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(t,r.params.arguments,r.params.name),o=t.handler,s={...i,taskStore:i.taskStore},a=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),c=a.task.taskId,l=a.task,u=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(p=>setTimeout(p,u));let d=await i.taskStore.getTask(c);if(!d)throw new ie(de.InternalError,`Task ${c} not found during polling`);l=d}return await i.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Ns(rb)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(rb,async t=>{switch(t.params.ref.type){case"ref/prompt":return EM(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return OM(t),this.handleResourceCompletion(t,t.params.ref);default:throw new ie(de.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let i=this._registeredPrompts[r.name];if(!i)throw new ie(de.InvalidParams,`Prompt ${r.name} not found`);if(!i.enabled)throw new ie(de.InvalidParams,`Prompt ${r.name} disabled`);if(!i.argsSchema)return Wm;let o=ys(i.argsSchema)?.[t.params.argument.name];if(!gA(o))return Wm;let s=ZZ(o);if(!s)return Wm;let a=await s(t.params.argument.value,t.params.context);return BZ(a)}async handleResourceCompletion(t,r){let i=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!i){if(this._registeredResources[r.uri])return Wm;throw new ie(de.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let n=i.resourceTemplate.completeCallback(t.params.argument.name);if(!n)return Wm;let o=await n(t.params.argument.value,t.params.context);return BZ(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ns(H$)),this.server.assertCanSetRequestHandler(Ns(J$)),this.server.assertCanSetRequestHandler(Ns(Y$)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(H$,async(t,r)=>{let i=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(r);for(let a of s.resources)n.push({...o.metadata,...a})}return{resources:[...i,...n]}}),this.server.setRequestHandler(J$,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,i])=>({name:r,uriTemplate:i.resourceTemplate.uriTemplate.toString(),...i.metadata}))})),this.server.setRequestHandler(Y$,async(t,r)=>{let i=new URL(t.params.uri),n=this._registeredResources[i.toString()];if(n){if(!n.enabled)throw new ie(de.InvalidParams,`Resource ${i} disabled`);return n.readCallback(i,r)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(i.toString());if(s)return o.readCallback(i,s,r)}throw new ie(de.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ns(X$)),this.server.assertCanSetRequestHandler(Ns(Q$)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(X$,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?tue(r.argsSchema):void 0}))})),this.server.setRequestHandler(Q$,async(t,r)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new ie(de.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new ie(de.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let n=nu(i.argsSchema),o=await cb(n,t.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",l=lb(c);throw new ie(de.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${l}`)}let s=o.data,a=i.callback;return await Promise.resolve(a(s,r))}else{let n=i.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...i){let n;typeof i[0]=="object"&&(n=i.shift());let o=i[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,i,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(t,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,r,i,n,o){let s={name:t,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==i&&(delete this._registeredResources[i],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=s,s}_createRegisteredResourceTemplate(t,r,i,n,o){let s={resourceTemplate:i,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredResourceTemplates[t],l.name&&(this._registeredResourceTemplates[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.template<"u"&&(s.resourceTemplate=l.template),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let a=i.uriTemplate.variableNames;return Array.isArray(a)&&a.some(l=>!!i.completeCallback(l))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,i,n,o){let s={title:r,description:i,argsSchema:n===void 0?void 0:La(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=La(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=s,n&&Object.values(n).some(c=>{let l=c instanceof ja?c._def?.innerType:c;return gA(l)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,i,n,o,s,a,c,l){yA(t);let u={title:r,description:i,inputSchema:VZ(n),outputSchema:VZ(o),annotations:s,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!==t&&(typeof d.name=="string"&&yA(d.name),delete this._registeredTools[t],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=La(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=La(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[t]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let i,n,o,s;if(typeof r[0]=="string"&&(i=r.shift()),r.length>1){let c=r[0];if(vA(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!vA(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(l=>typeof l=="object"&&l!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(t,void 0,i,n,o,s,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,i){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:a,annotations:c,_meta:l}=r;return this._createRegisteredTool(t,n,o,s,a,c,{taskSupport:"forbidden"},l,i)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let i;typeof r[0]=="string"&&(i=r.shift());let n;r.length>1&&(n=r.shift());let o=r[0],s=this._createRegisteredPrompt(t,void 0,i,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,i){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:n,description:o,argsSchema:s}=r,a=this._createRegisteredPrompt(t,n,o,s,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var eue={type:"object",properties:{}};function KZ(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function WZ(e){return"_def"in e||"_zod"in e||KZ(e)}function vA(e){return typeof e!="object"||e===null||WZ(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(KZ)}function VZ(e){if(e){if(vA(e))return La(e);if(!WZ(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function tue(e){let t=ys(e);return t?Object.entries(t).map(([r,i])=>{let n=ZM(i),o=VM(i);return{name:r,description:n,required:!o}}):[]}function Ns(e){let r=ys(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=iu(r);if(typeof i=="string")return i;throw new Error("Schema method literal must be a string")}function BZ(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Wm={completion:{values:[],hasMore:!1}};import{existsSync as rue,readFileSync as nue}from"node:fs";import{dirname as GZ,join as HZ}from"node:path";import{fileURLToPath as iue}from"node:url";function $A(e=iue(import.meta.url)){let t=GZ(e);for(;;){if(rue(HZ(t,"package.json")))return t;let r=GZ(t);if(r===t)throw new Error(`No package.json above ${e}`);t=r}}function JZ(){return JSON.parse(nue(HZ($A(),"package.json"),"utf8")).version??"0.0.0"}function Xi(e,t,r){if(t==="off"){let a=r.filter(c=>!c.passed&&c.warnOnly);return{gate:e,mode:t,outcome:a.length>0?"warned":"skipped",blocking:[],warnings:a}}let i=r.filter(a=>!a.passed),n=t==="block"?i.filter(a=>!a.warnOnly):[],o=i.filter(a=>!n.includes(a)),s=n.length>0?"blocked":o.length>0?"warned":"passed";return{gate:e,mode:t,outcome:s,blocking:n,warnings:o}}var oue=new Set(["parent-approved","parent-pinned","link-approved"]);function QZ(e,t){let r=s=>oue.has(s.id)&&s.about!==void 0&&t.has(s.about),i=e.blocking.filter(s=>!r(s)),n=e.warnings.filter(s=>!r(s)),o=e.outcome==="skipped"?"skipped":i.length>0?"blocked":n.length>0?"warned":"passed";return{...e,outcome:o,blocking:i,warnings:n}}function nn(e,t){if(e.outcome==="passed"||e.outcome==="skipped")return"";let r=[],i=n=>n.forEach((o,s)=>{r.push(`${s+1}. ${o.message}`),o.remedy&&r.push(` To fix: ${o.remedy}`)});return e.outcome==="blocked"?(r.push(`${YZ(t)} refused by the ${e.gate} gate: ${XZ(e.blocking.length,"check")} failed.`),i(e.blocking),e.warnings.length>0&&(r.push("Also:"),i(e.warnings))):(r.push(`${YZ(t)} goes ahead with ${XZ(e.warnings.length,"warning")} from the ${e.gate} gate:`),i(e.warnings)),r.join(`
221
+ `)}var YZ=e=>e.charAt(0).toUpperCase()+e.slice(1),XZ=(e,t)=>`${e} ${t}${e===1?"":"s"}`;var C_=Lt(Vt(),1);import{existsSync as Ome,readFileSync as Nme}from"node:fs";var T=(e,t=[])=>({ok:!0,value:e,problems:t}),w=(...e)=>({ok:!1,problems:e}),ee=e=>`{{bk:${e}}}`;function _t(e,t,r){return e.map(i=>{let n=i.path.length>0?jme(i.path):"(top level)";return{code:r,path:t,message:`${t}: ${n} ${zme(i)}.`}})}function jme(e){return e.map((t,r)=>typeof t=="number"?`[${t}]`:`${r>0?".":""}${String(t)}`).join("")}function zme(e){return e.code==="invalid_type"?/received undefined/.test(e.message)?"is required":`must be ${{object:"a set of named fields",array:"a list",boolean:"true or false",string:"text",number:"a number",int:"a whole number"}[e.expected]??e.expected}`:Dme(e.message)}var Dme=e=>e.charAt(0).toLowerCase()+e.slice(1).replace(/\.$/,"");function Gu(e,t,r,i){if(!Ome(e))return w({code:`${i}-missing`,path:t,message:`${t} was not found at ${e}.`});let n;try{n=(0,C_.parse)(Nme(e,"utf8"))}catch(s){let a=s instanceof C_.YAMLParseError?s.message.split(`
222
+ `)[0]:String(s);return w({code:`${i}-unreadable`,path:t,message:`${t} is not valid YAML: ${a}`})}let o=r.safeParse(n??{});return o.success?T(o.data):w(..._t(o.error.issues,t,`${i}-invalid`))}var Si=[{type:"idea",dir:"ideas",file:"idea.md",parent:"none"},{type:"epic",dir:"epics",file:"epic.md",parent:"required"},{type:"story",dir:"stories",file:"story.md",parent:"required"},{type:"task",dir:"tasks",file:"task.md",parent:"required"},{type:"bug",dir:"bugs",file:"bug.md",parent:"optional"},{type:"adhoc",dir:"adhoc",file:"adhoc.md",parent:"none"}],jo="capabilities",Sn="changes",mr=["task","story","bug","adhoc"],te={type:"test-plan",dir:"test-plan",file:"plan.md",idSuffix:"-TP"},mc={type:"design",dir:"design",file:"design.md",idSuffix:"-DD"},A_=[{type:te.type,dir:te.dir,file:te.file,suffix:"TP"},{type:mc.type,dir:mc.dir,file:mc.file,suffix:"DD"}],Hu=["versions","approvals","completions","repins"];var Ju=Lt(Vt(),1);import{createHash as Mme}from"node:crypto";var Mn="versions",xi="approvals",hc="onboard.md",to="sources",zo=(e,t)=>`${e}/${Mn}/v${t}.md`,Do=(e,t)=>`${e}/${xi}/v${t}.yaml`,xh=(e,t)=>`${e}/${xi}/v${t}-pending.yaml`,Z2=e=>`${e}/${hc}`,gc=e=>`${e}/${to}`,Yu=/^v(0|[1-9][0-9]*)\.yaml$/,Xu=/^v(0|[1-9][0-9]*)-pending\.yaml$/,E_=/^v(0|[1-9][0-9]*)\.md$/,F2=$.string().regex(/^sha256:[0-9a-f]{64}$/,"must be sha256: followed by 64 hex digits"),Sh=$.number().int().nonnegative(),Lme=$.object({artifact:$.string().min(1),version:Sh,hash:F2,approvedBy:$.string().min(1),approvedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),template:$.object({type:$.string().min(1),version:$.number().int().positive(),source:$.enum(["tree","org","built-in"]),org:$.string().min(1).optional()}).optional(),onboarded:$.literal(!0).optional(),baseline:$.record($.string(),$.string().regex(/^[0-9a-f]{7,64}$/,"must be a commit ID")).optional(),sources:$.record($.string(),F2).optional(),empty:$.array($.string().min(1)).optional(),completes:Sh.optional(),parent:$.string().min(1).optional(),pins:$.record($.string(),Sh).optional(),related:$.record($.string(),Sh).optional(),changes:$.record($.string(),Sh).optional(),draftId:$.string().min(1).optional(),recorded:$.literal(!0).optional()}).superRefine((e,t)=>{let r=(i,n)=>t.addIssue({code:"custom",path:[i],message:n});if(e.version===0){e.onboarded!==!0&&r("onboarded","must be true: version 0 describes code as it was before BuildKeel"),e.completes!==void 0&&r("completes","is for a version after version 0");return}e.onboarded!==void 0&&r("onboarded","is only for version 0"),e.template||r("template","is required for every version after version 0");for(let i of["baseline","sources","empty"])e[i]!==void 0&&r(i,"is only for version 0");e.completes!==void 0&&e.completes>=e.version&&r("completes",`must name a version before ${e.version}`)});function Ft(e){return`sha256:${Mme("sha256").update(e.replace(/\r\n/g,`
223
+ `),"utf8").digest("hex")}`}function eO(e){let{template:t}=e,r={artifact:e.artifact,version:e.version,hash:e.hash,approvedBy:e.approvedBy,approvedAt:e.approvedAt,...t?{template:{type:t.type,version:t.version,source:t.source,...t.org?{org:t.org}:{}}}:{},...e.onboarded?{onboarded:!0}:{},...e.baseline&&Object.keys(e.baseline).length>0?{baseline:e.baseline}:{},...e.sources&&Object.keys(e.sources).length>0?{sources:e.sources}:{},...e.empty&&e.empty.length>0?{empty:e.empty}:{},...e.completes!==void 0?{completes:e.completes}:{},...e.parent?{parent:e.parent}:{},...e.pins&&Object.keys(e.pins).length>0?{pins:e.pins}:{},...e.related&&Object.keys(e.related).length>0?{related:e.related}:{},...e.changes&&Object.keys(e.changes).length>0?{changes:e.changes}:{},...e.draftId?{draftId:e.draftId}:{},...e.recorded?{recorded:!0}:{}};return(0,Ju.stringify)(r,{lineWidth:0})}function yc(e,t){let r;try{r=(0,Ju.parse)(e)}catch(n){let o=n instanceof Ju.YAMLParseError?n.message.split(`
224
+ `)[0]:String(n);return w({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Lme.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"record-invalid"))}var j_=["approve","start","done","lock"],tO=["block","warn","off"],Ume=["record","approve"],Mo="buildkeel.yaml",O_=e=>Si.find(t=>t.type===e)?.dir??e,N_=[{type:"idea",name:"business idea",prefix:"BI",width:2,core:!0,dir:O_("idea"),requires:[]},{type:"epic",name:"epic",prefix:"EP",width:2,core:!0,dir:O_("epic"),requires:["design"]},{type:"story",name:"user story",prefix:"US",width:3,core:!0,dir:O_("story"),requires:["test-plan"]},{type:"task",name:"task",prefix:"TK",width:3,core:!0,dir:O_("task"),requires:[]}],qme=["idea","epic","story"],Fme={"test-plan":"test plan",design:"design document"},B2=A_.map(e=>({...e,name:Fme[e.type]??e.type,builtIn:!0})),K2=new Set(["bug","adhoc",...A_.map(e=>e.type)]),Zme=new Set([...Si.map(e=>e.dir),"templates",...A_.map(e=>e.dir)]),gt={chain:N_.map(e=>({...e,requires:[...e.requires]})),bug:{type:"bug",name:"bug",prefix:"BUG",width:3},adhoc:{type:"adhoc",name:"ad-hoc unit",prefix:"AH",width:3},documents:B2.map(e=>({...e})),gates:{approve:"block",start:"block",done:"block",lock:"block"},onboardedLetter:"E",taskPlans:"record"},z_=$.string().regex(/^[A-Z][A-Z0-9]{0,7}$/,"must be 1 to 8 capital letters or digits, starting with a letter"),W2=$.number().int().min(1).max(6),Ih=$.string().regex(/^[a-z][a-z0-9-]*$/,"must be lowercase letters, digits and hyphens"),Vme=$.object({type:Ih,name:$.string().min(1).optional(),prefix:z_.optional(),width:W2.optional(),dir:Ih.optional(),requires:$.array(Ih).optional()}),Bme=$.object({type:Ih,name:$.string().min(1).optional(),suffix:$.string().regex(/^[A-Z]{2,4}$/,"must be 2 to 4 capital letters").optional(),dir:Ih.optional()}),Qu=$.object({name:$.string().min(1).optional(),prefix:z_.optional(),width:W2.optional()}),Kme=$.object({chain:$.array(Vme).min(1).optional(),bug:Qu.optional(),adhoc:Qu.optional(),documents:$.array(Bme).optional(),gates:$.record($.string(),$.unknown()).optional(),onboarded:$.object({letter:$.string().regex(/^[A-Z]$/,"must be one capital letter, such as E")}).optional(),taskPlans:$.enum(Ume,{error:"must be record or approve"}).optional()});function V2(e,t){if(e.input===void 0||e.input===null)return{};let r=e.file===Mo?"process.":"",i=Kme.safeParse(e.input);if(!i.success){let n=`${e.file}: `;return t.push(..._t(i.error.issues,e.file,"process-invalid").map(o=>({...o,message:o.message.startsWith(n)?`${n}${r}${o.message.slice(n.length)}`:o.message}))),{}}for(let[n,o]of Object.entries(i.data.gates??{})){let s=a=>t.push({code:"process-invalid",path:e.file,message:`${e.file}: ${r}gates${a}`});/^stale(ness)?$/.test(n)?s(`.${n}: a spec tree that is behind its remote only ever warns, so it has no mode.`):j_.includes(n)?tO.includes(o)||s(`.${n} must be block, warn or off, not ${JSON.stringify(o)}.`):s(` has no gate called ${n}. The gates are ${j_.join(", ")}.`)}return i.data}function ed(e,t){if(e==null&&!t)return T(structuredClone(gt));let r=[],i=V2({input:e,file:Mo},r),n=t?V2(t,r):{};if(r.length>0)return w(...r);let o=i.chain||!t||!n.chain?Mo:t.file,s=S=>r.push({code:"process-invalid",path:o,message:`${o}: ${S}`}),a=new Map(N_.map(S=>[S.type,S])),c=i.chain??n.chain??N_.map(S=>({type:S.type})),l=[],u=new Set;for(let S of c){if(u.has(S.type)){s(`the process lists the ${S.type} stage twice.`);continue}u.add(S.type);let C=a.get(S.type);if(!C&&K2.has(S.type)){s(`${S.type} is not a stage: bugs, ad-hoc units, test plans and design documents sit outside the chain.`);continue}let E=S.prefix??C?.prefix;if(!E){s(`the ${S.type} stage needs a prefix for its IDs.`);continue}C&&S.dir&&S.dir!==C.dir&&s(`the ${S.type} stage keeps its directory, ${C.dir}; only stages a team adds choose one.`),l.push({type:S.type,name:S.name??C?.name??S.type,prefix:E,width:S.width??C?.width??3,core:C!==void 0,dir:C?.dir??S.dir??S.type,requires:[...S.requires??C?.requires??[]]})}for(let S of qme)u.has(S)||s(`the process has no ${a.get(S)?.name} stage. Business idea, epic and user story are required; they can be renamed but not removed.`);let d=l.filter(S=>S.core).map(S=>S.type),p=N_.map(S=>S.type).filter(S=>d.includes(S));if(d.join()!==p.join())s(`the core stages must stay in the order ${p.join(", ")}; added stages can go between them.`);else{let S=C=>l.findIndex(E=>E.type===C);for(let[C,E]of l.entries())E.core||C>S("idea")&&C<S("story")||s(`the ${E.type} stage must sit between the business idea and the user story. Work is done on stories and tasks, so nothing is added below a story.`)}let f=new Map;for(let S of l.filter(C=>!C.core)){let C=f.get(S.dir);Zme.has(S.dir)?s(`the ${S.type} stage cannot use the directory ${S.dir}, which BuildKeel uses for something else. Set its dir to another name.`):C?s(`the ${C} and ${S.type} stages both use the directory ${S.dir}. Each stage needs its own.`):f.set(S.dir,S.type)}let m=S=>{let C=i[S]??n[S]??{},E=gt[S];return{type:S,name:C.name??E.name,prefix:C.prefix??E.prefix,width:C.width??E.width}},h={...gt.gates,...n.gates,...i.gates},g=i.documents||!t||!n.documents?Mo:t.file,y=Wme(i.documents??n.documents??[],l,S=>r.push({code:"process-invalid",path:g,message:`${g}: ${S}`})),v=i.onboarded?.letter??n.onboarded?.letter??gt.onboardedLetter,b=i.taskPlans??n.taskPlans??gt.taskPlans,_={chain:l,bug:m("bug"),adhoc:m("adhoc"),documents:y,gates:h,onboardedLetter:v,taskPlans:b},k=new Set(y.map(S=>S.type));for(let S of l){let C=new Set;for(let E of S.requires)C.has(E)?s(`the ${S.type} stage requires ${E} twice.`):k.has(E)||s(`the ${S.type} stage requires ${E}, which is not a document type. The document types are ${[...k].join(", ")}.`),C.add(E)}let x=new Map;for(let S of[..._.chain,_.bug,_.adhoc]){let C=x.get(S.prefix);C?s(`the ${C} and ${S.name} types both use the prefix ${S.prefix}. Each type needs its own.`):x.set(S.prefix,S.name)}return r.length>0?w(...r):T(_)}function Wme(e,t,r){let i=B2.map(a=>({...a})),n=new Set;for(let a of e){if(n.has(a.type)){r(`the process lists the ${a.type} document twice.`);continue}n.add(a.type);let c=i.find(u=>u.builtIn&&u.type===a.type);if(c){a.suffix&&a.suffix!==c.suffix&&r(`the ${a.type} document keeps its suffix, ${c.suffix}; only documents a team adds choose one.`),a.dir&&a.dir!==c.dir&&r(`the ${a.type} document keeps its directory, ${c.dir}; only documents a team adds choose one.`),a.name&&(c.name=a.name);continue}if(K2.has(a.type)||t.some(u=>u.type===a.type)){r(`${a.type} cannot be a document type: a stage, bugs or ad-hoc units already use the name.`);continue}if(!a.suffix){r(`the ${a.type} document needs a suffix for its IDs, such as ${a.type.slice(0,2).toUpperCase()}.`);continue}let l=a.dir??a.type;if(Hu.includes(l)||l===to){r(`the ${a.type} document cannot use the directory ${l}, which holds an artifact's records. Set its dir to another name.`);continue}i.push({type:a.type,name:a.name??a.type.replace(/-/g," "),suffix:a.suffix,dir:l,file:`${a.type}.md`,builtIn:!1})}let o=new Map,s=new Map;for(let a of i){let c=o.get(a.suffix),l=s.get(a.dir);c?r(`the ${c} and ${a.type} documents both use the suffix ${a.suffix}. Each document needs its own.`):o.set(a.suffix,a.type),l?r(`the ${l} and ${a.type} documents both use the directory ${a.dir}. Each document needs its own.`):s.set(a.dir,a.type)}return i}var D_=(e,t)=>e.documents.find(r=>r.type===t);function Ln(e,t,r=""){return`${e.prefix}-${r}${String(t).padStart(e.width,"0")}`}function Th(e,t){let r=e.chain.findIndex(i=>i.type===t);return r>0?e.chain[r-1]??null:null}var M_=(e,t)=>e.chain.some(r=>r.type===t&&!r.core);import{existsSync as xhe,statSync as Ihe}from"node:fs";import{join as The}from"node:path";import{existsSync as Gme}from"node:fs";import{homedir as Hme}from"node:os";import{isAbsolute as G2,join as J2,resolve as rO}from"node:path";function Bs(e=process.env){return e.BUILDKEEL_HOME?rO(e.BUILDKEEL_HOME):J2(Hme(),".buildkeel")}var H2="paths.yaml",Jme=$.object({specs:$.record($.string(),$.string().min(1)).default({}),repos:$.record($.string(),$.string().min(1)).default({})});function L_(e=Bs()){let t=J2(e,H2);if(!Gme(t))return T({specs:{},repos:{}});let r=Gu(t,`~/.buildkeel/${H2}`,Jme,"machine-paths");if(!r.ok)return r;for(let[i,n]of Object.entries(r.value.specs))G2(n)||(r.value.specs[i]=rO(e,n));for(let[i,n]of Object.entries(r.value.repos))G2(n)||(r.value.repos[i]=rO(e,n));return r}import{join as Yme}from"node:path";var Xe="buildkeel.yaml",X2=1e4,Xme=$.object({name:$.string().min(1),remote:$.string().min(1).optional(),baseline:$.string().regex(/^[0-9a-f]{7,64}$/,"must be a commit ID").optional()}),Qme=$.object({source:$.string().min(1),version:$.union([$.string(),$.number()]).transform(String).optional()}),ehe=$.object({autoPush:$.boolean().default(!1),idsBranch:$.string().min(1).default("buildkeel/ids"),contextBudget:$.number().int().positive().default(X2)}),the=$.object({sections:$.array($.string().min(1)).default([]),notes:$.array($.string().min(1)).default([])}),nO=["spec-driven","full-sdlc"],Y2=2,rhe=$.object({format:$.number().int("must be a whole number").positive("must be 1 or higher"),name:$.string().min(1).optional(),mode:$.enum(nO,{error:"must be spec-driven or full-sdlc"}).optional(),process:$.record($.string(),$.unknown()).optional(),templates:$.object({org:Qme.optional()}).optional(),rules:$.record($.string(),the).optional(),repos:$.array(Xme).default([]).superRefine((e,t)=>{let r=new Set;e.forEach((i,n)=>{r.has(i.name)&&t.addIssue({code:"custom",path:[n,"name"],message:`repeats the repo name "${i.name}"`}),r.add(i.name)})}),settings:ehe.default({autoPush:!1,idsBranch:"buildkeel/ids",contextBudget:X2})}).superRefine((e,t)=>{e.format===Y2&&e.mode===void 0&&t.addIssue({code:"custom",path:["mode"],message:`is required in a format ${Y2} spec tree: spec-driven or full-sdlc`})}),Q2=e=>e.mode??"full-sdlc";function ro(e){return Gu(Yme(e,Xe),Xe,rhe,"spec-config")}var F_=Lt(Vt(),1);import{execFileSync as nhe}from"node:child_process";import{createHash as ihe,randomBytes as ohe}from"node:crypto";import{existsSync as aO,mkdirSync as she,readFileSync as ahe,renameSync as che,rmSync as eB}from"node:fs";import{isAbsolute as lhe,join as U_,resolve as uhe}from"node:path";var Ph="templates",rB="process.yaml",dhe="org-templates",phe=new Set(["latest","head","main","master","trunk","develop"]),tB=3e4,fhe=6e4,mhe=e=>!/^[a-z][a-z0-9+.-]*:\/\//i.test(e)&&!/^[^/\\]+@[^/\\]+:/.test(e)&&!/^[a-z0-9.-]+:[^\\]/i.test(e),cO=(e,t)=>mhe(t)&&!lhe(t)?uhe(e,t):t,nB=(e,t)=>`${e}@${t}`;function hhe(e){let t=e.version?.trim()??"",r="Set templates.org.version in buildkeel.yaml to one of the organization's release tags, such as v1.2.0, and change it only to move to another release.";return t===""?{code:"org-unpinned",path:"buildkeel.yaml",message:`buildkeel.yaml: templates.org names ${e.source} with no version. Organization templates are always pinned to a tag, so that they change only when the team changes the version.`,remedy:r}:phe.has(t.toLowerCase())?{code:"org-unpinned",path:"buildkeel.yaml",message:`buildkeel.yaml: templates.org.version is ${t}, which follows whatever is newest. Organization templates are pinned to a fixed tag.`,remedy:r}:null}function lO(e,t,r){let i=ihe("sha256").update(t).digest("hex").slice(0,16);return U_(e,dhe,i,r.replace(/[^A-Za-z0-9._-]/g,"_"))}var iO=new Map;function oO(e,t){try{return{ok:!0,stdout:nhe("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:tB,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}}catch(r){let i=r;return{ok:!1,stderr:i.signal==="SIGTERM"?`timed out after ${tB/1e3} seconds`:String(i.stderr??r)}}}function uO(e,t,r,i){let n=hhe(r);if(n)return w(n);let o=r.version.trim(),s=cO(t,r.source),a=nB(r.source,o),c=lO(e,s,o);if(aO(c))return T({source:r.source,version:o,dir:c,label:a});let l=iO.get(c);if(l&&(!i.fetch||Date.now()-l.at<fhe))return w(l.problem);if(!i.fetch)return w({code:"org-unavailable",path:"buildkeel.yaml",message:`The organization templates ${a} are not on this machine yet.`,remedy:"They are fetched the next time BuildKeel's server works in this project with a connection to the source."});let u=ghe(s,o,c,r.source);return u.ok?(iO.delete(c),T({source:r.source,version:o,dir:c,label:a})):(iO.set(c,{at:Date.now(),problem:u.problems[0]}),u)}function ghe(e,t,r,i){let n=nB(i,t),o=U_(r,"..");she(o,{recursive:!0});let s=U_(o,`.fetch-${ohe(4).toString("hex")}`),a=(d,p)=>(eB(s,{recursive:!0,force:!0,maxRetries:5,retryDelay:100}),w({code:"org-unavailable",path:"buildkeel.yaml",message:d,remedy:p})),c=oO(["init","-q",s],o);if(!c.ok)return a(`BuildKeel could not prepare a copy of the organization templates ${n}: ${sO(c.stderr)}`,"Check that git works on this machine, then try again.");let l=oO(["fetch","-q","--depth","1","--no-tags",e,`+refs/tags/${t}:refs/tags/${t}`],s);if(!l.ok)return/couldn't find remote ref|not our ref|no such ref/i.test(l.stderr)?a(`${t} is not a tag in the organization's template source ${i}. Organization templates are pinned to a tag, never a branch.`,"Set templates.org.version in buildkeel.yaml to one of the organization's release tags."):a(`BuildKeel could not fetch the organization templates ${n}: ${sO(l.stderr)}`,"Check the source and your access to it; they are fetched once per machine, when there is a connection, and kept.");let u=oO(["-c","advice.detachedHead=false","checkout","-q",`refs/tags/${t}`],s);if(!u.ok)return a(`BuildKeel could not check out the organization templates ${n}: ${sO(u.stderr)}`,"Try again; if it keeps failing, remove the folder and try again.");try{che(s,r)}catch(d){if(!aO(r))return a(`BuildKeel could not keep the organization templates ${n}: ${String(d)}`,"Try again.");eB(s,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}return T(!0)}var sO=e=>e.trim().split(`
225
+ `).find(t=>t.trim()!=="")?.replace(/^(fatal|error): /,"")??"no output";function Z_(e){let t=U_(e.dir,rB);if(!aO(t))return T(void 0);try{return T((0,F_.parse)(ahe(t,"utf8"))??void 0)}catch(r){let i=r instanceof F_.YAMLParseError?r.message.split(`
226
+ `)[0]:String(r);return w({code:"org-process-unreadable",path:q_(e),message:`${q_(e)} is not valid YAML: ${i}`})}}var q_=e=>`${rB} in ${e.label}`;var td=Lt(Vt(),1);import{existsSync as yhe,readFileSync as vhe}from"node:fs";import{join as $he}from"node:path";var Mt="onboarding/conversion.yaml",dO=$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),bhe=$.object({by:$.string().min(1),at:dO}),whe=$.object({startedBy:$.string().min(1),startedAt:dO,process:$.record($.string(),$.unknown()).default({}),placed:$.record($.string(),$.string().min(1)).default({}),dropped:$.record($.string(),bhe).default({}),finishedBy:$.string().min(1).optional(),finishedAt:dO.optional()});function rd(e){let t={startedBy:e.startedBy,startedAt:e.startedAt,process:e.process,placed:e.placed,dropped:e.dropped,...e.finishedBy?{finishedBy:e.finishedBy}:{},...e.finishedAt?{finishedAt:e.finishedAt}:{}};return`# Moving this spec tree from Spec-driven to Full SDLC. Written by BuildKeel's onboarding.
227
+ ${(0,td.stringify)(t,{lineWidth:0})}`}function _he(e,t=Mt){let r;try{r=(0,td.parse)(e)}catch(n){let o=n instanceof td.YAMLParseError?n.message.split(`
228
+ `)[0]:String(n);return w({code:"conversion-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=whe.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"conversion-invalid"))}function nd(e){let t=$he(e,Mt);return yhe(t)?_he(vhe(t,"utf8")):null}function iB(e){return e?e.ok&&e.value.finishedAt?"finished":"in-progress":"none"}var id=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");var Rh={mode:"spec-driven",change:{type:"change",name:"change",prefix:"CH",width:3},bug:{...gt.bug},adhoc:{...gt.adhoc},gates:{lock:"block"}},vc=[{type:"capability",name:"capability spec"},{type:"proposal",name:"proposal"},{type:"spec-change",name:"spec change"},{type:"design",name:"design document"},{type:"tasks",name:"task list"}],khe={chain:"stages",documents:"attached document types",onboarded:"onboarded numbers",taskPlans:"how tasks' own test plans are kept"},She=$.object({change:Qu.optional(),bug:Qu.optional(),adhoc:Qu.optional(),gates:$.record($.string(),$.unknown()).optional()});function oB(e,t,r){if(e.input===void 0||e.input===null)return{};let i=e.file===Mo?"process.":"",n=She.safeParse(e.input);if(!n.success){let a=`${e.file}: `;return t.push(..._t(n.error.issues,e.file,"process-invalid").map(c=>({...c,message:c.message.startsWith(a)?`${a}${i}${c.message.slice(a.length)}`:c.message}))),{}}let o=a=>t.push({code:"process-invalid",path:e.file,message:`${e.file}: ${i}${a}`});if(r&&typeof e.input=="object")for(let[a,c]of Object.entries(khe))a in e.input&&o(`${a} sets ${c}, which only a Full SDLC tree has. A Spec-driven tree's capability specs and changes are fixed.`);let s={};for(let[a,c]of Object.entries(n.data.gates??{}))a!=="lock"?r&&o(`gates.${a}: a Spec-driven tree has no ${a} gate. Its only gate is lock.`):tO.includes(c)?s[a]=c:o(`gates.lock must be block, warn or off, not ${JSON.stringify(c)}.`);return{...n.data,gates:s}}function sB(e,t){if(e==null&&!t)return T(structuredClone(Rh));let r=[],i=oB({input:e,file:Mo},r,!0),n=t?oB(t,r,!1):{};if(r.length>0)return w(...r);let o=l=>{let u=i[l]??n[l]??{},d=Rh[l];return{...d,name:u.name??d.name,prefix:u.prefix??d.prefix,width:u.width??d.width}},s=i.gates?.lock??n.gates?.lock??Rh.gates.lock,a={mode:"spec-driven",change:o("change"),bug:o("bug"),adhoc:o("adhoc"),gates:{lock:s}},c=new Map;for(let l of[a.change,a.bug,a.adhoc]){let u=c.get(l.prefix);u?r.push({code:"process-invalid",path:Mo,message:`${Mo}: the ${u} and ${l.name} types both use the prefix ${l.prefix}. Each type needs its own.`}):c.set(l.prefix,l.name)}return r.length>0?w(...r):T(a)}var pO=new Map,aB=new Map;function lB(e,t,r){pO.set(e,r);let i=t.templates?.org;i&&uO(r,e,i,{fetch:!0})}var uB=e=>pO.get(e)??Bs();function B(e){let t=pO.get(e)??Bs(),r=m=>{try{let h=Ihe(The(e,m));return`${h.mtimeMs}:${h.ctimeMs}:${h.size}`}catch{return"missing"}},i=`${t}
229
+ ${r(Xe)}
230
+ ${r(Mt)}`,n=aB.get(e);if(n&&n.key===i&&(n.orgDir===null||n.setup.org?.ok===xhe(n.orgDir)))return n.setup;let o=ro(e),s=o.ok?o.value.templates?.org:void 0,a=s?uO(t,e,s,{fetch:!1}):null,c=o.ok?o.value.process:void 0,l=(o.ok?o.value.rules:void 0)??{},u=nd(e),d=iB(u),p;if(o.ok&&Q2(o.value)==="spec-driven"){let m=V_(c,a,sB),h=u&&d==="in-progress"?Phe(u,a):null,g=u&&h?{state:"in-progress",record:u,process:h}:null,y=h?.ok?cB(h.value):Rhe;p={mode:"spec-driven",process:m,org:a,types:y,rules:l,conversion:g}}else{let m=V_(c,a,ed),h=u?{state:d==="finished"?"finished":"in-progress",record:u,process:m}:null;p={mode:"full-sdlc",process:m,org:a,types:m.ok?cB(m.value):Si,rules:l,conversion:h}}let f=s?.version?lO(t,cO(e,s.source),String(s.version).trim()):null;return aB.set(e,{key:i,orgDir:f,setup:p}),p}function Phe(e,t){return e.ok?V_(e.value.process,t,ed):e}function dB(e,t){return V_(t,B(e).org,ed)}var cB=e=>[...Si,...Che(e)];function V_(e,t,r){if(!t)return r(e);if(!t.ok)return w(...t.problems);let i=Z_(t.value);return i.ok?r(e,{input:i.value,file:q_(t.value)}):i}var Rhe=Si.filter(e=>e.type==="bug"||e.type==="adhoc");function Che(e){return e.chain.filter(t=>!t.core).map(t=>({type:t.type,dir:t.dir,file:`${t.type}.md`,parent:"required"}))}function Tt(e){let t=hr({root:e});return t.ok?t.value:gt}function hr(e){let t=B(e.root);return t.mode==="full-sdlc"?t.process:t.conversion?.state==="in-progress"?t.conversion.process:w({code:"process-spec-driven",path:Xe,message:"This spec tree is Spec-driven: it has capability specs and changes, not stages."})}function Ks(e){let t=B(e);return t.mode==="spec-driven"&&t.conversion?.state==="in-progress"}function pB(e){let{process:t}=B(e.root);return t.ok?T({bug:t.value.bug,adhoc:t.value.adhoc}):t}function od(e){let{process:t}=B(e.root);return t.ok?[]:t.problems}var fB={idea:"business idea",epic:"epic",story:"story",task:"task",bug:"bug",adhoc:"ad-hoc unit","test-plan":"test plan",design:"design document",capability:"capability spec",proposal:"proposal","spec-change":"spec change",tasks:"task list"};function sd(e){let t=r=>{let i=e.chain.find(o=>o.type===r);if(i){let o=gt.chain.find(s=>s.type===r)?.name;return i.core&&i.name===o?fB[r]??i.name:i.name}if(r==="bug"||r==="adhoc")return e[r].name;let n=e.documents.find(o=>o.type===r);return n?n.name:fB[r]??r};return{one:t,many:r=>Ch(t(r)),a:r=>Ws(t(r))}}var Re=e=>sd(Tt(e));function Ch(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}function Ws(e){return`${/^(a|e|i|o|u(?!s|ni|r[aeiou]))/i.test(e)?"an":"a"} ${e}`}function fO(e){let t=Tt(e),r=a=>gt.chain.find(c=>c.type===a),i=(a,c,l)=>!l||l.name!==a||l.prefix!==c,n=[t.bug,t.adhoc].filter(a=>i(a.name,a.prefix,gt[a.type]));if(!(t.chain.length!==gt.chain.length||t.chain.some(a=>i(a.name,a.prefix,r(a.type))))&&n.length===0)return null;let s=(a,c,l,u)=>{let d=u?", added by the team":l&&l!==a?`, the ${l}`:"";return`${a} (${c}${d})`};return[...t.chain.map(a=>s(a.name,a.prefix,r(a.type)?.name,!a.core)),...n.map(a=>s(a.name,a.prefix,gt[a.type].name,!1))].join(", ")}function mB(e){if(fO(e)===null)return[];let t=Tt(e),r=s=>{let a=gt.chain.find(c=>c.type===s.type);return a!==void 0&&a.name===s.name&&a.prefix===s.prefix},i=sd(t),n=[];for(let[s,a]of t.chain.entries()){let c=t.chain[s-1];if(!c||a.type==="task"||r(a)&&r(c)&&c.type===gt.chain[s-1]?.type)continue;let l=Ln(c,1);n.push(`${i.one(a.type)} ${l}`,`${i.many(a.type)} from ${l}`)}let o=t.chain.find(s=>s.type==="story");return o&&n.push(`test-plan ${Ln(o,1)}`),n}var ad=Lt(Vt(),1);var hB=/^---[ \t]*\r?\n?$/,Ahe=/^## +(.*?)[ \t]*#*[ \t]*\r?\n?$/,Ehe=/^ {0,3}(`{3,}|~{3,})/;function Ohe(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function oe(e,t){let r=t?`${t}: `:"",i=(d,p)=>({code:d,message:r+p,...t?{path:t}:{}}),n=Ohe(e);if(n.length===0||!hB.test(n[0]??""))return w(i("artifact-no-frontmatter","the file must start with a frontmatter block (---)."));let o=n.findIndex((d,p)=>p>0&&hB.test(d));if(o===-1)return w(i("artifact-no-frontmatter","the frontmatter block is not closed with ---."));let s=n.slice(0,o+1).join(""),a;try{a=(0,ad.parse)(n.slice(1,o).join(""))??{}}catch(d){let p=d instanceof ad.YAMLParseError?d.message.split(`
231
+ `)[0]:String(d);return w(i("artifact-bad-frontmatter",`the frontmatter is not valid YAML: ${p}`))}if(typeof a!="object"||a===null||Array.isArray(a))return w(i("artifact-bad-frontmatter","the frontmatter must be a set of named fields."));let c="",l=[],u=null;for(let d of n.slice(o+1)){let p=Ehe.exec(d);if(p?.[1]){let m=p[1];u===null?u=m:m[0]===u[0]&&m.length>=u.length&&(u=null)}let f=u===null&&!p?Ahe.exec(d):null;if(f)l.push({name:f[1]??"",headingLine:d,body:""});else if(l.length>0){let m=l[l.length-1];m.body+=d}else c+=d}return T({frontmatterBlock:s,frontmatter:a,preamble:c,sections:l})}function Gt(e){return e.frontmatterBlock+e.preamble+e.sections.map(t=>t.headingLine+t.body).join("")}function Ht(e,t){let r=t.trim().toLowerCase();return e.sections.find(i=>i.name.trim().toLowerCase()===r)}function sr(e,t){let r=e.frontmatterBlock.includes(`\r
232
+ `)?`\r
233
+ `:`
234
+ `,i=e.frontmatterBlock.replace(/^---[ \t]*\r?\n/,"").replace(/---[ \t]*\r?\n?$/,""),n=(0,ad.parseDocument)(i),o={...e.frontmatter};for(let[a,c]of Object.entries(t))c===void 0?(n.delete(a),delete o[a]):(n.set(a,c),o[a]=c);let s=n.toString().replace(/\r?\n/g,r);return{...e,frontmatterBlock:`---${r}${s}---${r}`,frontmatter:o}}var mW=Lt(Vt(),1);import{existsSync as fW,readdirSync as V$e,readFileSync as B$e}from"node:fs";import{join as TN}from"node:path";import{existsSync as gB,readdirSync as Nhe,readFileSync as jhe}from"node:fs";import{join as yB}from"node:path";var no=["proposal","spec-change","design","tasks"],cd="archive.yaml",io="discarded.yaml",mO="specs",Et=e=>`${Sn}/${e}`;function Ce(e,t,r){return t==="spec-change"?`${Et(e)}/${mO}/${r}.md`:`${Et(e)}/${t}.md`}function nr(e,t){let r=yB(e,Et(t),mO);return gB(r)?Nhe(r).filter(i=>i.endsWith(".md")).map(i=>i.slice(0,-3)).sort():[]}function B_(e,t){let r=Ce(t,"proposal"),i=yB(e,r);if(!gB(i))return[{code:"change-no-proposal",path:r,message:`${t} has no proposal.`,remedy:"Write one saying why the change is made and what it changes."}];let n=oe(jhe(i,"utf8"),r);if(!n.ok)return n.problems;let o=Array.isArray(n.value.frontmatter.capabilities)?n.value.frontmatter.capabilities.filter(u=>typeof u=="string"):[],s=n.value.frontmatter.noSpecChanges===!0,a=nr(e,t),c=[],l=(u,d,p)=>c.push({code:u,path:r,message:`${t}: ${d}`,remedy:p});if(s)return a.length>0&&l("proposal-no-behavior-but-specs",`its proposal says it alters no behavior, but it has spec changes for ${a.join(", ")}.`,"Remove noSpecChanges from the proposal, or remove the spec changes."),c;a.length===0&&o.length===0&&l("change-no-spec-change","it has no spec change, and its proposal does not say it alters no behavior.","Add a spec change for each capability whose behavior it changes, or set noSpecChanges: true in the proposal for a change such as a refactor.");for(let u of o.filter(d=>!a.includes(d)))l("proposal-capability-without-spec",`its proposal names ${u}, but it has no spec change for ${u}.`,`Add a spec change for ${u}, or remove ${u} from the proposal's capabilities.`);for(let u of a.filter(d=>!o.includes(d)))l("spec-without-proposal-capability",`it has a spec change for ${u}, which its proposal does not name.`,`Add ${u} to the proposal's capabilities, or remove the spec change.`);return c}import{existsSync as Gd,readFileSync as lW}from"node:fs";import{join as pa}from"node:path";var ud=Lt(Vt(),1);import{existsSync as K_,readdirSync as bB,readFileSync as wB}from"node:fs";import{join as ld}from"node:path";var vB=$.string().regex(/^sha256:[0-9a-f]{64}$/,"must be sha256: followed by 64 hex digits"),$B=$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),bc=z_,zhe=$.object({capability:bc,version:$.number().int().nonnegative(),hash:vB,change:$.string().min(1).optional(),archivedBy:$.string().min(1).optional(),archivedAt:$B.optional(),confirmedBy:$.string().min(1).optional(),confirmedAt:$B.optional(),template:$.object({type:$.string().min(1),version:$.number().int().positive(),source:$.enum(["tree","org","built-in"]),org:$.string().min(1).optional()}).optional(),baseline:$.record($.string(),$.string().regex(/^[0-9a-f]{7,64}$/,"must be a commit ID")).optional(),sources:$.record($.string(),vB).optional()}).superRefine((e,t)=>{let r=(i,n)=>t.addIssue({code:"custom",path:[i],message:n});if(e.version===0){for(let i of["confirmedBy","confirmedAt"])e[i]===void 0&&r(i,"is required for version 0");for(let i of["change","archivedBy","archivedAt"])e[i]!==void 0&&r(i,"is for a version a change wrote, not version 0");return}for(let i of["change","archivedBy","archivedAt","template"])e[i]===void 0&&r(i,"is required for every version after version 0");for(let i of["confirmedBy","confirmedAt","baseline","sources"])e[i]!==void 0&&r(i,"is only for version 0")}),on=e=>`${jo}/${e}`,Lo=(e,t)=>`${on(e)}/${Mn}/v${t}.md`,Ii=(e,t)=>`${on(e)}/${Mn}/v${t}.yaml`;function $c(e,t){let r=ld(e,on(t),Mn);return K_(r)?bB(r).map(i=>E_.exec(i)?.[1]).filter(i=>i!==void 0).map(Number).sort((i,n)=>i-n):[]}function Un(e){let t=ld(e,jo);if(!K_(t))return[];let r=[];for(let i of bB(t,{withFileTypes:!0})){if(!i.isDirectory()||i.name.startsWith("."))continue;let n=Uo(e,i.name);n&&r.push(n)}return r.sort((i,n)=>i.code.localeCompare(n.code))}function Uo(e,t){let r=$c(e,t),i=r.at(-1);if(i===void 0)return null;let n=Pt(e,t,i),o=n.ok?n.value.document.frontmatter.title:void 0;return{code:t,versions:r,inForce:i,...typeof o=="string"?{title:o}:{}}}function Pt(e,t,r){let i=r??$c(e,t).at(-1);if(i===void 0)return w({code:"capability-not-found",message:`There is no capability ${t}.`});let n=Lo(t,i);if(!K_(ld(e,n)))return w({code:"capability-version-not-found",path:n,message:`${t} has no version ${i}. Its versions are ${$c(e,t).map(a=>`v${a}`).join(", ")||"none"}.`});let o=wB(ld(e,n),"utf8"),s=oe(o,n);return s.ok?T({code:t,version:i,path:n,text:o,document:s.value,record:Dhe(e,t,i)}):s}function Dhe(e,t,r){let i=Ii(t,r);return K_(ld(e,i))?Mhe(wB(ld(e,i),"utf8"),i):w({code:"capability-record-missing",path:i,message:`${i} is missing: every capability version has a record beside its text.`})}function W_(e){let t=["capability","version","hash","change","archivedBy","archivedAt","confirmedBy","confirmedAt","template","baseline","sources"],r={};for(let i of t)e[i]!==void 0&&(r[i]=e[i]);return(0,ud.stringify)(r,{lineWidth:0})}function Mhe(e,t){let r;try{r=(0,ud.parse)(e)}catch(n){let o=n instanceof ud.YAMLParseError?n.message.split(`
235
+ `)[0]:String(n);return w({code:"capability-record-invalid",path:t,message:`${t} is not valid YAML: ${o}`})}let i=zhe.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"capability-record-invalid"))}var _B=$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),hO=$.object({id:$.string().regex(/^Q[1-9][0-9]*$/,"must be Q followed by a number, such as Q1"),about:$.string().min(1),code:$.string().min(1),source:$.string().min(1),sources:$.array($.string().min(1)).optional(),leftOpenBy:$.string().min(1).optional(),leftOpenAt:_B.optional(),answer:$.enum(["code","source"],{error:"must be code or source"}).optional(),answeredBy:$.string().min(1).optional(),answeredAt:_B.optional()});function Ah(e,t){let r=e.frontmatter.openQuestions;if(r==null)return{questions:[],problems:[]};let i=$.array(hO).safeParse(r);if(i.success)return{questions:i.data,problems:[]};let n=i.error.issues[0],o=n?`openQuestions${n.path.map(s=>typeof s=="number"?`[${s}]`:`.${String(s)}`).join("")}`:"openQuestions";return{questions:[],problems:[{code:"open-question-invalid",...t?{path:t}:{},message:`${o} ${n?.message??"is not a list of questions"}.`}]}}var dd=e=>e.filter(t=>!t.answer);function kB(e,t,r){let{questions:i}=Ah(e);if(i.length===0)return e;let n=i.map(o=>({...o,...o.leftOpenBy?{}:{leftOpenBy:t},...o.leftOpenAt?{}:{leftOpenAt:r},...o.answer&&!o.answeredBy?{answeredBy:t}:{},...o.answer&&!o.answeredAt?{answeredAt:r}:{}}));return sr(e,{openQuestions:n})}function SB(e,t){return dd(Ah(t).questions).map(r=>({id:"open-question",passed:!1,message:`${e} version 0 leaves ${r.id} open (${r.about}). The code: ${r.code}. ${r.sources?.length?r.sources.join(", "):"The source"}: ${r.source}.`.replace(/\.\./g,"."),remedy:`Ask someone who knows which is intended, with ${ee("onboard")}. Record their answer as answer: code or answer: source on ${r.id}, saving ${e} with save_draft (version 0), and draft the part it concerns; then approve again.`}))}function G_(e){let t=[];for(let r of e.artifacts.values()){let i=r.onboard?.document;if(i)for(let n of dd(Ah(i).questions))t.push({id:r.id,...r.title?{title:r.title}:{},question:n})}return t.sort((r,i)=>r.id.localeCompare(i.id,"en",{numeric:!0})||r.question.id.localeCompare(i.question.id,"en",{numeric:!0}))}import{randomBytes as O$e}from"node:crypto";import{existsSync as N$e}from"node:fs";import{dirname as aW,join as j$e}from"node:path";var Br=e=>e.replace(/<!--[\s\S]*?-->/g,""),H_=e=>Br(e).trim()==="",Lhe=/^[-*+] +(.*)$/,Uhe=/^\*\*([A-Za-z0-9][A-Za-z0-9-]*)\*\*\s*(.*)$/,qhe=/^### +(.*?)\s*$/,Fhe=/^#### +(.*?)\s*$/,Zhe=/^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)\b\s*(.*)$/,Vhe=/^covers:\s*(.*)$/i;function qo(e,t,r={}){let i=Br(e).split(/\r?\n/);return t==="list"?Bhe(i):Khe(i,r.nested===!0)}function Bhe(e){let t=[];for(let r of e){let i=Lhe.exec(r);if(i){let n=i[1]??"",o=Uhe.exec(n);t.push({id:o?.[1]??null,text:(o?o[2]:n)?.trim()??"",raw:r,covers:null})}else if(t.length>0&&/^\s+\S/.test(r)){let n=t[t.length-1];n.raw+=`
236
+ ${r}`,n.text=`${n.text} ${r.trim()}`.trim()}}return t}function Khe(e,t){let r=[],i=new Map;for(let n of e){let o=qhe.exec(n);if(o){let l=xB(o[1]??"",n);t&&(l.children=[],i.set(l,[])),r.push(l);continue}let s=r[r.length-1];if(!s)continue;if(!s.children){IB(s,n);continue}s.raw+=`
237
+ ${n}`;let a=Fhe.exec(n),c=s.children[s.children.length-1];a?s.children.push(xB(a[1]??"",n)):c?IB(c,n):i.get(s)?.push(n)}for(let[n,o]of i)n.body=o.join(`
238
+ `).trim();return r}function xB(e,t){let r=Zhe.exec(e);return{id:r?.[1]??null,text:(r?r[2]:e)?.trim()??"",raw:t,covers:null}}function IB(e,t){e.raw+=`
239
+ ${t}`;let r=Vhe.exec(t.trim());r&&(e.covers=Whe(r[1]??""))}function Whe(e){return e.replace(/^\[|\]$/g,"").split(",").map(t=>t.trim()).filter(t=>t.length>0)}import{existsSync as Ghe,readdirSync as PB}from"node:fs";import{join as RB}from"node:path";var TB=500,Hhe=/^\s*[-*+]?\s*\*\*WHEN\*\*/im,Jhe=/^\s*[-*+]?\s*\*\*THEN\*\*/im,Yhe=/^v(0|[1-9][0-9]*)\.yaml$/;function J_(e){let t={capabilities:0,versionsChecked:0,problems:[]},r=RB(e,jo);if(!Ghe(r))return t;for(let i of PB(r,{withFileTypes:!0})){if(!i.isDirectory()||i.name.startsWith("."))continue;let n=i.name,o=$c(e,n);if(o.length===0){t.problems.push({code:"capability-no-version",path:on(n),message:`${on(n)} has no version. A capability spec is written by finishing a change.`});continue}t.capabilities++;for(let s of o){let a=Pt(e,n,s);if(!a.ok){t.problems.push(...a.problems);continue}let{record:c,path:l,text:u}=a.value;c.ok?(t.versionsChecked++,c.value.capability!==n||c.value.version!==s?t.problems.push({code:"capability-record-mismatch",path:Ii(n,s),message:`${Ii(n,s)} is the record of ${c.value.capability} v${c.value.version}, not of ${n} v${s}.`}):c.value.hash!==Ft(u)&&t.problems.push({code:"capability-version-altered",path:l,message:`${l} no longer matches the hash in its record: it was changed after it was written. Capability versions are never edited.`,remedy:`Restore it with git restore -- ${l} in the spec repo, and make the change in a change.`})):t.problems.push(...c.problems),s===o.at(-1)&&t.problems.push(...Eh(a.value.document,n,l))}t.problems.push(...Xhe(e,n,o))}return t}function Xhe(e,t,r){let i=RB(e,on(t),Mn);return PB(i).map(n=>Yhe.exec(n)?.[1]).filter(n=>n!==void 0&&!r.includes(Number(n))).map(n=>{let o=Ii(t,Number(n));return{code:"capability-text-missing",path:o,message:`${o} has no text beside it: ${o.replace(/\.yaml$/,".md")} is missing.`,remedy:"Restore it from the spec repo's history."}})}function Eh(e,t,r){let i=Ht(e,"Requirements")?.body??"";return gO(qo(i,"heading",{nested:!0}),r,t)}function gO(e,t,r){let i=[],n=(o,s,a)=>i.push({code:o,path:t,message:`${t}: ${s}`,remedy:a});for(let o of e){let s=o.id??o.text;(o.children??[]).length===0&&n("requirement-no-scenario",`${s} has no scenario.`,`Add one under it as "#### ${o.id??`${r}-R1`}-S1 <name>", with a WHEN line and a THEN line.`);let a=(o.body??"").length;a>TB&&n("requirement-too-long",`${s}'s text is ${a} characters; a requirement states one behavior in at most ${TB}.`,"Split it into requirements that each state one behavior, or move detail into its scenarios.");for(let c of o.children??[]){let l=[Hhe.test(c.raw)?null:"WHEN",Jhe.test(c.raw)?null:"THEN"].filter(u=>u!==null);l.length!==0&&n("scenario-malformed",`${c.id??c.text} has no ${l.join(" or ")} line.`,'Write it as "- **WHEN** <what happens>" then "- **THEN** <what the system does>".')}}return i}var Qhe=/^\s*\*\*Reason\*\*:?\s*\S/im,ege=/^\s*\*\*Migration\*\*:?\s*\S/im;function xn(e){let t=(i,n)=>qo(Ht(e,i)?.body??"","heading",{nested:n}),r=Ht(e,"Purpose")?.body.trim();return{added:t("Added",!0),modified:t("Modified",!0),removed:t("Removed",!1),purpose:r||null}}function AB(e,t,r,i){let n=xn(e),o=[],s=(c,l,u)=>o.push({code:c,path:i,message:`${i}: ${l}`,...u?{remedy:u}:{}}),a=new Set(r?Jt(r).map(c=>c.id):[]);r||(n.purpose||s("spec-change-no-purpose",`${t} is a new capability, so its spec change needs a Purpose section saying what it covers.`),(typeof e.frontmatter.title!="string"||e.frontmatter.title.trim()==="")&&s("spec-change-no-title",`${t} is a new capability, so its spec change needs its title in the frontmatter, such as title: Text messages.`),(n.modified.length>0||n.removed.length>0)&&s("spec-change-new-capability",`${t} is a new capability, so there is nothing to modify or remove: put every requirement under Added.`));for(let c of n.added)c.id&&a.has(c.id)&&s("requirement-exists",`${c.id} is added, but ${t} already has it.`,`Put it under Modified with its full new text, or write it as ${t}-R{{new}} to add a new requirement.`);if(r)for(let c of[...n.modified,...n.removed])c.id&&!a.has(c.id)&&s("requirement-not-found",`${c.id} is ${n.modified.includes(c)?"modified":"removed"}, but ${t} has no such requirement.`);for(let c of n.removed){let l=[Qhe.test(c.raw)?null:"Reason",ege.test(c.raw)?null:"Migration"].filter(u=>u!==null);l.length>0&&s("removal-incomplete",`${c.id??c.text} is removed without its ${l.join(" and ")}.`,'Add "**Reason**: why it no longer applies" and "**Migration**: what users or callers do instead".')}return o.push(...gO([...n.added,...n.modified],i,t)),o}function Jt(e){return qo(Ht(e,"Requirements")?.body??"","heading",{nested:!0})}function yO(e,t,r){let i=oe(t);if(!i.ok)return i;let n=xn(i.value),o=n.added.map(CB);if(e===null){let m=typeof i.value.frontmatter.title=="string"?i.value.frontmatter.title:r;return T(`---
240
+ id: ${r}
241
+ title: ${m}
242
+ ---
243
+
244
+ ## Purpose
245
+
246
+ ${n.purpose??""}
247
+
248
+ ## Requirements
249
+
250
+ ${o.join(`
251
+
252
+ `)}
253
+ `)}let s=oe(e);if(!s.ok)return s;let a=Ht(s.value,"Requirements");if(!a)return w({code:"capability-no-requirements",message:`${r} has no Requirements section to merge into.`});let c=new Map(n.modified.filter(m=>m.id).map(m=>[m.id,m])),l=new Set(n.removed.map(m=>m.id)),u=Jt(s.value).filter(m=>!l.has(m.id)).map(m=>CB(m.id&&c.get(m.id)||m)),d=a.body.slice(0,Math.max(0,a.body.search(/^### /m))),p=`${d.trim()===""?`
254
+ `:d}${[...u,...o].join(`
255
+
256
+ `)}
257
+ `,f=e.indexOf(a.headingLine)+a.headingLine.length;return T(`${e.slice(0,f)}${p}${e.slice(f+a.body.length)}`)}var CB=e=>e.raw.replace(/\s+$/,"");import{existsSync as pge,readdirSync as fge,readFileSync as mge}from"node:fs";import{join as kO}from"node:path";var fd=Lt(Vt(),1);import{existsSync as nge,readdirSync as ige,readFileSync as oge}from"node:fs";import{join as $O}from"node:path";import{existsSync as OB,readdirSync as tge,readFileSync as vO}from"node:fs";import{dirname as rge,join as Oh}from"node:path";var Ae=e=>rge(e.path);function EB(e,t){return OB(e)?tge(e).map(r=>t.exec(r)?.[1]).filter(r=>r!==void 0).map(Number):[]}function se(e,t){let r=Oh(e,Ae(t)),i=Oh(r,xi),n=EB(i,Yu),o=n.includes(0),s=t.onboard!==void 0&&!o,a=t.path===t.onboard?.path;if(n.length===0){let f=EB(i,Xu).length>0;return{state:f?"pending":"draft",approvedVersion:null,draftOpen:!1,onboardOpen:s&&!f,onboardOnly:a,onboarded:o}}let c=Math.max(...n),l=Oh(r,Mn,`v${c}.md`),u=Oh(e,t.path),d=!a&&(!OB(l)||vO(l,"utf8")!==vO(u,"utf8")),p=t.type==="test-plan"&&/^recorded: true$/m.test(vO(Oh(i,`v${c}.yaml`),"utf8"));return{state:"approved",approvedVersion:c,draftOpen:d,onboardOpen:s,onboardOnly:a,onboarded:o,...p?{recorded:!0}:{}}}function pd(e){let t=e.onboardOpen?", v0 in draft":"";return e.state==="draft"?e.onboardOnly?"v0 in draft":`draft${t}`:e.state==="pending"?"approved, number pending":`${e.recorded?"recorded":"approved"} v${e.approvedVersion}${e.draftOpen?`, v${(e.approvedVersion??0)+1} in draft`:""}${t}`}var md="completions",sge=["passed","failed","not run","stale","no test"],NB=$.object({id:$.string().regex(/^[0-9a-f]{7,64}$/),subject:$.string()}),age=$.object({unit:$.string().min(1),version:$.number().int().nonnegative().optional(),ancestors:$.array($.string()).default([]),documents:$.record($.string(),$.number().int().nonnegative()).optional(),repo:$.string().min(1),branch:$.string().min(1).optional(),commits:$.array(NB.extend({by:$.enum(["trailer","branch","key"])})).default([]),onboarded:$.literal(!0).optional(),keys:$.array($.string().min(1)).optional(),excluded:$.array(NB).default([]),merged:$.string().nullable().default(null),files:$.array($.string()).default([]),tests:$.object({ranAt:$.string().nullable().default(null),plans:$.array($.string()).default([]),cases:$.record($.string(),$.object({result:$.enum(sge),tests:$.array($.string()).optional(),note:$.string().optional()})).default({})}).default({ranAt:null,plans:[],cases:{}}),versions:$.record($.string(),$.number().int().positive()).optional(),requirements:$.array($.string().min(1)).optional(),review:$.string().optional(),findings:$.array($.object({code:$.string().min(1),message:$.string().min(1)})).optional(),finishedAnyway:$.boolean().optional(),children:$.array($.object({unit:$.string().min(1),version:$.number().int().nonnegative().optional(),record:$.string().min(1)})).optional(),finishedBy:$.string().min(1),finishedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),host:$.string().min(1)});function oo(e,t){let r=e.replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z"),n=(t.replace(/<[^>]*>/,"").trim()||t).toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"unknown";return`${r}-${n}.yaml`}var hd=(e,t)=>`${Ae(e)}/${md}/${t}`;function Gs(e){let t={unit:e.unit,...e.version!==void 0?{version:e.version}:{},ancestors:e.ancestors,...e.documents&&Object.keys(e.documents).length>0?{documents:e.documents}:{},repo:e.repo,...e.onboarded?{onboarded:!0}:{},...e.keys&&e.keys.length>0?{keys:e.keys}:{},...e.branch?{branch:e.branch}:{},commits:e.commits.map(r=>({id:r.id,subject:r.subject,by:r.by})),excluded:e.excluded.map(r=>({id:r.id,subject:r.subject})),merged:e.merged,files:e.files,tests:{ranAt:e.tests.ranAt,plans:e.tests.plans,cases:Object.fromEntries(Object.entries(e.tests.cases).map(([r,i])=>[r,{result:i.result,...i.tests?{tests:i.tests}:{},...i.note?{note:i.note}:{}}]))},...e.versions?{versions:e.versions}:{},...e.requirements?{requirements:e.requirements}:{},...e.review!==void 0?{review:e.review}:{},...e.findings?{findings:e.findings.map(r=>({code:r.code,message:r.message}))}:{},...e.finishedAnyway!==void 0?{finishedAnyway:e.finishedAnyway}:{},...e.children?{children:e.children.map(r=>({unit:r.unit,...r.version!==void 0?{version:r.version}:{},record:r.record}))}:{},finishedBy:e.finishedBy,finishedAt:e.finishedAt,host:e.host};return(0,fd.stringify)(t,{lineWidth:0})}function bO(e,t){let r;try{r=(0,fd.parse)(e)}catch(n){let o=n instanceof fd.YAMLParseError?n.message.split(`
258
+ `)[0]:String(n);return w({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=age.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"record-invalid"))}function Ti(e,t){let r=`${Ae(t)}/${md}`;if(!nge($O(e,r)))return{completions:[],problems:[]};let i=[],n=[];for(let o of ige($O(e,r)).filter(s=>s.endsWith(".yaml")).sort()){let s=`${r}/${o}`,a=bO(oge($O(e,s),"utf8"),s);a.ok?i.push({path:s,record:a.value}):n.push(...a.problems)}return{completions:i,problems:n}}function Ke(e,t,r){let{completions:i}=Ti(e,t);return i.filter(n=>r===null?!0:n.record.version===r).at(-1)??null}var gd=Lt(Vt(),1);import{existsSync as cge,readdirSync as lge,readFileSync as uge}from"node:fs";import{join as wO}from"node:path";var Y_="repins",dge=$.object({target:$.string().min(1),testCase:$.string().min(1).optional(),from:$.number().int().nonnegative(),to:$.number().int().nonnegative(),decidedBy:$.string().min(1),decidedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),decision:$.enum(["still-valid","needs-change"]).optional(),followUp:$.string().min(1).optional()});function Nh(e){let t=(e.testCase??e.target).toLowerCase().replace(/[^a-z0-9]+/g,"-");return oo(e.decidedAt,e.decidedBy).replace(/\.yaml$/,`-${t}.yaml`)}var jB=(e,t)=>`${Ae(e)}/${Y_}/${t}`;function jh(e){let t={target:e.target,...e.testCase?{testCase:e.testCase}:{},from:e.from,to:e.to,decidedBy:e.decidedBy,decidedAt:e.decidedAt,...e.decision==="needs-change"?{decision:e.decision}:{},...e.followUp?{followUp:e.followUp}:{}};return(0,gd.stringify)(t,{lineWidth:0})}function _O(e,t){let r;try{r=(0,gd.parse)(e)}catch(n){let o=n instanceof gd.YAMLParseError?n.message.split(`
259
+ `)[0]:String(n);return w({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=dge.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"record-invalid"))}function yd(e,t){let r=`${Ae(t)}/${Y_}`;if(!cge(wO(e,r)))return{repins:[],problems:[]};let i=[],n=[];for(let o of lge(wO(e,r)).filter(s=>s.endsWith(".yaml")).sort()){let s=`${r}/${o}`,a=_O(uge(wO(e,s),"utf8"),s);a.ok?i.push({path:s,record:a.value}):n.push(...a.problems)}return{repins:i,problems:n}}function Pi(e,t,r,i){return t.map(n=>n.record).filter(n=>n.target===r&&n.testCase===i).reduce((n,o)=>Math.max(n,o.to),e)}var vd=e=>`${Et(e)}/${md}`,$d=e=>`${Et(e)}/${Y_}`;function zB(e,t,r){if(!pge(kO(e,t)))return{records:[],problems:[]};let i=[],n=[];for(let o of fge(kO(e,t)).filter(s=>s.endsWith(".yaml")).sort()){let s=`${t}/${o}`,a=r(mge(kO(e,s),"utf8"),s);a.ok?i.push({path:s,record:a.value}):n.push(...a.problems)}return{records:i,problems:n}}function Ri(e,t){let{records:r,problems:i}=zB(e,vd(t),bO);return{completions:r,problems:i}}function X_(e,t){let{records:r,problems:i}=zB(e,$d(t),_O);return{repins:r,problems:i}}import{existsSync as hge,readFileSync as gge}from"node:fs";import{join as DB}from"node:path";function Js(e){let t=e.raw.split(/\r?\n/).slice(1).join(`
260
+ `);return Ft(t.replace(/\s+/g," ").trim())}var wc=(e,t,r,i)=>({id:e.id,title:e.text,capability:t,version:r,change:i,hash:Js(e),item:e}),Hs=e=>e.id!==null;function SO(e,t,r){let i=Ce(t,"spec-change",r);if(!hge(DB(e,i)))return null;let n=oe(gge(DB(e,i),"utf8"),i);return n.ok?xn(n.value):null}function bd(e,t,r){let i=Pt(e,r),n=i.ok?i.value.version:null,o=i.ok?Jt(i.value.document).filter(Hs):[],s=SO(e,t,r);if(!s)return{requirements:o.map(d=>wc(d,r,n,null)),own:new Set,removed:new Set};let a=new Map(s.modified.filter(Hs).map(d=>[d.id,d])),c=new Set(s.removed.filter(Hs).map(d=>d.id)),l=o.filter(d=>!c.has(d.id)).map(d=>{let p=a.get(d.id);return p?wc(p,r,n,t):wc(d,r,n,null)}),u=new Set(l.map(d=>d.id));for(let d of s.added.filter(Hs))u.has(d.id)||l.push(wc(d,r,n,t));return{requirements:l,own:new Set([...a.keys(),...s.added.filter(Hs).map(d=>d.id)]),removed:c}}function xO(e,t){let r=new Map,i=Un(e),n=new Map(i.map(s=>[s.code,s.inForce]));for(let s of i){let a=Pt(e,s.code,s.inForce);if(a.ok)for(let c of Jt(a.value.document).filter(Hs))r.set(c.id,wc(c,s.code,s.inForce,null))}let o=Ys(e).map(s=>s.id);if(t&&o.includes(t))for(let s of nr(e,t)){let a=SO(e,t,s);if(a)for(let c of[...a.modified,...a.added].filter(Hs))r.set(c.id,wc(c,s,n.get(s)??null,t))}for(let s of o)if(s!==t)for(let a of nr(e,s)){let c=SO(e,s,a);if(c)for(let l of c.added.filter(Hs))r.has(l.id)||r.set(l.id,wc(l,a,n.get(a)??null,s))}return r}function zh(e){let t=[];for(let r of e)for(let i of r.item.children??[])i.id&&t.push({id:i.id,title:i.text,requirement:r});return t}function wd(e,t){return new Map(zh(xO(e,t).values()).map(r=>[r.id,r]))}import{execFile as yge,execFileSync as vge,spawn as $ge}from"node:child_process";import{copyFileSync as bge,existsSync as UB,rmSync as wge}from"node:fs";import{isAbsolute as qB,join as _ge,relative as kge,resolve as FB,sep as Sge}from"node:path";import{promisify as xge}from"node:util";var Ige=xge(yge),_d=class extends Error{constructor(r,i){super(`git ${r.join(" ")} failed: ${i.trim()||"no output"}`);this.args=r;this.stderr=i}args;stderr};function Rt(e,t,r){return so(e,t,r).trim()}function so(e,t,r){try{return vge("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","pipe"],maxBuffer:256*1024*1024,...r?{env:{...process.env,...r}}:{}})}catch(i){throw new _d(t,String(i.stderr??i))}}function le(e,t){try{return Rt(e,t)}catch{return null}}function $r(e,t,r={}){return new Promise(i=>{let n=r.input,o=$ge("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"},stdio:[n===void 0?"ignore":"pipe","pipe","pipe"]}),s="",a="";o.stdout?.on("data",l=>s+=l.toString("utf8")),o.stderr?.on("data",l=>a+=l.toString("utf8"));let c=r.timeoutMs?setTimeout(()=>{a+=`timed out after ${r.timeoutMs} ms`,o.kill()},r.timeoutMs):null;o.on("error",l=>{c&&clearTimeout(c),i({code:-1,stdout:s,stderr:a||l.message})}),o.on("close",l=>{c&&clearTimeout(c),i({code:l??-1,stdout:s.trim(),stderr:a.trim()})}),o.stdin&&(o.stdin.on("error",()=>{}),o.stdin.end(n))})}var kd=e=>le(e,["rev-parse","--show-toplevel"]);function lt(e){let t=le(e,["var","GIT_COMMITTER_IDENT"]);return(t?/^(.*<[^>]*>)/.exec(t):null)?.[1]?.trim()??null}function Me(e,t,r){let i=[...new Set(t)].filter(n=>UB(_ge(e,n))||le(e,["ls-files","--",n]));if(i.length===0)return w({code:"git-nothing-to-commit",message:"There is nothing to commit."});try{return Rt(e,["add","--all","--",...i]),Rt(e,["commit","--quiet","--only","--message",r,"--",...i]),T(Rt(e,["rev-parse","HEAD"]))}catch(n){let o=n instanceof _d?n.stderr.trim():String(n);return w({code:"git-commit-failed",message:`Could not commit: ${o}`})}}var Xs=e=>le(e,["symbolic-ref","--quiet","--short","HEAD"]);function Q_(e){let t=(le(e,["for-each-ref","--format=%(refname) %(symref)","refs/remotes/origin/HEAD","refs/heads/"])??"").split(`
261
+ `).map(s=>s.split(" ")),r=t.find(([s])=>s==="refs/remotes/origin/HEAD")?.[1],i=r?r.replace(/^refs\/remotes\//,""):null,n=new Set(t.map(([s])=>s??"").filter(s=>s.startsWith("refs/heads/")).map(s=>s.slice(11)));return[i?.replace(/^origin\//,""),"main","master"].filter(s=>!!s).find(s=>n.has(s))??i}function Ci(e,t){let r=kge(e,FB(e,t));return r===""||r.startsWith("..")||qB(r)?null:r.split(Sge).join("/")}var MB=new Map;function Tge(e){let t=MB.get(e);if(t)return t;let r=le(e,["rev-parse","--git-path","index"]);if(!r)return null;let i=qB(r)?r:FB(e,r);return MB.set(e,i),i}function ZB(e,t=[]){let r=le(e,["rev-parse","--verify","--quiet","HEAD"]),i=Tge(e);if(!i)return{commit:r,tree:null};let n=`${i}.buildkeel-${process.pid}`;try{UB(i)&&bge(i,n);let o={GIT_INDEX_FILE:n};return Rt(e,["add","--all","--","."],o),t.length>0&&Rt(e,["rm","-r","--cached","--quiet","--ignore-unmatch","--",...t],o),{commit:r,tree:Rt(e,["write-tree"],o)}}catch{return{commit:r,tree:null}}finally{wge(n,{force:!0})}}var ek=e=>le(e,["rev-parse","--abbrev-ref","--symbolic-full-name","@{upstream}"]),Qs=e=>(le(e,["remote"])??"").split(`
262
+ `).filter(Boolean);function Fo(e){let t=Pge(e)?le(e,["log","--format=%s","HEAD","--not","--remotes"]):null;if(t===null)return{approvals:null,completions:null,archives:null};let r=t.split(`
263
+ `);return{approvals:r.filter(i=>i.startsWith("approve: ")).length,completions:r.filter(i=>i.startsWith("done: ")).length,archives:r.filter(i=>i.startsWith("archive: ")||i.startsWith("discard: ")).length}}var LB=new Set;function Pge(e){if(LB.has(e))return!0;let t=Qs(e).length>0;return t&&LB.add(e),t}var tk=e=>Fo(e).approvals,rk=e=>Fo(e).completions;function VB(e){let t=ek(e);if(t)return t;let r=Qs(e),i=r.includes("origin")?"origin":r[0];if(!i)return null;let n=le(e,["symbolic-ref","--quiet","--short",`refs/remotes/${i}/HEAD`]);for(let o of[n,`${i}/main`,`${i}/master`])if(o&&le(e,["rev-parse","--verify","--quiet",`refs/remotes/${o}`]))return o;return null}async function In(e){let t=Xs(e);if(!t)return w({code:"git-push-failed",message:"Cannot push: the repo is not on a branch."});let r=ek(e)?["push","--quiet"]:["push","--quiet","--set-upstream","origin",t];try{return await Ige("git",r,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),T(void 0)}catch(i){let n=String(i.stderr??i).trim();return w({code:"git-push-failed",message:`The push was rejected: ${n.split(`
264
+ `)[0]}`})}}var ar="{{new}}";function _c(e){return Object.entries(e.sections).flatMap(([t,r])=>r.items?[{section:t,prefix:r.items.prefix,style:r.items.style}]:[])}var IO=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Tn(e,t,r){let i=[];for(let{section:n,prefix:o,style:s}of _c(t)){let a=Ht(e,n)?.body;if(!a)continue;let c=new RegExp(`^${IO(r)}-${o}([1-9][0-9]*)$`);for(let l of qo(a,s)){let u=l.id?c.exec(l.id):null;u&&l.id&&i.push({...l,id:l.id,prefix:o,number:Number(u[1]),section:n})}}return i}function nk(e,t,r){let i=new Map;for(let n of e)for(let o of Tn(n,t,r))i.set(o.prefix,Math.max(i.get(o.prefix)??0,o.number));return i}function KB(e,t,r,i){let n=[],o=e;for(let{prefix:s}of _c(t)){let a=i.get(s)??0;o=o.replace(new RegExp(`${IO(r)}-${s}${IO(ar)}`,"g"),()=>{let c=`${r}-${s}${++a}`;return n.push(c),c})}return{text:o,assigned:n}}var BB=e=>`${e.text.replace(/\s+/g," ").trim()}|${(e.covers??[]).join(",")}`;function WB(e,t,r,i){let n=[],o=new Map,s=new Map;for(let{version:a,items:c}of e){let l=new Set(c.map(u=>u.id));for(let[u]of o)!l.has(u)&&!s.has(u)&&s.set(u,a);for(let u of c)o.set(u.id,{item:u,version:a}),s.delete(u.id)}for(let a of t){let c=s.get(a.id),l=o.get(a.id);c===void 0||!l||BB(l.item)===BB(a)||n.push({code:"item-reused",path:r,message:`${r}: ${a.id} was removed in v${c} and cannot be used again for a different entry.`,remedy:`Write the new entry as ${i}-${a.prefix}${ar}, and BuildKeel gives it the next number when it is saved.`})}return n}var Sd=Lt(Vt(),1);import{existsSync as Rge,readFileSync as Cge}from"node:fs";import{join as Age}from"node:path";function ao(e,t){return t.some(r=>r.endsWith("/")?e.startsWith(r):e===r||e.startsWith(`${r}/`))}function GB(e){let t=e.split("/"),r=t.at(-1)??"";return t.slice(0,-1).some(i=>["test","tests","__tests__","spec"].includes(i))||/[._-](test|spec)\.[^.]+$/.test(r)||/^test_.*\.py$/.test(r)}var co=e=>e.trim().replace(/\\/g,"/").replace(/^\.\//,"");var sn="onboarding/map.yaml",Ege=$.object({key:$.string().trim().min(1),link:$.string().trim().min(1).optional(),title:$.string().trim().min(1),outcome:$.enum(["carried","left-out"],{error:"must be carried or left-out"}),artifact:$.string().trim().min(1).optional(),why:$.enum(["open","in-progress","choice"],{error:"must be open, in-progress or choice"}).optional(),chosenBy:$.string().min(1).optional(),chosenAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}).optional()}).superRefine((e,t)=>{e.outcome==="carried"&&!e.artifact&&t.addIssue({code:"custom",path:["artifact"],message:"names what a ticket carried over became, and is required for it"}),e.outcome==="left-out"&&!e.why&&t.addIssue({code:"custom",path:["why"],message:"says why a ticket was left out (open, in-progress or choice), and is required for it"})}),Oge=$.object({name:$.string().trim().min(1),repo:$.string().trim().min(1),paths:$.array($.string().trim().min(1)).default([]),summary:$.string().trim().min(1).optional(),capabilities:$.array($.string().trim().min(1)).optional(),openQuestions:$.array(hO).optional(),tickets:$.array(Ege).optional()}),Nge=$.object({areas:$.array(Oge)}).superRefine((e,t)=>{let r=new Set;e.areas.forEach((i,n)=>{let o=i.name.toLowerCase();r.has(o)&&t.addIssue({code:"custom",path:["areas",n,"name"],message:`repeats the area name "${i.name}"`}),r.add(o),i.paths.length===0&&!i.capabilities?.length&&t.addIssue({code:"custom",path:["areas",n,"paths"],message:"must name at least one path the area covers"}),i.capabilities?.forEach((s,a)=>{let c=e.areas.findIndex((l,u)=>u<n&&l.capabilities?.includes(s));c!==-1&&t.addIssue({code:"custom",path:["areas",n,"capabilities",a],message:`puts ${s} in a second area: it is already in "${e.areas[c]?.name}", and a capability spec is drafted with one area`})}),i.paths.forEach((s,a)=>{(s.startsWith("/")||s.split("/").includes(".."))&&t.addIssue({code:"custom",path:["areas",n,"paths",a],message:`must be a path inside the repo, not ${s}`})})})});function jge(e){let t=e.areas.map(r=>({name:r.name,repo:r.repo,...r.paths.length>0||!r.capabilities?{paths:r.paths}:{},...r.summary?{summary:r.summary}:{},...r.capabilities?{capabilities:r.capabilities}:{},...r.openQuestions?.length?{openQuestions:r.openQuestions}:{},...r.tickets?.length?{tickets:r.tickets}:{}}));return`# The capability areas of the code, for documenting it area by area. Written by BuildKeel's onboarding.
265
+ ${(0,Sd.stringify)({areas:t},{lineWidth:0})}`}function HB(e,t=sn){let r;try{r=(0,Sd.parse)(e)}catch(n){let o=n instanceof Sd.YAMLParseError?n.message.split(`
266
+ `)[0]:String(n);return w({code:"map-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Nge.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"map-invalid"))}function qn(e){let t=Age(e,sn);return Rge(t)?HB(Cge(t,"utf8")):T(null)}var kc=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Dh(e,t){let r=qn(e.root);if(!r.ok)return r;let i=r.value?.areas??[],n=m=>i.findIndex(h=>h.name.toLowerCase()===m.trim().toLowerCase()),o=m=>({code:"map-no-area",message:`The map has no area called "${m}".${i.length>0?` Its areas are ${kc(i.map(h=>h.name))}.`:""}`}),s=m=>({name:m.name.trim(),repo:m.repo?.trim()||e.defaultRepo,paths:[...new Set((m.paths??[]).map(co).filter(Boolean))],...m.summary?.trim()?{summary:m.summary.trim()}:{},...m.capabilities?.length?{capabilities:[...new Set(m.capabilities.map(h=>h.trim().toUpperCase()))]}:{}}),a,c;switch(t.op){case"set":a=t.areas.map(s).map(m=>{let h=i[n(m.name)];return{...m,...h?.openQuestions?.length?{openQuestions:h.openQuestions}:{},...h?.tickets?.length?{tickets:h.tickets}:{}}}),c=`map of ${a.length} area${a.length===1?"":"s"}`;break;case"merge":{let m=t.names.map(n),h=t.names.filter((x,S)=>m[S]===-1);if(h.length>0)return w(...h.map(o));if(t.names.length<2)return w({code:"map-merge-one",message:"Name at least two areas to merge."});let g=m.map(x=>i[x]),y=[...new Set(g.map(x=>x.repo))];if(y.length>1)return w({code:"map-merge-repos",message:`${kc(t.names)} are in different repos (${kc(y)}); an area is in one repo.`});let v=[...new Set(g.flatMap(x=>x.capabilities??[]))],b=g.flatMap(x=>x.openQuestions??[]).map((x,S)=>({...x,id:`Q${S+1}`})),_={name:t.to.trim(),repo:y[0],paths:[...new Set(g.flatMap(x=>x.paths))],...v.length>0?{capabilities:v}:{},...b.length>0?{openQuestions:b}:{},...g.some(x=>x.tickets?.length)?{tickets:g.flatMap(x=>x.tickets??[])}:{}},k=Math.min(...m);a=i.flatMap((x,S)=>S===k?[_]:m.includes(S)?[]:[x]),c=`merge ${kc(g.map(x=>x.name))} into ${_.name}`;break}case"split":{let m=n(t.name);if(m===-1)return w(o(t.name));let h=i[m].openQuestions,g=i[m].tickets,y=t.areas.map((v,b)=>({...s({...v,repo:v.repo??i[m].repo}),...b===0&&h?.length?{openQuestions:h}:{},...b===0&&g?.length?{tickets:g}:{}}));a=[...i.slice(0,m),...y,...i.slice(m+1)],c=`split ${i[m].name} into ${kc(y.map(v=>v.name))}`;break}case"question":{let m=n(t.name);if(m===-1)return w(o(t.name));let h=i[m],g=h.openQuestions??[],y=`Q${g.reduce((b,_)=>Math.max(b,Number(_.id.slice(1))),0)+1}`,v={id:y,...t.question,leftOpenBy:t.by,leftOpenAt:t.at};a=i.map((b,_)=>_===m?{...b,openQuestions:[...g,v]}:b),c=`question ${y} left open in ${h.name}`;break}case"answer":{let m=n(t.name);if(m===-1)return w(o(t.name));let h=i[m],g=h.openQuestions?.find(y=>y.id===t.id);if(!g)return w({code:"map-no-question",message:`${h.name} has no question ${t.id}.`});if(g.answer)return w({code:"map-answered",message:`${h.name} ${t.id} is answered already: ${g.answer==="code"?"the code is right":"the source is right"}, by ${g.answeredBy??"someone"}.`});a=i.map((y,v)=>v===m?{...y,openQuestions:(y.openQuestions??[]).map(b=>b.id===t.id?{...b,answer:t.answer,answeredBy:t.by,answeredAt:t.at}:b)}:y),c=`answer ${t.id} in ${h.name}`;break}case"tickets":{let m=n(t.name);if(m===-1)return w(o(t.name));let h=i[m],g=t.tickets.map(y=>{let v=h.tickets?.find(b=>b.key===y.key);return y.outcome!=="left-out"||y.why!=="choice"?y:{...y,chosenBy:v?.why==="choice"&&v.chosenBy?v.chosenBy:t.by,chosenAt:v?.why==="choice"&&v.chosenAt?v.chosenAt:t.at}});a=i.map((y,v)=>v===m?{...y,tickets:g}:y),c=`tickets of ${h.name}`;break}case"rename":{let m=n(t.name);if(m===-1)return w(o(t.name));a=i.map((h,g)=>g===m?{...h,name:t.to.trim()}:h),c=`rename ${i[m].name} to ${t.to.trim()}`;break}}let l=new Set(Un(e.root).map(m=>m.code)),u=[...new Set(a.flatMap(m=>m.capabilities??[]))].filter(m=>!l.has(m));if(u.length>0)return w({code:"map-no-capability",message:`This spec tree has no capability spec ${kc(u)}.${l.size>0?` Its capability specs are ${kc([...l].sort())}.`:""}`});let d=jge({areas:a}),p=HB(d);if(!p.ok)return p;let f=e.writer.writeFile(sn,d);return f.ok?T({map:p.value,summary:c,commit:Me(e.root,[sn],`onboard: ${c}`)}):f}function ea(e){let t=e.flatMap(r=>r.tickets??[]);return{read:t.length,carried:t.filter(r=>r.outcome==="carried").length,leftOut:t.filter(r=>r.outcome==="left-out")}}function ta(e){let t=["open","in-progress","choice"].map(r=>[r,e.leftOut.filter(i=>i.why===r).length]).filter(([,r])=>r>0).map(([r,i])=>`${i} ${r==="choice"?"by choice":r==="in-progress"?"in progress":"open"}`);return`${e.read} read, ${e.carried} carried over, ${e.leftOut.length} left out${t.length>0?` (${t.join(", ")})`:""}`}import{existsSync as xd,readdirSync as qge,readFileSync as Fge}from"node:fs";import{join as Sc}from"node:path";var zge=$.object({required:$.boolean().default(!1),type:$.enum(["text","list","link","boolean"]).default("text"),tracked:$.boolean().default(!1)}),JB=$.string().regex(/^[A-Z]{1,4}$/,"must be 1 to 4 capital letters"),Dge=$.object({prefix:JB,style:$.literal("heading",{error:"must be heading: nested entries are #### headings"})}),Mge=$.object({prefix:JB,style:$.enum(["list","heading"]),covers:$.enum(["required","optional"]).optional(),children:Dge.optional()}).refine(e=>!e.children||e.style==="heading",{path:["children"],message:"need heading entries to sit under: set style to heading"}),Lge=$.object({required:$.boolean().default(!1),tracked:$.boolean().default(!1),items:Mge.optional(),offered:$.string().min(1).optional()}),Uge=$.object({template:$.string().regex(/^[a-z][a-z0-9-]*$/),version:$.number().int().positive(),description:$.string().optional(),fields:$.record($.string(),zge).default({}),sections:$.record($.string(),Lge).default({})});function YB(e,t){let r=oe(e,t);if(!r.ok)return r;let i=Uge.safeParse(r.value.frontmatter);if(!i.success)return w(..._t(i.error.issues,t,"template-invalid"));let n=c=>r.value.sections.some(l=>l.name.toLowerCase()===c.toLowerCase()),o=Object.entries(i.data.sections),s=o.filter(([c,l])=>l.offered===void 0&&!n(c)).map(([c])=>c);if(s.length>0)return w({code:"template-invalid",path:t,message:`${t}: the template declares ${s.map(c=>`"${c}"`).join(", ")} but its body has no such section.`,remedy:'Add the section to the body, or mark it offered with a line saying what goes in it, such as offered: "How it is released and undone".'});let a=o.flatMap(([c,l])=>l.offered===void 0?[]:l.required?[`"${c}" is offered, so it cannot be required: an offered section is added only when it applies.`]:n(c)?[`"${c}" is offered, so it stays out of the body: an offered section is added only when it applies.`]:[]);return a.length>0?w(...a.map(c=>({code:"template-invalid",path:t,message:`${t}: ${c}`}))):T({type:i.data.template,version:i.data.version,...i.data.description?{description:i.data.description}:{},fields:i.data.fields,sections:i.data.sections,skeleton:r.value})}var XB=Sc($A(),"templates"),Zge=Sc(XB,"spec-driven"),lo="templates";function We(e,t){let r=`${e}.md`,{org:i,mode:n,rules:o,conversion:s}=B(t),a=o[e],c=Sc(t,lo,r);if(xd(c))return ik(e,c,`${lo}/${r}`,"tree",void 0,a);if(i&&!i.ok)return i;if(i){let p=Sc(i.value.dir,Ph,r);if(xd(p))return ik(e,p,`${Ph}/${r} in ${i.value.label}`,"org",i.value.label,a)}let l=Sc(Zge,r),u=Sc(XB,r),d=n==="spec-driven"&&s?.state!=="in-progress";return xd(l)&&(d||s&&!xd(u))?ik(e,l,l,"built-in",void 0,a):xd(u)?ik(e,u,u,"built-in",void 0,a):w({code:"template-missing",message:`There is no template for the artifact type ${e}.`,remedy:`Add one as ${lo}/${r} in the spec tree${i?" or in the organization's templates":""}: copy a built-in template such as epic.md, set template: ${e}, and change its fields and sections.`})}function ik(e,t,r,i,n,o){let s=YB(Fge(t,"utf8"),r);return s.ok?s.value.type!==e?w({code:"template-invalid",path:r,message:`${r} says it is the template for ${s.value.type}, not ${e}.`}):T({template:Vge(s.value,o),source:i,path:r,file:t,...n?{org:n}:{}}):s}function Vge(e,t){if(!t||t.sections.length===0&&t.notes.length===0)return e;let r={...e.sections};for(let i of t.sections){let n=Object.keys(r).find(a=>a.toLowerCase()===i.toLowerCase()),o=n?r[n]:void 0;if(o?.required)continue;let s=o?.tracked??!1;r[n??i]={required:!0,tracked:s,...o?.items?{items:o.items}:{},byRule:!0}}return{...e,sections:r,...t.notes.length>0?{notes:[...t.notes]}:{}}}function QB(e){let t=Sc(e,lo);return xd(t)?qge(t).filter(r=>r.endsWith(".md")).map(r=>r.slice(0,-3)).sort():[]}function Mh(e){return e.source==="tree"?`the spec tree's own template (${e.path})`:e.source==="org"?`the organization's templates (${e.org})`:"BuildKeel's built-in template"}import{existsSync as Id,readdirSync as Kge,readFileSync as eK}from"node:fs";import{dirname as Wge,join as Ic,relative as Gge,sep as Hge}from"node:path";var Bge=/^([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)(?:@v(0|[1-9][0-9]*))?$/;function Pn(e){let t=Bge.exec(e.trim());return t?.[1]?t[2]?{id:t[1],version:Number(t[2])}:{id:t[1]}:null}function Yt(e){return e.version===void 0?e.id:`${e.id}@v${e.version}`}var ra=["related","changes"];function na(e,t){let r=e[t];if(r==null||r==="")return{ids:[],invalid:[]};let i=Array.isArray(r)?r:[r],n=[],o=[];for(let s of i){let a=typeof s=="string"?Pn(s):null;a?n.push(a.id):o.push(s)}return{ids:[...new Set(n)],invalid:o}}var xc=e=>/^(?:[A-Za-z][A-Za-z0-9]*-)?draft-[a-z0-9]+$/.test(e);function K(e){let t=B(e),r=t.mode==="spec-driven"?t.conversion?.state==="in-progress"?t.conversion.process:null:t.process,i=r===null?[]:r.ok?r.value.documents:gt.documents;return Jge(e,t.types,i)}function Jge(e,t,r){let i={root:e,artifacts:new Map,problems:[]},n=o=>Gge(e,o).split(Hge).join("/");for(let o of t){let s=Ic(e,o.dir);if(Id(s))for(let a of Kge(s,{withFileTypes:!0})){if(!a.isDirectory()||a.name.startsWith("."))continue;let c=Ic(s,a.name),l=tK(i,n,Ic(c,o.file),a.name,o.type,o.parent);if(l)for(let u of r){let d=Ic(c,u.dir,u.file);if(!Id(d)&&!Id(Ic(c,u.dir,hc)))continue;let p=tK(i,n,d,`${l.id}-${u.suffix}`,u.type,"required",l.id),f=u.name??u.type;p&&(o.type==="bug"||o.type==="adhoc")&&i.problems.push({code:"plan-not-allowed",path:p.path,message:`${p.path}: ${l.id} is ${o.type==="bug"?"a bug":"an ad-hoc unit"}, which has no ${f}. Attached documents belong to the stages of the process, from the business idea down.`}),p?.parent&&p.parent.id!==l.id&&i.problems.push({code:"plan-parent-mismatch",path:p.path,message:`${p.path}: the ${f} sits under ${l.id} but declares ${Yt(p.parent)} as its parent.`,remedy:`Set parent to ${l.id} pinned to the version the ${f} was written against.`})}}}for(let o of i.artifacts.values())o.parent&&!i.artifacts.has(o.parent.id)&&!Id(Ic(e,Sn,o.parent.id))&&i.problems.push({code:"parent-not-found",path:o.path,message:`${o.id} declares ${Yt(o.parent)} as its parent, but no artifact ${o.parent.id} exists.`});return i}function tK(e,t,r,i,n,o,s){let a=Ic(Wge(r),hc),c=Id(a),l=Id(r)?r:c?a:null;if(!l)return e.problems.push({code:"artifact-file-missing",path:t(r),message:`${t(r)} is missing for ${i}.`}),null;let u=t(l),d=oe(eK(l,"utf8"),u);if(!d.ok)return e.problems.push(...d.problems),null;let p=d.value.frontmatter,f;if(l===a)f={path:u,document:d.value};else if(c){let y=oe(eK(a,"utf8"),t(a));y.ok?f={path:t(a),document:y.value}:e.problems.push(...y.problems)}for(let y of s===void 0?[{path:u,fields:p},...f&&f.path!==u?[{path:f.path,fields:f.document.frontmatter}]:[]]:[])y.fields.id!==i&&e.problems.push({code:"id-mismatch",path:y.path,message:`${y.path}: the id field is ${JSON.stringify(y.fields.id??null)} but the artifact's directory is ${i}.`,remedy:`Set id to ${i}.`});let m;if(p.parent!==void 0&&p.parent!==null){let y=typeof p.parent=="string"?Pn(p.parent):null;y?m=y:e.problems.push({code:"bad-link",path:u,message:`${u}: parent ${JSON.stringify(p.parent)} is not an artifact ID. Links use IDs such as US-012@v1, never file paths.`})}else o==="required"&&e.problems.push({code:"missing-parent",path:u,message:`${i} must declare a parent but has none.`});m&&o==="none"&&e.problems.push({code:"unexpected-parent",path:u,message:`${i} is a ${n}, which has no parent, but declares ${Yt(m)}.`});let h={id:i,type:n,path:u,document:d.value,...typeof p.title=="string"?{title:p.title}:{},...m?{parent:m}:{},...s!==void 0?{owner:s}:{},...f?{onboard:f}:{}},g=e.artifacts.get(i);return g?(e.problems.push({code:"duplicate-id",path:u,message:`${i} exists twice: ${g.path} and ${u}.`}),null):(e.artifacts.set(i,h),h)}import{existsSync as TO,readdirSync as Yge,readFileSync as rK}from"node:fs";import{join as ok}from"node:path";function dt(e,t){let r=ok(e,Ae(t),xi);return TO(r)?Yge(r).map(i=>Yu.exec(i)?.[1]).filter(i=>i!==void 0).map(Number).sort((i,n)=>i-n):[]}function Fn(e,t,r){let i=Do(Ae(t),r);if(!TO(ok(e,i)))return null;let n=yc(rK(ok(e,i),"utf8"),i);return n.ok?n.value:null}function an(e,t,r){if(r===void 0)return{document:t.document,version:null,label:`the draft of ${t.id}`};let i=ok(e,zo(Ae(t),r));if(!TO(i))return null;let n=oe(rK(i,"utf8"),i);return n.ok?{document:n.value,version:r,label:`${t.id} v${r}`}:null}function ii(e,t){let r=dt(e,t),i=r[r.length-1];return an(e,t,i)}function Xge(e,t){let r=typeof t.document.frontmatter.parent=="string"?Pn(t.document.frontmatter.parent):null,i=t.document.frontmatter.title;return{id:e.id,type:e.type,path:e.path,document:t.document,...typeof i=="string"?{title:i}:{},...r?{parent:r}:{},...e.owner!==void 0?{owner:e.owner}:{}}}function ve(e,t){let r=dt(e,t).at(-1);if(r===void 0)return null;let i=an(e,t,r);return i?{...Xge(t,i),version:r}:null}function Tc(e,t=K(e)){let r=B(e);if(r.mode!=="spec-driven"||r.conversion?.state!=="in-progress")return w({code:"conversion-none",message:"This spec tree is not being converted to Full SDLC."});let i=nd(e);if(!i?.ok)return i??w({code:"conversion-none",message:"This spec tree is not being converted to Full SDLC."});let n=i.value,o=qn(e);if(!o.ok)return o;let s=new Set(Un(e).map(p=>p.code)),a=[...wd(e,null).values()],c=(o.value?.areas??[]).filter(p=>p.capabilities).map(p=>{let f=(p.capabilities??[]).filter(b=>s.has(b)),m=a.filter(b=>f.includes(b.requirement.capability)),h=m.flatMap(b=>n.placed[b.id]?[{scenario:b.id,to:n.placed[b.id]}]:[]),g=m.filter(b=>n.dropped[b.id]).map(b=>b.id),y=m.filter(b=>!n.placed[b.id]&&!n.dropped[b.id]),v=y.length===0?"converted":y.length<m.length?"partly":"not started";return{area:p,capabilities:f,scenarios:m,placed:h,dropped:g,unplaced:y,state:v}}),l=new Set(c.flatMap(p=>p.capabilities)),u=[...s].filter(p=>!l.has(p)).sort(),d=[...t.artifacts.values()].filter(p=>se(e,p).onboardOpen).map(p=>p.id).sort((p,f)=>p.localeCompare(f,"en",{numeric:!0}));return T({conversion:n,areas:c,unmapped:u,waiting:d,next:c.find(p=>p.state!=="converted")??null})}function PO(e,t,r){for(let i of t.artifacts.values()){let n=i.type===te.type,o=n?Bt(i.id):i.id;if(!r.startsWith(`${o}-`))continue;let s=ve(e,i),a=We(i.type,e);if(!(!s||!a.ok)&&Tn(s.document,a.value.template,o).some(c=>c.id===r))return{id:r,record:i,version:s.version,kind:n?"test case":"entry"}}return null}function nK(e,t,r,i=()=>new Date){if(!e.access.writable)return w(e.access.problem);let n=Tc(e.root);if(!n.ok)return n;let o=Object.entries(r.place??{}).map(([y,v])=>[y.trim(),v.trim()]),s=[...new Set((r.drop??[]).map(y=>y.trim()))];if(o.length===0&&s.length===0)return w({code:"place-nothing",message:"Name the scenarios to place (place, scenario to the entry it became) or to drop (drop)."});let a=new Map(n.value.areas.flatMap(y=>y.scenarios).map(y=>[y.id,y])),c=K(e.root),l=[],u=[];for(let[y,v]of o){if(!a.has(y)){l.push({code:"place-unknown-scenario",message:`There is no scenario ${y} in a capability spec of an area of the map.`});continue}let b=PO(e.root,c,v);if(!b){l.push({code:"place-unknown-entry",message:`${v} is not an acceptance criterion or test case of an approved artifact: a scenario is placed once the artifact it became is approved, by the ID approval gave it.`});continue}u.push({scenario:y,to:b})}for(let y of s)a.has(y)||l.push({code:"place-unknown-scenario",message:`There is no scenario ${y} in a capability spec of an area of the map.`});if(l.length>0)return w(...l);let d=lt(e.root);if(!d)return w({code:"conversion-no-identity",message:"Git has no name and email set for the spec repo, so who placed the scenarios cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com.'});let p=structuredClone(n.value.conversion);for(let{scenario:y,to:v}of u)p.placed[y]=v.id,delete p.dropped[y];let f=id(i());for(let y of s)p.dropped[y]={by:d,at:f},delete p.placed[y];let m=t.writeFile(Mt,rd(p));if(!m.ok)return m;let h=[...u.map(y=>y.scenario),...s],g=`onboard: ${u.length>0?"place":"drop"} ${h.length<=3?h.join(", "):`${h.length} scenarios`}`;return T({placed:u,dropped:s,commit:Me(e.root,[Mt],g)})}function Pc(e){let t=nd(e);return t?.ok?new Map(Object.entries(t.value.placed)):new Map}function Lh(e,t){let r=new Set(t);return new Map([...Pc(e)].filter(([,i])=>r.has(i)))}function iK(e,t,r,i=Pc(e)){let n=Ri(e,r).completions.flatMap(s=>s.record.requirements??[]),o=new Set;for(let[s,a]of i){if(!n.some(l=>s.startsWith(`${l}-`)))continue;let c=PO(e,t,a);c&&o.add(c.record.type===te.type?Bt(c.record.id):c.record.id)}return[...o].sort((s,a)=>s.localeCompare(a,"en",{numeric:!0}))}function oK(e,t){let r=[],i=new Map;for(let[n,o]of Pc(e)){if(!o.startsWith(`${t}-`))continue;let s=n.slice(0,n.lastIndexOf("-")),a=s.slice(0,s.lastIndexOf("-"));i.has(s)||i.set(s,Qge(e,a,s)),r.push({entry:o,scenario:n,requirement:s,capability:a,added:i.get(s)??null})}return r.sort((n,o)=>n.entry.localeCompare(o.entry,"en",{numeric:!0}))}function Qge(e,t,r){for(let i of $c(e,t)){let n=Pt(e,t,i);if(!(!n.ok||!Jt(n.value.document).some(o=>o.id===r)))return{version:i,change:n.value.record.ok?n.value.record.value.change??null:null}}return null}var eye=["idea","epic","story","task"];function cK(e){let t=Tt(e),r=Re(e),i=t.chain.map(n=>r.a(n.type));return`${i.slice(0,-1).join(", ")} or ${i.at(-1)}`}function Zo(e,t){return eye.includes(t)?t:M_(Tt(e),t)?"epic":null}var Rc={idea:"end-to-end test plan",epic:"integration test plan",story:"test plan",task:"test plan"},Bt=e=>e.slice(0,-te.idSuffix.length);function Td(e,t,r){if(!r)return[];let i=We(t.type,e);return i.ok?Tn(r.document,i.value.template,t.id):[]}var RO=(e,t,r)=>an(e,t,r)??an(e,t);function Uh(e,t,r){let i=[],n=new Set([t.id]),o=s=>{for(let a of e.artifacts.values())a.parent?.id!==s||n.has(a.id)||a.owner!==void 0||(n.add(a.id),a.type===r?i.push(a):o(a.id))};return o(t.id),i}function sK(e,t,r,i,n){let o=dt(e,t).at(-1)??i,s=se(e,t).draftOpen?o+1:o;if(s<=i)return;let a=new Set(Td(e,t,{document:t.document,version:null,label:""}).map(l=>l.id).filter(l=>!n.has(l))),c=s>o?`the draft of ${t.id} v${s}`:`${t.id} v${s}`;return{items:a,story:t,pinnedBy:r,label:c,version:s}}function ia(e,t,r){let i=t.artifacts.get(Bt(r.id)),n=i?Zo(e,i.type):null;if(!i||!n)return null;let o=Re(e),s=new Map,a={plan:r,owner:i,level:n,allowed:s,required:[],informational:[],describe:"",against:""};if(n==="story"){let c=RO(e,i,r.parent?.version);for(let l of Td(e,i,c))s.set(l.id,l.text),a.required.push({id:l.id,text:l.text});if(a.describe=`a criterion of ${c?.label??i.id}`,a.against=c?.label??i.id,r.parent?.version!==void 0){a.newer=sK(e,i,r,r.parent.version,s);let l=dt(e,i).at(-1);if(l!==void 0&&l>r.parent.version)for(let u of Td(e,i,an(e,i,l)))s.has(u.id)||a.required.push({id:u.id,text:u.text,addedIn:l})}}else if(n==="task"){s.set(i.id,i.title??`the ${o.one("task")}`);let c=i.parent?t.artifacts.get(i.parent.id):void 0,l=c?RO(e,c,i.parent?.version):null;if(c)for(let u of Td(e,c,l))s.set(u.id,u.text);c&&i.parent?.version!==void 0&&(a.newer=sK(e,c,i,i.parent.version,s)),a.describe=`${i.id} or a criterion of ${l?.label??i.parent?.id??`its ${o.one("story")}`}`,a.against=l?.label??i.parent?.id??`its ${o.one("story")}`}else if(n==="epic"){for(let c of Uh(t,i,"story")){s.set(c.id,c.title??c.id);for(let l of Td(e,c,ii(e,c)))s.set(l.id,l.text)}a.describe=`${o.a("story")} under ${i.id} or one of their criteria`,a.against=`the latest version of each ${o.one("story")} under ${i.id}`}else{for(let l of Uh(t,i,"epic"))s.set(l.id,l.title??l.id);let c=RO(e,i,r.parent?.version);for(let l of Td(e,i,c))s.set(l.id,l.text),a.informational.push({id:l.id,text:l.text});a.describe=`${o.a("epic")} under ${i.id} or a goal of ${c?.label??i.id}`,a.against=c?.label??i.id}return a}function Kt(e,t,r=t.document){let i=We(te.type,e);return i.ok?Tn(r,i.value.template,Bt(t.id)):[]}function sk(e,t){let r=[];for(let i of t)for(let n of i.covers??[]){if(e.allowed.has(n))continue;let o=e.newer?.items.has(n)?e.newer:void 0,s=o?`${n} is in ${o.label}. Once v${o.version} is approved, save ${o.pinnedBy.id} with parent ${o.story.id}@v${o.version}.`:void 0;r.push({code:"covers-unknown",path:e.plan.path,message:`${e.plan.path}: ${i.id} covers ${n}, which is not ${e.describe}.`,remedy:s??`Correct the covers line of ${i.id}, then save the plan again.`})}return r}function qh(e,t){let r=new Map(e.map(i=>[i.id,[]]));for(let i of t)for(let n of i.covers??[])r.get(n)?.push(i.id);return r}function Fh(e,t){let r=qh(e.required,t);return e.required.filter(i=>(r.get(i.id)??[]).length===0)}function lK(e,t){return Fh(e,t).map(r=>({code:"coverage-gap",path:e.plan.path,message:`${r.id} is not covered by any test case in ${e.plan.id}: "${r.text}"`,remedy:CO(e.plan.id,e.owner.id,r,`add a test case to ${e.plan.id} with "covers: [${r.id}]", then save the plan again`)}))}function CO(e,t,r,i){return r.addedIn===void 0?`${i.charAt(0).toUpperCase()}${i.slice(1)}.`:`${r.id} was added in ${t} v${r.addedIn}. Save ${e} with parent ${t}@v${r.addedIn} and a test case that covers it, then approve the new version.`}var aK=(e,t)=>({id:e.id,title:e.title??"regression test",covers:[],plan:e.id,version:null,own:t,regression:!0}),AO=(e,t,r)=>[...t.artifacts.values()].filter(i=>i.type==="bug"&&i.parent?.id===r.id&&Ke(e,i,null)!==null);function tye(e,t,r){let i=Pc(e).get(r),n=i?t.artifacts.get(i.slice(0,i.lastIndexOf("-"))):void 0;return n?uo(e,t,n.id).find(o=>o.id===i):void 0}function uo(e,t,r){let i=t.artifacts.get(r);if(!i)return[];if(i.type==="bug"){let a=i.document.frontmatter.testCase,c=typeof a=="string"&&i.parent?uo(e,t,i.parent.id).find(l=>l.id===a)??tye(e,t,a):void 0;return[aK(i,!0),...c?[{...c,own:!1}]:[]]}let n=i.type==="task"&&i.parent?t.artifacts.get(i.parent.id):void 0,o=[i,...n?[n]:[]],s=[];for(let a of o){let c=a===i,l=t.artifacts.get(`${a.id}${te.idSuffix}`),u=l?ii(e,l):null;if(l&&u)for(let d of Kt(e,l,u.document))s.push({id:d.id,title:d.text,covers:d.covers??[],plan:l.id,version:u.version,own:c});for(let d of AO(e,t,a))s.push(aK(d,c))}return s}function Vo(e,t,r){let i=[],n=(s,a,c)=>i.push({code:s,path:r.path,message:`${r.path}: ${a}`,...c?{remedy:c}:{}});for(let[s,a]of Object.entries(t.fields)){let c=e.frontmatter[s];if(c==null||c===""||Array.isArray(c)&&c.length===0){a.required&&n("field-missing",`the ${s} field is required.`);continue}a.type==="text"&&typeof c!="string"&&typeof c!="number"?n("field-malformed",`the ${s} field must be a line of text.`):a.type==="list"&&!(Array.isArray(c)&&c.every(u=>typeof u=="string"))?n("field-malformed",`the ${s} field must be a list, such as [src/reset/, src/email/].`):a.type==="boolean"&&typeof c!="boolean"?n("field-malformed",`the ${s} field must be true or false.`):a.type==="link"&&!(typeof c=="string"&&Pn(c))&&n("field-malformed",`the ${s} field must be an artifact ID such as EP-01@v1, not ${JSON.stringify(c)}.`)}let o=new Map;for(let s of e.sections){let a=s.name.trim().toLowerCase();o.set(a,[...o.get(a)??[],s])}for(let[s,a]of Object.entries(t.sections)){let c=o.get(s.toLowerCase())??[];c.length>1&&n("section-duplicate",`the "${s}" section appears ${c.length} times.`);let l=c[0],u=a.byRule?"; the spec tree's rules require it":"";if(!l){a.required&&n(a.byRule?"rule-section-missing":"section-missing",`the "${s}" section is missing${u}.`,`Add a "## ${s}" section.`);continue}if(H_(l.body)){a.required&&n(a.byRule?"rule-section-empty":"section-empty",`the "${s}" section is empty${u}.`);continue}if(!a.items)continue;let d=a.items.children,p=qo(l.body,a.items.style,{nested:d!==void 0}),f=r.offlineIds?nye:rye,m=new RegExp(`^${uK(r.itemOwner)}-${a.items.prefix}${f}$`),h=`${r.itemOwner}-${a.items.prefix}1`;p.length===0&&a.required&&n("section-empty",`the "${s}" section has no entries. Each entry starts with its ID, such as ${h}.`);let g=new Set;for(let y of p){if(!y.id||!m.test(y.id)){n("item-malformed",`in "${s}", "${y.raw.split(`
267
+ `)[0]?.trim()}" does not start with an ID such as ${h}.`);continue}if(g.has(y.id)&&n("item-duplicate",`in "${s}", ${y.id} is used twice.`),g.add(y.id),a.items.covers==="required"&&(y.covers===null||y.covers.length===0)&&n("covers-missing",`${y.id} does not say what it covers.`,'Add a line such as "covers: [US-001-AC1]" under it.'),!d)continue;let v=new RegExp(`^${uK(y.id)}-${d.prefix}${f}$`),b=`${y.id}-${d.prefix}1`;for(let _ of y.children??[]){if(!_.id||!v.test(_.id)){n("item-malformed",`in "${s}", "${_.raw.split(`
268
+ `)[0]?.trim()}" under ${y.id} does not start with an ID such as ${b}.`);continue}g.has(_.id)&&n("item-duplicate",`in "${s}", ${_.id} is used twice.`),g.add(_.id)}}}return i}var rye="([1-9][0-9]*)",nye="([1-9][0-9]*|(?=[0-9a-z]*[a-z])[0-9a-z]{4})",uK=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var Cc=e=>e.type===te.type?Bt(e.id):e.id;function oa(e,t,r,i){let n=i.template,o=Cc(r),s=Vo(r.document,n,{itemOwner:o,path:r.path}),a=dt(e,r).flatMap(c=>{let l=an(e,r,c);return l?[{version:c,items:Tn(l.document,n,o)}]:[]});s.push(...WB(a,Tn(r.document,n,o),r.path,o));for(let c of ra){let{ids:l,invalid:u}=na(r.document.frontmatter,c),d=c==="related"?"related: [EP-01]":"changes: [EP-01-DD]";for(let p of u)s.push({code:"link-malformed",path:r.path,message:`${r.path}: ${c} must list artifact IDs, such as ${d}, not ${JSON.stringify(p)}.`});for(let p of l)p===r.id?s.push({code:"link-unknown",path:r.path,message:`${r.path}: ${r.id} names itself in ${c}.`}):t.artifacts.has(p)||s.push({code:"link-unknown",path:r.path,message:`${r.path}: ${c} names ${p}, which does not exist.`})}if(r.owner!==void 0&&r.document.frontmatter.id!==void 0){let c=r.type===te.type?"a test plan":"an attached document";s.push({code:"plan-has-id",path:r.path,message:`${r.path}: ${c} has no id field; ${r.id} is named after the artifact it ${r.type===te.type?"tests":"belongs to"}.`,remedy:`Remove the id line, keeping parent, and save the ${r.type===te.type?"plan":"document"} again.`})}if(r.type===te.type){let c=ia(e,t,r);if(c){let l=Kt(e,r);s.push(...sk(c,l),...lK(c,l))}}return s}function dK(e,t,r){let i=Cc(t),n=[t.document,...dt(e,t).flatMap(s=>an(e,t,s)?.document??[])],o=nk(n,r.template,i);return _c(r.template).map(({prefix:s})=>`${i}-${s}${(o.get(s)??0)+1}`)}import{existsSync as iye,readdirSync as oye,readFileSync as sye}from"node:fs";import{join as pK}from"node:path";var Rn="@v0";function br(e){let t=e.trim();return t.endsWith(Rn)?{id:t.slice(0,-Rn.length),v0:!0}:{id:t,v0:!1}}function Ac(e){if(!e.onboard)return null;let{document:t,path:r}=e.onboard,i=typeof t.frontmatter.parent=="string"?Pn(t.frontmatter.parent):null,n=t.frontmatter.title;return{id:e.id,type:e.type,path:r,document:t,onboard:e.onboard,...typeof n=="string"?{title:n}:{},...i?{parent:i}:{},...e.owner!==void 0?{owner:e.owner}:{}}}function ak(e,t){if(t.path!==t.onboard?.path)return t.path;let r=t.owner!==void 0?Tt(e).documents.find(i=>i.type===t.type)?.file:B(e).types.find(i=>i.type===t.type)?.file;return`${Ae(t)}/${r??`${t.type}.md`}`}function Ec(e,t){return Object.entries(t.sections).filter(([,r])=>r.required).map(([r])=>r).filter(r=>{let i=e.sections.find(n=>n.name.trim().toLowerCase()===r.toLowerCase());return!i||H_(i.body)})}function sa(e,t){let r=pK(e,t,to);return iye(r)?oye(r,{withFileTypes:!0}).filter(i=>i.isFile()&&!i.name.startsWith(".")).map(i=>i.name).sort():[]}function fK(e,t){return Object.fromEntries(sa(e,t).map(r=>[r,Ft(sye(pK(e,t,to,r),"utf8"))]))}function mK(e){return Object.fromEntries(e.repos.flatMap(t=>t.baseline?[[t.name,t.baseline]]:[]))}function ck(e,t){let r=dt(e,t);if(!r.includes(0))return null;let i=Fn(e,t,0);return i?{by:i.approvedBy.replace(/\s*<[^>]*>\s*$/,"")||i.approvedBy,on:i.approvedAt.slice(0,10),sources:Object.keys(i.sources??{}),empty:i.empty??[],inForce:r.at(-1)===0}:null}function hK(e,t){let r=ck(e,t);return r?.inForce?`code as it was before BuildKeel, reviewed by ${r.by} on ${r.on}`:null}function Pd(e){let t=e.frontmatter.scope;return typeof t=="string"?t.trim()?[t.trim()]:[]:Array.isArray(t)?t.filter(r=>typeof r=="string"&&r.trim()!=="").map(r=>r.trim()):[]}function aa(e){let t=e.document.frontmatter.completes;return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function gK(e,t){if(t.document.frontmatter.completes===void 0)return[];let r=aa(t),i=se(e,t),n=`Remove the completes field from ${t.id}, and save it again with save_draft (id ${t.id}).`;return r===null?[{id:"completes",passed:!1,message:`${t.id} has completes ${JSON.stringify(t.document.frontmatter.completes)}, which is not a version number such as 1.`,remedy:n}]:i.onboarded?r!==i.approvedVersion?[{id:"completes",passed:!1,message:`${t.id} says it completes v${r}, but v${i.approvedVersion} is in force.`,remedy:`If this version only completes v${i.approvedVersion} with what version 0 describes, set completes to ${i.approvedVersion}; if it changes behavior, remove the completes field. Then save it again with save_draft (id ${t.id}).`}]:[]:[{id:"completes",passed:!1,about:t.id,message:`${t.id} says it completes v${r}, but it has no approved version 0: a version only completes another with what version 0 describes, or fills in what version 0 left empty.`,remedy:`Approve ${t.id}${Rn} first, or ${n.charAt(0).toLowerCase()}${n.slice(1)}`}]}var vK=Lt(Vt(),1);import{existsSync as aye,readFileSync as cye}from"node:fs";import{join as yK}from"node:path";function lye(e){let t=n=>n.trim().replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"").slice(0,60),r=t(e.source).toLowerCase()||"source",i=t(e.key??"")||t(e.title??"").toLowerCase();return`${r}${i?`-${i}`:""}.md`}function $K(e,t,r,i,n){let o=[],s=[];for(let a of i){if(!a.source.trim())return w({code:"source-unnamed",message:"Each source needs a name for where it came from, such as Jira or Confluence."});let c=`${r}/${to}/${lye(a)}`;if(a.drop){if(!aye(yK(t,c)))return w({code:"source-not-found",message:`There is no kept source ${c} to drop.`});let p=e.remove(c);if(!p.ok)return p;s.push(c);continue}if(a.text===void 0||a.text.trim()==="")return w({code:"source-empty",message:`The source ${a.source}${a.key?` ${a.key}`:""} has no text. Keep what was read, exactly as it was read.`});let l={source:a.source.trim(),...a.key?{key:a.key.trim()}:{},...a.title?{title:a.title.trim()}:{},...a.link?{link:a.link.trim()}:{},readAt:n.readAt,readBy:n.readBy},u=a.text.endsWith(`
269
+ `)?a.text:`${a.text}
270
+ `,d=e.writeFile(c,`---
271
+ ${(0,vK.stringify)(l,{lineWidth:0})}---
272
+
273
+ ${u}`);if(!d.ok)return d;o.push(c)}return T({written:o,dropped:s})}function Rd(e,t){return sa(e,t).map(r=>{let i=oe(cye(yK(e,t,to,r),"utf8")),n=i.ok?i.value.frontmatter:{},o=u=>typeof n[u]=="string"||typeof n[u]=="number"?String(n[u]):void 0,s=o("source")??r.replace(/\.md$/,""),a=o("key"),c=o("link"),l=o("title");return{file:r,source:s,...a?{key:a}:{},...c?{link:c}:{},...l?{title:l}:{}}})}var EO="Sources";function lk(e,t){let r=e.frontmatterBlock.includes(`\r
274
+ `)?`\r
275
+ `:`
276
+ `,i=e.sections.filter(a=>a.name.trim().toLowerCase()!==EO.toLowerCase());if(t.length===0)return{...e,sections:i};let n=i.at(-1);n&&!n.body.endsWith(`${r}${r}`)&&(i[i.length-1]={...n,body:n.body.endsWith(r)?`${n.body}${r}`:`${n.body}${r}${r}`});let o=a=>`- ${[a.source,a.key,a.title?`"${a.title}"`:void 0].filter(Boolean).join(" ")}${a.link?`: ${a.link}`:""} (${to}/${a.file})`,s={name:EO,headingLine:`## ${EO}${r}`,body:`${r}Kept as read, beside this version 0. Written by BuildKeel.${r}${r}${t.map(o).join(r)}${r}`};return{...e,preamble:e.sections.length===0&&!e.preamble.endsWith(r)?`${e.preamble}${r}`:e.preamble,sections:[...i,s]}}import{existsSync as R$e}from"node:fs";import{join as C$e}from"node:path";function Zh(e,t,r){let i=ve(e,t);if(!i)return null;let n=i.document.frontmatter.repo;if(typeof n=="string"&&n.trim()!==""&&n.trim()!==r)return null;let o=Pd(i.document).map(co);return o.length>0?{record:t,version:i.version,paths:o}:null}function Vh(e,t,r,i){let n=[],o=[];for(let a of t.artifacts.values()){if(a.owner!==void 0)continue;let c=Zh(e,a,i);if(c&&n.push(c),!mr.includes(a.type))continue;let l=Cd(e,t,r,a.id).repos.find(u=>u.repo===i);l&&l.files.length>0&&o.push({record:a,commits:l.commits,files:new Set(l.files)})}let s=(a,c)=>a.record.id.localeCompare(c.record.id,"en",{numeric:!0});return{repo:i,scopes:n.sort(s),units:o.sort(s),changes:uye(e,t,r,i)}}function uye(e,t,r,i){if(!B(e).conversion)return[];let n=Pc(e),o=[];for(let s of ir(e).filter(a=>a.state==="archived")){let a=[],c=new Set;for(let l of r.repos.find(u=>u.name===i)?.units.get(s.id)??[]){a.push({id:l.id,subject:l.subject,by:l.by});for(let u of l.files)c.add(u)}for(let{record:l}of Ri(e,s.id).completions)if(l.repo===i){for(let u of l.commits)a.some(d=>d.id===u.id)||a.push(u);for(let u of l.files)c.add(u)}c.size>0&&o.push({change:s.id,...s.title?{title:s.title}:{},commits:a,files:c,became:iK(e,t,s.id,n)})}return o}function bK(e,t){let r=e.scopes.flatMap(i=>{let n=i.paths.filter(o=>ao(t,[o]));return n.length>0?[{...i,covering:n}]:[]});return{file:t,scopes:r,units:e.units.filter(i=>i.files.has(t)),changes:e.changes.filter(i=>i.files.has(t))}}var OO=(e,t)=>e.scopes.some(r=>ao(t,r.paths))||e.units.some(r=>r.files.has(t))||e.changes.some(r=>r.files.has(t));import{existsSync as wK}from"node:fs";import{dirname as dye,join as _K,resolve as pye}from"node:path";var cr=".buildkeel.yaml";function Bh(e){let t=pye(e);for(;;){if(wK(_K(t,cr)))return t;if(wK(_K(t,".git")))return null;let r=dye(t);if(r===t)return null;t=r}}var Ad=Lt(Vt(),1);import{existsSync as SK,readdirSync as fye,readFileSync as mye}from"node:fs";import{join as NO}from"node:path";var jO="matches",hye=(e,t)=>`${Ae(e)}/${jO}/${t}.yaml`,gye=$.object({testCase:$.string().min(1),tests:$.array($.string().min(1)).min(1),matchedBy:$.string().min(1),matchedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})});function xK(e){return(0,Ad.stringify)({testCase:e.testCase,tests:e.tests,matchedBy:e.matchedBy,matchedAt:e.matchedAt},{lineWidth:0})}function yye(e,t){let r;try{r=(0,Ad.parse)(e)}catch(n){let o=n instanceof Ad.YAMLParseError?n.message.split(`
277
+ `)[0]:String(n);return w({code:"match-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=gye.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"match-invalid"))}function Ai(e,t){let r=new Map,i=[];for(let n of t.artifacts.values()){if(n.type!==te.type)continue;let o=NO(e,Ae(n),jO);if(!SK(o))continue;let s=ii(e,n),a=new Set(s?Kt(e,n,s.document).map(c=>c.id):[]);for(let c of fye(o).filter(l=>l.endsWith(".yaml")).sort()){let l=`${Ae(n)}/${jO}/${c}`,u=yye(mye(NO(e,l),"utf8"),l);if(!u.ok){i.push(...u.problems);continue}let{testCase:d}=u.value;if(c!==`${d}.yaml`||!a.has(d)){i.push({code:"match-unknown-case",path:l,message:`${l} matches tests to ${d}, which is not a test case of ${n.id}${c!==`${d}.yaml`?` (and the file is not named ${d}.yaml)`:""}.`,remedy:`Match the tests again to a test case of ${n.id}, or remove ${l}.`});continue}r.set(d,{path:l,plan:n.id,match:u.value})}}return{matches:r,problems:i}}function vye(e,t,r){for(let i of t.artifacts.values()){if(i.type!==te.type)continue;let n=ii(e,i);if(n&&Kt(e,i,n.document).some(o=>o.id===r))return i}return null}function IK(e,t){let r=vye(e.root,e.index,t.testCase);if(!r)return w({code:"match-unknown-case",message:`There is no test case ${t.testCase} in any test plan.`});let i=[...new Set(t.tests.map(s=>s.trim()).filter(Boolean))],n=hye(r,t.testCase);if(i.length===0){if(!SK(NO(e.root,n)))return w({code:"match-not-found",message:`${t.testCase} has no recorded match to drop.`});let s=e.writer.remove(n);if(!s.ok)return s}else{let s=e.writer.writeFile(n,xK({testCase:t.testCase,tests:i,matchedBy:t.by,matchedAt:t.at}));if(!s.ok)return s}let o=Me(e.root,[n],`match: ${t.testCase}${i.length===0?" dropped":""}`);return T({testCase:t.testCase,path:n,tests:i,commit:o})}var $ye=e=>e.replace(/\s*\[[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+\]/g,"").trim(),kK=e=>e.includes(" > ")?e.slice(0,e.indexOf(" > ")):null;function TK(e,t,r){let{matches:i}=Ai(e.root,e.index),n=new Set(r),o=[],s=[];for(let a of t){let c=i.get(a.id),l=a.tests.filter(h=>h.includes(`[${a.id}]`));if(!c||l.length===0)continue;let u=new Set(l.map($ye)),d=new Set(l.map(kK)),p=c.match.tests.filter(h=>u.has(h)||!n.has(h)&&d.has(kK(h)));if(p.length===0)continue;let f=c.match.tests.filter(h=>!p.includes(h)),m=f.length===0?e.writer.remove(c.path):e.writer.writeFile(c.path,xK({...c.match,tests:f}));if(!m.ok)return m;o.push({testCase:a.id,tests:p,path:c.path}),s.push(c.path)}return T({dropped:o,paths:s})}import{readFileSync as S$e}from"node:fs";import{join as x$e}from"node:path";import{existsSync as bye,readFileSync as PK,writeFileSync as wye}from"node:fs";import{join as zO}from"node:path";var po=".buildkeel",DO="hook-cache.json",_ye="context.md",MO=e=>zO(e,po,_ye);function LO(e){return zO(e,po,DO)}function _e(e){try{return JSON.parse(PK(LO(e),"utf8"))}catch{return null}}var kye=`${po}/`;function RK(e){let t=zO(e,".gitignore"),r=bye(t)?PK(t,"utf8"):"";if(r.split(/\r?\n/).some(s=>["/.buildkeel/",".buildkeel/","/.buildkeel",".buildkeel"].includes(s.trim())))return!1;let n=r.includes(`\r
278
+ `)?`\r
279
+ `:`
280
+ `,o=r===""||r.endsWith(`
281
+ `)?"":n;return wye(t,`${r}${o}${kye}${n}`),!0}import{randomBytes as Sye}from"node:crypto";import{mkdirSync as xye,renameSync as Iye,rmSync as Tye,writeFileSync as Pye}from"node:fs";import{dirname as CK,join as Rye}from"node:path";var UO=e=>Rye(CK(e),`.${Sye(6).toString("hex")}.bk-tmp`);function Nr(e,t,r){xye(CK(e),{recursive:!0});let i=UO(e);try{Pye(i,t,{flag:"wx",...r!==void 0?{mode:r}:{}}),Iye(i,e)}catch(n){throw Tye(i,{force:!0}),n}}var Cye=/\[([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)\]/g;function AK(e){return[...new Set([...`${e.name} ${e.classname}`.matchAll(Cye)].map(t=>t[1]))]}var uk=e=>e.classname&&!e.name.includes(e.classname)?`${e.classname} > ${e.name}`:e.name,Aye={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function Eye(e){return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi,(t,r)=>r.startsWith("#x")||r.startsWith("#X")?String.fromCodePoint(parseInt(r.slice(2),16)):r.startsWith("#")?String.fromCodePoint(Number(r.slice(1))):Aye[r]??t)}function*Oye(e){let t=0,r=(i,n)=>{let o=e.indexOf(i,n);return o<0?e.length:o+i.length};for(;(t=e.indexOf("<",t))>=0;)if(e.startsWith("<!--",t))t=r("-->",t+4);else if(e.startsWith("<![CDATA[",t))t=r("]]>",t+9);else if(e.startsWith("<?",t))t=r("?>",t+2);else if(e.startsWith("<!",t)){let i=0,n=t+2;for(;n<e.length;n++){let o=e[n];if(o==="[")i++;else if(o==="]")i--;else if(o===">"&&i<=0)break}t=n+1}else{let i=t+1,n=null;for(;i<e.length;i++){let u=e[i];if(n)u===n&&(n=null);else if(u==='"'||u==="'")n=u;else if(u===">")break}if(i>=e.length)throw new Error("a tag is not closed");let o=e.slice(t+1,i).trim();if(t=i+1,o.startsWith("/")){yield{kind:"close",name:o.slice(1).trim(),attrs:{}};continue}let s=o.endsWith("/"),a=s?o.slice(0,-1):o,c=/^[^\s/>]+/.exec(a)?.[0]??"",l={};for(let u of a.slice(c.length).matchAll(/([^\s=]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g))l[u[1]]=Eye(u[2]??u[3]??"");yield{kind:s?"empty":"open",name:c,attrs:l}}}var Nye=e=>e.slice(e.indexOf(":")+1);function EK(e,t){let r=[],i=null,n=!1;try{for(let o of Oye(e)){let s=Nye(o.name);if((s==="testsuites"||s==="testsuite")&&(n=!0),o.kind==="close"){s==="testcase"&&i&&(r.push(i),i=null);continue}if(s==="testcase"){let a={name:o.attrs.name??"",classname:o.attrs.classname??o.attrs.class??"",outcome:"passed"};o.kind==="empty"?r.push(a):i=a}else i&&(s==="failure"||s==="error")?i.outcome="failed":i&&s==="skipped"&&i.outcome!=="failed"&&(i.outcome="skipped")}}catch(o){return w({code:"report-unreadable",path:t,message:`${t} is not valid XML: ${o.message}.`})}return i&&r.push(i),n?T(r):w({code:"report-not-junit",path:t,message:`${t} is not a JUnit XML report: it has no testsuite element.`,remedy:"Run the tests with a JUnit XML reporter, such as --reporter=junit for Vitest or --junitxml for pytest, and pass that file."})}import{existsSync as ng,readdirSync as J9,readFileSync as G9}from"node:fs";import{join as ji}from"node:path";var pk=Lt(Vt(),1);var NK="ids.yaml",dk=2e4,OK=10;function Ed(e,t){let r=Qs(e),i=ek(e)?.split("/")[0],n=i&&r.includes(i)?i:r.includes("origin")?"origin":r[0]??null;return{repo:e,branch:t,remote:n}}function FO(e){let t=e?(0,pk.parse)(e):null;return{last:{...t?.last??{}},assigned:{...t?.assigned??{}}}}function jye(e){return`# BuildKeel number counters. Written by BuildKeel when artifacts are approved; do not edit.
282
+ ${(0,pk.stringify)(e)}`}var Oc=e=>e.remote?`refs/remotes/${e.remote}/${e.branch}`:`refs/heads/${e.branch}`;async function Kh(e,t){let r=await ZO(e,[t]);return r.ok?T(r.value[0]):r}async function ZO(e,t,r=[]){if(t.length===0&&r.length===0)return T([]);for(let i=0;i<OK;i++){let n=await zye(e);if(!n.ok)return n;let o=FO(n.value?await VO(e.repo,n.value):null),s=[],a=[];for(let p of t){let f=o.assigned[p.draftId];if(f){s.push(f);continue}let m=Math.max(o.last[p.type]??0,p.floor)+1,h=p.format(m);o.last[p.type]=m,o.assigned[p.draftId]=h,s.push(h),a.push({id:h,draftId:p.draftId})}let c=[];for(let p of r){let f=o.assigned[p.owner]??p.owner,m=o.assigned[p.key];if(m!==f){if(m)return w({code:"claim-taken",message:`${p.key} is already held by ${m}.`});o.assigned[p.key]=f,c.push(p.key)}}if(a.length===0&&c.length===0)return T(s);let l=a.length===1&&c.length===0?`Reserve ${a[0]?.id} for ${a[0]?.draftId}`:`Reserve ${[...a.map(p=>p.id),...c].join(", ")}`,u=await Dye(e.repo,jye(o),n.value,l);if(!u.ok)return u;let d=await Mye(e,u.value,n.value);if(!d.ok)return d;if(d.value)return T(s)}return w({code:"counter-busy",message:`The number counter kept changing under us after ${OK} tries.`})}async function jK(e,t){let r=await $r(e.repo,["rev-parse","--verify","--quiet",Oc(e)]);return r.code!==0?null:FO(await VO(e.repo,r.stdout)).assigned[t]??null}async function zK(e,t){let r=await $r(e.repo,["rev-parse","--verify","--quiet",Oc(e)]);return r.code!==0?0:FO(await VO(e.repo,r.stdout)).last[t]??0}var qO=(e,t)=>w({code:"counter-unreachable",message:`The number counter on ${e.remote} (branch ${e.branch}) could not be reached: ${t.split(`
283
+ `)[0]||"no reason given"}`});async function zye(e){if(!e.remote){let n=await $r(e.repo,["rev-parse","--verify","--quiet",Oc(e)]);return T(n.code===0?n.stdout:null)}let t=await $r(e.repo,["ls-remote","--heads",e.remote,`refs/heads/${e.branch}`],{timeoutMs:dk});if(t.code!==0)return qO(e,t.stderr);if(t.stdout==="")return T(null);let r=await $r(e.repo,["fetch","--quiet","--no-tags",e.remote,`+refs/heads/${e.branch}:${Oc(e)}`],{timeoutMs:dk});if(r.code!==0)return qO(e,r.stderr);let i=await $r(e.repo,["rev-parse","--verify","--quiet",Oc(e)]);return T(i.code===0?i.stdout:null)}async function VO(e,t){let r=await $r(e,["cat-file","-p",`${t}:${NK}`]);return r.code===0?r.stdout:null}async function Dye(e,t,r,i){let n=await $r(e,["hash-object","-w","--stdin"],{input:t}),o=n.code===0?await $r(e,["mktree"],{input:`100644 blob ${n.stdout} ${NK}
284
+ `}):n,s=o.code===0?await $r(e,["commit-tree",o.stdout,...r?["-p",r]:[],"-m",i]):o;return s.code!==0?w({code:"counter-write-failed",message:`Could not write the number counter: ${s.stderr}`}):T(s.stdout)}async function Mye(e,t,r){if(!e.remote){let s=await $r(e.repo,["update-ref",Oc(e),t,r??""]);return T(s.code===0)}let i=await $r(e.repo,["push","--quiet",e.remote,`${t}:refs/heads/${e.branch}`],{timeoutMs:dk});if(i.code===0)return await $r(e.repo,["update-ref",Oc(e),t]),T(!0);let n=await $r(e.repo,["ls-remote","--heads",e.remote,`refs/heads/${e.branch}`],{timeoutMs:dk});return n.code!==0?qO(e,n.stderr):(n.stdout.split(/\s/)[0]||null)!==r?T(!1):w({code:"counter-push-refused",message:`The remote ${e.remote} refused the number counter branch ${e.branch}: ${i.stderr.split(`
285
+ `)[0]}`,remedy:"Allow pushes to that branch, or set settings.idsBranch in buildkeel.yaml to a branch you may push to."})}import{randomBytes as rve}from"node:crypto";import{existsSync as WK,readdirSync as Gye,readFileSync as mk}from"node:fs";import{basename as Hye,dirname as fk,join as jc}from"node:path";function fo(e,t){let r=B(e.root);return r.mode==="spec-driven"&&t==="approve"&&r.conversion?.state==="in-progress"?r.conversion.process.ok?r.conversion.process.value.gates.approve:"block":r.mode==="spec-driven"?t!=="lock"?"off":r.process.ok?r.process.value.gates.lock:"block":r.process.ok?r.process.value.gates[t]:"block"}var DK="",MK="",LK="",Lye=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Uye=(e,t)=>new RegExp(`(?<![A-Za-z0-9-])${Lye(t)}(?![0-9])`).test(e);function qye(e,t,r){let i=[];for(let n of KO(e,{codeRoot:t.codeRoot,repo:t.repo},t.home)){if(!n.dir||!n.baseline)continue;let o=le(n.dir,["rev-parse","--verify","--quiet",`${n.baseline}^{commit}`]);if(!o)continue;let s=Ci(n.dir,e.root),a=r.flatMap(d=>["--grep",d]),c=le(n.dir,["-c","core.quotePath=false","log",o,"--no-merges","--no-renames","--fixed-strings",...a,`--format=${DK}%H${MK}%B${LK}`,"--name-only"]),l=[],u=new Set;for(let d of(c??"").split(DK)){let p=d.indexOf(LK);if(p<0)continue;let[f,m=""]=d.slice(0,p).split(MK);if(!(!f||!r.some(h=>Uye(m,h)))){l.push({id:f,subject:m.split(`
286
+ `)[0]?.trim()??""});for(let h of d.slice(p+1).split(`
287
+ `).map(g=>g.trim()).filter(Boolean))(!s||!h.startsWith(`${s}/`))&&u.add(h)}}l.length>0&&i.push({repo:n.name,commits:l,files:[...u].sort()})}return i}function Fye(e,t){return[...new Set(Rd(e,Ae(t)).flatMap(r=>r.key?[r.key]:[]))].sort()}function UK(e,t,r,i,n,o){let s=Fye(e.root,n);if(s.length===0)return null;let a=qye(e,i,s),c=[];for(let f=ve(e.root,n)?.parent;f;){let m=r.artifacts.get(f.id),h=m?ve(e.root,m):null;if(!m||!h||c.includes(`${m.id}@v${h.version}`))break;c.push(`${m.id}@v${h.version}`),f=h.parent}let l=a.length>0?a:[{repo:i.repo,commits:[],files:[]}],u=oo(o.approvedAt,o.approvedBy).replace(/\.yaml$/,""),d=[];for(let f of l){let m={unit:n.id,version:0,ancestors:c,repo:f.repo,onboarded:!0,keys:s,commits:f.commits.map(y=>({...y,by:"key"})),excluded:[],merged:null,files:f.files,tests:{ranAt:null,plans:[],cases:{}},finishedBy:o.approvedBy,finishedAt:o.approvedAt,host:i.host},h=hd(n,`${u}${l.length>1?`-${f.repo}`:""}.yaml`),g=t.createRecord(h,Gs(m));if(!g.ok)return{keys:s,records:d,commit:g};d.push({path:h,record:m})}let p=Me(e.root,d.map(f=>f.path),`done: ${n.id} v0 (onboarded)`);return{keys:s,records:d,commit:p}}var BO=e=>{let t=e.records.flatMap(i=>i.record.commits.map(n=>({...n,repo:i.record.repo})));if(t.length===0)return`No commit made before the baseline names ${e.keys.join(" or ")}, so it is recorded as done with no commits; the paths in its scope stand as its link to the code.`;let r=[...new Set(t.map(i=>i.repo))];return`${t.length===1?"1 commit":`${t.length} commits`} made before the baseline name ${e.keys.join(" or ")}, in ${r.join(" and ")}: ${t.map(i=>`${i.id.slice(0,7)} ${i.subject}`).join("; ")}. They count as its code.`};function WO(e,t){let r=new Map;for(let i of t){let n=e.artifacts.get(i),o=/^(.+)-[A-Z]{1,4}[1-9][0-9]*$/.exec(i)?.[1],s=n??(o?e.artifacts.get(o):void 0);if(!s)continue;let a=r.get(s.id)??{target:s,items:[]};a.items=n||a.items===null?null:[...a.items,i],r.set(s.id,a)}return[...r.values()]}function qK(e,t,r,i){let n=t.artifacts.get(Bt(r.id)),o=new Set([n?.id,n?.parent?.id]),s={};for(let a of Kt(e,r,i))for(let{target:c}of WO(t,a.covers??[])){let l=dt(e,c).at(-1);!o.has(c.id)&&l!==void 0&&(s[c.id]=l)}return Object.fromEntries(Object.entries(s).sort(([a],[c])=>a.localeCompare(c,"en",{numeric:!0})))}function FK({index:e,record:t,conformance:r,typeName:i,process:n,version0:o=!1}){let s=[],a=`Fix the draft and save it again with save_draft (id ${t.id}${o?", version 0":""}).`,c=Vye(e,t,i,n,a,o);s.push(...c.checks);for(let l of e.problems.filter(u=>u.path===t.path))s.push({id:"tree",passed:!1,message:l.message,remedy:l.remedy??a});for(let l of r){let u=l.code==="coverage-gap"?"coverage-gap":l.code==="covers-unknown"?"covers":l.code.startsWith("link-")?"link":"template";s.push({id:u,passed:!1,message:l.message,remedy:l.remedy??a})}return s.push(...Zye(e,t,i)),{checks:s,...c.parent?{parent:c.parent}:{}}}function Zye(e,t,r){return ra.flatMap(i=>na(t.document.frontmatter,i).ids.flatMap(n=>{let o=e.artifacts.get(n);if(!o||o.id===t.id)return[];let s=se(e.root,o);return s.state==="approved"?[]:[{id:"link-approved",passed:!1,about:o.id,message:`${t.id} names ${r(o.type)} ${o.id} in ${i}, but ${o.id} ${s.state==="pending"?"is waiting for its number":"is still a draft"}, so there is no version to link to.`,remedy:`Approve ${o.id} first with ${ee("approve")} ${o.id}.`}]}))}function Vye(e,t,r,i,n,o){let s=[],a=t.parent;if(!a)return{checks:s};let c=e.artifacts.get(a.id);if(!c)return s.push({id:"parent-exists",passed:!1,message:`The parent ${a.id} of ${t.id} does not exist.`,remedy:n}),{checks:s,parent:a};let l=GO(i,t,c);if(l)return s.push({id:"parent-stage",passed:!1,message:l.message,remedy:l.remedy??n}),{checks:s,parent:a};let u=r(c.type),d=se(e.root,c);if(d.state==="draft")return s.push({id:"parent-approved",passed:!1,about:c.id,message:`The parent ${u} ${c.id}${c.title?` "${c.title}"`:""} is still a draft.`,remedy:`Approve ${c.id} first with ${ee("approve")} ${c.id}.`}),{checks:s,parent:a};if(d.state==="pending")return s.push({id:"parent-approved",passed:!1,about:c.id,message:`The parent ${u} ${c.id} is approved, but its number is still pending.`,remedy:`Approve again when the spec repo's remote can be reached; ${c.id} gets its number first.`}),{checks:s,parent:a};let p=d.approvedVersion;return o&&a.version!==void 0&&dt(e.root,c).includes(a.version)?{checks:s,parent:a}:a.version!==void 0&&a.version!==p?(s.push({id:"parent-pinned",passed:!1,about:c.id,message:`${t.id} is pinned to ${Yt(a)}, but the current approved version of ${c.id} is v${p}.`,remedy:`Check ${t.id} against ${c.id} v${p}, then save it with parent ${c.id}@v${p}.`}),{checks:s,parent:a}):{checks:s,parent:{id:c.id,version:p}}}function GO(e,t,r){let i=Th(e,t.type);if(!i||r.type===i.type)return null;let n=sd(e),s=Th(e,i.type)?.type===r.type?`; if it has none yet, draft one under ${r.id} with ${ee("new")} ${i.name} ${r.id}`:"";return{code:"parent-stage",path:t.path,message:`${t.id} sits under ${r.id}, ${n.a(r.type)}, but in this process ${n.a(t.type)} sits under ${n.a(i.type)}.`,remedy:`Save ${t.id} with its parent set to the ${n.one(i.type)} it belongs to${s}.`}}import{readdirSync as Bye,readFileSync as Kye}from"node:fs";import{join as VK}from"node:path";var ZK=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Wye(e,t,r,i){let o=/^---[ \t]*\r?\n[\s\S]*?\r?\n---[ \t]*(\r?\n|$)/.exec(e)?.[0]??"",s=o.replace(new RegExp(`^(parent:[ \\t]*)${ZK(t)}([ \\t]*)$`,"m"),`$1${r}@v${i}$2`),a=new RegExp(`(?<![A-Za-z0-9-])${ZK(t)}(?![A-Za-z0-9])`,"g");return(s+e.slice(o.length)).replace(a,r)}function BK(e,t){return Bye(VK(e,t),{withFileTypes:!0}).flatMap(r=>r.isDirectory()?BK(e,`${t}/${r.name}`):[`${t}/${r.name}`])}function HO(e,t,r,i){let n=Ae(t),o=`${n.slice(0,n.lastIndexOf("/")+1)}${r}`,s=u=>u.startsWith(`${n}/`)?`${o}${u.slice(n.length)}`:u,a=BK(e.root,n).map(u=>({from:u,to:s(u)})),c=new Set([...e.artifacts.values()].flatMap(u=>[u.path,...u.onboard?[u.onboard.path]:[]])),l=[];for(let u of c){let d=Kye(VK(e.root,u),"utf8"),p=Wye(d,t.id,r,i);p!==d&&l.push({path:s(u),before:d,after:p})}return{from:t.id,to:r,dirFrom:n,dirTo:o,moved:a,rewrites:l}}function KK(e,t){let r=e.move(t.dirFrom,t.dirTo);if(!r.ok)return r;let i=[];for(let n of t.rewrites){let o=e.writeFile(n.path,n.after);if(!o.ok){for(let s of i)e.writeFile(s.path,s.before);return e.move(t.dirTo,t.dirFrom),w(...o.problems)}i.push(n)}return T(t)}var Jye=e=>(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z");function GK(e){if(!e.access.writable)return w(e.access.problem);let t=hr(e);if(!t.ok)return t;let r=kd(e.root);if(!r)return w({code:"approve-not-git",message:`The spec tree at ${e.root} is not in a git repository. Each approval is committed, so it needs one.`,remedy:"Run git init in the spec tree (or the repository holding it), then approve again."});let i=lt(e.root);if(!i)return w({code:"approve-no-identity",message:"Git has no name and email set for the spec repo, so the approver cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then approve again.'});let n;return T({process:t.value,repo:r,approver:i,location:()=>n??=Ed(e.root,e.config.settings.idsBranch)})}function Nc(e,t){let r=D_(e,t);return r?r.name:t==="bug"||t==="adhoc"?e[t].name:e.chain.find(i=>i.type===t)?.name??t}function Yye(e,t,r){let i={};for(let n of ra){let o=na(r.document.frontmatter,n).ids.flatMap(s=>{let a=t.artifacts.get(s),c=a?se(e,a).approvedVersion:null;return c!==null?[[s,c]]:[]});o.length>0&&(i[n]=Object.fromEntries(o))}return i}function YO(e,t,r=""){let i=new RegExp(`-${r}([0-9]+)$`),n=0;for(let o of e.artifacts.values()){if(o.type!==t||xc(o.id))continue;let s=i.exec(o.id)?.[1];s&&(n=Math.max(n,Number(s)))}return n}function HK(e,t,r,i){let n=e.chain.find(s=>s.type===r)??(r==="bug"&&i?e.bug:void 0);if(!n)return null;let o=i?e.onboardedLetter:"";return{key:i?`${r}:${o}`:r,floor:YO(t,r,o),format:s=>Ln(n,s,o)}}function JO(e,t,r,i,n=!1){let o=We(i.type,e.root);if(!o.ok)return o;let{checks:s,parent:a}=FK({index:r,record:i,conformance:n?[]:Od(e.root,i,oa(e.root,r,i,o.value)),typeName:l=>Nc(t,l),process:t,version0:n});n||s.push(...gK(e.root,i)),n&&s.push(...SB(i.id,i.document));let c=Xi("approve",fo(e,"approve"),s);return T({template:o.value,gate:c,...a?{parent:a}:{}})}var JK=e=>e.state==="draft"&&!e.onboardOnly||e.state==="approved"&&e.draftOpen;function YK(e){let t=hr(e);if(!t.ok)return t;let r=K(e.root),i=[];for(let n of r.artifacts.values()){if(n.type==="adhoc")continue;let o=se(e.root,n);if(o.state==="pending")continue;let s=o.onboardOpen?Ac(n):null;if(s){let c=JO(e,t.value,r,s,!0);c.ok&&i.push({record:s,version:0,target:o.onboardOnly?n.id:`${n.id}${Rn}`,gate:c.value.gate})}if(n.type==="bug"||!JK(o)||la(t.value,r,n))continue;let a=JO(e,t.value,r,n);a.ok&&i.push({record:n,version:(o.approvedVersion??0)+1,target:n.id,gate:a.value.gate})}return T(i.sort((n,o)=>n.record.id.localeCompare(o.record.id,"en",{numeric:!0})||n.version-o.version))}function Cn(e,t){let r=hr(e);return r.ok?Nc(r.value,t):t}async function ca(e,t){let r=GK(e.tree);if(!r.ok)return r;let{process:i,approver:n,location:o}=r.value,s=br(t.id),a=K(e.tree.root),c=a.artifacts.get(s.id);if(!c)return w({code:"approve-not-found",message:`There is no artifact ${s.id}.`});let l=se(e.tree.root,c),u=s.v0||l.onboardOnly;if(c.type==="adhoc"||c.type==="bug"&&!u)return w({code:"approve-not-approvable",message:`${s.id} is a ${Nc(i,c.type)}. Bugs and ad-hoc units are not approved.`});let d=!u&&la(i,a,c);if(d&&!t.recorded)return w({code:"approve-recorded-plan",message:`${s.id} is the test plan of a ${Nc(i,"task")}, which is recorded rather than approved: each save that changes it, once it passes its checks and its ${Nc(i,"task")} is approved, becomes its next version.`,remedy:`Nothing to approve. To change it, save it with save_draft (id ${s.id}). A team that wants task plans approved sets process.taskPlans to approve in buildkeel.yaml.`});if(l.state==="pending")return t.apply?T({kind:"assigned",pending:await hk(e)}):w({code:"approve-pending",message:`${s.id} is already approved; its number is pending until the number counter can be reached.`,remedy:"Call approve again with apply=true to try to assign it now."});if(u&&l.onboarded)return w({code:"approve-v0-exists",message:`${s.id} already has an approved version 0. An artifact has one version 0 at most.`,remedy:`To change what ${s.id} says, save the changes with save_draft (id ${s.id}); that opens its next version.`});if(u&&!l.onboardOpen)return w({code:"approve-no-v0-draft",message:`${s.id} has no draft of version 0 waiting.`,remedy:`Draft it with save_draft (id ${s.id}, version 0), then approve ${s.id}${Rn}.`});if(!u&&l.state==="approved"&&!l.draftOpen){let Oe=l.onboardOpen?` Its version 0 is waiting: approve ${s.id}${Rn}.`:"";return w({code:"approve-nothing-new",message:`${s.id} v${l.approvedVersion} is approved and no new version is open.${Oe}`,remedy:`To change it, save the changes with save_draft (id ${s.id}); that opens v${(l.approvedVersion??0)+1}, which is then approved the same way.`})}let p=t.apply?await hk(e):{assigned:[],problems:[]};p.assigned.length>0&&(a=K(e.tree.root));let f=a.artifacts.get(s.id)??c,m=u?Ac(f)??f:f,h=JO(e.tree,i,a,m,u);if(!h.ok)return h;let{template:g,parent:y}=h.value,v=t.first&&!t.apply?QZ(h.value.gate,t.first):h.value.gate,b=u?0:(l.approvedVersion??0)+1,_=Math.max(b,l.approvedVersion??0),k=Nc(i,m.type);if(v.outcome==="blocked")return T({kind:"refused",id:m.id,gate:v});let x=m.owner===void 0&&l.approvedVersion===null&&xc(m.id),S=HK(i,a,m.type,u);if(x&&!S)return w({code:"approve-no-stage",message:`The process has no ${m.type} stage, so ${m.id} cannot be numbered.`});let C=u?{sources:sa(e.tree.root,Ae(m)),empty:Ec(m.document,g.template)}:void 0;if(!t.apply){let Oe,M=[],me;if(x&&S){Oe=await jK(o(),m.id)??S.format(Math.max(await zK(o(),S.key),S.floor)+1);let xe=HO(a,m,Oe,b);me=xe.dirTo,M=xe.rewrites.map(Ot=>Ot.path).filter(Ot=>fk(Ot)!==xe.dirTo)}return T({kind:"preview",id:m.id,name:k,...m.title?{title:m.title}:{},version:b,...Oe?{likelyId:Oe}:{},...me?{dirTo:me}:{},references:M,...y?{parent:Yt(y)}:{},approver:n,autoPush:e.tree.config.settings.autoPush,gate:v,...C?{version0:C}:{},inForce:_})}let E=[],U=m.document;if(y&&y.version!==void 0&&m.parent?.version===void 0&&(U=sr(U,{parent:Yt(y)})),u&&(U=lk(U,Rd(e.tree.root,Ae(m)))),Gt(U)!==Gt(m.document)){let Oe=e.writer.writeFile(m.path,Gt(U));if(!Oe.ok)return Oe;E.push(m.path),a=K(e.tree.root)}let V=a.artifacts.get(m.id)??f,X=u?Ac(V)??m:V,J={approvedBy:n,approvedAt:Jye(e),...u?{onboarded:!0,baseline:mK(e.tree.config),sources:fK(e.tree.root,Ae(X)),empty:C?.empty??[]}:{template:{type:g.template.type,version:g.template.version,source:g.source,...g.org?{org:g.org}:{}},...aa(X)!==null?{completes:aa(X)}:{}},...y?{parent:Yt(y)}:{},...X.type===te.type?{pins:qK(e.tree.root,a,X,X.document)}:{},...Yye(e.tree.root,a,X),...d?{recorded:!0}:{}},it=null;if(x&&S){let Oe=await Kh(o(),{type:S.key,draftId:m.id,floor:S.floor,format:S.format});if(!Oe.ok)return Oe.problems.some(M=>M.code.startsWith("counter-"))?T(await Xye(e,X,b,J,E,Oe.problems,v,p)):Oe;it=Oe.value}let z=QK(e,a,X,b,J,it);if(!z.ok)return z;let pe=it??m.id,H=Me(e.tree.root,[...E,...z.value.paths],`${d?"record":"approve"}: ${pe} v${b}`),{pushed:fe,unpushed:kt}=H.ok?await e9(e):{pushed:null,unpushed:null},Qt=H.ok&&b===0?XK(e,pe,J):null,L=K(e.tree.root),Ve=[...L.artifacts.values()].filter(Oe=>Oe.owner===pe).filter(Oe=>{let M=se(e.tree.root,Oe);return M.state==="draft"||M.onboardOpen||M.state==="approved"&&M.draftOpen}).map(Oe=>({id:Oe.id,name:Nc(i,Oe.type)})).sort((Oe,M)=>Oe.id.localeCompare(M.id)),Ze=L.artifacts.get(pe),Ge=H.ok&&Ze?.type==="task"&&i.taskPlans==="record"?L.artifacts.get(`${pe}${te.idSuffix}`):void 0,yt=Ge?se(e.tree.root,Ge):null,lr=Ge&&(yt?.state==="draft"||yt?.draftOpen)?await ca(e,{id:Ge.id,apply:!0,recorded:!0}):null,pt=lr?.ok&&lr.value.kind==="approved"?{id:lr.value.id,version:lr.value.version,commit:lr.value.commit}:void 0;return T({kind:"approved",id:pe,version:b,...it?{draftId:m.id}:{},frozen:z.value.frozen,approval:z.value.approval,hash:z.value.hash,references:z.value.references,commit:H,push:fe,unpushed:kt,gate:v,documents:Ve,pending:p,...C?{version0:C}:{},inForce:_,nextOpen:Ze?JK(se(e.tree.root,Ze)):!1,...Qt?{onboardedWork:Qt}:{},...pt?{recordedPlan:pt}:{}})}function la(e,t,r){return e.taskPlans!=="record"||r.type!==te.type||r.owner===void 0?!1:t.artifacts.get(r.owner)?.type==="task"}function XK(e,t,r){if(!e.code)return null;let i=K(e.tree.root),n=i.artifacts.get(t);return!n||n.type!=="task"&&n.type!=="bug"?null:UK(e.tree,e.writer,i,e.code,n,r)}function QK(e,t,r,i,n,o){let s=r.path,a=[],c=[],l=Hye(ak(e.tree.root,r));if(o){let g=HO(t,r,o,i),y=KK(e.writer,g);if(!y.ok)return y;s=`${g.dirTo}${r.path.slice(g.dirFrom.length)}`,a.push(...g.moved.flatMap(v=>[v.from,v.to]),...g.rewrites.map(v=>v.path)),c=g.rewrites.map(v=>v.path).filter(v=>fk(v)!==fk(s))}let u=mk(jc(e.tree.root,s),"utf8"),d=fk(s),p=Ft(u),f={artifact:o??r.id,version:i,hash:p,...n,...o?{draftId:r.id}:{}},m=e.writer.createRecord(zo(d,i),u);if(!m.ok)return m;let h=e.writer.createRecord(Do(d,i),eO(f));if(!h.ok)return h;if(a.push(s,m.value,h.value),i===0){a.push(...sa(e.tree.root,d).map(v=>`${gc(d)}/${v}`));let g=`${d}/${l}`;if(!WK(jc(e.tree.root,g))){let v=e.writer.writeFile(g,u);if(!v.ok)return v;a.push(g)}let y=e.writer.remove(s);if(!y.ok)return y}return T({frozen:m.value,approval:h.value,hash:p,references:c,paths:a})}async function e9(e){return{pushed:e.tree.config.settings.autoPush?await In(e.tree.root):null,unpushed:tk(e.tree.root)}}async function Xye(e,t,r,i,n,o,s,a){let c=mk(jc(e.tree.root,t.path),"utf8"),l=xh(Ae(t),r),u=e.writer.createRecord(l,eO({artifact:t.id,version:r,hash:Ft(c),...i}));if(!u.ok)return{kind:"pending",draftId:t.id,version:r,record:l,reason:[...o,...u.problems],commit:u,gate:s,pending:a};let d=Me(e.tree.root,[...n,t.path,l],`approve: ${t.id} v${r} (number pending)`);return d.ok&&await e9(e),{kind:"pending",draftId:t.id,version:r,record:l,reason:o,commit:d,gate:s,pending:a}}function Qye(e,t){let r=Ae(t),n=(WK(jc(e,r,xi))?Gye(jc(e,r,xi)):[]).map(o=>Xu.exec(o)?.[1]).find(o=>o!==void 0);return n===void 0?null:{version:Number(n),path:xh(r,Number(n))}}async function hk(e){let t={assigned:[],problems:[]},r=null;for(;;){let i=K(e.tree.root),n=[...i.artifacts.values()].find(v=>se(e.tree.root,v).state==="pending"&&!t.problems.some(b=>b.path===v.path));if(!n||(r??=GK(e.tree),!r.ok))return t;let{process:o,location:s}=r.value,a=Qye(e.tree.root,n);if(!a)return t;let{version:c,path:l}=a,u=c===0?Ac(n)??n:n,d=yc(mk(jc(e.tree.root,l),"utf8"),l),p=mk(jc(e.tree.root,u.path),"utf8");if(!d.ok||d.value.hash!==Ft(p)){t.problems.push({code:"pending-altered",path:n.path,message:`${u.id} cannot be numbered: ${d.ok?`${u.path} was changed after it was approved`:`${l} cannot be read`}.`,remedy:`Restore ${u.path} from git history, then approve again.`});continue}let f=HK(o,i,u.type,c===0);if(!f){t.problems.push({code:"approve-no-stage",path:n.path,message:`The process has no ${u.type} stage, so ${u.id} cannot be numbered.`});continue}let m=await Kh(s(),{type:f.key,draftId:u.id,floor:f.floor,format:f.format});if(!m.ok)return t.problems.push(...m.problems),t;let h={...d.value};for(let v of["artifact","version","hash","draftId"])delete h[v];let g=QK(e,i,u,c,h,m.value);if(!g.ok){t.problems.push(...g.problems.map(v=>({...v,path:n.path})));continue}let y=Me(e.tree.root,[l,...g.value.paths],`approve: ${m.value} v${c}`);y.ok&&c===0&&XK(e,m.value,h),t.assigned.push({from:u.id,to:m.value,version:c,commit:y})}}var eve=["task","story"];function Nd(e,t,r,i={}){let n=typeof r.testCase=="string"&&r.testCase.trim()!==""?r.testCase.trim():void 0;if(B(e).mode==="spec-driven")return tve(e,r.parent,n);let o=Re(e);if(r.parent===void 0||r.parent===null||r.parent==="")return n?w({code:"bug-test-case-without-parent",message:`testCase ${n} names a test case, but the bug has no parent. A test case belongs to the unit where the bug was found.`,remedy:`Set parent to the ${o.one("task")} or ${o.one("story")} whose test case found the bug, or leave testCase out for a standalone bug.`}):T({});let s=typeof r.parent=="string"?Pn(r.parent):null;if(!s)return w({code:"bug-bad-parent",message:`parent ${JSON.stringify(r.parent)} is not an artifact ID such as TK-001.`});let a=t.artifacts.get(s.id);if(!a)return w({code:"bug-parent-not-found",message:`There is no artifact ${s.id} to attach the bug to.`});if(!eve.includes(a.type))return w({code:"bug-parent-type",message:`${s.id} is ${o.a(a.type)}. A bug is attached to the ${o.one("task")} or ${o.one("story")} where it was found.`,remedy:`Set parent to ${o.a("task")} or ${o.a("story")}, or leave it out for a standalone bug.`});let c=se(e,a);if(i.version0)return T({parent:s,...n?{testCase:n}:{}});if(c.state!=="approved")return w({code:"bug-parent-not-approved",message:`${s.id} is not approved, so no work on it can have found a bug.`,remedy:"Leave parent out to record a standalone bug, or record the problem in the draft itself."});let l={id:a.id,version:s.version??c.approvedVersion};if(n){let u=uo(e,t,a.id).map(d=>d.id);if(!u.includes(n))return w({code:"bug-test-case-unknown",message:`${n} is not a test case of ${Yt(l)}.`,remedy:u.length>0?`Use one of ${u.join(", ")}, or leave testCase out.`:`${a.id} has no test cases; leave testCase out.`})}return T({parent:l,...n?{testCase:n}:{}})}function tve(e,t,r){if(t==null||t==="")return r?w({code:"bug-test-case-without-parent",message:`testCase ${r} names a scenario, but the bug has no parent.`,remedy:"Set parent to the change whose work found the bug, or leave testCase out for a standalone bug."}):T({});let i=typeof t=="string"?Pn(t):null;if(!i)return w({code:"bug-bad-parent",message:`parent ${JSON.stringify(t)} is not a change ID such as CH-012.`});let n=Xt(e,i.id);return n==="missing"||n==="discarded"?w({code:"bug-parent-not-change",message:n==="missing"?`There is no change ${i.id} to attach the bug to.`:`${i.id} was discarded, so no work on it can have found a bug.`,remedy:"Set parent to the change whose work found the bug, or leave it out for a standalone bug."}):T({parent:{id:i.id},...r?{testCase:r}:{}})}function nve(e,t){return Wh(r=>`${t}-${r}`,r=>e.artifacts.has(r))}function Wh(e,t){for(;;){let r=BigInt(`0x${rve(5).toString("hex")}`).toString(36).slice(-4).padStart(4,"0"),i=e(r);if(/[a-z]/.test(r)&&!t(i))return i}}async function gk(e,t){let{tree:r}=e;if(!r.access.writable)return w(r.access.problem);let i=pB(r);if(!i.ok)return i;if(!kd(r.root))return w({code:"unit-not-git",message:`The spec tree at ${r.root} is not in a git repository, and a new ${i.value[t.type].name} is committed there.`,remedy:"Run git init in the spec tree (or the repository holding it), then try again."});let n=i.value[t.type],o=Si.find(S=>S.type===t.type);if(!o)return w({code:"unit-unknown-type",message:`There is no artifact type "${t.type}".`});let s=K(r.root),a=oe(t.content.replaceAll(jr,"PLACEHOLDER"));if(!a.ok)return a;let c=a.value.frontmatter,l={};if(t.type==="bug"){let S=Nd(r.root,s,c);if(!S.ok)return S;l=S.value}else if(c.parent!==void 0&&c.parent!==null){let S=/^[aeiou]/i.test(n.name)?"An":"A";return w({code:"unit-unexpected-parent",message:`${S} ${n.name} has no parent, but the file names ${String(c.parent)}.`,remedy:"Remove the parent line."})}let u=nve(s,n.prefix),d=await Kh(Ed(r.root,r.config.settings.idsBranch),{type:t.type,draftId:u,floor:YO(s,t.type),format:S=>Ln(n,S)});if(!d.ok&&!d.problems.some(S=>S.code.startsWith("counter-")))return d;let p=d.ok?d.value:u,f=`${o.dir}/${p}/${o.file}`,m=oe(t.content.replaceAll(jr,p),f);if(!m.ok)return m;let h={id:p};l.parent&&(h.parent=Yt(l.parent));let g=e.writer.writeFile(f,Gt(sr(m.value,h)));if(!g.ok)return g;let y=K(r.root),v=y.artifacts.get(p),b=We(t.type,r.root),_=b.ok?v?oa(r.root,y,v,b.value):[]:b.problems,k=Me(r.root,[f],`new: ${p}`),x=k.ok&&r.config.settings.autoPush?await In(r.root):null;return T({id:p,type:t.type,name:n.name,...v?.title?{title:v.title}:{},path:f,numbered:d.ok,offline:d.ok?[]:d.problems,attachment:l,notes:_,commit:k,push:x})}var Wd=Lt(Vt(),1);import{existsSync as B9,readdirSync as m$e,readFileSync as bN,rmSync as h$e}from"node:fs";import{join as Mc}from"node:path";import{mkdirSync as ive,renameSync as ove,writeFileSync as sve}from"node:fs";import{join as t9}from"node:path";function ave(e){return[...e.artifacts.values()].flatMap(t=>{let r=se(e.root,t);return r.state==="pending"?[t.path,...t.onboard?[t.onboard.path]:[]]:r.state==="approved"&&!r.draftOpen?[t.path]:[]}).sort()}function cve(e){return[...e.artifacts.values()].filter(t=>{let r=se(e.root,t);return r.onboarded||r.state==="pending"&&t.onboard!==void 0}).map(t=>gc(Ae(t))).sort()}function Gh(e,t,r=new Date){let i=_e(e),n=B(t.root).conversion?.state,o={...i,version:1,specRoot:t.root,lockedDirs:[...Hu],lockedFiles:ave(t),lockedSources:cve(t),activeUnit:i?.activeUnit??null,scope:i?.scope??[],lockMode:fo(t,"lock"),mode:B(t.root).mode,...B(t.root).mode==="spec-driven"||B(t.root).conversion?{archivedChanges:ir(t.root).filter(s=>s.state==="archived").map(s=>s.id)}:{},...n?{conversion:n}:{},stages:fO(t.root),stageExamples:mB(t.root),documents:Object.fromEntries(Tt(t.root).documents.map(s=>[s.dir,s.suffix])),updatedAt:r.toISOString()};return n||delete o.conversion,r9(e,o)?o:null}function wr(e,t,r=new Date){let i=_e(e);if(!i)return null;let n={...i,...t,updatedAt:r.toISOString()};return r9(e,n)?n:null}function r9(e,t){let r=t9(e,po);try{ive(r)}catch(n){let o=n.code;if(o==="ENOENT")return!1;if(o!=="EEXIST")throw n}let i=t9(r,`.${DO}.${process.pid}.tmp`);return sve(i,`${JSON.stringify(t,null,2)}
288
+ `),ove(i,LO(e)),!0}var Hh=Lt(Vt(),1);import{createHash as lve}from"node:crypto";import{existsSync as o9,mkdirSync as uve,readdirSync as dve,readFileSync as pve,realpathSync as XO,rmSync as s9,writeFileSync as n9}from"node:fs";import{join as eN}from"node:path";var i9=new Map;function jd(e){let t=i9.get(e);if(t===void 0)try{t=Rt(e,["remote","get-url","origin"]),i9.set(e,t)}catch{t=XO(e)}return lve("sha256").update(t).digest("hex").slice(0,16)}var zc=(e,t)=>eN(e,"claims",jd(t)),tN=(e,t)=>eN(e,`${t}.yaml`),rN=e=>o9(e.workingTree);function yk(e){try{let t=(0,Hh.parse)(pve(e,"utf8"));return typeof t?.unit=="string"&&typeof t.workingTree=="string"?t:null}catch{return null}}function gr(e,t,r){let i=yk(tN(zc(e,t),r));return i&&rN(i)?i:null}function zd(e,t){let r=zc(e,t);return o9(r)?dve(r).filter(i=>i.endsWith(".yaml")).map(i=>yk(eN(r,i))).filter(i=>i!==null&&rN(i)).sort((i,n)=>i.unit.localeCompare(n.unit,"en",{numeric:!0})):[]}var QO=(e,t)=>{try{return XO(e)===XO(t)}catch{return e===t}};function Dd(e,t,r,i){let n=gr(e,t,r);return n&&!QO(n.workingTree,i)?n:null}function nN(e,t,r,i=new Date){let n=zc(e,t);uve(n,{recursive:!0});let o=tN(n,r.unit),s={...r,claimedAt:i.toISOString().replace(/\.\d{3}Z$/,"Z")};for(let c=0;c<3;c++)try{return n9(o,(0,Hh.stringify)(s),{flag:"wx"}),{held:s,ours:!0}}catch(l){if(l.code!=="EEXIST")throw l;let u=yk(o);if(u&&rN(u)){if(!QO(u.workingTree,r.workingTree))return{held:u,ours:!1};let d={...u,branch:r.branch,host:r.host};return n9(o,(0,Hh.stringify)(d)),{held:d,ours:!0}}s9(o,{force:!0})}let a=yk(o);return a?{held:a,ours:QO(a.workingTree,r.workingTree)}:{held:s,ours:!1}}function Bo(e,t,r){s9(tN(zc(e,t),r),{force:!0})}function a9(e,t,r){let i=gr(e,t,r);if(!i)return null;Bo(e,t,r);let n=_e(i.workingTree)?.activeUnit===r;return n&&wr(i.workingTree,{activeUnit:null,activeBranch:null,scope:[]}),{claim:i,cleared:n}}import{existsSync as U9,readdirSync as l$e,readFileSync as q9}from"node:fs";import{join as rg}from"node:path";function vk(e){let{scenarios:t}=e;if(t.length===0)return[];let r=Jh(e.codeRoot,e.specRoot,t.map(o=>o.id)),i=e.state??mo(e.codeRoot,e.specRoot),n=Ei(e.codeRoot).cases;return t.map(o=>{let{requirement:s}=o,a={id:o.id,title:o.title,plan:s.capability,planVersion:s.version,own:e.own?e.own.has(s.id):!0},c=n[o.id],l=!c||c.tree===null||c.tree!==i.tree,u=!!c?.requirementHash&&c.requirementHash!==s.hash,d=!!c&&!l&&!u;if(!r.has(o.id)&&!d)return{...a,status:"no test",tests:[]};if(!c)return{...a,status:"not run",tests:[]};if(!d){let p=u?`${s.id} has changed since the tests ran`:"the code has changed since the tests ran";return{...a,status:"stale",tests:c.tests,detail:p}}return{...a,status:c.outcome,tests:c.tests}})}function iN(e,t){let r=[],i=new Set;for(let n of nr(e,t)){let o=bd(e,t,n);r.push(...zh(o.requirements));for(let s of o.own)i.add(s)}return{scenarios:r,own:i}}function $k(e){let{scenarios:t,own:r}=iN(e.root,e.change),i=vk({scenarios:t,own:r,codeRoot:e.codeRoot,specRoot:e.specRoot,...e.state?{state:e.state}:{}});return[...i.filter(n=>n.own),...i.filter(n=>!n.own)]}function c9(e){let t=[...wd(e.root,e.activeUnit??null).values()];return vk({scenarios:t,codeRoot:e.codeRoot,specRoot:e.specRoot,...e.state?{state:e.state}:{}})}var Md=Lt(Vt(),1);import{existsSync as l9,readFileSync as fve}from"node:fs";import{join as oN}from"node:path";var sN="closed.yaml",bk=["duplicate","cannot-reproduce","works-as-intended","wrong-test"],wk={duplicate:"a duplicate","cannot-reproduce":"cannot be reproduced","works-as-intended":"works as intended","wrong-test":"the test was wrong"},mve=$.object({bug:$.string().min(1),reason:$.enum(bk,{error:`must be one of ${bk.join(", ")}`}),duplicateOf:$.string().min(1).optional(),note:$.string().min(1).optional(),closedBy:$.string().min(1),closedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})}).superRefine((e,t)=>{e.reason==="duplicate"&&!e.duplicateOf&&t.addIssue({code:"custom",path:["duplicateOf"],message:"names the bug it duplicates, and is required for a duplicate"}),e.reason!=="duplicate"&&e.duplicateOf&&t.addIssue({code:"custom",path:["duplicateOf"],message:"is only for a duplicate"})}),oi=e=>`${Ae(e)}/${sN}`;function hve(e){let t={bug:e.bug,reason:e.reason,...e.duplicateOf?{duplicateOf:e.duplicateOf}:{},...e.note?{note:e.note}:{},closedBy:e.closedBy,closedAt:e.closedAt};return(0,Md.stringify)(t,{lineWidth:0})}function gve(e,t){let r;try{r=(0,Md.parse)(e)}catch(n){let o=n instanceof Md.YAMLParseError?n.message.split(`
289
+ `)[0]:String(n);return w({code:"closed-record-invalid",path:t,message:`${t} is not valid YAML: ${o}`})}let i=mve.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"closed-record-invalid"))}function Ko(e,t){if(t.type!=="bug")return null;let r=oi(t);return l9(oN(e,r))?gve(fve(oN(e,r),"utf8"),r):null}var Oi=(e,t)=>t.type==="bug"&&l9(oN(e,oi(t)));function Wo(e){let t=e.reason==="duplicate"?`as a duplicate of ${e.duplicateOf}`:`as ${wk[e.reason]}`;return`closed on ${e.closedAt.slice(0,10)} ${t}${e.note?` (${e.note})`:""}`}var aN=e=>`close: ${e.bug} (${e.reason==="duplicate"?`duplicate of ${e.duplicateOf}`:wk[e.reason]})`;function cN(e){let{tree:t,index:r,bugId:i}=e,n=t.root;if(!t.access.writable)return w(t.access.problem);let o=r.artifacts.get(i);if(!o)return w({code:"close-not-found",message:`There is no bug ${i}.`});if(o.type!=="bug")return w({code:"close-not-bug",message:`${i} is not a bug: only a bug can be closed without a fix.`});if(Oi(n,o))return w({code:"close-closed",path:oi(o),message:`${i} is already closed: ${oi(o)}.`});let s=Ke(n,o,null);if(s)return w({code:"close-finished",path:s.path,message:`${i} is finished already: ${s.path}. A finished bug is not closed; a defect that returns is a new bug.`});let a=gr(e.home,n,i);if(a&&a.workingTree!==e.codeRoot)return w({code:"close-claimed-elsewhere",message:`${i} is being worked on in another working tree on this machine: ${a.workingTree}.`,remedy:"Close it there, or release its claim first."});let c=e.note?.trim()||void 0,l;if(e.reason==="duplicate"){if(l=e.duplicateOf?.trim(),!l)return w({code:"close-duplicate-of",message:"Name the bug it duplicates, with duplicateOf."});let u=r.artifacts.get(l);if(!u||u.type!=="bug"||l===i)return w({code:"close-duplicate-of",message:`${l} is not another bug of this spec tree, so ${i} cannot be its duplicate.`})}return T({bug:o,reason:e.reason,...l?{duplicateOf:l}:{},...c?{note:c}:{},active:e.activeUnit===i,claimed:a!==null})}function u9(e){let t=cN(e);if(!t.ok)return t;let r=e.tree.root,i=lt(r);if(!i)return w({code:"close-no-identity",message:"Git has no name and email set for the spec repo, so who closed the bug cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com.'});let{bug:n,reason:o,duplicateOf:s,note:a}=t.value,c={bug:n.id,reason:o,...s?{duplicateOf:s}:{},...a?{note:a}:{},closedBy:i,closedAt:(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z")},l=oi(n),u=e.writer.createRecord(l,hve(c));if(!u.ok)return u;let d=Me(r,[l],aN(c));return t.value.claimed&&Bo(e.home,r,n.id),t.value.active&&wr(e.codeRoot,{activeUnit:null,activeBranch:null,scope:[]}),T({plan:t.value,record:c,path:l,commit:d})}var uN=e=>e.replace(/\s+/g," ").trim(),d9=e=>e?.raw.trim(),p9=e=>uN(e.raw.replace(/^\s*[-*+] +/,""));function f9(e,t){let r=Ht(e,t)?.body,i=r===void 0?"":Br(r).trim();return i===""?void 0:i}function m9(e){if(!(e==null||e===""||Array.isArray(e)&&e.length===0))return Array.isArray(e)?`[${e.map(String).join(", ")}]`:typeof e=="object"?JSON.stringify(e):String(e)}function lN(e,t,r,i){return{...e,change:t===void 0?"added":r===void 0?"removed":i?"unchanged":"changed",...t!==void 0?{before:t}:{},...r!==void 0?{after:r}:{}}}function yve(e,t,r,i){let n=[];for(let[a,c]of Object.entries(e.fields)){if(!c.tracked)continue;let[l,u]=[m9(r.frontmatter[a]),m9(i.frontmatter[a])];(l!==void 0||u!==void 0)&&n.push(lN({id:a,kind:"field"},l,u,JSON.stringify(r.frontmatter[a])===JSON.stringify(i.frontmatter[a])))}let o=Tn(r,e,t),s=Tn(i,e,t);for(let[a,c]of Object.entries(e.sections)){if(!c.tracked)continue;if(!c.items){let[m,h]=[f9(r,a),f9(i,a)];(m!==void 0||h!==void 0)&&n.push(lN({id:a,kind:"section"},m,h,uN(m??"")===uN(h??"")));continue}let l=m=>new Map(m.filter(h=>h.section===a).map(h=>[h.id,h])),[u,d]=[l(o),l(s)],p=[...new Set([...u.keys(),...d.keys()])],f=m=>(d.get(m)??u.get(m))?.number??0;for(let m of p.sort((h,g)=>f(h)-f(g))){let[h,g]=[u.get(m),d.get(m)];n.push(lN({id:m,kind:"entry",section:a},d9(h),d9(g),!!h&&!!g&&p9(h)===p9(g)))}}return n}function dN(e,t,r,i){let n=We(t.type,e);if(!n.ok)return n;let o=an(e,t,r),s=i===null?an(e,t):an(e,t,i),a=o?s?null:i:r;return!o||!s?w({code:"version-missing",message:`${t.id} v${a} cannot be read: its frozen copy is missing or is not a valid artifact file.`}):T({id:t.id,from:o.label,to:s.label,items:yve(n.value.template,Cc(t),o.document,s.document)})}function h9(e,t){let r=[],i=[],n=new Map,o=u=>{let d=n.get(u.id);if(!d){let p=yd(e,u);i.push(...p.problems),d=p.repins,n.set(u.id,d)}return d},s=u=>u.type==="bug"?u:ve(e,u);for(let u of t.artifacts.values()){if(u.type===te.type||Oi(e,u))continue;let d=s(u)?.parent,p=d?t.artifacts.get(d.id):void 0;if(!d||d.version===void 0||!p)continue;let f=Pi(d.version,o(u),p.id);r.push({id:u.id,kind:"artifact",holder:u,...u.title?{title:u.title}:{},target:p,pinned:f,items:null})}let a=new Map(zd(uB(e),e).map(u=>[u.unit,u]));for(let u of t.artifacts.values()){if(!mr.includes(u.type))continue;let d=u.type==="bug"||u.type==="adhoc"?null:ve(e,u)?.version??null,p=u.type==="bug"||u.type==="adhoc"||d!==null?Ke(e,u,d):null,f=p?p.record.documents:a.get(u.id)?.documents;for(let[m,h]of Object.entries(f??{})){let g=t.artifacts.get(m);g&&r.push({id:u.id,kind:"artifact",holder:u,...u.title?{title:u.title}:{},target:g,pinned:Pi(h,o(u),m),items:null})}}for(let u of t.artifacts.values()){let d=dt(e,u),p=d.at(-1);if(p===void 0)continue;let f=Fn(e,u,p)?.related??{};for(let[m,h]of Object.entries(f)){let g=t.artifacts.get(m);if(!g||(r.push({id:u.id,kind:"artifact",holder:u,...u.title?{title:u.title}:{},target:g,pinned:Pi(h,o(u),m),items:null}),dt(e,g).length===0))continue;let y=p;for(let v of[...d].reverse().slice(1)){if(Fn(e,u,v)?.related?.[m]===void 0)break;y=v}r.push({id:g.id,kind:"artifact",holder:g,...g.title?{title:g.title}:{},target:u,pinned:Pi(y,o(g),u.id),items:null})}}for(let u of t.artifacts.values()){if(u.type!==te.type)continue;let d=ve(e,u),p=t.artifacts.get(Bt(u.id));if(!d||!p)continue;let f=new Map(Object.entries(Fn(e,u,d.version)?.pins??{}));d.parent?.id===p.id&&d.parent.version!==void 0&&f.set(p.id,d.parent.version);let m=p.type==="task"?ve(e,p)?.parent:void 0;m?.version!==void 0&&f.set(m.id,m.version);for(let h of Kt(e,u,d.document))for(let{target:g,items:y}of WO(t,h.covers??[])){let v=f.get(g.id);if(v===void 0)continue;let b=Pi(v,o(u),g.id,h.id);r.push({id:h.id,kind:"test-case",holder:u,...h.text?{title:h.text}:{},target:g,pinned:b,items:y})}}let c=new Map,l=(u,d)=>{let p=`${u.id}@${d}`,f=c.get(p);if(f===void 0){f=d;for(let m of dt(e,u).filter(h=>h>d)){if(Fn(e,u,m)?.completes!==f)break;f=m}c.set(p,f)}return f};return{dependencies:r.map(u=>({...u,pinned:l(u.target,u.pinned)})),problems:i}}function vve(e,t){if(t.kind!=="artifact")return{};let r=t.holder,i=Ke(e,r,r.type==="bug"?null:ve(e,r)?.version??null);if(!i)return{};let{repo:n,commits:o,files:s}=i.record;return{finished:{record:i.path,repo:n,commits:o.map(a=>({id:a.id,subject:a.subject})),files:s}}}function $ve(e,t){return e.change==="unchanged"?!1:t===null||t.includes(e.id)&&e.change!=="added"}function g9(e,t,r){let i=[...t.problems],n=new Map,o=[];for(let s of t.dependencies){let a=r(s);if(a===void 0)continue;let c=`${s.target.id}@${s.pinned}..${a??"draft"}`;if(!n.has(c)){let d=dN(e,s.target,s.pinned,a);d.ok||i.push(...d.problems),n.set(c,d.ok?d.value:null)}let l=n.get(c),u=l?l.items.filter(d=>$ve(d,s.items)):[];l&&u.length===0||o.push({...s,target:s.target.id,current:a,changes:u,...vve(e,s)})}return o.sort((s,a)=>s.target.localeCompare(a.target,"en",{numeric:!0})||s.id.localeCompare(a.id,"en",{numeric:!0})),{suspects:o,problems:i}}function yr(e,t){return g9(e,h9(e,t),r=>{let i=dt(e,r.target).at(-1);return i!==void 0&&i>r.pinned?i:void 0})}function y9(e,t,r){let i=dt(e,r).at(-1);if(i===void 0)return null;let n=aa(r)===i,o=g9(e,h9(e,t),c=>c.target.id===r.id&&!(n&&c.pinned===i)?null:void 0),s=r.type==="story"?dN(e,r,i,null):null;s&&!s.ok&&o.problems.push(...s.problems);let a=s?.ok?s.value.items.filter(c=>c.kind==="entry"&&c.change==="added"):[];return{...o,from:i,gaps:a}}function Go(e){let t=e.current===null?"its draft":`v${e.current}`;return e.changes.length===0?`built against ${e.target} v${e.pinned}, which cannot be compared with ${t}`:`built against ${e.target} v${e.pinned}, and ${t} changes ${e.changes.map(r=>r.id).join(", ")}`}var bve=2e4,_k=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");async function v9(e,t=()=>new Date){let r=VB(e);if(!r)return{status:"no-remote",checkedAt:_k(t())};let i=r.split("/")[0],n=await $r(e,["fetch","--quiet","--no-tags",i],{timeoutMs:bve});if(n.code!==0)return{status:"failed",reason:n.stderr.split(`
290
+ `)[0]||"the fetch did not finish",checkedAt:_k(t())};let o=await $r(e,["rev-list","--count",`HEAD..${r}`,"--","."]),s=o.code===0?Number(o.stdout):0;return s>0?{status:"behind",behind:s,upstream:r,checkedAt:_k(t())}:{status:"current",checkedAt:_k(t())}}function Ld(e){return e?e.status==="behind"?`The spec tree is ${e.behind} commit${e.behind===1?"":"s"} behind ${e.upstream} (checked ${e.checkedAt}). Pull the spec repo to see the latest approvals.`:e.status==="failed"?`Could not check whether the spec tree is up to date (${e.reason}). Work continues with the local copy.`:null:null}import{existsSync as Ave,readFileSync as w9}from"node:fs";import{dirname as Eve,isAbsolute as mN,join as fN,posix as Ik,relative as Tk,sep as Ove}from"node:path";var wve=(e,t)=>`${e}-${t.suffix}`;function Yh(e,t,r,i){let n=r.chain.find(o=>o.type===i.type);return n?n.requires.flatMap(o=>{let s=r.documents.find(l=>l.type===o);if(!s)return[];let a=wve(i.id,s),c=t.artifacts.get(a);return[{owner:i,kind:s,id:a,...c?{record:c}:{},approved:c?ve(e,c):null}]}):[]}function kk(e,t,r,i){let n={};for(let o of i)for(let s of Yh(e,t,r,o))s.kind.type!=="test-plan"&&s.approved&&(n[s.id]=s.approved.version);return n}function Sk(e,t){return[...e.artifacts.values()].filter(r=>r.owner===t.id).sort((r,i)=>r.id.localeCompare(i.id))}function Ud(e){let t=n=>e.documents.find(o=>o.type===n)?.name??n,r=e.chain.map(n=>{let o=n.requires.map(t),s=`${n.prefix}-${"1".padStart(n.width,"0")}`;return`| ${n.name}${n.core?"":" (added)"} | ${s} | ${o.length>0?o.join(", "):"nothing"} |`}),i=e.documents.map(n=>n.name);return["| Stage | First ID | Requires before work under it starts |","|---|---|---|",...r,`Documents that can be attached at any stage: ${i.slice(0,-1).join(", ")}${i.length>1?" and ":""}${i.at(-1)??""}.`]}import{isAbsolute as _ve,posix as kve,relative as Sve,sep as xve}from"node:path";function qd(e,t,r){let i=new Map,n=Sve(e,t);if(n.startsWith("..")||_ve(n))return i;let o=n.split(xve).join("/"),a=[...r.artifacts.values()].filter(l=>mr.includes(l.type)).map(l=>l.id),c=(le(e,["for-each-ref","--format=%(refname:short)","refs/heads/bk/"])??"").split(`
291
+ `).filter(Boolean);for(let l of c){let u=ua(l,a),d=u?r.artifacts.get(u):void 0;if(!d||i.has(d.id))continue;let p=ve(r.root,d)?.version??null;if(Ke(r.root,d,p))continue;let f=kve.join(o,Ae(d),md);(le(e,["ls-tree","--name-only",l,"--",`${f}/`])??"").split(`
292
+ `).filter(Boolean).some(g=>p===null||new RegExp(`^version: ${p}$`,"m").test(le(e,["show",`${l}:${g}`])??""))&&i.set(d.id,l)}return i}var pN=mr,Ive=new Set(["bug","adhoc"]);function xk(e){let{tree:t,index:r,unitId:i}=e,n=t.root,o=r.artifacts.get(i);if(!o)return w({code:"start-not-found",message:`There is no artifact ${i}.`});let s=h=>Cn(t,h),a=Re(n),c=h=>`${s(h.type)} ${h.id}${h.title?` "${h.title}"`:""}`;if(!pN.includes(o.type))return w({code:"start-not-startable",message:`${o.id} is ${a.a(o.type)}, which is not worked on directly. Start one of the ${a.many("story")} or ${a.many("task")} under it.`});if(o.type==="story"){let h=[...r.artifacts.values()].filter(g=>g.type==="task"&&g.parent?.id===o.id).map(g=>g.id).sort();if(h.length>0)return w({code:"start-story-has-tasks",message:`${o.id} is built through its ${a.many("task")}: ${h.join(", ")}. Start one of them instead.`,remedy:`Start ${a.a("task")} with ${ee("start")} ${h[0]}.`})}if(se(n,o).onboardOnly)return w({code:"start-onboard-draft",message:`${o.id} is a draft of version 0: it describes code as it was before BuildKeel, and is not worked on.`,remedy:`Approve it with ${ee("approve")} ${o.id}; new work on what it describes is then drafted with ${ee("new")}.`});let l=ve(n,o)?.version??null,u=Ke(n,o,l);if(u)return w({code:"start-finished",message:`${o.id}${l!==null?` v${l}`:""} was finished on ${u.record.finishedAt.slice(0,10)} by ${u.record.finishedBy} (${u.path}).`,remedy:l===null?`Record the follow-up as a bug with ${ee("new")} bug, or as an ad-hoc unit with ${ee("adhoc")}.`:`Save a change to ${o.id} with save_draft and approve the new version with ${ee("approve")} ${o.id}; then it can be started and finished again. Or record the follow-up as a bug with ${ee("new")} bug, or as an ad-hoc unit with ${ee("adhoc")}.`});if(l===0)return w({code:"start-onboarded",message:`${o.id} is at version 0: it describes code as it was before BuildKeel, which counts as done.`,remedy:`To change it, save the change with save_draft (id ${o.id}) and approve v1 with ${ee("approve")} ${o.id}; v1 is then started and finished like any other. Or record new work under it with ${ee("new")}.`});let d=[],p=Tve(n,r,o);Ive.has(o.type)||(d.push(...Rve(n,o,p,c)),d.push(...Cve(n,r,Tt(n),o,p,a))),d.push(...Pve(e.suspects??yr(n,r).suspects,o,p,c));let f=Dd(e.home,n,o.id,e.workingTree);f&&d.push({id:"claimed",passed:!1,message:`${o.id} is being worked on in another working tree on this machine: ${f.workingTree}${f.branch?` (branch ${f.branch})`:""}, since ${f.claimedAt}.`,remedy:`Carry on with ${o.id} in that working tree, or pick another unit.`});let m=Ld(e.freshness);return m&&e.freshness?.status==="behind"&&d.push({id:"stale",passed:!1,warnOnly:!0,message:m,remedy:"Pull the spec repo, then start again to be sure nothing changed."}),T({unit:o,gate:Xi("start",fo(t,"start"),d)})}function Tve(e,t,r){let i=[],n=new Set([r.id]),o=ve(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id),i.push(s),o=ve(e,s)??s}return i}function Pve(e,t,r,i){let n=new Map([t,...r].map(o=>[o.id,o]));return e.filter(o=>o.kind==="artifact"&&n.has(o.id)).map(o=>{let s=n.get(o.id);return{id:o.id===t.id?"unit-suspect":"ancestor-suspect",passed:!1,message:o.id===t.id?`The ${i(s)} is suspect: ${Go(o)}.`:`The ${i(s)}, above ${t.id}, is suspect: ${Go(o)}.`,remedy:`Review it with ${ee("impact")} ${o.id}, and record whether it is still valid or needs change.`}})}function Rve(e,t,r,i){let n=[],o=(a,c)=>{let l=se(e,a);return l.state==="approved"?null:l.state==="pending"?{id:c?"unit-numbered":"ancestor-approved",passed:!1,message:`The ${i(a)} is approved, but its permanent number is still pending.`,remedy:`Approve again with ${ee("approve")} ${a.id} when the spec repo's remote can be reached; it gets its number first.`}:{id:c?"unit-approved":"ancestor-approved",passed:!1,message:c?`The ${i(a)} is not approved${xc(a.id)?" and has no permanent number yet":""}.`:`The ${i(a)}, above ${t.id}, is not approved.`,remedy:`Approve ${a.id} with ${ee("approve")} ${a.id}.`}},s=o(t,!0);s&&n.push(s);for(let a of r){let c=o(a,!1);c&&n.push(c)}return n}function Cve(e,t,r,i,n,o){let s=[],a=new Set;for(let c of[i,...n])for(let l of Yh(e,t,r,c)){a.add(l.id);let u=l.kind.type===te.type,d=u?"test-plan":"required-document";if(!l.record){let f=u?"test-plan":l.kind.name;s.push({id:d,passed:!1,message:u?`${c.id} has no ${l.kind.name}, so there is nothing to check the work against.`:`${c.id} has no ${l.kind.name}, which this process requires of ${o.a(c.type)} before work ${c===i?"on it":"under it"} starts.`,remedy:`Draft one with ${ee("new")} ${f} ${c.id}, then approve it with ${ee("approve")} ${l.id}.`});continue}if(!l.approved){s.push({id:d,passed:!1,message:`The ${l.kind.name} ${l.id} is not approved.`,remedy:`Approve it with ${ee("approve")} ${l.id}.`});continue}if(!u)continue;let p=ia(e,t,l.approved);for(let f of p?Fh(p,Kt(e,l.approved,l.approved.document)):[])s.push({id:"test-plan-gap",passed:!1,message:`${f.id} is not covered by any test case in ${l.id} v${l.approved.version}: "${f.text}"`,remedy:CO(l.id,c.id,f,`add a test case that covers it to ${l.id} and approve the new version`)})}for(let c of Sk(t,i)){if(a.has(c.id)||ve(e,c)||la(r,t,c))continue;let l=o.one(c.type);s.push({id:c.type===te.type?"test-plan":"required-document",passed:!1,message:`${i.id} has its own ${l}, ${c.id}, which is not approved.`,remedy:`Approve it with ${ee("approve")} ${c.id}.`})}return s}var Xh=e=>e.split(Ove).join("/");function Nve(e){let t=(e.title??"").toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),r=t.slice(0,41),i=t.length<=40?t:r.includes("-")?r.replace(/-[^-]*$/,""):t.slice(0,40);return i?`bk/${e.id}-${i}`:`bk/${e.id}`}function _9(e,t){let r=Tk(e,t);return r!==""&&!r.startsWith("..")&&!mN(r)?`${Xh(r)}/`:null}function Qh(e,t,r){if(r===cr)return!0;if(r===".gitignore")return jve(e);let i=_9(e,t);return i!==null&&(r===`${i}${Xe}`||r.startsWith(`${i}${lo}/`))}function jve(e){let t=o=>[".buildkeel/","/.buildkeel/",".buildkeel","/.buildkeel"].includes(o.trim());if(!le(e,["ls-files","--",".gitignore"]))return(le(e,["show",":.gitignore"])??zve(fN(e,".gitignore"))).split(/\r?\n/).filter(s=>s.trim()!=="").every(t);let n=so(e,["diff","HEAD","--unified=0","--",".gitignore"]).split(/\r?\n/).filter(o=>/^[+-](?![+-]{2} )/.test(o));return n.length>0&&n.every(o=>o.startsWith("+")&&t(o.slice(1)))}var zve=e=>{try{return w9(e,"utf8")}catch{return""}};function Pk(e,t){let i=so(e,["status","--porcelain=v1","-z","--untracked-files=all"]).split("\0").filter(Boolean),n=[];for(let s=0;s<i.length;s++){let a=i[s],c=a.slice(0,2);n.push(a.slice(3)),(c.startsWith("R")||c.startsWith("C"))&&s++}let o=_9(e,t);return n.filter(s=>!s.startsWith(".buildkeel/")&&(!o||!s.startsWith(o)||Qh(e,t,s)))}function Dve(e,t){try{let r=Number(Rt(e,["rev-list","--count",`${t}..${t}@{upstream}`]));return r>0?`${t} is ${r} commit${r===1?"":"s"} behind its remote as of the last fetch; pull it if you want the latest code.`:void 0}catch{return}}function Mve(e,t,r,i){let n=Ik.join(Xh(Tk(e,t)),Ik.dirname(r.path)),o=Rt(e,["log","--format=%H","--reverse",`${i}..HEAD`,"--",n]).split(`
293
+ `).filter(Boolean);return o.length===0?null:o.every(a=>Rt(e,["show","--name-only","--format=",a]).split(`
294
+ `).filter(Boolean).every(c=>c.startsWith(`${n}/`)))?o:null}function Lve(e,t,r,i){let n=Tk(e,t);return n.startsWith("..")||mN(n)?!0:Rt(e,["ls-tree","--name-only",i,"--",Ik.join(Xh(n),r.path)])!==""}function $9(e,t,r,i,n){let o=Tk(e,t);if(o.startsWith("..")||mN(o))return[];let s=[];for(let u=i;u;u=u.parent?r.artifacts.get(u.parent.id):void 0)s.push(Ik.join(Xh(o),Eve(u.path)));let a=u=>new Set(Rt(e,["ls-tree","-r","--name-only",u,"--",...s]).split(`
295
+ `).filter(d=>/\/approvals\/[^/]+\.yaml$/.test(d))),c=a(n),l=new Map(Tt(t).documents.map(u=>[u.dir,u.suffix]));return[...a("HEAD")].filter(u=>!c.has(u)).sort().map(u=>{let d=u.slice(o===""?0:Xh(o).length+1).split("/"),p=d.length===5?l.get(d[2]??""):void 0;return`${d[1]}${p?`-${p}`:""} ${(d.at(-1)??"").replace(/\.yaml$/,"")}`})}function k9(e,t,r,i,n,o=!1){try{let s=`bk/${i.id}`;if(n&&(_=>_===s||_.startsWith(`${s}-`))(n))return T({kind:"kept",branch:n});let c=n??"this commit",l=(_,k,x)=>w({code:"start-approvals-elsewhere",message:`${i.id} is approved here, on ${c}, but ${k} does not have these approvals yet: ${_.join(", ")}.`,remedy:x}),u=n?.startsWith("bk/")??!1,d=Q_(e),p=Rt(e,["for-each-ref","--format=%(refname:short)",`refs/heads/${s}`,`refs/heads/${s}-*`]).split(`
296
+ `).filter(Boolean);if(p[0]){let _=$9(e,t,r,i,p[0]);return _.length>0?l(_,`its branch ${p[0]}`,u&&d?`Merge ${c} into ${d}, for example through its pull request, then merge ${d} into ${p[0]}, and start ${i.id} again.`:`Merge ${c} into ${p[0]}, then start ${i.id} again.`):(Rt(e,["switch","--quiet",p[0]]),T({kind:"switched",branch:p[0]}))}let f=o&&u,m=u&&!f?d??"HEAD":n??"HEAD",h=[];if(m!==(n??"HEAD")&&(i.type==="bug"||i.type==="adhoc")&&!Lve(e,t,i,m)){let _=Mve(e,t,i,m);if(!_)return w({code:"start-unit-elsewhere",message:`${i.id} was recorded here, on ${c}, but ${m}, where its branch would start, does not have it yet.`,remedy:`Merge ${c} into ${m}, for example through its pull request, then start ${i.id} again.`});h=_}let g=m===(n??"HEAD")?[]:$9(e,t,r,i,m);if(g.length>0)return l(g,`${m}, where its branch would start,`,`Merge ${c} into ${m}, for example through its pull request, then start ${i.id} again.`);let y=Nve(i);if(Rt(e,["switch","--quiet","-c",y,m]),h.length>0)try{Rt(e,["cherry-pick",...h])}catch(_){throw le(e,["cherry-pick","--abort"]),Rt(e,["switch","--quiet",n??"-"]),le(e,["branch","-D",y]),_}let v=h.map(_=>Rt(e,["log","-1","--format=%s",_])),b=u&&!f?Dve(e,m):void 0;return T({kind:"created",branch:y,base:m,...b?{baseNote:b}:{},...v.length>0?{carried:v}:{},...f?{stacked:f}:{}})}catch(s){let a=s instanceof _d?s.stderr.trim():String(s);return w({code:"start-branch-failed",message:`Could not switch to the unit's branch: ${a}`})}}function hN(e,t,r){let i=[],n=new Set([r.id]),o=ve(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id),i.push(s),o=ve(e,s)??s}return i}function S9(e){let{tree:t,codeRoot:r}=e,i=qve(t.root,e.unitId);if(i)return w(i);if(B(t.root).mode==="spec-driven")return Fve(e);let n=K(t.root),o=_e(r),s=xk({tree:t,index:n,unitId:e.unitId,workingTree:r,home:e.home,freshness:o?.freshness});if(!s.ok)return s;let{unit:a,gate:c}=s.value,l=qd(r,t.root,n).get(a.id);if(l)return w({code:"start-finished-elsewhere",message:`${a.id} was finished on its branch ${l}, which is not merged yet, so this branch does not show it as done.`,remedy:`Merge ${l}, for example through its pull request. For more work, record the follow-up as a bug with ${ee("new")} bug, or as an ad-hoc unit with ${ee("adhoc")}.`});if(c.outcome==="blocked")return T({kind:"refused",unitId:a.id,gate:c});let u=o?.activeUnit??null,d=Pk(r,t.root);if(d.length>0)return T({kind:"uncommitted",unitId:a.id,files:d,activeUnit:u,gate:c});let p=Xs(r),f=k9(r,t.root,n,a,p,e.stack);if(!f.ok)return f;let m;try{let b=kk(t.root,n,Tt(t.root),[a,...hN(t.root,n,a)]);m=nN(e.home,t.root,{unit:a.id,workingTree:r,branch:f.value.branch,host:e.host,...Object.keys(b).length>0?{documents:b}:{}})}catch(b){return f.value.kind!=="kept"&&p&&(le(r,["switch","--quiet",p]),f.value.kind==="created"&&le(r,["branch","-D",f.value.branch])),w({code:"start-claim-failed",message:`${a.id} was not started: its claim could not be written in ${zc(e.home,t.root)} (${b instanceof Error?b.message:String(b)}).`,remedy:`BuildKeel keeps claims in ${e.home}, which must be writable by the BuildKeel tools. Call them through the host, never from a terminal or a script, then start ${a.id} again.`})}let{held:h,ours:g}=m;if(!g)return w({code:"start-claimed",message:`${a.id} was just claimed by another working tree: ${h.workingTree}.`});let y=(ve(t.root,a)??a).document.frontmatter.scope,v=Array.isArray(y)?y.filter(b=>typeof b=="string"):[];return o||Gh(r,n),wr(r,{activeUnit:a.id,activeBranch:f.value.branch,scope:v,untrackedSince:null}),T({kind:"started",unit:a,previous:u,branch:f.value,claim:h,gate:c})}var b9={gate:"start",mode:"off",outcome:"skipped",blocking:[],warnings:[]};function Uve(e,t,r){let i=Xt(e,r);if(i==="archived"||i==="discarded")return w({code:"start-change-closed",message:`${r} is ${i}: there is nothing left to work on in it.`,remedy:`Make further work a new change, with ${ee("new")} change.`});if(i==="open"){let s=Ce(r,"proposal"),a=Ave(fN(e,s))?oe(w9(fN(e,s),"utf8"),s):null;if(!a?.ok)return w({code:"start-change-no-proposal",message:`${r} has no readable proposal, so it cannot be started.`,remedy:`Save its proposal with ${ee("new")}.`});let c=a.value.frontmatter.title;return T({id:r,type:"change",path:s,document:a.value,...typeof c=="string"?{title:c}:{}})}let n=t.artifacts.get(r);if(!n||n.type!=="bug"&&n.type!=="adhoc")return w({code:"start-not-found",message:`There is no change, bug or ad-hoc unit ${r}.`,remedy:`See what can be started with ${ee("start")}.`});let o=Ke(e,n,null);return o?w({code:"start-finished",message:`${r} was finished on ${o.record.finishedAt.slice(0,10)}.`,remedy:"Record further work as a new bug or change."}):T(n)}function qve(e,t){let r=K(e).artifacts.get(t);return!r||!Oi(e,r)?null:{code:"start-closed",path:oi(r),message:`${t} was closed without a fix (${oi(r)}), so it is not worked on.`,remedy:"If the defect is back, record it as a new bug, which can name this one."}}function Fve(e){let{tree:t,codeRoot:r}=e,i=K(t.root),n=Uve(t.root,i,e.unitId);if(!n.ok)return n;let o=n.value,s=Dd(e.home,t.root,o.id,r);if(s)return w({code:"start-claimed",message:`${o.id} is being worked on in another working tree on this machine: ${s.workingTree}${s.branch?` (branch ${s.branch})`:""}, since ${s.claimedAt}.`,remedy:`Carry on with ${o.id} in that working tree, or pick another unit.`});let a=_e(r),c=a?.activeUnit??null,l=Pk(r,t.root);if(l.length>0)return T({kind:"uncommitted",unitId:o.id,files:l,activeUnit:c,gate:b9});let u=Xs(r),d=k9(r,t.root,i,o,u,e.stack);if(!d.ok)return d;let p;try{p=nN(e.home,t.root,{unit:o.id,workingTree:r,branch:d.value.branch,host:e.host})}catch(f){return d.value.kind!=="kept"&&u&&(le(r,["switch","--quiet",u]),d.value.kind==="created"&&le(r,["branch","-D",d.value.branch])),w({code:"start-claim-failed",message:`${o.id} was not started: its claim could not be written in ${zc(e.home,t.root)} (${f instanceof Error?f.message:String(f)}).`})}return p.ours?(a||Gh(r,i),wr(r,{activeUnit:o.id,activeBranch:d.value.branch,scope:[],untrackedSince:null}),T({kind:"started",unit:o,previous:c,branch:d.value,claim:p.held,gate:b9})):w({code:"start-claimed",message:`${o.id} was just claimed by another working tree: ${p.held.workingTree}.`})}var gN=5,yN="run the tests with a JUnit XML report and record it with the BuildKeel test_results tool";function Zve(e){let t=`${e.id} "${e.title}"`,r=(i,n)=>({id:`test-case-${e.status.replace(" ","-")}`,passed:!1,message:i,remedy:n});switch(e.status){case"passed":return null;case"no test":return e.own?e.regression?r(`${e.id} has no regression test: no test is tagged [${e.id}].`,`Write a test that fails without the fix and passes with it, with [${e.id}] in its name, then ${yN}.`):r(`${t} has no test tagged [${e.id}].`,`Write a test for it with [${e.id}] in its name, then ${yN}.`):null;case"not run":return r(e.matched?`${t} is matched to ${e.matched.join("; ")}, which has no result.`:`${t} has a tagged test but no result.`,"Run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.");case"stale":return r(`The result of ${t} is stale: ${e.detail??"it no longer matches the code"}.`,"Run the tests again with a JUnit XML report and record it with the BuildKeel test_results tool.");case"failed":return r(`${t} fails${e.tests.length>0?`: ${e.tests.join("; ")}`:""}.`,`Fix the code or the test, then ${yN}.`)}}function vN(e,t,r,i){let n=[],o=Pk(e,t);if(o.length>0){let a=o.slice(0,gN).join(", "),c=o.length>gN?` and ${o.length-gN} more`:"",l=o.filter(u=>Qh(e,t,u));n.push({id:"clean",passed:!1,message:`The working tree has uncommitted changes: ${a}${c}.`,remedy:l.length===o.length?`${l.join(", ")} ${l.length===1?"sets":"set"} BuildKeel up: commit ${l.length===1?"it":"them"} on ${l.length===1?"its":"their"} own, with no BuildKeel-Unit line, then finish again.`:`Commit them with "BuildKeel-Unit: ${r}" at the end of the message${l.length>0?`, apart from ${l.join(", ")}, which set BuildKeel up and are committed on their own with no such line`:""}, or set them aside with git stash, then finish again.`})}let s=Xs(e);return i&&s!==i&&n.push({id:"on-branch",passed:!1,message:`The working tree is on ${s??"a detached HEAD"}, not on ${r}'s branch ${i}.`,remedy:`Switch back with git switch ${i}, then finish again.`}),n}function x9(e){let{tree:t,unit:r,codeRoot:i}=e,n=[];n.push(...vN(i,t.root,r.id,e.branch));let o=B(t.root).mode==="spec-driven",s=Fd({root:t.root,index:e.index,unitId:r.id,codeRoot:i,specRoot:t.root,...e.state?{state:e.state}:{}});for(let c of s){let l=Zve(c);l&&n.push(o?{...l,warnOnly:!0}:l)}if(r.type==="task"&&!s.some(c=>c.status==="passed")&&!n.some(c=>c.id.startsWith("test-case-"))){let c=Re(t.root);n.push({id:"tested",passed:!1,message:`${r.id} has no passing test case: it has no test plan of its own, and no test is tagged with one of its ${c.one("story")}'s test cases. Nothing shows its work is tested.`,remedy:`Give ${r.id} a test plan whose test cases cover ${r.id} (draft it with ${ee("new")} test-plan ${r.id}${Tt(t.root).taskPlans==="approve"?" and approve it":": it is recorded as it is saved"}), or tag a test with the ${c.one("story")} test case it delivers; then run the tests and record the report with the BuildKeel test_results tool.`})}if(!o)for(let c of yr(t.root,e.index).suspects.filter(l=>l.kind==="artifact"&&l.id===r.id))n.push({id:"unit-suspect",passed:!1,message:`${r.id} is suspect: ${Go(c)}.`,remedy:`Decide it with ${ee("impact")} ${r.id}: still valid lets it finish at once; needs change opens its next version, which it is finished against once approved.`});let a=Ld(e.freshness);return a&&e.freshness?.status==="behind"&&n.push({id:"stale",passed:!1,warnOnly:!0,message:a,remedy:"Pull the spec repo, then finish again to be sure the test plans did not change."}),{gate:Xi("done",o?"block":fo(t,"done"),n),cases:s}}var Zd=Lt(Vt(),1);import{existsSync as Vve,readFileSync as Bve}from"node:fs";import{join as I9}from"node:path";var Kve=$.string().regex(/^sha256:[0-9a-f]{64}$/,"must be sha256: followed by 64 hex digits"),Wve=$.object({change:$.string().min(1),versions:$.record($.string(),$.number().int().positive()).default({}),files:$.record($.string(),Kve),archivedBy:$.string().min(1),archivedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})}),eg=e=>`${Et(e)}/${cd}`;function T9(e){return(0,Zd.stringify)({change:e.change,versions:e.versions,files:e.files,archivedBy:e.archivedBy,archivedAt:e.archivedAt},{lineWidth:0})}function Gve(e,t){let r;try{r=(0,Zd.parse)(e)}catch(n){let o=n instanceof Zd.YAMLParseError?n.message.split(`
297
+ `)[0]:String(n);return w({code:"archive-record-invalid",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Wve.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"archive-record-invalid"))}function P9(e,t){let r=eg(t);return Vve(I9(e,r))?Gve(Bve(I9(e,r),"utf8"),r):null}import{existsSync as Xve,readFileSync as Qve}from"node:fs";import{join as Ck}from"node:path";var Hve=/^##\s+(?:(\d+)\.?\s+)?(.*?)\s*$/,Jve=/^\s*[-*+]\s+\[([^\]]*)\]\s+(.*?)\s*$/,Yve=/^(\d+(?:\.\d+)+)\.?\s+(.*)$/;function Ni(e){let t=[],r=[],i=null;for(let n of Br(e).split(/\r?\n/)){let o=Hve.exec(n);if(o){i={number:o[1]??null,title:o[2]??"",tasks:[]},t.push(i);continue}let s=Jve.exec(n);if(!s)continue;let a=Yve.exec(s[2]??""),c={id:a?.[1]??null,text:(a?a[2]:s[2])??"",ticked:/^\s*x\s*$/i.test(s[1]??""),group:i?.number??null};r.push(c),i?.tasks.push(c)}return{groups:t,tasks:r,done:r.filter(n=>n.ticked).length,total:r.length}}var Rk=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ak=(e,t)=>new RegExp(`(?<![A-Za-z0-9-])${Rk(t)}(?![A-Za-z0-9])`).test(e);function Ek(e,t,r){let i=[...B_(e,t)],n=p=>Xve(Ck(e,p))?Qve(Ck(e,p),"utf8"):null,o=Ce(t,"tasks"),s=n(o),a=s?Ni(s).tasks:[],c=nr(e,t).map(p=>{let f=Ce(t,"spec-change",p),m=oe(n(f)??"",f);return{capability:p,path:f,ops:m.ok?xn(m.value):null}}),l=c.flatMap(p=>(p.ops?.removed??[]).map(f=>f.id).filter(f=>f!==null)),u=Ce(t,"design"),d=n(u);for(let p of l){for(let f of a.filter(m=>Ak(m.text,p)))i.push({code:"task-names-removed-requirement",path:o,message:`${t}: task ${e$e(f)} names ${p}, which ${t} removes.`,remedy:`Reword or remove the task, or keep ${p} by taking it out of the spec change's Removed section.`});d&&Ak(d,p)&&i.push({code:"design-names-removed-requirement",path:u,message:`${t}: the design names ${p}, which ${t} removes.`,remedy:"Update the design to match the spec change."})}return r&&i.push(...t$e(e,t,r,new Set(l))),i.push(...r$e(e,t,a,c)),i}var e$e=e=>e.id??`"${e.text}"`;function t$e(e,t,r,i){let n=[],{scenarios:o,own:s}=iN(e,t);for(let g of vk({scenarios:o,own:s,codeRoot:r.codeRoot,specRoot:r.specRoot}))g.own&&g.status==="no test"&&n.push({code:"scenario-untested",message:`${t}: scenario ${g.id} "${g.title}" has no tagged test.`,remedy:`Put [${g.id}] in the name of the test that checks it.`});let a=nr(e,t);if(a.length===0)return n;let c=zh(xO(e,null).values()),l=new Set([...o.map(g=>g.id),...c.filter(g=>g.requirement.change!==null).map(g=>g.id)]),u=new Set(c.filter(g=>i.has(g.requirement.id)).map(g=>g.id)),d=Ho(e),p=`\\[(${a.map(Rk).join("|")})-${Rk(d.requirement)}[A-Za-z0-9]+-${Rk(d.scenario)}[A-Za-z0-9]+\\]`,f=Ok(r.codeRoot,r.specRoot).map(g=>`:(exclude)${g}`),m=le(r.codeRoot,["grep","--untracked","-I","-E","-o","-h","-e",p,"--",".",...f])??"",h=[...new Set(m.split(`
298
+ `).map(g=>g.trim().slice(1,-1)).filter(Boolean))].sort();for(let g of h.filter(y=>!l.has(y)))n.push({code:"test-tag-unknown",message:u.has(g)?`${t}: a test is tagged [${g}], a scenario of a requirement ${t} removes.`:`${t}: a test is tagged [${g}], which names no scenario.`,remedy:u.has(g)?"Remove the test, or retag it with the scenario that replaces it.":"Check the tag for a typo, or add the scenario."});return n}function r$e(e,t,r,i){let n=i.flatMap(d=>[...d.ops?.added??[],...d.ops?.modified??[]].filter(p=>p.id!==null).map(p=>({item:p,path:d.path}))),o=r.filter(d=>d.ticked&&d.id!==null&&n.some(p=>Ak(d.text,p.item.id)));if(o.length===0)return[];let s=kd(e),a=s?Ci(s,Ck(e,Ce(t,"tasks"))):null;if(!s||!a)return[];let c=(le(s,["log","--format=%H","--reverse","--",a])??"").split(`
299
+ `).filter(Boolean),l=new Map;for(let d of c){let p=le(s,["show",`${d}:${a}`]),f=new Map(Ni(p??"").tasks.map(m=>[m.id,m.ticked]));for(let m of o)f.get(m.id)!==!0?l.delete(m.id):l.has(m.id)||l.set(m.id,d)}let u=[];for(let d of o){let p=l.get(d.id);if(p)for(let{item:f,path:m}of n.filter(h=>Ak(d.text,h.item.id))){let h=Ci(s,Ck(e,m)),g=h?le(s,["show",`${p}:${h}`]):null,y=g===null?null:oe(g);if(!y?.ok)continue;let v=xn(y.value),b=[...v.added,...v.modified].find(_=>_.id===f.id);!b||Js(b)===Js(f)||u.push({code:"task-ticked-before-change",path:Ce(t,"tasks"),message:`${t}: task ${d.id} was ticked in ${p.slice(0,7)}, and ${f.id} has changed since.`,remedy:`Check that the work for task ${d.id} still meets ${f.id}; untick it if it does not.`})}}return u}var Vd=Lt(Vt(),1);import{existsSync as N9,readFileSync as j9}from"node:fs";import{join as zk}from"node:path";function R9(e){let t=new Map;return(r,i)=>{let n=`${r}@${i}`;if(!t.has(n)){let o=Pt(e,r,i);t.set(n,o.ok?new Map(Jt(o.value.document).filter(s=>s.id!==null).map(s=>[s.id,Js(s)])):null)}return t.get(n)??null}}function Nk(e){let t=[],r=[];for(let i of ir(e).filter(n=>n.state==="archived")){let n=Ri(e,i.id);r.push(...n.problems);let o=n.completions.at(-1),s=o?.record.versions;if(!o||!s)continue;let a=X_(e,i.id);r.push(...a.problems);let{record:c,path:l}=o;for(let[u,d]of Object.entries(s)){let p=Pt(e,u,d),f=p.ok?Jt(p.value.document):[],m=(c.requirements??[]).filter(h=>f.some(g=>g.id===h));m.length>0&&t.push({kind:"change",id:i.id,holder:i.id,...i.title?{title:i.title}:{},capability:u,requirements:m,pinned:Pi(d,a.repins,u),finished:{record:l,repo:c.repo,commits:c.commits.map(h=>({id:h.id,subject:h.subject})),files:c.files}});for(let h of f)for(let g of h.children??[]){let y=g.id?c.tests.cases[g.id]:void 0;!g.id||!h.id||!y?.tests||y.tests.length===0||t.push({kind:"test",id:g.id,holder:i.id,title:g.text,tests:y.tests,capability:u,requirements:[h.id],pinned:Pi(d,a.repins,u,g.id)})}}}return{dependencies:t,problems:r}}var C9=(e,t)=>e.capability.localeCompare(t.capability)||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id,"en",{numeric:!0});function da(e){let{dependencies:t,problems:r}=Nk(e),i=R9(e),n=[];for(let o of t){let s=Uo(e,o.capability)?.inForce;if(s===void 0||s<=o.pinned)continue;let a=[];for(let c of o.requirements){let l=i(o.capability,o.pinned)?.get(c);if(l!==void 0)for(let u=o.pinned+1;u<=s;u++){let d=i(o.capability,u)?.get(c);if(d===l)continue;let p=Pt(e,o.capability,u),f=p.ok&&p.value.record.ok?p.value.record.value.change??null:null;a.push({id:c,change:d===void 0?"removed":"modified",by:f});break}}a.length>0&&n.push({...o,current:s,changes:a})}return{suspects:n.sort(C9),problems:r}}function Dc(e,t){let{dependencies:r,problems:i}=Nk(e),n=R9(e),o=[];for(let s of nr(e,t)){let a=bd(e,t,s),c=new Map(a.requirements.map(l=>[l.id,l.hash]));for(let l of r.filter(u=>u.capability===s)){let u=[];for(let d of l.requirements){if(!a.own.has(d)&&!a.removed.has(d))continue;let p=n(s,l.pinned)?.get(d);p===void 0||p===c.get(d)||u.push({id:d,change:c.has(d)?"modified":"removed",by:t})}u.length>0&&o.push({...l,current:null,changes:u})}}return{suspects:o.sort(C9),problems:i}}function jk(e){let t=e.changes.map(r=>`${r.by?`${r.by} `:""}${r.change==="removed"?"removes":"modifies"} ${r.id}`).join(", and ");return`built against ${e.capability} v${e.pinned}, and ${t}`}var n$e="impact.yaml",z9=e=>`${Et(e)}/${n$e}`,i$e=$.object({suspect:$.string().min(1),kind:$.enum(["test","change"]),holder:$.string().min(1),capability:$.string().min(1),decision:$.enum(["still-valid","needs-change"]),task:$.string().optional(),decidedBy:$.string().min(1),decidedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})}),o$e=$.object({decisions:$.array(i$e).default([])});function Bd(e,t){let r=z9(t);if(!N9(zk(e,r)))return T([]);let i;try{i=(0,Vd.parse)(j9(zk(e,r),"utf8"))}catch(o){let s=o instanceof Vd.YAMLParseError?o.message.split(`
300
+ `)[0]:String(o);return w({code:"impact-file-invalid",path:r,message:`${r} is not valid YAML: ${s}`})}let n=o$e.safeParse(i??{});return n.success?T(n.data.decisions):w(..._t(n.error.issues,r,"impact-file-invalid"))}var s$e=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z"),a$e=(e,t)=>e.suspect===t.id&&e.holder===t.holder;function A9(e){let t=e.changes.map(o=>o.id).join(", "),r=[...new Set(e.changes.map(o=>o.by).filter(o=>o!==null))].join(", "),i=r?`, changed by ${r}`:"";if(e.kind==="test")return`Revisit the tests of ${e.id} (${(e.tests??[]).join("; ")}) for ${t}${i}. Verify: they check ${t} as it now reads, and pass.`;let n=e.finished?.files.length?` (${e.finished.files.join(", ")})`:"";return`Revisit the code ${e.id} built${n} for ${t}${i}. Verify: it meets ${t} as it now reads.`}function E9(e,t,r,i){let n=Ce(r,"tasks"),o=N9(zk(e,n))?j9(zk(e,n),"utf8"):`---
301
+ parent: ${r}
302
+ ---
303
+ `,a=Ni(o).groups.filter(d=>d.number!==null).at(-1),c,l;if(a){let d=Math.max(0,...a.tasks.map(p=>Number(p.id?.split(".").at(-1)??0)));c=`${a.number}.${d+1}`,l=`${o.trimEnd()}
304
+ - [ ] ${c} ${i}
305
+ `}else c="1.1",l=`${o.trimEnd()}
306
+
307
+ ## 1. Impact
308
+
309
+ - [ ] ${c} ${i}
310
+ `;let u=t.writeFile(n,l);return u.ok?T(c):u}function O9(e,t,r,i){let n=Bd(e,r);if(!n.ok)return n;let o=n.value.filter(s=>!(s.suspect===i.suspect&&s.holder===i.holder));return t.writeFile(z9(r),(0,Vd.stringify)({decisions:[...o,i]},{lineWidth:0}))}async function D9(e){let{tree:t,writer:r,id:i}=e,n=t.root;if(!t.access.writable)return w(t.access.problem);if(e.change&&Xt(n,e.change)!=="open")return w({code:"resolve-change-not-open",message:`${e.change} is not an open change.`,remedy:"Name an open change, or draft a new one with save_draft first."});let o=lt(n);if(!o)return w({code:"resolve-no-identity",message:"Git has no name and email set for the spec repo, so who decided cannot be recorded."});let s=s$e(e.now?.()??new Date),a=da(n).suspects.filter(p=>p.id===i),c=p=>Dc(n,p).suspects.filter(f=>f.id===i),l=e.change?c(e.change):[],u=e.change?l.length>0?e.change:null:a.length>0?null:c$e(n,i)??null;if(u){let p=l.length>0?l:c(u),f=[];for(let m of p){let h;if(e.decision==="needs-change"){let v=E9(n,r,u,A9(m));if(!v.ok)return v;h=v.value}let g={suspect:m.id,kind:m.kind,holder:m.holder,capability:m.capability,decision:e.decision,...h?{task:h}:{},decidedBy:o,decidedAt:s},y=O9(n,r,u,g);if(!y.ok)return y;f.push(g)}return T({kind:"preview",change:u,decisions:f,suspects:p})}if(a.length===0)return w({code:"resolve-not-suspect",message:`${i} is not suspect, and no open change's preview would make it so.`,remedy:"See what is suspect with the BuildKeel impact tool."});if(e.decision==="still-valid"){let p=[];for(let h of a){let g={target:h.capability,...h.kind==="test"?{testCase:h.id}:{},from:h.pinned,to:h.current,decidedBy:o,decidedAt:s},y=`${$d(h.holder)}/${Nh(g)}`,v=r.createRecord(y,jh(g));if(!v.ok)return v;p.push(y)}let f=Me(n,p,`repin: ${i} to ${a.map(h=>`${h.capability} v${h.current}`).join(", ")}`),m=f.ok&&t.config.settings.autoPush?await In(n):null;return T({kind:"repinned",suspects:a,records:p,commit:f,push:m})}if(!e.change)return w({code:"resolve-needs-change-target",message:`${i} needs change: name the open change to add the work to, in change.`,remedy:"Ask the user which open change takes it, or draft a new change with save_draft and name it."});let d="";for(let p of a){let f=E9(n,r,e.change,A9(p));if(!f.ok)return f;d=f.value;let m=O9(n,r,e.change,{suspect:p.id,kind:p.kind,holder:p.holder,capability:p.capability,decision:"needs-change",task:d,decidedBy:o,decidedAt:s});if(!m.ok)return m}return T({kind:"task",change:e.change,task:d,suspects:a})}function c$e(e,t){let r=Ys(e).map(i=>i.id).filter(i=>Dc(e,i).suspects.some(n=>n.id===t));return r.length===1?r[0]:void 0}function M9(e,t,r,i,n){let o=Bd(e,r);if(!o.ok)return o;if(o.value.length===0)return T([]);let{dependencies:s}=Nk(e),a=[];for(let c of o.value){let l=s.find(m=>a$e(c,m)&&m.capability===c.capability),u=Uo(e,c.capability)?.inForce;if(!l||u===void 0||l.pinned>=u)continue;let d={target:c.capability,...c.kind==="test"?{testCase:c.suspect}:{},from:l.pinned,to:u,decidedBy:i,decidedAt:n},p=`${$d(c.holder)}/${Nh(d)}`,f=t.createRecord(p,jh(d));if(!f.ok)return f;a.push(p)}return T(a)}var tg=(e,t)=>U9(rg(e,t))?q9(rg(e,t),"utf8"):null,Dk=e=>new Map(e.filter(t=>t.id!==null).map(t=>[t.id,{hash:Js(t),text:t.raw.trim()}]));function u$e(e){return e.activeUnit===e.id?e.activeBranch:(le(e.codeRoot,["for-each-ref","--format=%(refname:short)","refs/heads/bk/"])??"").split(`
311
+ `).filter(Boolean).find(r=>ua(r,[e.id])===e.id)??null}function Kd(e,t){let r={},i=n=>{for(let o of l$e(rg(e,n),{withFileTypes:!0})){let s=`${n}/${o.name}`;o.isDirectory()?i(s):r[s]=Ft(q9(rg(e,s),"utf8"))}};return U9(rg(e,Et(t)))&&i(Et(t)),Object.fromEntries(Object.entries(r).sort(([n],[o])=>n.localeCompare(o)))}function F9(e,t,r){let i=r.get(t);if(i)return{version:i.version,text:i.text,change:i.change};let n=Pt(e,t);return n.ok?{version:n.value.version,text:n.value.text,change:n.value.record.ok?n.value.record.value.change??null:null}:null}function d$e(e,t,r,i,n,o){let s=u=>{let d=Pt(e,t,u);return d.ok?d.value:null},a=u=>Dk(Jt(u.document)).get(r)?.hash,c=s(i),l=c?a(c):void 0;for(let u=i+1;u<=n.version;u++){let d=o.get(t);if(d?.version===u)return d.change;let p=s(u);if(p&&a(p)!==l)return p.record.ok?p.record.value.change??null:null}return n.change}function Mk(e){let{tree:t,id:r}=e,i=t.root,n=Xt(i,r);if(n==="missing")return w({code:"finish-not-found",message:`There is no change ${r}.`});if(n!=="open")return w({code:`change-${n}`,path:Et(r),message:`${r} is ${n}: there is nothing left to finish.`});let o=tg(i,Ce(r,"proposal")),s=o?oe(o):null,a=s?.ok&&typeof s.value.frontmatter.title=="string"?s.value.frontmatter.title:void 0,c=e.pending??new Map,l=e.activeUnit===r,u=u$e(e),d=Xi("done","block",vN(e.codeRoot,i,r,l?u:null)),p=[],f=[],m=[...V9(i,r)],h={},g=We("capability",i);for(let J of nr(i,r)){let it=Ce(r,"spec-change",J),z=tg(i,it)??"",pe=oe(z,it);if(!pe.ok)return pe;let H=xn(pe.value),fe=F9(i,J,c);h[J]=[fe?.version??null,fe?Ft(fe.text):null];let kt=yO(fe?.text??null,z,J);if(!kt.ok)return kt;let Qt=(fe?.version??0)+1,L=[...H.added,...H.modified].map(yt=>yt.id).filter(yt=>yt!==null),Ve=H.removed.map(yt=>yt.id).filter(yt=>yt!==null);p.push({code:J,base:fe?.version??null,next:Qt,text:kt.value,own:L,removed:Ve});let Ze=oe(kt.value,Lo(J,Qt));Ze.ok&&(m.push(...Eh(Ze.value,J,Lo(J,Qt))),g.ok&&m.push(...Vo(Ze.value,g.value.template,{itemOwner:J,path:Lo(J,Qt),offlineIds:!0})));let Ge=pe.value.frontmatter.base;if(fe&&typeof Ge=="number"&&Ge<fe.version){let yt=Pt(i,J,Ge),lr=yt.ok?Dk(Jt(yt.value.document)):new Map,pt=oe(fe.text),Oe=pt.ok?Dk(Jt(pt.value)):new Map,M=Dk([...H.modified]);for(let me of[...H.modified.map(xe=>xe.id),...Ve].filter(xe=>xe!==null))lr.get(me)?.hash!==Oe.get(me)?.hash&&f.push({capability:J,requirement:me,written:Ge,current:fe.version,by:d$e(i,J,me,Ge,fe,c),theirs:Oe.get(me)?.text??null,ours:M.get(me)?.text??null})}}let v=[...[...K(i).artifacts.values()].filter(J=>mr.includes(J.type)).map(J=>J.id),...ir(i).map(J=>J.id)],b=$N({tree:t,codeRoot:e.codeRoot,repo:e.repo,...e.exclude?{exclude:e.exclude}:{}},v,r,u);if(!b.ok)return b;let _=b.value.code,k=tg(i,Ce(r,"design")),x=k?oe(k):null,S=x?.ok&&["Design","Decisions"].map(J=>{let it=Br(Ht(x.value,J)?.body??"").trim();return it?`### ${J}
312
+ ${it}`:null}).filter(J=>J!==null).join(`
313
+
314
+ `)||null,C=tg(i,Ce(r,"tasks")),{done:E,total:U}=C?Ni(C):{done:0,total:0},V=Bd(i,r);V.ok||m.push(...V.problems);let X=Ft(JSON.stringify({files:Kd(i,r),bases:h,commits:_.commits.map(J=>J.id),excluded:_.excluded.map(J=>J.id)}));return T({id:r,...a?{title:a}:{},active:l,gate:d,capabilities:p,design:S,code:_,tests:$k({root:i,change:r,codeRoot:e.codeRoot,specRoot:i}),findings:Ek(i,r,{codeRoot:e.codeRoot,specRoot:i}),template:m,suspects:Dc(i,r).suspects,decisions:V.ok?V.value:[],overlaps:f,tasks:{done:E,total:U},fingerprint:X})}var p$e=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");function L9(e,t,r,i){let n=e;if(t!==null){let c=n.indexOf(t.trimEnd());if(c<0)return null;n=`${n.slice(0,c)}${n.slice(c+t.trimEnd().length)}`.replace(/\n{3,}/g,`
315
+
316
+ `)}if(r===null)return n;let o=new RegExp(`^## ${i}\\s*$`,"m").exec(n);if(!o)return`${n.trimEnd()}
317
+
318
+ ## ${i}
319
+
320
+ ${r.trim()}
321
+ `;let s=n.slice(o.index+o[0].length).search(/^## /m),a=s<0?n.length:o.index+o[0].length+s;return`${n.slice(0,a).trimEnd()}
322
+
323
+ ${r.trim()}
324
+ ${s<0?"":`
325
+ ${n.slice(a)}`}`}function f$e(e,t,r,i,n){let o=e;for(let a of r){let c=(i[a.requirement]??"").trim();if(c!==""&&!new RegExp(`^### ${a.requirement.replace(/[-]/g,"\\-")}\\b`).test(c))return w({code:"overlap-resolution-invalid",message:`The text given for ${a.requirement} must be the whole requirement, starting with "### ${a.requirement} <name>", with its scenarios.`});let l=oe(o);if(!l.ok)return l;let u=xn(l.value),d=[...u.modified,...u.removed].find(f=>f.id===a.requirement);if(a.theirs===null){let f=L9(o,d?.raw??null,c===""?null:c,"Added");if(f===null)return w({code:"overlap-resolution-failed",message:`${a.requirement} could not be found in ${t}'s spec change to resolve it.`});o=f;continue}if(c===""){if(a.ours!==null)return w({code:"overlap-resolution-invalid",message:`${a.requirement} can be left out only by a removal with its reason and migration: keep a text for it, or write the removal in the spec change.`});continue}let p=L9(o,d?.raw??null,c,"Modified");if(p===null)return w({code:"overlap-resolution-failed",message:`${a.requirement} could not be found in ${t}'s spec change to resolve it.`});o=p}let s=oe(o);return s.ok?T(Gt(sr(s.value,{base:n}))):s}function Z9(e){let{tree:t,id:r}=e,i=t.root,n=Mk(e);if(!n.ok)return n;let{gate:o}=n.value;if(o.outcome==="blocked")return w(...o.blocking.map(z=>({code:`finish-${z.id}`,message:z.message,...z.remedy?{remedy:z.remedy}:{}})));if(e.fingerprint===null)return w({code:"finish-no-preview",message:`${r} has not been previewed in this working tree.`,remedy:"Call finish_work without apply first, show the user what it reports, then apply."});if(e.fingerprint!==n.value.fingerprint)return w({code:"finish-changed",message:`${r} or the code linked to it has changed since the preview, so what the user saw is not what would be archived.`,remedy:"Call finish_work without apply again, and show the user the new report."});let s=e.resolved??{},a=n.value.overlaps.filter(z=>s[z.requirement]===void 0);if(a.length>0)return w({code:"finish-overlap-unresolved",message:`${r} changes ${a.map(z=>z.requirement).join(", ")}, which ${a.length===1?"has":"have"} changed since its spec change was written.`,remedy:"Show the user both texts of each, ask which to keep or how to combine them, and pass the result in resolved."});let c=lt(i);if(!c)return w({code:"finish-no-identity",message:"Git has no name and email set for the spec repo, so who archived the change cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then finish again.'});let l=gr(e.home,i,r);if(l&&l.workingTree!==e.codeRoot&&e.activeUnit!==r)return w({code:"finish-claimed-elsewhere",message:`${r} is being worked on in another working tree on this machine: ${l.workingTree}.`,remedy:"Finish it there."});let u=p$e(e.now?.()??new Date),d=[],p=e.pending??new Map,f=We("capability",i);if(!f.ok)return f;let{template:m,source:h,org:g}=f.value,y=new Map(n.value.capabilities.map(z=>[z.code,z]));for(let z of[...new Set(n.value.overlaps.map(pe=>pe.capability))]){let pe=y.get(z),H=Ce(r,"spec-change",z),fe=f$e(tg(i,H)??"",z,n.value.overlaps.filter(Ve=>Ve.capability===z),s,pe.base??0);if(!fe.ok)return fe;let kt=F9(i,z,p),Qt=yO(kt?.text??null,fe.value,z);if(!Qt.ok)return Qt;let L=e.writer.writeFile(H,fe.value);if(!L.ok)return L;y.set(z,{...pe,text:Qt.value})}let v=[];for(let z of y.values()){let pe=Lo(z.code,z.next),H=e.writer.createRecord(pe,z.text);if(!H.ok)return H;let fe=e.writer.createRecord(Ii(z.code,z.next),W_({capability:z.code,version:z.next,hash:Ft(z.text),change:r,archivedBy:c,archivedAt:u,template:{type:m.type,version:m.version,source:h,...g?{org:g}:{}}}));if(!fe.ok)return fe;d.push(pe,Ii(z.code,z.next)),v.push({code:z.code,version:z.next,path:pe}),p.set(z.code,{version:z.next,text:z.text,change:r})}let b=M9(i,e.writer,r,c,u);if(!b.ok)return b;d.push(...b.value);let _=Kd(i,r),k=e.writer.createRecord(eg(r),T9({change:r,versions:Object.fromEntries(v.map(z=>[z.code,z.version])),files:_,archivedBy:c,archivedAt:u}));if(!k.ok)return k;d.push(...Object.keys(_),eg(r));let{code:x,tests:S,findings:C}=n.value,E={unit:r,ancestors:[],repo:e.repo,...x.branch?{branch:x.branch}:{},commits:x.commits.map(z=>({id:z.id,subject:z.subject,by:z.by})),excluded:x.excluded.map(z=>({id:z.id,subject:z.subject})),merged:x.merged,files:x.files,tests:{ranAt:mo(e.codeRoot,i).commit,plans:[],cases:Object.fromEntries(S.map(z=>[z.id,{result:z.status,...z.tests.length>0?{tests:z.tests}:{}}]))},versions:Object.fromEntries(v.map(z=>[z.code,z.version])),requirements:[...y.values()].flatMap(z=>z.own),...e.review!==void 0?{review:e.review}:{},findings:[...C,...n.value.template].map(z=>({code:z.code,message:z.message})),finishedAnyway:e.finishedAnyway===!0,finishedBy:c,finishedAt:u,host:e.host},U=`${vd(r)}/${oo(u,c)}`,V=e.writer.createRecord(U,Gs(E));if(!V.ok)return V;d.push(U);let X=Me(i,d,`archive: ${r}`),J=gr(e.home,i,r)!==null;Bo(e.home,i,r);let it=e.activeUnit===r;return it&&wr(e.codeRoot,{activeUnit:null,activeBranch:null,scope:[]}),T({id:r,...n.value.title?{title:n.value.title}:{},versions:v,archive:eg(r),completion:U,record:E,resolved:n.value.overlaps.map(z=>z.requirement),commit:X,cleared:it,released:J,branch:x.branch})}var g$e=$.object({change:$.string().min(1),title:$.string().optional(),discardedBy:$.string().min(1),discardedAt:$.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),reason:$.string().optional(),ids:$.array($.string().min(1)).default([])}),Lk=e=>`${Et(e)}/${io}`;function y$e(e){let t={change:e.change,...e.title?{title:e.title}:{},discardedBy:e.discardedBy,discardedAt:e.discardedAt,...e.reason?{reason:e.reason}:{},ids:e.ids};return(0,Wd.stringify)(t,{lineWidth:0})}function wN(e,t){let r;try{r=(0,Wd.parse)(e)}catch(n){let o=n instanceof Wd.YAMLParseError?n.message.split(`
326
+ `)[0]:String(n);return w({code:"discard-record-invalid",path:t,message:`${t} is not valid YAML: ${o}`})}let i=g$e.safeParse(r??{});return i.success?T(i.data):w(..._t(i.error.issues,t,"discard-record-invalid"))}function _N(e,t){let r=Lk(t);return B9(Mc(e,r))?wN(bN(Mc(e,r),"utf8"),r):null}function kN(e){let{tree:t,id:r}=e,i=t.root,n=Xt(i,r);if(n==="missing")return w({code:"discard-not-found",message:`There is no change ${r}.`});if(n!=="open")return w({code:`discard-${n}`,path:Et(r),message:`${r} is ${n}: only an open change can be discarded.`});let o=gr(e.home,i,r);if(o&&o.workingTree!==e.codeRoot)return w({code:"discard-claimed-elsewhere",message:`${r} is being worked on in another working tree on this machine: ${o.workingTree}.`,remedy:"Discard it there, or release its claim first."});let s=B9(Mc(i,Ce(r,"proposal")))?oe(bN(Mc(i,Ce(r,"proposal")),"utf8")):null,a=s?.ok&&typeof s.value.frontmatter.title=="string"?s.value.frontmatter.title:void 0,c=[];for(let l of nr(i,r)){let u=oe(bN(Mc(i,Ce(r,"spec-change",l)),"utf8"));if(u.ok)for(let d of xn(u.value).added)c.push(...[d.id,...(d.children??[]).map(p=>p.id)].filter(p=>p!==null))}return T({id:r,...a?{title:a}:{},files:Object.keys(Kd(i,r)),ids:c,active:e.activeUnit===r,claimed:o!==null})}function K9(e){let t=kN(e);if(!t.ok)return t;let r=e.tree.root,i=lt(r);if(!i)return w({code:"discard-no-identity",message:"Git has no name and email set for the spec repo, so who discarded the change cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com.'});for(let l of t.value.files){let u=e.writer.remove(l);if(!u.ok)return u}for(let l of m$e(Mc(r,Et(e.id)),{withFileTypes:!0}))l.isDirectory()&&h$e(Mc(r,Et(e.id),l.name),{recursive:!0,force:!0});let n=e.reason?.trim(),o={change:e.id,...t.value.title?{title:t.value.title}:{},discardedBy:i,discardedAt:(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),...n?{reason:n}:{},ids:t.value.ids},s=Lk(e.id),a=e.writer.createRecord(s,y$e(o));if(!a.ok)return a;let c=Me(r,[...t.value.files,s],`discard: ${e.id}`);return t.value.claimed&&Bo(e.home,r,e.id),t.value.active&&wr(e.codeRoot,{activeUnit:null,activeBranch:null,scope:[]}),T({plan:t.value,record:o,path:s,commit:c})}function W9(e,t){let r=[];for(let i of ir(e).filter(n=>n.state==="discarded")){let n=_N(e,i.id);if(!n?.ok)continue;let o=t.repos.flatMap(s=>(s.units.get(i.id)??[]).map(a=>({...a,repo:s.name})));o.length>0&&r.push({record:n.value,commits:o})}return r}var SN={requirement:"R",scenario:"S"};function Ho(e){let t=We("capability",e);if(!t.ok)return SN;let r=Object.values(t.value.template.sections).find(i=>i.items?.children)?.items;return r?.children?{requirement:r.prefix,scenario:r.children.prefix}:SN}function Y9(e){let t=Ho(e),r=We("spec-change",e);if(!r.ok)return[];let i=[];for(let[n,o]of Object.entries(r.value.template.sections))!o.items||!(o.items.prefix!==t.requirement||o.items.children!==void 0&&o.items.children.prefix!==t.scenario)||i.push({code:"markers-differ",path:r.value.path,message:`${r.value.path}: "${n}" numbers ${o.items.children?"requirements and scenarios":"requirements"} with ${[o.items.prefix,o.items.children?.prefix].filter(Boolean).join(" and ")}, but the capability template uses ${t.requirement} and ${t.scenario}.`,remedy:"Use the same markers in both templates."});return i}var Lc=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");async function Uk(e,t,r,i=SN){let n=k$e(e.root),o=x=>n.has(x),s=[],a=[],c=[],l=new Set(r.newCapabilities??[]);for(let x of l){let S=v$e(e.root,x);S&&c.push(S)}let u=r.changeId??null;if(r.newChange){let{change:x}=t,S=Wh(C=>`${x.prefix}-${C}`,C=>ng(ji(e.root,Sn,C)));s.push({type:"change",draftId:S,floor:_$e(e.root,x.prefix),format:C=>Ln(x,C)}),a.push(S),u=S}if(l.size>0&&!u)return w({code:"capability-no-change",message:"A new capability is created by a change, so name the change or create one with it."});let d=x=>c.some(S=>S.path===on(x)),p=[...l].filter(x=>!d(x)).map(x=>({key:`cap:${x}`,owner:u})),f=r.specChanges.map(({capability:x,text:S})=>({capability:x,plan:d(x)?null:w$e(x,S,i)}));for(let{plan:x}of f)for(let S of x?.slots??[])if(S.kind==="requirement"){let C=`${S.capability}-${i.requirement}`,E=Wh(U=>`${C}${U}`,o);s.push({type:`req:${S.capability}`,draftId:E,floor:H9(n,C),format:U=>`${C}${U}`}),a.push(E)}else{let C=`${S.requirement}-${i.scenario}`,E=Wh(U=>`${C}${U}`,o);s.push({type:`scn:${S.requirement}`,draftId:E,floor:H9(n,C),format:U=>`${C}${U}`}),a.push(E)}let m=await ZO(Ed(e.root,e.config.settings.idsBranch),s,p);if(!m.ok&&m.problems.some(x=>x.code==="claim-taken"))return w(...m.problems.map(b$e));if(!m.ok&&!m.problems.some(x=>x.code.startsWith("counter-")))return m;let h=m.ok?m.value:a,g=m.ok?[]:m.problems,y=m.ok?[]:p.map(({key:x})=>$$e(x.slice(4))),v=0,b=r.newChange?h[v++]:null,_=b?[b]:[],k=f.map(({capability:x,plan:S})=>{if(!S)return null;let C=v;if(v+=S.slots.length,y.some(V=>V.path===on(x)))return null;let E=C,U=S.fill(()=>h[E++]);return _.push(...S.assigned),U});return T({changeId:b,specChanges:k,refused:[...c,...y],assigned:_,offline:g})}function v$e(e,t){let r=on(t);return bc.safeParse(t).success?ng(ji(e,r))?{code:"capability-exists",path:r,message:`There is already a capability ${t}.`,remedy:`Change it with a spec change that modifies ${t}, or choose another code for a new capability.`}:null:{code:"capability-code-invalid",path:r,message:`${t} cannot be a capability's code: a code is 1 to 8 capital letters or digits, starting with a letter, such as AUTH.`}}function $$e(e){return{code:"capability-offline",path:on(e),message:`${e} was not created: a new capability's code is reserved in the number counter, so two people never create the same one, and the counter cannot be reached.`,remedy:`Draft the rest of the change now, and add ${e} once the counter can be reached.`}}function b$e(e){let t=/^cap:(\S+) is already held by (\S+)\.$/.exec(e.message);return e.code!=="claim-taken"||!t?e:{code:"capability-code-taken",path:on(t[1]),message:`The capability code ${t[1]} is already taken by ${t[2]}, which creates a capability with it.`,remedy:"Choose another code for the new capability, or work in that change instead."}}function w$e(e,t,r){let i=new RegExp(`^(###\\s+)${Lc(e)}-${Lc(r.requirement)}(${Lc(ar)}|[0-9A-Za-z]+)(?=\\s|$)`),n=new RegExp(`^(####\\s+)(\\S+)-${Lc(r.scenario)}${Lc(ar)}(?=\\s|$)`),o=t.split(`
327
+ `),s=[],a=null;for(let l of o){let u=i.exec(l);if(u){let d=u[2]===ar;a=d?null:`${e}-${r.requirement}${u[2]}`,d&&s.push({kind:"requirement",capability:e});continue}n.test(l)&&a&&s.push({kind:"scenario",requirement:a})}let c={slots:s,assigned:[],fill(l){let u=null,d=!1,p=0;return o.map(f=>{let m=i.exec(f);if(m){if(p=0,d=m[2]===ar,!d)return u=`${e}-${r.requirement}${m[2]}`,f;let v=l();return u=v,c.assigned.push(v),f.replace(`${e}-${r.requirement}${ar}`,v)}let h=n.exec(f);if(!h||!u)return f;let g=h[2],y=d?`${u}-${r.scenario}${++p}`:l();return c.assigned.push(y),f.replace(`${g}-${r.scenario}${ar}`,y)}).join(`
328
+ `)}};return c}function H9(e,t){let r=new RegExp(`^${Lc(t)}([0-9]+)$`),i=0;for(let n of e){let o=r.exec(n)?.[1];o&&(i=Math.max(i,Number(o)))}return i}function _$e(e,t){let r=ji(e,Sn);if(!ng(r))return 0;let i=new RegExp(`^${Lc(t)}-([0-9]+)$`);return Math.max(0,...J9(r).map(n=>Number(i.exec(n)?.[1]??0)))}function k$e(e){let t=new Set,r=n=>{for(let o of G9(n,"utf8").matchAll(/^#{3,4}\s+([A-Z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)(?=\s|$)/gm))o[1]&&t.add(o[1])},i=(n,o)=>{if(ng(n))for(let s of J9(n,{withFileTypes:!0}))s.name.startsWith(".")||o(ji(n,s.name))};return i(ji(e,jo),n=>i(ji(n,Mn),o=>o.endsWith(".md")&&r(o))),i(ji(e,Sn),n=>i(ji(n,"specs"),o=>o.endsWith(".md")&&r(o))),i(ji(e,Sn),n=>{let o=ng(ji(n,io))?wN(G9(ji(n,io),"utf8"),io):null;if(o?.ok)for(let s of o.value.ids)t.add(s)}),t}var I$e="test-results.json",Q9=e=>x$e(e,po,I$e);function Ei(e){try{let t=JSON.parse(S$e(Q9(e),"utf8"));return t?.version===1&&t.cases&&typeof t.cases=="object"?t:{version:1,cases:{}}}catch{return{version:1,cases:{}}}}function Ok(e,t){let r=Ci(e,t);return[po,...r?[r]:[]]}var mo=(e,t)=>ZB(e,Ok(e,t));function xN(e,t){let r=new Map;for(let i of t.artifacts.values()){if(i.type==="bug"&&r.set(i.id,{plan:i.id,planVersion:null}),i.type!==te.type)continue;let n=ii(e,i);if(n)for(let o of Kt(e,i,n.document))r.set(o.id,{plan:i.id,planVersion:n.version})}return r}var T$e=/-TC[1-9][0-9]*$/;function P$e(e,t){let r=new Map;for(let o of wd(e,t).values()){let{capability:s,version:a,hash:c}=o.requirement;r.set(o.id,{plan:s,planVersion:a,requirementHash:c})}let{requirement:i,scenario:n}=Ho(e);return{known:r,looksLike:new RegExp(`^[A-Z][A-Z0-9]*-${i}[A-Za-z0-9]+-${n}[A-Za-z0-9]+$`)}}function eW(e){let t=xN(e.root,e.index),r=T$e;if(B(e.root).mode==="spec-driven"){let h=P$e(e.root,e.activeUnit??null);for(let[g,y]of h.known)t.set(g,y);r=h.looksLike}let i=Lh(e.root,t.keys()),n=new Map;for(let[h,{match:g}]of Ai(e.root,e.index).matches)if(t.has(h))for(let y of g.tests)n.set(y,[...n.get(y)??[],h]);let o=new Map,s=new Set,a=new Map,c=new Set,l=0,u=0;for(let h of e.tests){let g=AK(h),y=[...new Set([...g.filter(b=>t.has(b)),...g.flatMap(b=>i.get(b)??[])])];for(let b of g){let _=i.get(b);_&&!g.includes(_)&&a.set(_,b)}for(let b of g)!t.has(b)&&!i.has(b)&&r.test(b)&&c.add(b);for(let b of y)s.add(b);let v=(n.get(uk(h))??[]).filter(b=>!y.includes(b));y.length===0&&l++,y.length===0&&v.length>0&&u++;for(let b of[...y,...v])o.set(b,[...o.get(b)??[],h])}let d=mo(e.codeRoot,e.specRoot),p=(e.now??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),f=Ei(e.codeRoot),m=new Map;for(let[h,g]of o){let y=g.some(x=>x.outcome==="failed")?"failed":g.some(x=>x.outcome==="passed")?"passed":"not run",{plan:v,planVersion:b,requirementHash:_}=t.get(h),k={outcome:y,tests:g.map(uk),...s.has(h)?{}:{matched:!0},commit:d.commit,tree:d.tree,plan:v,planVersion:b,..._?{requirementHash:_}:{},report:e.report,at:p};f.cases[h]=k,m.set(h,k)}return f.latest={report:e.report,at:p,tests:e.tests.map(uk)},Nr(Q9(e.codeRoot),`${JSON.stringify(f,null,2)}
329
+ `),{total:e.tests.length,recorded:m,unknown:[...c].sort(),untagged:l,matched:u,viaScenario:a,state:d}}function Jh(e,t,r){if(r.length===0)return new Set;let i=Lh(t,r),o=[...r,...i.keys()].flatMap(l=>["-e",`[${l}]`]),s=Ok(e,t).map(l=>`:(exclude)${l}`),c=(le(e,["grep","--untracked","-I","-F","-o","-h",...o,"--",".",...s])??"").split(`
330
+ `).map(l=>l.trim().slice(1,-1));return new Set(c.map(l=>i.get(l)??l).filter(l=>r.includes(l)))}function Fd(e){let t=uo(e.root,e.index,e.unitId);if(t.length===0)return[];let r=Jh(e.codeRoot,e.specRoot,t.map(s=>s.id)),{matches:i}=Ai(e.root,e.index),n=e.state??mo(e.codeRoot,e.specRoot),o=Ei(e.codeRoot).cases;return t.map(s=>{let a=i.get(s.id)?.match.tests,c={id:s.id,title:s.title,plan:s.plan,planVersion:s.version,own:s.own,...s.regression?{regression:s.regression}:{},...a?{matched:a}:{}},l=o[s.id],u=!l||l.tree===null||l.tree!==n.tree,d=!!l&&l.planVersion!==s.version,p=!!l&&!u&&!d;if(!r.has(s.id)&&!a&&!p)return{...c,status:"no test",tests:[]};if(!l)return{...c,status:"not run",tests:[]};if(!p){let f=d?`the result was for ${s.plan} ${l.planVersion===null?"in draft":`v${l.planVersion}`}, and ${s.version===null?"its draft":`v${s.version}`} applies now`:"the code has changed since the tests ran";return{...c,status:"stale",tests:l.tests,detail:f}}return{...c,status:l.outcome,tests:l.tests,...l.matched?{viaMatch:!0}:{}}})}var X9=e=>e.includes(" > ")?e.slice(0,e.indexOf(" > ")):null;function qk(e,t,r){let i=Ei(r).latest;if(!i)return[];let n=new Set(i.tests),o=new Set(i.tests.map(X9)),s=[];for(let[a,{path:c,match:l}]of Ai(e,t).matches)for(let u of l.tests.filter(d=>!n.has(d)&&o.has(X9(d))))s.push({code:"match-broken",path:c,message:`${a} is matched to "${u}", which is not in the latest test report (${i.report}, ${i.at}): the test was renamed or removed since it was matched.`,remedy:`Tag the test with [${a}] in its name, match ${a} again to the test as the report names it now, or drop the match.`});return s}function tW(e,t){let r=[...e.artifacts.values()].filter(n=>n.type===te.type);if(t===void 0)return r;let i=new Set([t]);for(let n=!0;n;){n=!1;for(let o of e.artifacts.values())o.parent&&i.has(o.parent.id)&&!i.has(o.id)&&o.owner===void 0&&(i.add(o.id),n=!0)}return r.filter(n=>i.has(Bt(n.id)))}function Fk(e,t,r,i){let n=i.flatMap(u=>{let d=ii(e,u);return d?Kt(e,u,d.document).map(p=>({id:p.id,title:p.text,plan:u.id,covers:p.covers??[]})):[]}),{matches:o}=Ai(e,t),s=Jh(r,e,n.map(u=>u.id)),a=n.filter(u=>!s.has(u.id)&&!o.has(u.id)),c=Ei(r).latest,l=null;if(c){let u=xN(e,t),d=Lh(e,u.keys()),p=new Set([...o.values()].flatMap(m=>m.match.tests)),f=m=>[...m.matchAll(/\[([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)\]/g)].some(h=>u.has(h[1])||d.has(h[1]));l=c.tests.filter(m=>!p.has(m)&&!f(m))}return{total:n.length,untested:a,unmatched:l,report:c?{report:c.report,at:c.at}:null}}var rW=e=>[...e.artifacts.values()].filter(t=>{if(t.type!==te.type)return!1;let r=e.artifacts.get(Bt(t.id));return se(e.root,t).onboarded||r!==void 0&&se(e.root,r).onboarded});function A$e(e){return R$e(C$e(e.root,sn))||[...e.artifacts.values()].some(t=>se(e.root,t).onboarded)}function nW(e,t){let r;try{r=so(e,["-c","core.quotePath=false","ls-files","-z"])}catch{return[]}let i=Ci(e,t);return r.split("\0").filter(Boolean).filter(n=>!GB(n)&&n!==cr&&n!==".gitignore"&&!(i&&n.startsWith(`${i}/`)))}function iW(e,t,r,i){if(!A$e(e))return null;let n=Vh(e.root,e,t,i),o=nW(r,e.root),s=rW(e),a=Fk(e.root,e,r,s);return{repo:i,described:o.filter(c=>OO(n,c)).length,total:o.length,tests:s.length>0?{withTest:a.total-a.untested.length,total:a.total}:null,unmatched:a.unmatched?.length??null}}function IN(e,t){if(t===0)return"0%";let r=Math.round(e/t*100);return r===0&&e>0?"under 1%":`${r}%`}var E$e=(e,t)=>ao(e,t)||t.some(r=>ao(r,[e]));function Zk(e,t,r,i,n){let o=Vh(e.root,e,t,i),s=nW(r,e.root),a=[...e.artifacts.values()].flatMap(c=>{let l=se(e.root,c).onboardOpen?c.onboard:void 0;if(!l)return[];let u=l.document.frontmatter.repo,d=typeof u=="string"&&u.trim()!==""?u.trim():null;return[{id:c.id,repo:d,paths:Pd(l.document).map(co)}]});return n.areas.map(c=>{if(c.repo!==i)return{area:c,state:"elsewhere",files:0,described:0,drafts:[]};let l=s.filter(f=>ao(f,c.paths)),u=l.filter(f=>OO(o,f)).length,d=a.filter(f=>(f.repo===null||f.repo===c.repo)&&f.paths.some(m=>E$e(m,c.paths))).map(f=>f.id),p=d.length>0?"drafted":l.length===0?"no code":u===l.length?"onboarded":u>0?"partly":"not started";return{area:c,state:p,files:l.length,described:u,drafts:d}})}var Vk=e=>e.find(t=>t.state==="drafted"||t.state==="partly"||t.state==="not started")??null;function oW(e,t){let r=dt(e,t);if(!r.includes(0))return!1;let i=r.at(-1);for(;i>0;){let n=Fn(e,t,i)?.completes;if(n===void 0)return!1;i=n}return!0}function sW(e){let t=[];for(let r of e.artifacts.values()){if(!oW(e.root,r))continue;let i=ve(e.root,r),n=We(r.type,e.root);if(!i||!n.ok)continue;let o=Ec(i.document,n.value.template);o.length>0&&t.push({record:r,version:i.version,empty:o})}return t.sort((r,i)=>r.record.id.localeCompare(i.record.id,"en",{numeric:!0}))}function Od(e,t,r){let i=se(e,t);if(!(i.draftOpen?aa(t)===i.approvedVersion:i.state==="approved")||!oW(e,t))return r;let o=ve(e,t),s=We(t.type,e);if(!o||!s.ok)return r;let a=Ec(o.document,s.value.template),c=l=>(l.code==="section-missing"||l.code==="section-empty")&&a.some(u=>l.message.includes(`"${u}"`));return r.filter(l=>!c(l))}var z$e=e=>e.charAt(0).toUpperCase()+e.slice(1),jr="{{id}}";function D$e(e,t){for(;;){let r=`${t}-draft-${BigInt(`0x${O$e(4).toString("hex")}`).toString(36).slice(0,4).padStart(4,"0")}`;if(!e.artifacts.has(r))return r}}function M$e(e,t){let r=hr(e),{chain:i,bug:n,adhoc:o}=r.ok?r.value:gt;return[...i,n,o].find(s=>s.type===t)?.prefix??t.toUpperCase()}function ig(e,t){let r=t.trim().toLowerCase().replace(/\s+/g," ");if(r==="bug"||r==="adhoc"||r===te.type)return r;if(B(e.root).mode==="spec-driven"&&!Ks(e.root)){let u=d=>[d,Ch(d),d.replace(/-/g," ")].includes(r);return vc.find(({type:d,name:p})=>u(d)||u(p)||d==="design"&&u("design doc"))?.type??null}if(r==="test plan")return te.type;let i=hr(e),{chain:n,documents:o}=i.ok?i.value:gt,s=u=>u.map(d=>d.toLowerCase()).some(d=>d===r||Ch(d)===r||d.replace(/-/g," ")===r),a=u=>[u.type,u.name,gt.chain.find(d=>d.type===u.type)?.name??u.type],c=n.find(u=>s(a(u)));if(c)return c.type;let l=u=>gt.documents.find(d=>d.type===u)?.name??u;return o.find(u=>s([u.type,u.name,l(u.type),...u.type==="design"?["design doc"]:[]]))?.type??null}function cW(e,t,r){let i=ig(e,r.type);if(!i)return w({code:"draft-unknown-type",message:`There is no artifact type "${r.type}".`});let n=r.version===0;if(n&&i==="adhoc")return w({code:"draft-not-draftable",message:"An ad-hoc unit has no version 0: it is work done in BuildKeel, never code from before it."});if(r.sources&&r.sources.length>0&&!n)return w({code:"draft-sources-not-v0",message:"Sources are kept with version 0 only: what describes code as it was before BuildKeel. Save with version 0, or put what matters from them into the draft itself."});if((i==="bug"||i==="adhoc")&&!r.id&&!n)return w({code:"draft-not-draftable",message:`A ${i==="bug"?"bug":"ad-hoc unit"} gets its permanent ID when it is created, so it is not drafted.`});let o=K(e.root),s=hr(e),a=s.ok?s.value:gt,c=D_(a,i),l,u,d,p,f,m=null,h=!1,g,y=oe(r.content.replaceAll(jr,"PLACEHOLDER"));if(!y.ok)return y;let v=y.value.frontmatter.parent;if(i==="bug"){let z=Nd(e.root,o,y.value.frontmatter,{version0:n});if(!z.ok)return z}if(v!=null){let z=typeof v=="string"?Pn(v):null;if(!z)return w({code:"draft-bad-parent",message:`parent ${JSON.stringify(v)} is not an artifact ID such as EP-01.`});f=z}if(r.id){if(g=o.artifacts.get(r.id),!g)return w({code:"draft-not-found",message:`There is no artifact ${r.id} to update.`});if(g.type!==i){let pe=Re(e.root);return w({code:"draft-wrong-type",message:`${r.id} is ${pe.a(g.type)}, not ${pe.a(i)}.`})}let z=se(e.root,g);if(z.state==="pending")return w({code:"draft-pending",message:`${r.id} is approved and waiting for its number, so it cannot be changed yet.`,remedy:`Approve again with ${ee("approve")} ${r.id} when the spec repo's remote can be reached; it gets its number, and then a new version can be drafted.`});if(n&&z.onboarded)return w({code:"draft-v0-exists",message:`${r.id} already has an approved version 0, and an artifact has one at most.`,remedy:`To change what ${r.id} says, save the whole changed file with id ${r.id} and no version; that opens its next version.`});z.state==="approved"&&!n&&(m=(z.approvedVersion??0)+1),h=!n&&z.state==="approved"&&typeof y.value.frontmatter.completes=="number"&&y.value.frontmatter.completes!==z.approvedVersion,l=g.id,u=i===te.type?g.owner??l.slice(0,-te.idSuffix.length):l,d=n?Z2(Ae(g)):ak(e.root,g),p=n?!z.onboardOpen:!N$e(j$e(e.root,d))}else if(c){let z=c.name;if(!f)return w({code:"draft-missing-parent",message:`${Ws(z)} needs a parent: the artifact it belongs to.`});let pe=o.artifacts.get(f.id);if(!pe)return w({code:"draft-parent-not-found",message:`There is no artifact ${f.id} to attach ${Ws(z)} to.`});if(!Zo(e.root,pe.type))return w({code:"draft-plan-not-allowed",message:`${pe.id} is ${Re(e.root).a(pe.type)}, which has no ${z}. ${z$e(Ch(z))} belong to ${cK(e.root)}.`});if(l=`${pe.id}-${c.suffix}`,o.artifacts.has(l))return w({code:"draft-plan-exists",message:`${pe.id} already has ${Ws(z)}, ${l}. Update it by passing id ${l}${n?" and version 0":""}.`});u=i===te.type?pe.id:l,d=`${aW(pe.path)}/${c.dir}/${n?hc:c.file}`,p=!0}else{let z=B(e.root).types.find(pe=>pe.type===i);if(!z)return w({code:"draft-unknown-type",message:`There is no artifact type "${r.type}".`});l=D$e(o,M$e(e,i)),u=l,d=`${z.dir}/${l}/${n?hc:z.file}`,p=!0}let b=We(i,e.root),_=r.content.replaceAll(jr,u),k=[];if(b.ok&&_.includes(ar)){let z=oe(_,d),pe=g?[g.document,...g.onboard?[g.onboard.document]:[]]:[],H=g?[...dt(e.root,g).flatMap(kt=>an(e.root,g,kt)?.document??[]),...pe]:[],fe=nk([...z.ok?[z.value]:[],...H],b.value.template,u);({text:_,assigned:k}=KB(_,b.value.template,u,fe))}let x=oe(_,d);if(!x.ok)return x;let S=[],C={};if(!c&&x.value.frontmatter.id!==l&&(C.id=l),h&&(C.completes=void 0,S.push({code:"draft-completes-dropped",path:d,message:`The completes field was left out: it said which version an earlier version completed, and v${m} is a version of its own. Set completes to v${(m??1)-1}'s number only if this version just completes it with what version 0 describes.`})),f){let z=o.artifacts.get(f.id);if(!z)S.push({code:"draft-parent-not-found",path:d,message:`The parent ${f.id} does not exist yet.`});else{let pe=se(e.root,z);pe.state==="approved"&&f.version===void 0?(f={id:f.id,version:pe.approvedVersion},C.parent=Yt(f)):pe.state==="draft"&&S.push({code:"draft-parent-draft",path:d,message:`The parent ${f.id} is still a draft. This draft can be approved once ${f.id} is.`,remedy:`Approve ${f.id} first with ${ee("approve")}.`})}}let E=Object.keys(C).length>0?sr(x.value,C):x.value,U;if(n){let z=Ah(E,d);S.push(...z.problems),z.questions.length>0&&(E=kB(E,lt(e.root)??"unknown",new Date().toISOString().replace(/\.\d{3}Z$/,"Z")));let pe=aW(d),H=$K(t,e.root,pe,r.sources??[],{readBy:lt(e.root)??"unknown",readAt:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});if(!H.ok)return H;let fe=Rd(e.root,pe);E=lk(E,fe),U={kept:fe,...H.value}}_.includes(ar)&&S.push({code:"draft-unnumbered",path:d,message:`Some entries still read ${ar}: only entries written as ${u}-<letters>${ar} in a numbered section are numbered.`});let V=t.writeFile(d,Gt(E));if(!V.ok)return V;if(!b.ok)return S.push(...b.problems),T({id:l,type:i,path:d,created:p,notes:S,assigned:k});if(n)return T({id:l,type:i,path:d,created:p,notes:S,assigned:k,empty:Ec(E,b.value.template),...U?{sources:U}:{}});let X=K(e.root),J=X.artifacts.get(l);J&&S.push(...Od(e.root,J,oa(e.root,X,J,b.value)));let it=m!==null&&g?se(e.root,g).draftOpen:!1;return T({id:l,type:i,path:d,created:p,notes:S,assigned:k,...m!==null?{nextVersion:m,opened:it}:{}})}async function uW(e,t,r){if(!e.access.writable)return w(e.access.problem);let i=B(e.root);if(i.mode!=="spec-driven")return w({code:"change-not-spec-driven",message:"Changes belong to Spec-driven trees; this spec tree follows Full SDLC."});if(!i.process.ok)return i.process;if(i.conversion&&!r.id)return w({code:"change-conversion",path:Mt,message:`No new change can be opened: this spec tree is being converted to Full SDLC (${Mt}), and its capability specs are being drafted into the team's stages.`,remedy:`Finish the conversion with ${ee("onboard")}, then plan the work through the stages; or cancel the conversion, if no area is approved yet. Bugs and ad-hoc units work as usual meanwhile.`});if(r.files.length===0)return w({code:"change-no-files",message:"Give at least one file of the change to save."});if(r.id){let h=Xt(e.root,r.id);if(h!=="open")return w(L$e(r.id,h))}else if(!r.files.some(h=>h.type==="proposal"))return w({code:"change-no-proposal",message:"A new change starts with its proposal: say why the change is made and what it changes, then save it with the other files."});let n=[],o=[];for(let h of r.files){let g=(h.type==="design"||h.type==="tasks")&&!h.content.trimStart().startsWith("---")?{...h,content:`---
331
+ ---
332
+
333
+ ${h.content}`}:h,y=oe(g.content.replaceAll(jr,"PLACEHOLDER"),g.type);if(y.ok||o.push(...y.problems.map(b=>({...b,message:`The ${g.type.replace("-"," ")}: ${b.message}`}))),g.type!=="spec-change"){n.push(g);continue}let v=U$e(g.content);if(!v)return w({code:"spec-change-no-capability",message:"A spec change names the capability it changes in its frontmatter, such as capability: AUTH.",remedy:"Add the capability field, then save again."});n.push({...g,capability:v})}if(o.length>0)return w(...o);let s=Z$e(n.map(h=>h.type==="spec-change"?`${h.type}:${h.capability}`:h.type));if(s.length>0)return w({code:"change-file-twice",message:`The save names ${s.map(h=>h.replace("spec-change:","the spec change for ")).join(", ")} twice. Give each file once.`});let a=n.filter(h=>h.type==="spec-change"),c=a.map(h=>h.capability).filter(h=>bc.safeParse(h).success&&!Gd(pa(e.root,on(h)))),l=await Uk(e,i.process.value,{newChange:!r.id,...r.id?{changeId:r.id}:{},newCapabilities:c,specChanges:a.map(({capability:h,content:g})=>({capability:h,text:g}))},Ho(e.root));if(!l.ok)return l;let u=r.id??l.value.changeId,d=[],p=[],f=0,m=[];for(let h of n){let g=h.type==="spec-change"?l.value.specChanges[f++]:h.content;if(g==null)continue;let y=Ce(u,h.type,h.capability),v=h.capability?F$e(e.root,g.replaceAll(jr,u),h.capability,y):q$e(g.replaceAll(jr,u),h.type,u,y);if(!v.ok)return v;m.push({file:h,path:y,content:v.value})}for(let{file:h,path:g,content:y}of m){let v=t.writeFile(g,y);if(!v.ok)return v;d.push({type:h.type,path:g,...h.capability?{capability:h.capability}:{}}),p.push(...pW(e.root,h.type,y,h.capability??u,g)),h.capability&&p.push(...dW(e.root,y,h.capability,g))}return p.push(...B_(e.root,u)),T({id:u,created:!r.id,written:d,assigned:l.value.assigned,notes:p,refused:l.value.refused,offline:l.value.offline})}function Xt(e,t){let r=pa(e,Et(t));return Gd(pa(r,cd))?"archived":Gd(pa(r,io))?"discarded":Gd(r)?"open":"missing"}function L$e(e,t){return t==="missing"?{code:"change-not-found",message:`There is no change ${e}.`}:{code:t==="archived"?"change-archived":"change-discarded",path:Et(e),message:`${e} is ${t}, so its files are its record and never change.`,remedy:"Make the change you want in a new change."}}function U$e(e){let t=oe(e),r=t.ok?t.value.frontmatter.capability:void 0;return typeof r=="string"&&r.trim()!==""?r.trim():null}function q$e(e,t,r,i){let n=oe(e,i);if(!n.ok)return n;if(t==="spec-change")return T(e);let o=t==="proposal"?"id":"parent";return n.value.frontmatter[o]===r?T(e):T(Gt(sr(n.value,{[o]:r})))}function F$e(e,t,r,i){let n=oe(t,i);if(!n.ok)return n;if(n.value.frontmatter.base!==void 0)return T(t);let o=Gd(pa(e,i))?oe(lW(pa(e,i),"utf8"),i):null,s=o?.ok?o.value.frontmatter.base:void 0,a=typeof s=="number"?s:Uo(e,r)?.inForce;return T(a===void 0?t:Gt(sr(n.value,{base:a})))}function V9(e,t){let r=[];for(let i of no){let n=i==="spec-change"?nr(e,t):[void 0];for(let o of n){let s=Ce(t,i,o);if(!Gd(pa(e,s)))continue;let a=lW(pa(e,s),"utf8");r.push(...pW(e,i,a,o??t,s)),o&&r.push(...dW(e,a,o,s))}}return r}function dW(e,t,r,i){let n=oe(t,i);if(!n.ok)return[];let o=Pt(e,r);return AB(n.value,r,o.ok?o.value.document:null,i)}function pW(e,t,r,i,n){let o=We(t,e);if(!o.ok)return o.problems;let s=oe(r,n);return s.ok?Vo(s.value,o.value.template,{itemOwner:i,path:n,offlineIds:!0}):s.problems}var Z$e=e=>e.filter((t,r)=>e.indexOf(t)!==r);function ir(e){let t=TN(e,Sn);return fW(t)?V$e(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>K$e(e,r.name)).sort((r,i)=>r.id.localeCompare(i.id,"en",{numeric:!0})):[]}var Ys=e=>ir(e).filter(t=>t.state==="open");function K$e(e,t){let r=Xt(e,t),i=u=>fW(TN(e,u))?B$e(TN(e,u),"utf8"):null,n=i(Ce(t,"proposal")),o=n?oe(n):null,s=o?.ok&&typeof o.value.frontmatter.title=="string"?o.value.frontmatter.title:void 0;if(r==="discarded"){let u=i(`${Sn}/${t}/${io}`);try{let d=u?(0,mW.parse)(u):null;typeof d?.title=="string"&&(s=d.title)}catch{}}let a=i(Ce(t,"tasks")),{done:c,total:l}=a?Ni(a):{done:0,total:0};return{id:t,state:r,...s?{title:s}:{},capabilities:nr(e,t),done:c,total:l}}import{existsSync as PN,realpathSync as hW}from"node:fs";import{dirname as gW,join as yW,resolve as vW}from"node:path";var W$e=/^[ \t]*BuildKeel-Unit:[ \t]*([A-Za-z0-9][A-Za-z0-9-]*)[ \t]*$/gim;function CN(e){return[...new Set([...e.matchAll(W$e)].map(t=>t[1]))]}var G$e=/^[ \t]*BuildKeel-Task:[ \t]*(\d+(?:\.\d+)+)[ \t]*$/gim;function H$e(e){return[...new Set([...e.matchAll(G$e)].map(t=>t[1]))]}var J$e=process.platform==="win32",og=e=>J$e?e.toLowerCase():e,bW=(e,t)=>{try{return og(hW.native(e))===og(hW.native(t))}catch{return og(vW(e))===og(vW(t))}},$W=e=>og(e.trim().replace(/\\/g,"/").replace(/\.git\/?$/,"").replace(/\/+$/,""));function Y$e(e,t){return $W(e)===$W(t)?!0:PN(e)&&PN(t)&&bW(e,t)}function X$e(e,t){if(!PN(e))return!1;let r=le(e,["rev-parse","--show-toplevel"]);if(!r||!bW(r,e))return!1;if(!t)return!0;let i=le(e,["remote","get-url","origin"]);return i!==null&&Y$e(i,t)}function KO(e,t,r){let i=e.config.repos.map(s=>({name:s.name,...s.remote?{remote:s.remote}:{},...s.baseline?{baseline:s.baseline}:{}}));i.some(s=>s.name===t.repo)||i.unshift({name:t.repo});let n=L_(r),o=n.ok?n.value.repos:{};return i.map(s=>{if(s.name===t.repo)return{...s,dir:t.codeRoot};let c=[o[s.name],yW(gW(t.codeRoot),s.name),yW(gW(e.root),s.name)].filter(l=>!!l).find(l=>X$e(l,s.remote));return{...s,dir:c??null}})}function ua(e,t){let r=/(?:^|\/)bk\/(.+)$/.exec(e)?.[1];return r?t.filter(n=>r===n||r.startsWith(`${n}-`)).sort((n,o)=>o.length-n.length)[0]??null:null}var wW="",RN="",_W="";function Q$e(e,t){let r=[];for(let i of e.split(wW)){let n=i.indexOf(_W);if(n<0)continue;let[o,s,a]=i.slice(0,n).split(RN);if(!o||a===void 0)continue;let c=i.slice(n+1).split(`
334
+ `).map(d=>d.trim()).filter(Boolean),l=t?c.filter(d=>!d.startsWith(`${t}/`)):c;if(c.length>0&&l.length===0)continue;let u=H$e(a);r.push({id:o,subject:a.split(`
335
+ `)[0]?.trim()??"",units:CN(a),...u.length>0?{tasks:u}:{},files:l,time:Number(s)})}return r}var ebe=`--format=${wW}%H${RN}%ct${RN}%B${_W}`,Hd=new Map,tbe=16;function AN(e,t,r,i={}){let n=i.specRoot?Ci(t,i.specRoot):null,o=le(t,["show-ref","--head"]),s=JSON.stringify([e,i.baseline??null,n,i.idsBranch??null,r]),a=Hd.get(t);if(o!==null&&a?.key===s&&a.refs===o)return a.repo;let c=rbe(e,t,r,o??"",n,i);return Hd.delete(t),o!==null&&Hd.set(t,{key:s,refs:o,repo:c}),Hd.size>tbe&&Hd.delete(Hd.keys().next().value),c}function rbe(e,t,r,i,n,o){let s=i.split(`
336
+ `).map(_=>_.slice(_.indexOf(" ")+1)),a=o.baseline&&le(t,["rev-parse","--verify","--quiet",`${o.baseline}^{commit}`]),c={name:e,dir:t,baseline:o.baseline?{commit:o.baseline,found:!!a}:null,commits:new Map,units:new Map,branches:new Map,branchCommits:new Map},l=a?["--not",a]:[],u=s.includes("HEAD")?["HEAD"]:[],d=o.idsBranch,p=[...d?[`--exclude=${d}`]:[],"--branches",...d?[`--exclude=*/${d}`]:[],"--remotes"],f=le(t,["-c","core.quotePath=false","log",...u,...p,"--no-merges","--no-renames","--date-order",ebe,"--name-only",...l]);for(let _ of Q$e(f??"",n))c.commits.set(_.id,_);let m=(_,k,x)=>{let S=c.units.get(_)??[];S.some(C=>C.id===k.id)||S.push({...k,by:x}),c.units.set(_,S)};for(let _ of c.commits.values())for(let k of _.units)m(k,_,"trailer");let h=new Map(i.split(`
337
+ `).map(_=>[_.slice(_.indexOf(" ")+1),_.slice(0,_.indexOf(" "))])),g=_=>_.replace(/^refs\/(heads|remotes)\//,""),y=s.filter(_=>(_.startsWith("refs/heads/bk/")||_.startsWith("refs/remotes/"))&&ua(g(_),r)!==null),v=new Set(y.map(_=>ua(g(_),r)));for(let _ of y){let k=g(_),x=ua(k,r);c.branches.set(x,[...c.branches.get(x)??[],k]);let S=v.size>1?(le(t,["for-each-ref","--format=%(refname)",`--merged=${_}`,...y])??"").split(`
338
+ `).filter(E=>E!==""&&ua(g(E),r)!==x&&h.get(E)!==h.get(_)):[],C=le(t,["log",_,"--no-merges","--format=%H","--not","--exclude=bk/*","--branches","--exclude=*/bk/*","--remotes",...S,...a?[a]:[]]);for(let E of(C??"").split(`
339
+ `).filter(Boolean)){let U=c.commits.get(E);if(!U)continue;let V=c.branchCommits.get(x)??[];V.includes(E)||c.branchCommits.set(x,[...V,E]),U.units.length===0&&m(x,U,"branch")}}let b=new Map([...c.commits.keys()].map((_,k)=>[_,k]));for(let _ of c.units.values())_.sort((k,x)=>x.time-k.time||(b.get(k.id)??0)-(b.get(x.id)??0));return c}var nbe=new Set([cr,".gitignore"]);function sg(e){let t=new Set([...e.branchCommits.values()].flat());return[...e.commits.values()].filter(r=>r.units.length===0&&!t.has(r.id)&&!r.files.every(i=>nbe.has(i)))}function zi(e,t,r,i){let n=[...[...t.artifacts.values()].filter(a=>mr.includes(a.type)).map(a=>a.id),...B(e.root).mode==="spec-driven"||B(e.root).conversion?ir(e.root).map(a=>a.id):[]],o=[],s=[];for(let a of KO(e,r,i)){if(!a.dir){s.push(a.name);continue}o.push(AN(a.name,a.dir,n,{...a.baseline?{baseline:a.baseline}:{},specRoot:e.root,idsBranch:e.config.settings.idsBranch}))}return{repos:o,missing:s}}function Cd(e,t,r,i){let n=t.artifacts.get(i),o=n?Ti(e,n).completions.map(u=>u.record):[],s=new Set(o.flatMap(u=>u.excluded.map(d=>d.id))),a=new Map,c=u=>{let d=a.get(u);if(d)return d;let p={commits:[],files:new Set};return a.set(u,p),p};for(let u of r.repos)for(let d of u.units.get(i)??[]){if(s.has(d.id))continue;let p=c(u.name);p.commits.push({id:d.id,subject:d.subject,by:d.by});for(let f of d.files)p.files.add(f)}for(let u of o){let d=c(u.repo);for(let p of u.commits)d.commits.some(f=>f.id===p.id)||d.commits.push(p);for(let p of u.files)d.files.add(p)}return{repos:[...a.entries()].filter(([,u])=>u.commits.length>0||u.files.size>0).map(([u,d])=>({repo:u,commits:d.commits,files:[...d.files].sort()})).sort((u,d)=>u.repo.localeCompare(d.repo)),missing:[...r.missing].sort()}}function ag(e,t){let r=t;for(let i=0;r&&i<3;i++){if(r.type==="story")return r;if(r.type==="adhoc"||!r.parent)return null;r=e.artifacts.get(r.parent.id)}return null}function kW(e,t,r,i,n){let o=new Set(n),s=new Map,a=(d,p)=>{d===i||!o.has(p)||s.set(d,(s.get(d)??new Set).add(p))};for(let[d,p]of r.units)for(let f of p)for(let m of f.files)a(d,m);for(let d of t.artifacts.values())if(mr.includes(d.type)){for(let{record:p}of Ti(e,d).completions)if(p.repo===r.name)for(let f of p.files)a(d.id,f)}let c=new Map,l=d=>c.get(d.id)??{story:d,files:[],via:[],scopes:[]};for(let[d,p]of s){let f=t.artifacts.get(d),m=f?ag(t,f):null;if(!f||!m)continue;let h=l(m);h.files=[...new Set([...h.files,...p])].sort(),h.via.push({unit:f,files:[...p].sort()}),c.set(m.id,h)}for(let d of t.artifacts.values()){if(d.type!=="story"&&d.type!=="task"||d.id===i)continue;let p=Zh(e,d,r.name),f=p?ag(t,d):null,m=p?n.filter(g=>ao(g,p.paths)):[];if(!p||!f||m.length===0)continue;let h=l(f);h.files=[...new Set([...h.files,...m])].sort(),h.scopes.push({record:d,paths:p.paths.filter(g=>m.some(y=>ao(y,[g]))),files:m}),c.set(f.id,h)}let u=(d,p)=>p.files.length-d.files.length;return[...c.values()].map(d=>({...d,via:d.via.sort((p,f)=>u(p,f)||p.unit.id.localeCompare(f.unit.id,"en",{numeric:!0}))})).sort((d,p)=>u(d,p)||d.story.id.localeCompare(p.story.id,"en",{numeric:!0}))}var EN=(e,t)=>t.type==="epic"||M_(Tt(e.root),t.type)||t.type==="story"&&[...e.artifacts.values()].some(r=>r.type==="task"&&r.parent?.id===t.id),ibe=new Set([...mr,"story"]);function cg(e,t){let r=[],i=new Set([t.id]),n=o=>{for(let s of e.artifacts.values())s.parent?.id!==o||s.owner!==void 0||i.has(s.id)||(i.add(s.id),ibe.has(s.type)&&r.push(s),n(s.id))};return n(t.id),r.sort((o,s)=>o.id.localeCompare(s.id,"en",{numeric:!0}))}function obe(e){let{tree:t,index:r,parent:i}=e,n=t.root,o=y=>`${Cn(t,y.type)} ${y.id}${y.title?` "${y.title}"`:""}`,s=[],a=cg(r,i).map(y=>{let v=ve(n,y)?.version??null,_=y.type==="bug"||se(n,y).state==="approved"?Ke(n,y,y.type==="bug"&&v===null?null:v):null;return{unit:y,version:v,done:_,onboarded:v===0,closed:Oi(n,y),claim:gr(e.home,n,y.id)}});for(let y of a.filter(v=>!v.done&&!v.onboarded&&!v.closed))s.push(sbe(n,r,y,i,o));let c=`${i.id}${te.idSuffix}`,l=r.artifacts.get(c);l&&!ve(n,l)&&s.push({id:"test-plan",passed:!1,message:`The test plan ${c} is not approved.`,remedy:`Approve it with ${ee("approve")} ${c}.`});let u=abe(n,a,e.repo),d=Fd({root:n,index:r,unitId:i.id,codeRoot:e.codeRoot,specRoot:n}).map(y=>{let v=y.status==="no test"?u.get(y.id):void 0;return v?{...y,status:"passed",tests:v.tests,from:v.from}:y});for(let y of d){let v=cbe(y);v&&s.push(v)}let p=ve(n,i),f=p?Fn(n,i,p.version)?.changes??{}:{};for(let[y,v]of Object.entries(f)){let b=r.artifacts.get(y),_=b?dt(n,b).at(-1):void 0;_!==void 0&&_>v||s.push({id:"changes",passed:!1,message:`${i.id} is linked as changing ${b?o(b):y}, which has no newer approved version than v${v}, the one in force when the link was made.`,remedy:`Update ${y} to describe how it works now: save the change with save_draft (id ${y}) and approve it with ${ee("approve")} ${y}; then finish ${i.id} again.`})}let m=new Set([i.id,...a.map(y=>y.unit.id)]);for(let y of yr(n,r).suspects){let v=y.kind==="test-case"?Bt(y.holder.id):y.id;if(!m.has(v)||y.kind==="artifact"&&y.id===i.id)continue;let b=y.kind==="test-case"?`The test case ${y.id} in ${y.holder.id}`:`The ${o(y.holder)}, under ${i.id},`;s.push({id:"suspect",passed:!1,message:`${b} is suspect: ${Go(y)}.`,remedy:`Review it with ${ee("impact")} ${y.id}, and record whether it is still valid or needs change; then finish ${i.id} again.`})}let h=_e(e.codeRoot)?.freshness,g=Ld(h);return g&&h?.status==="behind"&&s.push({id:"stale",passed:!1,warnOnly:!0,message:g,remedy:"Pull the spec repo, then finish again to be sure nothing under it changed."}),{gate:Xi("done",fo(t,"done"),s),children:a,cases:d}}function sbe(e,t,r,i,n){let{unit:o}=r,s=se(e,o),a=(l,u)=>({id:"child-open",passed:!1,message:l,remedy:u});if(o.type!=="bug"&&s.state!=="approved")return a(`The ${n(o)}, under ${i.id}, is not approved${s.state==="pending"?" (its number is pending)":""}, so it is not done.`,`Approve it with ${ee("approve")} ${o.id} and build it; if it is no longer needed, delete its draft from the spec tree.`);if(r.claim)return a(`The ${n(o)}, under ${i.id}, is in progress in ${r.claim.workingTree}${r.claim.branch?` (branch ${r.claim.branch})`:""}.`,`Finish it there with ${ee("done")}, then finish ${i.id} again.`);let c=r.version!==null?Ke(e,o,null):null;return c&&r.version!==null?a(`The ${n(o)}, under ${i.id}, is not finished at v${r.version}; v${c.record.version??"?"} was finished on ${c.record.finishedAt.slice(0,10)}.`,`Start it with ${ee("start")} ${o.id} and finish v${r.version} with ${ee("done")}.`):a(`The ${n(o)}, under ${i.id}, is not finished.`,EN(t,o)?`Finish its own units, then finish it with ${ee("done")} ${o.id}.`:`Start it with ${ee("start")} ${o.id} and finish it with ${ee("done")}.`)}function abe(e,t,r){let i=new Map;for(let n of t)for(let{path:o,record:s}of Ti(e,n.unit).completions)if(s.repo!==r)for(let[a,c]of Object.entries(s.tests.cases))c.result==="passed"&&!i.has(a)&&i.set(a,{tests:c.tests??[],from:{unit:s.unit,repo:s.repo,path:o}});return i}function cbe(e){let t=`${e.id} "${e.title}"`,r=(n,o)=>({id:`test-case-${e.status.replace(" ","-")}`,passed:!1,message:n,remedy:o}),i="run the tests with a JUnit XML report and record it with the BuildKeel test_results tool";switch(e.status){case"passed":return null;case"no test":return r(`${t} has no test tagged [${e.id}] in this repo, and no unit under it that was finished in another repo recorded it as passed.`,`Write a test for it with [${e.id}] in its name in the repo that delivers it, then ${i}.`);case"not run":return r(`${t} has a tagged test but no result here.`,"Run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.");case"stale":return r(`The result of ${t} is stale: ${e.detail??"it no longer matches the code"}.`,"Run the tests again, then record the report with the BuildKeel test_results tool.");case"failed":return r(`${t} fails${e.tests.length>0?`: ${e.tests.join("; ")}`:""}.`,`Fix the code or the test, then ${i}.`)}}async function SW(e,t){let{tree:r,parent:i,index:n}=e,o=ve(r.root,i);if(!o)return w({code:"finish-not-approved",message:`${i.id} is not approved, so there is nothing finished to record.`,remedy:`Approve it with ${ee("approve")} ${i.id}.`});if(o.version===0)return w({code:"finish-onboarded",message:`${i.id} is at version 0: it describes code as it was before BuildKeel, which counts as done. From version 1 it is finished like any other.`});let s=Ke(r.root,i,o.version);if(s)return w({code:"finish-already",message:`${i.id} v${o.version} was already finished on ${s.record.finishedAt.slice(0,10)} by ${s.record.finishedBy} (${s.path}). It is finished once per approved version.`});let a=lt(r.root);if(!a)return w({code:"finish-no-identity",message:"Git has no name and email set for the spec repo, so who finished it cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then finish again.'});let{gate:c,children:l,cases:u}=obe({tree:r,index:n,parent:i,codeRoot:e.codeRoot,repo:e.repo,home:e.home});if(c.outcome==="blocked")return T({kind:"parent-refused",unit:i,gate:c,children:l,cases:u});if(!e.apply)return T({kind:"parent-preview",unit:i,version:o.version,ancestors:t,gate:c,children:l,cases:u,autoPush:r.config.settings.autoPush});let d=mo(e.codeRoot,r.root),p=(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),f={unit:i.id,version:o.version,ancestors:t,repo:e.repo,commits:[],excluded:[],merged:null,files:[],tests:{ranAt:d.commit,plans:[...new Set(u.filter(v=>!v.regression).map(v=>v.planVersion===null?v.plan:`${v.plan}@v${v.planVersion}`))],cases:Object.fromEntries(u.map(v=>[v.id,{result:v.status,...v.tests.length>0?{tests:v.tests}:{},...v.from?{note:`passed in ${v.from.repo}, recorded by ${v.from.unit} (${v.from.path})`}:{}}]))},children:l.flatMap(v=>v.done?[{unit:v.unit.id,...v.done.record.version!==void 0?{version:v.done.record.version}:{},record:v.done.path}]:v.onboarded?[{unit:v.unit.id,version:0,record:Do(Ae(v.unit),0)}]:[]),finishedBy:a,finishedAt:p,host:e.host},m=hd(i,oo(p,a)),h=e.writer.createRecord(m,Gs(f));if(!h.ok)return h;let g=Me(r.root,[m],`done: ${i.id} v${o.version}`),y=g.ok&&r.config.settings.autoPush?await In(r.root):null;return T({kind:"parent-finished",unit:i,record:f,path:m,commit:g,push:y,unpushed:g.ok?rk(r.root):null,gate:c,children:l,cases:u})}var lbe=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");function ON(e,t,r){let i=[],n=new Set([r.id]),o=ve(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id);let a=ve(e,s);i.push(a?`${s.id}@v${a.version}`:s.id),o=a??s}return i}function ube(e,t,r,i,n){if(!r)return null;if(t&&le(e,["merge-base","--is-ancestor",t,r])!==null)return(le(e,["rev-list","--first-parent",r])??"").split(`
340
+ `).includes(t)?t:(le(e,["rev-list","--first-parent","--ancestry-path","--reverse",`${t}..${r}`])??"").split(`
341
+ `).filter(Boolean)[0]??null;let o=le(e,["log",r,"--format=%H%x1f%B%x1e","-i","-F",`--grep=BuildKeel-Unit: ${i}`,...n?["--not",n]:[]])??"";for(let s of o.split("")){let[a,c]=s.trim().split("");if(a&&c!==void 0&&CN(c).includes(i))return a}return null}function $N(e,t,r,i){let n=e.tree.config.repos.find(h=>h.name===e.repo)?.baseline,o=AN(e.repo,e.codeRoot,t,{...n?{baseline:n}:{},specRoot:e.tree.root,idsBranch:e.tree.config.settings.idsBranch}),s=o.units.get(r)??[],a=s.filter(h=>h.by==="branch"),c=[];for(let h of e.exclude??[]){let g=a.filter(y=>y.id.startsWith(h.trim()));if(h.trim().length<4||g.length!==1)return w({code:"finish-exclude-unknown",message:`${h} is not one of the commits on ${r}'s branch without a BuildKeel-Unit line${g.length>1?" (it matches more than one; give more of the ID)":""}.`,remedy:`Leave out only commits from that list${a.length>0?`: ${a.map(y=>y.id.slice(0,7)).join(", ")}`:"; there are none"}.`});c.includes(g[0])||c.push(g[0])}let l=s.filter(h=>!c.includes(h)),u=(o.branchCommits.get(r)??[]).map(h=>o.commits.get(h)).filter(h=>!!h&&h.units.length>0&&!h.units.includes(r)),d=Q_(e.codeRoot),p=i?le(e.codeRoot,["rev-parse","--verify","--quiet",i]):null,f=d&&d!==i?ube(e.codeRoot,p,d,r,i&&p?i:null):null,m=[...new Set(l.flatMap(h=>h.files))].sort();return T({code:{branch:i,commits:l,unstamped:a,otherUnits:u,excluded:c,files:m,merged:f,defaultBranch:d},repo:o})}async function xW(e){let{tree:t,codeRoot:r}=e;if(!t.access.writable)return w(t.access.problem);if(e.unitId){let H=K(t.root),fe=H.artifacts.get(e.unitId);if(fe&&EN(H,fe)){let{writer:kt,repo:Qt,home:L,host:Ve,apply:Ze,now:Ge}=e;return SW({tree:t,writer:kt,codeRoot:r,repo:Qt,home:L,host:Ve,parent:fe,index:H,apply:Ze,...Ge?{now:Ge}:{}},ON(t.root,H,fe))}if(fe&&fe.owner===void 0&&!mr.includes(fe.type)){let kt=Re(t.root);return w({code:"finish-not-finishable",message:`${fe.id} is ${kt.a(fe.type)}, which is not finished itself; the ${kt.many("epic")} under it are.`})}}let i=_e(r),n=i?.activeUnit??null,o=e.unitId??n;if(!o)return w({code:"finish-no-active-unit",message:"There is no active unit in this working tree, so there is nothing to finish here.",remedy:`Start the unit with ${ee("start")} <ID> (it switches to the unit's branch), then finish it.`});if(o!==n){let H=K(t.root).artifacts.get(o)?.type==="bug";return w({code:"finish-not-active",message:`${o} is not the active unit in this working tree${n?`; ${n} is`:""}.`,remedy:`Start ${o} again with ${ee("start")} ${o} (it switches to its branch), run its tests, then finish it.${H?" If it is not a defect (a duplicate, one that cannot be reproduced, behavior that works as intended, or a wrong test), it can instead be closed without a fix, with no need to start it: ask the user, then call finish_work with close.":""}`})}let s=K(t.root),a=s.artifacts.get(o);if(!a)return w({code:"finish-not-found",message:`There is no artifact ${o}.`});let c=ve(t.root,a)?.version??null,l=Ke(t.root,a,c);if(l)return w({code:"finish-already",message:`${o}${c?` v${c}`:""} was already finished on ${l.record.finishedAt.slice(0,10)} by ${l.record.finishedBy} (${l.path}). A unit is finished once per approved version.`,remedy:`Save a change to ${o} with save_draft and approve the new version with ${ee("approve")} ${o}; then it can be started and finished again.`});let u=lt(t.root);if(!u)return w({code:"finish-no-identity",message:"Git has no name and email set for the spec repo, so who finished the unit cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then finish again.'});let d=i?.activeBranch??null,p=mo(r,t.root),{gate:f,cases:m}=x9({tree:t,index:s,unit:a,codeRoot:r,branch:d,freshness:i?.freshness,state:p});if(f.outcome==="blocked")return T({kind:"refused",unit:a,gate:f,cases:m});let h=[...s.artifacts.values()].filter(H=>mr.includes(H.type)).map(H=>H.id),g=$N(e,h,o,d);if(!g.ok)return g;let y=g.value.code,v=a.type==="bug"&&!a.parent;if(!e.apply){let H=v?kW(t.root,s,g.value.repo,o,y.files):[];return T({kind:"preview",unit:a,version:c,ancestors:ON(t.root,s,a),gate:f,cases:m,code:y,autoPush:t.config.settings.autoPush,suggestions:H})}let b=[],_=null;if(e.attach){if(!v)return w({code:"finish-attach-not-standalone",message:a.type==="bug"?`${o} is already attached to ${a.parent?.id}.`:`${o} is not a bug; only a standalone bug is attached as it is finished.`});let H=Nd(t.root,s,{parent:e.attach});if(!H.ok)return H;let fe=Yt(H.value.parent),kt=e.writer.writeFile(a.path,Gt(sr(a.document,{parent:fe})));if(!kt.ok)return kt;b.push(a.path),_=fe,s=K(t.root),a=s.artifacts.get(o)??a}let k=ON(t.root,s,a),x=gr(e.home,t.root,o)?.documents??kk(t.root,s,Tt(t.root),[a,...hN(t.root,s,a)]),S=[...new Set(m.filter(H=>!H.regression).map(H=>H.planVersion===null?H.plan:`${H.plan}@v${H.planVersion}`))],C=lbe(e.now?.()??new Date),E={unit:o,...c!==null?{version:c}:{},ancestors:k,...Object.keys(x).length>0?{documents:x}:{},repo:e.repo,...d?{branch:d}:{},commits:y.commits.map(H=>({id:H.id,subject:H.subject,by:H.by})),excluded:y.excluded.map(H=>({id:H.id,subject:H.subject})),merged:y.merged,files:y.files,tests:{ranAt:p.commit,plans:S,cases:Object.fromEntries(m.map(H=>[H.id,{result:H.status,...H.tests.length>0?{tests:H.tests}:{},...!H.own&&H.status==="no test"?{note:"left for the story"}:{}}]))},finishedBy:u,finishedAt:C,host:e.host},U=Ei(r).latest?.tests??[],V=a.type==="bug"&&a.parent?uo(t.root,s,a.parent.id).filter(H=>!m.some(fe=>fe.id===H.id)):[],X=TK({root:t.root,writer:e.writer,index:s},[...m,...V.map(H=>({id:H.id,tests:U}))],U);if(!X.ok)return X;b.push(...X.value.paths);let J=hd(a,oo(C,u)),it=e.writer.createRecord(J,Gs(E));if(!it.ok)return it;let z=Me(t.root,[...b,J],`done: ${o}${c!==null?` v${c}`:""}`),pe=z.ok&&t.config.settings.autoPush?await In(t.root):null;return Bo(e.home,t.root,o),wr(r,{activeUnit:null,activeBranch:null,scope:[]}),T({kind:"finished",unit:a,record:E,path:J,commit:z,push:pe,unpushed:z.ok?rk(t.root):null,gate:f,cases:m,code:y,attached:_,droppedMatches:X.value.dropped})}function fa(e,t={}){if(!e)return[];let{behind:r=!0,suspects:i=!0,unpushed:n=!0}=t,o=[],s=e.freshness;s?.status==="behind"&&r&&o.push(`- The spec tree was ${s.behind} commit${s.behind===1?"":"s"} behind ${s.upstream} at the last check (${s.checkedAt}). Pull the spec repo to see the latest approvals; work can continue meanwhile.`),s?.status==="failed"&&o.push(`- The last check of whether the spec tree is up to date failed (${s.reason}); work continues with the local copy.`);let a=e.suspects??[];if(i&&a.length>0){let u=a.slice(0,5).join(", "),d=a.length>5?`, and ${a.length-5} more`:"";o.push(e.mode==="spec-driven"?`- ${a.length} ${a.length===1?"item is":"items are"} suspect, built against an older capability version that changed what ${a.length===1?"it relies":"they rely"} on: ${u}${d}. Review them with {{bk:impact}}; nothing waits for them.`:`- ${a.length} ${a.length===1?"item is":"items are"} suspect, built against an older version of something that has changed: ${u}${d}. Review them with {{bk:impact}}; work under a suspect artifact cannot start.`)}let c=e.unpushedApprovals??0,l=e.unpushedCompletions??0;if(n&&c+l>0){let u=[...c?[`${c} approval${c===1?"":"s"}`]:[],...l?[`${l} completion${l===1?"":"s"}`]:[]],d=c+l;o.push(`- ${u.join(" and ")} ${d===1?"is":"are"} committed in the spec repo but not pushed. Push it to share ${d===1?"it":"them"}.`)}return o.length>0?["","Also in the spec tree:",...o]:[]}function D(e,t){return[e,...t.flatMap(r=>[`- ${r.message}`,...r.remedy?[` To fix: ${r.remedy}`]:[]])].join(`
342
+ `)}var TW=e=>e.slice(0,7),IW=(e,t)=>`${e} ${t}${e===1?"":"s"}`,NN=e=>`- ${TW(e.id)} ${e.subject}`;function Bk(e,t){let r=[],i=e.commits.filter(o=>o.by==="trailer"),n=e.unstamped.filter(o=>!e.excluded.includes(o));if(r.push(`Commits for the unit in ${t}: ${e.commits.length}.`),i.length>0&&r.push("Stamped with its BuildKeel-Unit line:",...i.map(NN)),e.unstamped.length>0){let o=e.unstamped.length===1;r.push("",`${IW(e.unstamped.length,"commit")} on ${e.branch} ${o?"has":"have"} no BuildKeel-Unit line. ${o?"It counts":"They count"} for the unit unless the user leaves ${o?"it":"them"} out:`),r.push(...e.unstamped.map(s=>`${NN(s)}${e.excluded.includes(s)?" (left out)":""}`)),n.length!==e.unstamped.length&&r.push(`${IW(e.excluded.length,"commit")} left out.`)}return e.otherUnits.length>0&&(r.push("","Stamped with another unit, so left with it:"),r.push(...e.otherUnits.map(o=>`${NN(o)} [${o.units.join(", ")}]`))),r.push("",`Files: ${e.files.join(", ")||"none"}`),r.push(e.merged?`Already merged into ${e.defaultBranch}: ${TW(e.merged)}.`:`Not merged into ${e.defaultBranch??"the default branch"} yet; the record is written before the merge and stays valid after a squash.`),r}import{readFileSync as bbe}from"node:fs";import{join as wbe}from"node:path";var Kk=Lt(Vt(),1);import{readFileSync as dbe}from"node:fs";import{join as pbe}from"node:path";var fbe="guide.yaml",PW=e=>pbe(e,fbe);function RW(e){try{let t=(0,Kk.parse)(dbe(PW(e),"utf8"));return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(r=>r[1]==="on"||r[1]==="off"||r[1]==="done"))}catch{return{}}}function Wk(e,t){return RW(e)[jd(t)]??null}function Gk(e,t,r){Nr(PW(e),(0,Kk.stringify)({...RW(e),[jd(t)]:r}))}var CW={drafted:"Guide: in a line or two, say that the proposal records why this change is made and what it changes, that the spec changes say how it alters the capability specs, requirement by requirement, and that the tasks come next, then building them.",started:"Guide: in a line or two, say that the change is now the active unit on its own branch, that commits will name it, and that the next step is building its tasks one by one.",tested:"Guide: in a line or two, say that each test carries a scenario's ID, so its result shows against that scenario, and that finishing the change comes once the tasks are done.",finishing:"Guide: in a line or two, say that finishing reviews the code against the change and then archives it, giving each capability spec it touches its next version; nothing is written until the user chooses.",finished:"Guide: in a line or two, say that the change is archived and the capability specs now describe the system with it, and that this was the last guided step: from now on, no more explaining."};function Jo(e,t,r){let{root:i}=t.tree;return B(i).mode!=="spec-driven"||Wk(e.home,i)!=="on"?[]:["",CW[r]]}import{existsSync as mbe,readFileSync as hbe}from"node:fs";import{isAbsolute as gbe,relative as ybe,resolve as vbe,sep as $be}from"node:path";var Zt=e=>e;var EW=Zt({name:"test_results",title:"Record test results",description:"Read a JUnit XML test report and record, for this working tree, each test case's local result: tests are matched to test cases by the ID in square brackets in their name, such as [US-001-TC2], or by a recorded match naming an existing test that has no tag yet. Run the tests with a JUnit XML reporter first (for example vitest --reporter=junit --outputFile=<file>, pytest --junitxml=<file>, node --test --test-reporter=junit --test-reporter-destination=<file>) and pass the file's path. Returns where every test case of the active unit stands: passed, failed, not run, stale (the code or the plan changed since the run) or no tagged test. Leave out path to see where they stand without reading a report. In a Spec-driven tree, tests are tagged with scenario IDs instead, such as [AUTH-R3-S1], and a result is also stale once the scenario's requirement changes.",inputSchema:{path:$.string().optional().describe("The JUnit XML report, relative to the repository root or absolute.")},readOnly:!1,run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value,{codeRoot:o}=n,s=K(i.root),a=B(i.root).mode==="spec-driven",c=[],l;if(t.path){let g=vbe(o,t.path);if(!mbe(g))return`There is no file at ${g}. Run the tests with a JUnit XML reporter first, then pass the report's path.`;let y=EK(hbe(g,"utf8"),t.path);if(!y.ok)return D("The report could not be read.",y.problems);let v=ybe(o,g),b=v.startsWith("..")||gbe(v)?g:v.split($be).join("/"),_=eW({root:i.root,index:s,codeRoot:o,specRoot:i.root,report:b,tests:y.value,activeUnit:_e(o)?.activeUnit??null});l=_.state;let k=y.value.length-_.untagged;if(c.push(`Read ${b}: ${AW(y.value.length,"test")}, ${k} tagged with ${a?"a scenario":"a test case"}${_.matched>0?`, ${_.matched} matched to one by a recorded match`:""}. Results are recorded for this working tree only (local results).`),_.viaScenario.size>0){let x=[..._.viaScenario].map(([S,C])=>`[${C}] counted for ${S}`);c.push(`Tagged with the scenario a test case was converted from: ${x.join(", ")}. When you next change one of these tests, retag it with the test case's ID.`)}if(_.unknown.length>0){let x=a?"scenarios of any capability or open change":"test cases in any plan";c.push(`Tags that are not ${x}: ${_.unknown.map(S=>`[${S}]`).join(", ")}. Check them for typos.`)}}let u=_e(o)?.activeUnit??null;if(u&&e.refreshHookCache(r.value),!u)return c.push(...c.length>0?[""]:[],"There is no active unit in this working tree, so no unit's test cases are shown. Start one with {{bk:start}}."),c.join(`
343
+ `);let d=a&&Xt(i.root,u)==="open",p=d?$k({root:i.root,change:u,codeRoot:o,specRoot:i.root,...l?{state:l}:{}}):Fd({root:i.root,index:s,unitId:u,codeRoot:o,specRoot:i.root,...l?{state:l}:{}}),f=p.filter(g=>g.status==="passed").length,m=p.filter(g=>g.status==="failed").length,h=p.length-f-m;return p.length>0&&c.unshift(`${u}: ${f} of ${AW(p.length,d?"scenario":"test case")} ${f===1?"passes":"pass"}${m>0?`, ${m} ${m===1?"fails":"fail"}`:""}${h>0?`, ${h} without a current passing or failing result`:""}.`),c.length>0&&c.push(""),c.push(...d?jN(u,p):Hk(u,p,Re(i.root).one("story"))),d&&t.path&&c.push(...Jo(e,r.value,"tested")),c.join(`
344
+ `)}}),AW=(e,t)=>`${e} ${t}${e===1?"":"s"}`,OW={passed:"passed",failed:"failed","not run":"not run: tagged in the code, but not in any report since",stale:"stale","no test":"no tagged test"};function Hk(e,t,r="story"){if(t.length===0)return[`No test cases apply to ${e}.`];let i=[`Test cases of ${e} (local results):`],n=o=>{let s=o.regression?" (regression test)":o.own?"":` (from ${o.plan})`,a=o.status==="stale"?`: ${o.detail}`:o.status==="failed"&&o.tests.length>0?`: ${o.tests.join("; ")}`:"",c=!o.own&&o.status==="no test"?`, left for the ${r}`:"",l=o.matched&&o.status==="not run"?`not run: matched to ${o.matched.join("; ")}, which is not in any report since`:OW[o.status],u=o.viaMatch?", through its recorded match":"";return`- ${o.id} ${o.title}${s}: ${l}${a}${u}${c}`};return i.push(...t.filter(o=>o.own).map(n),...t.filter(o=>!o.own).map(n)),i}function jN(e,t){if(t.length===0)return[`${e} has no scenarios: it has no spec change.`];let r=s=>{let a=s.status==="stale"?`: ${s.detail}`:s.status==="failed"&&s.tests.length>0?`: ${s.tests.join("; ")}`:"";return`- ${s.id} ${s.title}: ${OW[s.status]}${a}`},i=t.filter(s=>s.own),n=t.filter(s=>!s.own),o=[`Scenarios of ${e} (local results):`,...i.length>0?i.map(r):["- none: it adds or modifies no requirement"]];return n.length>0&&o.push(`Other scenarios of ${[...new Set(n.map(s=>s.plan))].join(", ")}, which ${e} leaves as they are:`,...n.map(r)),o}var _be="finish-previews.json",DW=e=>wbe(e,po,_be);function zN(e){try{let t=JSON.parse(bbe(DW(e),"utf8"));return t&&typeof t=="object"?t:{}}catch{return{}}}function NW(e,t){Nr(DW(e),`${JSON.stringify(t,null,2)}
345
+ `)}var kbe=e=>[...new Set(e)].sort((t,r)=>t.localeCompare(r,"en",{numeric:!0}));function MW(e,t,r,i){let n=r&&r.length>0?r:t?[t]:null;return n?n.every(o=>Xt(e,o)!=="missing")?n:null:i&&Xt(e,i)!=="missing"?[i]:null}function LW(e){let t=Ys(e.tree.root);if(t.length===0)return"There is no active unit in this working tree, and no open change to finish.";let r=t.filter(s=>s.total>0&&s.done===s.total),i=s=>`- ${s.id}${s.title?` "${s.title}"`:""}: ${s.done} of ${s.total} tasks done`,n=["There is no active unit in this working tree. Open changes:"];r.length>0&&n.push("Every task ticked:",...r.map(i));let o=t.filter(s=>!r.includes(s));return o.length>0&&n.push("Tasks left:",...o.map(i)),n.push("","Ask the user which to finish (those with every task ticked are the usual choice; several can be finished in one run), then call finish_work with ids."),n.join(`
346
+ `)}async function UW(e,t,r){let{tree:i,resolved:n}=t,{codeRoot:o}=n,s=_e(o),a={tree:i,codeRoot:o,repo:n.pointer.repo,activeUnit:s?.activeUnit??null,activeBranch:s?.activeBranch??null},c=kbe(r.ids),l=xbe(t,c,r.exclude??[]);if(!l.ok)return D("The changes cannot be finished.",l.problems);let u=new Map;if(!r.apply){let y=[];for(let v of c){let b=Mk({...a,id:v,pending:u,...l.value[v]?{exclude:l.value[v]}:{}});if(!b.ok)return D(`${v} cannot be finished.`,b.problems);y.push(b.value);for(let _ of b.value.capabilities)u.set(_.code,{version:_.next,text:_.text,change:v})}return NW(o,{...zN(o),...Object.fromEntries(y.map(v=>[v.id,v.fingerprint]))}),[Pbe(y,i.config.settings.autoPush),...Jo(e,t,"finishing")].join(`
347
+ `)}let d=zN(o),p=[],f=e.writer(t);for(let y of c){let v=gr(e.home,i.root,y)?.claimedAt,b=Z9({...a,id:y,pending:u,writer:f,home:e.home,host:e.host,fingerprint:d[y]??null,...l.value[y]?{exclude:l.value[y]}:{},...r.review?.[y]!==void 0?{review:r.review[y]}:{},finishedAnyway:r.finishedAnyway?.includes(y)??!1,...r.resolved?{resolved:r.resolved}:{}});if(!b.ok){let _=p.length>0?[`Archived before it: ${p.map(k=>k.id).join(", ")}.`,""]:[];return p.length>0&&e.refreshHookCache(t),[..._,D(`${y} was not archived.`,b.problems)].join(`
348
+ `)}p.push(b.value),Sbe(e,t,b.value,v),a.activeUnit=_e(o)?.activeUnit??null}let m=zN(o);for(let y of p)delete m[y.id];NW(o,m),e.refreshHookCache(t);let h=p.map(y=>Rbe(y)),g=Jo(e,t,"finished");if(g.length>0&&(Gk(e.home,i.root,"done"),e.usage(t,{event:"guide",state:"done"}),e.refreshHookCache(t),h.push(g[1])),p.some(y=>y.commit.ok))if(i.config.settings.autoPush){let y=await In(i.root);h.push(y.ok?"Pushed the spec repo.":`Not pushed: ${y.problems[0]?.message??""} Push the spec repo when you can.`)}else h.push("The spec repo is not pushed: push it to share the new versions.");return h.join(`
349
+
350
+ `)}function Sbe(e,t,r,i){let{record:n}=r,o=i?Math.max(0,Math.round((Date.parse(n.finishedAt)-Date.parse(i))/1e3)):void 0;e.usage(t,{event:"change",unit:r.id,action:"finished",...o!==void 0?{seconds:o}:{}});let s={};for(let c of n.findings??[])s[c.code]=(s[c.code]??0)+1;let a=Object.values(n.tests.cases).map(c=>c.result);e.usage(t,{event:"finish-report",unit:r.id,findings:s,gaps:a.filter(c=>c==="no test").length,failing:a.filter(c=>c==="failed").length,finishedAnyway:n.finishedAnyway===!0})}function xbe(e,t,r){if(r.length===0)return T({});if(t.length===1)return T({[t[0]]:r});let i=_e(e.resolved.codeRoot),n={},o=[];for(let s of r){let a=t.filter(c=>{let l=Mk({tree:e.tree,codeRoot:e.resolved.codeRoot,repo:e.resolved.pointer.repo,id:c,activeUnit:i?.activeUnit??null,activeBranch:i?.activeBranch??null});return l.ok&&l.value.code.unstamped.some(u=>u.id.startsWith(s.trim()))});a.length!==1?o.push({code:"finish-exclude-unknown",message:`${s} is not a commit without a BuildKeel-Unit line on the branch of exactly one of ${t.join(", ")}.`}):(n[a[0]]??=[]).push(s)}return o.length>0?w(...o):T(n)}var DN=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function Ibe(e){let t=[];for(let r of e.capabilities){let i=oe(r.text),n=i.ok?Jt(i.value):[],o=r.base===null?"a new capability":`merged onto v${r.base}`;if(t.push("",`### ${r.code} v${r.next} (${o})`),r.base===null&&i.ok){let s=Ht(i.value,"Purpose")?.body.trim();s&&t.push(`Purpose: ${s}`)}for(let s of n){let a=r.own.includes(s.id??"");t.push(a?`
351
+ ${s.raw.trim()}`:`- ${s.id} ${s.text} (unchanged)`)}r.removed.length>0&&t.push(`Removed: ${r.removed.join(", ")}`)}return t}var jW=(e,t)=>e.length===0?[t]:e.map(r=>`- ${r.message}`);function Tbe(e,t){let r=`${e.id}${e.title?` "${e.title}"`:""}`;if(e.gate.outcome==="blocked")return[nn(e.gate,`finish of ${e.id}`)];let i=[`## ${r}: ${e.tasks.done} of ${DN(e.tasks.total,"task")} done`,"Finishing will:"];for(let o of e.capabilities)i.push(`- write ${o.code} v${o.next}${o.base===null?", a new capability":`, merging its spec change onto v${o.base}`}`);e.capabilities.length===0&&i.push("- write no capability version: it has no spec change"),i.push("- freeze the change: an archive record with the hash of every file, and its completion record"),i.push(`- commit them once as "archive: ${e.id}" in the spec repo${t?", then push":", without pushing"}`),i.push(e.active?"- release its claim and clear the active unit here; the code branch is left as it is":"- release its claim on this machine, if it has one"),i.push("","Requirements and scenarios after the merge:",...Ibe(e)),i.push("",e.design?`Design to review the code against:
352
+ ${e.design}`:"Design: none."),i.push("",...Bk(e.code,"this repo")),i.push("",...jN(e.id,e.tests));let n=e.tests.filter(o=>o.status==="no test");n.length>0&&i.push(`Gaps (scenarios with no tagged test): ${n.map(o=>o.id).join(", ")}. Reported, never blocking.`),i.push("","Consistency check:",...jW(e.findings,"- nothing found")),i.push("","Template check:",...jW(e.template,"- nothing missing")),i.push("","Suspects archiving would raise:"),e.suspects.length===0&&i.push("- none");for(let o of e.suspects){let s=o.kind==="test"?`tests of ${o.id} (${(o.tests??[]).join("; ")})`:`${o.id}${o.title?` "${o.title}"`:""}`,a=o.finished?`; its work: ${o.finished.commits.map(u=>u.id.slice(0,7)).join(", ")||"no commits"} \xB7 ${o.finished.files.join(", ")||"no files"}`:"",c=e.decisions.find(u=>u.suspect===o.id&&u.holder===o.holder),l=c?c.decision==="still-valid"?" (decided: still valid)":` (decided: needs change, task ${c.task??"added"})`:"";i.push(`- ${s}: ${jk(o)}${a}${l}`)}e.suspects.length>0&&i.push(e.suspects.every(o=>e.decisions.some(s=>s.suspect===o.id&&s.holder===o.holder))?"Each is decided: archiving re-pins them, so none becomes suspect.":"Any not decided becomes suspect once the change is archived; {{bk:impact}} decides them first."),i.push("","Overlaps with changes archived since its spec changes were written:"),e.overlaps.length===0&&i.push("- none");for(let o of e.overlaps)i.push(`- ${o.requirement}: written against ${o.capability} v${o.written}; ${o.by??"another change"} changed it in v${o.current}.`),i.push(` In ${o.capability} v${o.current}:`,zW(o.theirs??"(removed)"),` In ${e.id}:`,zW(o.ours??"(removed)"));return i}var zW=e=>e.split(`
353
+ `).map(t=>` ${t}`).join(`
354
+ `);function Pbe(e,t){let r=e.filter(o=>o.gate.outcome==="blocked"),i=[];e.length>1&&i.push(`Finishing ${e.map(o=>o.id).join(", ")}, oldest first: each is merged onto the versions the ones before it write, and archived in its own commit.`,"");for(let o of e)i.push(...Tbe(o,t),"");if(r.length>0)return i.push(`Nothing has been written. Fix what stops ${r.map(o=>o.id).join(", ")}, then preview again.`),i.join(`
355
+ `).trimEnd();let n=e.some(o=>o.overlaps.length>0);return i.push("Nothing has been written yet. What to do now:",'1. Review the code linked above against the requirements and scenarios after the merge, and the design. Write a short report headed "My review (a judgment, not a check)": which scenarios the code implements, which it does not, and anything at odds with the design.',"2. Show the user your review with the gaps, failing or stale tests, consistency and template findings, suspects and overlaps above.",...n?['3. For each overlap, show both texts and ask which to keep or how to combine them. Pass each result in resolved, by requirement ID: the whole requirement with its scenarios, or "" to leave it out where one side removed it.']:[],`${n?"4":"3"}. Ask the user to choose: Fix first, or Finish anyway. Fix first is the default when your review or the checks report something missing (a scenario not implemented, a gap, a failing test); otherwise Finish is the default, offered as Finish. Nothing stops the finish.`,`${n?"5":"4"}. To finish, call finish_work again with apply=true, the same ids, review set to your report for each change by ID, and finishedAnyway listing any change finished although something was reported missing. With fix first, help fix it, then preview again.`),i.join(`
356
+ `)}function Rbe(e){let r=[`Archived ${`${e.id}${e.title?` "${e.title}"`:""}`}.`];for(let i of e.versions)r.push(`- Wrote ${i.code} v${i.version} (${i.path}), naming ${e.id}.`);return e.versions.length===0&&r.push("- It had no spec change, so no capability version was written."),e.resolved.length>0&&r.push(`- Wrote ${e.resolved.join(", ")} as resolved, in the spec change and the new version.`),r.push(`- Froze the change: ${e.archive}, and its completion record ${e.completion} (${DN(e.record.commits.length,"commit")}, ${DN(e.record.files.length,"file")}).`),e.record.finishedAnyway&&r.push("- Recorded that it was finished anyway, with what was reported."),e.commit.ok?r.push(`- Committed as "archive: ${e.id}" (${e.commit.value.slice(0,7)}) in the spec repo.`):r.push(`- Written but not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),e.cleared?r.push("- Released its claim; there is no active unit in this working tree now."):e.released&&r.push("- Released its claim on this machine."),e.branch&&r.push(`- The branch ${e.branch} is unchanged: push it and open a pull request as usual.`),r.join(`
357
+ `)}function Jk(e,t,r=()=>"",i=()=>null){let n=hr(e),o=new Map([[te.type,"test plan"]]);if(n.ok){for(let f of n.value.chain)o.set(f.type,f.name);o.set("bug",n.value.bug.name),o.set("adhoc",n.value.adhoc.name);for(let f of n.value.documents)f.type!==te.type&&o.set(f.type,f.name)}let s=new Map,a=[];for(let f of t.artifacts.values()){let m=f.parent&&t.artifacts.has(f.parent.id)?f.parent.id:null;m?s.set(m,[...s.get(m)??[],f]):a.push(f)}let c=f=>{if(f.type!==te.type)return o.get(f.type)??f.type;let m=t.artifacts.get(Bt(f.id))?.type??"",h=Zo(e.root,m);return h?Rc[h]:"test plan"},l=f=>{let m=i(f);if(m)return m;let h=se(e.root,f),g=hK(e.root,f);if(f.type!=="bug"&&f.type!=="adhoc"||h.onboarded||h.onboardOpen)return`${pd(h)}${g?` (${g})`:""}`;let y=Ko(e.root,f);if(y)return y.ok?Wo(y.value):"closed";let v=Ke(e.root,f,null);return v?`done on ${v.record.finishedAt.slice(0,10)}`:"open"},u=(f,m)=>f.id.localeCompare(m.id,"en",{numeric:!0}),d=[],p=(f,m)=>{let h=f.title?` "${f.title}"`:"";d.push(`${" ".repeat(m)}${f.id} ${c(f)}${h}: ${l(f)}${r(f)}`);for(let g of(s.get(f.id)??[]).sort(u))p(g,m+1)};for(let f of a.sort(u))p(f,0);return d}function ma(e,t){let{tree:r,resolved:i}=e,n=K(r.root),o=_e(i.codeRoot),s=o?.activeUnit??null,a=[...n.artifacts.values()].filter(p=>pN.includes(p.type)).filter(p=>p.type!=="story"||![...n.artifacts.values()].some(f=>f.type==="task"&&f.parent?.id===p.id)).sort((p,f)=>p.id.localeCompare(f.id,"en",{numeric:!0})),c=p=>`${p.id} ${Cn(r,p.type)}${p.title?` "${p.title}"`:""}`,l={units:a,ready:[],waiting:[],finished:[]},u=qd(i.codeRoot,r.root,n),d=yr(r.root,n).suspects;for(let p of a){let f=u.get(p.id);if(f){l.finished.push(`- ${c(p)}: finished on its branch ${f}, not merged yet`);continue}let m=Ko(r.root,p);if(m){l.finished.push(`- ${c(p)}: ${m.ok?Wo(m.value):"closed"}`);continue}let h=ve(r.root,p)?.version??null;if(h===0){l.finished.push(`- ${c(p)}: v0, describing code as it was before BuildKeel; counts as done until a v1 changes it`);continue}let g=Ke(r.root,p,h);if(g){l.finished.push(`- ${c(p)}: finished${h!==null?` v${h}`:""} on ${g.record.finishedAt.slice(0,10)}`);continue}let y=xk({tree:r,index:n,unitId:p.id,workingTree:i.codeRoot,home:t,freshness:o?.freshness,suspects:d});if(y.ok)if(p.id===s)l.ready.unshift(`- ${c(p)}: the active unit here`);else if(y.value.gate.outcome!=="blocked")l.ready.push(`- ${c(p)}`);else{let[v,...b]=y.value.gate.blocking;l.waiting.push(`- ${c(p)}: ${v?.message??""}${b.length>0?` (and ${b.length} more)`:""}`)}}return l}var ZW=Zt({name:"finish_work",title:"Finish the active unit",description:"Finish the active unit of this working tree, or, with id, a story built through tasks or an epic. Runs the done gate: a clean working tree on the unit's branch; every test case of the unit's own plan with a tagged test and a current passing local result (recorded with test_results); a test case inherited from the story must pass once a test is tagged with it, and is otherwise left for the story. Call it first without apply: it checks and says what finishing will write, and lists commits on the unit's branch that have no BuildKeel-Unit line. Show that to the user and ask whether to count those commits for the unit (the default) or leave some out. Then call again with apply=true, passing the IDs of commits to leave out in exclude, to write the completion record (commits, files, test results, the versions it was built against, who and when), commit it alone in the spec repo, release the claim and clear the active unit. For a standalone bug, the check also says which stories its changes belong to: ask the user whether to attach the bug there, and pass the chosen story or task in attach. A story built through tasks, an epic, or a stage the team added, is finished once every unit under it is done and its own test cases pass, here or in the completion records of units finished in other repos; it needs no active unit. In a Spec-driven tree, a change (the active one, id, or several in ids) is finished by archiving it: call without apply for the report to review the code against, follow what it says, then apply.",inputSchema:{id:$.string().optional().describe("The unit to finish. Defaults to the active unit, and must be it; or a story built through tasks, an epic, or a stage the team added."),apply:$.boolean().default(!1).describe("false: only check and describe. true: finish."),exclude:$.array($.string()).optional().describe("apply: commits on the unit's branch without a BuildKeel-Unit line to leave out, by ID."),attach:$.string().optional().describe("apply, for a standalone bug: the story or task to attach it to, such as US-001."),ids:$.array($.string()).optional().describe("Spec-driven: several changes to finish in one run, oldest first."),review:$.record($.string(),$.string()).optional().describe("Spec-driven, apply: your review of each change, by change ID, as you reported it to the user."),finishedAnyway:$.array($.string()).optional().describe("Spec-driven, apply: changes the user finished although something was reported missing."),resolved:$.record($.string(),$.string()).optional().describe('Spec-driven, apply: for each overlapping requirement, by ID, the whole text to keep, or "" to leave it out.'),close:$.object({reason:$.enum(bk).describe("duplicate, cannot-reproduce, works-as-intended or wrong-test, as the user chose."),duplicateOf:$.string().optional().describe("For a duplicate: the bug it duplicates, such as BUG-001."),note:$.string().optional().describe("The user's note, if they gave one.")}).optional().describe("For a bug that is not a defect: close it without a fix, with the reason. Without apply it says what closing does; with apply=true, only once the user has confirmed, it writes the closing record.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value;if(t.close)return Mbe(e,r.value,t.id,t.close,t.apply);if(B(i.root).mode==="spec-driven"){let d=_e(n.codeRoot)?.activeUnit??null,p=MW(i.root,t.id,t.ids,d);if(p){let{apply:f,exclude:m,review:h,finishedAnyway:g,resolved:y}=t;return UW(e,r.value,{ids:p,apply:f,...m?{exclude:m}:{},...h?{review:h}:{},...g?{finishedAnyway:g}:{},...y?{resolved:y}:{}})}if(!t.id&&!d)return LW(r.value)}let o=t.id??_e(n.codeRoot)?.activeUnit??null,s=o?gr(e.home,i.root,o)?.claimedAt:void 0,a=await xW({tree:i,writer:e.writer(r.value),codeRoot:n.codeRoot,repo:n.pointer.repo,home:e.home,host:e.host,apply:t.apply,...t.id?{unitId:t.id}:{},...t.exclude?{exclude:t.exclude}:{},...t.attach?{attach:t.attach}:{}});if(!a.ok)return D(`${t.id??"The active unit"} cannot be finished.`,a.problems);let c=a.value;if((c.kind==="refused"||c.kind==="parent-refused")&&e.gateUsage(r.value,c.gate,c.unit.id,!1),c.kind==="finished"||c.kind==="parent-finished"){e.gateUsage(r.value,c.gate,c.unit.id,!0);let d=s?Math.max(0,Math.round((Date.parse(c.record.finishedAt)-Date.parse(s))/1e3)):void 0,p=c.record.version;e.usage(r.value,{event:"finish",unit:c.unit.id,type:c.unit.type,...p!==void 0?{version:p}:{},...d!==void 0?{seconds:d}:{}})}a.value.kind==="finished"&&e.refreshHookCache(r.value);let l=fa(_e(n.codeRoot),{behind:!1,unpushed:!1}),u=a.value.kind==="finished"?Cbe(r.value,e.home,a.value.unit,a.value.code.branch):[];return[zbe(a.value,Re(r.value.tree.root).one("story")),...u,...l].join(`
358
+ `)}});function Cbe(e,t,r,i){let n=r.parent?.id;if(!n)return[];let o=new Set([...K(e.tree.root).artifacts.values()].filter(l=>l.parent?.id===n&&l.id!==r.id).map(l=>l.id)),s=ma(e,t).ready.find(l=>o.has(/^- (\S+) /.exec(l)?.[1]??""));if(!s)return[];let a=/^- (\S+) /.exec(s)?.[1],c=i?`; started from here, its branch is stacked on ${i}, so it has this work before it is merged`:"";return["",`Next under ${n}: ${s.slice(2)} is ready to start. Offer to start it with start_work (id ${a}, stack=true)${c}.`]}var MN=e=>e.slice(0,7),lg=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function Abe(e,t){if(t.length===0)return[`${e} is standalone, and none of the files it changed belongs to other work or to an artifact's scope, so there is nowhere to suggest attaching it.`];let r=[`${e} is standalone. The files it changed also belong to:`];for(let n of t){let o=n.via.map(c=>`${c.unit.id}${c.unit.title?` "${c.unit.title}"`:""}`).join(", "),s=n.scopes.map(c=>`${c.record.id===n.story.id?"its":`${c.record.id}'s`} scope ${c.paths.join(", ")}`).join(" and "),a=[...o?[`through ${o}`]:[],...s?[`under ${s}`]:[]].join(", and ");r.push(`- ${n.story.id}${n.story.title?` "${n.story.title}"`:""}: ${lg(n.files.length,"file")} (${n.files.join(", ")}), ${a}`)}let[i]=t;return r.push(`Ask the user whether to attach ${e} to ${i?.story.id} (the default), to one of the units listed, or leave it standalone; to attach, pass attach with the chosen ID when calling finish_work with apply=true. Its regression test then counts among that unit's test cases.`),r}function qW(e,t){let r=e.filter(o=>!o.own&&o.status==="no test");if(r.length===0)return[];let i=r[0]?.plan??"",n=i.replace(/-TP$/,"");return[`Left for the ${t}: ${r.map(o=>o.id).join(", ")} ${r.length===1?"has":"have"} no test yet; ${n} cannot be finished until every test case in ${i} passes.`]}var Ebe=e=>{let t=e.from?`passed in ${e.from.repo}, recorded by ${e.from.unit}`:e.status==="no test"?"no tagged test here":e.status==="stale"?`stale: ${e.detail}`:e.status;return`- ${e.id} ${e.title}${e.regression?" (regression test)":""}: ${t}`};function Obe(e){let t=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;if(!e.done&&e.closed)return`- ${t}: closed without a fix; counts as done`;if(!e.done)return e.onboarded?`- ${t}: v0, describing code as it was before BuildKeel; counts as done`:`- ${t}: not done`;let r=e.done.record.version!==void 0?` v${e.done.record.version}`:"";return`- ${t}: finished${r} on ${e.done.record.finishedAt.slice(0,10)} in ${e.done.record.repo}`}function FW(e){let t=[e.children.length>0?`Units under ${e.unit.id}:`:`There are no units under ${e.unit.id}.`,...e.children.map(Obe)];return t.push("",e.cases.length>0?`Test cases of ${e.unit.id} (local results here, and completion records from other repos):`:`${e.unit.id} has no test cases of its own.`),t.push(...e.cases.map(Ebe)),t}function Nbe(e){let t=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;switch(e.kind){case"parent-refused":return[nn(e.gate,`finish of ${e.unit.id}`),"",...FW(e),"","Nothing was written."].join(`
359
+ `);case"parent-preview":{let r=[`${t} v${e.version} can be finished: everything under it is done. Finishing will:`];return r.push(`- write its completion record in the spec tree${e.ancestors.length>0?`, built against ${e.ancestors.join(", ")}`:""}, listing the units under it and its test results`),r.push(`- commit only that file in the spec repo as "done: ${e.unit.id} v${e.version}"${e.autoPush?", then push it":", without pushing"}`),e.gate.outcome==="warned"&&r.push("",nn(e.gate,"the finish")),r.push("",...FW(e),"",`Nothing has been written yet. Show this to the user, and call finish_work again with id ${e.unit.id} and apply=true only if they confirm.`),r.join(`
360
+ `)}case"parent-finished":{let r=e.record.version!==void 0?` v${e.record.version}`:"",i=[`Finished ${t}${r}: everything under it is done, and its completion record lists each unit and where its test cases passed.`,`- Completion record: ${e.path}`];return e.commit.ok?(i.push(`- Committed as "done: ${e.unit.id}${r}" (${MN(e.commit.value)}) in the spec repo, with only that file.`),e.push?i.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?i.push("- Not pushed: the spec repo has no remote. Add one and push it to share the record."):e.unpushed>0&&i.push(`- Not pushed: ${lg(e.unpushed,"completion")} in the spec repo ${e.unpushed===1?"is":"are"} not pushed yet. Push it to share ${e.unpushed===1?"it":"them"}.`)):i.push(`- The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),e.gate.outcome==="warned"&&i.push("",nn(e.gate,"the finish")),i.join(`
361
+ `)}}}var jbe=e=>e.kind.startsWith("parent-");function zbe(e,t="story"){return jbe(e)?Nbe(e):Dbe(e,t)}function Dbe(e,t){let r=[],i=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;switch(e.kind){case"refused":return r.push(nn(e.gate,`finish of ${e.unit.id}`),"",...Hk(e.unit.id,e.cases,t),"","Nothing was written."),r.join(`
362
+ `);case"preview":{let n=e.version!==null?` v${e.version}`:"";r.push(`${i}${n} can be finished. Finishing will:`),r.push(`- write its completion record in the spec tree${e.ancestors.length>0?`, built against ${e.ancestors.join(", ")}`:""}`),r.push(`- commit only that file in the spec repo as "done: ${e.unit.id}${n}"${e.autoPush?", then push it":", without pushing"}`),r.push("- release its claim on this machine and clear the active unit here; the code branch is left as it is"),e.gate.outcome==="warned"&&r.push("",nn(e.gate,"the finish")),r.push("",...Bk(e.code,"this repo")),r.push("",...Hk(e.unit.id,e.cases,t));let o=qW(e.cases,t);return o.length>0&&r.push("",...o),e.unit.type==="bug"&&!e.unit.parent&&r.push("",...Abe(e.unit.id,e.suggestions)),r.push("",e.code.unstamped.length>0?`Nothing has been written yet. Show this to the user and ask about the ${lg(e.code.unstamped.length,"commit")} without a BuildKeel-Unit line: count them all for ${e.unit.id} (the default), or leave some out. Then call finish_work again with apply=true, and exclude listing any left out.`:"Nothing has been written yet. Show this to the user, and call finish_work again with apply=true only if they confirm."),r.join(`
363
+ `)}case"finished":{let n=e.record.version!==void 0?` v${e.record.version}`:"";r.push(`Finished ${i}${n}: its completion record keeps what was built, against which approved versions, and with which test results.`),e.attached&&r.push(`- Attached to ${e.attached}: its regression test now counts among ${e.attached.split("@")[0]}'s test cases.`),r.push(`- Completion record: ${e.path}`),r.push(`- ${e.record.commits.length} commit${e.record.commits.length===1?"":"s"} and ${lg(e.record.files.length,"file")} recorded${e.record.excluded.length>0?`, ${e.record.excluded.length} left out`:""}.`);for(let s of e.droppedMatches)r.push(`- Dropped the recorded match of ${s.testCase} to ${s.tests.join("; ")}: the test now carries [${s.testCase}] in its name.`);if(e.commit.ok){let s=[...e.attached?["the bug's own file"]:[],...e.droppedMatches.length>0?["the matches dropped"]:[]];r.push(`- Committed as "done: ${e.unit.id}${n}" (${MN(e.commit.value)}) in the spec repo, with only ${s.length>0?`that file and ${s.join(" and ")}`:"that file"}.`),e.push?r.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?r.push("- Not pushed: the spec repo has no remote. Add one and push it to share the record."):e.unpushed>0&&r.push(`- Not pushed: ${lg(e.unpushed,"completion")} in the spec repo ${e.unpushed===1?"is":"are"} not pushed yet. Push it to share ${e.unpushed===1?"it":"them"}.`)}else r.push(`- The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`);r.push("- The claim is released and there is no active unit in this working tree now."),e.code.branch&&r.push(`- The branch ${e.code.branch} is unchanged: push it and open a pull request as usual.`),e.gate.outcome==="warned"&&r.push("",nn(e.gate,"the finish"));let o=qW(e.cases,t);return o.length>0&&r.push("",...o),r.join(`
364
+ `)}}}function Mbe(e,t,r,i,n){let{tree:o,resolved:s}=t,a=_e(s.codeRoot)?.activeUnit??null,c=r??a;if(!c)return"Name the bug to close with id, such as BUG-002.";let l={tree:o,index:K(o.root),codeRoot:s.codeRoot,home:e.home,bugId:c,reason:i.reason,...i.duplicateOf?{duplicateOf:i.duplicateOf}:{},...i.note?{note:i.note}:{},activeUnit:a};if(!n){let h=cN(l);if(!h.ok)return D(`${c} cannot be closed.`,h.problems);let{bug:g,reason:y,duplicateOf:v,note:b,active:_,claimed:k}=h.value,x=y==="duplicate"?`as a duplicate of ${v}`:`as ${wk[y]}`;return[`Closing ${g.id}${g.title?` "${g.title}"`:""} without a fix, ${x}${b?` (${b})`:""}, will:`,`- write its closing record, ${oi(g)}: the reason, who closed it and when, never edited after`,"- commit it on its own in the spec repo",..._?["- release its claim and clear the active unit here"]:k?["- release its claim on this machine"]:[],"",`A closed bug is not open, does not hold up ${g.parent?g.parent.id:"anything above it"} from being finished, and is never started or reopened: a defect that returns is a new bug.${y==="wrong-test"?" Correct the test case as a new version of its test plan.":""}`,"","Nothing has been written yet. Show this to the user with the bug, and close it only when they confirm: call finish_work again with the same close and apply=true."].join(`
365
+ `)}let u=u9({...l,writer:e.writer(t)});if(!u.ok)return D(`${c} was not closed.`,u.problems);e.usage(t,{event:"bug",unit:c,action:"closed",reason:i.reason}),e.refreshHookCache(t);let{record:d,path:p,commit:f,plan:m}=u.value;return[`${c} is ${Wo(d)}: ${p}.`,f.ok?`- Committed as "${aN(d)}" (${MN(f.value)}) in the spec repo.`:`- Written but not committed: ${f.problems[0]?.message??""} Commit it in the spec repo yourself.`,...m.active?["- Released its claim; there is no active unit in this working tree now."]:m.claimed?["- Released its claim on this machine."]:[]].join(`
366
+ `)}import{existsSync as Lbe,readFileSync as Ube}from"node:fs";import{join as VW}from"node:path";var qbe=7;function BW(e,t,r,i){let n=e.root,o=v=>Lbe(VW(n,v))?Ube(VW(n,v),"utf8"):null,s=o(Ce(r,"proposal"));if(s===null)return w({code:"context-not-found",message:`There is no change ${r}.`});let a=oe(s),c=a.ok&&typeof a.value.frontmatter.title=="string"?a.value.frontmatter.title:null,l=o(Ce(r,"tasks")),u=l?Ni(l):null,d=nr(n,r),p=[`# ${i.active?"Active unit":"Unit"}: ${r}${c?` "${c}"`:""} (change)`];u&&p.push(`Progress: ${u.done} of ${u.total} tasks done.`),i.active&&p.push(`Commits: end every message with "BuildKeel-Unit: ${r}", and add "BuildKeel-Task: <number>" when the commit does exactly one task.`,"Tests: put the scenario ID in each test's name, such as [AUTH-R1-S1]. Record each run's JUnit XML report with test_results.",`Tasks: work through the unticked ones in order, and tick each with save_draft once its verification passes. Finish with ${ee("done")}.`,"Keep the change consistent: when you edit one of its files, check the others and propose the follow-on edits."),p.push("","## Proposal",Yk(s));let f=new Map;for(let v of d){let b=o(Ce(r,"spec-change",v));if(b===null)continue;p.push("",`## Spec change: ${v}`,Yk(b));let _=oe(b);if(_.ok){let k=xn(_.value);f.set(v,new Set([...k.added,...k.modified,...k.removed].map(x=>x.id).filter(x=>x!==null)))}}let m=o(Ce(r,"design"));m!==null&&p.push("","## Design",Yk(m)),l!==null&&p.push("","## Tasks",Yk(l));for(let v of d){let b=Pt(n,v);if(!b.ok){p.push("",`## ${v}: a new capability, written when this change is finished`);continue}p.push("",`## ${v} v${b.value.version}, in force`);let _=Ht(b.value.document,"Purpose")?.body;_&&Br(_).trim()&&p.push(Br(_).trim());let k=f.get(v)??new Set;for(let x of Jt(b.value.document))p.push(k.has(x.id??"")?`
367
+ ${x.raw.trim()}`:`- ${Fbe(x)}`)}let h=[...t.artifacts.values()].filter(v=>v.type==="bug"&&v.parent?.id===r&&Ke(n,v,null)===null&&!Oi(n,v)).sort((v,b)=>v.id.localeCompare(b.id,"en",{numeric:!0}));p.push("",h.length===0?"## Open bugs: none":"## Open bugs",...h.map(v=>`- ${v.id}${v.title?` "${v.title}"`:""}`)),p.push("",...Zbe(i.code));let g=`${p.join(`
368
+ `)}
369
+ `,y=e.config.settings.contextBudget;return g.length<=y?T(g):T(`${g}
370
+ Note: this context is ${g.length.toLocaleString("en")} characters, over the budget of ${y.toLocaleString("en")} (settings.contextBudget in buildkeel.yaml). Nothing was left out; consider splitting ${r}.
371
+ `)}function Yk(e){let t=oe(e),r=t.ok?t.value.preamble+t.value.sections.map(i=>i.headingLine+i.body).join(""):e;return Br(r).trim().replace(/^(#{1,5}) /gm,"#$1 ")}var Fbe=e=>`${e.id??""} ${e.text}`.trim();function Zbe(e){if(!e||e.repos.length===0&&e.missing.length===0)return["## Linked code: none yet"];let t=["## Linked code"];e.repos.length===0&&t.push("None yet.");for(let r of e.repos)t.push(`- ${r.repo}: commits ${r.commits.map(i=>i.id.slice(0,qbe)).join(", ")||"none"} \xB7 files ${r.files.join(", ")||"none"}`);return e.missing.length>0&&t.push(`- Not on this machine, so not searched: ${e.missing.join(", ")}`),t}var ug=e=>`${e.record.id} ${e.version===null?"(draft)":`v${e.version}`}`;function LN(e){if(e.version!==0)return null;let t=Pd(e.record.document);return`${e.record.id} v0 describes the code as it was before BuildKeel${t.length>0?`, in ${t.join(", ")}`:""}.`}var UN=e=>`${ug(e)}${e.record.title?` "${e.record.title}"`:""}`,Jd=e=>Br(e).replace(/\s+/g," ").trim(),KW=e=>Jd(e).replace(/\|/g,"\\|"),Vbe=new Set(["id","title","parent"]);function HW(e,t){let r=ve(e,t);return r?{record:r,version:r.version}:{record:t,version:null}}function WW(e,t,r){if(!r.parent)return null;let i=t.artifacts.get(r.parent.id);return i?HW(e,i):null}function Xk(e,t){let r=We(t,e);return r.ok?r.value.template:null}function Bbe(e,t){if(!t)return null;let r=Object.keys(t.fields).filter(i=>!Vbe.has(i)).flatMap(i=>{let n=e.record.document.frontmatter[i];return n==null||n===""?[]:[`${i} ${Array.isArray(n)?n.join(", "):String(n)}`]});return r.length>0?r.join(" \xB7 "):null}function GW(e,t){if(!t)return[];let r=new Set(_c(t).map(n=>n.section.toLowerCase())),i=Object.entries(t.sections).filter(([n,o])=>o.tracked&&!r.has(n.toLowerCase())).flatMap(([n])=>{let o=Ht(e.record.document,n)?.body,s=o?Br(o).trim():"";return s?[{name:n,text:s}]:[]});return i.length===1?[i[0]?.text??""]:i.flatMap(({name:n,text:o})=>[`### ${n}`,o])}function Kbe(e,t){if(!t)return[];let r=new Set(_c(t).map(i=>i.section.toLowerCase()));return Object.entries(t.sections).filter(([i,n])=>n.tracked&&!r.has(i.toLowerCase())).map(([i])=>i).filter(i=>qN(e,i)!==null)}function Wbe(e,t,r){return r.flatMap(i=>{let n=t.artifacts.get(`${i.id}${te.idSuffix}`),o=n?ve(e,n):null,s=o&&n?Kt(e,o,o.document).map(c=>({...c,plan:n.id})):[],a=AO(e,t,i).map(c=>({id:c.id,text:c.title??"",covers:[],plan:c.id,regression:!0}));return[...s,...a]})}function Gbe(e,t,r){return Sk(t,r).flatMap(i=>{if(i.type===te.type)return[];let n=ve(e,i);return n?[{record:n,version:n.version}]:[]})}function qN(e,t){let r=Ht(e.record.document,t)?.body;return(r?Jd(r):"")||null}function Hbe(e){let t=[];for(let r of e)if(r.record.type!=="task"&&r.record.type!=="story"||(t.push(r.record),r.record.type==="story"))break;return t}function Jbe(e,t,r,i){let n=new Set([r.id,...i?[i.id]:[]]);return[...t.artifacts.values()].filter(o=>o.type==="bug"&&o.id!==r.id&&o.parent&&n.has(o.parent.id)&&Ke(e,o,null)===null&&!Oi(e,o)).sort((o,s)=>o.id.localeCompare(s.id,"en",{numeric:!0}))}function Yd(e,t,r,i){return B(e.root).mode==="spec-driven"&&Xt(e.root,r)!=="missing"?BW(e,t,r,i):Ybe(e,t,r,i)}function Ybe(e,t,r,i){let n=e.root,o=t.artifacts.get(r);if(!o)return w({code:"context-not-found",message:`There is no artifact ${r}.`});let s=HW(n,o),a=[s],c=new Set([s.record.id]);for(let E=WW(n,t,s.record);E&&!c.has(E.record.id);E=WW(n,t,E.record))a.push(E),c.add(E.record.id);let[,l,...u]=a,d=[s,l].find(E=>E?.record.type==="story"),p=s.record.type==="task"&&d?[s.record,d.record]:s.record.type==="bug"?[s.record,...Hbe(a.slice(1))]:[s.record],f=Wbe(n,t,p),m=[];if(m.push(`# ${i.active?"Active unit":"Unit"}: ${UN(s)}`),m.push([...a].reverse().map(ug).join(" \u203A ")),i.active){m.push(`Commits: end every message with "BuildKeel-Unit: ${s.record.id}".`);let E=`Record each run's JUnit XML report with test_results, and finish with ${ee("done")}.`;if(s.record.type==="bug"){let X=s.record.document.frontmatter.testCase,J=typeof X=="string"&&X!==""?` ${X}, which found it, must pass too.`:"";m.push(`Tests: write a regression test with [${s.record.id}] in its name, which fails without the fix and passes with it.${J} ${E}`)}else{let X=f[0]?`, such as [${f[0].id}]`:"";m.push(`Tests: put the test case ID in the test's name${X}. ${E}`)}let{matches:U}=Ai(n,t),V=f.flatMap(X=>(U.get(X.id)?.match.tests??[]).map(J=>`${J} (${X.id})`));V.length>0&&m.push(`Matched without a tag: ${V.join("; ")}. When you change one of these tests, add its test case ID to its name; the match is dropped when ${s.record.id} is finished.`)}for(let[E,U]of a.entries()){let V=a[E+1],X=U.record.parent?.version,J=X===void 0||!V?X:Pi(X,yd(n,U.record).repins,V.record.id);V?.version!=null&&J!==void 0&&J<V.version&&m.push(`Note: ${U.record.id} was approved against ${V.record.id} v${J}; ${V.record.id} v${V.version} is now approved. Check whether ${U.record.id} still holds.`)}let h=Xk(n,s.record.type);m.push("",`## What to build: ${ug(s)}`);let g=Bbe(s,h);g&&m.push(g),m.push(...GW(s,h));let y=d?twe(n,d,f):{lines:[],covered:new Set};if(d===s&&m.push("",...y.lines),l){m.push("",`## Why: ${UN(l)}`);let E=LN(l);E&&m.push(E),m.push(...GW(l,Xk(n,l.record.type))),d===l&&m.push("",...y.lines)}let v=f.filter(E=>!y.covered.has(E.id));if(v.length>0){let E=U=>`${U.id} ${Jd(U.text)} (${U.regression?"regression test of a fixed bug":`covers ${(U.covers??[]).join(", ")||"nothing"}`})`;m.push("",`Also tested: ${v.map(E).join("; ")}`)}let b=Re(n),_=a.map(E=>({owner:E.record,docs:Gbe(n,t,E.record)})),k=_.flatMap(({owner:E,docs:U})=>U.filter(V=>V.record.type===mc.type).map(V=>({owner:E,doc:V})))[0];if(k){m.push("",`## How it is built: ${ug(k.doc)}, the ${b.one(mc.type)} of ${k.owner.id}`);let E=LN(k.doc);E&&m.push(E);let U=qN(k.doc,"Summary");U&&m.push(U);for(let V of Kbe(k.doc,Xk(n,mc.type))){let X=Br(Ht(k.doc.record.document,V)?.body??"").trim().replace(/^(#{1,5}) /gm,"#$1 ");m.push(`### ${V}`,X)}}let x=_.flatMap(({owner:E,docs:U})=>U.filter(V=>V!==k?.doc).map(V=>({owner:E,doc:V})));if(u.length>0||x.length>0){m.push("","## Background");for(let E of u){let U=Ht(E.record.document,"Summary")?.body,V=LN(E);m.push(`- ${UN(E)}${U?`: ${Jd(U)}`:""}${V?` (${V.replace(/\.$/,"")})`:""}`)}for(let{owner:E,doc:U}of x){let V=qN(U,"Summary");m.push(`- ${ug(U)}, the ${b.one(U.record.type)} of ${E.id}${V?`: ${V}`:""}`)}}m.push("",...ewe(i.code,Jbe(n,t,s.record,l?.record)));let S=`${m.join(`
372
+ `)}
373
+ `,C=e.config.settings.contextBudget;return S.length<=C?T(S):T(`${S}
374
+ Note: this context is ${S.length.toLocaleString("en")} characters, over the budget of ${C.toLocaleString("en")} (settings.contextBudget in buildkeel.yaml). Nothing was left out; consider shortening ${s.record.id} or splitting it.
375
+ `)}var Xbe=7;function Qbe(e){let t=e.document.frontmatter.testCase;return`- ${e.id}${e.title?` "${Jd(e.title)}"`:""} in ${e.parent?.id??"nothing"}${typeof t=="string"&&t!==""?`, found by ${t}`:""}`}function ewe(e,t){let r=!e||e.repos.length===0&&e.missing.length===0;if(t.length===0&&r)return["## Open bugs: none \xB7 Linked code: none yet"];let i=t.length===0?["## Open bugs: none"]:["## Open bugs",...t.map(Qbe)];if(!e||r)return[...i,"","## Linked code: none yet"];i.push("","## Linked code"),e.repos.length===0&&i.push("None yet.");for(let n of e.repos){let o=n.commits.map(a=>a.id.slice(0,Xbe)).join(", "),s=(n.pullRequests??[]).map(a=>`#${a.number} "${Jd(a.title)}" (${a.state})`).join(", ");i.push(`- ${n.repo}: commits ${o||"none"} \xB7 files ${n.files.join(", ")||"none"}${s?` \xB7 pull requests ${s}`:""}`)}return e.missing.length>0&&i.push(`- Not on this machine, so not searched: ${e.missing.join(", ")}`),i}function twe(e,t,r){let i=Xk(e,"story"),n=i?Tn(t.record.document,i,t.record.id):[],o=new Set;return n.length===0?{lines:[],covered:o}:{lines:["| Criterion | Must hold | Tested by |","|---|---|---|",...n.map(a=>{let c=r.filter(u=>(u.covers??[]).includes(a.id));for(let u of c)o.add(u.id);let l=c.length>0?c.map(u=>`${u.id} ${KW(u.text)}`).join("; "):"not covered";return`| ${a.id} | ${KW(a.text)} | ${l} |`})],covered:o}}var JW=Zt({name:"get_context",title:"Get a unit's context",description:"The compact context for a unit of work, built from approved versions: what to build, why (its parent, with the story's acceptance criteria and the test case for each), summaries further up, and the code already linked to it (commits and files in every code repo on this machine, and the pull requests holding them where the repo is on GitHub and its gh tool is installed), with every version shown. In a Spec-driven tree, a change's context: its proposal, spec changes, design and tasks, the capabilities it touches at their versions in force, its open bugs and its code. Leave out id for the active unit of this working tree.",inputSchema:{id:$.string().optional().describe("The unit, such as TK-001. Defaults to the active unit.")},readOnly:!0,async run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let i=_e(r.value.resolved.codeRoot)?.activeUnit??null,n=t.id??i;if(!n)return"There is no active unit in this working tree. Give the id of a unit, or start one with {{bk:start}}.";let o=n===i?e.refreshHookCache(r.value):K(r.value.tree.root),s=await e.unitCodeWithPullRequests(r.value,o,n),a=Yd(r.value.tree,o,n,{active:n===i,code:s});return a.ok&&e.usage(r.value,{event:"context",unit:n}),a.ok?a.value.trimEnd():D(`There is no context for ${n}.`,a.problems)}});import{readFileSync as rwe}from"node:fs";var YW=Zt({name:"get_template",title:"Get a template",description:"The template for an artifact type (idea, epic, story, task, test-plan, or a stage the team added): the fields and sections it needs, which are required, and the skeleton to fill in. The spec tree's own template is used when it has one, then the organization's when the tree takes templates from one.",inputSchema:{type:$.string().describe("The artifact type, such as story, or a stage's name such as user story.")},readOnly:!0,run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let{root:i}=r.value.tree;if(/^changes?$/i.test(t.type.trim())&&B(i).mode==="spec-driven")return"A change has no template of its own: it is made of files, each with its template. Ask for proposal, spec-change and tasks, and for design when the change needs one.";let n=ig(r.value.tree,t.type);if(!n)return`There is no artifact type "${t.type}".`;let o=We(n,i);if(!o.ok)return D(`There is no usable template for ${n}.`,o.problems);let{template:s}=o.value,a=Object.entries(s.sections).filter(([,u])=>u.offered!==void 0),c=Object.entries(s.sections).filter(([,u])=>u.byRule).map(([u])=>u),l=s.notes??[];return[`Template for ${nwe(Re(i).one(n),n)}, version ${o.value.template.version}, from ${Mh(o.value)}:`,"",rwe(o.value.file,"utf8").trimEnd(),...a.length>0?["",'Offered sections, not in the skeleton: add one, as a "## <name>" section, only when the work needs it.',...a.map(([u,d])=>`- ${u}: ${d.offered}`)]:[],...c.length>0||l.length>0?["","This spec tree's rules for it, which come before the template's guidance:",...c.map(u=>`- Required section: "## ${u}".`),...l.map(u=>`- ${u}`)]:[],"","Fill each section from what the user gave you: the conversation, a document, or content from their tools, keeping its meaning. Put what fits no section in the section for further material, such as Notes. Ask the user for each required section the material does not cover, one question at a time; never invent one."].join(`
376
+ `)}}),nwe=(e,t)=>e===t?t:`${e} (type ${t})`;var FN=(e,t)=>`${e} ${t}${e===1?"":"s"}`,XW="Ask the user to decide each, one at a time: still valid (kept as it is, and counts as built against the new version) or needs change (a task to revisit it, in an open change). Record each with resolve_suspect.";function QW(e,t,r,i,n){let{root:o}=e.tree;if(i===null&&n)return bd(o,n,t).requirements.find(a=>a.id===r)?.item.raw.trim();if(i===null)return;let s=Pt(o,t,i);return s.ok?Jt(s.value.document).find(a=>a.id===r)?.raw.trim():void 0}var eG=(e,t)=>t===void 0?[]:[` ${e}:`,...t.split(`
377
+ `).map(r=>r?` ${r}`:"")];function tG(e,t,r,i){let n=new Map;for(let s of t)n.set(`${s.capability}\0${s.pinned}\0${s.current}`,[...n.get(`${s.capability}\0${s.pinned}\0${s.current}`)??[],s]);let o=[];for(let s of n.values()){let a=s[0],c=a.current===null?`what ${i} would make it`:`v${a.current}`;o.push("",`${a.capability}, from v${a.pinned} to ${c}:`);let l=new Map(s.flatMap(u=>u.changes).map(u=>[u.id,u]));for(let u of l.values())o.push(`- ${u.id} ${u.change}${u.by?` by ${u.by}`:""}`,...eG("was",QW(e,a.capability,u.id,a.pinned,null))),u.change==="modified"&&o.push(...eG("now",QW(e,a.capability,u.id,a.current,i)));o.push(`${r} (${s.length}):`),s.forEach((u,d)=>{u.kind==="test"?o.push(`${d+1}. The tests of ${u.id}${u.title?` "${u.title}"`:""}, as ${u.holder} recorded them: ${(u.tests??[]).join("; ")}.`):(o.push(`${d+1}. ${u.id}${u.title?` "${u.title}"`:""}, which built ${u.requirements.join(", ")}.`),u.finished&&(o.push(` Finished (${u.finished.record}): ${FN(u.finished.commits.length,"commit")} in ${u.finished.repo}${u.finished.commits.length>0?`: ${u.finished.commits.map(p=>`${p.id.slice(0,7)} ${p.subject}`).join("; ")}`:""}.`),u.finished.files.length>0&&o.push(` Files: ${u.finished.files.join(", ")}.`)))})}return o}function rG(e,t){let{root:r}=e.tree;if(t&&Xt(r,t)==="open"){let s=Dc(r,t),a=Bd(r,t),c=a.ok?a.value:[];if(s.suspects.length===0)return`Archiving ${t} would make nothing suspect: nothing built against its capabilities relies on what it modifies or removes.`;let l=[`Archiving ${t} would make ${FN(s.suspects.length,"item")} suspect. Nothing is marked yet.`,...tG(e,s.suspects,"Would become suspect",t)],u=s.suspects.filter(d=>c.some(p=>p.suspect===d.id&&p.holder===d.holder));if(u.length>0){l.push("","Decided already, carried out when it is archived:");for(let d of u){let p=c.find(f=>f.suspect===d.id&&f.holder===d.holder);l.push(`- ${d.id}: ${p?.decision==="still-valid"?"still valid":`needs change, task ${p?.task??""} in ${t}`}`)}}return l.push("",`They can be decided now, or after ${t} is archived. Now: still valid keeps it, and needs change adds a task to ${t} to revisit it; either way it does not become suspect when ${t} is archived. ${XW}`),a.ok||l.push("",D("The decisions so far could not be read:",a.problems)),l.join(`
378
+ `)}let i=da(r),n=t?i.suspects.filter(s=>s.id===t||s.holder===t||s.capability===t||s.changes.some(a=>a.by===t)):i.suspects,o=[];return n.length===0?o.push(t?`Nothing involving ${t} is suspect.`:"Nothing is suspect: everything is built against the capability versions in force, or is unaffected by what changed since."):(o.push(`${FN(n.length,"item")}${t?` involving ${t}`:""} ${n.length===1?"is":"are"} suspect: built against an older capability version that changed what ${n.length===1?"it relies":"they rely"} on.`),o.push(...tG(e,n,"Suspect",null),"",`${XW} Needs change names the open change to add the task to, or a new change drafted with save_draft first; it stays suspect until that change is archived.`)),i.problems.length>0&&o.push("",D("Some records could not be read:",i.problems)),o.join(`
379
+ `)}async function nG(e,t,r){let i=await D9({tree:t.tree,writer:e.writer(t),id:r.id,decision:r.decision,...r.change?{change:r.change}:{}});return i.ok?(e.usage(t,{event:"resolve",id:r.id,decision:r.decision}),iwe(i.value,r.id,t.tree.root)):D(`Nothing was recorded for ${r.id}.`,i.problems)}function iwe(e,t,r){switch(e.kind){case"preview":{let i=e.decisions.map(n=>n.task).filter(n=>n!==void 0);return e.decisions[0]?.decision==="still-valid"?`Recorded in ${e.change}'s impact decisions that ${t} is still valid. When ${e.change} is archived, it is re-pinned to the new version and does not become suspect.`:`Added task ${i.join(", ")} to ${e.change} to revisit ${t}, and recorded the decision. When ${e.change} is archived, ${t} counts as built against the new version and does not become suspect.`}case"repinned":{let i=[`Recorded that ${t} is still valid against ${e.suspects.map(n=>`${n.capability} v${n.current}`).join(", ")}, so it is no longer suspect. The decision is kept in:`,...e.records.map(n=>`- ${n}`)];return e.commit.ok?(i.push(`Committed as "repin: ${t}" (${e.commit.value.slice(0,7)}) in the spec repo.`),i.push(e.push?e.push.ok?"Pushed.":`Not pushed: ${e.push.problems[0]?.message??""}`:Qs(r).length===0?"Not pushed: the spec repo has no remote.":"Not pushed. Push the spec repo to share the decision.")):i.push(`The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),i.join(`
380
+ `)}case"task":return`Added task ${e.task} to ${e.change} to revisit ${t}. ${t} stays suspect until ${e.change} is archived, which re-pins it to the version then in force.`}}var owe="Each stays suspect until the user decides, one at a time: still valid (it is kept as it is and counts as built against the new version) or needs change (a new draft of it, or of its test plan, to update and approve).",iG=Zt({name:"impact",title:"Change impact",description:"What a change to an approved artifact affects. Without id: every suspect in the spec tree, that is every task, story, epic, bug or test case built against an older version of something whose tracked content it relies on has changed since, with the old and new text of each change and, for finished units, the commits and files to review. With the id of an artifact that has an open draft of a new version: a preview of what approving it would make suspect and which coverage gaps it would open. With another id: the suspects it causes or is one of. In a Spec-driven tree: with an open change's id, what archiving it would make suspect; otherwise the tests and archived changes built against a requirement a later capability version modified or removed. Changes nothing.",inputSchema:{id:$.string().optional().describe("An artifact such as US-001, or a test case such as US-001-TC2. Leave it out for every suspect.")},readOnly:!0,run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let i=r.value.tree;if(B(i.root).mode==="spec-driven")return rG(r.value,t.id);let n=K(i.root),o=t.id?n.artifacts.get(t.id):void 0;if(o&&se(i.root,o).draftOpen){let u=y9(i.root,n,o);if(u)return swe(i,n,o.id,u)}let s=yr(i.root,n),a=t.id,c=a?s.suspects.filter(u=>u.target===a||u.id===a||u.holder.id===a):s.suspects,l=[];if(c.length===0)a&&!o&&!s.suspects.some(u=>u.id===a)?l.push(`There is no artifact ${a}, and no suspect test case with that ID.`):l.push(a?`Nothing involving ${a} is suspect.`:"Nothing is suspect: everything is built against the versions in force, or is unaffected by what changed since.");else{let u=a?` involving ${a}`:"";l.push(`${Qk(c.length,"item")}${u} ${c.length===1?"is":"are"} suspect: built against an older version of something that has changed since in what ${c.length===1?"it relies":"they rely"} on.`),l.push(...oG(i,n,c,"Suspect"),"",owe)}return s.problems.length>0&&l.push("",D("Some records could not be read, so what relies on them is listed as suspect:",s.problems)),l.join(`
381
+ `)}});function swe(e,t,r,i){let n=`v${i.from+1}`,o=[];if(i.suspects.length===0?o.push(`Approving the draft of ${r} as ${n} would make nothing suspect: nothing built against ${r} relies on what the draft changes.`):(o.push(`Approving the draft of ${r} as ${n} would make ${Qk(i.suspects.length,"item")} suspect. Nothing is marked until the draft is approved.`),o.push(...oG(e,t,i.suspects,"Would become suspect"))),i.gaps.length>0){o.push("",`It would open ${Qk(i.gaps.length,"coverage gap")}:`);for(let s of i.gaps)o.push(`- ${s.id} is new. No test case can cover it until a version of ${r}-TP written against ${r} ${n} does, and no work under ${r} can start until then.`)}return i.problems.length>0&&o.push("",D("Some records could not be read, so what relies on them is listed as suspect:",i.problems)),o.join(`
382
+ `)}function oG(e,t,r,i){let n=new Map;for(let s of r){let a=`${s.target}\0${s.pinned}\0${s.current??"draft"}`;n.set(a,[...n.get(a)??[],s])}let o=[];for(let s of n.values()){let a=s[0],c=t.artifacts.get(a.target),l=a.current===null?"the draft":`v${a.current}`,u=new Map;for(let d of s)for(let p of d.changes)u.set(p.id,p);o.push("",`${a.target}${c?.title?` "${c.title}"`:""}, from v${a.pinned} to ${l}:`),u.size===0&&o.push("- These versions could not be compared, so everything built against it needs review.");for(let d of u.values())o.push(...awe(d));o.push(`${i} (${s.length}):`),s.forEach((d,p)=>o.push(...cwe(e,d,p+1)))}return o}function awe(e){let t=(r,i)=>{if(i===void 0)return[];let n=i.split(`
383
+ `);return n.length===1?[` ${r}: ${i}`]:[` ${r}:`,...n.map(o=>` ${o}`)]};return[`- ${e.id} ${e.change}`,...t("was",e.before),...t("now",e.after)]}function cwe(e,t,r){let i=t.title?` "${t.title}"`:"",n=[];if(t.kind==="test-case"){let s=dt(e.root,t.holder).at(-1),a=t.items?t.items.join(", "):`all of ${t.target}`;n.push(`${r}. Test case ${t.id}${i} in ${t.holder.id}${s?` v${s}`:""}: covers ${a}.`)}else{let s=Cn(e,t.holder.type);n.push(`${r}. ${s.charAt(0).toUpperCase()}${s.slice(1)} ${t.id}${i}: any change to ${t.target} affects it.`)}let o=t.finished;if(o){let s=o.commits.map(a=>`${a.id.slice(0,7)} ${a.subject}`).join("; ");n.push(` Finished (${o.record}): ${Qk(o.commits.length,"commit")} in ${o.repo}${s?`: ${s}`:""}.`),o.files.length>0&&n.push(` Files: ${o.files.join(", ")}.`)}return n}var Qk=(e,t)=>`${e} ${t}${e===1?"":"s"}`;var pg=Lt(Vt(),1);import{existsSync as Qd,mkdirSync as hwe,readdirSync as uG,readFileSync as gwe,realpathSync as ywe}from"node:fs";import{basename as dG,isAbsolute as iS,join as Xo,relative as oS,resolve as ep,sep as vwe}from"node:path";var Xd=2,lwe={2:1},uwe=e=>lwe[e]??e,ZN=(e,t=Xd)=>e>=uwe(t)&&e<=t,eS=e=>e==="spec-driven"?2:1;function tS(e,t=Xd){return ZN(e,t)?{writable:!0}:e<t?{writable:!1,reason:"older-format",problem:{code:"format-older",message:`This spec tree uses format ${e}; this version of BuildKeel uses format ${t}. The tree is read-only until it is migrated.`,remedy:`Run ${ee("migrate")} to upgrade it in one reviewable commit.`,path:"buildkeel.yaml"}}:{writable:!1,reason:"newer-format",problem:{code:"format-newer",message:`This spec tree uses format ${e}, which is newer than this version of BuildKeel supports (format ${t}). You can read it, but not change it.`,remedy:"Update the BuildKeel plugin, then start a new session.",path:"buildkeel.yaml"}}}import{existsSync as VN,readFileSync as sG}from"node:fs";import{isAbsolute as dwe,join as rS,resolve as pwe}from"node:path";var aG="# BuildKeel commit-msg hook",BN=`unit=$(sed -n 's/^ *"activeUnit": *"\\([^"]*\\)".*/\\1/p' .buildkeel/hook-cache.json 2>/dev/null)
384
+ if [ -n "$unit" ] && ! grep -q '^BuildKeel-Unit:' "$1"; then
385
+ git interpret-trailers --in-place --trailer "BuildKeel-Unit: $unit" "$1"
386
+ fi`,fwe=`#!/bin/sh
387
+ ${aG}: adds "BuildKeel-Unit: <id>" to commits made while a unit is active.
388
+ ${BN}
389
+ `;function nS(e){let t=Rt(e,["rev-parse","--git-path","hooks"]);return dwe(t)?t:pwe(e,t)}function cG(e){let t=mwe(e,"core.hooksPath");if(t)return`core.hooksPath (${t})`;let r=[[".husky","husky"],["lefthook.yml","lefthook"],["lefthook.yaml","lefthook"],[".lefthook.yml","lefthook"],[".pre-commit-config.yaml","pre-commit"],[".overcommit.yml","overcommit"]];for(let[o,s]of r)if(VN(rS(e,o)))return s;let i=rS(e,"package.json");if(VN(i)){let o=sG(i,"utf8");if(/"simple-git-hooks"\s*:/.test(o))return"simple-git-hooks"}let n=rS(nS(e),"commit-msg");return VN(n)&&!sG(n,"utf8").includes(aG)?"an existing commit-msg hook":null}function mwe(e,t){try{return Rt(e,["config","--get",t])||null}catch{return null}}function lG(e){let t=rS(nS(e),"commit-msg");return Nr(t,fwe,493),t}var mG=eS("full-sdlc"),Yo=e=>e.split(vwe).join("/");function hG(e){let t;try{t=Rt(e.cwd,["rev-parse","--show-toplevel"])}catch{return w({code:"init-not-git",message:`${e.cwd} is not inside a git repository.`,remedy:"Run git init first, then set up BuildKeel."})}if(t=ep(t),Qd(Xo(t,cr)))return w({code:"init-already",message:`This repository is already set up: ${cr} exists.`,remedy:`To point it at a different spec tree, edit ${cr}.`});if(e.mode&&e.location==="existing")return w({code:"init-mode-existing",message:"An existing spec tree keeps its own mode; setting up a repository with it does not change it.",remedy:"Set up without a mode: the repository follows the tree's mode."});let r=e.mode==="spec-driven";if(r&&e.process!==void 0&&e.process!==null)return w({code:"init-process-spec-driven",message:"A Spec-driven tree has no stages, so it has no process to adjust.",remedy:"Set it up without a process, or choose Full SDLC to adjust its stages."});let i=e.process!==void 0&&e.process!==null;if(i&&e.location==="existing")return w({code:"init-process-existing",message:"An existing spec tree keeps its own process; setting up a repository with it does not change it.",remedy:"Set up without a process, then change the process section of the spec tree's buildkeel.yaml if the team agrees."});let n=e.location==="existing"||r?null:i?ed(e.process):T(gt);if(n&&!n.ok)return n;let o=n?{process:n.value,adjusted:i}:void 0,s=dg(t,["remote","get-url","origin"]),a=e.repoName??(s?dG(s).replace(/\.git$/,""):dG(t)),c=dg(t,["rev-parse","--verify","--quiet","HEAD"]),l=[],u=[],d=`this repo registered as "${a}"${c?`, with commits up to ${c.slice(0,7)} treated as existing work`:""}`,p,f=e.mode??"full-sdlc",m,h;if(e.location==="this-repo"){let g=e.path??"specs";p=ep(t,g);let y=oS(t,p);if(iS(g)||y===""||y.startsWith(".."))return w({code:"init-bad-path",message:`The spec folder must be inside this repository, such as specs; got ${g}.`});if(Qd(Xo(p,Xe)))return w({code:"init-tree-exists",message:`${Yo(y)}/ already holds a spec tree.`,remedy:"Set up again choosing the existing spec tree."});if(Qd(p)&&uG(p).length>0)return w({code:"init-folder-in-use",message:`${Yo(y)}/ already exists and is not empty. Choose another folder.`});let v=fG(a,s,c,i?e.process:void 0,e.mode);u.push({path:Xo(p,Xe),content:v}),l.push({display:`${Yo(y)}/${Xe}`,what:pG(e.mode,d,i)}),m={specs:`./${Yo(y)}`}}else if(e.location==="new-repo"){if(!e.path)return w({code:"init-bad-path",message:"Give the folder for the new spec repository: an empty folder, a new one, or an empty repository you cloned."});p=ep(t,e.path);let g=oS(t,p);if(g===""||!g.startsWith("..")&&!iS(g))return w({code:"init-bad-path",message:`${p} is inside this repository. A new spec repository needs a folder of its own, outside it.`,remedy:"Give a folder next to this repository, such as ../specs, or choose to keep the spec tree in this repository."});if(Qd(Xo(p,Xe)))return w({code:"init-tree-exists",message:`${p} already holds a spec tree.`,remedy:"Set up again choosing the existing spec tree."});let y=Qd(p)?dg(p,["rev-parse","--show-toplevel"]):null;if(!Qd(p))h=p;else{if(y&&!_we(y,p))return w({code:"init-bad-path",message:`${p} is inside the git repository ${y}. Give an empty folder, or the top folder of an empty repository.`});if(!y){if(uG(p).length>0)return w({code:"init-folder-in-use",message:`${p} is not empty and is not a git repository. Give an empty folder, or an empty repository you cloned.`});h=p}}let v=fG(a,s,c,i?e.process:void 0,e.mode);u.push({path:Xo(p,Xe),content:v}),h&&l.push({display:p,what:"a new git repository for the spec tree (git init)"}),l.push({display:Xo(p,Xe),what:pG(e.mode,d,i)});let b=y?dg(p,["remote","get-url","origin"]):null;m={specs:iS(g)?Yo(p):Yo(g),...b?{remote:b}:{}}}else{if(!e.path)return w({code:"init-bad-path",message:"Give the path of the existing spec tree."});p=ep(t,e.path);let g=ro(p);if(!g.ok)return w({code:"init-no-tree",message:`There is no spec tree at ${p}: ${g.problems[0]?.message??""}`,remedy:"Check the path, or clone the spec repository first."});let y=tS(g.value.format);if(!y.writable)return w(y.problem);f=g.value.mode??"full-sdlc";let v=Xo(p,Xe);g.value.repos.some(k=>k.name===a)?l.push({display:v,what:`no change: "${a}" is already registered in this spec tree`}):(u.push({path:v,content:wwe(gwe(v,"utf8"),a,s,c)}),l.push({display:v,what:`in the spec tree: ${d}`}));let b=dg(p,["remote","get-url","origin"]),_=oS(t,p);m={specs:iS(_)?Yo(p):Yo(_),...b?{remote:b}:{}}}return bwe({codeRoot:t,specRoot:p,repoName:a,baseline:c,changes:l,writes:u,pointer:m,options:e,mode:f,...h?{gitInit:h}:{},...o?{process:o}:{}})}var $we=e=>e?"and the process as the team adjusted it":"and the default process";function pG(e,t,r){return e==="spec-driven"?`new spec tree settings: format ${eS("spec-driven")}, Spec-driven, ${t}`:`new spec tree settings: format ${mG}, ${e==="full-sdlc"?"Full SDLC, ":""}${t}, ${$we(r)}`}function bwe(e){let{codeRoot:t,specRoot:r,repoName:i,baseline:n,changes:o,writes:s,pointer:a,options:c}=e,l=["# Which BuildKeel spec tree this repository uses.",`specs: ${a.specs}`,...a.remote?[`remote: ${a.remote}`]:[],`repo: ${i}`,""].join(`
390
+ `);s.push({path:Xo(t,cr),content:l}),o.push({display:cr,what:`points this repo at ${a.specs}`}),o.push({display:".gitignore",what:"ignores .buildkeel/, where BuildKeel keeps local state that is never committed (added only if missing)"});let u={kind:"declined"};if(c.stampCommits){let d=cG(t);if(d)u={kind:"manual",manager:d,lines:BN},o.push({display:"(git hooks)",what:`nothing installed: this repo uses ${d}. Add the commit-msg lines shown below to it.`});else{let p=Xo(nS(t),"commit-msg");u={kind:"install",hookPath:p},o.push({display:Yo(oS(t,p)),what:"a commit-msg hook that adds the active unit to commits you make yourself"})}}return T({codeRoot:t,specRoot:r,repoName:i,baseline:n,changes:o,stamping:u,writes:s,mode:e.mode,...e.gitInit?{gitInit:e.gitInit}:{},...e.process?{process:e.process}:{}})}function gG(e){try{e.gitInit&&(hwe(e.gitInit,{recursive:!0}),Rt(e.gitInit,["init","--quiet"]));for(let t of e.writes)Nr(t.path,t.content);RK(e.codeRoot),e.stamping.kind==="install"&&lG(e.codeRoot)}catch(t){return w({code:"init-write-failed",message:`Setup stopped part way: ${t.message}`})}return T(e)}function fG(e,t,r,i,n){let o=n?`format: ${eS(n)}
391
+ mode: ${n}
392
+ `:`format: ${mG}
393
+ `,s=(0,pg.parseDocument)(`${o}repos: []
394
+ `);return s.commentBefore=" BuildKeel spec tree settings.",s.set("repos",s.createNode([KN(e,t,r)])),i!==void 0&&s.set("process",s.createNode(i)),s.toString()}function wwe(e,t,r,i){let n=(0,pg.parseDocument)(e),o=n.get("repos"),s=n.createNode(KN(t,r,i));return o instanceof pg.YAMLSeq?o.add(s):n.set("repos",n.createNode([KN(t,r,i)])),n.toString()}var KN=(e,t,r)=>({name:e,...t?{remote:t}:{},...r?{baseline:r}:{}}),_we=(e,t)=>{try{let r=i=>ywe.native(i);return process.platform==="win32"?r(e).toLowerCase()===r(t).toLowerCase():r(e)===r(t)}catch{return ep(e)===ep(t)}};function dg(e,t){try{return Rt(e,t)||null}catch{return null}}import{homedir as zwe}from"node:os";import{resolve as Dwe}from"node:path";var vG=Lt(Vt(),1);import{readFileSync as yG}from"node:fs";import{join as sS}from"node:path";var kwe=[];function $G(e,t={}){let r=t.migrations??kwe,i=t.target??Xd,n=e.config.format;if(ZN(n,i))return w({code:"migrate-current",message:`The spec tree is already in format ${n}, the one this version of BuildKeel uses; there is nothing to migrate.`});if(n>i)return w({code:"migrate-newer",message:`The spec tree is in format ${n}, newer than this version of BuildKeel knows (format ${i}).`,remedy:"Update the BuildKeel plugin; a tree is never migrated back."});let o=[];for(let l=n;l<i;){let u=r.find(d=>d.from===l);if(!u)return w({code:"migrate-unknown",message:`This version of BuildKeel has no migration from format ${l}.`,remedy:"Update the BuildKeel plugin, then migrate again."});o.push(u),l=u.to}let s=K(e.root),a=[];for(let l of s.artifacts.values()){let u=yG(sS(e.root,l.path),"utf8"),d=o.reduce((p,f)=>f.workingFile?.(l.type,p)??p,u);d!==u&&a.push({path:l.path,text:d})}let c=(0,vG.parseDocument)(yG(sS(e.root,Xe),"utf8"));for(let l of o)l.config?.(c);return c.set("format",i),T({from:n,to:i,steps:o,files:a.sort((l,u)=>l.path.localeCompare(u.path)),config:c.toString()})}function bG(e,t){try{for(let r of t.files)Nr(sS(e.root,r.path),r.text);Nr(sS(e.root,Xe),t.config)}catch(r){return w({code:"migrate-write-failed",message:`The migration stopped part way: ${r.message}`,remedy:"Restore the spec tree with git checkout, then migrate again."})}return Me(e.root,[Xe,...t.files.map(r=>r.path)],`migrate: format ${t.from} to ${t.to}`)}import{appendFileSync as Swe,copyFileSync as xwe,existsSync as wG,mkdirSync as WN,readdirSync as Iwe,readFileSync as _G,rmSync as Twe,writeFileSync as Pwe}from"node:fs";import{dirname as kG,join as fg}from"node:path";var Rwe="usage",SG="settings.json",ha=e=>fg(e,Rwe),GN=(e,t)=>fg(ha(e),`${jd(t)}.jsonl`);function mg(e){try{return JSON.parse(_G(fg(ha(e),SG),"utf8")).recording!==!1}catch{return!0}}function HN(e,t){WN(ha(e),{recursive:!0}),Pwe(fg(ha(e),SG),`${JSON.stringify({recording:t},null,2)}
395
+ `)}function xG(e,t,r,i,n=new Date){try{if(!mg(e))return;let o=GN(e,t);WN(kG(o),{recursive:!0});let s={at:n.toISOString().replace(/\.\d{3}Z$/,"Z"),host:r,...i};Swe(o,`${JSON.stringify(s)}
396
+ `)}catch{}}function IG(e,t){let r;try{r=_G(GN(e,t),"utf8")}catch{return[]}return r.split(`
397
+ `).flatMap(i=>{if(!i.trim())return[];try{let n=JSON.parse(i);return typeof n.event=="string"&&typeof n.at=="string"?[n]:[]}catch{return[]}})}function TG(e){let t=ha(e);if(!wG(t))return 0;let r=Iwe(t).filter(i=>i.endsWith(".jsonl"));for(let i of r)Twe(fg(t,i),{force:!0});return r.length}function PG(e,t,r){let i=GN(e,t);return wG(i)?(WN(kG(r),{recursive:!0}),xwe(i,r),!0):!1}var RG=Lt(Vt(),1);import{readFileSync as Cwe}from"node:fs";import{join as Awe}from"node:path";function JN(e){if(!e.access.writable)return w(e.access.problem);let t=Tc(e.root);if(!t.ok)return t;let{areas:r,unmapped:i}=t.value,n=[];r.length===0&&n.push({code:"switch-no-areas",message:"No area of the map holds capability specs yet, so nothing is converted."}),i.length>0&&n.push({code:"switch-unmapped",message:`${i.join(", ")} ${i.length===1?"is":"are"} in no area of the map, so ${i.length===1?"it was":"they were"} never converted.`});let o=r.filter(s=>s.state!=="converted");if(o.length>0&&n.push({code:"switch-areas-open",message:`${o.length===1?"One area is":`${o.length} areas are`} not converted yet: ${o.map(s=>`${s.area.name} (${s.unplaced.length} of ${s.scenarios.length} scenarios not placed)`).join(", ")}.`}),n.length>0){let[s,...a]=n;return w({...s,remedy:`Carry on with ${ee("onboard")}: the tree stays Spec-driven until every area is converted.`},...a)}return t}function CG(e,t,r=()=>new Date){let i=JN(e);if(!i.ok)return i;let n=lt(e.root);if(!n)return w({code:"conversion-no-identity",message:"Git has no name and email set for the spec repo, so who switched the tree cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com.'});let o={...i.value.conversion,finishedBy:n,finishedAt:id(r())},s=(0,RG.parseDocument)(Cwe(Awe(e.root,Xe),"utf8"));s.set("mode","full-sdlc"),Object.keys(o.process).length>0?s.set("process",s.createNode(o.process)):s.delete("process");let a=t.writeFile(Xe,s.toString({lineWidth:0}));if(!a.ok)return a;let c=t.writeFile(Mt,rd(o));return c.ok?T({conversion:o,commit:Me(e.root,[Xe,Mt],"onboard: switch to Full SDLC")}):c}import{existsSync as Ewe,readdirSync as Owe,rmSync as Nwe}from"node:fs";import{join as AG}from"node:path";var jwe=e=>({code:"conversion-no-identity",message:`Git has no name and email set for the spec repo, so who ${e} the conversion cannot be recorded.`,remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com.'});function YN(e,t){if(!e.access.writable)return w(e.access.problem);let r=B(e.root);if(r.mode!=="spec-driven")return w({code:"conversion-full-sdlc",message:"This spec tree already follows Full SDLC. The mode only moves from Spec-driven to Full SDLC, never back."});if(r.conversion)return w({code:"conversion-started",path:Mt,message:"This spec tree is already being converted to Full SDLC.",remedy:"Carry on with the next area, or cancel the conversion."});let i=Ys(e.root);if(i.length>0){let d=i.map(p=>`${p.id}${p.title?` "${p.title}"`:""}`).join(", ");return w({code:"conversion-open-changes",message:`This spec tree has ${i.length===1?"an open change":`${i.length} open changes`}: ${d}. A tree moves to Full SDLC only with no change open, so that nothing planned as a change is lost.`,remedy:`Finish or discard ${i.length===1?"it":"each of them"} first: finish with ${ee("done")}, or discard it if the work is dropped. Then convert.`})}if(!r.process.ok)return r.process;let n=ro(e.root),o=n.ok?n.value.process??{}:{},s={...t??{}};for(let d of["bug","adhoc"])s[d]===void 0&&o[d]!==void 0&&(s[d]=o[d]);let a=dB(e.root,s);if(!a.ok)return a;let c=a.value.chain.find(d=>vc.some(p=>p.type===d.type));if(c)return w({code:"conversion-type-taken",message:`The stage of type ${c.type} has the type of this tree's ${vc.find(d=>d.type===c.type)?.name}s, which stay in the tree as history.`,remedy:`Give the stage another type, such as ${c.type}-area; its name can stay "${c.name}".`});let l=r.process.value.change.prefix,u=a.value.chain.find(d=>d.prefix===l);return u?w({code:"conversion-prefix-taken",message:`The ${u.name} stage uses the prefix ${l}, which this tree's changes have: ${l}-001 would name both a change and a ${u.name}.`,remedy:"Give the stage another prefix."}):T({process:a.value,input:s})}function EG(e,t,r,i=()=>new Date){let n=YN(e,r);if(!n.ok)return n;let o=lt(e.root);if(!o)return w(jwe("started"));let s={startedBy:o,startedAt:id(i()),process:n.value.input,placed:{},dropped:{}},a=t.writeFile(Mt,rd(s));return a.ok?T({plan:n.value,conversion:s,commit:Me(e.root,[Mt],"onboard: start conversion to Full SDLC")}):a}function OG(e){return B(e).types.filter(t=>t.type!=="bug"&&t.type!=="adhoc").map(t=>t.dir)}function NG(e,t){let r=AG(e,t);return Ewe(r)?Owe(r,{withFileTypes:!0}).flatMap(i=>i.isDirectory()?NG(e,`${t}/${i.name}`):[`${t}/${i.name}`]):[]}function XN(e){if(!e.access.writable)return w(e.access.problem);let t=B(e.root);if(t.mode!=="spec-driven"||t.conversion?.state!=="in-progress")return w({code:"conversion-none",message:t.mode==="spec-driven"?"This spec tree is not being converted.":"This spec tree follows Full SDLC; there is no conversion to cancel."});let r=OG(e.root).flatMap(n=>NG(e.root,n)),i=r.filter(n=>/\/approvals\/[^/]+$/.test(n));if(i.length>0){let n=[...new Set(i.map(o=>o.split("/")[1]))].sort();return w({code:"conversion-approved",message:`The conversion cannot be cancelled: ${n.join(", ")} ${n.length===1?"is":"are"} approved already, and approvals are never removed.`,remedy:`Finish the conversion with ${ee("onboard")}, area by area. Meanwhile the tree keeps working for bugs, ad-hoc units and looking up capability specs.`})}return T({files:[Mt,...r]})}function jG(e,t){let r=XN(e);if(!r.ok)return r;let i=OG(e.root);for(let n of r.value.files){let o=t.remove(n);if(!o.ok)return o}for(let n of i)Nwe(AG(e.root,n),{recursive:!0,force:!0});return T({plan:r.value,commit:Me(e.root,r.value.files,"onboard: cancel conversion to Full SDLC")})}function zG(e,t,r){let{tree:i}=t;if(r.convert==="place"){let n=nK(i,e.writer(t),{...r.place?{place:r.place}:{},...r.drop?{drop:r.drop}:{}});if(!n.ok)return D("Nothing was recorded.",n.problems);let{placed:o,dropped:s,commit:a}=n.value,c=Tc(i.root);return[...o.map(({scenario:l,to:u})=>`- ${l} became ${u.id} (${u.kind==="test case"?`a test case of ${u.record.id}`:`in ${u.record.id}`} v${u.version})`),...s.map(l=>`- ${l} is left out, as the user chose`),a.ok?`Recorded in ${Mt}, committed (${a.value.slice(0,7)}).`:`Written but not committed: ${a.problems[0]?.message??""}`,...c.ok?["",...QN(c.value)]:[]].join(`
398
+ `)}if(r.convert==="start"){if(!r.apply){let s=YN(i,r.process);return s.ok?["Converting moves this spec tree to Full SDLC, with this process:","",...Ud(s.value.process),"","Starting it will:",`- write ${Mt}, with who started it, when, and this process, committed on its own`,"- stop new changes from being opened until the conversion is finished; bugs and ad-hoc units work as usual","","Then each area of the map is drafted into these stages as version 0, from its capability specs and archived changes, and approved as a set. The tree stays Spec-driven until every area is converted; it can be cancelled until the first area is approved. The capability specs and archived changes stay, read-only, as history. The move is one way.","","Nothing has been written yet. Show the table to the user, as it is, and ask whether to convert with this process, adjust it, or stop. To adjust, ask one question at a time, call manage again without apply with the process, and show the new table; call manage with action=convert, convert=start, the same process and apply=true only when the user agrees."].join(`
399
+ `):D("The conversion cannot start.",s.problems)}let n=EG(i,e.writer(t),r.process);if(!n.ok)return D("The conversion did not start.",n.problems);e.refreshHookCache(t);let{commit:o}=n.value;return[`The conversion to Full SDLC has started: ${Mt} ${o.ok?`committed as "onboard: start conversion to Full SDLC" (${o.value.slice(0,7)})`:`written but not committed: ${o.problems[0]?.message??""}`}.`,"No new change can be opened until it is finished. Next: map the capabilities into areas."].join(`
400
+ `)}if(r.convert==="cancel"){if(!r.apply){let s=XN(i);if(!s.ok)return D("The conversion cannot be cancelled.",s.problems);let a=s.value.files.filter(c=>c!==Mt);return["Cancelling the conversion will:",`- remove ${Mt}${a.length>0?`, and the ${a.length===1?"file":`${a.length} files`} drafted for it: ${a.join(", ")}`:""}`,'- commit that as "onboard: cancel conversion to Full SDLC" in the spec repo',"","The tree stays Spec-driven, and changes can be opened again. Nothing has been written yet. Ask the user to confirm, then call manage again with action=convert, convert=cancel and apply=true."].join(`
401
+ `)}let n=jG(i,e.writer(t));if(!n.ok)return D("The conversion was not cancelled.",n.problems);e.refreshHookCache(t);let{commit:o}=n.value;return`The conversion is cancelled: this spec tree is Spec-driven, and changes can be opened again. ${o.ok?`Committed as "onboard: cancel conversion to Full SDLC" (${o.value.slice(0,7)}).`:`Removed but not committed: ${o.problems[0]?.message??""}`}`}if(r.convert==="finish"){if(!r.apply){let s=JN(i);if(!s.ok)return D("The tree cannot switch to Full SDLC yet.",s.problems);let{areas:a,conversion:c}=s.value,l=a.reduce((d,p)=>d+p.placed.length,0),u=a.reduce((d,p)=>d+p.dropped.length,0);return[`Every area is converted: ${a.length} area${a.length===1?"":"s"}, ${l} scenario${l===1?"":"s"} placed${u>0?`, ${u} left out by the user's choice`:""}. Switching will:`,`- set mode: full-sdlc in ${Xe}, with the process the conversion chose${Object.keys(c.process).length>0?"":" (the defaults)"}`,`- mark ${Mt} finished, with who switched the tree and when; it keeps where each scenario went, so tests tagged with scenarios keep counting`,'- commit both, on their own, as "onboard: switch to Full SDLC"',"","From then on, work goes through the team's stages, approvals and gates, and no change can be opened. The capability specs and archived changes stay, read-only, as history. The move is one way.","","Nothing has been written yet. Ask the user to confirm, then call manage again with action=convert, convert=finish and apply=true."].join(`
402
+ `)}let n=CG(i,e.writer(t));if(!n.ok)return D("The tree was not switched.",n.problems);e.refreshHookCache(t);let{commit:o}=n.value;return[`This spec tree follows Full SDLC now: ${o.ok?`committed as "onboard: switch to Full SDLC" (${o.value.slice(0,7)})`:`written but not committed: ${o.problems[0]?.message??""}`}.`,"Work goes through the team's stages from here: draft with {{bk:new}} or {{bk:capture}}, approve with {{bk:approve}}, and start with {{bk:start}}. The capability specs and archived changes stay, read-only, as history."].join(`
403
+ `)}return"Say which step of the conversion: convert=start (with process when the user adjusts it), convert=place, convert=finish, or convert=cancel."}function QN(e){let{areas:t,unmapped:r,waiting:i,next:n,conversion:o}=e,s=t.filter(l=>l.state==="converted").length,a=[`Converting to Full SDLC, started by ${o.startedBy} on ${o.startedAt.slice(0,10)}: ${s} of ${t.length} area${t.length===1?"":"s"} converted. The tree stays Spec-driven until every area is.`];if(t.length===0)return a.push("","There is no map of areas for the conversion yet. Propose areas from the capability specs, each holding one or more of them, and write the map with manage action=map (each area with its capabilities) once the user agrees."),a;a.push("","| Area | Capability specs | Where it stands |","|---|---|---|");for(let l of t){let u=l.scenarios.length,d=u-l.unplaced.length,p=l.state==="converted"?`converted: ${l.placed.length} scenario${l.placed.length===1?"":"s"} placed${l.dropped.length>0?`, ${l.dropped.length} left out`:""}`:l.state==="partly"?`${d} of ${u} scenarios placed or left out`:"not started";a.push(`| ${l.area.name} | ${l.capabilities.join(", ")} | ${p} |`)}r.length>0&&a.push("",`In no area yet: ${r.join(", ")}. Each capability spec goes in one area before the tree can switch.`),i.length>0&&a.push("",`Waiting for approval (version 0): ${i.join(", ")}.`);let c=t.filter(l=>l.state==="partly").flatMap(l=>l.unplaced);return c.length>0&&a.push("",`Not placed yet, in areas already begun: ${c.map(l=>`${l.id} "${l.title}"`).join(", ")}. Place each on the criterion or test case it became, or leave it out if the user says so; nothing is dropped without their choice.`),a.push("",n?`Next: ${n.area.name}.`:r.length>0?"Next: put the capability specs in no area into one.":"Every area is converted. Next: switch the tree to Full SDLC with manage, action=convert, convert=finish, first without apply, and ask the user to confirm."),a}var MG=Zt({name:"manage",title:"Set up and maintain BuildKeel",description:"Setup and housekeeping. action=init sets up this repository: a new spec tree in a folder of this repo (location=this-repo), a pointer to an existing spec tree (location=existing, path=<spec tree>), or a new spec repository of its own outside this repo (location=new-repo, path=<folder>: an empty folder, a new one, or an empty clone); a new tree follows the mode the user chose (mode). Call it first without apply to get the list of everything it will add, show that to the user, and call again with apply=true only after the user agrees. action=release with id releases the claim on a unit held by a working tree on this machine, before it is finished, only when the user asks for it; it stops being the active unit there, and its branch and commits stay as they are. action=usage changes the usage record kept on this machine: usage=off stops recording, usage=on starts it again, usage=delete deletes the record, and usage=export writes this spec tree's record to path, all only on the user's request; nothing is ever sent anywhere. action=migrate upgrades a spec tree in an older format to the one this version of BuildKeel uses: without apply it lists what changes, and with apply=true, only after the user agrees, it rewrites working files and buildkeel.yaml in one commit; frozen versions and records are never changed. action=untracked, only when the user has said to go ahead without a unit after being offered one: lets files be changed in this working tree with no active unit until a unit is started; those changes belong to no unit, and their commits are listed by the status overview. action=map writes the map of the code's capability areas that onboarding goes through, only once the user agreed to it or asked for the change: map=set with areas (each with a name, its paths, and its repo when the tree serves several), map=merge, map=split or map=rename. action=guide, in a Spec-driven tree, records whether this person is guided through their first change (guide=on) or not (guide=off), on this machine only: at the end of setup with their answer, or when they say to stop or start explaining. action=discard with id, in a Spec-driven tree, discards an open change: without apply it says what goes, then only after the user confirms, apply=true with reason (optional, the user's words) removes its files and leaves a discard record, in one commit. action=convert, in a Spec-driven tree, moves it to Full SDLC through onboarding, only on the user's request: convert=start without apply shows the process it would follow, and with apply=true, once the user agrees, starts the conversion; convert=place, once an area is approved, records which approved acceptance criterion or test case each of its scenarios became (place), or that the user left it out (drop); convert=finish, once every area is converted, switches the tree to Full SDLC (without apply it says what changes; apply=true only after the user confirms); convert=cancel, until the first area is approved, removes the conversion and its drafts. action=match with id (a test case, such as US-E001-TC1) and tests records which existing tests implement it, without changing the code: name each test exactly as the latest JUnit report names it (query view=untested lists them), replacing what was matched before; tests empty drops the match. Matches are for tests that existed before BuildKeel; a new test carries the test case ID in its name instead.",inputSchema:{action:$.enum(["init","release","untracked","usage","migrate","match","map","discard","guide","convert"]).describe("What to do."),convert:$.enum(["start","cancel","place","finish"]).optional().describe("convert: start begins moving a Spec-driven tree to Full SDLC (process when the user adjusts the stages); place records where scenarios went once their area is approved (place, drop); finish switches the tree once every area is converted; cancel stops it, until the first area is approved."),place:$.record($.string(),$.string()).optional().describe("convert=place: each scenario, by ID, with the approved acceptance criterion or test case it became, such as { AUTH-R3-S1: US-E004-TC1 }."),drop:$.array($.string()).optional().describe("convert=place: scenarios the user chose to leave out, by ID."),guide:$.enum(["on","off"]).optional().describe("guide: on to be guided through the first change in this spec tree, off to stop the explaining."),reason:$.string().optional().describe("discard: why the change is discarded, as the user put it, such as replaced by CH-016."),map:$.enum(["set","merge","split","rename","question","answer","tickets"]).optional().describe("map: set writes the whole map (areas); merge joins the areas named in merge into one called to; split replaces area with areas; rename renames area to to. In a Spec-driven tree, question records a question the user left open on area (question), and answer records the answer to one (questionId, answer), once someone who knows gives it. tickets records every ticket read for area and what became of it (tickets), replacing the area's list."),question:$.object({about:$.string(),code:$.string(),source:$.string(),sources:$.array($.string()).optional()}).optional().describe("map question: what it concerns, what the code does, what the source says, and the sources' keys."),questionId:$.string().optional().describe("map answer: the question, such as Q1."),tickets:$.array($.object({key:$.string(),link:$.string().optional(),title:$.string(),outcome:$.enum(["carried","left-out"]),artifact:$.string().optional().describe("carried: the artifact it became (its approved ID), or the capability spec it fed."),why:$.enum(["open","in-progress","choice"]).optional().describe("left-out: open, in-progress, or choice when the team chose not to carry it over.")})).optional().describe("map tickets: every ticket read for the area, each carried over or left out."),answer:$.enum(["code","source"]).optional().describe("map answer: code when the code is right, source when the source is (the code has a defect)."),areas:$.array($.object({name:$.string(),repo:$.string().optional(),paths:$.array($.string()).optional(),summary:$.string().optional(),capabilities:$.array($.string()).optional()})).optional().describe("map set or split: each area's name, the paths it covers (such as src/reset/), its repo when the tree serves several, and one line on what it does. While a Spec-driven tree is converted to Full SDLC: the capability specs each area drafts (capabilities, by code), each in one area; paths are then optional."),area:$.string().optional().describe("map split or rename: the area, by name."),merge:$.array($.string()).optional().describe("map merge: the areas to join, by name."),to:$.string().optional().describe("map merge or rename: the new name."),tests:$.array($.string()).optional().describe("match: the existing tests that implement the test case, each as a JUnit report names it, such as test/reset.test.ts > emails a reset link."),usage:$.enum(["off","on","delete","export"]).optional().describe("usage: what to do with the usage record."),id:$.string().optional().describe("release: the unit whose claim to release, such as TK-001. match: the test case, such as US-E001-TC1. discard: the change, such as CH-014."),location:$.enum(["this-repo","existing","new-repo"]).optional().describe("init: where the spec tree lives."),path:$.string().optional().describe("init: this-repo: folder for the new spec tree (default specs). existing: the spec tree's path. new-repo: the new spec repository's folder. usage=export: the file to write, such as ~/buildkeel-usage.jsonl."),repoName:$.string().optional().describe("init: this repository's name in the spec tree. Defaults to the remote's name."),stampCommits:$.boolean().optional().describe("init: add the active unit to commits the user makes by hand, through a git hook."),mode:$.enum(nO).optional().describe("init, for a new spec tree: spec-driven (capability specs and changes, no approvals; offer it first) or full-sdlc (stages, approvals and gates). An existing spec tree keeps its own."),process:$.record($.string(),$.unknown()).optional().describe("init, for a new spec tree, or convert=start, only when the user adjusts the default process: the process section of buildkeel.yaml, such as { chain: [{ type: idea }, { type: epic, requires: [] }, { type: story, name: feature, requires: [test-plan, design] }, { type: task }] }. Stages: rename with name, add one between idea and story with type, prefix and dir; requires lists the documents (test-plan, design) each stage needs approved before work under it starts. documents renames a built-in document or adds the team's own with type, name and suffix."),apply:$.boolean().default(!1).describe("false: only list what would change. true: make the changes.")},readOnly:!1,run(e,t){if(t.action==="release")return Zwe(e.home,e.workspace(),t.id);if(t.action==="untracked")return Fwe(e.workspace());if(t.action==="migrate")return Lwe(e.workspace(),t.apply);if(t.action==="map"){let s=e.workspace();if(!s.ok)return D("BuildKeel cannot read a spec tree here.",s.problems);let a=Uwe(s.value,e.writer(s.value),t);e.flushWrites();let c=qn(s.value.tree.root);return c.ok&&c.value&&a.startsWith("The map now has")&&e.usage(s.value,{event:"map",areas:c.value.areas.length}),a}if(t.action==="match"){let s=e.workspace();if(!s.ok)return D("BuildKeel cannot read a spec tree here.",s.problems);let a=qwe(s.value,e.writer(s.value),t.id,t.tests);return e.flushWrites(),a}if(t.action==="guide"){let s=e.workspace();return s.ok?B(s.value.tree.root).mode!=="spec-driven"?"The guide is for Spec-driven trees; this spec tree follows Full SDLC.":t.guide?(Gk(e.home,s.value.tree.root,t.guide),e.usage(s.value,{event:"guide",state:t.guide}),e.refreshHookCache(s.value),t.guide==="on"?"Guidance is on for this spec tree, on this machine: at each step of the user's first change, from drafting to finishing, BuildKeel's results say what to explain in a line or two. It ends when that change is finished, or when the user says to stop.":"Guidance is off for this spec tree, on this machine: nothing more is explained. The user can turn it back on by saying so."):"Say guide=on or guide=off, as the user chose.":D("BuildKeel cannot read a spec tree here.",s.problems)}if(t.action==="discard"){let s=e.workspace();if(!s.ok)return D("BuildKeel cannot read a spec tree here.",s.problems);let a=Bwe(e,s.value,t.id,t.reason,t.apply);return t.apply&&e.refreshHookCache(s.value),a}if(t.action==="convert"){let s=e.workspace();return s.ok?zG(e,s.value,t):D("BuildKeel cannot read a spec tree here.",s.problems)}if(t.action==="usage")return Mwe(e.home,e.workspace(),t.usage,t.path,e.cwd);if(!t.location||t.stampCommits===void 0)return"To set up, ask the user where the spec tree should live (in this repo, an existing spec tree, or a new spec repository of its own) and whether to stamp their own commits, then call manage again with location and stampCommits.";let r={cwd:e.cwd,location:t.location,stampCommits:t.stampCommits,...t.path?{path:t.path}:{},...t.repoName?{repoName:t.repoName}:{},...t.process?{process:t.process}:{},...t.mode?{mode:t.mode}:{}},i=hG(r);if(!i.ok)return D("BuildKeel cannot set up this repository.",i.problems);if(!t.apply)return[`BuildKeel will set up ${i.value.codeRoot}:`,...DG(i.value),"",i.value.process?"Nothing has been written yet. Show this list and the process to the user, as they are, and ask whether to set up with this process, adjust it, or stop. To adjust, ask one question at a time, call manage again without apply with the process, and show the new table; call manage with the same choices and apply=true only when the user agrees.":"Nothing has been written yet. Show this list to the user and ask them to confirm; then call manage again with the same choices and apply=true."].join(`
404
+ `);let n=gG(i.value);if(!n.ok)return D("Setup did not finish.",n.problems);let o=e.workspace();return o.ok&&e.refreshHookCache(o.value),[`BuildKeel is set up in ${i.value.codeRoot}: from now on, code changes here follow the team's process, and conversation stays free. Changed:`,...DG(i.value),"","Nothing was committed. Review the changes and commit them; if the spec tree is in another repository, commit and push it there too, so the team sees this repo registered.",...i.value.gitInit?[`The new spec repository at ${i.value.gitInit} has no remote yet: add one and push it, so other code repositories and teammates can use it.`]:[],...i.value.baseline?["This repository already holds code: it is documented as work touches it, with a version 0 of what each change touches, or all at once with {{bk:onboard}}, whenever you choose."]:[],...i.value.mode==="spec-driven"?["Then ask the user, with your tool for asking a question with choices: **Guide me through my first change** (the default), with a line or two at each step of it on what happened and what comes next, or **Jump right in**. Record the answer with manage, action guide, guide on or off: it is kept on this machine only, for this person."]:[],i.value.mode==="spec-driven"?"Next: talk through what you want to build, as you would without BuildKeel. When you want it planned, {{bk:capture}} turns the conversation into a change: a proposal, spec changes for the capabilities it alters, and tasks; {{bk:new}} drafts one.":"Next: talk through what you want to build, as you would without BuildKeel. When you want it planned, {{bk:capture}} turns the conversation into the artifacts your process needs, and {{bk:new}} drafts one artifact at a time."].join(`
405
+ `)}});function Mwe(e,t,r,i,n){if(r==="off")return HN(e,!1),`Usage recording is off on this machine: nothing new is recorded, and everything else works as before. What was recorded stays in ${ha(e)} until you delete it.`;if(r==="on")return HN(e,!0),`Usage recording is on again on this machine, in ${ha(e)}. Nothing is sent anywhere.`;if(r==="delete"){let o=TG(e);return o===0?"There is no usage record on this machine to delete.":`Deleted the usage record on this machine: ${o} log${o===1?"":"s"}. ${mg(e)?"Recording carries on from now; turn it off with usage off.":"Recording stays off."}`}if(r==="export"){if(!t.ok)return D("BuildKeel cannot read a spec tree here.",t.problems);if(!i)return"Give the path of the file to write the usage record to.";let o=Dwe(n,i.replace(/^~(?=$|[/\\])/,zwe()));return PG(e,t.value.tree.root,o)?`Wrote this spec tree's usage record to ${o}: one JSON line per event, with IDs, types, outcomes and times, and no artifact text or code.`:"There is no usage record for this spec tree on this machine yet, so nothing was written."}return"Say what to do with the usage record: usage off, on, delete or export (with a path)."}function Lwe(e,t){if(!e.ok)return D("BuildKeel cannot read a spec tree here.",e.problems);let{tree:r}=e.value,i=$G(r);if(!i.ok)return D("Nothing was migrated.",i.problems);let{from:n,to:o,steps:s,files:a}=i.value,c=[...s.map(u=>`- Format ${u.from} to ${u.to}: ${u.summary}`),`- buildkeel.yaml: format ${o}`,...a.map(u=>`- ${u.path}`)];if(!t)return[`Migrating the spec tree from format ${n} to ${o} rewrites ${a.length} working file${a.length===1?"":"s"} and buildkeel.yaml, in one commit. Frozen versions and records stay exactly as they are, so every approval still matches its hash.`,...c,"","Nothing has been written yet. Show this to the user, and call manage again with action migrate and apply=true only if they agree."].join(`
406
+ `);let l=bG(r,i.value);return l.ok?[`Migrated the spec tree from format ${n} to ${o}: it can be changed again, and every approval still matches its hash. Committed as "migrate: format ${n} to ${o}" (${l.value.slice(0,7)}), with only these files:`,...c,"Push the spec repo so the team gets it; anyone on an older BuildKeel needs to update the plugin first."].join(`
407
+ `):D("The migration did not finish.",l.problems)}function Uwe(e,t,r){if(r.map==="question"||r.map==="answer")return Kwe(e,t,r);if(r.map==="tickets")return Wwe(e,t,r.area,r.tickets);let i=r.map==="set"&&r.areas?{op:"set",areas:r.areas}:r.map==="merge"&&r.merge&&r.to?{op:"merge",names:r.merge,to:r.to}:r.map==="split"&&r.area&&r.areas?{op:"split",name:r.area,areas:r.areas}:r.map==="rename"&&r.area&&r.to?{op:"rename",name:r.area,to:r.to}:"Say how to change the map: map set with areas, map merge with merge and to, map split with area and areas, or map rename with area and to.";if(typeof i=="string")return i;let{tree:n,resolved:o}=e,s=Dh({root:n.root,writer:t,defaultRepo:o.pointer.repo},i);if(!s.ok)return D("The map was not changed.",s.problems);let{map:a,summary:c,commit:l}=s.value,u=l.ok?`committed as "onboard: ${c}" (${l.value.slice(0,7)})`:`written but not committed: ${l.problems[0]?.message??""}`,d=a.areas.some(p=>p.capabilities);return[`The map now has ${a.areas.length} area${a.areas.length===1?"":"s"}, in ${sn}, ${u}:`,"",d?"| Area | Capability specs | Repo | Paths | What it does |":"| Area | Repo | Paths | What it does |",d?"|---|---|---|---|---|":"|---|---|---|---|",...a.areas.map(p=>`| ${p.name} |${d?` ${(p.capabilities??[]).join(", ")} |`:""} ${p.repo} | ${p.paths.join(", ")} | ${p.summary??""} |`)].join(`
408
+ `)}function qwe(e,t,r,i){if(!r||i===void 0)return"Give the test case's id and the tests that implement it, as the latest test report names them; no tests drops its match.";let{tree:n,resolved:o}=e,s=lt(n.root);if(!s)return'Git has no name and email set for the spec repo, so who matched the tests cannot be recorded. Set them with git config user.name "Your Name" and git config user.email you@example.com.';let a=K(n.root),c=IK({root:n.root,writer:t,index:a},{testCase:r,tests:i,by:s,at:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});if(!c.ok)return D("Nothing was matched.",c.problems);let{path:l,commit:u}=c.value,d=u.ok?`committed as "match: ${r}${c.value.tests.length===0?" dropped":""}" (${u.value.slice(0,7)}) in the spec repo`:`written but not committed: ${u.problems[0]?.message??""}`;if(c.value.tests.length===0)return`Dropped the match of ${r}: ${l} is removed, ${d}. ${r} counts as having a test again only once a test is tagged [${r}] or matched to it.`;let p=Ei(o.codeRoot).latest,f=p?c.value.tests.filter(m=>!p.tests.includes(m)):[];return[`Matched ${r} to ${c.value.tests.join("; ")} in ${l}, ${d}. The code is unchanged: results of ${c.value.tests.length===1?"that test":"those tests"} now count for ${r}.`,...f.length>0?[`Not in the latest test report (${p?.report}): ${f.join("; ")}. Check the names against the report; a match counts only when a report names the test the same way.`]:[]].join(`
409
+ `)}function Fwe(e){if(!e.ok)return D("BuildKeel cannot read a spec tree here.",e.problems);let{codeRoot:t}=e.value.resolved,r=_e(t);if(r?.activeUnit)return`${r.activeUnit} is the active unit in this working tree, so changes belong to it. Finish it, or start another unit, instead.`;let i=r?.untrackedSince??new Date().toISOString().replace(/\.\d{3}Z$/,"Z");return wr(t,{untrackedSince:i})?[`Working without a unit in ${t} since ${i}: BuildKeel no longer holds edits here until a unit is started.`,"Changes made now belong to no unit. Commit them without a BuildKeel-Unit line; the status overview lists those commits under commits with no unit.","Starting a unit with {{bk:start}} <ID> ends this."].join(`
410
+ `):"BuildKeel has not prepared this working tree yet; call another BuildKeel tool first, then try again."}function Zwe(e,t,r){if(!t.ok)return D("BuildKeel cannot read a spec tree here.",t.problems);if(!r)return"Give the id of the unit whose claim to release.";let i=a9(e,t.value.tree.root,r);if(!i)return`${r} is not claimed on this machine, so there is nothing to release.`;let{claim:n,cleared:o}=i,s=[`Released the claim on ${r}, held by ${n.workingTree}${n.branch?` (branch ${n.branch})`:""} since ${n.claimedAt}. Any working tree can start it now.`];return o&&s.push(`${r} is no longer the active unit in ${n.workingTree}; its branch and commits are unchanged. Start it again with {{bk:start}} ${r} to carry on.`),s.join(`
411
+ `)}var Vwe={"spec-driven":"Spec-driven: capability specs say how the system behaves, and each piece of work is a change to them, with no approvals or gates.","full-sdlc":"Full SDLC: work goes through the team's stages, from business idea down, with approvals and gates."};function DG(e){let t=e.changes.map(r=>`- ${r.display}: ${r.what}`);return t.push("",`The spec tree follows ${Vwe[e.mode]}`),e.process&&t.push("",e.process.adjusted?"The process, as adjusted:":"The process: BuildKeel's default, which the team can use as it is or adjust.","",...Ud(e.process.process)),e.stamping.kind==="manual"&&t.push("",`To stamp your own commits, add these lines to the commit-msg hook managed by ${e.stamping.manager}:`,"","```sh",e.stamping.lines,"```"),t}function Bwe(e,t,r,i,n){let{tree:o,resolved:s}=t;if(B(o.root).mode!=="spec-driven")return"Discarding is for changes, which belong to Spec-driven trees; this spec tree follows Full SDLC.";if(!r)return"Name the change to discard with id, such as CH-014.";let a={tree:o,codeRoot:s.codeRoot,home:e.home,id:r,activeUnit:_e(s.codeRoot)?.activeUnit??null};if(!n){let h=kN(a);if(!h.ok)return D(`${r} cannot be discarded.`,h.problems);let{files:g,ids:y,active:v,claimed:b,title:_}=h.value;return[`Discarding ${r}${_?` "${_}"`:""} will:`,`- remove its ${g.length===1?"file":`${g.length} files`}: ${g.join(", ")}`,`- write its discard record, ${Lk(r)}: its ID, title, who discarded it, when, and the reason`,`- commit both as "discard: ${r}" in the spec repo`,...v?["- release its claim and clear the active unit here; its branch and commits stay as they are"]:b?["- release its claim on this machine"]:[],"",`No capability spec changes.${y.length>0?` The IDs it gave (${y.join(", ")}) are never used again.`:""} Commits stamped with ${r} stay with it, shown as belonging to a discarded change.`,"",`Nothing has been written yet. Ask the user to confirm, and for a reason if they want to give one (optional), then call manage again with action=discard, id ${r}, the reason, and apply=true.`].join(`
412
+ `)}let c=gr(e.home,o.root,r)?.claimedAt,l=K9({...a,writer:e.writer(t),...i?{reason:i}:{}});if(!l.ok)return D(`${r} was not discarded.`,l.problems);let u=c?Math.max(0,Math.round((Date.parse(l.value.record.discardedAt)-Date.parse(c))/1e3)):void 0;e.usage(t,{event:"change",unit:r,action:"discarded",...u!==void 0?{seconds:u}:{}});let{plan:d,path:p,commit:f,record:m}=l.value;return[`Discarded ${r}${d.title?` "${d.title}"`:""}${m.reason?` (${m.reason})`:""}.`,`- Removed ${d.files.length===1?"its file":`its ${d.files.length} files`}, and wrote ${p}.`,f.ok?`- Committed as "discard: ${r}" (${f.value.slice(0,7)}) in the spec repo.`:`- Written but not committed: ${f.problems[0]?.message??""} Commit it in the spec repo yourself.`,...d.active?["- Released its claim; there is no active unit in this working tree now."]:d.claimed?["- Released its claim on this machine."]:[]].join(`
413
+ `)}function Kwe(e,t,r){let{tree:i,resolved:n}=e;if(B(i.root).mode!=="spec-driven")return"Questions are kept on the map in a Spec-driven tree. In this tree, keep a question in the version 0 draft it concerns, with save_draft.";let o=lt(i.root);if(!o)return'Git has no name and email set for the spec repo, so who left the question open cannot be recorded. Set them with git config user.name "Your Name" and git config user.email you@example.com.';let s=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),a={root:i.root,writer:t,defaultRepo:n.pointer.repo};if(r.map==="question"){if(!r.area||!r.question)return"Give the area and the question: what it concerns, what the code does, what the source says, and the sources' keys.";let{sources:u,...d}=r.question,p=Dh(a,{op:"question",name:r.area,question:{...d,...u?.length?{sources:u}:{}},by:o,at:s});if(!p.ok)return D("The question was not recorded.",p.problems);let f=p.value.map.areas.find(h=>h.name.toLowerCase()===r.area?.trim().toLowerCase());return`Recorded ${f?.openQuestions?.at(-1)?.id??""} on ${f?.name??r.area}, left open by ${o}, ${p.value.commit.ok?`committed (${p.value.commit.value.slice(0,7)})`:"written but not committed"}. Save version 0 without the requirement it concerns; it is listed until someone who knows answers it.`}if(!r.area||!r.questionId||!r.answer)return"Give the area, the question (questionId) and the answer: code or source.";let c=Dh(a,{op:"answer",name:r.area,id:r.questionId,answer:r.answer,by:o,at:s});if(!c.ok)return D("The answer was not recorded.",c.problems);let l=c.value.map.areas.flatMap(u=>u.openQuestions??[]).find(u=>u.id===r.questionId&&u.answeredBy===o&&u.answeredAt===s);return[`Recorded the answer to ${r.questionId} (${l?.about??""}): ${r.answer==="code"?"the code is right":"the source is right, and the code has a defect"}, given by ${o}.`,r.answer==="code"?"Next: draft a change that adds the requirement as the code behaves, with save_draft (type change), so the capability spec says it once the change is finished.":"Next: draft a change that adds the requirement as the source states it, and record the defect as a bug attached to that change with save_draft (type bug)."].join(`
414
+ `)}function Wwe(e,t,r,i){if(!r||!i)return"Give the area and every ticket read for it, each carried over (with the artifact it became) or left out (open, in-progress or choice).";let{tree:n,resolved:o}=e,s=lt(n.root);if(!s)return'Git has no name and email set for the spec repo, so who chose to leave a ticket out cannot be recorded. Set them with git config user.name "Your Name" and git config user.email you@example.com.';let a=Dh({root:n.root,writer:t,defaultRepo:o.pointer.repo},{op:"tickets",name:r,tickets:i.map(p=>Gwe(p)),by:s,at:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});if(!a.ok)return D("The tickets were not recorded.",a.problems);let c=a.value.map.areas.find(p=>p.name.toLowerCase()===r.trim().toLowerCase()),l=ea(c?[c]:[]),{commit:u,summary:d}=a.value;return[`${c?.name??r}: ${ta(l)}, in ${sn}, ${u.ok?`committed as "onboard: ${d}" (${u.value.slice(0,7)})`:`written but not committed: ${u.problems[0]?.message??""}`}.`,...l.leftOut.length>0?[`Left out: ${l.leftOut.map(p=>`${p.key} "${p.title}"`).join(", ")}.`]:[]].join(`
415
+ `)}var Gwe=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0&&t!==""));import{readFileSync as wH}from"node:fs";import{join as _H,resolve as R_e}from"node:path";function aS(e){let t=e.filter(r=>r.tickets?.length);return t.length===0?[]:["","Tickets read:",...t.map(r=>{let i=ea([r]),n=i.leftOut.map(o=>`${o.key} "${o.title}" (${o.why==="choice"?`by choice of ${o.chosenBy??"the team"}`:o.why==="in-progress"?"in progress":"open"})`);return`- ${r.name}: ${ta(i)}${n.length>0?`. Left out: ${n.join(", ")}`:""}`})]}import{existsSync as Hwe,realpathSync as LG}from"node:fs";import{basename as YWe,dirname as UG,isAbsolute as Jwe,join as Ywe,relative as FG,resolve as XWe,sep as Xwe}from"node:path";var QWe=process.platform==="win32";function ZG(e,t){let r=qG(e,t);if(r!==null)return r;try{let i=t;for(;!Hwe(i)&&UG(i)!==i;)i=UG(i);let n=Ywe(LG(i),FG(i,t));return qG(LG(e),n)}catch{return null}}function qG(e,t){let r=FG(e,t);return r===""||r.startsWith("..")||Jwe(r)?null:r.split(Xwe).join("/")}var VG=(e,t)=>e.artifacts.get(`${t.id}${te.idSuffix}`),hg=e=>e.title?` "${e.title}"`:"";function KG(e,t,r){let i=t.artifacts.get(r.endsWith(te.idSuffix)?Bt(r):r);if(!i)return`There is no artifact ${r}.`;let n=Re(e),o=Zo(e,i.type);if(!o)return`${i.id} is ${n.a(i.type)}, which has no test plan.`;if(o==="task")return Qwe(e,t,i);let s=VG(t,i),a=[];if(!s)return a.push(`${i.id}${hg(i)} has no ${Rc[o]} yet. Draft one with ${ee("new")} test-plan ${i.id}.`),a.join(`
416
+ `);let c=ia(e,t,s);if(!c)return`${s.id} cannot be read.`;let l=Kt(e,s),u=pd(se(e,s));if(a.push(`Coverage of ${i.id}${hg(i)} by its ${Rc[o]} ${s.id} (${u}), checked against ${c.against}:`),o==="story"){let p=[...t.artifacts.values()].filter(g=>g.type==="task"&&g.parent?.id===i.id).flatMap(g=>{let y=VG(t,g);return y?Kt(e,y).map(v=>({...v,id:`${v.id} (${n.one("task")} ${g.id})`})):[]}),f=qh(c.required,[...l,...p]),m=qh(c.required,l);a.push(...BG(c.required,f));let h=c.required.filter(g=>(m.get(g.id)??[]).length===0);a.push("",h.length===0?`Every criterion is covered by ${s.id}.`:`${h.length} gap${h.length===1?"":"s"} in ${s.id}: ${h.map(g=>g.id).join(", ")}. A plan with a gap cannot be approved.`)}else if(o==="epic"){let p=Uh(t,i,"story");p.length===0&&a.push(`- No ${n.many("story")} under it yet.`);for(let f of p){let m=l.filter(h=>(h.covers??[]).some(g=>g===f.id||g.startsWith(`${f.id}-`)));a.push(`- ${f.id}${hg(f)} ${m.length>0?`covered by ${m.map(h=>h.id).join(", ")}`:"not covered"}`)}}else{let p=Uh(t,i,"epic");a.push(...BG(c.informational,qh(c.informational,l)));for(let f of p){let m=l.filter(h=>(h.covers??[]).includes(f.id));a.push(`- ${f.id}${hg(f)} ${m.length>0?`covered by ${m.map(h=>h.id).join(", ")}`:"not covered"}`)}c.informational.length>0&&a.push("","Goals are not required to be covered; one that is not is listed for information.")}let d=sk(c,l);return d.length>0&&a.push("","Covers lines that name something the plan may not cover:",...d.map(p=>`- ${p.message}`)),a.join(`
417
+ `)}function BG(e,t){return e.map(r=>{let i=t.get(r.id)??[],n=r.addedIn!==void 0?`, added in v${r.addedIn}`:"";return`- ${r.id} (${r.text}${n}) ${i.length>0?`covered by ${i.join(", ")}`:"not covered"}`})}function Qwe(e,t,r){let i=uo(e,t,r.id),n=[`${i.length} test case${i.length===1?"":"s"} apply to ${r.id}${hg(r)}: its own and its ${Re(e).one("story")}'s.`],o=[...new Set(i.map(a=>a.plan))];for(let a of[`${r.id}${te.idSuffix}`,...r.parent?[`${r.parent.id}${te.idSuffix}`]:[]]){if(!t.artifacts.get(a)){n.push("",`${a}: none yet.`);continue}if(!o.includes(a))continue;let l=i.find(u=>u.plan===a)?.version;n.push("",`From ${a} (${l?`approved v${l}`:"draft"}):`);for(let u of i.filter(d=>d.plan===a))n.push(`- ${u.id} ${u.title} (covers ${u.covers.join(", ")||"nothing"})`)}let s=i.filter(a=>a.regression);return s.length>0&&n.push("","Regression tests of fixed bugs:",...s.map(a=>`- ${a.id} ${a.title}`)),n.join(`
418
+ `)}import{readFileSync as e_e}from"node:fs";import{join as t_e}from"node:path";var gg=e=>e?` "${e}"`:"",WG=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function JG(e,t,r){let{root:i}=e.tree;if(!t){let u=Un(i);if(u.length===0)return"There are no capability specs yet. Finishing a change that adds a capability writes its first version.";let d=u.map(p=>{let f=Pt(i,p.code),m=f.ok?Jt(f.value.document):[],h=m.reduce((g,y)=>g+(y.children?.length??0),0);return`- ${p.code}${gg(p.title)} v${p.inForce}: ${WG(m.length,"requirement")}, ${WG(h,"scenario")}`});return[`Capability specs (${u.length}), each at its version in force:`,...d,"","Read one with view=capabilities and its code."].join(`
419
+ `)}let n=Uo(i,t);if(!n)return`There is no capability ${t}.`;let o=Pt(i,t,r);if(!o.ok)return D(`BuildKeel cannot read ${t}${r===void 0?"":` v${r}`}.`,o.problems);let s=o.value.record,a=s.ok?s.value.version===0?`describing code from before BuildKeel, confirmed by ${s.value.confirmedBy} on ${s.value.confirmedAt?.slice(0,10)}`:`written by ${s.value.change}, archived by ${s.value.archivedBy} on ${s.value.archivedAt?.slice(0,10)}`:"its record cannot be read",c=o.value.version===n.inForce?"in force":`not in force: v${n.inForce} is`,l=ir(i).filter(u=>u.state==="open"&&u.capabilities.includes(t));return[`${t} v${o.value.version} (capability spec, ${c}; ${a}) at ${o.value.path}:`,...s.ok&&s.value.change?r_e(i,s.value.change):[],...l.length>0?[`Open changes with a spec change for ${t}: ${l.map(u=>u.id).join(", ")}.`]:[],"",o.value.text.trimEnd()].join(`
420
+ `)}function r_e(e,t){let r=Ri(e,t).completions.at(-1)?.record;if(!r)return[];let i=r.commits.map(n=>`${n.id.slice(0,7)} ${n.subject}`);return[`Code that implements it, from ${t}'s completion record in ${r.repo}:`,`- Commits: ${i.join("; ")||"none"}`,`- Files: ${r.files.join(", ")||"none"}`]}function YG(e,t){let{root:r}=e.tree,i=ir(r);if(!t){if(i.length===0)return"There are no changes yet. Draft one from the conversation with {{bk:capture}}, or with {{bk:new}}.";let a=u=>i.filter(d=>d.state===u),c=a("open"),l=c.length>0?[`Open changes (${c.length}):`,...c.map(u=>`- ${HG(u)}`)]:["No change is open."];for(let u of["archived","discarded"]){let d=a(u);d.length>0&&l.push("",`${u==="archived"?"Archived":"Discarded"} (${d.length}): ${d.map(p=>`${p.id}${gg(p.title)}`).join(", ")}`)}return l.push("","Read one with view=changes and its id."),l.join(`
421
+ `)}let n=i.find(a=>a.id===t);if(!n)return`There is no change ${t}.`;let s=[...no.filter(a=>a!=="spec-change").map(a=>Ce(t,a)),...n.capabilities.map(a=>Ce(t,"spec-change",a))].sort((a,c)=>GG(a)-GG(c)).flatMap(a=>{try{return[`--- ${a} ---`,e_e(t_e(r,a),"utf8").trimEnd(),""]}catch{return[]}});return[`${HG(n)} (change, ${n.state}):`,"",...s].join(`
422
+ `).trimEnd()}var GG=e=>e.endsWith("/proposal.md")?0:e.includes("/specs/")?1:e.endsWith("/design.md")?2:3;function HG(e){let t=e.total>0?`${e.done} of ${e.total} tasks done`:"no tasks yet",r=e.capabilities.length>0?e.capabilities.join(", "):"no spec changes";return`${e.id}${gg(e.title)}: ${r}; ${t}`}function XG(e){let t=B(e.tree.root);if(t.mode!=="spec-driven")return"";if(!t.process.ok)return D("The process definition has problems, so BuildKeel uses its defaults until they are fixed.",t.process.problems);let r=t.process.value,i=Object.entries(t.rules);return[`This spec tree${e.tree.config.name?`, ${e.tree.config.name},`:""} is Spec-driven: capability specs say how the system behaves now, and each change proposes, specifies and plans one piece of work. Nothing is approved, and no gate stops work.`,"","| Artifact | First ID |","|---|---|",`| change: a proposal, spec changes, an optional design and tasks | ${Ln(r.change,1)} |`,"| capability spec | a code such as AUTH; requirements AUTH-R1, scenarios AUTH-R1-S1 |",`| ${r.bug.name} | ${Ln(r.bug,1)} |`,`| ${r.adhoc.name} | ${Ln(r.adhoc,1)} |`,"",`Lock gate: ${r.gates.lock}${r.gates.lock===Rh.gates.lock?"":" (set by the team)"}. It protects capability versions and archived changes from edits outside BuildKeel.`,...i.length>0?["","The team's rules:",...i.map(([n,o])=>`- ${n}: ${[...o.sections.map(s=>`requires "${s}"`),...o.notes].join("; ")}`)]:[]].join(`
423
+ `)}function cS(e,t){let{tree:r,resolved:i}=e,n=_e(i.codeRoot)?.activeUnit??null,o=K(r.root),s=[...ir(r.root).filter(c=>c.state==="open").map(c=>({id:c.id,label:`${c.id} change${gg(c.title)} (${c.total>0?`${c.done} of ${c.total} tasks done`:"no tasks yet"})`,done:null})),...[...o.artifacts.values()].filter(c=>c.type==="bug"||c.type==="adhoc").sort((c,l)=>c.id.localeCompare(l.id,"en",{numeric:!0})).map(c=>{let l=Ke(r.root,c,null),u=Ko(r.root,c),d=u?u.ok?Wo(u.value):"closed":l?`finished on ${l.record.finishedAt.slice(0,10)}`:null;return{id:c.id,label:`${c.id} ${c.type==="bug"?"bug":"ad-hoc unit"}${gg(c.title)}`,done:d}})],a={units:[],ready:[],waiting:[],finished:[]};for(let c of s){if(c.done){a.finished.push(`- ${c.label}: ${c.done}`);continue}let l=Dd(t,r.root,c.id,i.codeRoot);c.id===n?a.ready.unshift(`- ${c.label}: the active unit here`):l?a.waiting.push(`- ${c.label}: being worked on in another working tree on this machine, ${l.workingTree}`):a.ready.push(`- ${c.label}`)}return a}function QG(e){let{tree:t,resolved:r}=e,{root:i}=t,n=qn(i);if(!n.ok)return D("The onboarding map cannot be read.",n.problems);if(!n.value||n.value.areas.length===0)return"There is no map of the code's areas yet. Propose areas from the code, each to become one or more capabilities, and write the map with manage action=map once the user agrees.";let o=Un(i).flatMap(u=>{let d=u.versions.includes(0)?Pt(i,u.code,0):null;if(!d?.ok)return[];let p=d.value.document.frontmatter.area,f=d.value.record.ok?d.value.record.value:null;return typeof p=="string"?[{code:u.code,area:p,by:f?.confirmedBy,at:f?.confirmedAt?.slice(0,10)}]:[]}),s=r.pointer.repo,a=[`Onboarding, from the map in ${sn}: each area is documented as capability specs, version 0, confirmed by a person.`],c=null;for(let u of n.value.areas){let d=o.filter(f=>f.area===u.name),p=u.repo===s?"":` (in ${u.repo})`;d.length>0?a.push(`- ${u.name}${p}: ${d.map(f=>`${f.code} v0, confirmed by ${f.by} on ${f.at}`).join("; ")}`):(a.push(`- ${u.name}${p}: not started (${u.paths.join(", ")})`),!c&&u.repo===s&&(c=u.name))}a.push(...aS(n.value.areas));let l=n.value.areas.flatMap(u=>dd(u.openQuestions??[]).map(d=>({area:u.name,q:d})));if(l.length>0){a.push("",`Questions left open (${l.length}), each keeping its requirement out of version 0 until someone who knows answers it:`);for(let{area:u,q:d}of l)a.push(`- ${u} ${d.id}, ${d.about}: the code: ${d.code}; ${d.sources?.length?d.sources.join(", "):"the source"}: ${d.source} (left open by ${d.leftOpenBy??"someone"})`);a.push("To answer one, ask which is intended, with both readings as equals, and record it with manage action=map, map answer.")}return a.push("",c?`Next: ${c}. Draft its capability specs from its code (each with a purpose, then requirements with scenarios, new IDs written as CODE-R{{new}}), show them to the user, and save each with save_draft (type capability, version 0, area: ${c} in its frontmatter) once they confirm it.`:"Every area in this repo is documented."),a.join(`
424
+ `)}var n_e=new Set(["test-plan-gap","coverage-gap"]);function eH(e,t){let r={events:0,finished:{},durations:[],gates:{},gapsCaught:0,suspectsRaised:0,resolved:{"still-valid":0,"needs-change":0},drafts:0,capturedDrafts:0,approvals:0,contextLoads:0,runStarts:0,onboarded:{area:0,work:0},changes:{started:0,finished:0,discarded:0},changeDurations:[],finishReports:{reports:0,findings:{},gaps:0,failing:0,finishedAnyway:0},guide:{on:0,off:0,done:0}};for(let i of e)if(!(t&&Date.parse(i.at)<t.getTime()))switch(r.events++,i.event){case"finish":r.finished[i.type]=(r.finished[i.type]??0)+1,typeof i.seconds=="number"&&r.durations.push(i.seconds);break;case"gate":{let n=r.gates[i.gate]??={passed:0,warned:0,blocked:0};n[i.outcome]++,i.outcome==="blocked"&&(r.gapsCaught+=i.checks.filter(o=>n_e.has(o)).length);break}case"suspect":r.suspectsRaised++;break;case"resolve":r.resolved[i.decision]++;break;case"draft":r.drafts++,i.capture&&r.capturedDrafts++;break;case"approve":r.approvals++;break;case"context":r.contextLoads++;break;case"start":i.run&&r.runStarts++;break;case"onboard":r.onboarded[i.way]++;break;case"change":r.changes[i.action]++,i.action==="finished"&&typeof i.seconds=="number"&&r.changeDurations.push(i.seconds);break;case"finish-report":{let n=r.finishReports;n.reports++;for(let[o,s]of Object.entries(i.findings))n.findings[o]=(n.findings[o]??0)+s;n.gaps+=i.gaps,n.failing+=i.failing,i.finishedAnyway&&n.finishedAnyway++;break}case"guide":r.guide[i.state]++;break}return r}function tp(e){if(e<60)return`${e} s`;let t=Math.round(e/60);if(t<60)return`${t} min`;let r=Math.floor(t/60);return r<48?`${r} h${t%60?` ${t%60} min`:""}`:`${Math.floor(r/24)} days${r%24?` ${r%24} h`:""}`}function ej(e){if(e.length===0)return null;let t=[...e].sort((i,n)=>i-n),r=Math.floor(t.length/2);return t.length%2===1?t[r]:Math.round((t[r-1]+t[r])/2)}var _r=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`;function tH(e,t,r,i=new Date){let{tree:n}=e,o=IG(t,n.root),s=r?new Date(i.getTime()-r*864e5):null,a=r?`the last ${_r(r,"day")} (since ${s?.toISOString().slice(0,10)})`:"all the time recorded",l=mg(t)?[]:["","Recording is off on this machine, so nothing new is added. Turn it back on with the BuildKeel manage tool, action usage, usage on."];if(o.length===0)return["There is nothing to show yet: BuildKeel has recorded no usage for this spec tree on this machine. It records as you draft, approve, start and finish work, and keeps the record on this machine only.",...l].join(`
425
+ `);let u=eH(o,s);if(u.events===0)return[`Nothing was recorded in ${a}. Ask for a longer period, or all of it.`,...l].join(`
426
+ `);if(B(n.root).mode==="spec-driven")return[...i_e(u,a,n.config.name),...l].join(`
427
+ `);let d=sd(Tt(n.root)),p=Object.values(u.finished).reduce((_,k)=>_+k,0),f=Object.values(u.gates).reduce((_,k)=>_+k.blocked,0),m=u.resolved["still-valid"]+u.resolved["needs-change"],h=[];h.push(`In ${a}: ${_r(p,"unit")} finished, the gates stopped work ${_r(f,"time")} and caught ${_r(u.gapsCaught,"coverage gap")}, and ${_r(m,"suspect")} ${m===1?"was":"were"} decided.`),h.push(`Recorded on this machine only, for ${n.config.name??"this spec tree"}; nothing is sent anywhere.`),h.push("",`Units finished: ${p}${p>0?` (${Object.entries(u.finished).map(([_,k])=>`${d.one(_)} ${k}`).join(", ")})`:""}.`);let g=u.finished.adhoc??0;p>0&&h.push(`Recorded as ${d.many("adhoc")}: ${g} of ${p} (${Math.round(g/p*100)}%).`);let y=ej(u.durations);y!==null&&h.push(`Time from start to done: ${tp(y)} typically (the median), ${tp(Math.max(...u.durations))} at the longest.`);let v=Object.entries(u.gates);v.length>0&&h.push("","| Gate | Passed | Warned | Blocked |","|---|---|---|---|",...v.map(([_,k])=>`| ${_} | ${k.passed} | ${k.warned} | ${k.blocked} |`)),h.push("",`Coverage gaps caught by a gate: ${u.gapsCaught}.`),h.push(`Suspects: ${u.suspectsRaised} raised; ${u.resolved["still-valid"]} kept as still valid, ${u.resolved["needs-change"]} needing change.`),h.push(`Drafts: ${u.drafts} created${u.capturedDrafts>0?` (${u.capturedDrafts} captured from a conversation)`:""}; ${_r(u.approvals,"approval")}.`),h.push(`Context loaded for a unit ${_r(u.contextLoads,"time")}; ${_r(u.runStarts,"unit")} started in a build run.`);let b=u.onboarded.area+u.onboarded.work;return b>0&&h.push(`Existing code documented: ${_r(b,"artifact")} approved as version 0, ${u.onboarded.area} area by area and ${u.onboarded.work} as work touched the code.`),h.push(...l),h.join(`
428
+ `)}function i_e(e,t,r){let{changes:i,finishReports:n}=e,o=Object.values(n.findings).reduce((d,p)=>d+p,0),s=ej(e.changeDurations),a=e.resolved["still-valid"]+e.resolved["needs-change"],c=[`In ${t}: ${_r(i.finished,"change")} finished${s!==null?`, typically in ${tp(s)}`:""}; at finish, ${_r(o,"finding")} and ${_r(n.gaps,"untested scenario")} were reported, and ${_r(n.finishedAnyway,"change")} ${n.finishedAnyway===1?"was":"were"} finished anyway; ${_r(a,"suspect")} ${a===1?"was":"were"} decided.`,`Recorded on this machine only, for ${r??"this spec tree"}; nothing is sent anywhere.`,"",`Changes: ${i.started} started, ${i.finished} finished, ${i.discarded} discarded.`];if(s!==null&&c.push(`Time from start to finish: ${tp(s)} typically (the median), ${tp(Math.max(...e.changeDurations))} at the longest.`),n.reports>0){let d=Object.entries(n.findings).sort(([p],[f])=>p.localeCompare(f));c.push(`Reported at finish, over ${_r(n.reports,"change")}: ${d.length>0?d.map(([p,f])=>`${p} ${f}`).join(", "):"no findings"}; ${_r(n.gaps,"scenario")} with no tagged test; ${_r(n.failing,"failing scenario")}.`,`Finished anyway, with something reported missing: ${n.finishedAnyway} of ${n.reports}.`)}c.push(`Suspects: ${e.suspectsRaised} raised; ${e.resolved["still-valid"]} kept as still valid, ${e.resolved["needs-change"]} needing change.`);let l=Object.entries(e.finished).filter(([d])=>d==="bug"||d==="adhoc");l.length>0&&c.push(`Bugs and ad-hoc units finished: ${l.map(([d,p])=>`${d==="bug"?"bug":"ad-hoc unit"} ${p}`).join(", ")}.`),c.push(`Context loaded for a unit ${_r(e.contextLoads,"time")}.`);let{guide:u}=e;return u.on+u.off+u.done>0&&c.push(`Guidance for a first change: turned on ${u.on}, turned off ${u.off}, completed ${u.done}.`),c}import{realpathSync as gH}from"node:fs";import{existsSync as o_e}from"node:fs";import{join as s_e}from"node:path";function tj(e,t){let r=se(e,t);return r.state!=="approved"||r.draftOpen||r.approvedVersion===null?null:Fn(e,t,r.approvedVersion)}var a_e=new Set(["rule-section-missing","rule-section-empty"]),c_e=(e,t)=>e.type===t.template.type&&e.version===t.template.version&&e.source===t.source&&(e.org??null)===(t.org??null);function l_e(e){return`${e.source==="tree"?"the spec tree's own":e.source==="org"?`the organization's (${e.org??"unknown version"})`:"the built-in"} ${e.type} template v${e.version}`}function rj(e,t,r,i){let n=tj(e,t);if(!n||i.length===0)return{problems:i,earlier:null};let o=new Set(Vo(t.document,r.template,{itemOwner:Cc(t),path:t.path}).map(u=>u.message));if(!n.template)return{problems:i.filter(u=>!o.has(u.message)),earlier:null};let s=c_e(n.template,r),a=i.filter(u=>o.has(u.message)&&(!s||a_e.has(u.code)));if(a.length===0)return{problems:i,earlier:null};let c=u=>u.replace(`${t.path}: `,"").replace(/\.$/,""),l=a.map(u=>c(u.message)).join("; ");return{problems:i.filter(u=>!a.includes(u)),earlier:{code:"approved-under-earlier-template",path:t.path,message:s?`${t.id} v${n.version} was approved before the spec tree's rules asked for more: ${l}.`:`${t.id} v${n.version} was approved under ${l_e(n.template)}, and under the current one (v${r.template.version}, ${Mh(r)}) ${l}.`,remedy:`${t.id} stays approved; its next version is checked against the current template.`}}}function nj(e,t,r){let i=[],n=[];for(let o of t.artifacts.values()){let s=o.parent?t.artifacts.get(o.parent.id):void 0,a=s?GO(r,o,s):null;if(!a)continue;let c=tj(e,o);if(!c){i.push({...a,message:`${o.path}: ${a.message}`});continue}n.push({code:"approved-under-earlier-process",path:o.path,message:`${o.id} v${c.version} was approved before the process changed: ${a.message}`,remedy:`${o.id} stays approved; its next version must sit under ${Re(e).a(Th(r,o.type)?.type??"")}.`})}return{problems:i,earlier:n}}function rH(e,t){let r=[],i=new Set;for(let n of[...t.chain.map(o=>o.type),"bug","adhoc",...t.documents.map(o=>o.type)]){let o=We(n,e);o.ok||(i.add(n),!o.problems.some(s=>s.code==="org-unpinned"||s.code==="org-unavailable")&&r.push(...o.problems))}return{problems:r,failed:i}}function lS(e){let t=We(te.type,e);if(!t.ok)return null;let r=Object.entries(t.value.template.sections).filter(([,o])=>o.items);if(r.length>0&&r.every(([,o])=>o.items?.covers==="required"))return null;let i=Re(e),n=t.value.source==="tree"?t.value.path:Mh(t.value);return{code:"covers-optional",path:t.value.path,message:`The test plan template (${n}) makes the covers line optional. A test case without one is never marked suspect when what it tests changes, and covers no ${i.one("story")} criterion, so precise change impact and coverage gap detection are lost for it.`,remedy:t.value.source==="tree"?`Set covers: required on the test cases section of ${t.value.path}, and raise its version.`:"Override test-plan.md in the spec tree's templates/ folder with covers: required, or ask the organization's template maintainers to require it."}}function nH(e){let{org:t}=B(e);if(!t?.ok)return null;let r=Re(e),i=[];for(let u of QB(e)){let d=o_e(s_e(t.value.dir,Ph,`${u}.md`));i.push(`- the ${r.one(u)} template: templates/${u}.md ${d?"overrides the organization's":"is the tree's own (the organization has none)"}`)}let n=ro(e),o=n.ok?n.value.process??{}:{},s=Z_(t.value),a=s.ok&&s.value&&typeof s.value=="object"?s.value:{};for(let u of["chain","bug","adhoc"])o[u]!==void 0&&a[u]!==void 0&&i.push(`- process.${u} in buildkeel.yaml overrides the organization's`);let c=o.gates??{},l=a.gates??{};for(let u of j_)c[u]!==void 0&&l[u]!==void 0&&c[u]!==l[u]&&i.push(`- the ${u} gate: ${String(c[u])} in buildkeel.yaml overrides the organization's ${String(l[u])}`);return{label:t.value.label,lines:i}}function iH(e,t,r){let i=nj(e,t,r).earlier,n=new Map;for(let o of t.artifacts.values()){if(!tj(e,o))continue;n.has(o.type)||n.set(o.type,We(o.type,e));let s=n.get(o.type);if(!s?.ok)continue;let a=Vo(o.document,s.value.template,{itemOwner:Cc(o),path:o.path}),{earlier:c}=rj(e,o,s.value,a);c&&i.push(c)}return i}import{existsSync as lH,readdirSync as y_e,readFileSync as dH}from"node:fs";import{join as yg}from"node:path";import{existsSync as u_e,readFileSync as d_e}from"node:fs";import{join as oH}from"node:path";function uS(e){let t=[];for(let r of ir(e)){if(t.push(...Ri(e,r.id).problems,...X_(e,r.id).problems),r.state==="discarded"){let a=_N(e,r.id);a&&!a.ok&&t.push(...a.problems);continue}if(r.state!=="archived")continue;let i=P9(e,r.id);if(!i)continue;if(!i.ok){t.push(...i.problems);continue}let n=a=>`Restore it with git restore -- ${a} in the spec repo. ${r.id} is archived: make the change you want in a new change.`,o=[`${Et(r.id)}/${cd}`,`${vd(r.id)}/`,`${$d(r.id)}/`],s=Kd(e,r.id);for(let[a,c]of Object.entries(i.value.files))u_e(oH(e,a))?Ft(d_e(oH(e,a),"utf8"))!==c&&t.push({code:"archived-change-altered",path:a,message:`${a} was changed after ${r.id} was archived: it no longer matches the hash in its archive record.`,remedy:n(a)}):t.push({code:"archived-change-file-removed",path:a,message:`${a} was removed after ${r.id} was archived.`,remedy:n(a)});for(let a of Object.keys(s).filter(c=>!(c in i.value.files)&&!o.some(l=>c===l||c.startsWith(l))))t.push({code:"archived-change-file-added",path:a,message:`${a} was added after ${r.id} was archived.`,remedy:`Remove it. ${r.id} is archived: make the change you want in a new change.`});Ri(e,r.id).completions.length===0&&t.push({code:"archived-change-no-completion",path:vd(r.id),message:`${r.id} is archived but has no completion record.`,remedy:"Restore it from the spec repo's history."})}return t}import{existsSync as p_e,readdirSync as f_e}from"node:fs";import{join as m_e}from"node:path";var h_e=[{dir:jo,name:"capability spec"},{dir:Sn,name:"change"}],g_e=Si.filter(e=>e.type!=="bug"&&e.type!=="adhoc").map(e=>({dir:e.dir,name:gt.chain.find(t=>t.type===e.type)?.name??e.type}));function aH(e,t){let r=[];if(t.conversion)return r;if(t.mode==="spec-driven"){for(let{dir:n,name:o}of g_e)for(let s of sH(e,n))r.push({code:"artifact-wrong-mode",path:`${n}/${s}`,message:`${n}/${s} is ${Ws(o)}, which does not belong in this spec tree: it is Spec-driven, so work is planned as changes to capability specs.`,remedy:"Plan the work as a change, then remove the directory. A spec tree follows one mode."});return r}let i=new Set(t.types.map(n=>n.dir));for(let{dir:n,name:o}of h_e)if(!i.has(n))for(let s of sH(e,n))r.push({code:"artifact-wrong-mode",path:`${n}/${s}`,message:`${n}/${s} is ${Ws(o)}, which does not belong in this spec tree: it follows Full SDLC, so work is planned through its stages.`,remedy:"Plan the work through the process's stages, then remove the directory. A spec tree follows one mode."});return r}function sH(e,t){let r=m_e(e,t);return p_e(r)?f_e(r).filter(i=>!i.startsWith(".")).sort():[]}function cH(e){let t=vc.map(s=>s.type),r=e.mode==="full-sdlc"?e.process:e.conversion?.process??null,i=r===null?[]:r.ok?[...r.value.chain.map(s=>s.type),...r.value.documents.map(s=>s.type)]:null;if(!i)return[];let o=[...e.mode==="spec-driven"||e.conversion?[...new Set([...t,...i])]:i,"bug","adhoc"];return Object.keys(e.rules).filter(s=>!o.includes(s)).map(s=>({code:"rules-unknown-type",path:Xe,message:`${Xe}: rules.${s} names no artifact type of this spec tree, so it never applies. Its types are ${o.join(", ")}.`}))}function pH(e){let t=K(e.root),r=[...t.problems],i=B(e.root),{org:n}=i;n&&!n.ok&&r.push(...n.problems),!i.process.ok&&n?.ok!==!1&&r.push(...i.process.problems),r.push(...aH(e.root,i),...cH(i));let o=i.mode==="spec-driven"||i.conversion?J_(e.root):null;o&&r.push(...o.problems,...Y9(e.root),...uS(e.root));let s=hr(e),a=[],c=new Set;if(s.ok){let m=nj(e.root,t,s.value);r.push(...m.problems),a.push(...m.earlier);let h=rH(e.root,s.value);r.push(...h.problems),c=h.failed}let l=0,u=new Map;for(let m of t.artifacts.values()){let h=hH(e.root,m);l+=h.checked,u.set(m.id,h.versions),r.push(...h.problems)}let d=k_e(e.root,t,c);a.push(...d.earlier),r.push(...w_e(t,u),...__e(t),...d.problems,...x_e(e.root,t),...S_e(e.root,t)),r.push(...Ai(e.root,t).problems,...$_e(e.root,t));let p=new Set(r.map(m=>m.path));r.push(...mH(e.root).filter(m=>!p.has(m.path)));let f=lS(e.root);return{index:t,versionsChecked:l,problems:r,warnings:f?[f]:[],earlier:a,overrides:nH(e.root),...o?{capabilities:{count:o.capabilities,versionsChecked:o.versionsChecked}}:{}}}var v_e=new Set(["frozen-altered","pending-altered","source-altered","source-missing","source-added"]);function fH(e,t=K(e)){let r=[...t.artifacts.values()].flatMap(n=>hH(e,n).problems.filter(o=>v_e.has(o.code))),i=new Set(r.map(n=>n.path));return[...r,...mH(e).filter(n=>!i.has(n.path))]}var uH=new RegExp(`^[^/]+/[^/]+/(?:[^/]+/)?(?:${Hu.join("|")})/[^/]+$|^bugs/[^/]+/${sN.replace(".","\\.")}$`);function $_e(e,t){let r=[];for(let i of t.artifacts.values()){let n=Ko(e,i);if(!n)continue;if(!n.ok){r.push(...n.problems);continue}let o=oi(i);n.value.bug!==i.id&&r.push({code:"record-artifact-mismatch",path:o,message:`${o} is about ${n.value.bug}, but it sits in the directory of ${i.id}.`});let s=n.value.duplicateOf;s&&t.artifacts.get(s)?.type!=="bug"&&r.push({code:"closed-duplicate-missing",path:o,message:`${o} closes ${i.id} as a duplicate of ${s}, which is not a bug of this spec tree.`})}return r}function mH(e){let t=[],r=le(e,["diff","--name-only","--relative","HEAD","--","."]);for(let o of(r??"").split(`
429
+ `).filter(s=>uH.test(s)))t.push({code:"record-changed",path:o,message:`${o} has uncommitted changes. BuildKeel writes records once and never changes them.`,remedy:`Restore it with git restore -- ${o} in the spec repo.`});let i=new Set(t.map(o=>o.path)),n=le(e,["log","--format=%x1e%h %s","--name-only","--relative","--diff-filter=M","--","."]);for(let o of(n??"").split("").filter(Boolean)){let[s="",...a]=o.split(`
430
+ `).filter(Boolean);for(let c of a.filter(l=>uH.test(l)&&!i.has(l)))i.add(c),t.push({code:"record-changed",path:c,message:`${c} was changed after it was written, in commit ${s}. BuildKeel writes records once and never changes them.`,remedy:`Check that change with git show ${s.split(" ")[0]} in the spec repo, and restore the file as it was first written if it should not have changed.`})}return t}function hH(e,t){let r=Ae(t),i=[],n=d=>dH(yg(e,d),"utf8"),o=d=>lH(yg(e,r,d))?y_e(yg(e,r,d)):[],s=(d,p)=>d.map(f=>p.exec(f)?.[1]).filter(f=>f!==void 0).map(Number),a=o(xi),c=new Set(s(a,Yu)),l=new Set(s(o(Mn),E_)),u=0;for(let d of[...c].sort((p,f)=>p-f)){let p=Do(r,d),f=yc(n(p),p);if(!f.ok){i.push(...f.problems);continue}let m=f.value;m.version!==d&&i.push({code:"record-version-mismatch",path:p,message:`${p} records version ${m.version}, but its file name says v${d}. Two approvals may claim the same version.`}),m.artifact!==t.id&&i.push({code:"record-artifact-mismatch",path:p,message:`${p} is the approval of ${m.artifact}, but it sits in the directory of ${t.id}.`});let h=zo(r,d);if(!l.has(d)){i.push({code:"frozen-missing",path:h,message:`${t.id} v${d} is approved, but its frozen copy ${h} is missing.`});continue}u++,Ft(n(h))!==m.hash&&i.push({code:"frozen-altered",path:h,message:`${t.id} v${d} was altered after ${m.recorded?"it was recorded":"approval"}: ${h} no longer matches the hash in ${p}.`,remedy:m.recorded?`Restore ${h} from git history. To change ${t.id}, save it again with save_draft: that records its next version.`:`Restore ${h} from git history. To change ${t.id}, save a new version as a draft and approve it.`}),d===0&&i.push(...b_e(e,t,r,m.sources??{},p))}c.has(0)&&t.onboard&&i.push({code:"onboard-after-approval",path:t.onboard.path,message:`${t.onboard.path} is a draft of version 0, but ${t.id} v0 is already approved, and an artifact has one version 0 at most.`,remedy:`Remove ${t.onboard.path}. To change what ${t.id} says, save a new version as a draft and approve it.`});for(let d of l)if(!c.has(d)){let p=zo(r,d);i.push({code:"frozen-unrecorded",path:p,message:`${p} has no approval record (${Do(r,d)}).`})}if(c.size===0)for(let d of s(a,Xu)){let p=xh(r,d),f=yc(n(p),p);if(!f.ok){i.push(...f.problems);continue}let m=d===0?t.onboard?.path??t.path:t.path;(!lH(yg(e,m))||Ft(n(m))!==f.value.hash)&&i.push({code:"pending-altered",path:m,message:`${t.id} was changed after it was approved (its number is still pending): ${m} no longer matches the hash in ${p}.`,remedy:`Restore ${m} from git history.`})}return{checked:u,versions:c,problems:i}}function b_e(e,t,r,i,n){let o=[],s=new Set(sa(e,r));for(let[a,c]of Object.entries(i)){let l=`${gc(r)}/${a}`;s.has(a)?Ft(dH(yg(e,l),"utf8"))!==c&&o.push({code:"source-altered",path:l,message:`A source of ${t.id} v0 was altered after approval: ${l} no longer matches the hash in ${n}.`,remedy:`Restore ${l} from git history. Sources are kept as they were read, and frozen with version 0.`}):o.push({code:"source-missing",path:l,message:`${t.id} v0 was approved with the source ${a}, but ${l} is missing.`,remedy:`Restore ${l} from git history.`})}for(let a of s){if(Object.hasOwn(i,a))continue;let c=`${gc(r)}/${a}`;o.push({code:"source-added",path:c,message:`${c} was added after ${t.id} v0 was approved, so it is not one of the sources it was approved with.`,remedy:`Remove ${c}. What it says can go into a new version of ${t.id}, drafted and approved as usual.`})}return o}function w_e(e,t){let r=[];for(let i of e.artifacts.values()){let n=i.parent;!n||n.version===void 0||!e.artifacts.has(n.id)||t.get(n.id)?.has(n.version)||r.push({code:"pin-not-approved",path:i.path,message:`${i.id} is pinned to ${Yt(n)}, but ${n.id} has no approved version ${n.version}.`})}return r}function __e(e){let t=[],r=new Map,i=new Map,n=[...e.artifacts.values()].sort((o,s)=>o.path<s.path?-1:o.path>s.path?1:0);for(let o of n){if(o.owner!==void 0)continue;let s=o.document.frontmatter.id;typeof s=="string"&&s!==""&&r.set(s,[...r.get(s)??[],o]);let a=xc(o.id)?null:/-([A-Z]?)([0-9]+)$/.exec(o.id);if(a){let c=`${o.type}:${a[1]??""}${Number(a[2])}`;i.set(c,[...i.get(c)??[],o])}}for(let[o,s]of r)s.length>1&&t.push({code:"duplicate-id",path:s[0]?.path??"",message:`${o} is used by ${s.length} artifacts: ${s.map(a=>a.path).join(" and ")}.`,remedy:"Keep one, and save the other as a new draft so it gets its own number when approved."});for(let[o,s]of i)s.length>1&&t.push({code:"duplicate-number",path:s[0]?.path??"",message:`${s.map(a=>a.id).join(" and ")} share the ${Re(e.root).one(o.split(":")[0])} number ${o.split(":")[1]?.replace(/^[A-Z]/,"")}${/^[A-Z]/.test(o.split(":")[1]??"")?" in the onboarded sequence":""}: ${s.map(a=>a.path).join(" and ")}.`,remedy:"Keep one, and save the other as a new draft so it gets its own number when approved."});return t}function k_e(e,t,r){let i=[],n=[],o=new Map,s=c=>(o.has(c)||o.set(c,We(c,e)),o.get(c)),a=new Set(r);for(let c of t.artifacts.values()){if(c.path===c.onboard?.path)continue;let l=s(c.type);if(!l.ok){a.has(c.type)||i.push(...l.problems),a.add(c.type);continue}let u=rj(e,c,l.value,Od(e,c,oa(e,t,c,l.value)));i.push(...u.problems),u.earlier&&n.push(u.earlier)}return{problems:i,earlier:n}}function S_e(e,t){let r=[];for(let i of t.artifacts.values()){let{repins:n,problems:o}=yd(e,i);r.push(...o);for(let{path:s,record:a}of n){let c=i.type===te.type;c&&a.testCase===void 0?r.push({code:"record-artifact-mismatch",path:s,message:`${s} sits in the test plan ${i.id} but names no test case.`}):!c&&a.testCase!==void 0&&r.push({code:"record-artifact-mismatch",path:s,message:`${s} is about the test case ${a.testCase}, but it sits in the directory of ${i.id}, not of a test plan.`})}}return r}function x_e(e,t){let r=[];for(let i of t.artifacts.values()){let{completions:n,problems:o}=Ti(e,i);r.push(...o);for(let{path:s,record:a}of n)a.unit!==i.id&&r.push({code:"record-artifact-mismatch",path:s,message:`${s} is the completion record of ${a.unit}, but it sits in the directory of ${i.id}.`})}return r}var ij=5,An=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,I_e=(e,t)=>{try{return gH(e)===gH(t)}catch{return e===t}};function oj(e){if(!e)return"not checked yet in this session";switch(e.status){case"current":return`up to date at the last check (${e.checkedAt})`;case"behind":return`${An(e.behind,"commit")} behind ${e.upstream} at the last check (${e.checkedAt}); pull it to see the latest approvals`;case"failed":return`the last check failed (${e.reason}); work continues with the local copy`;case"no-remote":return"it has no remote to compare with"}}function yH(e,t){let{tree:r,resolved:i}=e,{root:n}=r,o=K(n),s=_e(i.codeRoot),a=M=>`${M.id} ${Cn(r,M.type)}${M.title?` "${M.title}"`:""}`,c=zd(t,n),l=qd(i.codeRoot,n,o),u=M=>`finished on ${l.get(M)}, not merged yet`,d=new Map(c.map(M=>[M.unit,M])),p=M=>I_e(M,i.codeRoot),f=yr(n,o).suspects,m=new Set(f.filter(M=>M.kind==="artifact").map(M=>M.id)),h=Tt(n),g=[...o.artifacts.values()].filter(M=>h.chain.some(me=>me.type===M.type)&&se(n,M).state==="approved"),y=new Map(g.map(M=>[M.id,Yh(n,o,h,M)])),v=[`BuildKeel status: ${r.config.name?`${r.config.name}, `:""}spec tree ${n} (format ${r.config.format}${r.access.writable?"":", read-only"})`,""],b=s?.activeUnit?o.artifacts.get(s.activeUnit):void 0;v.push(s?.activeUnit?`Active unit here: ${b?a(b):s.activeUnit}${s.activeBranch?` on branch ${s.activeBranch}`:""}.`:s?.untrackedSince?`No active unit in this working tree: working without one since ${s.untrackedSince}, as the user chose. Starting a unit ends this.`:"No active unit in this working tree.");let _=Fo(n),k=_.approvals??0,x=_.completions??0,S=[...k?[An(k,"approval")]:[],...x?[An(x,"completion")]:[]],C=k+x===1?"it":"them";v.push(`Spec repo: ${oj(s?.freshness)}.${S.length>0?` Not pushed yet: ${S.join(" and ")}; push the spec repo to share ${C}.`:""}`);let E=[];try{E=so(n,["status","--porcelain=v1","-z","--untracked-files=all","--",Xe,lo]).split("\0").filter(Boolean).map(M=>M.slice(3))}catch{}E.length>0&&v.push(`Spec tree settings not committed: ${E.join(", ")}. Commit them, on their own, so everyone works to the same process and templates.`);let U=lS(n);U&&v.push("",D("Warning:",[U]));let V=M=>{let me=[],xe=d.get(M.id);if(xe)me.push(p(xe.workingTree)?"in progress here":`in progress in ${xe.workingTree}`);else if(l.has(M.id))M.type!=="bug"&&M.type!=="adhoc"&&me.push(u(M.id));else if(M.type!=="bug"&&M.type!=="adhoc"){let Ot=ve(n,M)?.version,ho=Ot!==void 0?Ke(n,M,Ot):null;ho&&me.push(`done on ${ho.record.finishedAt.slice(0,10)}`)}for(let Ot of y.get(M.id)??[])Ot.record||me.push(`no ${Ot.kind.name}`);return m.has(M.id)&&me.push("suspect"),me.map(Ot=>` \xB7 ${Ot}`).join("")},X=M=>(M.type==="bug"||M.type==="adhoc")&&l.has(M.id)?u(M.id):null;if(v.push("",...o.artifacts.size===0?["No artifacts yet."]:Jk(r,o,V,X)),c.length>0){v.push("",`Claims on this machine (${c.length}):`);for(let M of c)v.push(`- ${M.unit}: ${p(M.workingTree)?"this working tree":M.workingTree}${M.branch?`, branch ${M.branch}`:""}, since ${M.claimedAt}`);v.push("A claim is released when its unit is finished. One whose work has stopped can be released sooner, on request.")}let J=[],it=[];for(let M of g)for(let me of y.get(M.id)??[]){let xe=me.kind.type===te.type;me.record?!xe&&!me.approved&&it.push(`- ${me.id} ${me.kind.name} is not approved yet, so no work under ${M.id} can start.`):(xe?J:it).push(`- ${a(M)} has no ${me.kind.name}, so no work under it can start.`)}for(let M of g.filter(me=>me.type==="story")){let me=`${M.id}${te.idSuffix}`,xe=o.artifacts.get(me);if(!xe)continue;let Ot=ve(n,xe),ho=ia(n,o,Ot??xe),ip=ii(n,xe),kg=ho&&ip?Fh(ho,Kt(n,xe,ip.document)):[];kg.length>0?J.push(`- ${me}${Ot?` v${Ot.version}`:" (draft)"} leaves ${kg.map(rJ=>rJ.id).join(", ")} uncovered.`):Ot||J.push(`- ${me} is not approved yet, so no work under ${M.id} can start.`)}if(J.length>0&&v.push("","Coverage gaps:",...J),it.length>0&&v.push("","Documents still needed:",...it),f.length>0){v.push("",`Suspect (${f.length}), each built against an older version of something that has changed:`);for(let M of f){let me=M.kind==="test-case"?`${M.id} test case${M.title?` "${M.title}"`:""} in ${M.holder.id}`:a(M.holder);v.push(`- ${me}: ${Go(M)}`)}v.push("Review them with {{bk:impact}}: each is still valid, or needs change. Work under a suspect artifact cannot start.")}let z=hr(r),pe=z.ok?iH(n,o,z.value):[];if(pe.length>0){let M=[...new Set(pe.map(me=>me.message.split(" ")[0]))];v.push("",`Approved under earlier rules (${M.length}): ${M.join(", ")}. ${M.length===1?"It stays":"They stay"} approved, and each is checked against the current template and process at its next version; validation lists what each lacks.`)}let H=[...o.artifacts.values()].filter(M=>se(n,M).state==="pending");H.length>0&&(v.push("",`Approved, number pending (${H.length}):`,...H.map(M=>`- ${a(M)}`)),v.push("They get their numbers the next time the spec repo's remote can be reached; approving one again tries straight away."));let fe=[...o.artifacts.values()].filter(M=>M.type==="adhoc");if(fe.length>0){let M=fe.filter(xe=>!Ke(n,xe,null)&&!l.has(xe.id)),me=z.ok?z.value.adhoc.name:"ad-hoc unit";v.push("",`Ad-hoc work: ${An(M.length,`open ${me}`)}, ${fe.length-M.length} done.`),v.push(...M.map(xe=>`- ${xe.id}${xe.title?` "${xe.title}"`:""}${d.has(xe.id)?", in progress":""}`))}let kt=zi(r,o,{codeRoot:i.codeRoot,repo:i.pointer.repo},t),Qt=[];for(let M of kt.repos){M.baseline&&!M.baseline.found&&Qt.push(`- ${M.name}: its baseline ${M.baseline.commit} is not in its history, so every commit counts.`);let me=sg(M);if(me.length===0)continue;let xe=me.slice(0,ij).map(Ot=>`${Ot.id.slice(0,7)} "${Ot.subject}"`);Qt.push(`- ${M.name}: ${An(me.length,"commit")}: ${xe.join(", ")}${me.length>ij?`, and ${me.length-ij} more`:""}`)}kt.missing.length>0&&Qt.push(`- Not on this machine, so not checked: ${kt.missing.join(", ")}`),v.push("",...Qt.length>0?["Commits with no unit, after each repo's baseline:",...Qt]:["Commits with no unit: none after the baselines."]);let L=iW(o,kt,i.codeRoot,i.pointer.repo);if(L){v.push("",`Existing code (${L.repo}):`,`- Described: ${L.described} of ${An(L.total,"file")} (${IN(L.described,L.total)}), by the paths artifacts cover and the commits of their work; tests and the spec tree are left out.`);let M=qn(n);if(M.ok&&M.value&&M.value.areas.length>0){let xe=Zk(o,kt,i.codeRoot,i.pointer.repo,M.value),Ot=Vk(xe),ho=xe.filter(kg=>kg.state==="onboarded").length;v.push(`- Areas: ${ho} of ${An(xe.length,"area")} onboarded, from the map in ${sn}${Ot?`; next: ${Ot.area.name}`:""}.`);let ip=ea(M.value.areas);ip.read>0&&v.push(`- Tickets: ${ta(ip)}.`)}let me=G_(o);if(me.length>0&&v.push(`- Questions left open: ${me.length} (${me.map(xe=>`${xe.id} ${xe.question.id}`).join(", ")}); {{bk:onboard}} lists them, for someone who knows to answer.`),L.tests){let{withTest:xe,total:Ot}=L.tests,ho=L.unmatched===null?"":`; ${An(L.unmatched,"test")} in the latest report ${L.unmatched===1?"matches":"match"} no test case`;v.push(`- Tests: ${xe} of ${An(Ot,"onboarded test case")} (${IN(xe,Ot)}) ${xe===1?"has":"have"} a test, tagged or matched${ho}.`)}}let Ve=fH(n,o);Ve.length>0&&v.push("",D("Changed outside BuildKeel:",Ve));let Ze=qk(n,o,i.codeRoot);Ze.length>0&&v.push("",D("Broken test matches:",Ze));let Ge=ma(e,t);Ge.ready.length>0?v.push("",`Ready to start (${Ge.ready.length}):`,...Ge.ready):Ge.units.length>0&&v.push("","Nothing is ready to start."),Ge.waiting.length>0&&v.push(`Not ready yet: ${Ge.waiting.length}; {{bk:start}} lists them with the reason.`);let yt=[...e.notices,...od(r),...o.problems];yt.length>0&&v.push("",D("Problems with the tree:",yt));let lr=kt.repos.reduce((M,me)=>M+sg(me).length,0),pt=J.length+it.length,Oe=[s?.activeUnit?`${s.activeUnit} is in progress here`:"no unit is active here",Ge.ready.length>0?`${An(Ge.ready.length,"unit")} ${Ge.ready.length===1?"is":"are"} ready to start`:"nothing is ready to start",...f.length>0?[`${An(f.length,"item")} ${f.length===1?"is":"are"} suspect`]:[],...pt>0?[`${pt} ${pt===1?"gap":"gaps"} in coverage or required documents`]:[],...S.length>0?[`${S.join(" and ")} not pushed`]:[],...lr>0?[`${An(lr,"commit")} with no unit`]:[],...Ve.length>0?[`${An(Ve.length,"record")} changed outside BuildKeel`]:[],...Ze.length>0?[`${An(Ze.length,"broken test match","broken test matches")}`]:[]];return v.splice(1,0,`In short: ${Oe.join("; ")}.`),v.join(`
431
+ `)}import{existsSync as T_e,realpathSync as vH}from"node:fs";import{join as P_e}from"node:path";var qc=5,Uc=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,ga=e=>e?` "${e}"`:"",$H=(e,t)=>{try{return vH(e)===vH(t)}catch{return e===t}},vg=e=>`${e.slice(0,qc*2).join(", ")}${e.length>qc*2?`, and ${e.length-qc*2} more`:""}`;function bH(e,t){let{tree:r,resolved:i}=e,{root:n}=r,{codeRoot:o}=i,s=K(n),a=_e(o),c=ir(n),l=c.filter(L=>L.state==="open"),u=zd(t,n),d=new Map(u.map(L=>[L.unit,L])),p=l.find(L=>L.id===a?.activeUnit),f=[`BuildKeel status: ${r.config.name?`${r.config.name}, `:""}Spec-driven spec tree ${n} (format ${r.config.format}${r.access.writable?"":", read-only"})`,""],m=a?.activeUnit??null,h=p?`${p.id} change${ga(p.title)}`:m?`${m}${ga(s.artifacts.get(m)?.title)}`:null;f.push(h?`Active unit here: ${h}${a?.activeBranch?` on branch ${a.activeBranch}`:""}.`:a?.untrackedSince?`No active unit in this working tree: working without one since ${a.untrackedSince}, as the user chose.`:"No active unit in this working tree.");let g=Fo(n),y=(g.archives??0)+(g.completions??0);f.push(`Spec repo: ${oj(a?.freshness)}.${y>0?` Not pushed yet: ${Uc(y,"archive, discard or completion","archives, discards or completions")}; push the spec repo to share them.`:""}`);let v=[];try{v=so(n,["status","--porcelain=v1","-z","--untracked-files=all","--",Xe,lo]).split("\0").filter(Boolean).map(L=>L.slice(3))}catch{}v.length>0&&f.push(`Spec tree settings not committed: ${v.join(", ")}. Commit them, on their own, so everyone works to the same templates and rules.`);let b=0;f.push("",l.length>0?`Open changes (${l.length}):`:"No change is open.");for(let L of l){let Ve=no.flatMap(pt=>pt==="spec-change"?L.capabilities.map(Oe=>`spec change ${Oe}`):T_e(P_e(n,Ce(L.id,pt)))?[pt]:[]),Ze=d.get(L.id),Ge=Ze?$H(Ze.workingTree,o)?" \xB7 in progress here":` \xB7 in progress in ${Ze.workingTree}`:"",yt=L.total>0?`${L.done} of ${L.total} tasks done`:"no tasks yet";f.push(`- ${L.id}${ga(L.title)}: ${yt}; ${Ve.join(", ")}${Ge}`);let lr=Ek(n,L.id,{codeRoot:o,specRoot:n});b+=lr.length,f.push(...lr.map(pt=>` - ${pt.message.replace(`${L.id}: `,"")}`))}let _=c.filter(L=>L.state!=="open");if(_.length>0){let L=Ge=>_.filter(yt=>yt.state===Ge).map(yt=>yt.id),Ve=L("archived"),Ze=L("discarded");f.push(`Closed: ${[...Ve.length>0?[`${Ve.length} archived (${vg(Ve)})`]:[],...Ze.length>0?[`${Ze.length} discarded (${vg(Ze)})`]:[]].join(", ")}.`)}let k=Un(n);f.push("",k.length>0?`Capability specs (${k.length}):`:"No capability specs yet: finishing a change that adds one writes its first version.");for(let L of k){let Ve=Pt(n,L.code),Ze=Ve.ok&&Ve.value.record.ok?Ve.value.record.value:null,Ge=Ze?.change?`, written by ${Ze.change}`:Ze?.version===0?", describing code from before BuildKeel":"",yt=l.filter(lr=>lr.capabilities.includes(L.code)).map(lr=>lr.id);f.push(`- ${L.code}${ga(L.title)} v${L.inForce}${Ge}${yt.length>0?`; open changes to it: ${yt.join(", ")}`:""}`)}if(u.length>0){f.push("",`Claims on this machine (${u.length}):`);for(let L of u)f.push(`- ${L.unit}: ${$H(L.workingTree,o)?"this working tree":L.workingTree}${L.branch?`, branch ${L.branch}`:""}, since ${L.claimedAt}`)}let x=c9({root:n,codeRoot:o,specRoot:n,activeUnit:m}),S=x.filter(L=>L.status==="no test").map(L=>L.id),C=x.filter(L=>L.status==="failed").map(L=>L.id),E=x.filter(L=>L.status==="stale").map(L=>L.id);f.push("",x.length===0?"Scenarios: none yet.":`Scenarios: ${x.length}, ${x.length-S.length} with a tagged test (local results in this working tree).`),S.length>0&&f.push(`- No tagged test (${S.length}): ${vg(S)}`),C.length>0&&f.push(`- Failing (${C.length}): ${vg(C)}`),E.length>0&&f.push(`- Stale, the code or the requirement changed since the run (${E.length}): ${vg(E)}`);let U=da(n).suspects;if(U.length>0){f.push("",`Suspect (${U.length}), each built against an older capability version that changed what it relies on:`);for(let L of U)f.push(`- ${L.kind==="test"?`tests of ${L.id}`:`${L.id}${ga(L.title)}`}: ${jk(L)}`);f.push("Review them with {{bk:impact}}: each is still valid, or needs change.")}let V=qn(n),X=V.ok&&V.value?V.value.areas.flatMap(L=>dd(L.openQuestions??[]).map(Ve=>`${L.name} ${Ve.id} (${Ve.about})`)):[],J=V.ok&&V.value?ea(V.value.areas):null;J&&J.read>0&&f.push("",`Tickets: ${ta(J)}.`),X.length>0&&f.push("",`Questions left open: ${X.length}: ${X.join(", ")}. {{bk:onboard}} lists them, for someone who knows to answer.`);for(let[L,Ve]of[["bug","Bugs"],["adhoc","Ad-hoc work"]]){let Ze=[...s.artifacts.values()].filter(pt=>pt.type===L);if(Ze.length===0)continue;let Ge=Ze.flatMap(pt=>{let Oe=Ko(n,pt);return Oe?[{r:pt,record:Oe}]:[]}),yt=Ze.filter(pt=>!Ke(n,pt,null)&&!Ge.some(Oe=>Oe.r===pt)),lr=Ze.length-yt.length-Ge.length;f.push("",`${Ve}: ${yt.length} open, ${lr} done${Ge.length>0?`, ${Ge.length} closed without a fix`:""}.`,...yt.map(pt=>`- ${pt.id}${ga(pt.title)}${d.has(pt.id)?", in progress":""}`),...Ge.map(({r:pt,record:Oe})=>`- ${pt.id}${ga(pt.title)}: ${Oe.ok?Wo(Oe.value):"closed"}`))}let it=zi(r,s,{codeRoot:o,repo:i.pointer.repo},t),z=[];for(let L of it.repos){L.baseline&&!L.baseline.found&&z.push(`- ${L.name}: its baseline ${L.baseline.commit} is not in its history, so every commit counts.`);let Ve=sg(L);Ve.length>0&&z.push(`- ${L.name}: ${Uc(Ve.length,"commit")}: ${Ve.slice(0,qc).map(Ze=>`${Ze.id.slice(0,7)} "${Ze.subject}"`).join(", ")}${Ve.length>qc?`, and ${Ve.length-qc} more`:""}`)}it.missing.length>0&&z.push(`- Not on this machine, so not checked: ${it.missing.join(", ")}`),f.push("",...z.length>0?["Commits with no unit, after each repo's baseline:",...z]:["Commits with no unit: none after the baselines."]);let pe=W9(n,it);if(pe.length>0){f.push("Commits of discarded changes:");for(let{record:L,commits:Ve}of pe)f.push(`- ${L.change}${ga(L.title)}, discarded on ${L.discardedAt.slice(0,10)}${L.reason?` (${L.reason})`:""}: ${Ve.slice(0,qc).map(Ze=>`${Ze.id.slice(0,7)} "${Ze.subject}"`).join(", ")}`)}let H=[...J_(n).problems.filter(L=>L.code==="capability-version-altered"),...uS(n).filter(L=>L.code.startsWith("archived-change-"))];H.length>0&&f.push("",D("Changed outside BuildKeel:",H));let fe=cS(e,t);fe.ready.length>0&&f.push("",`Ready to start (${fe.ready.length}):`,...fe.ready),fe.waiting.length>0&&f.push(`Being worked on elsewhere: ${fe.waiting.length}; {{bk:start}} lists them.`),p&&f.push("",`Offer to review ${p.id} now: call finish_work without apply (it writes nothing), review the code against its requirements, scenarios and design, and report as your judgment what is implemented, missing or at odds with the design. Do not finish it unless the user asks.`);let kt=[...e.notices,...od(r),...s.problems];kt.length>0&&f.push("",D("Problems with the tree:",kt));let Qt=[h?`${m} is in progress here`:"no unit is active here",`${Uc(l.length,"open change")}`,...b>0?[`${Uc(b,"finding")} in open changes`]:[],...S.length>0?[`${Uc(S.length,"scenario")} with no tagged test`]:[],...C.length>0?[`${C.length} failing`]:[],...U.length>0?[`${Uc(U.length,"item")} ${U.length===1?"is":"are"} suspect`]:[],...y>0?[`${y} not pushed`]:[],...z.length>0?["commits with no unit"]:[],...H.length>0?[`${Uc(H.length,"record")} changed outside BuildKeel`]:[]];return f.splice(1,0,`In short: ${Qt.join("; ")}.`),f.join(`
432
+ `)}var IH=Zt({name:"query",title:"Query the spec tree",description:"Read the BuildKeel spec tree. view=tree lists every artifact as a hierarchy with its state (draft, approved, approved with the number pending, new version in draft), plus any problems with the tree. view=artifact with id returns one artifact's full text and state (with version, one of its approved versions as frozen). view=startable lists the units that can be worked on (tasks, stories without tasks, bugs, ad-hoc units), split into ready to start, not ready yet with the first reason, and done, and marks the active unit. view=drafts lists everything waiting for approval (drafts and new versions in draft), split into ready to approve and not ready yet, with the first reason for each. view=coverage with id shows test coverage: for a story, each acceptance criterion with the test cases that cover it and any gaps; for a task, every test case that applies to it (its own and its story's); for an epic, each story under it; for a business idea, its goals and epics. view=process is the team's process: each stage with how its IDs look and the documents it requires before work under it starts, and the documents that can be attached. view=stats is the user's own usage over the last days days (all of it when days is left out), from the record kept on this machine only: units finished, time from start to done, gate outcomes, coverage gaps caught, suspects and how they were decided. view=describes with paths names, for each file of this code repo, the artifacts that describe it: those whose scope covers it, and the units whose commits changed it; a file nothing describes is code no artifact covers yet. view=untested, for an artifact (id) and everything under it or for the whole tree, lists the test cases no test implements (no test in this repo tagged with them, none matched to them) and the tests in the latest test report recorded here that implement no test case, by tag or by match. view=onboarding is where documenting existing code stands: each area of the map with how much of its code is described (onboarded, drafts waiting, partly done by earlier onboarding or by work that touched it, not started), the next area, and the artifacts still as onboarding left them with required sections empty. view=status is the overview: the tree with each artifact's state and the work on each unit (done, in progress), the active unit, claims on this machine, coverage gaps, suspects (built against an older version of something that has changed since), numbers pending, the spec repo's freshness and unpushed records, ad-hoc work, commits with no unit after each repo's baseline, records changed outside BuildKeel, and what can be started next. In a Spec-driven tree, view=capabilities lists the capability specs, or with id (a code such as AUTH) shows one, at version when given; view=changes lists the changes, or with id shows one change's files; view=process and view=startable answer for the mode.",inputSchema:{view:$.enum(["tree","artifact","coverage","drafts","startable","process","stats","status","describes","untested","onboarding","capabilities","changes"]).default("tree").describe("What to show."),paths:$.array($.string()).optional().describe("view=describes: files in this code repo, relative to its root, such as src/reset/token.ts."),days:$.number().int().positive().optional().describe("view=stats: the period, in days back from now, such as 30. All of the record when left out."),id:$.string().optional().describe("view=artifact, coverage or untested: the artifact's ID, such as US-001, US-draft-k3x9 or US-001-TP."),version:$.number().int().nonnegative().optional().describe("view=artifact: an approved version to show instead of the current file, such as 2 to compare with the draft of v3, or 0 for version 0.")},readOnly:!0,run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let i=B(r.value.tree.root).mode==="spec-driven";if(Ks(r.value.tree.root)){if(t.view==="onboarding")return A_e(r.value);if(t.view==="process")return[C_e,"",SH(r.value)].join(`
433
+ `)}let n=i||B(r.value.tree.root).conversion!==null;return t.view==="capabilities"?n?JG(r.value,t.id,t.version):xH:t.view==="changes"?n?YG(r.value,t.id):xH:i&&t.view==="process"?XG(r.value):i&&t.view==="startable"?M_e(r.value,e.home):t.view==="artifact"?TH(r.value,t.id,t.version):t.view==="drafts"?D_e(r.value):t.view==="startable"?L_e(r.value,e.home):t.view==="status"?i?bH(r.value,e.home):yH(r.value,e.home):t.view==="process"?SH(r.value):t.view==="stats"?tH(r.value,e.home,t.days):t.view==="describes"?j_e(r.value,e.home,t.paths??[]):t.view==="untested"?N_e(r.value,t.id):t.view==="onboarding"?i?QG(r.value):O_e(r.value,e.home):t.view==="coverage"?t.id?KG(r.value.tree.root,K(r.value.tree.root),t.id):"Give the id of the artifact whose coverage to show.":z_e(r.value)}}),C_e="This spec tree is Spec-driven and is being converted to Full SDLC: its capability specs are drafted, area by area, into the process below, as version 0, and approved. Work is not started through these stages until the tree has switched; bugs and ad-hoc units work as usual.";function A_e(e){let t=Tc(e.tree.root);return t.ok?QN(t.value).join(`
434
+ `):D("The conversion cannot be read.",t.problems)}function TH(e,t,r){if(!t)return"Give the id of the artifact to show.";let{root:i}=e.tree,n=br(t),o=n.id,s=K(i).artifacts.get(o);if(!s)return`There is no artifact ${o}.`;if(n.v0&&r===void 0)return s.onboard&&!se(i,s).onboarded?[`${s.id} version 0 (${Re(i).one(s.type)}, draft, describing code as it was before BuildKeel) at ${s.onboard.path}:`,"",Gt(s.onboard.document).trimEnd()].join(`
435
+ `):TH(e,o,0);if(r!==void 0){let f=dt(i,s);if(!f.includes(r))return`${s.id} has no approved version ${r}.${f.length>0?` Its approved versions are ${f.map(g=>`v${g}`).join(", ")}.`:""}`;let m=zo(Ae(s),r),h=r===0?ck(i,s):null;return[`${s.id} v${r} (${Re(i).one(s.type)}, approved, frozen) at ${m}:`,...h?[kH(s.id,h)]:[],"",wH(_H(i,m),"utf8").trimEnd()].join(`
436
+ `)}let a=se(i,s),c=pd(a),l=We(s.type,i),u=l.ok?dK(i,s,l.value):[],d=ck(i,s),p=a.onboardOnly;return[`${s.id} (${Re(i).one(s.type)}, ${c}) at ${s.path}:`,...d?[kH(s.id,d)]:[],...p?["This is the draft of version 0: it describes code as it was before BuildKeel, and is held to no template."]:[],...a.onboardOpen&&!p?[`A draft of version 0 waits at ${s.onboard?.path}: read it with id ${s.id}@v0.`]:[],...E_e(i,s.id),"",wH(_H(i,s.path),"utf8").trimEnd(),...u.length>0&&!p?["",`Next entry numbers: ${u.join(", ")}. Numbers of removed entries are never reused.`]:[]].join(`
437
+ `)}function E_e(e,t){let r=oK(e,t);return r.length===0?[]:["Converted from the tree's capability specs (kept, read-only, as history):",...r.map(i=>{let n=i.added?i.added.change?`, added by ${i.added.change} (${i.capability} v${i.added.version})`:`, in ${i.capability} v${i.added.version}, which described code from before BuildKeel`:"";return`- ${i.entry}: scenario ${i.scenario} of requirement ${i.requirement}${n}`})]}function kH(e,t){let r=t.sources.length>0?`, from ${t.sources.length===1?"1 source":`${t.sources.length} sources`} kept beside it`:"",i=t.empty.length>0?` It leaves empty: ${t.empty.join(", ")}.`:"";return t.inForce?`${e} v0 describes the code as it was before BuildKeel: reviewed and approved by ${t.by} on ${t.on}${r}.${i}`:`${e} v0, before the version in force, describes the code as it was before BuildKeel: reviewed and approved by ${t.by} on ${t.on}${r}.`}function O_e(e,t){let{tree:r,resolved:i}=e,n=K(r.root),o=i.pointer.repo,s=Re(r.root),a=[],c=qn(r.root);if(!c.ok)return D("The map of areas cannot be read.",c.problems);if(!c.value||c.value.areas.length===0)a.push("There is no map of the code yet. {{bk:onboard}} proposes one: the code's capability areas, each with its paths, to adjust before anything is drafted.");else{let d=Zk(n,zi(r,n,{codeRoot:i.codeRoot,repo:o},t),i.codeRoot,o,c.value),p=d.filter(h=>h.state==="onboarded").length;a.push(`Onboarding: ${p} of ${d.length} area${d.length===1?"":"s"} onboarded, from the map in ${sn}.`,"","| Area | Paths | Where it stands |","|---|---|---|");let f=h=>{let g=`${h.described} of ${h.files} file${h.files===1?"":"s"} described`;switch(h.state){case"onboarded":return`onboarded: ${g}`;case"drafted":return`drafts waiting for approval: ${h.drafts.join(", ")}; ${g}`;case"partly":return`partly done: ${g}`;case"not started":return h.files===1?"not started: its one file is not described":`not started: none of its ${h.files} files are described`;case"no code":return"no code files at these paths";case"elsewhere":return`in ${h.area.repo}: open that repository to work on it`}};a.push(...d.map(h=>`| ${h.area.name} | ${h.area.paths.join(", ")} | ${f(h)} |`)),a.push(...aS(c.value.areas));let m=Vk(d);a.push("",m?`Next area: ${m.area.name}.${m.state==="partly"?" Part of it is described already: draft only what is not.":m.state==="drafted"?" Its drafts wait for approval.":""}`:"Every area in this repository is onboarded.")}let l=G_(n);if(l.length>0){a.push("",`Questions left open (${l.length}), each keeping its part out of version 0 until someone who knows answers it:`);for(let{id:d,title:p,question:f}of l)a.push(`- ${d}${p?` "${p}"`:""} ${f.id}, ${f.about}: the code: ${f.code}; ${f.sources?.length?f.sources.join(", "):"the source"}: ${f.source} (left open by ${f.leftOpenBy??"someone"})`);a.push("To answer one, ask which is intended, with both readings as equals; save the answer (answer: code or source) on the question with save_draft, version 0, and draft the part it concerns.")}let u=sW(n);if(u.length>0){a.push("",`Still as onboarding left them, with required sections empty (${u.length}):`);for(let d of u)a.push(`- ${d.record.id} ${s.one(d.record.type)}${d.record.title?` "${d.record.title}"`:""} v${d.version}: ${d.empty.join(", ")}`);a.push("Filling one in drafts its next version, which only completes it: nothing built on it becomes suspect.")}return a.join(`
438
+ `)}function N_e(e,t){let{tree:r,resolved:i}=e,n=K(r.root),o=t?n.artifacts.get(t):void 0;if(t&&!o)return`There is no artifact ${t}.`;let s=o?`under ${o.id}${o.title?` "${o.title}"`:""}`:"in the spec tree",a=Fk(r.root,n,i.codeRoot,tW(n,o?.id)),c=[a.total===0?`There are no test cases ${s}.`:`${a.total-a.untested.length} of ${a.total} test case${a.total===1?"":"s"} ${s} ${a.total-a.untested.length===1?"has":"have"} a test, tagged with its ID or matched to it.`];if(a.untested.length>0){c.push("",`No test yet (${a.untested.length}):`);for(let l of a.untested)c.push(`- ${l.id} ${l.title} (${l.plan}${l.covers.length>0?`, covers ${l.covers.join(", ")}`:""})`)}return a.report?a.unmatched&&a.unmatched.length>0?c.push("",`Tests in the latest report (${a.report.report}) that match no test case (${a.unmatched.length}), anywhere in the tree:`,...a.unmatched.map(l=>`- ${l}`)):c.push("",`Every test in the latest report (${a.report.report}) carries a test case's ID or is matched to one.`):c.push("","No test report has been recorded in this working tree yet, so the tests that match no test case are not known. Run the tests with a JUnit XML report and record it with test_results."),c.join(`
439
+ `)}function j_e(e,t,r){if(r.length===0)return"Give the paths of the files, relative to the code repo's root, such as src/reset/token.ts.";let{tree:i,resolved:n}=e,o=K(i.root),s=n.pointer.repo,a=Vh(i.root,o,zi(i,o,{codeRoot:n.codeRoot,repo:s},t),s),c=Re(i.root),l=[],u=[];for(let d of r){let p=(ZG(n.codeRoot,R_e(n.codeRoot,d))??co(d)).replace(/\/$/,""),f=bK(a,p);if(f.scopes.length===0&&f.units.length===0&&f.changes.length===0){u.push(p);continue}l.push(`${p} in ${s} is described by:`);for(let m of f.scopes){let h=m.version===0?", describing code as it was before BuildKeel":"";l.push(`- ${m.record.id} ${c.one(m.record.type)}${m.record.title?` "${m.record.title}"`:""} v${m.version}${h}: its scope covers ${m.covering.join(", ")}`)}for(let m of f.units){let h=m.commits.slice(0,3).map(g=>`${g.id.slice(0,7)} ${g.subject}`);l.push(`- ${m.record.id} ${c.one(m.record.type)}${m.record.title?` "${m.record.title}"`:""}: its work changed it${h.length>0?` (${h.join("; ")}${m.commits.length>3?`, and ${m.commits.length-3} more`:""})`:""}`)}for(let m of f.changes){let h=m.became.length>0?`; its requirements became ${m.became.join(", ")}`:"";l.push(`- ${m.change} change${m.title?` "${m.title}"`:""}, archived while this tree was Spec-driven: its work changed it${h}`)}}return u.length>0&&l.unshift(`Nothing describes ${u.join(", ")} in ${s} yet: no artifact's scope covers ${u.length===1?"it":"them"}, and no unit's commits changed ${u.length===1?"it":"them"}.`,...l.length>0?[""]:[]),l.join(`
440
+ `)}function SH(e){let t=hr(e.tree);return t.ok?[`The process of this spec tree${e.tree.config.name?`, ${e.tree.config.name}`:""}, from the business idea down:`,"",...Ud(t.value)].join(`
441
+ `):D("The process definition has problems, so BuildKeel uses its default one until they are fixed.",t.problems)}function z_e(e){let{tree:t}=e,r=K(t.root),i=[`Spec tree: ${t.root} (format ${t.config.format}${t.access.writable?"":", read-only"})`];r.artifacts.size===0?i.push("","No artifacts yet."):i.push("",...Jk(t,r));let n=[...e.notices,...od(t),...r.problems];return n.length>0&&i.push("",D("Problems:",n)),i.join(`
442
+ `)}function D_e(e){let{tree:t}=e,r=YK(t);if(!r.ok)return D("BuildKeel cannot read the process definition.",r.problems);if(r.value.length===0)return"Nothing is waiting for approval.";let i=K(t.root),n=({record:l,target:u})=>{let d=l.type===te.type?i.artifacts.get(Bt(l.id))?.type:void 0,p=d?Zo(t.root,d):null,f=p?Rc[p]:Cn(t,l.type);return`${u} ${f}${l.title?` "${l.title}"`:""}`},o=l=>l===0?"v0, describing code as it was before BuildKeel":l===1?"v1":`v${l} (v${l-1} is approved)`,s=r.value.filter(l=>l.gate.outcome!=="blocked"),a=r.value.filter(l=>l.gate.outcome==="blocked"),c=[`Waiting for approval: ${r.value.length}.`];if(s.length>0){c.push("",`Ready to approve (${s.length}):`);for(let l of s)c.push(`- ${n(l)}: ${o(l.version)}${l.gate.outcome==="warned"?`, with ${l.gate.warnings.length} warning(s)`:""}`)}if(a.length>0){c.push("",`Not ready yet (${a.length}):`);for(let l of a){let[u,...d]=l.gate.blocking;c.push(`- ${n(l)}: ${u?.message??""}${d.length>0?` (and ${d.length} more)`:""}`)}}return c.join(`
443
+ `)}var xH="This spec tree follows Full SDLC, which has no capability specs or changes. view=tree lists its artifacts.";function M_e(e,t){let r=cS(e,t);return r.ready.length+r.waiting.length+r.finished.length===0?"There is nothing to work on yet: no open change, bug or ad-hoc unit. Draft a change from the conversation with {{bk:capture}}.":PH(r)}function L_e(e,t){let r=ma(e,t);if(r.units.length===0){let i=Re(e.tree.root);return`There is nothing to work on yet: no ${i.many("task")}, ${i.many("story")}, ${i.many("bug")} or ${i.many("adhoc")}.`}return PH(r)}function PH({ready:e,waiting:t,finished:r}){let i=[];return e.length>0&&i.push(`Ready to start (${e.length}):`,...e),t.length>0&&i.push(...i.length>0?[""]:[],`Not ready yet (${t.length}):`,...t),r.length>0&&i.push(...i.length>0?[""]:[],`Done (${r.length}):`,...r),i.join(`
444
+ `)}async function RH(e){let{tree:t,id:r}=e;if(!t.access.writable)return w(t.access.problem);let i=K(t.root),n=yr(t.root,i).suspects.filter(a=>a.id===r);if(n.length===0)return w({code:"resolve-not-suspect",message:`${r} is not suspect: ${i.artifacts.has(r)?"it is built against the versions in force, or what changed since does not affect it":"there is no artifact or suspect test case with that ID"}.`,remedy:"See what is suspect with the BuildKeel impact tool."});let o=n.find(a=>a.current===null||a.changes.length===0);if(o)return w({code:"resolve-unreadable",message:`${r} cannot be resolved: ${o.target} v${o.pinned} and the version after it could not be compared, so its review would be blind.`,remedy:"Run the BuildKeel validate tool to find the record or frozen copy that cannot be read, and restore it from git history."});let s=n[0].holder;return e.decision==="still-valid"?q_e(e,n):s.type==="bug"?U_e(e,n,s):F_e(e,n,s)}function sj(e,t,r,i,n={}){let o=[];for(let s of t){let a={target:s.target,...s.kind==="test-case"?{testCase:s.id}:{},from:s.pinned,to:s.current,decidedBy:r,decidedAt:i,...n},c=e.createRecord(jB(s.holder,Nh(a)),jh(a));if(!c.ok)return c;o.push(c.value)}return T(o)}async function U_e(e,t,r){let{tree:i,writer:n}=e,o={kind:"needs-change",resolved:t,holder:r,repinned:null,draftOpen:!1};if(!Ke(i.root,r,null))return T({...o,bug:{kind:"update"}});let s=lt(i.root);if(!s)return w({code:"resolve-no-identity",message:"Git has no name and email set for the spec repo, so who decided cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then decide again.'});let a=t.find(f=>f.target===r.parent?.id)??t[0],c=`${a.target} v${a.current}`,l=await gk({tree:i,writer:n},{type:"bug",content:`---
445
+ id: ${jr}
446
+ title: Check ${r.id} against ${c}
447
+ parent: ${a.target}
448
+ ---
449
+
450
+ ## Description
451
+
452
+ ${r.id}${r.title?` "${r.title}"`:""} was fixed against ${a.target} v${a.pinned}. ${c} changes ${a.changes.map(f=>f.id).join(", ")}, so its fix may no longer hold. Check it, and fix what no longer does.
453
+ `});if(!l.ok)return l;let u=(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),d=sj(n,t,s,u,{decision:"needs-change",followUp:l.value.id});if(!d.ok)return d;let p=Me(i.root,d.value,`repin: ${r.id} to ${c} (needs change: ${l.value.id})`);return T({...o,bug:{kind:"follow-up",created:l.value,records:d.value,commit:p}})}function CH(e,t,r,i=()=>new Date){let n=K(e.root),o=n.artifacts.get(r);if(!o||o.type!=="bug"||Ke(e.root,o,null))return T(null);let s=yr(e.root,n).suspects.filter(p=>p.id===r&&p.current!==null);if(s.length===0)return T(null);let a=lt(e.root);if(!a)return w({code:"resolve-no-identity",message:"Git has no name and email set for the spec repo, so who decided cannot be recorded."});let c=s.find(p=>p.target===o.parent?.id),l=[];if(c){let p=t.writeFile(o.path,Gt(sr(o.document,{parent:`${c.target}@v${c.current}`})));if(!p.ok)return p}l.push(o.path);let u=sj(t,s,a,i().toISOString().replace(/\.\d{3}Z$/,"Z"),{decision:"needs-change"});if(!u.ok)return u;let d=s.map(p=>`${p.target} v${p.current}`).join(", ");return T({against:d,records:u.value,commit:Me(e.root,[...l,...u.value],`repin: ${r} to ${d} (needs change)`)})}async function q_e(e,t){let{tree:r,writer:i,id:n}=e,o=lt(r.root);if(!o)return w({code:"resolve-no-identity",message:"Git has no name and email set for the spec repo, so who decided cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then decide again.'});let s=(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),a=sj(i,t,o,s);if(!a.ok)return a;let c=a.value,l=t.map(p=>`${p.target} v${p.current}`).join(", "),u=Me(r.root,c,`repin: ${n} to ${l}`),d=u.ok&&r.config.settings.autoPush?await In(r.root):null;return T({kind:"still-valid",resolved:t,records:c,commit:u,push:d})}function F_e(e,t,r){let{tree:i,writer:n}=e,o=t.find(c=>c.target===r.parent?.id&&(r.parent.version??0)<c.current),s=null;if(o){s=`${o.target}@v${o.current}`;let c=n.writeFile(r.path,Gt(sr(r.document,{parent:s})));if(!c.ok)return c}let a=K(i.root).artifacts.get(r.id)??r;return T({kind:"needs-change",resolved:t,holder:r,repinned:s,draftOpen:se(i.root,a).draftOpen})}var AH=Zt({name:"resolve_suspect",title:"Decide on a suspect",description:`Record the user's decision on a suspect found by the impact tool, only once the user has made it; never decide for them. "still-valid" keeps it as it is: a permanent re-pin record says it was reviewed against the new version, committed alone in the spec repo, and it is no longer suspect. "needs-change" opens its next version (or, for a test case, its plan's) as a draft written against the new version, to update with save_draft and approve; it stays suspect until then. In a Spec-driven tree, id is a scenario (for its tests) or an archived change: decided in an open change's impact preview, the decision is carried out when that change is archived, and needs change adds a task to it; after archiving, still valid re-pins it now, and needs change adds a task to the open change named in change.`,inputSchema:{id:$.string().describe("The suspect: an artifact such as TK-001, or a test case such as US-001-TC2."),decision:$.enum(["still-valid","needs-change"]).describe("The user's decision."),change:$.string().optional().describe("Spec-driven: the open change whose impact preview raised it; or, for needs change after archiving, the open change to add the task to.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let i=r.value.tree;if(B(i.root).mode==="spec-driven")return nG(e,r.value,{id:t.id,decision:t.decision,...t.change?{change:t.change}:{}});let n=await RH({tree:i,writer:e.writer(r.value),id:t.id,decision:t.decision});if(!n.ok)return D(`Nothing was recorded for ${t.id}.`,n.problems);e.usage(r.value,{event:"resolve",id:t.id,decision:t.decision});let o=yr(i.root,K(i.root)).suspects.length,s=o===0?"Nothing else is suspect.":`${V_e(o,"item")} ${o===1?"is":"are"} still suspect; see them with {{bk:impact}}.`;return[...Z_e(n.value,i.root),"",s].join(`
454
+ `)}});function Z_e(e,t){let r=e.resolved[0].id,i=e.resolved.map(a=>`${a.target} v${a.current}`).join(" and ");if(e.kind==="still-valid"){let a=[`Recorded that ${r} is still valid against ${i}, so it is no longer suspect. The decision is kept in:`,...e.records.map(c=>`- ${c}`)];return e.commit.ok?(a.push(`Committed as "repin: ${r} to ${e.resolved.map(c=>`${c.target} v${c.current}`).join(", ")}" (${e.commit.value.slice(0,7)}) in the spec repo, with only ${e.records.length===1?"that file":"those files"}.`),e.push?a.push(e.push.ok?"Pushed.":`Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):Qs(t).length===0?a.push("Not pushed: the spec repo has no remote. Add one and push it to share the decision."):a.push("Not pushed. Push the spec repo to share the decision.")):a.push(`The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),a}let n=e.holder,o=`save it with save_draft and approve it with {{bk:approve}} ${n.id}`;if(n.type==="bug"&&e.bug?.kind==="follow-up"){let{created:a,records:c,commit:l}=e.bug;return[`${r} is finished, and its fix was made against what ${i} has changed: recorded ${a.id} "${a.title??""}" to check it, and kept the decision in ${c.join(", ")}.`,l.ok?`Committed as "repin: ${r} to ${i} (needs change: ${a.id})" (${l.value.slice(0,7)}) in the spec repo. ${r} is no longer suspect; ${a.id} can be started with {{bk:start}} ${a.id}.`:`The record is written but was not committed: ${l.problems[0]?.message??""} Commit it in the spec repo yourself.`]}if(n.type==="bug")return[`${r} needs change: nothing is written yet. Update its file with the user to match ${i}, such as what it expects, and save the whole file with save_draft (id ${r}). Saving it moves it to ${i} and records the decision, in one commit. It stays suspect until then.`];if(n.id===r)return[e.repinned?`${r} needs change: its next version is open as a draft, with parent ${e.repinned}. Update it to match ${i}, then ${o}. It stays suspect until that version is approved.`:`${r} needs change: update it to match ${i}, then ${o}. It stays suspect until its new version is approved.`];let s=e.repinned?`the next version of ${n.id} is open as a draft, written against ${e.repinned}`:e.draftOpen?`the next version of ${n.id} is open as a draft`:`changing it in ${n.id} opens the plan's next version`;return[`${r} needs change: ${s}. Change ${r} to match ${i}, adding test cases for any new criteria, then ${o}. ${r} stays suspect until that version is approved.`]}var V_e=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function EH(e,t){let r=[],i=new Map;for(let g of t){let y=br(g),v=e.artifacts.get(y.id);if(!v){r.push({code:"approve-not-found",message:`There is no artifact ${y.id}.`});continue}let b=se(e.root,v),_=y.v0||b.onboardOnly,k=_?`${y.id}${Rn}`:y.id;i.has(k)||!_&&la(Tt(e.root),e,v)||(v.type==="adhoc"||v.type==="bug"&&!_?r.push({code:"approve-not-approvable",message:`${y.id} is a bug or an ad-hoc unit, which is not approved.`}):_&&b.onboarded?r.push({code:"approve-v0-exists",message:`${y.id} already has an approved version 0.`}):_&&!b.onboardOpen?r.push({code:"approve-no-v0-draft",message:`${y.id} has no draft of version 0 waiting.`}):!_&&b.state==="approved"&&!b.draftOpen?r.push({code:"approve-nothing-new",message:`${y.id} v${b.approvedVersion} is approved and no new version is open.`}):i.set(k,{record:_?Ac(v)??v:v,artifact:y.id,v0:_}))}if(r.length>0)return w(...r);let n=g=>g===void 0?[]:[`${g}${Rn}`,g].filter(y=>i.has(y)),o=new Map;for(let[g,y]of i){let v=ra.flatMap(k=>na(y.record.document.frontmatter,k).ids),b=[y.record.owner,y.record.parent?.id,...v].filter(k=>k!==y.artifact).flatMap(n),_=y.v0?[]:n(y.artifact).filter(k=>k!==g);o.set(g,[...new Set([..._,...b])])}let s=new Map;for(let g of i.values())s.has(g.artifact)||s.set(g.artifact,g.record);let a=new Map,c=g=>t.findIndex(y=>br(y).id===g.id),l=g=>g.owner??g.parent?.id,u=g=>[...s.values()].filter(y=>l(y)===g||g===void 0&&!s.has(l(y)??"")).sort((y,v)=>+(v.owner!==void 0)-+(y.owner!==void 0)||c(y)-c(v)),d=new Set,p=g=>{if(!d.has(g.id)){d.add(g.id);for(let y of n(g.id))a.set(y,a.size);for(let y of u(g.id))p(y)}};for(let g of u(void 0))p(g);for(let g of s.values())p(g);let f=[],m=new Set,h=[...i.keys()].sort((g,y)=>(a.get(g)??0)-(a.get(y)??0));for(;h.length>0;){let g=h.findIndex(v=>(o.get(v)??[]).every(b=>m.has(b)));if(g<0)return w({code:"approve-set-cycle",message:`${h.join(", ")} each need another of them approved first, through their parents or links, so none can go first.`});let[y]=h.splice(g,1);m.add(y),f.push({id:y,record:i.get(y).record,needs:o.get(y)??[]})}return T(f)}async function OH(e,t){let r=K(e.tree.root),i=EH(r,t);if(!i.ok)return i;let n=[],o=new Map,s=new Map;for(let a of i.value){let c=await ca(e,{id:a.id,apply:!1,first:new Set(a.needs.map(f=>br(f).id))});if(!c.ok)return c;let l=c.value;if(l.kind!=="preview"&&l.kind!=="refused")return w({code:"approve-set-pending",message:`${a.id} is already approved, with its number pending.`});let u=l.gate,d=a.needs.find(f=>o.has(f));d?o.set(a.id,o.get(d)):u.outcome==="blocked"&&o.set(a.id,a.id);let p=br(a.id);if(l.kind==="preview"&&!p.v0&&i.value.some(f=>f.id===`${p.id}${Rn}`)&&(delete l.likelyId,delete l.dirTo,l.references=[]),l.kind==="preview"&&l.likelyId){let f=/^(.*?)(\d+)$/.exec(l.likelyId);if(f){let[,m,h]=f,g=Math.max(Number(h),(s.get(m)??0)+1);s.set(m,g),l.likelyId=`${m}${String(g).padStart(h.length,"0")}`}}n.push({member:a,preview:l,gate:u,...d?{waitsFor:o.get(d)}:{}})}return T(n)}async function NH(e,t){let r=EH(K(e.tree.root),t);if(!r.ok)return r;let i=new Map,n=c=>{let{id:l,v0:u}=br(c);for(let[d,p]of i){if(l===d)return`${p}${u?Rn:""}`;if(l.startsWith(`${d}-`))return`${p}${l.slice(d.length)}${u?Rn:""}`}return c},o=new Map,s=new Map,a=[];for(let c of r.value){let l=c.needs.find(h=>{let g=o.get(h);return g!==void 0&&g.kind!=="approved"});if(l){let h={kind:"waiting",on:n(l)};o.set(c.id,h),a.push({member:c,finalId:n(c.id),outcome:h});continue}let u=n(c.id),d=B_e(e,u,s);if(!d.ok){let h={kind:"failed",problems:d.problems};o.set(c.id,h),a.push({member:c,finalId:u,outcome:h});continue}let p=await ca(e,{id:u,apply:!0}),f,m=u;if(!p.ok)f={kind:"failed",problems:p.problems};else if(p.value.kind==="approved"){f={kind:"approved",result:p.value};let h=br(u);m=`${p.value.id}${h.v0?Rn:""}`,p.value.id!==h.id&&i.set(h.id,p.value.id),s.set(p.value.id,Math.max(p.value.version,s.get(p.value.id)??0))}else p.value.kind==="pending"?f={kind:"pending",result:p.value}:p.value.kind==="refused"?f={kind:"refused",gate:p.value.gate}:f={kind:"failed",problems:[{code:"approve-set-pending",message:`${u} is already approved, with its number pending.`}]};o.set(c.id,f),a.push({member:c,finalId:m,outcome:f})}return T(a)}function B_e(e,t,r){let i=br(t);if(i.v0)return T(void 0);let n=K(e.tree.root).artifacts.get(i.id),o=n?.parent,s=o?r.get(o.id):void 0;if(!n||!o||s===void 0||o.version===void 0||o.version>=s)return T(void 0);let a=e.writer.writeFile(n.path,Gt(sr(n.document,{parent:`${o.id}@v${s}`})));return a.ok?T(void 0):a}var K_e="Nothing was approved: this spec tree is Spec-driven, so it has no approvals. A change's files stay editable while it is open, and finishing it with {{bk:done}} archives it as the record of the work, giving each capability spec it touches its next version. To have approvals (drafts reviewed and approved stage by stage, with gates), move the tree to Full SDLC with {{bk:onboard}}: it converts the capability specs and archived changes into the team's process. The move is one way.",zH=Zt({name:"approve",title:"Approve an artifact",description:"Approve one version of one artifact (id, such as US-draft-k3x9, US-001 or US-001-TP), or a set of them in one review (ids, such as everything a capture drafted). For version 0, the description of code as it was before BuildKeel, add @v0 (US-005@v0); an artifact whose only draft is its version 0 can be named without it. Approval is the user's decision: call it first without apply to run the approve gate and get what approval will do, show that to the user, and call again with the same id or ids and apply=true only after the user confirms. On apply it freezes the version, records the approval, gives a draft its permanent number, rewrites references to the draft ID, and commits exactly those files in the spec repo. A set is approved in order, parents and their documents before children, each through its own gate with its own record and commit; when one is refused, what needs it stays a draft.",inputSchema:{id:$.string().optional().describe("The artifact to approve: a draft ID, a permanent ID, or a document's ID such as US-001-TP or EP-01-DD; with @v0 for its version 0."),ids:$.array($.string()).optional().describe("A set to approve in one review, in any order: such as the drafts a capture made."),apply:$.boolean().default(!1).describe("false: only check and describe. true: approve."),onboard:$.boolean().optional().describe("true when approving an area's drafts in the onboard command, documenting existing code area by area.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);if(B(r.value.tree.root).mode==="spec-driven"&&!Ks(r.value.tree.root))return K_e;let{resolved:i}=r.value,n={tree:r.value.tree,writer:e.writer(r.value),code:{codeRoot:i.codeRoot,repo:i.pointer.repo,home:e.home,host:e.host}},o=Xs(r.value.tree.root),s=o?.startsWith("bk/")?o:null,a=t.ids??(t.id?[t.id]:[]);if(a.length===0)return"Give the id of the artifact to approve, or ids for a set.";if(t.ids&&t.ids.length>1){if(!t.apply){let f=await OH(n,a);if(!f.ok)return D("The set cannot be approved.",f.problems);for(let m of f.value)m.waitsFor||e.gateUsage(r.value,m.gate,m.member.id,!1);return[G_e(f.value,m=>Cn(r.value.tree,m),s),...fa(_e(r.value.resolved.codeRoot),{suspects:!1,unpushed:!1})].join(`
455
+ `)}let p=await NH(n,a);if(!p.ok)return D("The set cannot be approved.",p.problems);for(let f of p.value)jH(e,r.value,f.member.record.type,f.member.id,f.outcome.kind==="waiting"||f.outcome.kind==="failed"?null:f.outcome.kind==="refused"?{kind:"refused",gate:f.outcome.gate}:f.outcome.result,t.onboard);return e.flushWrites(),[H_e(p.value,r.value,e,s),...fa(_e(r.value.resolved.codeRoot),{unpushed:!1})].join(`
456
+ `)}let c=a[0],l=K(r.value.tree.root).artifacts.get(br(c).id)?.type??"",u=await ca(n,{id:c,apply:t.apply});if(!u.ok)return D(`${c} cannot be approved.`,u.problems);jH(e,r.value,l,c,u.value,t.onboard),t.apply&&e.flushWrites();let d=fa(_e(r.value.resolved.codeRoot),t.apply?{unpushed:!1}:{suspects:!1,unpushed:!1});return[J_e(u.value,s),...d].join(`
457
+ `)}});function jH(e,t,r,i,n,o){n&&(n.kind==="refused"||n.kind==="preview"?e.gateUsage(t,n.gate,i,!1):n.kind==="approved"?(e.gateUsage(t,n.gate,n.id,!0),e.usage(t,{event:"approve",artifact:n.id,type:r,version:n.version}),n.version===0&&e.usage(t,{event:"onboard",artifact:n.id,type:r,way:o?"area":"work"})):n.kind==="pending"&&(e.gateUsage(t,n.gate,n.draftId,!0),e.usage(t,{event:"approve",artifact:n.draftId,type:r,version:n.version})))}var W_e=(e,t,r)=>`${e} ${t}${r?` "${r}"`:""}`,$g=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function G_e(e,t,r){let i=e.filter(a=>a.gate.outcome!=="blocked"&&!a.waitsFor),n=e.filter(a=>a.gate.outcome==="blocked"&&!a.waitsFor),o=[];o.push(i.length===e.length?`Ready to approve all ${e.length} in one review, parents and their documents first, each with its own approval record and commit.`:`Ready to approve ${i.length} of ${e.length} in one review, each with its own approval record and commit. ${$g(n.map(a=>a.member.id))} would not pass, so ${n.length===1?"it stays a draft":"they stay drafts"}, with what needs ${n.length===1?"it":"them"}.`);let s=new Map(e.flatMap(a=>a.preview.kind==="preview"&&a.preview.likelyId?[[br(a.member.id).id,a.preview.likelyId]]:[]));o.push("","In order:");for(let[a,c]of e.entries()){let{member:l,preview:u}=c,d=`${a+1}. ${W_e(l.id,t(l.record.type),l.record.title)}`;if(c.waitsFor){o.push(`${d}: stays a draft, because ${c.waitsFor} would not pass.`);continue}if(c.gate.outcome==="blocked"){o.push(`${d}: would not pass.`);for(let g of c.gate.blocking)o.push(` - ${g.message}`,...g.remedy?[` To fix: ${g.remedy}`]:[]);continue}if(u.kind!=="preview")continue;let p=l.record.owner,f=br(l.id).id,m=u.likelyId??(f!==l.id||!s.has(f)?void 0:s.get(f))??(p&&s.has(p)?`${s.get(p)}${f.slice(p.length)}`:void 0),h=u.version===0?"as v0, describing the code as it was before BuildKeel":`as v${u.version}`;o.push(`${d} ${h}${m?`: becomes ${m}${u.likelyId?" unless someone else approves one first":""}`:""}`),u.version0&&u.version0.empty.length>0&&o.push(` - Left empty: ${u.version0.empty.join(", ")}`);for(let g of c.gate.warnings)o.push(` - Warning: ${g.message}`)}return r&&o.push("",`These approvals are committed on ${r}, a unit's branch: units started from another branch, such as your main branch, will not see them until ${r} is merged into it.`),o.push("","Nothing has been written yet. Show this to the user, and call approve again with the same ids and apply=true only if they confirm."),o.join(`
458
+ `)}function H_e(e,t,r,i){let n=e.filter(f=>f.outcome.kind==="approved"),o=e.filter(f=>f.outcome.kind==="refused"||f.outcome.kind==="failed"),s=e.filter(f=>f.outcome.kind==="pending"),a=e.filter(f=>f.outcome.kind==="waiting"),c=[],l=[n.length===e.length?`Approved all ${e.length} in one review: ${$g(n.map(f=>f.finalId))}.`:`Approved ${n.length} of ${e.length}${n.length>0?`: ${$g(n.map(f=>f.finalId))}`:""}.`];for(let f of o){let m=f.outcome.kind==="refused"?f.outcome.gate.blocking[0]?.message:f.outcome.kind==="failed"?f.outcome.problems[0]?.message:"",h=a.filter(g=>g.outcome.kind==="waiting"&&g.outcome.on===f.finalId).map(g=>g.finalId);l.push(`${f.finalId} stays a draft: ${(m??"it was refused").replace(/\.$/,"")}${h.length>0?`; ${$g(h)} ${h.length===1?"waits":"wait"} for it`:""}.`)}s.length>0&&l.push(`${$g(s.map(f=>f.finalId))} ${s.length===1?"is":"are"} approved with the number pending, so what is under ${s.length===1?"it waits":"them waits"}.`),c.push(l.join(" "));let u=K(t.tree.root),d=new Set(n.flatMap(f=>{let m=u.artifacts.get(f.finalId);return m?[m.id,...cg(u,m).map(h=>h.id)]:[]})),p=ma(t,r.home).ready.filter(f=>d.has(/^- (\S+) /.exec(f)?.[1]??""));c.push(p.length>0?"Ready to start now:":"Nothing in it can start yet; {{bk:start}} lists what is waiting and why.",...p),c.push("","Each approval, in order:");for(let f of e){let m=f.outcome;if(m.kind==="approved"){let h=m.result,g=h.commit.ok?`committed as "approve: ${h.id} v${h.version}" (${rp(h.commit.value)})`:`written but not committed: ${h.commit.problems[0]?.message??""}`;c.push(`- ${h.id} v${h.version}${br(f.member.id).id!==h.id?` (was ${br(f.member.id).id})`:""}: ${g}.${h.onboardedWork?` ${BO(h.onboardedWork)}`:""}`),h.recordedPlan&&c.push(DH(h.recordedPlan))}else if(m.kind==="pending")c.push(`- ${m.result.draftId} v${m.result.version}: approved, number pending: ${m.result.reason.map(h=>h.message).join(" ")}`);else if(m.kind==="refused"){c.push(`- ${f.finalId}: refused by the approve gate.`);for(let h of m.gate.blocking)c.push(` - ${h.message}`,...h.remedy?[` To fix: ${h.remedy}`]:[])}else m.kind==="failed"?c.push(`- ${f.finalId}: not approved: ${m.problems.map(h=>h.message).join(" ")}`):c.push(`- ${f.finalId}: not approved, because ${m.on} was not.`)}if(n.length>0){let f=tk(t.tree.root);t.tree.config.settings.autoPush?c.push("","Pushed after each approval, as the spec tree is set to."):f===null?c.push("","Not pushed: the spec repo has no remote. Add one and push it when you are ready to share the approvals."):f>0&&c.push("",`Not pushed: the spec repo has ${f} approval${f===1?"":"s"} not yet pushed. Push it when you are ready to share ${f===1?"it":"them"}.`)}return i&&n.length>0&&c.push(`These approvals are committed on ${i}, a unit's branch: units started from another branch, such as your main branch, will not see them until ${i} is merged into it.`),c.join(`
459
+ `)}var rp=e=>e.slice(0,7);function aj(e){let t=[];for(let i of e.assigned)t.push(i.commit.ok?`${i.from}, approved earlier with its number pending, is now ${i.to}; committed as "approve: ${i.to} v${i.version}" (${rp(i.commit.value)}).`:`${i.from}, approved earlier with its number pending, is now ${i.to}, but the commit failed: ${i.commit.problems[0]?.message??""}`);let r=e.problems.filter(i=>!i.code.startsWith("counter-"));return r.length>0&&t.push(D("Some pending approvals could not be numbered:",r)),t}function J_e(e,t=null){let r=[],i=t?`This approval is committed on ${t}, a unit's branch: units started from another branch, such as your main branch, will not see it until ${t} is merged into it.`:null,n=o=>o.outcome==="warned"?["",nn(o,"approval")]:[];switch(e.kind){case"refused":return[nn(e.gate,`approval of ${e.id}`),"","Nothing was written."].join(`
460
+ `);case"preview":{let o=`${e.name} ${e.id}${e.title?` "${e.title}"`:""}`,s=e.version0;return r.push(s?`Ready to approve version 0 of ${o}: it describes the code as it was before BuildKeel, so it is held to no template; a person reads it before it is approved. Approving will:`:`Ready to approve ${o} as v${e.version}. Approving will:`),e.likelyId&&(r.push(`- give it its permanent number: the next ${s?`onboarded ${e.name}`:e.name} number, ${e.likelyId} unless someone else approves one first; its directory becomes ${e.dirTo}/`),e.references.length>0&&r.push(`- rewrite references to ${e.id} in: ${e.references.join(", ")}`)),e.parent&&r.push(`- record it against its parent ${e.parent}`),s?(r.push(`- freeze v0 and record the approval by ${e.approver}, ${s.sources.length===0?"with no sources kept beside it":`with its ${s.sources.length===1?"source":`${s.sources.length} sources`} frozen with it: ${s.sources.join(", ")}`}`),s.empty.length>0&&r.push(`- record what it leaves empty, for a later version to fill in: ${s.empty.join(", ")}`),e.inForce>0&&r.push(`- leave v${e.inForce} in force: version 0 goes before it in the history, and nothing becomes suspect`)):r.push(`- freeze v${e.version} and record the approval by ${e.approver}`),r.push(`- commit only those files in the spec repo as "approve: ${e.likelyId??e.id} v${e.version}"${e.autoPush?", then push it":", without pushing"}`),t&&r.push("",`${i} To have it on your main branch straight away, switch to it before approving.`),r.push(...n(e.gate)),r.push("","Nothing has been written yet. Show this to the user, and call approve again with apply=true only if they confirm."),r.join(`
461
+ `)}case"approved":{r.push(...aj(e.pending)),r.length>0&&r.push("");let o=e.draftId?` (was ${e.draftId})`:"",s=e.version0;if(!s)r.push(`Approved ${e.id} v${e.version}${o}. It is locked now: a change opens v${e.version+1}, and v${e.version} stays in force until then.`);else{let a=e.inForce===0?e.nextOpen?"It is in force and locked; the draft of v1 that builds on it is waiting for approval.":"It is in force and locked now: a change opens v1.":`v${e.inForce} stays in force; version 0 comes before it in the history, and nothing became suspect.`;r.push(`Approved ${e.id} v0${o}: it describes the code as it was before BuildKeel. ${a}`)}if(r.push(`- Frozen copy: ${e.frozen}`),r.push(`- Approval record: ${e.approval}`),s&&s.sources.length>0&&r.push(`- Sources frozen with it: ${s.sources.join(", ")}`),s&&s.empty.length>0&&r.push(`- Left empty, for a later version to fill in: ${s.empty.join(", ")}`),e.onboardedWork){let a=e.onboardedWork;r.push(`- Done before BuildKeel: ${BO(a)}`),r.push(a.commit.ok?`- Completion record: ${a.records.map(c=>c.path).join(", ")}, committed as "done: ${e.id} v0 (onboarded)" (${rp(a.commit.value)}).`:`- Completion record: ${a.records.map(c=>c.path).join(", ")}, written but not committed: ${a.commit.problems[0]?.message??""}`)}e.references.length>0&&r.push(`- References to ${e.draftId} rewritten in: ${e.references.join(", ")}`),e.commit.ok?(r.push(`Committed as "approve: ${e.id} v${e.version}" (${rp(e.commit.value)}) in the spec repo, with only these files.`),e.push?r.push(e.push.ok?"Pushed.":`Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?r.push("Not pushed: the spec repo has no remote. Add one and push it when you are ready to share the approval."):e.unpushed>0&&r.push(`Not pushed: the spec repo has ${e.unpushed} approval${e.unpushed===1?"":"s"} not yet pushed. Push it when you are ready to share ${e.unpushed===1?"it":"them"}.`)):r.push(`The files are written but were not committed: ${e.commit.problems[0]?.message??""} Commit them in the spec repo yourself.`),e.recordedPlan&&r.push(DH(e.recordedPlan)),i&&r.push(i),r.push(...n(e.gate));for(let a of e.documents)r.push("",`${e.id}'s ${a.name} ${a.id} has a draft waiting for approval; it can be approved next.`);return r.join(`
462
+ `)}case"pending":{r.push(...aj(e.pending)),r.length>0&&r.push(""),r.push(`Approved ${e.draftId} v${e.version}, but its number is pending: ${e.reason.map(s=>s.message).join(" ")}`),r.push(`- Approval recorded in ${e.record}`),r.push(e.commit.ok?`- Committed as "approve: ${e.draftId} v${e.version} (number pending)" (${rp(e.commit.value)}).`:`- Not committed: ${e.commit.problems[0]?.message??""}`),i&&r.push(i),r.push("It gets its number the next time the counter can be reached: the next approval, or the next session. Until then it cannot be changed, and work cannot start on it.");let o=e.reason.map(s=>s.remedy).filter(Boolean);return o.length>0&&r.push(`To fix: ${o.join(" ")}`),r.push(...n(e.gate)),r.join(`
463
+ `)}case"assigned":{let o=aj(e.pending);return e.pending.assigned.length===0?[`The number is still pending: ${e.pending.problems.map(a=>a.message).join(" ")||"the number counter could not be reached."}`,...o].join(`
464
+ `):o.join(`
465
+ `)}}}function DH(e){let t=e.commit.ok?`committed as "record: ${e.id} v${e.version}" (${rp(e.commit.value)})`:`written but not committed: ${e.commit.problems[0]?.message??""}`;return`- Its own test plan, ${e.id}, is recorded as v${e.version}, with no approval: ${t}.`}var Y_e="onboarding";async function MH(e,t,r){if(!e.access.writable)return w(e.access.problem);let i=B(e.root);if(i.mode!=="spec-driven")return w({code:"version0-not-spec-driven",message:"Capability specs belong to Spec-driven trees; this spec tree follows Full SDLC."});if(!i.process.ok)return i.process;if(r.capabilities.length===0)return w({code:"version0-nothing",message:"Give at least one capability spec to save as version 0."});let n=lt(e.root);if(!n)return w({code:"version0-no-identity",message:"Git has no name and email set for the spec repo, so who confirmed version 0 cannot be recorded."});let o=[],s=[];for(let h of r.capabilities){let g=oe(h.content);if(!g.ok)return g;let y=typeof g.value.frontmatter.id=="string"?g.value.frontmatter.id.trim():"";if(!bc.safeParse(y).success){s.push({code:"version0-no-code",message:`A capability spec names its code in its frontmatter, such as id: AUTH: 1 to 8 capital letters or digits${y?`, not ${y}`:""}.`});continue}if(Un(e.root).some(_=>_.code===y)){s.push({code:"version0-exists",message:`${y} already has a version, so it describes the system already.`,remedy:`Change it with a spec change that modifies ${y}.`});continue}let v=g.value.frontmatter.title,b=g.value.frontmatter.area;o.push({code:y,...typeof v=="string"?{title:v}:{},...typeof b=="string"?{area:b}:{},text:h.content,sources:h.sources})}let a=o.map(h=>h.code).filter((h,g,y)=>y.indexOf(h)!==g);if(a.length>0&&s.push({code:"version0-twice",message:`${a[0]} is given twice.`}),s.length>0)return w(...s);let c=await Uk(e,i.process.value,{newChange:!1,changeId:Y_e,newCapabilities:o.map(h=>h.code),specChanges:o.map(h=>({capability:h.code,text:h.text}))},Ho(e.root));if(!c.ok)return c;if(c.value.refused.length>0)return w(...c.value.refused);let l=c.value.specChanges;for(let[h,g]of o.entries()){let y=oe(l[h]);y.ok&&s.push(...Eh(y.value,g.code,Lo(g.code,0)))}if(s.length>0)return w(...s);let u=(r.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),d=le(r.codeRoot,["rev-parse","--verify","--quiet","HEAD"]),p=[],f=[];for(let[h,g]of o.entries()){let y=l[h],v=Lo(g.code,0),b=t.createRecord(v,y);if(!b.ok)return b;let _=Object.fromEntries((g.sources??[]).map(x=>[x.source,Ft(x.content)])),k=t.createRecord(Ii(g.code,0),W_({capability:g.code,version:0,hash:Ft(y),confirmedBy:n,confirmedAt:u,...d?{baseline:{[r.repo]:d}}:{},...Object.keys(_).length>0?{sources:_}:{}}));if(!k.ok)return k;p.push(v,Ii(g.code,0)),f.push({code:g.code,...g.title?{title:g.title}:{},path:v,...g.area?{area:g.area}:{}})}let m=Me(e.root,p,`onboard: ${f.map(h=>`${h.code} v0`).join(", ")}`);return T({capabilities:f,assigned:c.value.assigned,commit:m})}var LH=Zt({name:"save_draft",title:"Save a draft",description:`In a Spec-driven tree: type change creates a change, with content its proposal and files its spec changes, design and tasks; with id, it edits that open change, as does type proposal, spec-change, design or tasks with the change's id. A spec change names its capability in its frontmatter (capability: AUTH), and one for a capability the tree does not have creates it. Write ${jr} for the change's ID and each new requirement or scenario as AUTH-R${ar} or AUTH-R3-S${ar}; BuildKeel numbers them. Nothing in a Spec-driven tree is approved, and capability specs change only when a change is finished, except that type capability with version 0 saves, once the user has confirmed it, a capability spec describing existing code no capability covers (id: its code, area: the onboarding area it documents, if any). Otherwise: create a new draft artifact, or update an existing draft (pass its id). content is the whole artifact file: frontmatter and sections, following the type's template, with guidance comments removed. Write ${jr} wherever the artifact's own ID goes (id: ${jr}). Write each new numbered entry with ${ar} as its number (**${jr}-AC${ar}**, ### ${jr}-TC${ar}); BuildKeel numbers them and never reuses a removed entry's number. Keep the IDs of entries that already have one. For a test plan, set parent to the artifact it tests, and give every test case a covers line: a story's plan covers its criteria (all of them), a task's plan covers the task's own ID or its story's criteria, an epic's plan covers stories under it or their criteria, a business idea's plan covers epics under it or its goals. Set parent to the parent's ID; BuildKeel pins it to the parent's approved version. A design document, or another document attached to an artifact, has parent set to that artifact and no id field (EP-01-DD is the design document of EP-01). When the content comes from a document, an issue tracker or the conversation, keep its meaning, put what fits no section in the section for further material (such as Notes), and leave out a required section the source does not cover rather than invent it: BuildKeel names what is missing, for you to ask the user. To change an approved artifact, pass its id with the whole changed file: that opens its next version as a draft, and the approved version stays in force. Saving never approves anything. type bug or adhoc creates a bug or an ad-hoc unit at once, with its permanent ID and its own commit in the spec repo: neither is drafted or approved, and it can be started straight away. A bug found in work on a task or story has that unit as parent and, when a test case found it, testCase set to that test case's ID; a bug with no known home has no parent. Pass the id of an existing bug or ad-hoc unit to change its file.`,inputSchema:{type:$.string().describe("The artifact type: idea, epic, story, task, test-plan, design, bug or adhoc, or a stage or document the team added; its name works too, such as design document."),id:$.string().optional().describe("To update an existing draft, bug or ad-hoc unit, its ID. Leave out to create a new one."),content:$.string().describe("The whole artifact file."),capture:$.boolean().optional().describe("true when the draft is part of a plan captured from the conversation (the capture command)."),files:$.array($.object({type:$.enum(no),content:$.string()})).optional().describe("In a Spec-driven tree, with type change: the change's other files, each with its type and whole content."),sources:$.array($.object({source:$.string().describe("Where it came from: Jira, Azure DevOps, Confluence, a file's name, or the user."),key:$.string().optional().describe("Its key there, such as PAY-12."),link:$.string().optional().describe("A link to it."),title:$.string().optional(),text:$.string().optional().describe("The text exactly as read, not summarized: for a tracker entry, its description, fields and comments. Attachments, images and history stay behind the link."),drop:$.boolean().optional().describe("true to remove a source kept earlier, named by the same source and key (or title).")})).optional().describe("With version 0 only: each source it is drafted from, kept beside it exactly as read, with when and by whom. A source saved again with the same source and key replaces the earlier copy. BuildKeel lists them in the draft's Sources section; they are frozen with version 0 when it is approved. Code is never copied: the baseline commit names it."),version:$.literal(0).optional().describe("0 to draft version 0: what describes code as it was before BuildKeel, from the code and the sources the user brings. It follows the template's form but is held to no template; leave a section the sources do not support empty. With id, it adds version 0 to an existing artifact, beside any draft of its next version.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i}=r.value,n=Ks(i.root);if(B(i.root).mode==="spec-driven"&&(!n||/^(changes?|proposals?|spec[- ]changes?)$/i.test(t.type.trim()))){if(t.version===0&&/^capabilit(y|ies)(-specs?)?$/.test(t.type.trim().toLowerCase().replace(/\s+/g,"-"))){let{resolved:C}=r.value,E=(t.sources??[]).filter(V=>!V.drop).map(V=>({source:V.key?`${V.source}:${V.key}`:V.source,content:V.text??V.link??""})),U=await MH(i,e.writer(r.value),{capabilities:[{content:t.content,sources:E}],codeRoot:C.codeRoot,repo:C.pointer.repo});return U.ok?tke(U.value):D("Version 0 was not saved.",U.problems)}let S=eke(t.type,t.content,t.files??[],t.id);if(S){if(!S.ok)return D("Nothing was saved.",S.problems);let C=await uW(i,e.writer(r.value),{...t.id?{id:t.id}:{},files:S.value});return C.ok?[rke(C.value),...C.value.created?Jo(e,r.value,"drafted"):[]].join(`
466
+ `):D("Nothing was saved.",C.problems)}}let o=ig(i,t.type);if(!t.id&&t.version!==0&&(o==="bug"||o==="adhoc")){let S=await gk({tree:i,writer:e.writer(r.value)},{type:o,content:t.content});return S.ok?(e.usage(r.value,{event:o==="bug"?"bug":"adhoc",unit:S.value.id}),oke(S.value)):D(`The ${o==="bug"?"bug":"ad-hoc unit"} was not created.`,S.problems)}let s=cW(i,e.writer(r.value),{type:t.type,content:t.content,...t.id?{id:t.id}:{},...t.version===0?{version:0}:{},...t.sources?{sources:t.sources.map(nke)}:{}});if(!s.ok)return D("The draft was not saved.",s.problems);let{id:a,path:c,created:l,notes:u,nextVersion:d,opened:p}=s.value;if(l&&e.usage(r.value,{event:"draft",artifact:a,type:s.value.type,...t.capture?{capture:!0}:{}}),s.value.empty)return ike(s.value,Re(r.value.tree.root).one(s.value.type));let f=s.value.type==="bug"||s.value.type==="adhoc",m=s.value.type==="bug"&&t.id?CH(i,e.writer(r.value),a):null,h=m?.ok&&m.value?[`${a} was suspect: saving it records that it needed change, and moves it to ${m.value.against}${m.value.commit.ok?`, committed as "repin: ${a} to ${m.value.against} (needs change)" (${dS(m.value.commit.value)})`:""}. It is no longer suspect.`]:[],g=u.find(S=>S.code==="draft-parent-draft"),y=u.filter(S=>S.code==="draft-completes-dropped"),v=u.filter(S=>S!==g&&!y.includes(S)),b=g?`, once its parent ${/^The parent (\S+)/.exec(g.message)?.[1]??""} is approved`:"",_=v.length===0?f?" It follows its template.":` It follows its template and has everything it needs for approval${b}.`:"",k=d===void 0?[f?`Updated ${a} at ${c}.${_}`:`${l?"Created":"Updated"} draft ${a} (${Re(r.value.tree.root).one(s.value.type)}) at ${c}.${_}`]:p?[`Saved ${a} v${d} as a draft at ${c}. v${d-1} stays approved and in force until v${d} is approved.${_}`]:[`Saved ${a} at ${c}, but it matches the ${X_e(r.value,a)} v${d-1}, so no new version is open.`],x=v.length===0&&!g&&(l||p||d===void 0)?await Q_e(e,r.value,a):null;if(x)return[x,...s.value.assigned.length>0?[`New entries numbered: ${s.value.assigned.join(", ")}.`]:[]].join(`
467
+ `);if(v.length>0&&(k[0]=`${k[0]} It is saved; ${v.length===1?"one thing stands":`${v.length} things stand`} in the way of approval, listed below.`),s.value.assigned.length>0&&k.push(`New entries numbered: ${s.value.assigned.join(", ")}.`),k.push(...y.map(S=>S.message)),v.length>0){k.push("",D(f?"Still missing:":"Before it can be approved:",u.filter(C=>!y.includes(C))));let S=u.filter(C=>["section-missing","section-empty","field-missing"].includes(C.code));S.length>0&&k.push("",`Ask the user for ${S.length===1?"what is missing":"each missing part, one at a time"}, unless it is in what they gave you; never invent it.`)}return k.push(...h),k.join(`
468
+ `)}}),dS=e=>e.slice(0,7);function X_e(e,t){let r=K(e.tree.root).artifacts.get(t);return r&&se(e.tree.root,r).recorded?"recorded":"approved"}async function Q_e(e,t,r){let{tree:i,resolved:n}=t,o=hr(i),s=K(i.root),a=s.artifacts.get(r);if(!o.ok||!a||!la(o.value,s,a))return null;let c={tree:i,writer:e.writer(t),code:{codeRoot:n.codeRoot,repo:n.pointer.repo,home:e.home,host:e.host}},l=await ca(c,{id:r,apply:!0,recorded:!0});if(!l.ok||l.value.kind!=="approved")return null;e.flushWrites();let{version:u,commit:d}=l.value,p=d.ok?`committed as "record: ${r} v${u}" (${dS(d.value)})`:`written but not committed: ${d.problems[0]?.message??""}`;return`Recorded ${r} v${u}: a task's own test plan needs no approval, so this save is its version ${u}, frozen and ${p}. The task's tests run against it.`}function eke(e,t,r,i){let n=e.trim().toLowerCase().replace(/\s+/g,"-");if(/^capabilit(y|ies)(-specs?)?$/.test(n))return w({code:"capability-not-saved",message:"Capability specs are never edited directly: they change when a change that alters them is finished.",remedy:"Write a spec change for the capability, in a new change or an open one."});if(n==="change")return T([{type:"proposal",content:t},...r]);let o=no.find(s=>s===n||`${s}s`===n||s==="tasks"&&n==="task-list");return o?!i&&o!=="proposal"?w({code:"change-id-missing",message:`Give the id of the change this ${o.replace("-"," ")} belongs to, or save a new change with type change.`}):T([{type:o,content:t},...r]):null}function tke(e){let[t]=e.capabilities;if(!t)return"Nothing was saved.";let r=[`Saved ${t.code}${t.title?` "${t.title}"`:""} version 0 at ${t.path}: it describes the code as it is, as the user confirmed${t.area?`, for the ${t.area} area`:""}. It is never edited: later changes give it new versions.`];return e.assigned.length>0&&r.push(`IDs given: ${e.assigned.join(", ")}.`),r.push(e.commit.ok?`Committed as "onboard: ${t.code} v0" (${dS(e.commit.value)}) in the spec repo.`:`Written but not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),r.join(`
469
+ `)}function rke(e){let t=`changes/${e.id}/`,r=e.written.map(n=>n.path.slice(t.length)),i=[`${e.created?"Created":"Updated"} change ${e.id} at ${t}: ${r.join(", ")||"nothing written"}. It stays open and editable; nothing in it is approved.`];if(e.assigned.length>0&&i.push(`IDs given: ${e.assigned.join(", ")}.`),e.offline.length>0&&i.push(`- The number counter could not be reached (${e.offline[0]?.message??"no reason given"}), so these IDs have random suffixes instead of numbers. They are permanent.`),e.refused.length>0&&i.push("",D("Not created:",e.refused)),e.notes.length>0){i.push("",D("Worth fixing (nothing is blocked):",e.notes));let n=e.notes.filter(o=>/section-(missing|empty)|field-missing/.test(o.code));n.length>0&&i.push("",`Ask the user for ${n.length===1?"what is missing":"each missing part, one at a time"}, unless it is in what they gave you; never invent it.`)}return e.created&&i.push("",`Start it with {{bk:start}} ${e.id}.`),i.join(`
470
+ `)}function nke({source:e,key:t,link:r,title:i,text:n,drop:o}){return{source:e,...t?{key:t}:{},...r?{link:r}:{},...i?{title:i}:{},...n!==void 0?{text:n}:{},...o?{drop:o}:{}}}function ike(e,t){let{id:r,path:i,created:n,notes:o,empty:s=[],sources:a}=e,c=[`${n?"Created":"Updated"} the draft of version 0 of ${r} (${t}) at ${i}: it describes the code as it was before BuildKeel, and is held to no template.`+(s.length===0?" Every section the template asks for has content.":` Left empty: ${s.join(", ")}. That does not stop its approval; a later version can fill ${s.length===1?"it":"them"} in.`)];if(a&&a.kept.length>0){let d=[...a.written.map(p=>`kept ${p}`),...a.dropped.map(p=>`dropped ${p}`)];c.push(`Sources kept beside it, as read: ${a.kept.map(p=>p.file).join(", ")}${d.length>0?` (${d.join("; ")})`:""}. They are listed in its Sources section, and frozen with it when it is approved.`)}else a&&a.dropped.length>0&&c.push(`Dropped ${a.dropped.join(", ")}; no sources are kept beside it now.`);let l=o.find(d=>d.code==="draft-parent-draft");l&&c.push(l.message);let u=o.filter(d=>d!==l);return u.length>0&&c.push("",D("Worth knowing:",u)),c.push("",`It is approved as ${r}@v0, after a person has read it.`),c.join(`
471
+ `)}function oke(e){let t=e.attachment.parent?`, attached to ${Yt(e.attachment.parent)}${e.attachment.testCase?`, where ${e.attachment.testCase} found it`:""}`:e.type==="bug"?", standalone":"",r=[`Created ${e.name} ${e.id}${e.title?` "${e.title}"`:""} at ${e.path}${t}.`];return e.numbered||r.push(`- The number counter could not be reached (${e.offline[0]?.message??"no reason given"}), so ${e.id} has an ID that needs no counter. It is permanent: commits are stamped with it.`),e.commit.ok?(r.push(`- Committed alone as "new: ${e.id}" (${dS(e.commit.value)}) in the spec repo.`),e.push?r.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):r.push("- Not pushed: push the spec repo to share it.")):r.push(`- Written but not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),e.type==="bug"&&r.push(`- Finishing it needs a regression test with [${e.id}] in its name, passing.`),e.notes.length>0&&r.push("",D("Still missing (fix it with save_draft and its id):",e.notes)),r.push("",`Start it with {{bk:start}} ${e.id}.`),r.join(`
472
+ `)}var UH=Zt({name:"start_work",title:"Start work on a unit",description:"Start work on a task, a story built without tasks, a bug or an ad-hoc unit, in this working tree. Runs the start gate (the unit and its ancestors approved, permanently numbered, the documents the process requires approved, a test plan with no gaps, not being worked on in another working tree), then switches to the unit's branch bk/<ID>-<slug>, claims the unit on this machine, makes it the active unit and returns its context. Refuses while the working tree has uncommitted changes, listing them; it never commits or discards anything itself. With stack=true, as in a build run or for the next unit after finishing one, a new branch starts from the branch checked out, the branch of the unit just finished, so the unit has that work before it is merged. In a Spec-driven tree it starts an open change, a bug or an ad-hoc unit, with no gate.",inputSchema:{id:$.string().describe("The unit to start, such as TK-001, or a change such as CH-012."),stack:$.boolean().default(!1).describe("true in a build run, or for the next unit offered after finishing one: branch from the branch of the unit just finished instead of the default branch."),run:$.boolean().default(!1).describe("true for every unit a build run starts, the first included. It only marks the start in the user's own usage record.")},readOnly:!1,run(e,t){let r=e.workspace();if(!r.ok)return D("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value,o=S9({tree:i,codeRoot:n.codeRoot,home:e.home,host:e.host,unitId:t.id,stack:t.stack});if(!o.ok)return D(`${t.id} cannot be started.`,o.problems);let s=o.value;if(s.kind==="refused"&&e.gateUsage(r.value,s.gate,s.unitId,!1),s.kind==="refused")return[nn(s.gate,`start of ${s.unitId}`),"","Nothing was changed."].join(`
473
+ `);if(s.kind==="uncommitted"){let u=s.files.filter(f=>Qh(n.codeRoot,i.root,f)),d=s.files.filter(f=>!u.includes(f)),p=[`${s.unitId} was not started: the working tree has uncommitted changes, and every change must belong to exactly one unit.`,...s.files.map(f=>`- ${f}`),""];if(u.length>0){let f=u.length===1;p.push(`${u.join(", ")} ${f?"sets":"set"} BuildKeel up rather than being anyone's work: with the user's agreement, commit ${f?"it":"them"} on ${f?"its":"their"} own, as setting BuildKeel up, with no BuildKeel-Unit line${d.length===0?", then start again":""}.`)}return d.length>0&&p.push(s.activeUnit?`The active unit is ${s.activeUnit}. Commit ${u.length>0?"the other":"these"} changes to it (ending the message with "BuildKeel-Unit: ${s.activeUnit}"), or set them aside with git stash if the user confirms they should not be kept with it; then start again.`:`There is no active unit. Ask the user which unit ${u.length>0?"the other":"these"} changes belong to and commit them with that unit's BuildKeel-Unit line, or set them aside with git stash if the user confirms; then start again.`),p.push("Nothing was changed."),p.join(`
474
+ `)}s.gate.outcome!=="skipped"&&e.gateUsage(r.value,s.gate,s.unit.id,!0),e.usage(r.value,{event:"start",unit:s.unit.id,type:s.unit.type,...s.branch.kind==="created"&&s.branch.stacked?{stacked:!0}:{},...t.run?{run:!0}:{}}),s.unit.type==="change"&&e.usage(r.value,{event:"change",unit:s.unit.id,action:"started"});let a=e.refreshHookCache(r.value),c=Yd(i,a,s.unit.id,{active:!0,code:e.unitCode(r.value,a,s.unit.id)}),l=[`Started ${s.unit.id}${s.unit.title?` "${s.unit.title}"`:""} in ${n.codeRoot}: it is the active unit here, so the changes and commits made now belong to it.`];return l.push(`- ${ske(s.branch)}`),l.push(`- Claimed on this machine: other working trees cannot start ${s.unit.id} until it is finished or released.`),s.previous&&s.previous!==s.unit.id&&l.push(`- ${s.previous} is no longer the active unit here; its claim stays until it is finished.`),s.gate.outcome==="warned"&&l.push("",nn(s.gate,"the start")),l.push(...fa(_e(n.codeRoot),{behind:!1})),l.push("",c.ok?c.value.trimEnd():D("The context could not be built.",c.problems)),s.unit.type==="change"&&l.push(...Jo(e,r.value,"started")),l.join(`
475
+ `)}});function ske(e){if(e.kind==="kept")return`Already on its branch ${e.branch}.`;if(e.kind==="switched")return`Switched to its branch ${e.branch}.`;let t=e.carried?.length?` ${e.base} does not have the unit's record yet, so its branch brings along ${e.carried.map(i=>`"${i}"`).join(", ")}; it changes only the unit's own file, and merges cleanly with the branch it came from.`:"",r=e.stacked?` It is stacked on ${e.base}, so it has that unit's work before it is merged; merge the branches in order, or review the run in one pull request from the last branch.`:"";return`Created its branch ${e.branch} from ${e.base}.${r}${t}${e.baseNote?` ${e.baseNote}`:""}`}var FH=Zt({name:"validate",title:"Validate the spec tree",description:"Check the whole BuildKeel spec tree: the process definition and the organization template source, every artifact against its template, links between artifacts and the stage of each parent, duplicate IDs and numbers, and every approved version against the hash in its approval record (which shows files changed after approval, for example in another editor), and every existing test matched to a test case against the latest test report read here. Also lists approved artifacts that do not meet a template or process changed since (they stay approved), what the tree overrides from its organization's templates, and warnings about what its own setup gives up. Changes nothing.",inputSchema:{},readOnly:!0,run(e){let t=e.workspace();if(!t.ok)return D("BuildKeel cannot read a spec tree here.",t.problems);let r=pH(t.value.tree),i=qk(t.value.tree.root,r.index,t.value.resolved.codeRoot),n=[...t.value.notices,...r.problems,...i],o=`${r.versionsChecked} approved version${r.versionsChecked===1?"":"s"}`,s=r.capabilities,a=B(t.value.tree.root).conversion!==null,c=[s&&a?`Checked ${np(s.count,"capability spec")} and ${r.index.artifacts.size} artifacts in ${t.value.tree.root}, and ${np(s.versionsChecked,"capability version")} and ${o} against their recorded hashes.`:s?`Checked ${np(s.count,"capability spec")}, ${np(qH(r.index,"bug"),"bug")} and ${np(qH(r.index,"adhoc"),"ad-hoc unit")} in ${t.value.tree.root}, and ${np(s.versionsChecked,"capability version")} against their recorded hashes.`:`Checked ${r.index.artifacts.size} artifacts in ${t.value.tree.root}, and ${o} against their recorded hashes.`];c.push(...n.length===0?["No problems found."]:["",D(`Found ${n.length} problem${n.length===1?"":"s"}:`,n)]);for(let l of r.warnings)c.push("",D("Warning:",[l]));if(r.earlier.length>0){let l=r.earlier.length;c.push("",D(`Approved under earlier rules (${l}): ${l===1?"it stays":"they stay"} approved, and each is checked against the current template and process at its next version.`,r.earlier))}if(r.overrides){let{label:l,lines:u}=r.overrides,d=`Templates and process come from the organization's templates ${l}.`;c.push("",...u.length>0?[`${d} Overridden locally:`,...u]:[`${d} Nothing is overridden locally.`])}return c.join(`
476
+ `)}}),np=(e,t)=>`${e} ${t}${e===1?"":"s"}`,qH=(e,t)=>[...e.artifacts.values()].filter(r=>r.type===t).length;var cj=[JW,IH,YW,LH,FH,zH,UH,ZW,EW,MG,iG,AH],ZH=15,ake=$.string().optional().describe("The absolute path of the project folder this call is for: the repository with .buildkeel.yaml, or the one being set up. Always pass it; one BuildKeel server can serve several projects.");function VH(e){if(cj.length>ZH)throw new Error(`BuildKeel exposes ${cj.length} tools; the limit is ${ZH}.`);let t=new Aw({name:"buildkeel",version:JZ()});for(let r of cj)t.registerTool(r.name,{title:r.title,description:r.description,inputSchema:{...r.inputSchema,workspace:ake},annotations:{readOnlyHint:r.readOnly,openWorldHint:!1}},async({workspace:i,...n})=>{let o=await e.forCall(typeof i=="string"?i:void 0);if(!o.ok)return{isError:!0,content:[{type:"text",text:kT(D("BuildKeel cannot tell which project this call is for.",o.problems),e.host)}]};try{let s=await r.run(o.value,n);return o.value.flushWrites(),{content:[{type:"text",text:kT(s,e.host)}]}}catch(s){try{o.value.flushWrites()}catch{}return{isError:!0,content:[{type:"text",text:`BuildKeel failed: ${s instanceof Error?s.message:String(s)}`}]}}});return t}import{rmSync as kke,statSync as Ske}from"node:fs";import{isAbsolute as xke}from"node:path";import{existsSync as cke}from"node:fs";import{join as BH,resolve as lke}from"node:path";var uke=$.object({specs:$.string().min(1),remote:$.string().min(1).optional(),repo:$.string().min(1)});function KH(e,t=Bs()){let r=Bh(e);if(!r)return w({code:"pointer-missing",message:`This repo is not set up for BuildKeel: no ${cr} was found.`,remedy:`Run ${ee("init")} to create a spec tree or point this repo at an existing one.`});let i=Gu(BH(r,cr),cr,uke,"pointer");if(!i.ok)return i;let n=L_(t);if(!n.ok)return n;let o=i.value.remote?n.value.specs[i.value.remote]:void 0,s=o??lke(r,i.value.specs);if(!cke(BH(s,Xe))){let a=o?`the local override in ~/.buildkeel/paths.yaml (${s})`:s,c=[...i.value.remote?[`clone ${i.value.remote} to ${s}`]:[],`correct "specs" in ${cr}`,"set where the spec repo is checked out on this machine in ~/.buildkeel/paths.yaml"];return w({code:"spec-tree-not-found",path:cr,message:`${cr} points to a spec tree at ${a}, but there is no ${Xe} there.`,remedy:`Either ${c.join(", or ")}.`})}return T({codeRoot:r,pointer:i.value,specRoot:s,overridden:o!==void 0})}import{spawn as dke}from"node:child_process";var pke=1e4,fke=10,mke=(e,t,r)=>new Promise(i=>{let n="",o=dke(e,t,{cwd:r,env:{...process.env,GH_PROMPT_DISABLED:"1",GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","pipe","ignore"]}),s=setTimeout(()=>o.kill(),pke);o.stdout?.on("data",a=>n+=a.toString("utf8")),o.on("error",a=>{clearTimeout(s),i(a.code==="ENOENT"?null:{code:-1,stdout:n})}),o.on("close",a=>{clearTimeout(s),i({code:a??-1,stdout:n})})}),hke=/^(?:https?:\/\/(?:[^@/]+@)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])([^/\s]+\/[^/\s]+?)(?:\.git)?\/?$/i;function gke(e=mke){return{repository:t=>hke.exec(t.trim())?.[1]??null,async find(t,r,i){let n=new Map;for(let o of i.slice(0,fke)){let s=await e("gh",["api",`repos/${t}/commits/${o}/pulls`],r);if(s===null)return null;if(s.code===0)for(let a of yke(s.stdout))n.set(a.number,a)}return[...n.values()].sort((o,s)=>o.number-s.number)}}}function yke(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(r=>typeof r.number=="number"&&typeof r.title=="string"?[{number:r.number,title:r.title,state:r.merged_at?"merged":String(r.state??"open"),url:String(r.html_url??"")}]:[]):[]}catch{return[]}}var pS=[gke()];async function vke(e,t,r,i=pS){if(!e||r.length===0)return[];for(let n of i){let o=n.repository(e);if(o)return await n.find(o,t,r)??[]}return[]}async function WH(e,t,r=pS){for(let i of e.repos){let n=t.repos.find(s=>s.name===i.repo)?.dir;if(!n)continue;let o=await vke(le(n,["remote","get-url","origin"]),n,i.commits.map(s=>s.id),r);o.length>0&&(i.pullRequests=o)}return e}var GH=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")+1):e;function HH(e,t,r,i,n){let o=t.artifacts.get(n);if(!o)return[];let s=new Set,a=(ve(e,o)??o).document.frontmatter.scope;for(let d of Array.isArray(a)?a:[])typeof d=="string"&&d.trim()!==""&&s.add(co(d));let c=ag(t,o);if(c&&c!==o)for(let d of Zh(e,c,i)?.paths??[])s.add(d);let l=new Map([o,...c?[c,...cg(t,c)]:[]].map(d=>[d.id,d])),u=r.repos.find(d=>d.name===i);for(let d of l.values()){for(let p of u?.units.get(d.id)??[])for(let f of p.files)s.add(GH(f));for(let{record:p}of Ti(e,d).completions)if(p.repo===i)for(let f of p.files)s.add(GH(f))}return[...s].sort()}function JH(e,t=Xd,r={}){let i=ro(e);if(!i.ok)return i;r.home&&lB(e,i.value,r.home);let n=tS(i.value.format,t);return T({root:e,config:i.value,access:n},n.writable?[]:[n.problem])}import{existsSync as $ke,linkSync as bke,mkdirSync as YH,renameSync as wke,rmSync as lj,writeFileSync as _ke}from"node:fs";import{dirname as XH,isAbsolute as QH,relative as bg,resolve as wg,sep as fS}from"node:path";var mS=class{constructor(t){this.tree=t}tree;listeners=[];onWrite(t){this.listeners.push(t)}writeFile(t,r){return this.write(t,r,"replace")}createRecord(t,r){return this.write(t,r,"create")}remove(t){let r=this.refusal(t);if(r)return w(r);let i=wg(this.tree.root,t),n=bg(this.tree.root,i).split(fS).join("/");try{lj(i,{force:!0})}catch(o){return w({code:"write-failed",path:n,message:`Could not remove ${n}: ${o.message}`})}for(let o of this.listeners)o([n]);return T(n)}move(t,r){let i=this.refusal(t)??this.refusal(r);if(i)return w(i);let n=wg(this.tree.root,t),o=wg(this.tree.root,r),s=bg(this.tree.root,o).split(fS).join("/");if($ke(o))return w({code:"move-target-exists",path:s,message:`Cannot rename ${t} to ${s}: ${s} already exists.`});try{YH(XH(o),{recursive:!0}),wke(n,o)}catch(a){return w({code:"write-failed",path:s,message:`Could not rename ${t} to ${s}: ${a.message}`})}for(let a of this.listeners)a([bg(this.tree.root,n).split(fS).join("/"),s]);return T(s)}write(t,r,i){let n=this.refusal(t);if(n)return w(n);let o=wg(this.tree.root,t),s=bg(this.tree.root,o).split(fS).join("/"),a=UO(o);try{i==="create"?(YH(XH(o),{recursive:!0}),_ke(a,r,{flag:"wx"}),bke(a,o),lj(a)):Nr(o,r)}catch(c){lj(a,{force:!0});let l=c.code;return i==="create"&&l==="EEXIST"?w({code:"record-exists",path:s,message:`${s} already exists. Records are written once and never changed.`}):w({code:"write-failed",path:s,message:`Could not write ${s}: ${c.message}`})}for(let c of this.listeners)c([s]);return T(s)}refusal(t){if(!this.tree.access.writable)return this.tree.access.problem;let r=wg(this.tree.root,t),i=bg(this.tree.root,r);return QH(t)||i===""||i.startsWith("..")||QH(i)?{code:"write-outside-tree",message:`Refusing to write ${t}: it is outside the spec tree.`}:null}};var hS=class e{host;home;cwd;fixed;pullRequests;openFolders=null;preparesOnFirstUse=!1;prepared=new Set;written=null;constructor(t){this.host=t.host,this.cwd=t.cwd,this.home=t.home??Bs(),this.fixed=t.fixed??!1,this.pullRequests=t.pullRequests??pS}usage(t,r){xG(this.home,t.tree.root,this.host,r)}gateUsage(t,r,i,n){if(r.outcome==="skipped"||r.outcome!=="blocked"&&!n)return;let o=[...r.blocking,...r.warnings].map(s=>s.id);this.usage(t,{event:"gate",gate:r.gate,outcome:r.outcome,artifact:i,checks:o})}prepareProjectsOnFirstUse(){this.preparesOnFirstUse=!0}useOpenFolders(t){this.openFolders=t}async forCall(t){let r=this.cwd;if(t!==void 0){if(!xke(t)||!Tke(t))return w({code:"workspace-invalid",message:`${t} is not the absolute path of a folder on this machine.`,remedy:"Call again with workspace set to the absolute path of the project folder."});r=t}else if(!this.fixed&&this.openFolders){let n=await this.openFolders().catch(()=>[]),o=n.filter(s=>Bh(s)!==null);if(o.length===1)r=o[0];else if(o.length===0&&n.length===1)r=n[0];else if(n.length>0)return w({code:"workspace-unknown",message:`Several folders are open (${n.join(", ")}), so BuildKeel cannot tell which project this call is for.`,remedy:"Call again with workspace set to the absolute path of the project folder."})}let i=r===this.cwd?this:new e({host:this.host,cwd:r,home:this.home,pullRequests:this.pullRequests});return this.preparesOnFirstUse&&this.prepare(i),T(i)}prepare(t=this){let r=Bh(t.cwd);if(!r||this.prepared.has(r))return;let i=t.workspace();if(!i.ok)return;this.prepared.add(r),t.refreshHookCache(i.value),t.checkFreshness(i.value).catch(()=>{});let{resolved:n}=i.value,o={codeRoot:n.codeRoot,repo:n.pointer.repo,home:t.home,host:t.host};hk({tree:i.value.tree,writer:t.writer(i.value),code:o}).then(()=>t.flushWrites()).catch(s=>{process.stderr.write(`BuildKeel could not assign pending numbers: ${s instanceof Error?s.message:String(s)}
477
+ `)})}workspace(){let t=KH(this.cwd,this.home);if(!t.ok)return t;let r=JH(t.value.specRoot,void 0,{home:this.home});return r.ok?T({resolved:t.value,tree:r.value,notices:r.problems}):w(...r.problems)}writer(t){let r=new mS(t.tree);return r.onWrite(()=>{this.written=t}),r}flushWrites(){this.written&&this.refreshHookCache(this.written)}refreshHookCache(t){this.written=null;let{tree:r,resolved:i}=t,n=K(r.root),{codeRoot:o}=i,s=_e(o)?.suspects,a=Gh(o,n);if(!a)return n;let c=Fo(r.root),l=a.activeUnit,u=l?zi(r,n,{codeRoot:o,repo:i.pointer.repo},this.home):null,d=a.mode==="spec-driven"?da(r.root).suspects.map(f=>({id:f.id,target:f.capability})):yr(r.root,n).suspects.map(f=>({id:f.id,target:f.target}));if(s){let f=new Set(s);for(let m of d.filter(h=>!f.has(h.id)))this.usage(t,{event:"suspect",id:m.id,target:m.target})}let p=a.mode==="spec-driven"?Wk(this.home,r.root):null;return wr(o,{...p?{guide:p}:{},unpushedApprovals:c.approvals,unpushedCompletions:c.completions,suspects:[...new Set(d.map(f=>f.id))],...l&&u?{scope:HH(r.root,n,u,i.pointer.repo,l)}:{}}),Ike(o,l&&u?Yd(r,n,l,{active:!0,code:Cd(r.root,n,u,l)}):null),n}unitCode(t,r,i){let{tree:n,resolved:o}=t,s=zi(n,r,{codeRoot:o.codeRoot,repo:o.pointer.repo},this.home);return Cd(n.root,r,s,i)}async unitCodeWithPullRequests(t,r,i){let{tree:n,resolved:o}=t,s=zi(n,r,{codeRoot:o.codeRoot,repo:o.pointer.repo},this.home);return WH(Cd(n.root,r,s,i),s,this.pullRequests)}async checkFreshness(t){let r=await v9(t.tree.root);_e(t.resolved.codeRoot)||this.refreshHookCache(t);let i=Fo(t.tree.root);return wr(t.resolved.codeRoot,{freshness:r,unpushedApprovals:i.approvals,unpushedCompletions:i.completions}),r}};function Ike(e,t){t?.ok?Nr(MO(e),t.value):kke(MO(e),{force:!0})}function Tke(e){try{return Ske(e).isDirectory()}catch{return!1}}import{appendFileSync as Pke}from"node:fs";import{fileURLToPath as Rke}from"node:url";var Cke=5e3;async function tJ(e,t,r,i){if(_g({args:process.argv.slice(2),cwd:process.cwd(),fixed:i.fixed}),t.prepareProjectsOnFirstUse(),i.fixed){t.prepare(),e.server.oninitialized=()=>_g({client:e.server.getClientVersion(),roots:!!e.server.getClientCapabilities()?.roots}),await e.connect(r);return}let n=async()=>{let o=await eJ(e);_g({folders:o});for(let s of o)await t.forCall(s)};e.server.oninitialized=()=>{let o=!!e.server.getClientCapabilities()?.roots;_g({client:e.server.getClientVersion(),roots:o}),o&&(t.useOpenFolders(()=>eJ(e)),n().catch(s=>_g({rootsFailed:s instanceof Error?s.message:String(s)})))},e.server.setNotificationHandler(wT,()=>{n().catch(()=>{})}),await e.connect(r)}function _g(e){let t=process.env.BUILDKEEL_SERVER_LOG;t&&Pke(t,`${JSON.stringify({at:new Date().toISOString(),...e})}
478
+ `)}async function eJ(e){let{roots:t}=await e.server.listRoots(void 0,{timeout:Cke});return t.filter(r=>r.uri.startsWith("file:")).map(r=>Rke(r.uri))}function Ake(e){let t="claude-code",r=process.cwd(),i=!1;for(let n=0;n<e.length;n++){let o=e[n];o==="--host"?t=e[++n]??"":o==="--root"&&(r=e[++n]??r,i=!0)}if(!zM(t))throw new Error(`Unknown host "${t}". Use one of: ${_T.join(", ")}.`);return{host:t,cwd:r,rootGiven:i}}try{let{host:e,cwd:t,rootGiven:r}=Ake(process.argv.slice(2)),i=new hS({host:e,cwd:t,fixed:r});await tJ(VH(i),i,new ib,{fixed:r})}catch(e){process.stderr.write(`BuildKeel server could not start: ${e instanceof Error?e.message:String(e)}
479
+ `),process.exit(1)}