yaml-flow 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/asset-integrity.json +2 -2
- package/browser/board-livecards-localstorage.js +5 -5
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +2 -2
- package/cli/{execution-interface-C_A6WCiK.d.ts → execution-interface-ftO1W7Po.d.ts} +4 -2
- package/cli/node/board-live-cards-cli.js +7 -7
- package/cli/node/card-store-cli.js +1 -1
- package/cli/node/execution-adapter.d.ts +47 -2
- package/cli/node/execution-adapter.js +2 -2
- package/cli/node/fs-board-adapter.d.ts +4 -4
- package/cli/node/fs-board-adapter.js +7 -7
- package/cli/node/step-machine-cli.js +4 -4
- package/cli/{types-CziUxkiv.d.ts → types-C2YQXFwo.d.ts} +1 -1
- package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.config/card-store-ref.json +1 -1
- package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.config/outputs-store-ref.json +1 -1
- package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.state-snapshot/board/graph.json +3 -3
- package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime-out/.outputs/status.json +1 -1
- package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/status.json +10 -10
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/board-live-cards-node.cjs +7 -7
- package/lib/board-live-cards-node.d.cts +46 -2
- package/lib/board-live-cards-node.d.ts +46 -2
- package/lib/board-live-cards-node.js +7 -7
- package/lib/board-live-cards-public.cjs +1 -1
- package/lib/board-live-cards-public.js +1 -1
- package/lib/board-live-cards-server-runtime.cjs +2 -2
- package/lib/board-live-cards-server-runtime.js +2 -2
- package/lib/execution-refs.cjs +1 -1
- package/lib/execution-refs.d.cts +4 -2
- package/lib/execution-refs.d.ts +4 -2
- package/lib/execution-refs.js +1 -1
- package/lib/server-runtime/index.cjs +2 -2
- package/lib/server-runtime/index.js +2 -2
- package/package.json +1 -1
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.config/chat-handler.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.config/task-executor.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/gandalf-runtime/.state-snapshot/board/lastJournalProcessedId.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/cards/card-market-prices/computed_values.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/cards/card-portfolio/computed_values.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/cards/card-portfolio-value/computed_values.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/data-objects/holdings.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/data-objects/positions.json +0 -0
- /package/examples/board/.demo-setup/{run-1778643703151-3360-dopnpv → run-1778665078572-3466-a8ay4k}/board-default/runtime-out/.outputs/data-objects/quotes.json +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
'use strict';var child_process=require('child_process'),P=require('fs'),An=require('os'),ue=require('path'),Go=require('net'),url=require('url'),crypto=require('crypto'),module$1=require('module'),properLockfile=require('proper-lockfile'),Ah=require('ajv-formats');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var P__namespace=/*#__PURE__*/_interopNamespace(P);var An__namespace=/*#__PURE__*/_interopNamespace(An);var ue__namespace=/*#__PURE__*/_interopNamespace(ue);var Go__namespace=/*#__PURE__*/_interopNamespace(Go);var Ah__default=/*#__PURE__*/_interopDefault(Ah);var Rc=Object.create;var Mo=Object.defineProperty;var Cc=Object.getOwnPropertyDescriptor;var $c=Object.getOwnPropertyNames;var Ec=Object.getPrototypeOf,xc=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Tc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $c(t))!xc.call(e,s)&&s!==r&&Mo(e,s,{get:()=>t[s],enumerable:!(n=Cc(t,s))||n.enumerable});return e};var Ac=(e,t,r)=>(r=e!=null?Rc(Ec(e)):{},Tc(Mo(r,"default",{value:e,enumerable:true}),e));var Yt=x(W=>{Object.defineProperty(W,"__esModule",{value:true});W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var zt=class{};W._CodeOrName=zt;W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pt=class extends zt{constructor(t){if(super(),!W.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};W.Name=pt;var xe=class extends zt{constructor(t){super(),this._items=typeof t=="string"?[t]:t;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;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,n)=>`${r}${n}`,"")}get names(){var t;return (t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof pt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};W._Code=xe;W.nil=new xe("");function aa(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Bn(r,t[n]),r.push(e[++n]);return new xe(r)}W._=aa;var Vn=new xe("+");function ia(e,...t){let r=[Wt(e[0])],n=0;for(;n<t.length;)r.push(Vn),Bn(r,t[n]),r.push(Vn,Wt(e[++n]));return nd(r),new xe(r)}W.str=ia;function Bn(e,t){t instanceof xe?e.push(...t._items):t instanceof pt?e.push(t):e.push(ad(t));}W.addCodeArg=Bn;function nd(e){let t=1;for(;t<e.length-1;){if(e[t]===Vn){let r=sd(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+";}t++;}}function sd(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof pt||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 pt))return `"${e}${t.slice(1)}`}function od(e,t){return t.emptyStr()?e:e.emptyStr()?t:ia`${e}${t}`}W.strConcat=od;function ad(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Wt(Array.isArray(e)?e.join(","):e)}function id(e){return new xe(Wt(e))}W.stringify=id;function Wt(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=Wt;function ud(e){return typeof e=="string"&&W.IDENTIFIER.test(e)?new xe(`.${e}`):aa`[${e}]`}W.getProperty=ud;function cd(e){if(typeof e=="string"&&W.IDENTIFIER.test(e))return new xe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}W.getEsmExportName=cd;function dd(e){return new xe(e.toString())}W.regexpCode=dd;});var Un=x(be=>{Object.defineProperty(be,"__esModule",{value:true});be.ValueScope=be.ValueScopeName=be.Scope=be.varKinds=be.UsedValueState=void 0;var ve=Yt(),Gn=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value;}},Nr;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed";})(Nr||(be.UsedValueState=Nr={}));be.varKinds={const:new ve.Name("const"),let:new ve.Name("let"),var:new ve.Name("var")};var qr=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r;}toName(t){return t instanceof ve.Name?t:this.name(t)}name(t){return new ve.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return `${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};be.Scope=qr;var Dr=class extends ve.Name{constructor(t,r){super(r),this.prefix=t;}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0, ve._)`.${new ve.Name(r)}[${n}]`;}};be.ValueScopeName=Dr;var ld=(0, ve._)`\n`,Kn=class extends qr{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ld:ve.nil};}get(){return this._scope}name(t){return new Dr(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(t),{prefix:o}=s,a=(n=r.key)!==null&&n!==void 0?n:r.ref,i=this._values[o];if(i){let l=i.get(a);if(l)return l}else i=this._values[o]=new Map;i.set(a,s);let u=this._scope[o]||(this._scope[o]=[]),c=u.length;return u[c]=r.ref,s.setValue(r,{property:o,itemIndex:c}),s}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return (0, ve._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(t,r,n={},s){let o=ve.nil;for(let a in t){let i=t[a];if(!i)continue;let u=n[a]=n[a]||new Map;i.forEach(c=>{if(u.has(c))return;u.set(c,Nr.Started);let l=r(c);if(l){let d=this.opts.es5?be.varKinds.var:be.varKinds.const;o=(0, ve._)`${o}${d} ${c} = ${l};${this.opts._n}`;}else if(l=s?.(c))o=(0, ve._)`${o}${l}${this.opts._n}`;else throw new Gn(c);u.set(c,Nr.Completed);});}return o}};be.ValueScope=Kn;});var G=x(B=>{Object.defineProperty(B,"__esModule",{value:true});B.or=B.and=B.not=B.CodeGen=B.operators=B.varKinds=B.ValueScopeName=B.ValueScope=B.Scope=B.Name=B.regexpCode=B.stringify=B.getProperty=B.nil=B.strConcat=B.str=B._=void 0;var J=Yt(),Pe=Un(),Ye=Yt();Object.defineProperty(B,"_",{enumerable:true,get:function(){return Ye._}});Object.defineProperty(B,"str",{enumerable:true,get:function(){return Ye.str}});Object.defineProperty(B,"strConcat",{enumerable:true,get:function(){return Ye.strConcat}});Object.defineProperty(B,"nil",{enumerable:true,get:function(){return Ye.nil}});Object.defineProperty(B,"getProperty",{enumerable:true,get:function(){return Ye.getProperty}});Object.defineProperty(B,"stringify",{enumerable:true,get:function(){return Ye.stringify}});Object.defineProperty(B,"regexpCode",{enumerable:true,get:function(){return Ye.regexpCode}});Object.defineProperty(B,"Name",{enumerable:true,get:function(){return Ye.Name}});var Vr=Un();Object.defineProperty(B,"Scope",{enumerable:true,get:function(){return Vr.Scope}});Object.defineProperty(B,"ValueScope",{enumerable:true,get:function(){return Vr.ValueScope}});Object.defineProperty(B,"ValueScopeName",{enumerable:true,get:function(){return Vr.ValueScopeName}});Object.defineProperty(B,"varKinds",{enumerable:true,get:function(){return Vr.varKinds}});B.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var Ge=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Jn=class extends Ge{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n;}render({es5:t,_n:r}){let n=t?Pe.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return `${n} ${this.name}${s};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Tt(this.rhs,t,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},Fr=class extends Ge{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n;}render({_n:t}){return `${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof J.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Tt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof J.Name?{}:{...this.lhs.names};return Lr(t,this.rhs)}},Hn=class extends Fr{constructor(t,r,n,s){super(t,n,s),this.op=r;}render({_n:t}){return `${this.lhs} ${this.op}= ${this.rhs};`+t}},zn=class extends Ge{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `${this.label}:`+t}},Wn=class extends Ge{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `break${this.label?` ${this.label}`:""};`+t}},Yn=class extends Ge{constructor(t){super(),this.error=t;}render({_n:t}){return `throw ${this.error};`+t}get names(){return this.error.names}},Xn=class extends Ge{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=Tt(this.code,t,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},Xt=class extends Ge{constructor(t=[]){super(),this.nodes=t;}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1);}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(t,r)||(fd(t,o.names),n.splice(s,1));}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>gt(t,r.names),{})}},Ke=class extends Xt{render(t){return "{"+t._n+super.render(t)+"}"+t._n}},Qn=class extends Xt{},xt=class extends Ke{};xt.kind="else";var mt=class e extends Ke{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===true)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new xt(n):n;}if(r)return t===false?r instanceof e?r:r.nodes:this.nodes.length?this:new e(ua(t),r instanceof e?[r]:r.nodes);if(!(t===false||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Tt(this.condition,t,r),this}get names(){let t=super.names;return Lr(t,this.condition),this.else&>(t,this.else.names),t}};mt.kind="if";var ht=class extends Ke{};ht.kind="for";var Zn=class extends ht{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=Tt(this.iteration,t,r),this}get names(){return gt(super.names,this.iteration.names)}},es=class extends ht{constructor(t,r,n,s){super(),this.varKind=t,this.name=r,this.from=n,this.to=s;}render(t){let r=t.es5?Pe.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return `for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=Lr(super.names,this.from);return Lr(t,this.to)}},Mr=class extends ht{constructor(t,r,n,s){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=s;}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=Tt(this.iterable,t,r),this}get names(){return gt(super.names,this.iterable.names)}},Qt=class extends Ke{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n;}render(t){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Qt.kind="func";var Zt=class extends Xt{render(t){return "return "+super.render(t)}};Zt.kind="return";var ts=class extends Ke{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 n,s;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(s=this.finally)===null||s===void 0||s.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&>(t,this.catch.names),this.finally&>(t,this.finally.names),t}},er=class extends Ke{constructor(t){super(),this.error=t;}render(t){return `catch(${this.error})`+super.render(t)}};er.kind="catch";var tr=class extends Ke{render(t){return "finally"+super.render(t)}};tr.kind="finally";var rs=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
-
`:""},this._extScope=t,this._scope=new Pe.Scope({parent:t}),this._nodes=[new Qn];}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 n=this._extScope.value(t,r);return (this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new Jn(t,o,n)),o}const(t,r,n){return this._def(Pe.varKinds.const,t,r,n)}let(t,r,n){return this._def(Pe.varKinds.let,t,r,n)}var(t,r,n){return this._def(Pe.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Fr(t,r,n))}add(t,r){return this._leafNode(new Hn(t,B.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==J.nil&&this._leafNode(new Xn(t)),this}object(...t){let r=["{"];for(let[n,s]of t)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0, J.addCodeArg)(r,s));return r.push("}"),new J._Code(r)}if(t,r,n){if(this._blockNode(new mt(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new mt(t))}else(){return this._elseNode(new xt)}endIf(){return this._endBlockNode(mt,xt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Zn(t),r)}forRange(t,r,n,s,o=this.opts.es5?Pe.varKinds.var:Pe.varKinds.let){let a=this._scope.toName(t);return this._for(new es(o,a,r,n),()=>s(a))}forOf(t,r,n,s=Pe.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, J._)`${a}.length`,i=>{this.var(o,(0, J._)`${a}[${i}]`),n(o);})}return this._for(new Mr("of",s,o,r),()=>n(o))}forIn(t,r,n,s=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0, J._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new Mr("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(ht)}label(t){return this._leafNode(new zn(t))}break(t){return this._leafNode(new Wn(t))}return(t){let r=new Zt;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Zt)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new ts;if(this._blockNode(s),this.code(t),r){let o=this.name("e");this._currNode=s.catch=new er(o),r(o);}return n&&(this._currNode=s.finally=new tr,this.code(n)),this._endBlockNode(er,tr)}throw(t){return this._leafNode(new Yn(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 n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=J.nil,n,s){return this._blockNode(new Qt(t,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Qt)}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 n=this._currNode;if(n instanceof t||r&&n 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 mt))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;}};B.CodeGen=rs;function gt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Lr(e,t){return t instanceof J._CodeOrName?gt(e,t.names):e}function Tt(e,t,r){if(e instanceof J.Name)return n(e);if(!s(e))return e;return new J._Code(e._items.reduce((o,a)=>(a instanceof J.Name&&(a=n(a)),a instanceof J._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function s(o){return o instanceof J._Code&&o._items.some(a=>a instanceof J.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function fd(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0);}function ua(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0, J._)`!${ns(e)}`}B.not=ua;var pd=ca(B.operators.AND);function md(...e){return e.reduce(pd)}B.and=md;var hd=ca(B.operators.OR);function gd(...e){return e.reduce(hd)}B.or=gd;function ca(e){return (t,r)=>t===J.nil?r:r===J.nil?t:(0, J._)`${ns(t)} ${e} ${ns(r)}`}function ns(e){return e instanceof J.Name?e:(0, J._)`(${e})`}});var H=x(K=>{Object.defineProperty(K,"__esModule",{value:true});K.checkStrictMode=K.getErrorPath=K.Type=K.useFunc=K.setEvaluated=K.evaluatedPropsToName=K.mergeEvaluated=K.eachItem=K.unescapeJsonPointer=K.escapeJsonPointer=K.escapeFragment=K.unescapeFragment=K.schemaRefOrVal=K.schemaHasRulesButRef=K.schemaHasRules=K.checkUnknownRules=K.alwaysValidSchema=K.toHash=void 0;var Z=G(),yd=Yt();function vd(e){let t={};for(let r of e)t[r]=true;return t}K.toHash=vd;function bd(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?true:(fa(e,t),!pa(t,e.self.RULES.all))}K.alwaysValidSchema=bd;function fa(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let s=n.RULES.keywords;for(let o in t)s[o]||ga(e,`unknown keyword: "${o}"`);}K.checkUnknownRules=fa;function pa(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(t[r])return true;return false}K.schemaHasRules=pa;function Sd(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(r!=="$ref"&&t.all[r])return true;return false}K.schemaHasRulesButRef=Sd;function wd({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, Z._)`${r}`}return (0, Z._)`${e}${t}${(0, Z.getProperty)(n)}`}K.schemaRefOrVal=wd;function kd(e){return ma(decodeURIComponent(e))}K.unescapeFragment=kd;function _d(e){return encodeURIComponent(os(e))}K.escapeFragment=_d;function os(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}K.escapeJsonPointer=os;function ma(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}K.unescapeJsonPointer=ma;function Rd(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e);}K.eachItem=Rd;function da({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return (s,o,a,i)=>{let u=a===void 0?o:a instanceof Z.Name?(o instanceof Z.Name?e(s,o,a):t(s,o,a),a):o instanceof Z.Name?(t(s,a,o),o):r(o,a);return i===Z.Name&&!(u instanceof Z.Name)?n(s,u):u}}K.mergeEvaluated={props:da({mergeNames:(e,t,r)=>e.if((0, Z._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0, Z._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0, Z._)`${r} || {}`).code((0, Z._)`Object.assign(${r}, ${t})`));}),mergeToName:(e,t,r)=>e.if((0, Z._)`${r} !== true`,()=>{t===true?e.assign(r,true):(e.assign(r,(0, Z._)`${r} || {}`),as(e,r,t));}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:ha}),items:da({mergeNames:(e,t,r)=>e.if((0, Z._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0, Z._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0, Z._)`${r} !== true`,()=>e.assign(r,t===true?true:(0, Z._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ha(e,t){if(t===true)return e.var("props",true);let r=e.var("props",(0, Z._)`{}`);return t!==void 0&&as(e,r,t),r}K.evaluatedPropsToName=ha;function as(e,t,r){Object.keys(r).forEach(n=>e.assign((0, Z._)`${t}${(0, Z.getProperty)(n)}`,true));}K.setEvaluated=as;var la={};function Cd(e,t){return e.scopeValue("func",{ref:t,code:la[t.code]||(la[t.code]=new yd._Code(t.code))})}K.useFunc=Cd;var ss;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str";})(ss||(K.Type=ss={}));function $d(e,t,r){if(e instanceof Z.Name){let n=t===ss.Num;return r?n?(0, Z._)`"[" + ${e} + "]"`:(0, Z._)`"['" + ${e} + "']"`:n?(0, Z._)`"/" + ${e}`:(0, Z._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, Z.getProperty)(e).toString():"/"+os(e)}K.getErrorPath=$d;function ga(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===true)throw new Error(t);e.self.logger.warn(t);}}K.checkStrictMode=ga;});var Ue=x(is=>{Object.defineProperty(is,"__esModule",{value:true});var fe=G(),Ed={data:new fe.Name("data"),valCxt:new fe.Name("valCxt"),instancePath:new fe.Name("instancePath"),parentData:new fe.Name("parentData"),parentDataProperty:new fe.Name("parentDataProperty"),rootData:new fe.Name("rootData"),dynamicAnchors:new fe.Name("dynamicAnchors"),vErrors:new fe.Name("vErrors"),errors:new fe.Name("errors"),this:new fe.Name("this"),self:new fe.Name("self"),scope:new fe.Name("scope"),json:new fe.Name("json"),jsonPos:new fe.Name("jsonPos"),jsonLen:new fe.Name("jsonLen"),jsonPart:new fe.Name("jsonPart")};is.default=Ed;});var rr=x(pe=>{Object.defineProperty(pe,"__esModule",{value:true});pe.extendErrors=pe.resetErrorsCount=pe.reportExtraError=pe.reportError=pe.keyword$DataError=pe.keywordError=void 0;var z=G(),Br=H(),ge=Ue();pe.keywordError={message:({keyword:e})=>(0, z.str)`must pass "${e}" keyword validation`};pe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0, z.str)`"${e}" keyword must be ${t} ($data)`:(0, z.str)`"${e}" keyword is invalid ($data)`};function xd(e,t=pe.keywordError,r,n){let{it:s}=e,{gen:o,compositeRule:a,allErrors:i}=s,u=ba(e,t,r);n??(a||i)?ya(o,u):va(s,(0, z._)`[${u}]`);}pe.reportError=xd;function Td(e,t=pe.keywordError,r){let{it:n}=e,{gen:s,compositeRule:o,allErrors:a}=n,i=ba(e,t,r);ya(s,i),o||a||va(n,ge.default.vErrors);}pe.reportExtraError=Td;function Ad(e,t){e.assign(ge.default.errors,t),e.if((0, z._)`${ge.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0, z._)`${ge.default.vErrors}.length`,t),()=>e.assign(ge.default.vErrors,null)));}pe.resetErrorsCount=Ad;function Id({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",s,ge.default.errors,i=>{e.const(a,(0, z._)`${ge.default.vErrors}[${i}]`),e.if((0, z._)`${a}.instancePath === undefined`,()=>e.assign((0, z._)`${a}.instancePath`,(0, z.strConcat)(ge.default.instancePath,o.errorPath))),e.assign((0, z._)`${a}.schemaPath`,(0, z.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0, z._)`${a}.schema`,r),e.assign((0, z._)`${a}.data`,n));});}pe.extendErrors=Id;function ya(e,t){let r=e.const("err",t);e.if((0, z._)`${ge.default.vErrors} === null`,()=>e.assign(ge.default.vErrors,(0, z._)`[${r}]`),(0, z._)`${ge.default.vErrors}.push(${r})`),e.code((0, z._)`${ge.default.errors}++`);}function va(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;s.$async?r.throw((0, z._)`new ${e.ValidationError}(${t})`):(r.assign((0, z._)`${n}.errors`,t),r.return(false));}var yt={keyword:new z.Name("keyword"),schemaPath:new z.Name("schemaPath"),params:new z.Name("params"),propertyName:new z.Name("propertyName"),message:new z.Name("message"),schema:new z.Name("schema"),parentSchema:new z.Name("parentSchema")};function ba(e,t,r){let{createErrors:n}=e.it;return n===false?(0, z._)`{}`:Pd(e,t,r)}function Pd(e,t,r={}){let{gen:n,it:s}=e,o=[Od(s,r),jd(e,r)];return Nd(e,t,o),n.object(...o)}function Od({errorPath:e},{instancePath:t}){let r=t?(0, z.str)`${e}${(0, Br.getErrorPath)(t,Br.Type.Str)}`:e;return [ge.default.instancePath,(0, z.strConcat)(ge.default.instancePath,r)]}function jd({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:(0, z.str)`${t}/${e}`;return r&&(s=(0, z.str)`${s}${(0, Br.getErrorPath)(r,Br.Type.Str)}`),[yt.schemaPath,s]}function Nd(e,{params:t,message:r},n){let{keyword:s,data:o,schemaValue:a,it:i}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=i;n.push([yt.keyword,s],[yt.params,typeof t=="function"?t(e):t||(0, z._)`{}`]),u.messages&&n.push([yt.message,typeof r=="function"?r(e):r]),u.verbose&&n.push([yt.schema,a],[yt.parentSchema,(0, z._)`${l}${d}`],[ge.default.data,o]),c&&n.push([yt.propertyName,c]);}});var wa=x(At=>{Object.defineProperty(At,"__esModule",{value:true});At.boolOrEmptySchema=At.topBoolOrEmptySchema=void 0;var qd=rr(),Dd=G(),Fd=Ue(),Md={message:"boolean schema is false"};function Ld(e){let{gen:t,schema:r,validateName:n}=e;r===false?Sa(e,false):typeof r=="object"&&r.$async===true?t.return(Fd.default.data):(t.assign((0, Dd._)`${n}.errors`,null),t.return(true));}At.topBoolOrEmptySchema=Ld;function Vd(e,t){let{gen:r,schema:n}=e;n===false?(r.var(t,false),Sa(e)):r.var(t,true);}At.boolOrEmptySchema=Vd;function Sa(e,t){let{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0, qd.reportError)(s,Md,void 0,t);}});var us=x(It=>{Object.defineProperty(It,"__esModule",{value:true});It.getRules=It.isJSONType=void 0;var Bd=["string","number","integer","boolean","null","object","array"],Gd=new Set(Bd);function Kd(e){return typeof e=="string"&&Gd.has(e)}It.isJSONType=Kd;function Ud(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return {types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}It.getRules=Ud;});var cs=x(Xe=>{Object.defineProperty(Xe,"__esModule",{value:true});Xe.shouldUseRule=Xe.shouldUseGroup=Xe.schemaHasRulesForType=void 0;function Jd({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==true&&ka(e,n)}Xe.schemaHasRulesForType=Jd;function ka(e,t){return t.rules.some(r=>_a(e,r))}Xe.shouldUseGroup=ka;function _a(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Xe.shouldUseRule=_a;});var nr=x(me=>{Object.defineProperty(me,"__esModule",{value:true});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var Hd=us(),zd=cs(),Wd=rr(),L=G(),Ra=H(),Pt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong";})(Pt||(me.DataType=Pt={}));function Yd(e){let t=Ca(e.type);if(t.includes("null")){if(e.nullable===false)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===true&&t.push("null");}return t}me.getSchemaTypes=Yd;function Ca(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Hd.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}me.getJSONTypes=Ca;function Xd(e,t){let{gen:r,data:n,opts:s}=e,o=Qd(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0, zd.schemaHasRulesForType)(e,t[0]));if(a){let i=ls(t,n,s.strictNumbers,Pt.Wrong);r.if(i,()=>{o.length?Zd(e,t,o):fs(e);});}return a}me.coerceAndCheckDataType=Xd;var $a=new Set(["string","number","integer","boolean","null"]);function Qd(e,t){return t?e.filter(r=>$a.has(r)||t==="array"&&r==="array"):[]}function Zd(e,t,r){let{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0, L._)`typeof ${s}`),i=n.let("coerced",(0, L._)`undefined`);o.coerceTypes==="array"&&n.if((0, L._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0, L._)`${s}[0]`).assign(a,(0, L._)`typeof ${s}`).if(ls(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0, L._)`${i} !== undefined`);for(let c of r)($a.has(c)||c==="array"&&o.coerceTypes==="array")&&u(c);n.else(),fs(e),n.endIf(),n.if((0, L._)`${i} !== undefined`,()=>{n.assign(s,i),el(e,i);});function u(c){switch(c){case "string":n.elseIf((0, L._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0, L._)`"" + ${s}`).elseIf((0, L._)`${s} === null`).assign(i,(0, L._)`""`);return;case "number":n.elseIf((0, L._)`${a} == "boolean" || ${s} === null
|
|
1
|
+
'use strict';var child_process=require('child_process'),P=require('fs'),Pn=require('os'),ue=require('path'),Ho=require('net'),url=require('url'),crypto=require('crypto'),module$1=require('module'),properLockfile=require('proper-lockfile'),Bh=require('ajv-formats');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var P__namespace=/*#__PURE__*/_interopNamespace(P);var Pn__namespace=/*#__PURE__*/_interopNamespace(Pn);var ue__namespace=/*#__PURE__*/_interopNamespace(ue);var Ho__namespace=/*#__PURE__*/_interopNamespace(Ho);var Bh__default=/*#__PURE__*/_interopDefault(Bh);var jc=Object.create;var Go=Object.defineProperty;var Nc=Object.getOwnPropertyDescriptor;var qc=Object.getOwnPropertyNames;var Dc=Object.getPrototypeOf,Fc=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qc(t))!Fc.call(e,s)&&s!==r&&Go(e,s,{get:()=>t[s],enumerable:!(n=Nc(t,s))||n.enumerable});return e};var Lc=(e,t,r)=>(r=e!=null?jc(Dc(e)):{},Mc(Go(r,"default",{value:e,enumerable:true}),e));var Qt=x(W=>{Object.defineProperty(W,"__esModule",{value:true});W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var Yt=class{};W._CodeOrName=Yt;W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ht=class extends Yt{constructor(t){if(super(),!W.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};W.Name=ht;var xe=class extends Yt{constructor(t){super(),this._items=typeof t=="string"?[t]:t;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;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,n)=>`${r}${n}`,"")}get names(){var t;return (t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof ht&&(r[n.str]=(r[n.str]||0)+1),r),{})}};W._Code=xe;W.nil=new xe("");function ga(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Jn(r,t[n]),r.push(e[++n]);return new xe(r)}W._=ga;var Un=new xe("+");function ya(e,...t){let r=[Xt(e[0])],n=0;for(;n<t.length;)r.push(Un),Jn(r,t[n]),r.push(Un,Xt(e[++n]));return hd(r),new xe(r)}W.str=ya;function Jn(e,t){t instanceof xe?e.push(...t._items):t instanceof ht?e.push(t):e.push(vd(t));}W.addCodeArg=Jn;function hd(e){let t=1;for(;t<e.length-1;){if(e[t]===Un){let r=gd(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+";}t++;}}function gd(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof ht||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 ht))return `"${e}${t.slice(1)}`}function yd(e,t){return t.emptyStr()?e:e.emptyStr()?t:ya`${e}${t}`}W.strConcat=yd;function vd(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Xt(Array.isArray(e)?e.join(","):e)}function kd(e){return new xe(Xt(e))}W.stringify=kd;function Xt(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=Xt;function bd(e){return typeof e=="string"&&W.IDENTIFIER.test(e)?new xe(`.${e}`):ga`[${e}]`}W.getProperty=bd;function Sd(e){if(typeof e=="string"&&W.IDENTIFIER.test(e))return new xe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}W.getEsmExportName=Sd;function wd(e){return new xe(e.toString())}W.regexpCode=wd;});var Wn=x(ke=>{Object.defineProperty(ke,"__esModule",{value:true});ke.ValueScope=ke.ValueScopeName=ke.Scope=ke.varKinds=ke.UsedValueState=void 0;var ve=Qt(),Hn=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value;}},Dr;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed";})(Dr||(ke.UsedValueState=Dr={}));ke.varKinds={const:new ve.Name("const"),let:new ve.Name("let"),var:new ve.Name("var")};var Fr=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r;}toName(t){return t instanceof ve.Name?t:this.name(t)}name(t){return new ve.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return `${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};ke.Scope=Fr;var Mr=class extends ve.Name{constructor(t,r){super(r),this.prefix=t;}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0, ve._)`.${new ve.Name(r)}[${n}]`;}};ke.ValueScopeName=Mr;var _d=(0, ve._)`\n`,zn=class extends Fr{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?_d:ve.nil};}get(){return this._scope}name(t){return new Mr(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(t),{prefix:o}=s,a=(n=r.key)!==null&&n!==void 0?n:r.ref,i=this._values[o];if(i){let l=i.get(a);if(l)return l}else i=this._values[o]=new Map;i.set(a,s);let u=this._scope[o]||(this._scope[o]=[]),c=u.length;return u[c]=r.ref,s.setValue(r,{property:o,itemIndex:c}),s}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return (0, ve._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(t,r,n={},s){let o=ve.nil;for(let a in t){let i=t[a];if(!i)continue;let u=n[a]=n[a]||new Map;i.forEach(c=>{if(u.has(c))return;u.set(c,Dr.Started);let l=r(c);if(l){let d=this.opts.es5?ke.varKinds.var:ke.varKinds.const;o=(0, ve._)`${o}${d} ${c} = ${l};${this.opts._n}`;}else if(l=s?.(c))o=(0, ve._)`${o}${l}${this.opts._n}`;else throw new Hn(c);u.set(c,Dr.Completed);});}return o}};ke.ValueScope=zn;});var G=x(B=>{Object.defineProperty(B,"__esModule",{value:true});B.or=B.and=B.not=B.CodeGen=B.operators=B.varKinds=B.ValueScopeName=B.ValueScope=B.Scope=B.Name=B.regexpCode=B.stringify=B.getProperty=B.nil=B.strConcat=B.str=B._=void 0;var J=Qt(),Pe=Wn(),Qe=Qt();Object.defineProperty(B,"_",{enumerable:true,get:function(){return Qe._}});Object.defineProperty(B,"str",{enumerable:true,get:function(){return Qe.str}});Object.defineProperty(B,"strConcat",{enumerable:true,get:function(){return Qe.strConcat}});Object.defineProperty(B,"nil",{enumerable:true,get:function(){return Qe.nil}});Object.defineProperty(B,"getProperty",{enumerable:true,get:function(){return Qe.getProperty}});Object.defineProperty(B,"stringify",{enumerable:true,get:function(){return Qe.stringify}});Object.defineProperty(B,"regexpCode",{enumerable:true,get:function(){return Qe.regexpCode}});Object.defineProperty(B,"Name",{enumerable:true,get:function(){return Qe.Name}});var Gr=Wn();Object.defineProperty(B,"Scope",{enumerable:true,get:function(){return Gr.Scope}});Object.defineProperty(B,"ValueScope",{enumerable:true,get:function(){return Gr.ValueScope}});Object.defineProperty(B,"ValueScopeName",{enumerable:true,get:function(){return Gr.ValueScopeName}});Object.defineProperty(B,"varKinds",{enumerable:true,get:function(){return Gr.varKinds}});B.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var Ge=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Yn=class extends Ge{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n;}render({es5:t,_n:r}){let n=t?Pe.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return `${n} ${this.name}${s};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=It(this.rhs,t,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},Lr=class extends Ge{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n;}render({_n:t}){return `${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof J.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=It(this.rhs,t,r),this}get names(){let t=this.lhs instanceof J.Name?{}:{...this.lhs.names};return Br(t,this.rhs)}},Xn=class extends Lr{constructor(t,r,n,s){super(t,n,s),this.op=r;}render({_n:t}){return `${this.lhs} ${this.op}= ${this.rhs};`+t}},Qn=class extends Ge{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `${this.label}:`+t}},Zn=class extends Ge{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `break${this.label?` ${this.label}`:""};`+t}},es=class extends Ge{constructor(t){super(),this.error=t;}render({_n:t}){return `throw ${this.error};`+t}get names(){return this.error.names}},ts=class extends Ge{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=It(this.code,t,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},Zt=class extends Ge{constructor(t=[]){super(),this.nodes=t;}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1);}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(t,r)||(Rd(t,o.names),n.splice(s,1));}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>vt(t,r.names),{})}},Ke=class extends Zt{render(t){return "{"+t._n+super.render(t)+"}"+t._n}},rs=class extends Zt{},At=class extends Ke{};At.kind="else";var gt=class e extends Ke{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===true)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new At(n):n;}if(r)return t===false?r instanceof e?r:r.nodes:this.nodes.length?this:new e(va(t),r instanceof e?[r]:r.nodes);if(!(t===false||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=It(this.condition,t,r),this}get names(){let t=super.names;return Br(t,this.condition),this.else&&vt(t,this.else.names),t}};gt.kind="if";var yt=class extends Ke{};yt.kind="for";var ns=class extends yt{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=It(this.iteration,t,r),this}get names(){return vt(super.names,this.iteration.names)}},ss=class extends yt{constructor(t,r,n,s){super(),this.varKind=t,this.name=r,this.from=n,this.to=s;}render(t){let r=t.es5?Pe.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return `for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=Br(super.names,this.from);return Br(t,this.to)}},Vr=class extends yt{constructor(t,r,n,s){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=s;}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=It(this.iterable,t,r),this}get names(){return vt(super.names,this.iterable.names)}},er=class extends Ke{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n;}render(t){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};er.kind="func";var tr=class extends Zt{render(t){return "return "+super.render(t)}};tr.kind="return";var os=class extends Ke{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 n,s;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(s=this.finally)===null||s===void 0||s.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&vt(t,this.catch.names),this.finally&&vt(t,this.finally.names),t}},rr=class extends Ke{constructor(t){super(),this.error=t;}render(t){return `catch(${this.error})`+super.render(t)}};rr.kind="catch";var nr=class extends Ke{render(t){return "finally"+super.render(t)}};nr.kind="finally";var as=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=t,this._scope=new Pe.Scope({parent:t}),this._nodes=[new rs];}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 n=this._extScope.value(t,r);return (this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new Yn(t,o,n)),o}const(t,r,n){return this._def(Pe.varKinds.const,t,r,n)}let(t,r,n){return this._def(Pe.varKinds.let,t,r,n)}var(t,r,n){return this._def(Pe.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Lr(t,r,n))}add(t,r){return this._leafNode(new Xn(t,B.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==J.nil&&this._leafNode(new ts(t)),this}object(...t){let r=["{"];for(let[n,s]of t)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0, J.addCodeArg)(r,s));return r.push("}"),new J._Code(r)}if(t,r,n){if(this._blockNode(new gt(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new gt(t))}else(){return this._elseNode(new At)}endIf(){return this._endBlockNode(gt,At)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ns(t),r)}forRange(t,r,n,s,o=this.opts.es5?Pe.varKinds.var:Pe.varKinds.let){let a=this._scope.toName(t);return this._for(new ss(o,a,r,n),()=>s(a))}forOf(t,r,n,s=Pe.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, J._)`${a}.length`,i=>{this.var(o,(0, J._)`${a}[${i}]`),n(o);})}return this._for(new Vr("of",s,o,r),()=>n(o))}forIn(t,r,n,s=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0, J._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new Vr("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(yt)}label(t){return this._leafNode(new Qn(t))}break(t){return this._leafNode(new Zn(t))}return(t){let r=new tr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new os;if(this._blockNode(s),this.code(t),r){let o=this.name("e");this._currNode=s.catch=new rr(o),r(o);}return n&&(this._currNode=s.finally=new nr,this.code(n)),this._endBlockNode(rr,nr)}throw(t){return this._leafNode(new es(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 n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=J.nil,n,s){return this._blockNode(new er(t,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(er)}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 n=this._currNode;if(n instanceof t||r&&n 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 gt))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;}};B.CodeGen=as;function vt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Br(e,t){return t instanceof J._CodeOrName?vt(e,t.names):e}function It(e,t,r){if(e instanceof J.Name)return n(e);if(!s(e))return e;return new J._Code(e._items.reduce((o,a)=>(a instanceof J.Name&&(a=n(a)),a instanceof J._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function s(o){return o instanceof J._Code&&o._items.some(a=>a instanceof J.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function Rd(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0);}function va(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0, J._)`!${is(e)}`}B.not=va;var $d=ka(B.operators.AND);function Cd(...e){return e.reduce($d)}B.and=Cd;var Ed=ka(B.operators.OR);function xd(...e){return e.reduce(Ed)}B.or=xd;function ka(e){return (t,r)=>t===J.nil?r:r===J.nil?t:(0, J._)`${is(t)} ${e} ${is(r)}`}function is(e){return e instanceof J.Name?e:(0, J._)`(${e})`}});var H=x(K=>{Object.defineProperty(K,"__esModule",{value:true});K.checkStrictMode=K.getErrorPath=K.Type=K.useFunc=K.setEvaluated=K.evaluatedPropsToName=K.mergeEvaluated=K.eachItem=K.unescapeJsonPointer=K.escapeJsonPointer=K.escapeFragment=K.unescapeFragment=K.schemaRefOrVal=K.schemaHasRulesButRef=K.schemaHasRules=K.checkUnknownRules=K.alwaysValidSchema=K.toHash=void 0;var Z=G(),Td=Qt();function Ad(e){let t={};for(let r of e)t[r]=true;return t}K.toHash=Ad;function Id(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?true:(wa(e,t),!_a(t,e.self.RULES.all))}K.alwaysValidSchema=Id;function wa(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let s=n.RULES.keywords;for(let o in t)s[o]||Ca(e,`unknown keyword: "${o}"`);}K.checkUnknownRules=wa;function _a(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(t[r])return true;return false}K.schemaHasRules=_a;function Pd(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(r!=="$ref"&&t.all[r])return true;return false}K.schemaHasRulesButRef=Pd;function Od({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, Z._)`${r}`}return (0, Z._)`${e}${t}${(0, Z.getProperty)(n)}`}K.schemaRefOrVal=Od;function jd(e){return Ra(decodeURIComponent(e))}K.unescapeFragment=jd;function Nd(e){return encodeURIComponent(cs(e))}K.escapeFragment=Nd;function cs(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}K.escapeJsonPointer=cs;function Ra(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}K.unescapeJsonPointer=Ra;function qd(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e);}K.eachItem=qd;function ba({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return (s,o,a,i)=>{let u=a===void 0?o:a instanceof Z.Name?(o instanceof Z.Name?e(s,o,a):t(s,o,a),a):o instanceof Z.Name?(t(s,a,o),o):r(o,a);return i===Z.Name&&!(u instanceof Z.Name)?n(s,u):u}}K.mergeEvaluated={props:ba({mergeNames:(e,t,r)=>e.if((0, Z._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0, Z._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0, Z._)`${r} || {}`).code((0, Z._)`Object.assign(${r}, ${t})`));}),mergeToName:(e,t,r)=>e.if((0, Z._)`${r} !== true`,()=>{t===true?e.assign(r,true):(e.assign(r,(0, Z._)`${r} || {}`),ds(e,r,t));}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:$a}),items:ba({mergeNames:(e,t,r)=>e.if((0, Z._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0, Z._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0, Z._)`${r} !== true`,()=>e.assign(r,t===true?true:(0, Z._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function $a(e,t){if(t===true)return e.var("props",true);let r=e.var("props",(0, Z._)`{}`);return t!==void 0&&ds(e,r,t),r}K.evaluatedPropsToName=$a;function ds(e,t,r){Object.keys(r).forEach(n=>e.assign((0, Z._)`${t}${(0, Z.getProperty)(n)}`,true));}K.setEvaluated=ds;var Sa={};function Dd(e,t){return e.scopeValue("func",{ref:t,code:Sa[t.code]||(Sa[t.code]=new Td._Code(t.code))})}K.useFunc=Dd;var us;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str";})(us||(K.Type=us={}));function Fd(e,t,r){if(e instanceof Z.Name){let n=t===us.Num;return r?n?(0, Z._)`"[" + ${e} + "]"`:(0, Z._)`"['" + ${e} + "']"`:n?(0, Z._)`"/" + ${e}`:(0, Z._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, Z.getProperty)(e).toString():"/"+cs(e)}K.getErrorPath=Fd;function Ca(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===true)throw new Error(t);e.self.logger.warn(t);}}K.checkStrictMode=Ca;});var Ue=x(ls=>{Object.defineProperty(ls,"__esModule",{value:true});var fe=G(),Md={data:new fe.Name("data"),valCxt:new fe.Name("valCxt"),instancePath:new fe.Name("instancePath"),parentData:new fe.Name("parentData"),parentDataProperty:new fe.Name("parentDataProperty"),rootData:new fe.Name("rootData"),dynamicAnchors:new fe.Name("dynamicAnchors"),vErrors:new fe.Name("vErrors"),errors:new fe.Name("errors"),this:new fe.Name("this"),self:new fe.Name("self"),scope:new fe.Name("scope"),json:new fe.Name("json"),jsonPos:new fe.Name("jsonPos"),jsonLen:new fe.Name("jsonLen"),jsonPart:new fe.Name("jsonPart")};ls.default=Md;});var sr=x(pe=>{Object.defineProperty(pe,"__esModule",{value:true});pe.extendErrors=pe.resetErrorsCount=pe.reportExtraError=pe.reportError=pe.keyword$DataError=pe.keywordError=void 0;var z=G(),Kr=H(),ge=Ue();pe.keywordError={message:({keyword:e})=>(0, z.str)`must pass "${e}" keyword validation`};pe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0, z.str)`"${e}" keyword must be ${t} ($data)`:(0, z.str)`"${e}" keyword is invalid ($data)`};function Ld(e,t=pe.keywordError,r,n){let{it:s}=e,{gen:o,compositeRule:a,allErrors:i}=s,u=Ta(e,t,r);n??(a||i)?Ea(o,u):xa(s,(0, z._)`[${u}]`);}pe.reportError=Ld;function Vd(e,t=pe.keywordError,r){let{it:n}=e,{gen:s,compositeRule:o,allErrors:a}=n,i=Ta(e,t,r);Ea(s,i),o||a||xa(n,ge.default.vErrors);}pe.reportExtraError=Vd;function Bd(e,t){e.assign(ge.default.errors,t),e.if((0, z._)`${ge.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0, z._)`${ge.default.vErrors}.length`,t),()=>e.assign(ge.default.vErrors,null)));}pe.resetErrorsCount=Bd;function Gd({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",s,ge.default.errors,i=>{e.const(a,(0, z._)`${ge.default.vErrors}[${i}]`),e.if((0, z._)`${a}.instancePath === undefined`,()=>e.assign((0, z._)`${a}.instancePath`,(0, z.strConcat)(ge.default.instancePath,o.errorPath))),e.assign((0, z._)`${a}.schemaPath`,(0, z.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0, z._)`${a}.schema`,r),e.assign((0, z._)`${a}.data`,n));});}pe.extendErrors=Gd;function Ea(e,t){let r=e.const("err",t);e.if((0, z._)`${ge.default.vErrors} === null`,()=>e.assign(ge.default.vErrors,(0, z._)`[${r}]`),(0, z._)`${ge.default.vErrors}.push(${r})`),e.code((0, z._)`${ge.default.errors}++`);}function xa(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;s.$async?r.throw((0, z._)`new ${e.ValidationError}(${t})`):(r.assign((0, z._)`${n}.errors`,t),r.return(false));}var kt={keyword:new z.Name("keyword"),schemaPath:new z.Name("schemaPath"),params:new z.Name("params"),propertyName:new z.Name("propertyName"),message:new z.Name("message"),schema:new z.Name("schema"),parentSchema:new z.Name("parentSchema")};function Ta(e,t,r){let{createErrors:n}=e.it;return n===false?(0, z._)`{}`:Kd(e,t,r)}function Kd(e,t,r={}){let{gen:n,it:s}=e,o=[Ud(s,r),Jd(e,r)];return Hd(e,t,o),n.object(...o)}function Ud({errorPath:e},{instancePath:t}){let r=t?(0, z.str)`${e}${(0, Kr.getErrorPath)(t,Kr.Type.Str)}`:e;return [ge.default.instancePath,(0, z.strConcat)(ge.default.instancePath,r)]}function Jd({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:(0, z.str)`${t}/${e}`;return r&&(s=(0, z.str)`${s}${(0, Kr.getErrorPath)(r,Kr.Type.Str)}`),[kt.schemaPath,s]}function Hd(e,{params:t,message:r},n){let{keyword:s,data:o,schemaValue:a,it:i}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=i;n.push([kt.keyword,s],[kt.params,typeof t=="function"?t(e):t||(0, z._)`{}`]),u.messages&&n.push([kt.message,typeof r=="function"?r(e):r]),u.verbose&&n.push([kt.schema,a],[kt.parentSchema,(0, z._)`${l}${d}`],[ge.default.data,o]),c&&n.push([kt.propertyName,c]);}});var Ia=x(Pt=>{Object.defineProperty(Pt,"__esModule",{value:true});Pt.boolOrEmptySchema=Pt.topBoolOrEmptySchema=void 0;var zd=sr(),Wd=G(),Yd=Ue(),Xd={message:"boolean schema is false"};function Qd(e){let{gen:t,schema:r,validateName:n}=e;r===false?Aa(e,false):typeof r=="object"&&r.$async===true?t.return(Yd.default.data):(t.assign((0, Wd._)`${n}.errors`,null),t.return(true));}Pt.topBoolOrEmptySchema=Qd;function Zd(e,t){let{gen:r,schema:n}=e;n===false?(r.var(t,false),Aa(e)):r.var(t,true);}Pt.boolOrEmptySchema=Zd;function Aa(e,t){let{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0, zd.reportError)(s,Xd,void 0,t);}});var fs=x(Ot=>{Object.defineProperty(Ot,"__esModule",{value:true});Ot.getRules=Ot.isJSONType=void 0;var el=["string","number","integer","boolean","null","object","array"],tl=new Set(el);function rl(e){return typeof e=="string"&&tl.has(e)}Ot.isJSONType=rl;function nl(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return {types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Ot.getRules=nl;});var ps=x(Ze=>{Object.defineProperty(Ze,"__esModule",{value:true});Ze.shouldUseRule=Ze.shouldUseGroup=Ze.schemaHasRulesForType=void 0;function sl({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==true&&Pa(e,n)}Ze.schemaHasRulesForType=sl;function Pa(e,t){return t.rules.some(r=>Oa(e,r))}Ze.shouldUseGroup=Pa;function Oa(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Ze.shouldUseRule=Oa;});var or=x(me=>{Object.defineProperty(me,"__esModule",{value:true});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var ol=fs(),al=ps(),il=sr(),L=G(),ja=H(),jt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong";})(jt||(me.DataType=jt={}));function ul(e){let t=Na(e.type);if(t.includes("null")){if(e.nullable===false)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===true&&t.push("null");}return t}me.getSchemaTypes=ul;function Na(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(ol.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}me.getJSONTypes=Na;function cl(e,t){let{gen:r,data:n,opts:s}=e,o=dl(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0, al.schemaHasRulesForType)(e,t[0]));if(a){let i=hs(t,n,s.strictNumbers,jt.Wrong);r.if(i,()=>{o.length?ll(e,t,o):gs(e);});}return a}me.coerceAndCheckDataType=cl;var qa=new Set(["string","number","integer","boolean","null"]);function dl(e,t){return t?e.filter(r=>qa.has(r)||t==="array"&&r==="array"):[]}function ll(e,t,r){let{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0, L._)`typeof ${s}`),i=n.let("coerced",(0, L._)`undefined`);o.coerceTypes==="array"&&n.if((0, L._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0, L._)`${s}[0]`).assign(a,(0, L._)`typeof ${s}`).if(hs(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0, L._)`${i} !== undefined`);for(let c of r)(qa.has(c)||c==="array"&&o.coerceTypes==="array")&&u(c);n.else(),gs(e),n.endIf(),n.if((0, L._)`${i} !== undefined`,()=>{n.assign(s,i),fl(e,i);});function u(c){switch(c){case "string":n.elseIf((0, L._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0, L._)`"" + ${s}`).elseIf((0, L._)`${s} === null`).assign(i,(0, L._)`""`);return;case "number":n.elseIf((0, L._)`${a} == "boolean" || ${s} === null
|
|
3
3
|
|| (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0, L._)`+${s}`);return;case "integer":n.elseIf((0, L._)`${a} === "boolean" || ${s} === null
|
|
4
4
|
|| (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0, L._)`+${s}`);return;case "boolean":n.elseIf((0, L._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,false).elseIf((0, L._)`${s} === "true" || ${s} === 1`).assign(i,true);return;case "null":n.elseIf((0, L._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case "array":n.elseIf((0, L._)`${a} === "string" || ${a} === "number"
|
|
5
|
-
|| ${a} === "boolean" || ${s} === null`).assign(i,(0, L._)`[${s}]`);}}}function el({gen:e,parentData:t,parentDataProperty:r},n){e.if((0, L._)`${t} !== undefined`,()=>e.assign((0, L._)`${t}[${r}]`,n));}function ds(e,t,r,n=Pt.Correct){let s=n===Pt.Correct?L.operators.EQ:L.operators.NEQ,o;switch(e){case "null":return (0, L._)`${t} ${s} null`;case "array":o=(0, L._)`Array.isArray(${t})`;break;case "object":o=(0, L._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case "integer":o=a((0, L._)`!(${t} % 1) && !isNaN(${t})`);break;case "number":o=a();break;default:return (0, L._)`typeof ${t} ${s} ${e}`}return n===Pt.Correct?o:(0, L.not)(o);function a(i=L.nil){return (0, L.and)((0, L._)`typeof ${t} == "number"`,i,r?(0, L._)`isFinite(${t})`:L.nil)}}me.checkDataType=ds;function ls(e,t,r,n){if(e.length===1)return ds(e[0],t,r,n);let s,o=(0, Ra.toHash)(e);if(o.array&&o.object){let a=(0, L._)`typeof ${t} != "object"`;s=o.null?a:(0, L._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object;}else s=L.nil;o.number&&delete o.integer;for(let a in o)s=(0, L.and)(s,ds(a,t,r,n));return s}me.checkDataTypes=ls;var tl={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0, L._)`{type: ${e}}`:(0, L._)`{type: ${t}}`};function fs(e){let t=rl(e);(0, Wd.reportError)(t,tl);}me.reportTypeError=fs;function rl(e){let{gen:t,data:r,schema:n}=e,s=(0, Ra.schemaRefOrVal)(e,n,"type");return {gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var xa=x(Gr=>{Object.defineProperty(Gr,"__esModule",{value:true});Gr.assignDefaults=void 0;var Ot=G(),nl=H();function sl(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)Ea(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Ea(e,o,s.default));}Gr.assignDefaults=sl;function Ea(e,t,r){let{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;let i=(0, Ot._)`${o}${(0, Ot.getProperty)(t)}`;if(s){(0, nl.checkStrictMode)(e,`default is ignored for: ${i}`);return}let u=(0, Ot._)`${i} === undefined`;a.useDefaults==="empty"&&(u=(0, Ot._)`${u} || ${i} === null || ${i} === ""`),n.if(u,(0, Ot._)`${i} = ${(0, Ot.stringify)(r)}`);}});var Te=x(X=>{Object.defineProperty(X,"__esModule",{value:true});X.validateUnion=X.validateArray=X.usePattern=X.callValidateCode=X.schemaProperties=X.allSchemaProperties=X.noPropertyInData=X.propertyInData=X.isOwnProperty=X.hasPropFunc=X.reportMissingProp=X.checkMissingProp=X.checkReportMissingProp=void 0;var ne=G(),ps=H(),Qe=Ue(),ol=H();function al(e,t){let{gen:r,data:n,it:s}=e;r.if(hs(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0, ne._)`${t}`},true),e.error();});}X.checkReportMissingProp=al;function il({gen:e,data:t,it:{opts:r}},n,s){return (0, ne.or)(...n.map(o=>(0, ne.and)(hs(e,t,o,r.ownProperties),(0, ne._)`${s} = ${o}`)))}X.checkMissingProp=il;function ul(e,t){e.setParams({missingProperty:t},true),e.error();}X.reportMissingProp=ul;function Ta(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, ne._)`Object.prototype.hasOwnProperty`})}X.hasPropFunc=Ta;function ms(e,t,r){return (0, ne._)`${Ta(e)}.call(${t}, ${r})`}X.isOwnProperty=ms;function cl(e,t,r,n){let s=(0, ne._)`${t}${(0, ne.getProperty)(r)} !== undefined`;return n?(0, ne._)`${s} && ${ms(e,t,r)}`:s}X.propertyInData=cl;function hs(e,t,r,n){let s=(0, ne._)`${t}${(0, ne.getProperty)(r)} === undefined`;return n?(0, ne.or)(s,(0, ne.not)(ms(e,t,r))):s}X.noPropertyInData=hs;function Aa(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}X.allSchemaProperties=Aa;function dl(e,t){return Aa(t).filter(r=>!(0, ps.alwaysValidSchema)(e,t[r]))}X.schemaProperties=dl;function ll({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,u,c){let l=c?(0, ne._)`${e}, ${t}, ${n}${s}`:t,d=[[Qe.default.instancePath,(0, ne.strConcat)(Qe.default.instancePath,o)],[Qe.default.parentData,a.parentData],[Qe.default.parentDataProperty,a.parentDataProperty],[Qe.default.rootData,Qe.default.rootData]];a.opts.dynamicRef&&d.push([Qe.default.dynamicAnchors,Qe.default.dynamicAnchors]);let v=(0, ne._)`${l}, ${r.object(...d)}`;return u!==ne.nil?(0, ne._)`${i}.call(${u}, ${v})`:(0, ne._)`${i}(${v})`}X.callValidateCode=ll;var fl=(0, ne._)`new RegExp`;function pl({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0, ne._)`${s.code==="new RegExp"?fl:(0, ol.useFunc)(e,s)}(${r}, ${n})`})}X.usePattern=pl;function ml(e){let{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){let i=t.let("valid",true);return a(()=>t.assign(i,false)),i}return t.var(o,true),a(()=>t.break()),o;function a(i){let u=t.const("len",(0, ne._)`${r}.length`);t.forRange("i",0,u,c=>{e.subschema({keyword:n,dataProp:c,dataPropType:ps.Type.Num},o),t.if((0, ne.not)(o),i);});}}X.validateArray=ml;function hl(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0, ps.alwaysValidSchema)(s,u))&&!s.opts.unevaluated)return;let a=t.let("valid",false),i=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:true},i);t.assign(a,(0, ne._)`${a} || ${i}`),e.mergeValidEvaluated(l,i)||t.if((0, ne.not)(a));})),e.result(a,()=>e.reset(),()=>e.error(true));}X.validateUnion=hl;});var Oa=x(Fe=>{Object.defineProperty(Fe,"__esModule",{value:true});Fe.validateKeywordUsage=Fe.validSchemaType=Fe.funcKeywordCode=Fe.macroKeywordCode=void 0;var ye=G(),vt=Ue(),gl=Te(),yl=rr();function vl(e,t){let{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),u=Pa(r,n,i);a.opts.validateSchema!==false&&a.self.validateSchema(i,true);let c=r.name("valid");e.subschema({schema:i,schemaPath:ye.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:true},c),e.pass(c,()=>e.error(true));}Fe.macroKeywordCode=vl;function bl(e,t){var r;let{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:u}=e;wl(u,t);let c=!i&&t.compile?t.compile.call(u.self,o,a,u):t.validate,l=Pa(n,s,c),d=n.let("valid");e.block$data(d,v),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function v(){if(t.errors===false)p(),t.modifying&&Ia(e),S(()=>e.error());else {let h=t.async?g():f();t.modifying&&Ia(e),S(()=>Sl(e,h));}}function g(){let h=n.let("ruleErrs",null);return n.try(()=>p((0, ye._)`await `),m=>n.assign(d,false).if((0, ye._)`${m} instanceof ${u.ValidationError}`,()=>n.assign(h,(0, ye._)`${m}.errors`),()=>n.throw(m))),h}function f(){let h=(0, ye._)`${l}.errors`;return n.assign(h,null),p(ye.nil),h}function p(h=t.async?(0, ye._)`await `:ye.nil){let m=u.opts.passContext?vt.default.this:vt.default.self,y=!("compile"in t&&!i||t.schema===false);n.assign(d,(0, ye._)`${h}${(0, gl.callValidateCode)(e,l,m,y)}`,t.modifying);}function S(h){var m;n.if((0, ye.not)((m=t.valid)!==null&&m!==void 0?m:d),h);}}Fe.funcKeywordCode=bl;function Ia(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0, ye._)`${n.parentData}[${n.parentDataProperty}]`));}function Sl(e,t){let{gen:r}=e;r.if((0, ye._)`Array.isArray(${t})`,()=>{r.assign(vt.default.vErrors,(0, ye._)`${vt.default.vErrors} === null ? ${t} : ${vt.default.vErrors}.concat(${t})`).assign(vt.default.errors,(0, ye._)`${vt.default.vErrors}.length`),(0, yl.extendErrors)(e);},()=>e.error());}function wl({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Pa(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, ye.stringify)(r)})}function kl(e,t,r=false){return !t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Fe.validSchemaType=kl;function _l({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let a=s.dependencies;if(a?.some(i=>!Object.prototype.hasOwnProperty.call(e,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){let u=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}Fe.validateKeywordUsage=_l;});var Na=x(Ze=>{Object.defineProperty(Ze,"__esModule",{value:true});Ze.extendSubschemaMode=Ze.extendSubschemaData=Ze.getSubschema=void 0;var Me=G(),ja=H();function Rl(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let i=e.schema[t];return r===void 0?{schema:i,schemaPath:(0, Me._)`${e.schemaPath}${(0, Me.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0, Me._)`${e.schemaPath}${(0, Me.getProperty)(t)}${(0, Me.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0, ja.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return {schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Ze.getSubschema=Rl;function Cl(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:a}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,v=i.let("data",(0, Me._)`${t.data}${(0, Me.getProperty)(r)}`,true);u(v),e.errorPath=(0, Me.str)`${c}${(0, ja.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0, Me._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty];}if(s!==void 0){let c=s instanceof Me.Name?s:i.let("data",s,true);u(c),a!==void 0&&(e.propertyName=a);}o&&(e.dataTypes=o);function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c];}}Ze.extendSubschemaData=Cl;function $l(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r;}Ze.extendSubschemaMode=$l;});var gs=x(($y,qa)=>{qa.exports=function e(t,r){if(t===r)return true;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return false;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return false;for(s=n;s--!==0;)if(!e(t[s],r[s]))return false;return true}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),n=o.length,n!==Object.keys(r).length)return false;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return false;for(s=n;s--!==0;){var a=o[s];if(!e(t[a],r[a]))return false}return true}return t!==t&&r!==r};});var Fa=x((Ey,Da)=>{var et=Da.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Kr(t,n,s,e,"",e);};et.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};et.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};et.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};et.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function Kr(e,t,r,n,s,o,a,i,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,u,c);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in et.arrayKeywords)for(var v=0;v<d.length;v++)Kr(e,t,r,d[v],s+"/"+l+"/"+v,o,s,l,n,v);}else if(l in et.propsKeywords){if(d&&typeof d=="object")for(var g in d)Kr(e,t,r,d[g],s+"/"+l+"/"+El(g),o,s,l,n,g);}else (l in et.keywords||e.allKeys&&!(l in et.skipKeywords))&&Kr(e,t,r,d,s+"/"+l,o,s,l,n);}r(n,s,o,a,i,u,c);}}function El(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var sr=x(Se=>{Object.defineProperty(Se,"__esModule",{value:true});Se.getSchemaRefs=Se.resolveUrl=Se.normalizeId=Se._getFullPath=Se.getFullPath=Se.inlineRef=void 0;var xl=H(),Tl=gs(),Al=Fa(),Il=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Pl(e,t=true){return typeof e=="boolean"?true:t===true?!ys(e):t?Ma(e)<=t:false}Se.inlineRef=Pl;var Ol=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ys(e){for(let t in e){if(Ol.has(t))return true;let r=e[t];if(Array.isArray(r)&&r.some(ys)||typeof r=="object"&&ys(r))return true}return false}function Ma(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Il.has(r)&&(typeof e[r]=="object"&&(0, xl.eachItem)(e[r],n=>t+=Ma(n)),t===1/0))return 1/0}return t}function La(e,t="",r){r!==false&&(t=jt(t));let n=e.parse(t);return Va(e,n)}Se.getFullPath=La;function Va(e,t){return e.serialize(t).split("#")[0]+"#"}Se._getFullPath=Va;var jl=/#\/?$/;function jt(e){return e?e.replace(jl,""):""}Se.normalizeId=jt;function Nl(e,t,r){return r=jt(r),e.resolve(t,r)}Se.resolveUrl=Nl;var ql=/^[a-z_][-a-z0-9._]*$/i;function Dl(e,t){if(typeof e=="boolean")return {};let{schemaId:r,uriResolver:n}=this.opts,s=jt(e[r]||t),o={"":s},a=La(n,s,false),i={},u=new Set;return Al(e,{allKeys:true},(d,v,g,f)=>{if(f===void 0)return;let p=a+v,S=o[f];typeof d[r]=="string"&&(S=h.call(this,d[r])),m.call(this,d.$anchor),m.call(this,d.$dynamicAnchor),o[v]=S;function h(y){let k=this.opts.uriResolver.resolve;if(y=jt(S?k(S,y):y),u.has(y))throw l(y);u.add(y);let w=this.refs[y];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?c(d,w.schema,y):y!==jt(p)&&(y[0]==="#"?(c(d,i[y],y),i[y]=d):this.refs[y]=p),y}function m(y){if(typeof y=="string"){if(!ql.test(y))throw new Error(`invalid anchor "${y}"`);h.call(this,`#${y}`);}}}),i;function c(d,v,g){if(v!==void 0&&!Tl(d,v))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Se.getSchemaRefs=Dl;});var ir=x(tt=>{Object.defineProperty(tt,"__esModule",{value:true});tt.getData=tt.KeywordCxt=tt.validateFunctionCode=void 0;var Ja=wa(),Ba=nr(),bs=cs(),Ur=nr(),Fl=xa(),ar=Oa(),vs=Na(),T=G(),O=Ue(),Ml=sr(),Je=H(),or=rr();function Ll(e){if(Wa(e)&&(Ya(e),za(e))){Gl(e);return}Ha(e,()=>(0, Ja.topBoolOrEmptySchema)(e));}tt.validateFunctionCode=Ll;function Ha({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0, T._)`${O.default.data}, ${O.default.valCxt}`,n.$async,()=>{e.code((0, T._)`"use strict"; ${Ga(r,s)}`),Bl(e,s),e.code(o);}):e.func(t,(0, T._)`${O.default.data}, ${Vl(s)}`,n.$async,()=>e.code(Ga(r,s)).code(o));}function Vl(e){return (0, T._)`{${O.default.instancePath}="", ${O.default.parentData}, ${O.default.parentDataProperty}, ${O.default.rootData}=${O.default.data}${e.dynamicRef?(0, T._)`, ${O.default.dynamicAnchors}={}`:T.nil}}={}`}function Bl(e,t){e.if(O.default.valCxt,()=>{e.var(O.default.instancePath,(0, T._)`${O.default.valCxt}.${O.default.instancePath}`),e.var(O.default.parentData,(0, T._)`${O.default.valCxt}.${O.default.parentData}`),e.var(O.default.parentDataProperty,(0, T._)`${O.default.valCxt}.${O.default.parentDataProperty}`),e.var(O.default.rootData,(0, T._)`${O.default.valCxt}.${O.default.rootData}`),t.dynamicRef&&e.var(O.default.dynamicAnchors,(0, T._)`${O.default.valCxt}.${O.default.dynamicAnchors}`);},()=>{e.var(O.default.instancePath,(0, T._)`""`),e.var(O.default.parentData,(0, T._)`undefined`),e.var(O.default.parentDataProperty,(0, T._)`undefined`),e.var(O.default.rootData,O.default.data),t.dynamicRef&&e.var(O.default.dynamicAnchors,(0, T._)`{}`);});}function Gl(e){let{schema:t,opts:r,gen:n}=e;Ha(e,()=>{r.$comment&&t.$comment&&Qa(e),zl(e),n.let(O.default.vErrors,null),n.let(O.default.errors,0),r.unevaluated&&Kl(e),Xa(e),Xl(e);});}function Kl(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0, T._)`${r}.evaluated`),t.if((0, T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0, T._)`${e.evaluated}.props`,(0, T._)`undefined`)),t.if((0, T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0, T._)`${e.evaluated}.items`,(0, T._)`undefined`));}function Ga(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0, T._)`/*# sourceURL=${r} */`:T.nil}function Ul(e,t){if(Wa(e)&&(Ya(e),za(e))){Jl(e,t);return}(0, Ja.boolOrEmptySchema)(e,t);}function za({schema:e,self:t}){if(typeof e=="boolean")return !e;for(let r in e)if(t.RULES.all[r])return true;return false}function Wa(e){return typeof e.schema!="boolean"}function Jl(e,t){let{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&Qa(e),Wl(e),Yl(e);let o=n.const("_errs",O.default.errors);Xa(e,o),n.var(t,(0, T._)`${o} === ${O.default.errors}`);}function Ya(e){(0, Je.checkUnknownRules)(e),Hl(e);}function Xa(e,t){if(e.opts.jtd)return Ka(e,[],false,t);let r=(0, Ba.getSchemaTypes)(e.schema),n=(0, Ba.coerceAndCheckDataType)(e,r);Ka(e,r,!n,t);}function Hl(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0, Je.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function zl(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, Je.checkStrictMode)(e,"default is ignored in the schema root");}function Wl(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0, Ml.resolveUrl)(e.opts.uriResolver,e.baseId,t));}function Yl(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Qa({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===true)e.code((0, T._)`${O.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let a=(0, T.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0, T._)`${O.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`);}}function Xl(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0, T._)`${O.default.errors} === 0`,()=>t.return(O.default.data),()=>t.throw((0, T._)`new ${s}(${O.default.vErrors})`)):(t.assign((0, T._)`${n}.errors`,O.default.vErrors),o.unevaluated&&Ql(e),t.return((0, T._)`${O.default.errors} === 0`));}function Ql({gen:e,evaluated:t,props:r,items:n}){r instanceof T.Name&&e.assign((0, T._)`${t}.props`,r),n instanceof T.Name&&e.assign((0, T._)`${t}.items`,n);}function Ka(e,t,r,n){let{gen:s,schema:o,data:a,allErrors:i,opts:u,self:c}=e,{RULES:l}=c;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0, Je.schemaHasRulesButRef)(o,l))){s.block(()=>ei(e,"$ref",l.all.$ref.definition));return}u.jtd||Zl(e,t),s.block(()=>{for(let v of l.rules)d(v);d(l.post);});function d(v){(0, bs.shouldUseGroup)(o,v)&&(v.type?(s.if((0, Ur.checkDataType)(v.type,a,u.strictNumbers)),Ua(e,v),t.length===1&&t[0]===v.type&&r&&(s.else(),(0, Ur.reportTypeError)(e)),s.endIf()):Ua(e,v),i||s.if((0, T._)`${O.default.errors} === ${n||0}`));}}function Ua(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0, Fl.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0, bs.shouldUseRule)(n,o)&&ei(e,o.keyword,o.definition,t.type);});}function Zl(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(ef(e,t),e.opts.allowUnionTypes||tf(e,t),rf(e,e.dataTypes));}function ef(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Za(e.dataTypes,r)||Ss(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`);}),sf(e,t);}}function tf(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Ss(e,"use allowUnionTypes to allow union type keyword");}function rf(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0, bs.shouldUseRule)(e.schema,s)){let{type:o}=s.definition;o.length&&!o.some(a=>nf(t,a))&&Ss(e,`missing type "${o.join(",")}" for keyword "${n}"`);}}}function nf(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Za(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function sf(e,t){let r=[];for(let n of e.dataTypes)Za(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r;}function Ss(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0, Je.checkStrictMode)(e,t,e.opts.strictTypes);}var Jr=class{constructor(t,r,n){if((0, ar.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0, Je.schemaRefOrVal)(t,this.schema,n,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",ti(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0, ar.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==false)&&(this.errsCount=t.gen.const("_errs",O.default.errors));}result(t,r,n){this.failResult((0, T.not)(t),r,n);}failResult(t,r,n){this.gen.if(t),n?n():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, T.not)(t),void 0,r);}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(false);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, T._)`${r} !== undefined && (${(0, T.or)(this.invalid$data(),t)})`);}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n);}_error(t,r){(t?or.reportExtraError:or.reportError)(this,this.def.error,r);}$dataError(){(0, or.reportError)(this,this.def.$dataError||or.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, or.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,n=T.nil){this.gen.block(()=>{this.check$data(t,n),r();});}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0, T.or)((0, T._)`${s} === undefined`,r)),t!==T.nil&&n.assign(t,true),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&n.assign(t,false)),n.else();}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return (0, T.or)(a(),i());function a(){if(n.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let u=Array.isArray(n)?n:[n];return (0, T._)`${(0, Ur.checkDataTypes)(u,r,o.opts.strictNumbers,Ur.DataType.Wrong)}`}return T.nil}function i(){if(s.validateSchema){let u=t.scopeValue("validate$data",{ref:s.validateSchema});return (0, T._)`!${u}(${r})`}return T.nil}}subschema(t,r){let n=(0, vs.getSubschema)(this.it,t);(0, vs.extendSubschemaData)(n,this.it,t),(0, vs.extendSubschemaMode)(n,t);let s={...this.it,...n,items:void 0,props:void 0};return Ul(s,r),s}mergeEvaluated(t,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==true&&t.props!==void 0&&(n.props=Je.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==true&&t.items!==void 0&&(n.items=Je.mergeEvaluated.items(s,t.items,n.items,r)));}mergeValidEvaluated(t,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==true||n.items!==true))return s.if(r,()=>this.mergeEvaluated(t,T.Name)),true}};tt.KeywordCxt=Jr;function ei(e,t,r,n){let s=new Jr(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0, ar.funcKeywordCode)(s,r):"macro"in r?(0, ar.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0, ar.funcKeywordCode)(s,r);}var of=/^\/(?:[^~]|~0|~1)*$/,af=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ti(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return O.default.rootData;if(e[0]==="/"){if(!of.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=O.default.rootData;}else {let c=af.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(s=c[2],s==="#"){if(l>=t)throw new Error(u("property/index",l));return n[t-l]}if(l>t)throw new Error(u("data",l));if(o=r[t-l],!s)return o}let a=o,i=s.split("/");for(let c of i)c&&(o=(0, T._)`${o}${(0, T.getProperty)((0, Je.unescapeJsonPointer)(c))}`,a=(0, T._)`${a} && ${o}`);return a;function u(c,l){return `Cannot access ${c} ${l} levels up, current level is ${t}`}}tt.getData=ti;});var Hr=x(ks=>{Object.defineProperty(ks,"__esModule",{value:true});var ws=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=true;}};ks.default=ws;});var ur=x(Cs=>{Object.defineProperty(Cs,"__esModule",{value:true});var _s=sr(),Rs=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0, _s.resolveUrl)(t,r,n),this.missingSchema=(0, _s.normalizeId)((0, _s.getFullPath)(t,this.missingRef));}};Cs.default=Rs;});var Wr=x(Ae=>{Object.defineProperty(Ae,"__esModule",{value:true});Ae.resolveSchema=Ae.getCompilingSchema=Ae.resolveRef=Ae.compileSchema=Ae.SchemaEnv=void 0;var Oe=G(),uf=Hr(),bt=Ue(),je=sr(),ri=H(),cf=ir(),Nt=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=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, je.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={};}};Ae.SchemaEnv=Nt;function Es(e){let t=ni.call(this,e);if(t)return t;let r=(0, je.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new Oe.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),i;e.$async&&(i=a.scopeValue("Error",{ref:uf.default,code:(0, Oe._)`require("ajv/dist/runtime/validation_error").default`}));let u=a.scopeName("validate");e.validateName=u;let c={gen:a,allErrors:this.opts.allErrors,data:bt.default.data,parentData:bt.default.parentData,parentDataProperty:bt.default.parentDataProperty,dataNames:[bt.default.data],dataPathArr:[Oe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0, Oe.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Oe.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, Oe._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,cf.validateFunctionCode)(c),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(bt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let g=new Function(`${bt.default.self}`,`${bt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:g}),g.errors=null,g.schema=e.schema,g.schemaEnv=e,e.$async&&(g.$async=!0),this.opts.code.source===!0&&(g.source={validateName:u,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:f,items:p}=c;g.evaluated={props:f instanceof Oe.Name?void 0:f,items:p instanceof Oe.Name?void 0:p,dynamicProps:f instanceof Oe.Name,dynamicItems:p instanceof Oe.Name},g.source&&(g.source.evaluated=(0,Oe.stringify)(g.evaluated));}return e.validate=g,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e);}}Ae.compileSchema=Es;function df(e,t,r){var n;r=(0, je.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=pf.call(this,e,r);if(o===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:i}=this.opts;a&&(o=new Nt({schema:a,schemaId:i,root:e,baseId:t}));}if(o!==void 0)return e.refs[r]=lf.call(this,o)}Ae.resolveRef=df;function lf(e){return (0, je.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Es.call(this,e)}function ni(e){for(let t of this._compilations)if(ff(t,e))return t}Ae.getCompilingSchema=ni;function ff(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function pf(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||zr.call(this,e,t)}function zr(e,t){let r=this.opts.uriResolver.parse(t),n=(0, je._getFullPath)(this.opts.uriResolver,r),s=(0, je.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return $s.call(this,r,e);let o=(0, je.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=zr.call(this,e,a);return typeof i?.schema!="object"?void 0:$s.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Es.call(this,a),o===(0, je.normalizeId)(t)){let{schema:i}=a,{schemaId:u}=this.opts,c=i[u];return c&&(s=(0, je.resolveUrl)(this.opts.uriResolver,s,c)),new Nt({schema:i,schemaId:u,root:e,baseId:s})}return $s.call(this,r,a)}}Ae.resolveSchema=zr;var mf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $s(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let i of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0, ri.unescapeFragment)(i)];if(u===void 0)return;r=u;let c=typeof r=="object"&&r[this.opts.schemaId];!mf.has(i)&&c&&(t=(0, je.resolveUrl)(this.opts.uriResolver,t,c));}let o;if(typeof r!="boolean"&&r.$ref&&!(0, ri.schemaHasRulesButRef)(r,this.RULES)){let i=(0, je.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=zr.call(this,n,i);}let{schemaId:a}=this.opts;if(o=o||new Nt({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var si=x((Oy,hf)=>{hf.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:false};});var Ts=x((jy,ui)=>{var gf=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ai=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);function xs(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";t+=e[n];}return t}var yf=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function oi(e){return e.length=0,true}function vf(e,t,r){if(e.length){let n=xs(e);if(n!=="")t.push(n);else return r.error=true,false;e.length=0;}return true}function bf(e){let t=0,r={error:false,address:"",zone:""},n=[],s=[],o=false,a=false,i=vf;for(let u=0;u<e.length;u++){let c=e[u];if(!(c==="["||c==="]"))if(c===":"){if(o===true&&(a=true),!i(s,n,r))break;if(++t>7){r.error=true;break}u>0&&e[u-1]===":"&&(o=true),n.push(":");continue}else if(c==="%"){if(!i(s,n,r))break;i=oi;}else {s.push(c);continue}}return s.length&&(i===oi?r.zone=s.join(""):a?n.push(s.join("")):n.push(xs(s))),r.address=n.join(""),r}function ii(e){if(Sf(e,":")<2)return {host:e,isIPV6:false};let t=bf(e);if(t.error)return {host:e,isIPV6:false};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:true,escapedHost:n}}}function Sf(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function wf(e){let t=e,r=[],n=-1,s=0;for(;s=t.length;){if(s===1){if(t===".")break;if(t==="/"){r.push("/");break}else {r.push(t);break}}else if(s===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(s===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((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n);}return r.join("")}function kf(e,t){let r=t!==true?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function _f(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!ai(r)){let n=ii(r);n.isIPV6===true?r=`[${n.escapedHost}]`:r=e.host;}t.push(r);}return (typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}ui.exports={nonSimpleDomain:yf,recomposeAuthority:_f,normalizeComponentEncoding:kf,removeDotSegments:wf,isIPv4:ai,isUUID:gf,normalizeIPv6:ii,stringArrayToHexStripped:xs};});var pi=x((Ny,fi)=>{var{isUUID:Rf}=Ts(),Cf=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,$f=["http","https","ws","wss","urn","urn:uuid"];function Ef(e){return $f.indexOf(e)!==-1}function As(e){return e.secure===true?true:e.secure===false?false: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"):false}function ci(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function di(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 xf(e){return e.secure=As(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Tf(e){if((e.port===(As(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,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0;}return e.fragment=void 0,e}function Af(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Cf);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,o=Is(s);e.path=void 0,o&&(e=o.parse(e,t));}else e.error=e.error||"URN can not be parsed.";return e}function If(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,o=Is(s);o&&(e=o.serialize(e,t));let a=e,i=e.nss;return a.path=`${n||t.nid}:${i}`,t.skipEscape=true,a}function Pf(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Rf(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Of(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var li={scheme:"http",domainHost:true,parse:ci,serialize:di},jf={scheme:"https",domainHost:li.domainHost,parse:ci,serialize:di},Yr={scheme:"ws",domainHost:true,parse:xf,serialize:Tf},Nf={scheme:"wss",domainHost:Yr.domainHost,parse:Yr.parse,serialize:Yr.serialize},qf={scheme:"urn",parse:Af,serialize:If,skipNormalize:true},Df={scheme:"urn:uuid",parse:Pf,serialize:Of,skipNormalize:true},Xr={http:li,https:jf,ws:Yr,wss:Nf,urn:qf,"urn:uuid":Df};Object.setPrototypeOf(Xr,null);function Is(e){return e&&(Xr[e]||Xr[e.toLowerCase()])||void 0}fi.exports={wsIsSecure:As,SCHEMES:Xr,isValidSchemeName:Ef,getSchemeHandler:Is};});var gi=x((qy,Zr)=>{var{normalizeIPv6:Ff,removeDotSegments:cr,recomposeAuthority:Mf,normalizeComponentEncoding:Qr,isIPv4:Lf,nonSimpleDomain:Vf}=Ts(),{SCHEMES:Bf,getSchemeHandler:mi}=pi();function Gf(e,t){return typeof e=="string"?e=Le(He(e,t),t):typeof e=="object"&&(e=He(Le(e,t),t)),e}function Kf(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=hi(He(e,n),He(t,n),n,true);return n.skipEscape=true,Le(s,n)}function hi(e,t,r,n){let s={};return n||(e=He(Le(e,r),r),t=He(Le(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=cr(t.path||""),s.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=cr(t.path||""),s.query=t.query):(t.path?(t.path[0]==="/"?s.path=cr(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?s.path="/"+t.path:e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path,s.path=cr(s.path)),s.query=t.query):(s.path=e.path,t.query!==void 0?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function Uf(e,t,r){return typeof e=="string"?(e=unescape(e),e=Le(Qr(He(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=Le(Qr(e,true),{...r,skipEscape:true})),typeof t=="string"?(t=unescape(t),t=Le(Qr(He(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=Le(Qr(t,true),{...r,skipEscape:true})),e.toLowerCase()===t.toLowerCase()}function Le(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:""},n=Object.assign({},t),s=[],o=mi(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let a=Mf(r);if(a!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(a),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let i=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(i=cr(i)),a===void 0&&i[0]==="/"&&i[1]==="/"&&(i="/%2F"+i.slice(2)),s.push(i);}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var Jf=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function He(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=false;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(Jf);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(Lf(n.host)===false){let u=Ff(n.host);n.host=u.host.toLowerCase(),s=u.isIPV6;}else s=true;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=mi(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===false&&Vf(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase());}catch(i){n.error=n.error||"Host's domain name can not be converted to ASCII: "+i;}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r);}else n.error=n.error||"URI can not be parsed.";return n}var Ps={SCHEMES:Bf,normalize:Gf,resolve:Kf,resolveComponent:hi,equal:Uf,serialize:Le,parse:He};Zr.exports=Ps;Zr.exports.default=Ps;Zr.exports.fastUri=Ps;});var vi=x(Os=>{Object.defineProperty(Os,"__esModule",{value:true});var yi=gi();yi.code='require("ajv/dist/runtime/uri").default';Os.default=yi;});var $i=x(de=>{Object.defineProperty(de,"__esModule",{value:true});de.CodeGen=de.Name=de.nil=de.stringify=de.str=de._=de.KeywordCxt=void 0;var Hf=ir();Object.defineProperty(de,"KeywordCxt",{enumerable:true,get:function(){return Hf.KeywordCxt}});var qt=G();Object.defineProperty(de,"_",{enumerable:true,get:function(){return qt._}});Object.defineProperty(de,"str",{enumerable:true,get:function(){return qt.str}});Object.defineProperty(de,"stringify",{enumerable:true,get:function(){return qt.stringify}});Object.defineProperty(de,"nil",{enumerable:true,get:function(){return qt.nil}});Object.defineProperty(de,"Name",{enumerable:true,get:function(){return qt.Name}});Object.defineProperty(de,"CodeGen",{enumerable:true,get:function(){return qt.CodeGen}});var zf=Hr(),_i=ur(),Wf=us(),dr=Wr(),Yf=G(),lr=sr(),en=nr(),Ns=H(),bi=si(),Xf=vi(),Ri=(e,t)=>new RegExp(e,t);Ri.code="new RegExp";var Qf=["removeAdditional","useDefaults","coerceTypes"],Zf=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ep={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."},tp={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Si=200;function rp(e){var t,r,n,s,o,a,i,u,c,l,d,v,g,f,p,S,h,m,y,k,w,C,_,$,N;let q=e.strict,F=(t=e.code)===null||t===void 0?void 0:t.optimize,re=F===true||F===void 0?1:F||0,U=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ri,ce=(s=e.uriResolver)!==null&&s!==void 0?s:Xf.default;return {strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:q)!==null&&a!==void 0?a:true,strictNumbers:(u=(i=e.strictNumbers)!==null&&i!==void 0?i:q)!==null&&u!==void 0?u:true,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:q)!==null&&l!==void 0?l:"log",strictTuples:(v=(d=e.strictTuples)!==null&&d!==void 0?d:q)!==null&&v!==void 0?v:"log",strictRequired:(f=(g=e.strictRequired)!==null&&g!==void 0?g:q)!==null&&f!==void 0?f:false,code:e.code?{...e.code,optimize:re,regExp:U}:{optimize:re,regExp:U},loopRequired:(p=e.loopRequired)!==null&&p!==void 0?p:Si,loopEnum:(S=e.loopEnum)!==null&&S!==void 0?S:Si,meta:(h=e.meta)!==null&&h!==void 0?h:true,messages:(m=e.messages)!==null&&m!==void 0?m:true,inlineRefs:(y=e.inlineRefs)!==null&&y!==void 0?y:true,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:true,validateSchema:(C=e.validateSchema)!==null&&C!==void 0?C:true,validateFormats:(_=e.validateFormats)!==null&&_!==void 0?_:true,unicodeRegExp:($=e.unicodeRegExp)!==null&&$!==void 0?$:true,int32range:(N=e.int32range)!==null&&N!==void 0?N:true,uriResolver:ce}}var fr=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...rp(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Yf.ValueScope({scope:{},prefixes:Zf,es5:r,lines:n}),this.logger=up(t.logger);let s=t.validateFormats;t.validateFormats=false,this.RULES=(0, Wf.getRules)(),wi.call(this,ep,t,"NOT SUPPORTED"),wi.call(this,tp,t,"DEPRECATED","warn"),this._metaOpts=ap.call(this),t.formats&&sp.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&op.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),np.call(this),t.validateFormats=s;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,s=bi;n==="id"&&(s={...bi},s.id=s.$id,delete s.$id),r&&t&&this.addMetaSchema(s,s[n],false);}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let s=n(r);return "$async"in n||(this.errors=n.errors),s}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,t,r);async function s(l,d){await o.call(this,l.$schema);let v=this._addSchema(l,d);return v.validate||a.call(this,v)}async function o(l){l&&!this.getSchema(l)&&await s.call(this,{$ref:l},true);}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof _i.default))throw d;return i.call(this,d),await u.call(this,d.missingSchema),a.call(this,l)}}function i({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function u(l){let d=await c.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r);}async function c(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l];}}}addSchema(t,r,n,s=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,s);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0, lr.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,s,true),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,true,n),this}validateSchema(t,r){if(typeof t=="boolean")return true;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,true;let s=this.validate(n,t);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(t){let r;for(;typeof(r=ki.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,s=new dr.SchemaEnv({schema:{},schemaId:n});if(r=dr.resolveSchema.call(this,s,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=ki.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 n=t[this.opts.schemaId];return n&&(n=(0, lr.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(dp.call(this,n,r),!r)return (0, Ns.eachItem)(n,o=>js.call(this,o)),this;fp.call(this,r);let s={...r,type:(0, en.getJSONTypes)(r.type),schemaType:(0, en.getJSONTypes)(r.schemaType)};return (0, Ns.eachItem)(n,s.type.length===0?o=>js.call(this,o,s):o=>s.type.forEach(a=>js.call(this,o,s,a))),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 n of r.rules){let s=n.rules.findIndex(o=>o.keyword===t);s>=0&&n.rules.splice(s,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:n="data"}={}){return !t||t.length===0?"No errors":t.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let s of r){let o=s.split("/").slice(1),a=t;for(let i of o)a=a[i];for(let i in n){let u=n[i];if(typeof u!="object")continue;let{$data:c}=u.definition,l=a[i];c&&l&&(a[i]=Ci(l));}}return t}_removeAllSchemas(t,r){for(let n in t){let s=t[n];(!r||r.test(n))&&(typeof s=="string"?delete t[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete t[n]));}}_addSchema(t,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:i}=this.opts;if(typeof t=="object")a=t[i];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 u=this._cache.get(t);if(u!==void 0)return u;n=(0, lr.normalizeId)(a||n);let c=lr.getSchemaRefs.call(this,t,n);return u=new dr.SchemaEnv({schema:t,schemaId:i,meta:r,baseId:n,localRefs:c}),this._cache.set(u.schema,u),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=u),s&&this.validateSchema(t,true),u}_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):dr.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{dr.compileSchema.call(this,t);}finally{this.opts=r;}}};fr.ValidationError=zf.default;fr.MissingRefError=_i.default;de.default=fr;function wi(e,t,r,n="error"){for(let s in e){let o=s;o in t&&this.logger[n](`${r}: option ${s}. ${e[o]}`);}}function ki(e){return e=(0, lr.normalizeId)(e),this.schemas[e]||this.refs[e]}function np(){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 sp(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t);}}function op(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 ap(){let e={...this.opts};for(let t of Qf)delete e[t];return e}var ip={log(){},warn(){},error(){}};function up(e){if(e===false)return ip;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 cp=/^[a-z_$][a-z0-9_$:-]*$/i;function dp(e,t){let{RULES:r}=this;if((0, Ns.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!cp.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function js(e,t,r){var n;let s=t?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=s?o.post:o.rules.find(({type:u})=>u===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=true,!t)return;let i={keyword:e,definition:{...t,type:(0, en.getJSONTypes)(t.type),schemaType:(0, en.getJSONTypes)(t.schemaType)}};t.before?lp.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,(n=t.implements)===null||n===void 0||n.forEach(u=>this.addKeyword(u));}function lp(e,t,r){let n=e.rules.findIndex(s=>s.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`));}function fp(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ci(t)),e.validateSchema=this.compile(t,true));}var pp={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ci(e){return {anyOf:[e,pp]}}});var Ei=x(qs=>{Object.defineProperty(qs,"__esModule",{value:true});var mp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};qs.default=mp;});var Ii=x(St=>{Object.defineProperty(St,"__esModule",{value:true});St.callRef=St.getValidate=void 0;var hp=ur(),xi=Te(),we=G(),Dt=Ue(),Ti=Wr(),tn=H(),gp={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:u}=n,{root:c}=o;if((r==="#"||r==="#/")&&s===c.baseId)return d();let l=Ti.resolveRef.call(u,c,s,r);if(l===void 0)throw new hp.default(n.opts.uriResolver,s,r);if(l instanceof Ti.SchemaEnv)return v(l);return g(l);function d(){if(o===c)return rn(e,a,o,o.$async);let f=t.scopeValue("root",{ref:c});return rn(e,(0, we._)`${f}.validate`,c,c.$async)}function v(f){let p=Ai(e,f);rn(e,p,f,f.$async);}function g(f){let p=t.scopeValue("schema",i.code.source===true?{ref:f,code:(0, we.stringify)(f)}:{ref:f}),S=t.name("valid"),h=e.subschema({schema:f,dataTypes:[],schemaPath:we.nil,topSchemaRef:p,errSchemaPath:r},S);e.mergeEvaluated(h),e.ok(S);}}};function Ai(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0, we._)`${r.scopeValue("wrapper",{ref:t})}.validate`}St.getValidate=Ai;function rn(e,t,r,n){let{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:u}=o,c=u.passContext?Dt.default.this:we.nil;n?l():d();function l(){if(!i.$async)throw new Error("async schema referenced by sync schema");let f=s.let("valid");s.try(()=>{s.code((0, we._)`await ${(0, xi.callValidateCode)(e,t,c)}`),g(t),a||s.assign(f,true);},p=>{s.if((0, we._)`!(${p} instanceof ${o.ValidationError})`,()=>s.throw(p)),v(p),a||s.assign(f,false);}),e.ok(f);}function d(){e.result((0, xi.callValidateCode)(e,t,c),()=>g(t),()=>v(t));}function v(f){let p=(0, we._)`${f}.errors`;s.assign(Dt.default.vErrors,(0, we._)`${Dt.default.vErrors} === null ? ${p} : ${Dt.default.vErrors}.concat(${p})`),s.assign(Dt.default.errors,(0, we._)`${Dt.default.vErrors}.length`);}function g(f){var p;if(!o.opts.unevaluated)return;let S=(p=r?.validate)===null||p===void 0?void 0:p.evaluated;if(o.props!==true)if(S&&!S.dynamicProps)S.props!==void 0&&(o.props=tn.mergeEvaluated.props(s,S.props,o.props));else {let h=s.var("props",(0, we._)`${f}.evaluated.props`);o.props=tn.mergeEvaluated.props(s,h,o.props,we.Name);}if(o.items!==true)if(S&&!S.dynamicItems)S.items!==void 0&&(o.items=tn.mergeEvaluated.items(s,S.items,o.items));else {let h=s.var("items",(0, we._)`${f}.evaluated.items`);o.items=tn.mergeEvaluated.items(s,h,o.items,we.Name);}}}St.callRef=rn;St.default=gp;});var Pi=x(Ds=>{Object.defineProperty(Ds,"__esModule",{value:true});var yp=Ei(),vp=Ii(),bp=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yp.default,vp.default];Ds.default=bp;});var Oi=x(Fs=>{Object.defineProperty(Fs,"__esModule",{value:true});var nn=G(),rt=nn.operators,sn={maximum:{okStr:"<=",ok:rt.LTE,fail:rt.GT},minimum:{okStr:">=",ok:rt.GTE,fail:rt.LT},exclusiveMaximum:{okStr:"<",ok:rt.LT,fail:rt.GTE},exclusiveMinimum:{okStr:">",ok:rt.GT,fail:rt.LTE}},Sp={message:({keyword:e,schemaCode:t})=>(0, nn.str)`must be ${sn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0, nn._)`{comparison: ${sn[e].okStr}, limit: ${t}}`},wp={keyword:Object.keys(sn),type:"number",schemaType:"number",$data:true,error:Sp,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0, nn._)`${r} ${sn[t].fail} ${n} || isNaN(${r})`);}};Fs.default=wp;});var ji=x(Ms=>{Object.defineProperty(Ms,"__esModule",{value:true});var pr=G(),kp={message:({schemaCode:e})=>(0, pr.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0, pr._)`{multipleOf: ${e}}`},_p={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:kp,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0, pr._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0, pr._)`${a} !== parseInt(${a})`;e.fail$data((0, pr._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`);}};Ms.default=_p;});var qi=x(Ls=>{Object.defineProperty(Ls,"__esModule",{value:true});function Ni(e){let t=e.length,r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}Ls.default=Ni;Ni.code='require("ajv/dist/runtime/ucs2length").default';});var Di=x(Vs=>{Object.defineProperty(Vs,"__esModule",{value:true});var wt=G(),Rp=H(),Cp=qi(),$p={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return (0, wt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0, wt._)`{limit: ${e}}`},Ep={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:$p,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?wt.operators.GT:wt.operators.LT,a=s.opts.unicode===false?(0, wt._)`${r}.length`:(0, wt._)`${(0, Rp.useFunc)(e.gen,Cp.default)}(${r})`;e.fail$data((0, wt._)`${a} ${o} ${n}`);}};Vs.default=Ep;});var Fi=x(Bs=>{Object.defineProperty(Bs,"__esModule",{value:true});var xp=Te(),Tp=H(),Ft=G(),Ap={message:({schemaCode:e})=>(0, Ft.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0, Ft._)`{pattern: ${e}}`},Ip={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:Ap,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e,i=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:u}=a.opts.code,c=u.code==="new RegExp"?(0, Ft._)`new RegExp`:(0, Tp.useFunc)(t,u),l=t.let("valid");t.try(()=>t.assign(l,(0, Ft._)`${c}(${o}, ${i}).test(${r})`),()=>t.assign(l,false)),e.fail$data((0, Ft._)`!${l}`);}else {let u=(0, xp.usePattern)(e,s);e.fail$data((0, Ft._)`!${u}.test(${r})`);}}};Bs.default=Ip;});var Mi=x(Gs=>{Object.defineProperty(Gs,"__esModule",{value:true});var mr=G(),Pp={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return (0, mr.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0, mr._)`{limit: ${e}}`},Op={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:Pp,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?mr.operators.GT:mr.operators.LT;e.fail$data((0, mr._)`Object.keys(${r}).length ${s} ${n}`);}};Gs.default=Op;});var Li=x(Ks=>{Object.defineProperty(Ks,"__esModule",{value:true});var hr=Te(),gr=G(),jp=H(),Np={message:({params:{missingProperty:e}})=>(0, gr.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0, gr._)`{missingProperty: ${e}}`},qp={keyword:"required",type:"object",schemaType:"array",$data:true,error:Np,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:a}=e,{opts:i}=a;if(!o&&r.length===0)return;let u=r.length>=i.loopRequired;if(a.allErrors?c():l(),i.strictRequired){let g=e.parentSchema.properties,{definedProperties:f}=e.it;for(let p of r)if(g?.[p]===void 0&&!f.has(p)){let S=a.schemaEnv.baseId+a.errSchemaPath,h=`required property "${p}" is not defined at "${S}" (strictRequired)`;(0, jp.checkStrictMode)(a,h,a.opts.strictRequired);}}function c(){if(u||o)e.block$data(gr.nil,d);else for(let g of r)(0, hr.checkReportMissingProp)(e,g);}function l(){let g=t.let("missing");if(u||o){let f=t.let("valid",true);e.block$data(f,()=>v(g,f)),e.ok(f);}else t.if((0, hr.checkMissingProp)(e,r,g)),(0, hr.reportMissingProp)(e,g),t.else();}function d(){t.forOf("prop",n,g=>{e.setParams({missingProperty:g}),t.if((0, hr.noPropertyInData)(t,s,g,i.ownProperties),()=>e.error());});}function v(g,f){e.setParams({missingProperty:g}),t.forOf(g,n,()=>{t.assign(f,(0, hr.propertyInData)(t,s,g,i.ownProperties)),t.if((0, gr.not)(f),()=>{e.error(),t.break();});},gr.nil);}}};Ks.default=qp;});var Vi=x(Us=>{Object.defineProperty(Us,"__esModule",{value:true});var yr=G(),Dp={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return (0, yr.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0, yr._)`{limit: ${e}}`},Fp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:Dp,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?yr.operators.GT:yr.operators.LT;e.fail$data((0, yr._)`${r}.length ${s} ${n}`);}};Us.default=Fp;});var on=x(Js=>{Object.defineProperty(Js,"__esModule",{value:true});var Bi=gs();Bi.code='require("ajv/dist/runtime/equal").default';Js.default=Bi;});var Gi=x(zs=>{Object.defineProperty(zs,"__esModule",{value:true});var Hs=nr(),le=G(),Mp=H(),Lp=on(),Vp={message:({params:{i:e,j:t}})=>(0, le.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0, le._)`{i: ${e}, j: ${t}}`},Bp={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:Vp,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;let u=t.let("valid"),c=o.items?(0, Hs.getSchemaTypes)(o.items):[];e.block$data(u,l,(0, le._)`${a} === false`),e.ok(u);function l(){let f=t.let("i",(0, le._)`${r}.length`),p=t.let("j");e.setParams({i:f,j:p}),t.assign(u,true),t.if((0, le._)`${f} > 1`,()=>(d()?v:g)(f,p));}function d(){return c.length>0&&!c.some(f=>f==="object"||f==="array")}function v(f,p){let S=t.name("item"),h=(0, Hs.checkDataTypes)(c,S,i.opts.strictNumbers,Hs.DataType.Wrong),m=t.const("indices",(0, le._)`{}`);t.for((0, le._)`;${f}--;`,()=>{t.let(S,(0, le._)`${r}[${f}]`),t.if(h,(0, le._)`continue`),c.length>1&&t.if((0, le._)`typeof ${S} == "string"`,(0, le._)`${S} += "_"`),t.if((0, le._)`typeof ${m}[${S}] == "number"`,()=>{t.assign(p,(0, le._)`${m}[${S}]`),e.error(),t.assign(u,false).break();}).code((0, le._)`${m}[${S}] = ${f}`);});}function g(f,p){let S=(0, Mp.useFunc)(t,Lp.default),h=t.name("outer");t.label(h).for((0, le._)`;${f}--;`,()=>t.for((0, le._)`${p} = ${f}; ${p}--;`,()=>t.if((0, le._)`${S}(${r}[${f}], ${r}[${p}])`,()=>{e.error(),t.assign(u,false).break(h);})));}}};zs.default=Bp;});var Ki=x(Ys=>{Object.defineProperty(Ys,"__esModule",{value:true});var Ws=G(),Gp=H(),Kp=on(),Up={message:"must be equal to constant",params:({schemaCode:e})=>(0, Ws._)`{allowedValue: ${e}}`},Jp={keyword:"const",$data:true,error:Up,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0, Ws._)`!${(0, Gp.useFunc)(t,Kp.default)}(${r}, ${s})`):e.fail((0, Ws._)`${o} !== ${r}`);}};Ys.default=Jp;});var Ui=x(Xs=>{Object.defineProperty(Xs,"__esModule",{value:true});var vr=G(),Hp=H(),zp=on(),Wp={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0, vr._)`{allowedValues: ${e}}`},Yp={keyword:"enum",schemaType:"array",$data:true,error:Wp,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let i=s.length>=a.opts.loopEnum,u,c=()=>u??(u=(0, Hp.useFunc)(t,zp.default)),l;if(i||n)l=t.let("valid"),e.block$data(l,d);else {if(!Array.isArray(s))throw new Error("ajv implementation error");let g=t.const("vSchema",o);l=(0, vr.or)(...s.map((f,p)=>v(g,p)));}e.pass(l);function d(){t.assign(l,false),t.forOf("v",o,g=>t.if((0, vr._)`${c()}(${r}, ${g})`,()=>t.assign(l,true).break()));}function v(g,f){let p=s[f];return typeof p=="object"&&p!==null?(0, vr._)`${c()}(${r}, ${g}[${f}])`:(0, vr._)`${r} === ${p}`}}};Xs.default=Yp;});var Ji=x(Qs=>{Object.defineProperty(Qs,"__esModule",{value:true});var Xp=Oi(),Qp=ji(),Zp=Di(),em=Fi(),tm=Mi(),rm=Li(),nm=Vi(),sm=Gi(),om=Ki(),am=Ui(),im=[Xp.default,Qp.default,Zp.default,em.default,tm.default,rm.default,nm.default,sm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},om.default,am.default];Qs.default=im;});var eo=x(br=>{Object.defineProperty(br,"__esModule",{value:true});br.validateAdditionalItems=void 0;var kt=G(),Zs=H(),um={message:({params:{len:e}})=>(0, kt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, kt._)`{limit: ${e}}`},cm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:um,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0, Zs.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Hi(e,n);}};function Hi(e,t){let{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=true;let i=r.const("len",(0, kt._)`${s}.length`);if(n===false)e.setParams({len:t.length}),e.pass((0, kt._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0, Zs.alwaysValidSchema)(a,n)){let c=r.var("valid",(0, kt._)`${i} <= ${t.length}`);r.if((0, kt.not)(c),()=>u(c)),e.ok(c);}function u(c){r.forRange("i",t.length,i,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:Zs.Type.Num},c),a.allErrors||r.if((0, kt.not)(c),()=>r.break());});}}br.validateAdditionalItems=Hi;br.default=cm;});var to=x(Sr=>{Object.defineProperty(Sr,"__esModule",{value:true});Sr.validateTuple=void 0;var zi=G(),an=H(),dm=Te(),lm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Wi(e,"additionalItems",t);r.items=true,!(0, an.alwaysValidSchema)(r,t)&&e.ok((0, dm.validateArray)(e));}};function Wi(e,t,r=e.schema){let{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;l(s),i.opts.unevaluated&&r.length&&i.items!==true&&(i.items=an.mergeEvaluated.items(n,r.length,i.items));let u=n.name("valid"),c=n.const("len",(0, zi._)`${o}.length`);r.forEach((d,v)=>{(0, an.alwaysValidSchema)(i,d)||(n.if((0, zi._)`${c} > ${v}`,()=>e.subschema({keyword:a,schemaProp:v,dataProp:v},u)),e.ok(u));});function l(d){let{opts:v,errSchemaPath:g}=i,f=r.length,p=f===d.minItems&&(f===d.maxItems||d[t]===false);if(v.strictTuples&&!p){let S=`"${a}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${g}"`;(0, an.checkStrictMode)(i,S,v.strictTuples);}}}Sr.validateTuple=Wi;Sr.default=lm;});var Yi=x(ro=>{Object.defineProperty(ro,"__esModule",{value:true});var fm=to(),pm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0, fm.validateTuple)(e,"items")};ro.default=pm;});var Qi=x(no=>{Object.defineProperty(no,"__esModule",{value:true});var Xi=G(),mm=H(),hm=Te(),gm=eo(),ym={message:({params:{len:e}})=>(0, Xi.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, Xi._)`{limit: ${e}}`},vm={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:ym,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=true,!(0, mm.alwaysValidSchema)(n,t)&&(s?(0, gm.validateAdditionalItems)(e,s):e.ok((0, hm.validateArray)(e)));}};no.default=vm;});var Zi=x(so=>{Object.defineProperty(so,"__esModule",{value:true});var Ie=G(),un=H(),bm={message:({params:{min:e,max:t}})=>t===void 0?(0, Ie.str)`must contain at least ${e} valid item(s)`:(0, Ie.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0, Ie._)`{minContains: ${e}}`:(0, Ie._)`{minContains: ${e}, maxContains: ${t}}`},Sm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:bm,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e,a,i,{minContains:u,maxContains:c}=n;o.opts.next?(a=u===void 0?1:u,i=c):a=1;let l=t.const("len",(0, Ie._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0, un.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0, un.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0, un.alwaysValidSchema)(o,r)){let p=(0, Ie._)`${l} >= ${a}`;i!==void 0&&(p=(0, Ie._)`${p} && ${l} <= ${i}`),e.pass(p);return}o.items=true;let d=t.name("valid");i===void 0&&a===1?g(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,true),i!==void 0&&t.if((0, Ie._)`${s}.length > 0`,v)):(t.let(d,false),v()),e.result(d,()=>e.reset());function v(){let p=t.name("_valid"),S=t.let("count",0);g(p,()=>t.if(p,()=>f(S)));}function g(p,S){t.forRange("i",0,l,h=>{e.subschema({keyword:"contains",dataProp:h,dataPropType:un.Type.Num,compositeRule:true},p),S();});}function f(p){t.code((0, Ie._)`${p}++`),i===void 0?t.if((0, Ie._)`${p} >= ${a}`,()=>t.assign(d,true).break()):(t.if((0, Ie._)`${p} > ${i}`,()=>t.assign(d,false).break()),a===1?t.assign(d,true):t.if((0, Ie._)`${p} >= ${a}`,()=>t.assign(d,true)));}}};so.default=Sm;});var ru=x(Ve=>{Object.defineProperty(Ve,"__esModule",{value:true});Ve.validateSchemaDeps=Ve.validatePropertyDeps=Ve.error=void 0;var oo=G(),wm=H(),wr=Te();Ve.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return (0, oo.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0, oo._)`{property: ${e},
|
|
5
|
+
|| ${a} === "boolean" || ${s} === null`).assign(i,(0, L._)`[${s}]`);}}}function fl({gen:e,parentData:t,parentDataProperty:r},n){e.if((0, L._)`${t} !== undefined`,()=>e.assign((0, L._)`${t}[${r}]`,n));}function ms(e,t,r,n=jt.Correct){let s=n===jt.Correct?L.operators.EQ:L.operators.NEQ,o;switch(e){case "null":return (0, L._)`${t} ${s} null`;case "array":o=(0, L._)`Array.isArray(${t})`;break;case "object":o=(0, L._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case "integer":o=a((0, L._)`!(${t} % 1) && !isNaN(${t})`);break;case "number":o=a();break;default:return (0, L._)`typeof ${t} ${s} ${e}`}return n===jt.Correct?o:(0, L.not)(o);function a(i=L.nil){return (0, L.and)((0, L._)`typeof ${t} == "number"`,i,r?(0, L._)`isFinite(${t})`:L.nil)}}me.checkDataType=ms;function hs(e,t,r,n){if(e.length===1)return ms(e[0],t,r,n);let s,o=(0, ja.toHash)(e);if(o.array&&o.object){let a=(0, L._)`typeof ${t} != "object"`;s=o.null?a:(0, L._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object;}else s=L.nil;o.number&&delete o.integer;for(let a in o)s=(0, L.and)(s,ms(a,t,r,n));return s}me.checkDataTypes=hs;var pl={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0, L._)`{type: ${e}}`:(0, L._)`{type: ${t}}`};function gs(e){let t=ml(e);(0, il.reportError)(t,pl);}me.reportTypeError=gs;function ml(e){let{gen:t,data:r,schema:n}=e,s=(0, ja.schemaRefOrVal)(e,n,"type");return {gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var Fa=x(Ur=>{Object.defineProperty(Ur,"__esModule",{value:true});Ur.assignDefaults=void 0;var Nt=G(),hl=H();function gl(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)Da(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Da(e,o,s.default));}Ur.assignDefaults=gl;function Da(e,t,r){let{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;let i=(0, Nt._)`${o}${(0, Nt.getProperty)(t)}`;if(s){(0, hl.checkStrictMode)(e,`default is ignored for: ${i}`);return}let u=(0, Nt._)`${i} === undefined`;a.useDefaults==="empty"&&(u=(0, Nt._)`${u} || ${i} === null || ${i} === ""`),n.if(u,(0, Nt._)`${i} = ${(0, Nt.stringify)(r)}`);}});var Te=x(X=>{Object.defineProperty(X,"__esModule",{value:true});X.validateUnion=X.validateArray=X.usePattern=X.callValidateCode=X.schemaProperties=X.allSchemaProperties=X.noPropertyInData=X.propertyInData=X.isOwnProperty=X.hasPropFunc=X.reportMissingProp=X.checkMissingProp=X.checkReportMissingProp=void 0;var ne=G(),ys=H(),et=Ue(),yl=H();function vl(e,t){let{gen:r,data:n,it:s}=e;r.if(ks(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0, ne._)`${t}`},true),e.error();});}X.checkReportMissingProp=vl;function kl({gen:e,data:t,it:{opts:r}},n,s){return (0, ne.or)(...n.map(o=>(0, ne.and)(ks(e,t,o,r.ownProperties),(0, ne._)`${s} = ${o}`)))}X.checkMissingProp=kl;function bl(e,t){e.setParams({missingProperty:t},true),e.error();}X.reportMissingProp=bl;function Ma(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, ne._)`Object.prototype.hasOwnProperty`})}X.hasPropFunc=Ma;function vs(e,t,r){return (0, ne._)`${Ma(e)}.call(${t}, ${r})`}X.isOwnProperty=vs;function Sl(e,t,r,n){let s=(0, ne._)`${t}${(0, ne.getProperty)(r)} !== undefined`;return n?(0, ne._)`${s} && ${vs(e,t,r)}`:s}X.propertyInData=Sl;function ks(e,t,r,n){let s=(0, ne._)`${t}${(0, ne.getProperty)(r)} === undefined`;return n?(0, ne.or)(s,(0, ne.not)(vs(e,t,r))):s}X.noPropertyInData=ks;function La(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}X.allSchemaProperties=La;function wl(e,t){return La(t).filter(r=>!(0, ys.alwaysValidSchema)(e,t[r]))}X.schemaProperties=wl;function _l({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,u,c){let l=c?(0, ne._)`${e}, ${t}, ${n}${s}`:t,d=[[et.default.instancePath,(0, ne.strConcat)(et.default.instancePath,o)],[et.default.parentData,a.parentData],[et.default.parentDataProperty,a.parentDataProperty],[et.default.rootData,et.default.rootData]];a.opts.dynamicRef&&d.push([et.default.dynamicAnchors,et.default.dynamicAnchors]);let y=(0, ne._)`${l}, ${r.object(...d)}`;return u!==ne.nil?(0, ne._)`${i}.call(${u}, ${y})`:(0, ne._)`${i}(${y})`}X.callValidateCode=_l;var Rl=(0, ne._)`new RegExp`;function $l({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0, ne._)`${s.code==="new RegExp"?Rl:(0, yl.useFunc)(e,s)}(${r}, ${n})`})}X.usePattern=$l;function Cl(e){let{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){let i=t.let("valid",true);return a(()=>t.assign(i,false)),i}return t.var(o,true),a(()=>t.break()),o;function a(i){let u=t.const("len",(0, ne._)`${r}.length`);t.forRange("i",0,u,c=>{e.subschema({keyword:n,dataProp:c,dataPropType:ys.Type.Num},o),t.if((0, ne.not)(o),i);});}}X.validateArray=Cl;function El(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0, ys.alwaysValidSchema)(s,u))&&!s.opts.unevaluated)return;let a=t.let("valid",false),i=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:true},i);t.assign(a,(0, ne._)`${a} || ${i}`),e.mergeValidEvaluated(l,i)||t.if((0, ne.not)(a));})),e.result(a,()=>e.reset(),()=>e.error(true));}X.validateUnion=El;});var Ga=x(Fe=>{Object.defineProperty(Fe,"__esModule",{value:true});Fe.validateKeywordUsage=Fe.validSchemaType=Fe.funcKeywordCode=Fe.macroKeywordCode=void 0;var ye=G(),bt=Ue(),xl=Te(),Tl=sr();function Al(e,t){let{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),u=Ba(r,n,i);a.opts.validateSchema!==false&&a.self.validateSchema(i,true);let c=r.name("valid");e.subschema({schema:i,schemaPath:ye.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:true},c),e.pass(c,()=>e.error(true));}Fe.macroKeywordCode=Al;function Il(e,t){var r;let{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:u}=e;Ol(u,t);let c=!i&&t.compile?t.compile.call(u.self,o,a,u):t.validate,l=Ba(n,s,c),d=n.let("valid");e.block$data(d,y),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function y(){if(t.errors===false)p(),t.modifying&&Va(e),b(()=>e.error());else {let h=t.async?g():f();t.modifying&&Va(e),b(()=>Pl(e,h));}}function g(){let h=n.let("ruleErrs",null);return n.try(()=>p((0, ye._)`await `),m=>n.assign(d,false).if((0, ye._)`${m} instanceof ${u.ValidationError}`,()=>n.assign(h,(0, ye._)`${m}.errors`),()=>n.throw(m))),h}function f(){let h=(0, ye._)`${l}.errors`;return n.assign(h,null),p(ye.nil),h}function p(h=t.async?(0, ye._)`await `:ye.nil){let m=u.opts.passContext?bt.default.this:bt.default.self,v=!("compile"in t&&!i||t.schema===false);n.assign(d,(0, ye._)`${h}${(0, xl.callValidateCode)(e,l,m,v)}`,t.modifying);}function b(h){var m;n.if((0, ye.not)((m=t.valid)!==null&&m!==void 0?m:d),h);}}Fe.funcKeywordCode=Il;function Va(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0, ye._)`${n.parentData}[${n.parentDataProperty}]`));}function Pl(e,t){let{gen:r}=e;r.if((0, ye._)`Array.isArray(${t})`,()=>{r.assign(bt.default.vErrors,(0, ye._)`${bt.default.vErrors} === null ? ${t} : ${bt.default.vErrors}.concat(${t})`).assign(bt.default.errors,(0, ye._)`${bt.default.vErrors}.length`),(0, Tl.extendErrors)(e);},()=>e.error());}function Ol({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ba(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, ye.stringify)(r)})}function jl(e,t,r=false){return !t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Fe.validSchemaType=jl;function Nl({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let a=s.dependencies;if(a?.some(i=>!Object.prototype.hasOwnProperty.call(e,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){let u=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}Fe.validateKeywordUsage=Nl;});var Ua=x(tt=>{Object.defineProperty(tt,"__esModule",{value:true});tt.extendSubschemaMode=tt.extendSubschemaData=tt.getSubschema=void 0;var Me=G(),Ka=H();function ql(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let i=e.schema[t];return r===void 0?{schema:i,schemaPath:(0, Me._)`${e.schemaPath}${(0, Me.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0, Me._)`${e.schemaPath}${(0, Me.getProperty)(t)}${(0, Me.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0, Ka.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return {schema:n,schemaPath:s,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}tt.getSubschema=ql;function Dl(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:a}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,y=i.let("data",(0, Me._)`${t.data}${(0, Me.getProperty)(r)}`,true);u(y),e.errorPath=(0, Me.str)`${c}${(0, Ka.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0, Me._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty];}if(s!==void 0){let c=s instanceof Me.Name?s:i.let("data",s,true);u(c),a!==void 0&&(e.propertyName=a);}o&&(e.dataTypes=o);function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c];}}tt.extendSubschemaData=Dl;function Fl(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r;}tt.extendSubschemaMode=Fl;});var bs=x((Fy,Ja)=>{Ja.exports=function e(t,r){if(t===r)return true;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return false;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return false;for(s=n;s--!==0;)if(!e(t[s],r[s]))return false;return true}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),n=o.length,n!==Object.keys(r).length)return false;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return false;for(s=n;s--!==0;){var a=o[s];if(!e(t[a],r[a]))return false}return true}return t!==t&&r!==r};});var za=x((My,Ha)=>{var rt=Ha.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Jr(t,n,s,e,"",e);};rt.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};rt.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};rt.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};rt.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function Jr(e,t,r,n,s,o,a,i,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,u,c);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in rt.arrayKeywords)for(var y=0;y<d.length;y++)Jr(e,t,r,d[y],s+"/"+l+"/"+y,o,s,l,n,y);}else if(l in rt.propsKeywords){if(d&&typeof d=="object")for(var g in d)Jr(e,t,r,d[g],s+"/"+l+"/"+Ml(g),o,s,l,n,g);}else (l in rt.keywords||e.allKeys&&!(l in rt.skipKeywords))&&Jr(e,t,r,d,s+"/"+l,o,s,l,n);}r(n,s,o,a,i,u,c);}}function Ml(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ar=x(be=>{Object.defineProperty(be,"__esModule",{value:true});be.getSchemaRefs=be.resolveUrl=be.normalizeId=be._getFullPath=be.getFullPath=be.inlineRef=void 0;var Ll=H(),Vl=bs(),Bl=za(),Gl=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Kl(e,t=true){return typeof e=="boolean"?true:t===true?!Ss(e):t?Wa(e)<=t:false}be.inlineRef=Kl;var Ul=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ss(e){for(let t in e){if(Ul.has(t))return true;let r=e[t];if(Array.isArray(r)&&r.some(Ss)||typeof r=="object"&&Ss(r))return true}return false}function Wa(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Gl.has(r)&&(typeof e[r]=="object"&&(0, Ll.eachItem)(e[r],n=>t+=Wa(n)),t===1/0))return 1/0}return t}function Ya(e,t="",r){r!==false&&(t=qt(t));let n=e.parse(t);return Xa(e,n)}be.getFullPath=Ya;function Xa(e,t){return e.serialize(t).split("#")[0]+"#"}be._getFullPath=Xa;var Jl=/#\/?$/;function qt(e){return e?e.replace(Jl,""):""}be.normalizeId=qt;function Hl(e,t,r){return r=qt(r),e.resolve(t,r)}be.resolveUrl=Hl;var zl=/^[a-z_][-a-z0-9._]*$/i;function Wl(e,t){if(typeof e=="boolean")return {};let{schemaId:r,uriResolver:n}=this.opts,s=qt(e[r]||t),o={"":s},a=Ya(n,s,false),i={},u=new Set;return Bl(e,{allKeys:true},(d,y,g,f)=>{if(f===void 0)return;let p=a+y,b=o[f];typeof d[r]=="string"&&(b=h.call(this,d[r])),m.call(this,d.$anchor),m.call(this,d.$dynamicAnchor),o[y]=b;function h(v){let w=this.opts.uriResolver.resolve;if(v=qt(b?w(b,v):v),u.has(v))throw l(v);u.add(v);let S=this.refs[v];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?c(d,S.schema,v):v!==qt(p)&&(v[0]==="#"?(c(d,i[v],v),i[v]=d):this.refs[v]=p),v}function m(v){if(typeof v=="string"){if(!zl.test(v))throw new Error(`invalid anchor "${v}"`);h.call(this,`#${v}`);}}}),i;function c(d,y,g){if(y!==void 0&&!Vl(d,y))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}be.getSchemaRefs=Wl;});var cr=x(nt=>{Object.defineProperty(nt,"__esModule",{value:true});nt.getData=nt.KeywordCxt=nt.validateFunctionCode=void 0;var ri=Ia(),Qa=or(),_s=ps(),Hr=or(),Yl=Fa(),ur=Ga(),ws=Ua(),T=G(),O=Ue(),Xl=ar(),Je=H(),ir=sr();function Ql(e){if(oi(e)&&(ai(e),si(e))){tf(e);return}ni(e,()=>(0, ri.topBoolOrEmptySchema)(e));}nt.validateFunctionCode=Ql;function ni({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0, T._)`${O.default.data}, ${O.default.valCxt}`,n.$async,()=>{e.code((0, T._)`"use strict"; ${Za(r,s)}`),ef(e,s),e.code(o);}):e.func(t,(0, T._)`${O.default.data}, ${Zl(s)}`,n.$async,()=>e.code(Za(r,s)).code(o));}function Zl(e){return (0, T._)`{${O.default.instancePath}="", ${O.default.parentData}, ${O.default.parentDataProperty}, ${O.default.rootData}=${O.default.data}${e.dynamicRef?(0, T._)`, ${O.default.dynamicAnchors}={}`:T.nil}}={}`}function ef(e,t){e.if(O.default.valCxt,()=>{e.var(O.default.instancePath,(0, T._)`${O.default.valCxt}.${O.default.instancePath}`),e.var(O.default.parentData,(0, T._)`${O.default.valCxt}.${O.default.parentData}`),e.var(O.default.parentDataProperty,(0, T._)`${O.default.valCxt}.${O.default.parentDataProperty}`),e.var(O.default.rootData,(0, T._)`${O.default.valCxt}.${O.default.rootData}`),t.dynamicRef&&e.var(O.default.dynamicAnchors,(0, T._)`${O.default.valCxt}.${O.default.dynamicAnchors}`);},()=>{e.var(O.default.instancePath,(0, T._)`""`),e.var(O.default.parentData,(0, T._)`undefined`),e.var(O.default.parentDataProperty,(0, T._)`undefined`),e.var(O.default.rootData,O.default.data),t.dynamicRef&&e.var(O.default.dynamicAnchors,(0, T._)`{}`);});}function tf(e){let{schema:t,opts:r,gen:n}=e;ni(e,()=>{r.$comment&&t.$comment&&ui(e),af(e),n.let(O.default.vErrors,null),n.let(O.default.errors,0),r.unevaluated&&rf(e),ii(e),df(e);});}function rf(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0, T._)`${r}.evaluated`),t.if((0, T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0, T._)`${e.evaluated}.props`,(0, T._)`undefined`)),t.if((0, T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0, T._)`${e.evaluated}.items`,(0, T._)`undefined`));}function Za(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0, T._)`/*# sourceURL=${r} */`:T.nil}function nf(e,t){if(oi(e)&&(ai(e),si(e))){sf(e,t);return}(0, ri.boolOrEmptySchema)(e,t);}function si({schema:e,self:t}){if(typeof e=="boolean")return !e;for(let r in e)if(t.RULES.all[r])return true;return false}function oi(e){return typeof e.schema!="boolean"}function sf(e,t){let{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&ui(e),uf(e),cf(e);let o=n.const("_errs",O.default.errors);ii(e,o),n.var(t,(0, T._)`${o} === ${O.default.errors}`);}function ai(e){(0, Je.checkUnknownRules)(e),of(e);}function ii(e,t){if(e.opts.jtd)return ei(e,[],false,t);let r=(0, Qa.getSchemaTypes)(e.schema),n=(0, Qa.coerceAndCheckDataType)(e,r);ei(e,r,!n,t);}function of(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0, Je.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function af(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, Je.checkStrictMode)(e,"default is ignored in the schema root");}function uf(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0, Xl.resolveUrl)(e.opts.uriResolver,e.baseId,t));}function cf(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function ui({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===true)e.code((0, T._)`${O.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let a=(0, T.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0, T._)`${O.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`);}}function df(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0, T._)`${O.default.errors} === 0`,()=>t.return(O.default.data),()=>t.throw((0, T._)`new ${s}(${O.default.vErrors})`)):(t.assign((0, T._)`${n}.errors`,O.default.vErrors),o.unevaluated&&lf(e),t.return((0, T._)`${O.default.errors} === 0`));}function lf({gen:e,evaluated:t,props:r,items:n}){r instanceof T.Name&&e.assign((0, T._)`${t}.props`,r),n instanceof T.Name&&e.assign((0, T._)`${t}.items`,n);}function ei(e,t,r,n){let{gen:s,schema:o,data:a,allErrors:i,opts:u,self:c}=e,{RULES:l}=c;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0, Je.schemaHasRulesButRef)(o,l))){s.block(()=>di(e,"$ref",l.all.$ref.definition));return}u.jtd||ff(e,t),s.block(()=>{for(let y of l.rules)d(y);d(l.post);});function d(y){(0, _s.shouldUseGroup)(o,y)&&(y.type?(s.if((0, Hr.checkDataType)(y.type,a,u.strictNumbers)),ti(e,y),t.length===1&&t[0]===y.type&&r&&(s.else(),(0, Hr.reportTypeError)(e)),s.endIf()):ti(e,y),i||s.if((0, T._)`${O.default.errors} === ${n||0}`));}}function ti(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0, Yl.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0, _s.shouldUseRule)(n,o)&&di(e,o.keyword,o.definition,t.type);});}function ff(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(pf(e,t),e.opts.allowUnionTypes||mf(e,t),hf(e,e.dataTypes));}function pf(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ci(e.dataTypes,r)||Rs(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`);}),yf(e,t);}}function mf(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Rs(e,"use allowUnionTypes to allow union type keyword");}function hf(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0, _s.shouldUseRule)(e.schema,s)){let{type:o}=s.definition;o.length&&!o.some(a=>gf(t,a))&&Rs(e,`missing type "${o.join(",")}" for keyword "${n}"`);}}}function gf(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ci(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function yf(e,t){let r=[];for(let n of e.dataTypes)ci(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r;}function Rs(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0, Je.checkStrictMode)(e,t,e.opts.strictTypes);}var zr=class{constructor(t,r,n){if((0, ur.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0, Je.schemaRefOrVal)(t,this.schema,n,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",li(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0, ur.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==false)&&(this.errsCount=t.gen.const("_errs",O.default.errors));}result(t,r,n){this.failResult((0, T.not)(t),r,n);}failResult(t,r,n){this.gen.if(t),n?n():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, T.not)(t),void 0,r);}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(false);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, T._)`${r} !== undefined && (${(0, T.or)(this.invalid$data(),t)})`);}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n);}_error(t,r){(t?ir.reportExtraError:ir.reportError)(this,this.def.error,r);}$dataError(){(0, ir.reportError)(this,this.def.$dataError||ir.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, ir.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,n=T.nil){this.gen.block(()=>{this.check$data(t,n),r();});}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0, T.or)((0, T._)`${s} === undefined`,r)),t!==T.nil&&n.assign(t,true),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&n.assign(t,false)),n.else();}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return (0, T.or)(a(),i());function a(){if(n.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let u=Array.isArray(n)?n:[n];return (0, T._)`${(0, Hr.checkDataTypes)(u,r,o.opts.strictNumbers,Hr.DataType.Wrong)}`}return T.nil}function i(){if(s.validateSchema){let u=t.scopeValue("validate$data",{ref:s.validateSchema});return (0, T._)`!${u}(${r})`}return T.nil}}subschema(t,r){let n=(0, ws.getSubschema)(this.it,t);(0, ws.extendSubschemaData)(n,this.it,t),(0, ws.extendSubschemaMode)(n,t);let s={...this.it,...n,items:void 0,props:void 0};return nf(s,r),s}mergeEvaluated(t,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==true&&t.props!==void 0&&(n.props=Je.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==true&&t.items!==void 0&&(n.items=Je.mergeEvaluated.items(s,t.items,n.items,r)));}mergeValidEvaluated(t,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==true||n.items!==true))return s.if(r,()=>this.mergeEvaluated(t,T.Name)),true}};nt.KeywordCxt=zr;function di(e,t,r,n){let s=new zr(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0, ur.funcKeywordCode)(s,r):"macro"in r?(0, ur.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0, ur.funcKeywordCode)(s,r);}var vf=/^\/(?:[^~]|~0|~1)*$/,kf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function li(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return O.default.rootData;if(e[0]==="/"){if(!vf.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=O.default.rootData;}else {let c=kf.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(s=c[2],s==="#"){if(l>=t)throw new Error(u("property/index",l));return n[t-l]}if(l>t)throw new Error(u("data",l));if(o=r[t-l],!s)return o}let a=o,i=s.split("/");for(let c of i)c&&(o=(0, T._)`${o}${(0, T.getProperty)((0, Je.unescapeJsonPointer)(c))}`,a=(0, T._)`${a} && ${o}`);return a;function u(c,l){return `Cannot access ${c} ${l} levels up, current level is ${t}`}}nt.getData=li;});var Wr=x(Cs=>{Object.defineProperty(Cs,"__esModule",{value:true});var $s=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=true;}};Cs.default=$s;});var dr=x(Ts=>{Object.defineProperty(Ts,"__esModule",{value:true});var Es=ar(),xs=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0, Es.resolveUrl)(t,r,n),this.missingSchema=(0, Es.normalizeId)((0, Es.getFullPath)(t,this.missingRef));}};Ts.default=xs;});var Xr=x(Ae=>{Object.defineProperty(Ae,"__esModule",{value:true});Ae.resolveSchema=Ae.getCompilingSchema=Ae.resolveRef=Ae.compileSchema=Ae.SchemaEnv=void 0;var Oe=G(),bf=Wr(),St=Ue(),je=ar(),fi=H(),Sf=cr(),Dt=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=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, je.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={};}};Ae.SchemaEnv=Dt;function Is(e){let t=pi.call(this,e);if(t)return t;let r=(0, je.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new Oe.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),i;e.$async&&(i=a.scopeValue("Error",{ref:bf.default,code:(0, Oe._)`require("ajv/dist/runtime/validation_error").default`}));let u=a.scopeName("validate");e.validateName=u;let c={gen:a,allErrors:this.opts.allErrors,data:St.default.data,parentData:St.default.parentData,parentDataProperty:St.default.parentDataProperty,dataNames:[St.default.data],dataPathArr:[Oe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0, Oe.stringify)(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Oe.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, Oe._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Sf.validateFunctionCode)(c),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(St.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let g=new Function(`${St.default.self}`,`${St.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:g}),g.errors=null,g.schema=e.schema,g.schemaEnv=e,e.$async&&(g.$async=!0),this.opts.code.source===!0&&(g.source={validateName:u,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:f,items:p}=c;g.evaluated={props:f instanceof Oe.Name?void 0:f,items:p instanceof Oe.Name?void 0:p,dynamicProps:f instanceof Oe.Name,dynamicItems:p instanceof Oe.Name},g.source&&(g.source.evaluated=(0,Oe.stringify)(g.evaluated));}return e.validate=g,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e);}}Ae.compileSchema=Is;function wf(e,t,r){var n;r=(0, je.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=$f.call(this,e,r);if(o===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:i}=this.opts;a&&(o=new Dt({schema:a,schemaId:i,root:e,baseId:t}));}if(o!==void 0)return e.refs[r]=_f.call(this,o)}Ae.resolveRef=wf;function _f(e){return (0, je.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Is.call(this,e)}function pi(e){for(let t of this._compilations)if(Rf(t,e))return t}Ae.getCompilingSchema=pi;function Rf(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function $f(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Yr.call(this,e,t)}function Yr(e,t){let r=this.opts.uriResolver.parse(t),n=(0, je._getFullPath)(this.opts.uriResolver,r),s=(0, je.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return As.call(this,r,e);let o=(0, je.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=Yr.call(this,e,a);return typeof i?.schema!="object"?void 0:As.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Is.call(this,a),o===(0, je.normalizeId)(t)){let{schema:i}=a,{schemaId:u}=this.opts,c=i[u];return c&&(s=(0, je.resolveUrl)(this.opts.uriResolver,s,c)),new Dt({schema:i,schemaId:u,root:e,baseId:s})}return As.call(this,r,a)}}Ae.resolveSchema=Yr;var Cf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function As(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let i of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0, fi.unescapeFragment)(i)];if(u===void 0)return;r=u;let c=typeof r=="object"&&r[this.opts.schemaId];!Cf.has(i)&&c&&(t=(0, je.resolveUrl)(this.opts.uriResolver,t,c));}let o;if(typeof r!="boolean"&&r.$ref&&!(0, fi.schemaHasRulesButRef)(r,this.RULES)){let i=(0, je.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Yr.call(this,n,i);}let{schemaId:a}=this.opts;if(o=o||new Dt({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var mi=x((Uy,Ef)=>{Ef.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:false};});var Os=x((Jy,vi)=>{var xf=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gi=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);function Ps(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";t+=e[n];}return t}var Tf=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hi(e){return e.length=0,true}function Af(e,t,r){if(e.length){let n=Ps(e);if(n!=="")t.push(n);else return r.error=true,false;e.length=0;}return true}function If(e){let t=0,r={error:false,address:"",zone:""},n=[],s=[],o=false,a=false,i=Af;for(let u=0;u<e.length;u++){let c=e[u];if(!(c==="["||c==="]"))if(c===":"){if(o===true&&(a=true),!i(s,n,r))break;if(++t>7){r.error=true;break}u>0&&e[u-1]===":"&&(o=true),n.push(":");continue}else if(c==="%"){if(!i(s,n,r))break;i=hi;}else {s.push(c);continue}}return s.length&&(i===hi?r.zone=s.join(""):a?n.push(s.join("")):n.push(Ps(s))),r.address=n.join(""),r}function yi(e){if(Pf(e,":")<2)return {host:e,isIPV6:false};let t=If(e);if(t.error)return {host:e,isIPV6:false};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:true,escapedHost:n}}}function Pf(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Of(e){let t=e,r=[],n=-1,s=0;for(;s=t.length;){if(s===1){if(t===".")break;if(t==="/"){r.push("/");break}else {r.push(t);break}}else if(s===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(s===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((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n);}return r.join("")}function jf(e,t){let r=t!==true?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function Nf(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!gi(r)){let n=yi(r);n.isIPV6===true?r=`[${n.escapedHost}]`:r=e.host;}t.push(r);}return (typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}vi.exports={nonSimpleDomain:Tf,recomposeAuthority:Nf,normalizeComponentEncoding:jf,removeDotSegments:Of,isIPv4:gi,isUUID:xf,normalizeIPv6:yi,stringArrayToHexStripped:Ps};});var _i=x((Hy,wi)=>{var{isUUID:qf}=Os(),Df=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Ff=["http","https","ws","wss","urn","urn:uuid"];function Mf(e){return Ff.indexOf(e)!==-1}function js(e){return e.secure===true?true:e.secure===false?false: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"):false}function ki(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function bi(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 Lf(e){return e.secure=js(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Vf(e){if((e.port===(js(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,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0;}return e.fragment=void 0,e}function Bf(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Df);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,o=Ns(s);e.path=void 0,o&&(e=o.parse(e,t));}else e.error=e.error||"URN can not be parsed.";return e}function Gf(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,o=Ns(s);o&&(e=o.serialize(e,t));let a=e,i=e.nss;return a.path=`${n||t.nid}:${i}`,t.skipEscape=true,a}function Kf(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!qf(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Uf(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Si={scheme:"http",domainHost:true,parse:ki,serialize:bi},Jf={scheme:"https",domainHost:Si.domainHost,parse:ki,serialize:bi},Qr={scheme:"ws",domainHost:true,parse:Lf,serialize:Vf},Hf={scheme:"wss",domainHost:Qr.domainHost,parse:Qr.parse,serialize:Qr.serialize},zf={scheme:"urn",parse:Bf,serialize:Gf,skipNormalize:true},Wf={scheme:"urn:uuid",parse:Kf,serialize:Uf,skipNormalize:true},Zr={http:Si,https:Jf,ws:Qr,wss:Hf,urn:zf,"urn:uuid":Wf};Object.setPrototypeOf(Zr,null);function Ns(e){return e&&(Zr[e]||Zr[e.toLowerCase()])||void 0}wi.exports={wsIsSecure:js,SCHEMES:Zr,isValidSchemeName:Mf,getSchemeHandler:Ns};});var Ci=x((zy,tn)=>{var{normalizeIPv6:Yf,removeDotSegments:lr,recomposeAuthority:Xf,normalizeComponentEncoding:en,isIPv4:Qf,nonSimpleDomain:Zf}=Os(),{SCHEMES:ep,getSchemeHandler:Ri}=_i();function tp(e,t){return typeof e=="string"?e=Le(He(e,t),t):typeof e=="object"&&(e=He(Le(e,t),t)),e}function rp(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=$i(He(e,n),He(t,n),n,true);return n.skipEscape=true,Le(s,n)}function $i(e,t,r,n){let s={};return n||(e=He(Le(e,r),r),t=He(Le(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=lr(t.path||""),s.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=lr(t.path||""),s.query=t.query):(t.path?(t.path[0]==="/"?s.path=lr(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?s.path="/"+t.path:e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path,s.path=lr(s.path)),s.query=t.query):(s.path=e.path,t.query!==void 0?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function np(e,t,r){return typeof e=="string"?(e=unescape(e),e=Le(en(He(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=Le(en(e,true),{...r,skipEscape:true})),typeof t=="string"?(t=unescape(t),t=Le(en(He(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=Le(en(t,true),{...r,skipEscape:true})),e.toLowerCase()===t.toLowerCase()}function Le(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:""},n=Object.assign({},t),s=[],o=Ri(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let a=Xf(r);if(a!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(a),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let i=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(i=lr(i)),a===void 0&&i[0]==="/"&&i[1]==="/"&&(i="/%2F"+i.slice(2)),s.push(i);}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var sp=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function He(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=false;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(sp);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(Qf(n.host)===false){let u=Yf(n.host);n.host=u.host.toLowerCase(),s=u.isIPV6;}else s=true;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Ri(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===false&&Zf(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase());}catch(i){n.error=n.error||"Host's domain name can not be converted to ASCII: "+i;}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r);}else n.error=n.error||"URI can not be parsed.";return n}var qs={SCHEMES:ep,normalize:tp,resolve:rp,resolveComponent:$i,equal:np,serialize:Le,parse:He};tn.exports=qs;tn.exports.default=qs;tn.exports.fastUri=qs;});var xi=x(Ds=>{Object.defineProperty(Ds,"__esModule",{value:true});var Ei=Ci();Ei.code='require("ajv/dist/runtime/uri").default';Ds.default=Ei;});var qi=x(de=>{Object.defineProperty(de,"__esModule",{value:true});de.CodeGen=de.Name=de.nil=de.stringify=de.str=de._=de.KeywordCxt=void 0;var op=cr();Object.defineProperty(de,"KeywordCxt",{enumerable:true,get:function(){return op.KeywordCxt}});var Ft=G();Object.defineProperty(de,"_",{enumerable:true,get:function(){return Ft._}});Object.defineProperty(de,"str",{enumerable:true,get:function(){return Ft.str}});Object.defineProperty(de,"stringify",{enumerable:true,get:function(){return Ft.stringify}});Object.defineProperty(de,"nil",{enumerable:true,get:function(){return Ft.nil}});Object.defineProperty(de,"Name",{enumerable:true,get:function(){return Ft.Name}});Object.defineProperty(de,"CodeGen",{enumerable:true,get:function(){return Ft.CodeGen}});var ap=Wr(),Oi=dr(),ip=fs(),fr=Xr(),up=G(),pr=ar(),rn=or(),Ms=H(),Ti=mi(),cp=xi(),ji=(e,t)=>new RegExp(e,t);ji.code="new RegExp";var dp=["removeAdditional","useDefaults","coerceTypes"],lp=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),fp={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."},pp={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ai=200;function mp(e){var t,r,n,s,o,a,i,u,c,l,d,y,g,f,p,b,h,m,v,w,S,$,_,C,N;let q=e.strict,F=(t=e.code)===null||t===void 0?void 0:t.optimize,re=F===true||F===void 0?1:F||0,U=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:ji,ce=(s=e.uriResolver)!==null&&s!==void 0?s:cp.default;return {strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:q)!==null&&a!==void 0?a:true,strictNumbers:(u=(i=e.strictNumbers)!==null&&i!==void 0?i:q)!==null&&u!==void 0?u:true,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:q)!==null&&l!==void 0?l:"log",strictTuples:(y=(d=e.strictTuples)!==null&&d!==void 0?d:q)!==null&&y!==void 0?y:"log",strictRequired:(f=(g=e.strictRequired)!==null&&g!==void 0?g:q)!==null&&f!==void 0?f:false,code:e.code?{...e.code,optimize:re,regExp:U}:{optimize:re,regExp:U},loopRequired:(p=e.loopRequired)!==null&&p!==void 0?p:Ai,loopEnum:(b=e.loopEnum)!==null&&b!==void 0?b:Ai,meta:(h=e.meta)!==null&&h!==void 0?h:true,messages:(m=e.messages)!==null&&m!==void 0?m:true,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:true,schemaId:(w=e.schemaId)!==null&&w!==void 0?w:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:true,validateSchema:($=e.validateSchema)!==null&&$!==void 0?$:true,validateFormats:(_=e.validateFormats)!==null&&_!==void 0?_:true,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:true,int32range:(N=e.int32range)!==null&&N!==void 0?N:true,uriResolver:ce}}var mr=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...mp(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new up.ValueScope({scope:{},prefixes:lp,es5:r,lines:n}),this.logger=bp(t.logger);let s=t.validateFormats;t.validateFormats=false,this.RULES=(0, ip.getRules)(),Ii.call(this,fp,t,"NOT SUPPORTED"),Ii.call(this,pp,t,"DEPRECATED","warn"),this._metaOpts=vp.call(this),t.formats&&gp.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&yp.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),hp.call(this),t.validateFormats=s;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,s=Ti;n==="id"&&(s={...Ti},s.id=s.$id,delete s.$id),r&&t&&this.addMetaSchema(s,s[n],false);}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let s=n(r);return "$async"in n||(this.errors=n.errors),s}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,t,r);async function s(l,d){await o.call(this,l.$schema);let y=this._addSchema(l,d);return y.validate||a.call(this,y)}async function o(l){l&&!this.getSchema(l)&&await s.call(this,{$ref:l},true);}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Oi.default))throw d;return i.call(this,d),await u.call(this,d.missingSchema),a.call(this,l)}}function i({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function u(l){let d=await c.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r);}async function c(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l];}}}addSchema(t,r,n,s=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,s);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0, pr.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,s,true),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,true,n),this}validateSchema(t,r){if(typeof t=="boolean")return true;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,true;let s=this.validate(n,t);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(t){let r;for(;typeof(r=Pi.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,s=new fr.SchemaEnv({schema:{},schemaId:n});if(r=fr.resolveSchema.call(this,s,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=Pi.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 n=t[this.opts.schemaId];return n&&(n=(0, pr.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(wp.call(this,n,r),!r)return (0, Ms.eachItem)(n,o=>Fs.call(this,o)),this;Rp.call(this,r);let s={...r,type:(0, rn.getJSONTypes)(r.type),schemaType:(0, rn.getJSONTypes)(r.schemaType)};return (0, Ms.eachItem)(n,s.type.length===0?o=>Fs.call(this,o,s):o=>s.type.forEach(a=>Fs.call(this,o,s,a))),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 n of r.rules){let s=n.rules.findIndex(o=>o.keyword===t);s>=0&&n.rules.splice(s,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:n="data"}={}){return !t||t.length===0?"No errors":t.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let s of r){let o=s.split("/").slice(1),a=t;for(let i of o)a=a[i];for(let i in n){let u=n[i];if(typeof u!="object")continue;let{$data:c}=u.definition,l=a[i];c&&l&&(a[i]=Ni(l));}}return t}_removeAllSchemas(t,r){for(let n in t){let s=t[n];(!r||r.test(n))&&(typeof s=="string"?delete t[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete t[n]));}}_addSchema(t,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:i}=this.opts;if(typeof t=="object")a=t[i];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 u=this._cache.get(t);if(u!==void 0)return u;n=(0, pr.normalizeId)(a||n);let c=pr.getSchemaRefs.call(this,t,n);return u=new fr.SchemaEnv({schema:t,schemaId:i,meta:r,baseId:n,localRefs:c}),this._cache.set(u.schema,u),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=u),s&&this.validateSchema(t,true),u}_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):fr.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{fr.compileSchema.call(this,t);}finally{this.opts=r;}}};mr.ValidationError=ap.default;mr.MissingRefError=Oi.default;de.default=mr;function Ii(e,t,r,n="error"){for(let s in e){let o=s;o in t&&this.logger[n](`${r}: option ${s}. ${e[o]}`);}}function Pi(e){return e=(0, pr.normalizeId)(e),this.schemas[e]||this.refs[e]}function hp(){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 gp(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t);}}function yp(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 vp(){let e={...this.opts};for(let t of dp)delete e[t];return e}var kp={log(){},warn(){},error(){}};function bp(e){if(e===false)return kp;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 Sp=/^[a-z_$][a-z0-9_$:-]*$/i;function wp(e,t){let{RULES:r}=this;if((0, Ms.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Sp.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Fs(e,t,r){var n;let s=t?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=s?o.post:o.rules.find(({type:u})=>u===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=true,!t)return;let i={keyword:e,definition:{...t,type:(0, rn.getJSONTypes)(t.type),schemaType:(0, rn.getJSONTypes)(t.schemaType)}};t.before?_p.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,(n=t.implements)===null||n===void 0||n.forEach(u=>this.addKeyword(u));}function _p(e,t,r){let n=e.rules.findIndex(s=>s.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`));}function Rp(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ni(t)),e.validateSchema=this.compile(t,true));}var $p={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ni(e){return {anyOf:[e,$p]}}});var Di=x(Ls=>{Object.defineProperty(Ls,"__esModule",{value:true});var Cp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ls.default=Cp;});var Vi=x(wt=>{Object.defineProperty(wt,"__esModule",{value:true});wt.callRef=wt.getValidate=void 0;var Ep=dr(),Fi=Te(),Se=G(),Mt=Ue(),Mi=Xr(),nn=H(),xp={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:u}=n,{root:c}=o;if((r==="#"||r==="#/")&&s===c.baseId)return d();let l=Mi.resolveRef.call(u,c,s,r);if(l===void 0)throw new Ep.default(n.opts.uriResolver,s,r);if(l instanceof Mi.SchemaEnv)return y(l);return g(l);function d(){if(o===c)return sn(e,a,o,o.$async);let f=t.scopeValue("root",{ref:c});return sn(e,(0, Se._)`${f}.validate`,c,c.$async)}function y(f){let p=Li(e,f);sn(e,p,f,f.$async);}function g(f){let p=t.scopeValue("schema",i.code.source===true?{ref:f,code:(0, Se.stringify)(f)}:{ref:f}),b=t.name("valid"),h=e.subschema({schema:f,dataTypes:[],schemaPath:Se.nil,topSchemaRef:p,errSchemaPath:r},b);e.mergeEvaluated(h),e.ok(b);}}};function Li(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0, Se._)`${r.scopeValue("wrapper",{ref:t})}.validate`}wt.getValidate=Li;function sn(e,t,r,n){let{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:u}=o,c=u.passContext?Mt.default.this:Se.nil;n?l():d();function l(){if(!i.$async)throw new Error("async schema referenced by sync schema");let f=s.let("valid");s.try(()=>{s.code((0, Se._)`await ${(0, Fi.callValidateCode)(e,t,c)}`),g(t),a||s.assign(f,true);},p=>{s.if((0, Se._)`!(${p} instanceof ${o.ValidationError})`,()=>s.throw(p)),y(p),a||s.assign(f,false);}),e.ok(f);}function d(){e.result((0, Fi.callValidateCode)(e,t,c),()=>g(t),()=>y(t));}function y(f){let p=(0, Se._)`${f}.errors`;s.assign(Mt.default.vErrors,(0, Se._)`${Mt.default.vErrors} === null ? ${p} : ${Mt.default.vErrors}.concat(${p})`),s.assign(Mt.default.errors,(0, Se._)`${Mt.default.vErrors}.length`);}function g(f){var p;if(!o.opts.unevaluated)return;let b=(p=r?.validate)===null||p===void 0?void 0:p.evaluated;if(o.props!==true)if(b&&!b.dynamicProps)b.props!==void 0&&(o.props=nn.mergeEvaluated.props(s,b.props,o.props));else {let h=s.var("props",(0, Se._)`${f}.evaluated.props`);o.props=nn.mergeEvaluated.props(s,h,o.props,Se.Name);}if(o.items!==true)if(b&&!b.dynamicItems)b.items!==void 0&&(o.items=nn.mergeEvaluated.items(s,b.items,o.items));else {let h=s.var("items",(0, Se._)`${f}.evaluated.items`);o.items=nn.mergeEvaluated.items(s,h,o.items,Se.Name);}}}wt.callRef=sn;wt.default=xp;});var Bi=x(Vs=>{Object.defineProperty(Vs,"__esModule",{value:true});var Tp=Di(),Ap=Vi(),Ip=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Tp.default,Ap.default];Vs.default=Ip;});var Gi=x(Bs=>{Object.defineProperty(Bs,"__esModule",{value:true});var on=G(),st=on.operators,an={maximum:{okStr:"<=",ok:st.LTE,fail:st.GT},minimum:{okStr:">=",ok:st.GTE,fail:st.LT},exclusiveMaximum:{okStr:"<",ok:st.LT,fail:st.GTE},exclusiveMinimum:{okStr:">",ok:st.GT,fail:st.LTE}},Pp={message:({keyword:e,schemaCode:t})=>(0, on.str)`must be ${an[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0, on._)`{comparison: ${an[e].okStr}, limit: ${t}}`},Op={keyword:Object.keys(an),type:"number",schemaType:"number",$data:true,error:Pp,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0, on._)`${r} ${an[t].fail} ${n} || isNaN(${r})`);}};Bs.default=Op;});var Ki=x(Gs=>{Object.defineProperty(Gs,"__esModule",{value:true});var hr=G(),jp={message:({schemaCode:e})=>(0, hr.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0, hr._)`{multipleOf: ${e}}`},Np={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:jp,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0, hr._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0, hr._)`${a} !== parseInt(${a})`;e.fail$data((0, hr._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`);}};Gs.default=Np;});var Ji=x(Ks=>{Object.defineProperty(Ks,"__esModule",{value:true});function Ui(e){let t=e.length,r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}Ks.default=Ui;Ui.code='require("ajv/dist/runtime/ucs2length").default';});var Hi=x(Us=>{Object.defineProperty(Us,"__esModule",{value:true});var _t=G(),qp=H(),Dp=Ji(),Fp={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return (0, _t.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0, _t._)`{limit: ${e}}`},Mp={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:Fp,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?_t.operators.GT:_t.operators.LT,a=s.opts.unicode===false?(0, _t._)`${r}.length`:(0, _t._)`${(0, qp.useFunc)(e.gen,Dp.default)}(${r})`;e.fail$data((0, _t._)`${a} ${o} ${n}`);}};Us.default=Mp;});var zi=x(Js=>{Object.defineProperty(Js,"__esModule",{value:true});var Lp=Te(),Vp=H(),Lt=G(),Bp={message:({schemaCode:e})=>(0, Lt.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0, Lt._)`{pattern: ${e}}`},Gp={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:Bp,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e,i=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:u}=a.opts.code,c=u.code==="new RegExp"?(0, Lt._)`new RegExp`:(0, Vp.useFunc)(t,u),l=t.let("valid");t.try(()=>t.assign(l,(0, Lt._)`${c}(${o}, ${i}).test(${r})`),()=>t.assign(l,false)),e.fail$data((0, Lt._)`!${l}`);}else {let u=(0, Lp.usePattern)(e,s);e.fail$data((0, Lt._)`!${u}.test(${r})`);}}};Js.default=Gp;});var Wi=x(Hs=>{Object.defineProperty(Hs,"__esModule",{value:true});var gr=G(),Kp={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return (0, gr.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0, gr._)`{limit: ${e}}`},Up={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:Kp,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?gr.operators.GT:gr.operators.LT;e.fail$data((0, gr._)`Object.keys(${r}).length ${s} ${n}`);}};Hs.default=Up;});var Yi=x(zs=>{Object.defineProperty(zs,"__esModule",{value:true});var yr=Te(),vr=G(),Jp=H(),Hp={message:({params:{missingProperty:e}})=>(0, vr.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0, vr._)`{missingProperty: ${e}}`},zp={keyword:"required",type:"object",schemaType:"array",$data:true,error:Hp,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:a}=e,{opts:i}=a;if(!o&&r.length===0)return;let u=r.length>=i.loopRequired;if(a.allErrors?c():l(),i.strictRequired){let g=e.parentSchema.properties,{definedProperties:f}=e.it;for(let p of r)if(g?.[p]===void 0&&!f.has(p)){let b=a.schemaEnv.baseId+a.errSchemaPath,h=`required property "${p}" is not defined at "${b}" (strictRequired)`;(0, Jp.checkStrictMode)(a,h,a.opts.strictRequired);}}function c(){if(u||o)e.block$data(vr.nil,d);else for(let g of r)(0, yr.checkReportMissingProp)(e,g);}function l(){let g=t.let("missing");if(u||o){let f=t.let("valid",true);e.block$data(f,()=>y(g,f)),e.ok(f);}else t.if((0, yr.checkMissingProp)(e,r,g)),(0, yr.reportMissingProp)(e,g),t.else();}function d(){t.forOf("prop",n,g=>{e.setParams({missingProperty:g}),t.if((0, yr.noPropertyInData)(t,s,g,i.ownProperties),()=>e.error());});}function y(g,f){e.setParams({missingProperty:g}),t.forOf(g,n,()=>{t.assign(f,(0, yr.propertyInData)(t,s,g,i.ownProperties)),t.if((0, vr.not)(f),()=>{e.error(),t.break();});},vr.nil);}}};zs.default=zp;});var Xi=x(Ws=>{Object.defineProperty(Ws,"__esModule",{value:true});var kr=G(),Wp={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return (0, kr.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0, kr._)`{limit: ${e}}`},Yp={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:Wp,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?kr.operators.GT:kr.operators.LT;e.fail$data((0, kr._)`${r}.length ${s} ${n}`);}};Ws.default=Yp;});var un=x(Ys=>{Object.defineProperty(Ys,"__esModule",{value:true});var Qi=bs();Qi.code='require("ajv/dist/runtime/equal").default';Ys.default=Qi;});var Zi=x(Qs=>{Object.defineProperty(Qs,"__esModule",{value:true});var Xs=or(),le=G(),Xp=H(),Qp=un(),Zp={message:({params:{i:e,j:t}})=>(0, le.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0, le._)`{i: ${e}, j: ${t}}`},em={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:Zp,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;let u=t.let("valid"),c=o.items?(0, Xs.getSchemaTypes)(o.items):[];e.block$data(u,l,(0, le._)`${a} === false`),e.ok(u);function l(){let f=t.let("i",(0, le._)`${r}.length`),p=t.let("j");e.setParams({i:f,j:p}),t.assign(u,true),t.if((0, le._)`${f} > 1`,()=>(d()?y:g)(f,p));}function d(){return c.length>0&&!c.some(f=>f==="object"||f==="array")}function y(f,p){let b=t.name("item"),h=(0, Xs.checkDataTypes)(c,b,i.opts.strictNumbers,Xs.DataType.Wrong),m=t.const("indices",(0, le._)`{}`);t.for((0, le._)`;${f}--;`,()=>{t.let(b,(0, le._)`${r}[${f}]`),t.if(h,(0, le._)`continue`),c.length>1&&t.if((0, le._)`typeof ${b} == "string"`,(0, le._)`${b} += "_"`),t.if((0, le._)`typeof ${m}[${b}] == "number"`,()=>{t.assign(p,(0, le._)`${m}[${b}]`),e.error(),t.assign(u,false).break();}).code((0, le._)`${m}[${b}] = ${f}`);});}function g(f,p){let b=(0, Xp.useFunc)(t,Qp.default),h=t.name("outer");t.label(h).for((0, le._)`;${f}--;`,()=>t.for((0, le._)`${p} = ${f}; ${p}--;`,()=>t.if((0, le._)`${b}(${r}[${f}], ${r}[${p}])`,()=>{e.error(),t.assign(u,false).break(h);})));}}};Qs.default=em;});var eu=x(eo=>{Object.defineProperty(eo,"__esModule",{value:true});var Zs=G(),tm=H(),rm=un(),nm={message:"must be equal to constant",params:({schemaCode:e})=>(0, Zs._)`{allowedValue: ${e}}`},sm={keyword:"const",$data:true,error:nm,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0, Zs._)`!${(0, tm.useFunc)(t,rm.default)}(${r}, ${s})`):e.fail((0, Zs._)`${o} !== ${r}`);}};eo.default=sm;});var tu=x(to=>{Object.defineProperty(to,"__esModule",{value:true});var br=G(),om=H(),am=un(),im={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0, br._)`{allowedValues: ${e}}`},um={keyword:"enum",schemaType:"array",$data:true,error:im,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:a}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let i=s.length>=a.opts.loopEnum,u,c=()=>u??(u=(0, om.useFunc)(t,am.default)),l;if(i||n)l=t.let("valid"),e.block$data(l,d);else {if(!Array.isArray(s))throw new Error("ajv implementation error");let g=t.const("vSchema",o);l=(0, br.or)(...s.map((f,p)=>y(g,p)));}e.pass(l);function d(){t.assign(l,false),t.forOf("v",o,g=>t.if((0, br._)`${c()}(${r}, ${g})`,()=>t.assign(l,true).break()));}function y(g,f){let p=s[f];return typeof p=="object"&&p!==null?(0, br._)`${c()}(${r}, ${g}[${f}])`:(0, br._)`${r} === ${p}`}}};to.default=um;});var ru=x(ro=>{Object.defineProperty(ro,"__esModule",{value:true});var cm=Gi(),dm=Ki(),lm=Hi(),fm=zi(),pm=Wi(),mm=Yi(),hm=Xi(),gm=Zi(),ym=eu(),vm=tu(),km=[cm.default,dm.default,lm.default,fm.default,pm.default,mm.default,hm.default,gm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},ym.default,vm.default];ro.default=km;});var so=x(Sr=>{Object.defineProperty(Sr,"__esModule",{value:true});Sr.validateAdditionalItems=void 0;var Rt=G(),no=H(),bm={message:({params:{len:e}})=>(0, Rt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, Rt._)`{limit: ${e}}`},Sm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:bm,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0, no.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}nu(e,n);}};function nu(e,t){let{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=true;let i=r.const("len",(0, Rt._)`${s}.length`);if(n===false)e.setParams({len:t.length}),e.pass((0, Rt._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0, no.alwaysValidSchema)(a,n)){let c=r.var("valid",(0, Rt._)`${i} <= ${t.length}`);r.if((0, Rt.not)(c),()=>u(c)),e.ok(c);}function u(c){r.forRange("i",t.length,i,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:no.Type.Num},c),a.allErrors||r.if((0, Rt.not)(c),()=>r.break());});}}Sr.validateAdditionalItems=nu;Sr.default=Sm;});var oo=x(wr=>{Object.defineProperty(wr,"__esModule",{value:true});wr.validateTuple=void 0;var su=G(),cn=H(),wm=Te(),_m={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return ou(e,"additionalItems",t);r.items=true,!(0, cn.alwaysValidSchema)(r,t)&&e.ok((0, wm.validateArray)(e));}};function ou(e,t,r=e.schema){let{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;l(s),i.opts.unevaluated&&r.length&&i.items!==true&&(i.items=cn.mergeEvaluated.items(n,r.length,i.items));let u=n.name("valid"),c=n.const("len",(0, su._)`${o}.length`);r.forEach((d,y)=>{(0, cn.alwaysValidSchema)(i,d)||(n.if((0, su._)`${c} > ${y}`,()=>e.subschema({keyword:a,schemaProp:y,dataProp:y},u)),e.ok(u));});function l(d){let{opts:y,errSchemaPath:g}=i,f=r.length,p=f===d.minItems&&(f===d.maxItems||d[t]===false);if(y.strictTuples&&!p){let b=`"${a}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${g}"`;(0, cn.checkStrictMode)(i,b,y.strictTuples);}}}wr.validateTuple=ou;wr.default=_m;});var au=x(ao=>{Object.defineProperty(ao,"__esModule",{value:true});var Rm=oo(),$m={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0, Rm.validateTuple)(e,"items")};ao.default=$m;});var uu=x(io=>{Object.defineProperty(io,"__esModule",{value:true});var iu=G(),Cm=H(),Em=Te(),xm=so(),Tm={message:({params:{len:e}})=>(0, iu.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, iu._)`{limit: ${e}}`},Am={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Tm,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=true,!(0, Cm.alwaysValidSchema)(n,t)&&(s?(0, xm.validateAdditionalItems)(e,s):e.ok((0, Em.validateArray)(e)));}};io.default=Am;});var cu=x(uo=>{Object.defineProperty(uo,"__esModule",{value:true});var Ie=G(),dn=H(),Im={message:({params:{min:e,max:t}})=>t===void 0?(0, Ie.str)`must contain at least ${e} valid item(s)`:(0, Ie.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0, Ie._)`{minContains: ${e}}`:(0, Ie._)`{minContains: ${e}, maxContains: ${t}}`},Pm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:Im,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e,a,i,{minContains:u,maxContains:c}=n;o.opts.next?(a=u===void 0?1:u,i=c):a=1;let l=t.const("len",(0, Ie._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0, dn.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0, dn.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0, dn.alwaysValidSchema)(o,r)){let p=(0, Ie._)`${l} >= ${a}`;i!==void 0&&(p=(0, Ie._)`${p} && ${l} <= ${i}`),e.pass(p);return}o.items=true;let d=t.name("valid");i===void 0&&a===1?g(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,true),i!==void 0&&t.if((0, Ie._)`${s}.length > 0`,y)):(t.let(d,false),y()),e.result(d,()=>e.reset());function y(){let p=t.name("_valid"),b=t.let("count",0);g(p,()=>t.if(p,()=>f(b)));}function g(p,b){t.forRange("i",0,l,h=>{e.subschema({keyword:"contains",dataProp:h,dataPropType:dn.Type.Num,compositeRule:true},p),b();});}function f(p){t.code((0, Ie._)`${p}++`),i===void 0?t.if((0, Ie._)`${p} >= ${a}`,()=>t.assign(d,true).break()):(t.if((0, Ie._)`${p} > ${i}`,()=>t.assign(d,false).break()),a===1?t.assign(d,true):t.if((0, Ie._)`${p} >= ${a}`,()=>t.assign(d,true)));}}};uo.default=Pm;});var fu=x(Ve=>{Object.defineProperty(Ve,"__esModule",{value:true});Ve.validateSchemaDeps=Ve.validatePropertyDeps=Ve.error=void 0;var co=G(),Om=H(),_r=Te();Ve.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return (0, co.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0, co._)`{property: ${e},
|
|
6
6
|
missingProperty: ${n},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${r}}`};var km={keyword:"dependencies",type:"object",schemaType:"object",error:Ve.error,code(e){let[t,r]=_m(e);eu(e,t),tu(e,r);}};function _m({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n];}return [t,r]}function eu(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let a in t){let i=t[a];if(i.length===0)continue;let u=(0, wr.propertyInData)(r,n,a,s.opts.ownProperties);e.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),s.allErrors?r.if(u,()=>{for(let c of i)(0, wr.checkReportMissingProp)(e,c);}):(r.if((0, oo._)`${u} && (${(0, wr.checkMissingProp)(e,i,o)})`),(0, wr.reportMissingProp)(e,o),r.else());}}Ve.validatePropertyDeps=eu;function tu(e,t=e.schema){let{gen:r,data:n,keyword:s,it:o}=e,a=r.name("valid");for(let i in t)(0, wm.alwaysValidSchema)(o,t[i])||(r.if((0, wr.propertyInData)(r,n,i,o.opts.ownProperties),()=>{let u=e.subschema({keyword:s,schemaProp:i},a);e.mergeValidEvaluated(u,a);},()=>r.var(a,true)),e.ok(a));}Ve.validateSchemaDeps=tu;Ve.default=km;});var su=x(ao=>{Object.defineProperty(ao,"__esModule",{value:true});var nu=G(),Rm=H(),Cm={message:"property name must be valid",params:({params:e})=>(0, nu._)`{propertyName: ${e.propertyName}}`},$m={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Cm,code(e){let{gen:t,schema:r,data:n,it:s}=e;if((0, Rm.alwaysValidSchema)(s,r))return;let o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:true},o),t.if((0, nu.not)(o),()=>{e.error(true),s.allErrors||t.break();});}),e.ok(o);}};ao.default=$m;});var uo=x(io=>{Object.defineProperty(io,"__esModule",{value:true});var cn=Te(),Ne=G(),Em=Ue(),dn=H(),xm={message:"must NOT have additional properties",params:({params:e})=>(0, Ne._)`{additionalProperty: ${e.additionalProperty}}`},Tm={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:xm,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:i,opts:u}=a;if(a.props=true,u.removeAdditional!=="all"&&(0, dn.alwaysValidSchema)(a,r))return;let c=(0, cn.allSchemaProperties)(n.properties),l=(0, cn.allSchemaProperties)(n.patternProperties);d(),e.ok((0, Ne._)`${o} === ${Em.default.errors}`);function d(){t.forIn("key",s,S=>{!c.length&&!l.length?f(S):t.if(v(S),()=>f(S));});}function v(S){let h;if(c.length>8){let m=(0, dn.schemaRefOrVal)(a,n.properties,"properties");h=(0, cn.isOwnProperty)(t,m,S);}else c.length?h=(0, Ne.or)(...c.map(m=>(0, Ne._)`${S} === ${m}`)):h=Ne.nil;return l.length&&(h=(0, Ne.or)(h,...l.map(m=>(0, Ne._)`${(0, cn.usePattern)(e,m)}.test(${S})`))),(0, Ne.not)(h)}function g(S){t.code((0, Ne._)`delete ${s}[${S}]`);}function f(S){if(u.removeAdditional==="all"||u.removeAdditional&&r===false){g(S);return}if(r===false){e.setParams({additionalProperty:S}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0, dn.alwaysValidSchema)(a,r)){let h=t.name("valid");u.removeAdditional==="failing"?(p(S,h,false),t.if((0, Ne.not)(h),()=>{e.reset(),g(S);})):(p(S,h),i||t.if((0, Ne.not)(h),()=>t.break()));}}function p(S,h,m){let y={keyword:"additionalProperties",dataProp:S,dataPropType:dn.Type.Str};m===false&&Object.assign(y,{compositeRule:true,createErrors:false,allErrors:false}),e.subschema(y,h);}}};io.default=Tm;});var iu=x(lo=>{Object.defineProperty(lo,"__esModule",{value:true});var Am=ir(),ou=Te(),co=H(),au=uo(),Im={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&au.default.code(new Am.KeywordCxt(o,au.default,"additionalProperties"));let a=(0, ou.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==true&&(o.props=co.mergeEvaluated.props(t,(0, co.toHash)(a),o.props));let i=a.filter(d=>!(0, co.alwaysValidSchema)(o,r[d]));if(i.length===0)return;let u=t.name("valid");for(let d of i)c(d)?l(d):(t.if((0, ou.propertyInData)(t,s,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(u,true),t.endIf()),e.it.definedProperties.add(d),e.ok(u);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u);}}};lo.default=Im;});var lu=x(fo=>{Object.defineProperty(fo,"__esModule",{value:true});var uu=Te(),ln=G(),cu=H(),du=H(),Pm={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:a}=o,i=(0, uu.allSchemaProperties)(r),u=i.filter(p=>(0, cu.alwaysValidSchema)(o,r[p]));if(i.length===0||u.length===i.length&&(!o.opts.unevaluated||o.props===true))return;let c=a.strictSchema&&!a.allowMatchingProperties&&s.properties,l=t.name("valid");o.props!==true&&!(o.props instanceof ln.Name)&&(o.props=(0, du.evaluatedPropsToName)(t,o.props));let{props:d}=o;v();function v(){for(let p of i)c&&g(p),o.allErrors?f(p):(t.var(l,true),f(p),t.if(l));}function g(p){for(let S in c)new RegExp(p).test(S)&&(0, cu.checkStrictMode)(o,`property ${S} matches pattern ${p} (use allowMatchingProperties)`);}function f(p){t.forIn("key",n,S=>{t.if((0, ln._)`${(0, uu.usePattern)(e,p)}.test(${S})`,()=>{let h=u.includes(p);h||e.subschema({keyword:"patternProperties",schemaProp:p,dataProp:S,dataPropType:du.Type.Str},l),o.opts.unevaluated&&d!==true?t.assign((0, ln._)`${d}[${S}]`,true):!h&&!o.allErrors&&t.if((0, ln.not)(l),()=>t.break());});});}}};fo.default=Pm;});var fu=x(po=>{Object.defineProperty(po,"__esModule",{value:true});var Om=H(),jm={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){let{gen:t,schema:r,it:n}=e;if((0, Om.alwaysValidSchema)(n,r)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},s),e.failResult(s,()=>e.reset(),()=>e.error());},error:{message:"must NOT be valid"}};po.default=jm;});var pu=x(mo=>{Object.defineProperty(mo,"__esModule",{value:true});var Nm=Te(),qm={keyword:"anyOf",schemaType:"array",trackErrors:true,code:Nm.validateUnion,error:{message:"must match a schema in anyOf"}};mo.default=qm;});var mu=x(ho=>{Object.defineProperty(ho,"__esModule",{value:true});var fn=G(),Dm=H(),Fm={message:"must match exactly one schema in oneOf",params:({params:e})=>(0, fn._)`{passingSchemas: ${e.passing}}`},Mm={keyword:"oneOf",schemaType:"array",trackErrors:true,error:Fm,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,a=t.let("valid",false),i=t.let("passing",null),u=t.name("_valid");e.setParams({passing:i}),t.block(c),e.result(a,()=>e.reset(),()=>e.error(true));function c(){o.forEach((l,d)=>{let v;(0, Dm.alwaysValidSchema)(s,l)?t.var(u,true):v=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:true},u),d>0&&t.if((0, fn._)`${u} && ${a}`).assign(a,false).assign(i,(0, fn._)`[${i}, ${d}]`).else(),t.if(u,()=>{t.assign(a,true),t.assign(i,d),v&&e.mergeEvaluated(v,fn.Name);});});}}};ho.default=Mm;});var hu=x(go=>{Object.defineProperty(go,"__esModule",{value:true});var Lm=H(),Vm={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=t.name("valid");r.forEach((o,a)=>{if((0, Lm.alwaysValidSchema)(n,o))return;let i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i);});}};go.default=Vm;});var vu=x(yo=>{Object.defineProperty(yo,"__esModule",{value:true});var pn=G(),yu=H(),Bm={message:({params:e})=>(0, pn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0, pn._)`{failingKeyword: ${e.ifClause}}`},Gm={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:Bm,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0, yu.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=gu(n,"then"),o=gu(n,"else");if(!s&&!o)return;let a=t.let("valid",true),i=t.name("_valid");if(u(),e.reset(),s&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(i,c("then",l),c("else",l));}else s?t.if(i,c("then")):t.if((0, pn.not)(i),c("else"));e.pass(a,()=>e.error(true));function u(){let l=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},i);e.mergeEvaluated(l);}function c(l,d){return ()=>{let v=e.subschema({keyword:l},i);t.assign(a,i),e.mergeValidEvaluated(v,a),d?t.assign(d,(0, pn._)`${l}`):e.setParams({ifClause:l});}}}};function gu(e,t){let r=e.schema[t];return r!==void 0&&!(0, yu.alwaysValidSchema)(e,r)}yo.default=Gm;});var bu=x(vo=>{Object.defineProperty(vo,"__esModule",{value:true});var Km=H(),Um={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0, Km.checkStrictMode)(r,`"${e}" without "if" is ignored`);}};vo.default=Um;});var Su=x(bo=>{Object.defineProperty(bo,"__esModule",{value:true});var Jm=eo(),Hm=Yi(),zm=to(),Wm=Qi(),Ym=Zi(),Xm=ru(),Qm=su(),Zm=uo(),eh=iu(),th=lu(),rh=fu(),nh=pu(),sh=mu(),oh=hu(),ah=vu(),ih=bu();function uh(e=false){let t=[rh.default,nh.default,sh.default,oh.default,ah.default,ih.default,Qm.default,Zm.default,Xm.default,eh.default,th.default];return e?t.push(Hm.default,Wm.default):t.push(Jm.default,zm.default),t.push(Ym.default),t}bo.default=uh;});var wu=x(So=>{Object.defineProperty(So,"__esModule",{value:true});var ie=G(),ch={message:({schemaCode:e})=>(0, ie.str)`must match format "${e}"`,params:({schemaCode:e})=>(0, ie._)`{format: ${e}}`},dh={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:ch,code(e,t){let{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=i;if(!u.validateFormats)return;s?v():g();function v(){let f=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),p=r.const("fDef",(0, ie._)`${f}[${a}]`),S=r.let("fType"),h=r.let("format");r.if((0, ie._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(S,(0, ie._)`${p}.type || "string"`).assign(h,(0, ie._)`${p}.validate`),()=>r.assign(S,(0, ie._)`"string"`).assign(h,p)),e.fail$data((0, ie.or)(m(),y()));function m(){return u.strictSchema===false?ie.nil:(0, ie._)`${a} && !${h}`}function y(){let k=l.$async?(0, ie._)`(${p}.async ? await ${h}(${n}) : ${h}(${n}))`:(0, ie._)`${h}(${n})`,w=(0, ie._)`(typeof ${h} == "function" ? ${k} : ${h}.test(${n}))`;return (0, ie._)`${h} && ${h} !== true && ${S} === ${t} && !${w}`}}function g(){let f=d.formats[o];if(!f){m();return}if(f===true)return;let[p,S,h]=y(f);p===t&&e.pass(k());function m(){if(u.strictSchema===false){d.logger.warn(w());return}throw new Error(w());function w(){return `unknown format "${o}" ignored in schema at path "${c}"`}}function y(w){let C=w instanceof RegExp?(0, ie.regexpCode)(w):u.code.formats?(0, ie._)`${u.code.formats}${(0, ie.getProperty)(o)}`:void 0,_=r.scopeValue("formats",{key:o,ref:w,code:C});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0, ie._)`${_}.validate`]:["string",w,_]}function k(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw new Error("async format in sync schema");return (0, ie._)`await ${h}(${n})`}return typeof S=="function"?(0, ie._)`${h}(${n})`:(0, ie._)`${h}.test(${n})`}}}};So.default=dh;});var ku=x(wo=>{Object.defineProperty(wo,"__esModule",{value:true});var lh=wu(),fh=[lh.default];wo.default=fh;});var _u=x(Mt=>{Object.defineProperty(Mt,"__esModule",{value:true});Mt.contentVocabulary=Mt.metadataVocabulary=void 0;Mt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Mt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var Cu=x(ko=>{Object.defineProperty(ko,"__esModule",{value:true});var ph=Pi(),mh=Ji(),hh=Su(),gh=ku(),Ru=_u(),yh=[ph.default,mh.default,(0, hh.default)(),gh.default,Ru.metadataVocabulary,Ru.contentVocabulary];ko.default=yh;});var Eu=x(mn=>{Object.defineProperty(mn,"__esModule",{value:true});mn.DiscrError=void 0;var $u;(function(e){e.Tag="tag",e.Mapping="mapping";})($u||(mn.DiscrError=$u={}));});var Tu=x(Ro=>{Object.defineProperty(Ro,"__esModule",{value:true});var Lt=G(),_o=Eu(),xu=Wr(),vh=ur(),bh=H(),Sh={message:({params:{discrError:e,tagName:t}})=>e===_o.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0, Lt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},wh={keyword:"discriminator",type:"object",schemaType:"object",error:Sh,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:a}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=n.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let u=t.let("valid",false),c=t.const("tag",(0, Lt._)`${r}${(0, Lt.getProperty)(i)}`);t.if((0, Lt._)`typeof ${c} == "string"`,()=>l(),()=>e.error(false,{discrError:_o.DiscrError.Tag,tag:c,tagName:i})),e.ok(u);function l(){let g=v();t.if(false);for(let f in g)t.elseIf((0, Lt._)`${c} === ${f}`),t.assign(u,d(g[f]));t.else(),e.error(false,{discrError:_o.DiscrError.Mapping,tag:c,tagName:i}),t.endIf();}function d(g){let f=t.name("valid"),p=e.subschema({keyword:"oneOf",schemaProp:g},f);return e.mergeEvaluated(p,Lt.Name),f}function v(){var g;let f={},p=h(s),S=true;for(let k=0;k<a.length;k++){let w=a[k];if(w?.$ref&&!(0, bh.schemaHasRulesButRef)(w,o.self.RULES)){let _=w.$ref;if(w=xu.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,_),w instanceof xu.SchemaEnv&&(w=w.schema),w===void 0)throw new vh.default(o.opts.uriResolver,o.baseId,_)}let C=(g=w?.properties)===null||g===void 0?void 0:g[i];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);S=S&&(p||h(w)),m(C,k);}if(!S)throw new Error(`discriminator: "${i}" must be required`);return f;function h({required:k}){return Array.isArray(k)&&k.includes(i)}function m(k,w){if(k.const)y(k.const,w);else if(k.enum)for(let C of k.enum)y(C,w);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function y(k,w){if(typeof k!="string"||k in f)throw new Error(`discriminator: "${i}" values must be unique strings`);f[k]=w;}}}};Ro.default=wh;});var Au=x((Rv,kh)=>{kh.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:true,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:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},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:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},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:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},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:true};});var Pu=x((se,Co)=>{Object.defineProperty(se,"__esModule",{value:true});se.MissingRefError=se.ValidationError=se.CodeGen=se.Name=se.nil=se.stringify=se.str=se._=se.KeywordCxt=se.Ajv=void 0;var _h=$i(),Rh=Cu(),Ch=Tu(),Iu=Au(),$h=["/properties"],hn="http://json-schema.org/draft-07/schema",Vt=class extends _h.default{_addVocabularies(){super._addVocabularies(),Rh.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Ch.default);}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Iu,$h):Iu;this.addMetaSchema(t,hn,false),this.refs["http://json-schema.org/schema"]=hn;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(hn)?hn:void 0)}};se.Ajv=Vt;Co.exports=se=Vt;Co.exports.Ajv=Vt;Object.defineProperty(se,"__esModule",{value:true});se.default=Vt;var Eh=ir();Object.defineProperty(se,"KeywordCxt",{enumerable:true,get:function(){return Eh.KeywordCxt}});var Bt=G();Object.defineProperty(se,"_",{enumerable:true,get:function(){return Bt._}});Object.defineProperty(se,"str",{enumerable:true,get:function(){return Bt.str}});Object.defineProperty(se,"stringify",{enumerable:true,get:function(){return Bt.stringify}});Object.defineProperty(se,"nil",{enumerable:true,get:function(){return Bt.nil}});Object.defineProperty(se,"Name",{enumerable:true,get:function(){return Bt.Name}});Object.defineProperty(se,"CodeGen",{enumerable:true,get:function(){return Bt.CodeGen}});var xh=Hr();Object.defineProperty(se,"ValidationError",{enumerable:true,get:function(){return xh.default}});var Th=ur();Object.defineProperty(se,"MissingRefError",{enumerable:true,get:function(){return Th.default}});});var Ar="b64:";function Ic(e){let t=new TextEncoder().encode(e),r=globalThis.Buffer,n;if(r)n=r.from(t).toString("base64");else if(typeof btoa=="function"){let s="";for(let o of t)s+=String.fromCharCode(o);n=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Pc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(t,"base64").toString("utf8");if(typeof atob=="function"){let n=atob(t),s=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)s[o]=n.charCodeAt(o);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function oe(e){return `${Ar}${Ic(JSON.stringify(e))}`}function $e(e){if(!e.startsWith(Ar))throw new Error(`Invalid ref format (expected ${Ar}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(Pc(e.slice(Ar.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!t||typeof t!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=t;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function Lo(e,t,r){let n=e.tryAcquire();if(!n)return false;try{await t();}finally{n();}return r?.(),true}function Kt(e,t,r=".json"){let n=ue__namespace.join(e,".tmp");return P__namespace.mkdirSync(n,{recursive:true}),ue__namespace.join(n,`${t}-${Date.now()}-${Math.random().toString(36).slice(2,8)}${r}`)}function lt(...e){return ue__namespace.join(...e)}function Ko(e){return ue__namespace.isAbsolute(e)}function In(){return crypto.randomUUID()}function Uo(e){return crypto.createHash("sha256").update(e).digest("hex")}function Jo(e){return ue__namespace.dirname(url.fileURLToPath(e))}function Fc(e){if(typeof e=="object"&&e!==null){let{command:r,args:n=[],...s}=e,o=Bo(r,n);return {...s,command:o.command,args:o.args}}let t=Ho(e);if(t.length===0)throw new Error(`Empty command spec: ${JSON.stringify(e)}`);return Bo(t[0],t.slice(1))}function Bo(e,t){return /^(node|node\.exe)$/i.test(e)?{command:process.execPath,args:t}:/\.m?js$/i.test(e)?{command:process.execPath,args:[e,...t]}:{command:e,args:t}}function Ho(e){let t=[],r="",n=null;for(let s of e.trim()){if(n){s===n?n=null:r+=s;continue}if(s==='"'||s==="'"){n=s;continue}if(/\s/.test(s)){r&&(t.push(r),r="");continue}r+=s;}if(n)throw new Error(`Unterminated quote in command: ${e}`);return r&&t.push(r),t}function Pn(e){return process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)}function zo(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a}=e;return child_process.execFileSync(r,n,{shell:Pn(r),timeout:a,encoding:t?.encoding??"utf-8",cwd:s,windowsHide:true,env:o?{...process.env,...o}:void 0,input:t?.input})}function Mc(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a=3e4}=e;child_process.execFile(r,n,{shell:Pn(r),encoding:"utf8",windowsHide:true,timeout:a,maxBuffer:10*1024*1024,cwd:s,env:o?{...process.env,...o}:void 0},(i,u,c)=>t(i??null,u,c));}ue__namespace.join(An__namespace.tmpdir(),".board-live-cards-git-bash-cache.json");function Pr(e){let{command:t,args:r=[]}=e;if(process.platform==="win32"){child_process.spawn(t,r,{detached:true,stdio:"ignore",windowsHide:true,shell:Pn(t)}).unref();return}child_process.spawn(t,r,{detached:true,stdio:"ignore"}).unref();}function On(e,t,r){let n=ue__namespace.join(e,"board-live-cards-cli.js");if(P__namespace.existsSync(n))return {cmd:process.execPath,args:[n,t,...r]};let s=ue__namespace.join(e,"board-live-cards-cli.ts"),o=ue__namespace.join(e,"..","..","node_modules","tsx","dist","cli.mjs"),a=ue__namespace.join(e,"..","..","node_modules",".bin","tsx"),i=P__namespace.existsSync(o)?o:a;return P__namespace.existsSync(s)&&P__namespace.existsSync(i)?{cmd:process.execPath,args:[i,s,t,...r]}:{cmd:process.platform==="win32"?"npx.cmd":"npx",args:["tsx",s,t,...r]}}function jn(e){let t=ue__namespace.join(e,"..","..","..","dev","board-live-cards-cli.js");if(P__namespace.existsSync(t))return t;let r=ue__namespace.join(e,"..","..","dev","board-live-cards-cli.js");if(P__namespace.existsSync(r))return r;let n=ue__namespace.join(e,"board-live-cards-cli.js");if(P__namespace.existsSync(n))return n;throw new Error(`resolveBoardCliCallbackTarget: cannot find callback target in ${e} (expected dev/board-live-cards-cli.js wrapper or ${n})`)}function Wo(e,t,r){let n=["--base-ref",oe(t)];r&&n.push("--notify-channel",r);let{cmd:s,args:o}=On(e,"process-accumulated-events",n);Pr({command:s,args:o});}function Lc(e){return process.platform==="win32"?`\\\\.\\pipe\\${e}`:ue__namespace.join(An__namespace.tmpdir(),`${e}.sock`)}var Ir=new Map;function Yo(e,t,r){if(t.length===0)return;let n=t.map(i=>JSON.stringify(i)).join(`
|
|
8
|
+
deps: ${r}}`};var jm={keyword:"dependencies",type:"object",schemaType:"object",error:Ve.error,code(e){let[t,r]=Nm(e);du(e,t),lu(e,r);}};function Nm({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n];}return [t,r]}function du(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let a in t){let i=t[a];if(i.length===0)continue;let u=(0, _r.propertyInData)(r,n,a,s.opts.ownProperties);e.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),s.allErrors?r.if(u,()=>{for(let c of i)(0, _r.checkReportMissingProp)(e,c);}):(r.if((0, co._)`${u} && (${(0, _r.checkMissingProp)(e,i,o)})`),(0, _r.reportMissingProp)(e,o),r.else());}}Ve.validatePropertyDeps=du;function lu(e,t=e.schema){let{gen:r,data:n,keyword:s,it:o}=e,a=r.name("valid");for(let i in t)(0, Om.alwaysValidSchema)(o,t[i])||(r.if((0, _r.propertyInData)(r,n,i,o.opts.ownProperties),()=>{let u=e.subschema({keyword:s,schemaProp:i},a);e.mergeValidEvaluated(u,a);},()=>r.var(a,true)),e.ok(a));}Ve.validateSchemaDeps=lu;Ve.default=jm;});var mu=x(lo=>{Object.defineProperty(lo,"__esModule",{value:true});var pu=G(),qm=H(),Dm={message:"property name must be valid",params:({params:e})=>(0, pu._)`{propertyName: ${e.propertyName}}`},Fm={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Dm,code(e){let{gen:t,schema:r,data:n,it:s}=e;if((0, qm.alwaysValidSchema)(s,r))return;let o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:true},o),t.if((0, pu.not)(o),()=>{e.error(true),s.allErrors||t.break();});}),e.ok(o);}};lo.default=Fm;});var po=x(fo=>{Object.defineProperty(fo,"__esModule",{value:true});var ln=Te(),Ne=G(),Mm=Ue(),fn=H(),Lm={message:"must NOT have additional properties",params:({params:e})=>(0, Ne._)`{additionalProperty: ${e.additionalProperty}}`},Vm={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:Lm,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:i,opts:u}=a;if(a.props=true,u.removeAdditional!=="all"&&(0, fn.alwaysValidSchema)(a,r))return;let c=(0, ln.allSchemaProperties)(n.properties),l=(0, ln.allSchemaProperties)(n.patternProperties);d(),e.ok((0, Ne._)`${o} === ${Mm.default.errors}`);function d(){t.forIn("key",s,b=>{!c.length&&!l.length?f(b):t.if(y(b),()=>f(b));});}function y(b){let h;if(c.length>8){let m=(0, fn.schemaRefOrVal)(a,n.properties,"properties");h=(0, ln.isOwnProperty)(t,m,b);}else c.length?h=(0, Ne.or)(...c.map(m=>(0, Ne._)`${b} === ${m}`)):h=Ne.nil;return l.length&&(h=(0, Ne.or)(h,...l.map(m=>(0, Ne._)`${(0, ln.usePattern)(e,m)}.test(${b})`))),(0, Ne.not)(h)}function g(b){t.code((0, Ne._)`delete ${s}[${b}]`);}function f(b){if(u.removeAdditional==="all"||u.removeAdditional&&r===false){g(b);return}if(r===false){e.setParams({additionalProperty:b}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0, fn.alwaysValidSchema)(a,r)){let h=t.name("valid");u.removeAdditional==="failing"?(p(b,h,false),t.if((0, Ne.not)(h),()=>{e.reset(),g(b);})):(p(b,h),i||t.if((0, Ne.not)(h),()=>t.break()));}}function p(b,h,m){let v={keyword:"additionalProperties",dataProp:b,dataPropType:fn.Type.Str};m===false&&Object.assign(v,{compositeRule:true,createErrors:false,allErrors:false}),e.subschema(v,h);}}};fo.default=Vm;});var yu=x(ho=>{Object.defineProperty(ho,"__esModule",{value:true});var Bm=cr(),hu=Te(),mo=H(),gu=po(),Gm={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&gu.default.code(new Bm.KeywordCxt(o,gu.default,"additionalProperties"));let a=(0, hu.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==true&&(o.props=mo.mergeEvaluated.props(t,(0, mo.toHash)(a),o.props));let i=a.filter(d=>!(0, mo.alwaysValidSchema)(o,r[d]));if(i.length===0)return;let u=t.name("valid");for(let d of i)c(d)?l(d):(t.if((0, hu.propertyInData)(t,s,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(u,true),t.endIf()),e.it.definedProperties.add(d),e.ok(u);function c(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u);}}};ho.default=Gm;});var Su=x(go=>{Object.defineProperty(go,"__esModule",{value:true});var vu=Te(),pn=G(),ku=H(),bu=H(),Km={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:a}=o,i=(0, vu.allSchemaProperties)(r),u=i.filter(p=>(0, ku.alwaysValidSchema)(o,r[p]));if(i.length===0||u.length===i.length&&(!o.opts.unevaluated||o.props===true))return;let c=a.strictSchema&&!a.allowMatchingProperties&&s.properties,l=t.name("valid");o.props!==true&&!(o.props instanceof pn.Name)&&(o.props=(0, bu.evaluatedPropsToName)(t,o.props));let{props:d}=o;y();function y(){for(let p of i)c&&g(p),o.allErrors?f(p):(t.var(l,true),f(p),t.if(l));}function g(p){for(let b in c)new RegExp(p).test(b)&&(0, ku.checkStrictMode)(o,`property ${b} matches pattern ${p} (use allowMatchingProperties)`);}function f(p){t.forIn("key",n,b=>{t.if((0, pn._)`${(0, vu.usePattern)(e,p)}.test(${b})`,()=>{let h=u.includes(p);h||e.subschema({keyword:"patternProperties",schemaProp:p,dataProp:b,dataPropType:bu.Type.Str},l),o.opts.unevaluated&&d!==true?t.assign((0, pn._)`${d}[${b}]`,true):!h&&!o.allErrors&&t.if((0, pn.not)(l),()=>t.break());});});}}};go.default=Km;});var wu=x(yo=>{Object.defineProperty(yo,"__esModule",{value:true});var Um=H(),Jm={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){let{gen:t,schema:r,it:n}=e;if((0, Um.alwaysValidSchema)(n,r)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},s),e.failResult(s,()=>e.reset(),()=>e.error());},error:{message:"must NOT be valid"}};yo.default=Jm;});var _u=x(vo=>{Object.defineProperty(vo,"__esModule",{value:true});var Hm=Te(),zm={keyword:"anyOf",schemaType:"array",trackErrors:true,code:Hm.validateUnion,error:{message:"must match a schema in anyOf"}};vo.default=zm;});var Ru=x(ko=>{Object.defineProperty(ko,"__esModule",{value:true});var mn=G(),Wm=H(),Ym={message:"must match exactly one schema in oneOf",params:({params:e})=>(0, mn._)`{passingSchemas: ${e.passing}}`},Xm={keyword:"oneOf",schemaType:"array",trackErrors:true,error:Ym,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,a=t.let("valid",false),i=t.let("passing",null),u=t.name("_valid");e.setParams({passing:i}),t.block(c),e.result(a,()=>e.reset(),()=>e.error(true));function c(){o.forEach((l,d)=>{let y;(0, Wm.alwaysValidSchema)(s,l)?t.var(u,true):y=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:true},u),d>0&&t.if((0, mn._)`${u} && ${a}`).assign(a,false).assign(i,(0, mn._)`[${i}, ${d}]`).else(),t.if(u,()=>{t.assign(a,true),t.assign(i,d),y&&e.mergeEvaluated(y,mn.Name);});});}}};ko.default=Xm;});var $u=x(bo=>{Object.defineProperty(bo,"__esModule",{value:true});var Qm=H(),Zm={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=t.name("valid");r.forEach((o,a)=>{if((0, Qm.alwaysValidSchema)(n,o))return;let i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i);});}};bo.default=Zm;});var xu=x(So=>{Object.defineProperty(So,"__esModule",{value:true});var hn=G(),Eu=H(),eh={message:({params:e})=>(0, hn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0, hn._)`{failingKeyword: ${e.ifClause}}`},th={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:eh,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0, Eu.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=Cu(n,"then"),o=Cu(n,"else");if(!s&&!o)return;let a=t.let("valid",true),i=t.name("_valid");if(u(),e.reset(),s&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(i,c("then",l),c("else",l));}else s?t.if(i,c("then")):t.if((0, hn.not)(i),c("else"));e.pass(a,()=>e.error(true));function u(){let l=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},i);e.mergeEvaluated(l);}function c(l,d){return ()=>{let y=e.subschema({keyword:l},i);t.assign(a,i),e.mergeValidEvaluated(y,a),d?t.assign(d,(0, hn._)`${l}`):e.setParams({ifClause:l});}}}};function Cu(e,t){let r=e.schema[t];return r!==void 0&&!(0, Eu.alwaysValidSchema)(e,r)}So.default=th;});var Tu=x(wo=>{Object.defineProperty(wo,"__esModule",{value:true});var rh=H(),nh={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0, rh.checkStrictMode)(r,`"${e}" without "if" is ignored`);}};wo.default=nh;});var Au=x(_o=>{Object.defineProperty(_o,"__esModule",{value:true});var sh=so(),oh=au(),ah=oo(),ih=uu(),uh=cu(),ch=fu(),dh=mu(),lh=po(),fh=yu(),ph=Su(),mh=wu(),hh=_u(),gh=Ru(),yh=$u(),vh=xu(),kh=Tu();function bh(e=false){let t=[mh.default,hh.default,gh.default,yh.default,vh.default,kh.default,dh.default,lh.default,ch.default,fh.default,ph.default];return e?t.push(oh.default,ih.default):t.push(sh.default,ah.default),t.push(uh.default),t}_o.default=bh;});var Iu=x(Ro=>{Object.defineProperty(Ro,"__esModule",{value:true});var ie=G(),Sh={message:({schemaCode:e})=>(0, ie.str)`must match format "${e}"`,params:({schemaCode:e})=>(0, ie._)`{format: ${e}}`},wh={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:Sh,code(e,t){let{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=i;if(!u.validateFormats)return;s?y():g();function y(){let f=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),p=r.const("fDef",(0, ie._)`${f}[${a}]`),b=r.let("fType"),h=r.let("format");r.if((0, ie._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(b,(0, ie._)`${p}.type || "string"`).assign(h,(0, ie._)`${p}.validate`),()=>r.assign(b,(0, ie._)`"string"`).assign(h,p)),e.fail$data((0, ie.or)(m(),v()));function m(){return u.strictSchema===false?ie.nil:(0, ie._)`${a} && !${h}`}function v(){let w=l.$async?(0, ie._)`(${p}.async ? await ${h}(${n}) : ${h}(${n}))`:(0, ie._)`${h}(${n})`,S=(0, ie._)`(typeof ${h} == "function" ? ${w} : ${h}.test(${n}))`;return (0, ie._)`${h} && ${h} !== true && ${b} === ${t} && !${S}`}}function g(){let f=d.formats[o];if(!f){m();return}if(f===true)return;let[p,b,h]=v(f);p===t&&e.pass(w());function m(){if(u.strictSchema===false){d.logger.warn(S());return}throw new Error(S());function S(){return `unknown format "${o}" ignored in schema at path "${c}"`}}function v(S){let $=S instanceof RegExp?(0, ie.regexpCode)(S):u.code.formats?(0, ie._)`${u.code.formats}${(0, ie.getProperty)(o)}`:void 0,_=r.scopeValue("formats",{key:o,ref:S,code:$});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0, ie._)`${_}.validate`]:["string",S,_]}function w(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw new Error("async format in sync schema");return (0, ie._)`await ${h}(${n})`}return typeof b=="function"?(0, ie._)`${h}(${n})`:(0, ie._)`${h}.test(${n})`}}}};Ro.default=wh;});var Pu=x($o=>{Object.defineProperty($o,"__esModule",{value:true});var _h=Iu(),Rh=[_h.default];$o.default=Rh;});var Ou=x(Vt=>{Object.defineProperty(Vt,"__esModule",{value:true});Vt.contentVocabulary=Vt.metadataVocabulary=void 0;Vt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var Nu=x(Co=>{Object.defineProperty(Co,"__esModule",{value:true});var $h=Bi(),Ch=ru(),Eh=Au(),xh=Pu(),ju=Ou(),Th=[$h.default,Ch.default,(0, Eh.default)(),xh.default,ju.metadataVocabulary,ju.contentVocabulary];Co.default=Th;});var Du=x(gn=>{Object.defineProperty(gn,"__esModule",{value:true});gn.DiscrError=void 0;var qu;(function(e){e.Tag="tag",e.Mapping="mapping";})(qu||(gn.DiscrError=qu={}));});var Mu=x(xo=>{Object.defineProperty(xo,"__esModule",{value:true});var Bt=G(),Eo=Du(),Fu=Xr(),Ah=dr(),Ih=H(),Ph={message:({params:{discrError:e,tagName:t}})=>e===Eo.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0, Bt._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Oh={keyword:"discriminator",type:"object",schemaType:"object",error:Ph,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:a}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=n.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let u=t.let("valid",false),c=t.const("tag",(0, Bt._)`${r}${(0, Bt.getProperty)(i)}`);t.if((0, Bt._)`typeof ${c} == "string"`,()=>l(),()=>e.error(false,{discrError:Eo.DiscrError.Tag,tag:c,tagName:i})),e.ok(u);function l(){let g=y();t.if(false);for(let f in g)t.elseIf((0, Bt._)`${c} === ${f}`),t.assign(u,d(g[f]));t.else(),e.error(false,{discrError:Eo.DiscrError.Mapping,tag:c,tagName:i}),t.endIf();}function d(g){let f=t.name("valid"),p=e.subschema({keyword:"oneOf",schemaProp:g},f);return e.mergeEvaluated(p,Bt.Name),f}function y(){var g;let f={},p=h(s),b=true;for(let w=0;w<a.length;w++){let S=a[w];if(S?.$ref&&!(0, Ih.schemaHasRulesButRef)(S,o.self.RULES)){let _=S.$ref;if(S=Fu.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,_),S instanceof Fu.SchemaEnv&&(S=S.schema),S===void 0)throw new Ah.default(o.opts.uriResolver,o.baseId,_)}let $=(g=S?.properties)===null||g===void 0?void 0:g[i];if(typeof $!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);b=b&&(p||h(S)),m($,w);}if(!b)throw new Error(`discriminator: "${i}" must be required`);return f;function h({required:w}){return Array.isArray(w)&&w.includes(i)}function m(w,S){if(w.const)v(w.const,S);else if(w.enum)for(let $ of w.enum)v($,S);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function v(w,S){if(typeof w!="string"||w in f)throw new Error(`discriminator: "${i}" values must be unique strings`);f[w]=S;}}}};xo.default=Oh;});var Lu=x((qv,jh)=>{jh.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:true,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:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},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:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},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:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},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:true};});var Bu=x((se,To)=>{Object.defineProperty(se,"__esModule",{value:true});se.MissingRefError=se.ValidationError=se.CodeGen=se.Name=se.nil=se.stringify=se.str=se._=se.KeywordCxt=se.Ajv=void 0;var Nh=qi(),qh=Nu(),Dh=Mu(),Vu=Lu(),Fh=["/properties"],yn="http://json-schema.org/draft-07/schema",Gt=class extends Nh.default{_addVocabularies(){super._addVocabularies(),qh.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Dh.default);}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Vu,Fh):Vu;this.addMetaSchema(t,yn,false),this.refs["http://json-schema.org/schema"]=yn;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(yn)?yn:void 0)}};se.Ajv=Gt;To.exports=se=Gt;To.exports.Ajv=Gt;Object.defineProperty(se,"__esModule",{value:true});se.default=Gt;var Mh=cr();Object.defineProperty(se,"KeywordCxt",{enumerable:true,get:function(){return Mh.KeywordCxt}});var Kt=G();Object.defineProperty(se,"_",{enumerable:true,get:function(){return Kt._}});Object.defineProperty(se,"str",{enumerable:true,get:function(){return Kt.str}});Object.defineProperty(se,"stringify",{enumerable:true,get:function(){return Kt.stringify}});Object.defineProperty(se,"nil",{enumerable:true,get:function(){return Kt.nil}});Object.defineProperty(se,"Name",{enumerable:true,get:function(){return Kt.Name}});Object.defineProperty(se,"CodeGen",{enumerable:true,get:function(){return Kt.CodeGen}});var Lh=Wr();Object.defineProperty(se,"ValidationError",{enumerable:true,get:function(){return Lh.default}});var Vh=dr();Object.defineProperty(se,"MissingRefError",{enumerable:true,get:function(){return Vh.default}});});var Pr="b64:";function Vc(e){let t=new TextEncoder().encode(e),r=globalThis.Buffer,n;if(r)n=r.from(t).toString("base64");else if(typeof btoa=="function"){let s="";for(let o of t)s+=String.fromCharCode(o);n=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Bc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(t,"base64").toString("utf8");if(typeof atob=="function"){let n=atob(t),s=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)s[o]=n.charCodeAt(o);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function oe(e){return `${Pr}${Vc(JSON.stringify(e))}`}function Re(e){if(!e.startsWith(Pr))throw new Error(`Invalid ref format (expected ${Pr}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(Bc(e.slice(Pr.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!t||typeof t!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=t;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function Ko(e,t,r){let n=e.tryAcquire();if(!n)return false;try{await t();}finally{n();}return r?.(),true}function Jt(e,t,r=".json"){let n=ue__namespace.join(e,".tmp");return P__namespace.mkdirSync(n,{recursive:true}),ue__namespace.join(n,`${t}-${Date.now()}-${Math.random().toString(36).slice(2,8)}${r}`)}function pt(...e){return ue__namespace.join(...e)}function zo(e){return ue__namespace.isAbsolute(e)}function On(){return crypto.randomUUID()}function Wo(e){return crypto.createHash("sha256").update(e).digest("hex")}function Yo(e){return ue__namespace.dirname(url.fileURLToPath(e))}function zc(e){if(typeof e=="object"&&e!==null){let{command:r,args:n=[],...s}=e,o=Jo(r,n);return {...s,command:o.command,args:o.args}}let t=Xo(e);if(t.length===0)throw new Error(`Empty command spec: ${JSON.stringify(e)}`);return Jo(t[0],t.slice(1))}function Jo(e,t){return /^(node|node\.exe)$/i.test(e)?{command:process.execPath,args:t}:/\.m?js$/i.test(e)?{command:process.execPath,args:[e,...t]}:{command:e,args:t}}function Xo(e){let t=[],r="",n=null;for(let s of e.trim()){if(n){s===n?n=null:r+=s;continue}if(s==='"'||s==="'"){n=s;continue}if(/\s/.test(s)){r&&(t.push(r),r="");continue}r+=s;}if(n)throw new Error(`Unterminated quote in command: ${e}`);return r&&t.push(r),t}function jn(e){return process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)}function Qo(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a}=e;return child_process.execFileSync(r,n,{shell:jn(r),timeout:a,encoding:t?.encoding??"utf-8",cwd:s,windowsHide:true,env:o?{...process.env,...o}:void 0,input:t?.input})}function Wc(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a=3e4}=e;child_process.execFile(r,n,{shell:jn(r),encoding:"utf8",windowsHide:true,timeout:a,maxBuffer:10*1024*1024,cwd:s,env:o?{...process.env,...o}:void 0},(i,u,c)=>t(i??null,u,c));}ue__namespace.join(Pn__namespace.tmpdir(),".board-live-cards-git-bash-cache.json");function jr(e){let{command:t,args:r=[]}=e;if(process.platform==="win32"){child_process.spawn(t,r,{detached:true,stdio:"ignore",windowsHide:true,shell:jn(t)}).unref();return}child_process.spawn(t,r,{detached:true,stdio:"ignore"}).unref();}function Nn(e,t,r){let n=ue__namespace.join(e,"board-live-cards-cli.js");if(P__namespace.existsSync(n))return {cmd:process.execPath,args:[n,t,...r]};let s=ue__namespace.join(e,"board-live-cards-cli.ts"),o=ue__namespace.join(e,"..","..","node_modules","tsx","dist","cli.mjs"),a=ue__namespace.join(e,"..","..","node_modules",".bin","tsx"),i=P__namespace.existsSync(o)?o:a;return P__namespace.existsSync(s)&&P__namespace.existsSync(i)?{cmd:process.execPath,args:[i,s,t,...r]}:{cmd:process.platform==="win32"?"npx.cmd":"npx",args:["tsx",s,t,...r]}}function qn(e){let t=ue__namespace.join(e,"..","..","..","dev","board-live-cards-cli.js");if(P__namespace.existsSync(t))return t;let r=ue__namespace.join(e,"..","..","dev","board-live-cards-cli.js");if(P__namespace.existsSync(r))return r;let n=ue__namespace.join(e,"board-live-cards-cli.js");if(P__namespace.existsSync(n))return n;throw new Error(`resolveBoardCliCallbackTarget: cannot find callback target in ${e} (expected dev/board-live-cards-cli.js wrapper or ${n})`)}function Zo(e,t,r){let n=["--base-ref",oe(t)];r&&n.push("--notify-channel",r);let{cmd:s,args:o}=Nn(e,"process-accumulated-events",n);jr({command:s,args:o});}function Yc(e){return process.platform==="win32"?`\\\\.\\pipe\\${e}`:ue__namespace.join(Pn__namespace.tmpdir(),`${e}.sock`)}var Or=new Map;function ea(e,t,r){if(t.length===0)return;let n=t.map(i=>JSON.stringify(i)).join(`
|
|
9
9
|
`)+`
|
|
10
|
-
`,s=Ir.get(e);if(s&&!s.socket.destroyed){s.ready?s.socket.write(n):s.queue.push(n);return}let o=Lc(e),a=Go__namespace.createConnection(o);s={socket:a,ready:false,queue:[n]},Ir.set(e,s),a.on("connect",()=>{s.ready=true;for(let i of s.queue)a.write(i);s.queue.length=0;}),a.on("error",i=>{r?.(`[named-pipe publish] ${o}: ${i instanceof Error?i.message:String(i)}`),Ir.delete(e);}),a.on("close",()=>{Ir.delete(e);});}function Or(){return {executeSync(e,t,r){return zo({command:e,args:t,cwd:r?.cwd,timeoutMs:r?.timeout,env:r?.env},{encoding:r?.encoding,input:r?.input})},executeAsync(e,t,r){Mc({command:e,args:t},r);},resolveInvocation(e,t){let r=Fc({command:e,args:t});return {cmd:r.command,args:r.args??[]}},splitCommand:Ho,spawnDetached(e,t){Pr({command:e,args:t});}}}var Qo=ue.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href)))),Uc=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href)));function Jc(){let e=ue.resolve(Qo,"./jsonata-sync.cjs");return P.existsSync(e)?e:ue.resolve(Qo,"../../card-compute/jsonata-sync.cjs")}var ft=Uc(Jc());function Nn(e,t,r){if(!e||typeof e!="object")return {};let n={};if(Array.isArray(e.cmdTemplate)){let s=[];for(let o of e.cmdTemplate)try{s.push(String(ft(o).evaluate(t)));}catch(a){let i=a instanceof Error?a.message:String(a);throw new Error(`[${r}] argsMassaging.cmdTemplate failed on "${o}": ${i}`)}n.cmdArgs=s;}if(typeof e.stdinTemplate=="string")try{n.stdin=ft(e.stdinTemplate).evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.stdinTemplate failed: ${o}`)}if(typeof e.urlTemplate=="string")try{n.url=String(ft(e.urlTemplate).evaluate(t));}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.urlTemplate failed: ${o}`)}if(typeof e.headerTemplate=="string")try{let s=ft(e.headerTemplate).evaluate(t);if(typeof s!="object"||s===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(s)}`);n.headers=s;}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.headerTemplate failed: ${o}`)}if(typeof e.bodyTemplate=="string")try{n.body=ft(e.bodyTemplate).evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.bodyTemplate failed: ${o}`)}return n}function Hc(e,t){let r=typeof e=="object"?e.value:$e(e).value;switch(r){case "source-cli-task-executor":{let n=ue__namespace.join(t,"source-cli-task-executor.js");if(P__namespace.existsSync(n))return {command:process.execPath,args:[n]};let s=ue__namespace.join(t,"source-cli-task-executor.ts"),o=ue__namespace.join(t,"..","..","node_modules","tsx","dist","cli.mjs"),a=ue__namespace.join(t,"..","..","node_modules",".bin","tsx"),i=P__namespace.existsSync(o)?o:a;return P__namespace.existsSync(s)&&P__namespace.existsSync(i)?{command:process.execPath,args:[i,s]}:{command:process.execPath,args:[n]}}case "board-live-cards":{let{cmd:n,args:s}=On(t,"_",[]);return {command:n,args:s}}default:throw new Error(`resolveBuiltIn: unknown built-in name "${r}". Supported: source-cli-task-executor, board-live-cards`)}}function Zo(e,t){if(e.howToRun==="built-in"){let{command:n,args:s}=Hc(e.whatToRun,t);return {command:n,baseArgs:s}}let r=typeof e.whatToRun=="object"?e.whatToRun.value:$e(e.whatToRun).value;switch(e.howToRun){case "local-node":return {command:process.execPath,baseArgs:[r]};case "local-python":return {command:process.platform==="win32"?"python":"python3",baseArgs:[r]};case "local-process":return {command:r,baseArgs:[]};default:throw new Error(`resolveBaseInvocation: howToRun "${e.howToRun}" is not a local transport`)}}function zc(e,t){let r=[e.subcommand];return e.inRef&&r.push("--in-ref",e.inRef),e.outRef&&r.push("--out-ref",e.outRef),e.errRef&&r.push("--err-ref",e.errRef),t&&r.push("--extra",Buffer.from(JSON.stringify(t)).toString("base64")),r}function Wc(e,t){return {subcommand:e.subcommand,...e.inRef?{inRef:e.inRef}:{},...e.outRef?{outRef:e.outRef}:{},...e.errRef?{errRef:e.errRef}:{},...t?{extra:t}:{}}}function qn(e,t){return Zo(e,t)}function Yc(e){let t=e.trim();if(!t)throw new Error("empty stdout");try{return JSON.parse(t)}catch{let r=t.split(/\r?\n/).filter(Boolean),n=r[r.length-1];return JSON.parse(n)}}function Xc(e,t,r){let n=r?.label??"invokeRefSync",s=r?.cliDir??r?.cwd??process.cwd(),o;try{o=Nn(e.argsMassaging,t,n);}catch(d){return {result:"failure",data:{error:d instanceof Error?d.message:String(d)}}}let a;try{a=qn(e,s);}catch(d){let v=d instanceof Error?d.message:String(d);return {result:"failure",data:{error:`[${n}] ref resolution failed: ${v}`}}}let i=[...a.baseArgs,...o.cmdArgs??[]],u=JSON.stringify(o.stdin??t),c=Or(),l;try{l=c.executeSync(a.command,i,{timeout:r?.timeoutMs??3e4,encoding:"utf-8",cwd:r?.cwd,input:u});}catch(d){let v=d,g=(v.stderr?String(v.stderr):"").trim(),f=typeof v.status=="number"?v.status:"unknown",p=g||v.message;return {result:"failure",data:{error:`[${n}] ref exited with status ${f}${p?`: ${p}`:""}`}}}try{let d=Yc(l);return {result:"success",data:d&&typeof d=="object"&&!Array.isArray(d)?d:{stdout:d}}}catch{return {result:"success",data:{stdout:l.trim()}}}}async function Qc(e,t){let r={...t,whatToRun:e.whatToRun},n=Nn(e.argsMassaging,r,"_invokeTaskExecutorHttp"),s=n.url??(typeof e.whatToRun=="object"?e.whatToRun.value:$e(e.whatToRun).value),o=n.body?n.body:Wc(t,e.extra),a={"Content-Type":"application/json"},i=n.headers?{...a,...n.headers}:a,u=await fetch(s,{method:e.howToRun==="http:get"?"GET":"POST",headers:i,body:JSON.stringify(o)});if(!u.ok){let l=await u.text().catch(()=>"");return {status:"error",error:`HTTP ${u.status}: ${l}`}}let c=await u.json().catch(()=>null);return c&&typeof c.status=="string"?c:{status:"success"}}function ea(e,t,r){if(e.howToRun==="http:post"||e.howToRun==="http:get"){Qc(e,t).catch(i=>{console.error(`[dispatchTaskExecutorDetached] HTTP dispatch failed: ${i.message}`);});return}let{command:s,baseArgs:o}=Zo(e,r),a=zc(t,e.extra);Pr({command:s,args:[...o,...a]});}function Zc(){return {read(e){if(!P__namespace.existsSync(e))return null;try{return P__namespace.readFileSync(e,"utf-8")}catch{return null}},write(e,t){P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(e,t,"utf-8");}}}function ta(e){return Zc();}function Ht(e,t){if(process.platform!=="win32"){P__namespace.renameSync(e,t);return}let r=[10,20,40,80,160];for(let n=0;n<=r.length;n++)try{P__namespace.renameSync(e,t);return}catch(s){let o=s.code;if((o==="EPERM"||o==="EBUSY")&&n<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[n]);continue}throw s}}function jr(e){function t(s){return ue__namespace.join(e,...s.split("/"))}function r(s){return ue__namespace.relative(e,s).replace(/\\/g,"/")}function n(s,o){if(P__namespace.existsSync(s))for(let a of P__namespace.readdirSync(s,{withFileTypes:true})){let i=ue__namespace.join(s,a.name);if(a.isDirectory()){n(i,o);continue}a.isFile()&&o.push(r(i));}}return {read(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{return P__namespace.readFileSync(o,"utf-8")}catch{return null}},write(s,o){let a=t(s),i=`${a}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(a),{recursive:true}),P__namespace.writeFileSync(i,o,"utf-8"),Ht(i,a);},exists(s){return P__namespace.existsSync(t(s))},remove(s){let o=t(s);try{P__namespace.existsSync(o)&&P__namespace.unlinkSync(o);}catch{}},readBytes(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{return new Uint8Array(P__namespace.readFileSync(o))}catch{return null}},writeBytes(s,o){let a=t(s),i=`${a}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(a),{recursive:true}),P__namespace.writeFileSync(i,Buffer.from(o)),Ht(i,a);},listKeys(s){let o=[];n(e,o);let a=o.sort();return s?a.filter(i=>i.startsWith(s)):a},stat(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{let a=P__namespace.statSync(o);return {key:s,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}}}}function Mn(){return {read(e){if(!P__namespace.existsSync(e))return null;try{return P__namespace.readFileSync(e,"utf-8")}catch{return null}},write(e,t){let r=`${e}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(r,t,"utf-8"),Ht(r,e);},exists(e){return P__namespace.existsSync(e)},remove(e){try{P__namespace.existsSync(e)&&P__namespace.unlinkSync(e);}catch{}},readBytes(e){if(!P__namespace.existsSync(e))return null;try{return new Uint8Array(P__namespace.readFileSync(e))}catch{return null}},writeBytes(e,t){let r=`${e}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(r,Buffer.from(t)),Ht(r,e);},stat(e){if(!P__namespace.existsSync(e))return null;try{let t=P__namespace.statSync(e);return {key:e,size:Number(t.size||0),updatedAt:new Date(t.mtimeMs).toISOString()}}catch{return null}}}}function Ln(e){function t(n){return ue__namespace.join(e,...n.split("/"))+".json"}function r(n,s,o,a){if(P__namespace.existsSync(n))for(let i of P__namespace.readdirSync(n,{withFileTypes:true})){let u=s?`${s}/${i.name}`:i.name;if(i.isDirectory()){r(ue__namespace.join(n,i.name),u,o,a);continue}if(!i.isFile()||!i.name.endsWith(".json"))continue;let c=u.replace(/\.json$/,"");(!o||c.startsWith(o))&&a.push(c);}}return {read(n){let s=t(n);if(!P__namespace.existsSync(s))return null;try{return JSON.parse(P__namespace.readFileSync(s,"utf-8"))}catch{return null}},write(n,s){let o=t(n),a=`${o}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(o),{recursive:true}),P__namespace.writeFileSync(a,JSON.stringify(s,null,2),"utf-8"),Ht(a,o);},delete(n){let s=t(n);try{P__namespace.existsSync(s)&&P__namespace.unlinkSync(s);}catch{}},listKeys(n){let s=[];return r(e,"",n,s),s.sort()}}}function Fn(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return `[${e.map(Fn).join(",")}]`;let t=e;return `{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${Fn(t[n])}`).join(",")}}`}function ra(e){return crypto.createHash("sha256").update(Fn(e)).digest("hex")}function na(e){let t=ue__namespace.join(e,"board-journal.jsonl");return {readAllEntries(){if(!P__namespace.existsSync(t))return [];let r=P__namespace.readFileSync(t,"utf-8").trim();return r?r.split(`
|
|
10
|
+
`,s=Or.get(e);if(s&&!s.socket.destroyed){s.ready?s.socket.write(n):s.queue.push(n);return}let o=Yc(e),a=Ho__namespace.createConnection(o);s={socket:a,ready:false,queue:[n]},Or.set(e,s),a.on("connect",()=>{s.ready=true;for(let i of s.queue)a.write(i);s.queue.length=0;}),a.on("error",i=>{r?.(`[named-pipe publish] ${o}: ${i instanceof Error?i.message:String(i)}`),Or.delete(e);}),a.on("close",()=>{Or.delete(e);});}function Nr(){return {executeSync(e,t,r){return Qo({command:e,args:t,cwd:r?.cwd,timeoutMs:r?.timeout,env:r?.env},{encoding:r?.encoding,input:r?.input})},executeAsync(e,t,r){Wc({command:e,args:t},r);},resolveInvocation(e,t){let r=zc({command:e,args:t});return {cmd:r.command,args:r.args??[]}},splitCommand:Xo,spawnDetached(e,t){jr({command:e,args:t});}}}var ra=ue.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href)))),td=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href)));function rd(){let e=ue.resolve(ra,"./jsonata-sync.cjs");return P.existsSync(e)?e:ue.resolve(ra,"../../card-compute/jsonata-sync.cjs")}var mt=td(rd());function Dn(e,t,r){if(!e||typeof e!="object")return {};let n={};if(Array.isArray(e.cmdTemplate)){let s=[];for(let o of e.cmdTemplate)try{s.push(String(mt(o).evaluate(t)));}catch(a){let i=a instanceof Error?a.message:String(a);throw new Error(`[${r}] argsMassaging.cmdTemplate failed on "${o}": ${i}`)}n.cmdArgs=s;}if(typeof e.stdinTemplate=="string")try{n.stdin=mt(e.stdinTemplate).evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.stdinTemplate failed: ${o}`)}if(typeof e.urlTemplate=="string")try{n.url=String(mt(e.urlTemplate).evaluate(t));}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.urlTemplate failed: ${o}`)}if(typeof e.headerTemplate=="string")try{let s=mt(e.headerTemplate).evaluate(t);if(typeof s!="object"||s===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(s)}`);n.headers=s;}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.headerTemplate failed: ${o}`)}if(typeof e.bodyTemplate=="string")try{n.body=mt(e.bodyTemplate).evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.bodyTemplate failed: ${o}`)}return n}function nd(e,t){let r=typeof e=="object"?e.value:Re(e).value;switch(r){case "source-cli-task-executor":{let n=ue__namespace.join(t,"source-cli-task-executor.js");if(P__namespace.existsSync(n))return {command:process.execPath,args:[n]};let s=ue__namespace.join(t,"source-cli-task-executor.ts"),o=ue__namespace.join(t,"..","..","node_modules","tsx","dist","cli.mjs"),a=ue__namespace.join(t,"..","..","node_modules",".bin","tsx"),i=P__namespace.existsSync(o)?o:a;return P__namespace.existsSync(s)&&P__namespace.existsSync(i)?{command:process.execPath,args:[i,s]}:{command:process.execPath,args:[n]}}case "board-live-cards":{let{cmd:n,args:s}=Nn(t,"_",[]);return {command:n,args:s}}default:throw new Error(`resolveBuiltIn: unknown built-in name "${r}". Supported: source-cli-task-executor, board-live-cards`)}}function sa(e,t){if(e.howToRun==="built-in"){let{command:n,args:s}=nd(e.whatToRun,t);return {command:n,baseArgs:s}}let r=typeof e.whatToRun=="object"?e.whatToRun.value:Re(e.whatToRun).value;switch(e.howToRun){case "local-node":return {command:process.execPath,baseArgs:[r]};case "local-python":return {command:process.platform==="win32"?"python":"python3",baseArgs:[r]};case "local-process":return {command:r,baseArgs:[]};default:throw new Error(`resolveBaseInvocation: howToRun "${e.howToRun}" is not a local transport`)}}function sd(e,t){let r=[e.subcommand];return e.inRef&&r.push("--in-ref",e.inRef),e.outRef&&r.push("--out-ref",e.outRef),e.errRef&&r.push("--err-ref",e.errRef),t&&r.push("--extra",Buffer.from(JSON.stringify(t)).toString("base64")),r}function od(e,t){return {subcommand:e.subcommand,...e.inRef?{inRef:e.inRef}:{},...e.outRef?{outRef:e.outRef}:{},...e.errRef?{errRef:e.errRef}:{},...t?{extra:t}:{}}}function Fn(e,t){return sa(e,t)}function oa(e){let t=e.trim();if(!t)throw new Error("empty stdout");try{return JSON.parse(t)}catch{let r=t.split(/\r?\n/).filter(Boolean),n=r[r.length-1];return JSON.parse(n)}}function aa(e){let t=e.whatToRun;return typeof t=="object"?t.value:Re(t).value}function ia(e,t){return {...t,whatToRun:aa(e),...e.extra?{extra:e.extra}:{}}}function Mn(e,t,r="invokeExecutionRef"){return Dn(e,t,r)}function ua(e){return e&&typeof e=="object"&&!Array.isArray(e)&&typeof e.result=="string"&&e.data&&typeof e.data=="object"&&!Array.isArray(e.data)?e:{result:"success",data:e&&typeof e=="object"&&!Array.isArray(e)?e:{stdout:e}}}function Ye(e){return {result:"failure",data:{error:e}}}function We(e,t,r){let n=r?.label??"invokeExecutionRefSync",s=r?.cliDir??r?.cwd??process.cwd(),o;try{o=Mn(e.argsMassaging,ia(e,t),n);}catch(d){let y=d instanceof Error?d.message:String(d);return Ye(y)}let a;try{a=Fn(e,s);}catch(d){let y=d instanceof Error?d.message:String(d);return Ye(`[${n}] ref resolution failed: ${y}`)}let i=[...a.baseArgs,...o.cmdArgs??[]],u=JSON.stringify(o.stdin??t),c=Nr(),l;try{l=c.executeSync(a.command,i,{timeout:r?.timeoutMs??3e4,encoding:"utf-8",cwd:r?.cwd,input:u});}catch(d){let y=d,g=(y.stderr?String(y.stderr):"").trim(),f=typeof y.status=="number"?y.status:"unknown",p=g||y.message;return Ye(`[${n}] ref exited with status ${f}${p?`: ${p}`:""}`)}try{return ua(oa(l))}catch{return {result:"success",data:{stdout:l.trim()}}}}async function na(e,t,r){let n=r?.label??"invokeExecutionRef",s;try{s=Mn(e.argsMassaging,ia(e,t),n);}catch(c){let l=c instanceof Error?c.message:String(c);return Ye(l)}let o=aa(e),a=s.headers?{"Content-Type":"application/json",...s.headers}:{"Content-Type":"application/json"},i=s.url??o,u;if(e.howToRun==="http:get"){let c=s.body&&typeof s.body=="object"&&!Array.isArray(s.body)?s.body:t,l=new URLSearchParams(Object.entries(c).filter(([,d])=>d!=null).map(([d,y])=>[d,String(y)]));l.size>0&&(i=`${i}${i.includes("?")?"&":"?"}${l.toString()}`);}else u=JSON.stringify(s.body??t);try{let c=await fetch(i,{method:e.howToRun==="http:get"?"GET":"POST",headers:a,body:u});if(!c.ok){let d=await c.text().catch(()=>"");return Ye(`[${n}] HTTP ${c.status}${d?`: ${d}`:""}`)}let l=await c.text();if(!l.trim())return {result:"success",data:{}};try{return ua(oa(l))}catch{return {result:"success",data:{stdout:l.trim()}}}}catch(c){let l=c instanceof Error?c.message:String(c);return Ye(`[${n}] ${l}`)}}var ad={"local-node":async(e,t,r)=>We(e,t,r),"local-python":async(e,t,r)=>We(e,t,r),"local-process":async(e,t,r)=>We(e,t,r),"built-in":async(e,t,r)=>We(e,t,r),"http:post":na,"http:get":na},id={"local-node":We,"local-python":We,"local-process":We,"built-in":We};async function ca(e,t,r){let n=r?.transports?.[e.howToRun]??ad[e.howToRun];return n?n(e,t,r):Ye(`[${r?.label??"invokeExecutionRef"}] unsupported howToRun: ${e.howToRun}`)}function Ln(e,t,r){let n=r?.syncTransports?.[e.howToRun]??id[e.howToRun];return n?n(e,t,r):Ye(`[${r?.label??"invokeExecutionRefSync"}] unsupported sync howToRun: ${e.howToRun}`)}function ud(e){return {invoke(t,r){return ca(t,r,e)},invokeSync(t,r){return Ln(t,r,e)}}}function cd(e,t,r){return Ln(e,t,r)}async function dd(e,t){let r={...t,whatToRun:e.whatToRun},n=Dn(e.argsMassaging,r,"_invokeTaskExecutorHttp"),s=n.url??(typeof e.whatToRun=="object"?e.whatToRun.value:Re(e.whatToRun).value),o=n.body?n.body:od(t,e.extra),a={"Content-Type":"application/json"},i=n.headers?{...a,...n.headers}:a,u=await fetch(s,{method:e.howToRun==="http:get"?"GET":"POST",headers:i,body:JSON.stringify(o)});if(!u.ok){let l=await u.text().catch(()=>"");return {status:"error",error:`HTTP ${u.status}: ${l}`}}let c=await u.json().catch(()=>null);return c&&typeof c.status=="string"?c:{status:"success"}}function da(e,t,r){if(e.howToRun==="http:post"||e.howToRun==="http:get"){dd(e,t).catch(i=>{console.error(`[dispatchTaskExecutorDetached] HTTP dispatch failed: ${i.message}`);});return}let{command:s,baseArgs:o}=sa(e,r),a=sd(t,e.extra);jr({command:s,args:[...o,...a]});}function ld(){return {read(e){if(!P__namespace.existsSync(e))return null;try{return P__namespace.readFileSync(e,"utf-8")}catch{return null}},write(e,t){P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(e,t,"utf-8");}}}function la(e){return ld();}function Wt(e,t){if(process.platform!=="win32"){P__namespace.renameSync(e,t);return}let r=[10,20,40,80,160];for(let n=0;n<=r.length;n++)try{P__namespace.renameSync(e,t);return}catch(s){let o=s.code;if((o==="EPERM"||o==="EBUSY")&&n<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[n]);continue}throw s}}function qr(e){function t(s){return ue__namespace.join(e,...s.split("/"))}function r(s){return ue__namespace.relative(e,s).replace(/\\/g,"/")}function n(s,o){if(P__namespace.existsSync(s))for(let a of P__namespace.readdirSync(s,{withFileTypes:true})){let i=ue__namespace.join(s,a.name);if(a.isDirectory()){n(i,o);continue}a.isFile()&&o.push(r(i));}}return {read(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{return P__namespace.readFileSync(o,"utf-8")}catch{return null}},write(s,o){let a=t(s),i=`${a}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(a),{recursive:true}),P__namespace.writeFileSync(i,o,"utf-8"),Wt(i,a);},exists(s){return P__namespace.existsSync(t(s))},remove(s){let o=t(s);try{P__namespace.existsSync(o)&&P__namespace.unlinkSync(o);}catch{}},readBytes(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{return new Uint8Array(P__namespace.readFileSync(o))}catch{return null}},writeBytes(s,o){let a=t(s),i=`${a}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(a),{recursive:true}),P__namespace.writeFileSync(i,Buffer.from(o)),Wt(i,a);},listKeys(s){let o=[];n(e,o);let a=o.sort();return s?a.filter(i=>i.startsWith(s)):a},stat(s){let o=t(s);if(!P__namespace.existsSync(o))return null;try{let a=P__namespace.statSync(o);return {key:s,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}}}}function Gn(){return {read(e){if(!P__namespace.existsSync(e))return null;try{return P__namespace.readFileSync(e,"utf-8")}catch{return null}},write(e,t){let r=`${e}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(r,t,"utf-8"),Wt(r,e);},exists(e){return P__namespace.existsSync(e)},remove(e){try{P__namespace.existsSync(e)&&P__namespace.unlinkSync(e);}catch{}},readBytes(e){if(!P__namespace.existsSync(e))return null;try{return new Uint8Array(P__namespace.readFileSync(e))}catch{return null}},writeBytes(e,t){let r=`${e}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:true}),P__namespace.writeFileSync(r,Buffer.from(t)),Wt(r,e);},stat(e){if(!P__namespace.existsSync(e))return null;try{let t=P__namespace.statSync(e);return {key:e,size:Number(t.size||0),updatedAt:new Date(t.mtimeMs).toISOString()}}catch{return null}}}}function Kn(e){function t(n){return ue__namespace.join(e,...n.split("/"))+".json"}function r(n,s,o,a){if(P__namespace.existsSync(n))for(let i of P__namespace.readdirSync(n,{withFileTypes:true})){let u=s?`${s}/${i.name}`:i.name;if(i.isDirectory()){r(ue__namespace.join(n,i.name),u,o,a);continue}if(!i.isFile()||!i.name.endsWith(".json"))continue;let c=u.replace(/\.json$/,"");(!o||c.startsWith(o))&&a.push(c);}}return {read(n){let s=t(n);if(!P__namespace.existsSync(s))return null;try{return JSON.parse(P__namespace.readFileSync(s,"utf-8"))}catch{return null}},write(n,s){let o=t(n),a=`${o}.${process.pid}.${crypto.randomUUID()}.tmp`;P__namespace.mkdirSync(ue__namespace.dirname(o),{recursive:true}),P__namespace.writeFileSync(a,JSON.stringify(s,null,2),"utf-8"),Wt(a,o);},delete(n){let s=t(n);try{P__namespace.existsSync(s)&&P__namespace.unlinkSync(s);}catch{}},listKeys(n){let s=[];return r(e,"",n,s),s.sort()}}}function Bn(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return `[${e.map(Bn).join(",")}]`;let t=e;return `{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${Bn(t[n])}`).join(",")}}`}function fa(e){return crypto.createHash("sha256").update(Bn(e)).digest("hex")}function pa(e){let t=ue__namespace.join(e,"board-journal.jsonl");return {readAllEntries(){if(!P__namespace.existsSync(t))return [];let r=P__namespace.readFileSync(t,"utf-8").trim();return r?r.split(`
|
|
11
11
|
`).filter(Boolean).map(n=>JSON.parse(n)):[]},appendEntry(r){P__namespace.appendFileSync(t,JSON.stringify(r)+`
|
|
12
|
-
`,"utf-8");},generateId(){return crypto.randomUUID()}}}function sa(e){return {tryAcquire(){try{if(!P__namespace.existsSync(e)){P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:!0});try{P__namespace.writeFileSync(e,"{}",{flag:"wx"});}catch{}}return properLockfile.lockSync(e,{retries:0})}catch{return null}}}}var oa={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://nsreehari.github.io/boards/live-cards.schema.json",definitions:{bind_ref:{description:"A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",type:"string",pattern:"^(card_data|requires|fetched_sources|computed_values)(\\.|$)"},bind_or_literal:{description:"A literal value or a bind reference object",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref"}},required:["bind"]}]},compute_expr:{description:"A declarative JSON compute expression",type:"object",required:["fn"],properties:{fn:{type:"string",description:"Function name from the built-in vocabulary",enum:["sum","avg","min","max","count","first","last","add","sub","mul","div","round","abs","mod","gt","gte","lt","lte","eq","neq","if","and","or","not","concat","upper","lower","template","filter","pluck","map","sort","slice","flat","unique","group","get","default","now","diff_days","format_date"]},input:{description:"card_data.path, literal, array of inputs, or nested compute_expr",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/definitions/compute_expr"}]},field:{type:"string",description:"For pluck/sum/group \u2014 the object key to extract"},where:{$ref:"#/definitions/compute_expr",description:"For filter \u2014 predicate expression ($ = current item)"},cond:{$ref:"#/definitions/compute_expr",description:"For if \u2014 condition expression"},then:{description:"For if \u2014 value when cond is truthy"},else:{description:"For if \u2014 value when cond is falsy"},format:{type:"string",description:"For format_date \u2014 date format string"}}},meta:{type:"object",properties:{title:{type:"string"},tags:{type:"array",items:{type:"string"}}}},requires:{type:"array",items:{type:"string"},description:"IDs of upstream nodes this node depends on"},provides:{type:"array",items:{type:"object",required:["bindTo","ref"],properties:{bindTo:{type:"string",description:"Token name published downstream"},ref:{type:"string",description:"Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)"}}},description:"Explicit bindings exposing computed or card_data values downstream as named tokens"},compute_step:{description:"A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",type:"object",required:["bindTo","expr"],properties:{bindTo:{type:"string",description:"Key in computed_values to write result"},expr:{type:"string",description:"JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }"}}},source_def:{description:"One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all source_defs in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",type:"object",required:["bindTo","outputFile"],additionalProperties:true,properties:{bindTo:{type:"string",description:"Key under fetched_sources.* available in compute expressions"},outputFile:{type:"string",description:"Board-relative path the executor writes its JSON result to. Presence of this file signals delivery."},projections:{type:"object",description:"Named data projections from card_data or requires, evaluated before the executor is called. Each key is a ref name; each value is a JSONata expression rooted at card_data or requires. The resolved values are passed to the executor as _projections. fetched_sources, computed_values, and source_defs are not accessible here \u2014 sources run before those exist.",additionalProperties:{type:"string"}},optionalForCompletionGating:{type:"boolean",default:false,description:"When true this source does not gate card completion. Default false when absent, so source_defs are completion-gating by default."},timeout:{type:"integer",minimum:0,default:12e4,description:"Executor/script timeout in ms. Default: 120 000 (2 min)."},script:{type:"string",description:"Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result."}}},render_element:{type:"object",required:["kind"],properties:{id:{type:"string",description:"Optional element ID for targeted updates"},kind:{enum:["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]},label:{type:"string",description:"Heading above this element"},className:{type:"string",description:"Bootstrap grid class, e.g. 'col-12 col-md-6'"},visible:{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy"},data:{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref",description:"card_data/requires/fetched_sources/computed_values path to read data from"},writeTo:{$ref:"#/definitions/bind_ref",description:"card_data path for user input (form, filter, todo, notes)"},columns:{type:"array",items:{type:"string"},description:"table: visible columns"},maxRows:{type:"integer",description:"table/list: max rows to display"},sortable:{type:"boolean",default:true,description:"table: enable click-to-sort"},placeholder:{type:"string",description:"Empty-state message"},chartType:{enum:["bar","line","pie","doughnut"]},chartOptions:{type:"object",description:"Chart.js options passthrough"},fields:{type:"object",description:"JSON Schema for form/filter fields"},thresholds:{type:"object",properties:{green:{type:"string"},amber:{type:"string"}}},colorMap:{type:"object",description:"badge: value \u2192 Bootstrap color"},style:{enum:["heading","muted","default"],description:"text: display style"},upload:{type:"boolean",default:true,description:"file-upload: show drop zone (false = read-only file list)"},accept:{type:"array",items:{type:"string"},description:"file-upload: allowed extensions"},multiple:{type:"boolean",default:true,description:"file-upload: allow multiple files"},fileAttach:{type:"boolean",default:false,description:"chat: enable inline file attachments"},fileAccept:{type:"array",items:{type:"string"},description:"chat: allowed attachment extensions"},buttons:{type:"array",description:"actions: button definitions",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},style:{type:"string",description:"Bootstrap button variant, e.g. 'success', 'outline-danger'"},size:{type:"string",default:"sm"},disabled:{oneOf:[{type:"boolean"},{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled"}]}}}}}}}},view:{type:"object",required:["elements"],properties:{elements:{type:"array",minItems:1,items:{$ref:"#/definitions/render_element"}},layout:{type:"object",properties:{board:{type:"object",properties:{col:{type:"integer",minimum:1,maximum:12},order:{type:"integer"}}},canvas:{type:"object",properties:{x:{type:"number"},y:{type:"number"},w:{type:"number"},h:{type:"number"}}}}},features:{type:"object",properties:{chat:{type:"boolean",default:false},notes:{type:"boolean",default:false},refresh:{type:"boolean",default:true}}}}}},title:"LiveCard",description:"A unified card node. Behavior depends on which sections are present (source_defs, compute, view, etc.)",type:"object",required:["id"],additionalProperties:false,properties:{id:{type:"string"},requires:{$ref:"#/definitions/requires"},provides:{$ref:"#/definitions/provides"},meta:{$ref:"#/definitions/meta"},view:{$ref:"#/definitions/view"},card_data:{type:"object",description:"Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",properties:{files:{type:"array",description:"Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",items:{type:"object",required:["name","stored_name"],properties:{name:{type:"string",minLength:1},stored_name:{type:"string",minLength:5,maxLength:32,pattern:"^[0-9]{3,}-[a-z0-9._-]+$"},size:{oneOf:[{type:"integer",minimum:0},{type:"null"}]},mime_type:{type:"string"},path:{type:"string",pattern:"^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$"},uploaded_at:{type:"string",format:"date-time"}},additionalProperties:false}}},additionalProperties:true},source_defs:{type:"array",description:"Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only source_defs that should not block task-completed.",items:{$ref:"#/definitions/source_def"}},compute:{type:"array",description:"Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",items:{$ref:"#/definitions/compute_step"}}}};var Nu=Ac(Pu());var Ph=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),Oh=Ph("./jsonata-sync.cjs"),gn=null;var Ou=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,jh=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function Nh(e){let t=new Set,r;for(Ou.lastIndex=0;(r=Ou.exec(e))!==null;)t.add(r[1]);return t}function qu(e){let t=jh.exec(e);return t?t[1]:null}function ju(e,t,r,n){try{Oh(e);}catch(o){let a=o instanceof Error?o.message:String(o);n.push(`${t}: invalid JSONata expression (${a})`);return}let s=Nh(e);for(let o of s)r.has(o)||n.push(`${t}: disallowed namespace "${o}" in expression`);}function $o(e,t,r){if(Array.isArray(e)){e.forEach((s,o)=>{$o(s,`${t}/${o}`,r);});return}if(typeof e=="string"){let s=qu(e);if(!s)return;new Set(["card_data","requires","computed_values"]).has(s)||r.push(`${t}: disallowed namespace "${s}" in view reference`);return}if(!e||typeof e!="object")return;let n=e;for(let[s,o]of Object.entries(n))$o(o,`${t}/${s}`,r);}function qh(){if(gn)return gn;let e=new Nu.default({allErrors:true});return Ah__default.default(e),gn=e.compile(oa),gn}function Du(e){let t=qh(),r=t(e),n=(t.errors??[]).map(s=>`${s.instancePath||"/"}: ${s.message??"unknown error"}`);if(e&&typeof e=="object"&&!Array.isArray(e)){let s=e.source_defs;if(Array.isArray(s)){let o=new Set,a=new Set;s.forEach((i,u)=>{if(!i||typeof i!="object"||Array.isArray(i))return;let c=i;typeof c.bindTo=="string"&&c.bindTo&&(o.has(c.bindTo)&&n.push(`/source_defs/${u}/bindTo: bindTo "${c.bindTo}" must be unique across all source_defs`),o.add(c.bindTo)),typeof c.outputFile=="string"&&c.outputFile&&(a.has(c.outputFile)&&n.push(`/source_defs/${u}/outputFile: outputFile "${c.outputFile}" must be unique across all source_defs`),a.add(c.outputFile));});}}return !r||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function Fu(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:true,errors:[]};let r=e,n=r.compute;Array.isArray(n)&&n.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.expr;typeof d!="string"||d.trim().length===0||ju(d,`/compute/${l}/expr`,new Set(["card_data","requires","fetched_sources","computed_values"]),t);});let s=new Set(["card_data","requires","fetched_sources","computed_values"]),o=r.provides;Array.isArray(o)&&o.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.ref;if(typeof d!="string"||d.trim().length===0)return;let v=qu(d);v===null?t.push(`/provides/${l}/ref: path "${d}" must start with a valid namespace (${[...s].join(", ")})`):s.has(v)||t.push(`/provides/${l}/ref: disallowed namespace "${v}" in path "${d}" (valid: ${[...s].join(", ")})`);});let a=r.view;a&&typeof a=="object"&&!Array.isArray(a)&&$o(a,"/view",t);let i=new Set(["card_data","requires"]),u=r.source_defs;return Array.isArray(u)&&u.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.projections;if(!(!d||typeof d!="object"||Array.isArray(d)))for(let[v,g]of Object.entries(d))typeof g!="string"||g.trim().length===0||ju(g,`/source_defs/${l}/projections/${v}`,i,t);}),{ok:t.length===0,errors:t}}function Eo(e){let t=Du(e);if(!t.ok)return t;let r=Fu(e);return r.ok?{ok:true,errors:[]}:{ok:false,errors:r.errors}}var nt={RUNNING:"running",COMPLETED:"completed",FAILED:"failed",INACTIVATED:"inactivated"};function Re(e){return e?Array.isArray(e.provides)?e.provides:[]:[]}function st(e){return e?Array.isArray(e.requires)?e.requires:[]:[]}function Mu(e){return e.tasks??{}}function xo(e){return e?e.status===nt.FAILED||e.status===nt.INACTIVATED:false}function Lu(e,t){return e.refreshStrategy??t?.refreshStrategy??"data-changed"}function Vu(e){return e.maxExecutions}function Bu(e,t){let r=new Set;for(let[n,s]of Object.entries(t))if(s.status===nt.COMPLETED){let o=e.tasks[n];o&&Re(o).forEach(i=>r.add(i));}return Array.from(r)}function Gu(e,t){let r={};return e.forEach(n=>{let s=t[n];if(!s)return;Re(s).forEach(a=>{r[a]||(r[a]=[]),r[a].push(n);});}),r}function Ku(e,t,r){let n=e.tasks[t]??yn(),s={};if(r){let a=r.tasks[t],i=st(a);for(let u of i)for(let[c,l]of Object.entries(r.tasks))if(Re(l).includes(u)){let d=e.tasks[c];d?.lastDataHash&&(s[u]=d.lastDataHash);break}}let o={...n,status:"running",startedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),progress:0,error:void 0,startConsumedHashes:s};return {...e,tasks:{...e.tasks,[t]:o},lastUpdated:new Date().toISOString()}}function Uu(e,t,r,n,s,o){let a=e.tasks[r]??yn(),i=t.tasks[r];if(!i)throw new Error(`Task "${r}" not found in graph`);let u;n&&i.on&&i.on[n]?u=i.on[n]:u=Re(i);let c=a.startConsumedHashes?{...a.startConsumedHashes}:{...a.lastConsumedHashes};if(!a.startConsumedHashes){let v=i.requires??[];for(let g of v)for(let[f,p]of Object.entries(t.tasks))if(Re(p).includes(g)){let S=e.tasks[f];S?.lastDataHash&&(c[g]=S.lastDataHash);break}}let l={...a,status:"completed",completedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),executionCount:a.executionCount+1,lastEpoch:a.executionCount+1,lastDataHash:s,data:o,lastConsumedHashes:c,error:void 0},d=[...new Set([...e.availableOutputs,...u])];return {...e,tasks:{...e.tasks,[r]:l},availableOutputs:d,lastUpdated:new Date().toISOString()}}function Ju(e,t,r,n){let s=e.tasks[r]??yn(),o=t.tasks[r];if(o?.retry){let u=s.retryCount+1;if(u<=o.retry.max_attempts){let c={...s,status:"not-started",retryCount:u,lastUpdated:new Date().toISOString(),error:n};return {...e,tasks:{...e.tasks,[r]:c},lastUpdated:new Date().toISOString()}}}let a={...s,status:"failed",failedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),error:n,executionCount:s.executionCount+1},i=e.availableOutputs;if(o?.on_failure&&o.on_failure.length>0&&(i=[...new Set([...e.availableOutputs,...o.on_failure])]),o?.circuit_breaker&&a.executionCount>=o.circuit_breaker.max_executions){let u=o.circuit_breaker.on_break;i=[...new Set([...i,...u])];}return {...e,tasks:{...e.tasks,[r]:a},availableOutputs:i,lastUpdated:new Date().toISOString()}}function Hu(e,t,r,n){let s=e.tasks[t]??yn(),o={...s,progress:typeof n=="number"?n:s.progress,messages:[...s.messages??[],...r?[{message:r,timestamp:new Date().toISOString(),status:s.status}]:[]],lastUpdated:new Date().toISOString()};return {...e,tasks:{...e.tasks,[t]:o},lastUpdated:new Date().toISOString()}}function zu(e,t){let r=e.tasks[t];if(!r)return e;let n={...r,status:"not-started",startedAt:void 0,completedAt:void 0,failedAt:void 0,error:void 0,data:void 0,progress:null,lastUpdated:new Date().toISOString()};return {...e,tasks:{...e.tasks,[t]:n},lastUpdated:new Date().toISOString()}}function yn(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function vn(e,t){let r=`live-${Date.now()}`,n={};for(let o of Object.keys(e.tasks))n[o]=Yu();let s={status:"running",tasks:n,availableOutputs:[],stuckDetection:{is_stuck:false,stuck_description:null,outputs_unresolvable:[],tasks_blocked:[]},lastUpdated:new Date().toISOString(),executionId:r,executionConfig:{executionMode:e.settings.execution_mode??"eligibility-mode",conflictStrategy:e.settings.conflict_strategy??"alphabetical",completionStrategy:e.settings.completion}};return {config:e,state:s}}function Dh(e,t){let{config:r,state:n}=e;if("executionId"in t&&t.executionId&&t.executionId!==n.executionId)return e;switch(t.type){case "task-started":return {config:r,state:Ku(n,t.taskName,r)};case "task-completed":return {config:r,state:Uu(n,r,t.taskName,t.result,t.dataHash,t.data)};case "task-failed":return {config:r,state:Ju(n,r,t.taskName,t.error)};case "task-progress":return {config:r,state:Hu(n,t.taskName,t.message,t.progress)};case "task-restart":return {config:r,state:zu(n,t.taskName)};case "inject-tokens":return {config:r,state:{...n,availableOutputs:[...new Set([...n.availableOutputs,...t.tokens])],lastUpdated:new Date().toISOString()}};case "agent-action":return {config:r,state:Kh(n,t.action)};case "task-upsert":return Fh(e,t.taskName,t.taskConfig);case "task-removal":return Mh(e,t.taskName);case "node-requires-add":return Lh(e,t.nodeName,t.tokens);case "node-requires-remove":return Vh(e,t.nodeName,t.tokens);case "node-provides-add":return Bh(e,t.nodeName,t.tokens);case "node-provides-remove":return Gh(e,t.nodeName,t.tokens);default:return e}}function Wu(e,t){return t.reduce((r,n)=>Dh(r,n),e)}function Fh(e,t,r){let n=!!e.config.tasks[t];return {config:{...e.config,tasks:{...e.config.tasks,[t]:r}},state:{...e.state,tasks:{...e.state.tasks,[t]:n?e.state.tasks[t]:Yu()},lastUpdated:new Date().toISOString()}}}function Mh(e,t){if(!e.config.tasks[t])return e;let{[t]:r,...n}=e.config.tasks,{[t]:s,...o}=e.state.tasks;return {config:{...e.config,tasks:n},state:{...e.state,tasks:o,lastUpdated:new Date().toISOString()}}}function Lh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=st(n),o=r.filter(a=>!s.includes(a));return o.length===0?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,requires:[...s,...o]}}},state:e.state}}function Vh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=st(n),o=s.filter(a=>!r.includes(a));return o.length===s.length?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,requires:o}}},state:e.state}}function Bh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Re(n),o=r.filter(a=>!s.includes(a));return o.length===0?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,provides:[...s,...o]}}},state:e.state}}function Gh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Re(n),o=s.filter(a=>!r.includes(a));return o.length===s.length?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,provides:o}}},state:e.state}}function kr(e){return {version:1,config:e.config,state:e.state,snapshotAt:new Date().toISOString()}}function bn(e){if(!e||typeof e!="object")throw new Error("Invalid snapshot: expected an object");let t=e;if(!t.config||typeof t.config!="object")throw new Error('Invalid snapshot: missing or invalid "config"');if(!t.state||typeof t.state!="object")throw new Error('Invalid snapshot: missing or invalid "state"');let r=t.config,n=t.state;if(!r.settings||typeof r.settings!="object")throw new Error("Invalid snapshot: config.settings missing");if(!r.tasks||typeof r.tasks!="object")throw new Error("Invalid snapshot: config.tasks missing");if(!n.tasks||typeof n.tasks!="object")throw new Error("Invalid snapshot: state.tasks missing");if(!Array.isArray(n.availableOutputs))throw new Error("Invalid snapshot: state.availableOutputs must be an array");return {config:r,state:n}}function Yu(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function Kh(e,t){let r=new Date().toISOString();switch(t){case "stop":return {...e,status:"stopped",lastUpdated:r};case "pause":return {...e,status:"paused",lastUpdated:r};case "resume":return {...e,status:"running",lastUpdated:r};default:return e}}function _r(e){let{config:t,state:r}=e,n=Mu(t);if(Object.keys(n).length===0)return {eligible:[],pending:[],unresolved:[],blocked:[],conflicts:{}};let o=Uh(n),a=Bu(t,r.tasks),i=new Set([...a,...r.availableOutputs]),u=[],c=[],l=[],d=[];for(let[g,f]of Object.entries(n)){let p=r.tasks[g],S=Lu(f,t.settings),h=S!=="once";if(p?.status===nt.RUNNING||xo(p))continue;let m=Vu(f);if(m!==void 0&&p&&p.executionCount>=m||f.circuit_breaker&&p&&p.executionCount>=f.circuit_breaker.max_executions||!h&&p?.status===nt.COMPLETED)continue;if(h&&p?.status===nt.COMPLETED){let _=st(f),$=false;switch(S){case "data-changed":{_.length>0&&_.some(q=>{for(let[F,re]of Object.entries(n))if(Re(re).includes(q)){let U=r.tasks[F];if(!U)continue;let ce=p.lastConsumedHashes?.[q];return U.lastDataHash==null?U.executionCount>p.lastEpoch:U.lastDataHash!==ce}return false})||($=true);break}case "epoch-changed":{_.length>0&&_.some(q=>{for(let[F,re]of Object.entries(n))if(Re(re).includes(q)){let U=r.tasks[F];if(U&&U.executionCount>p.lastEpoch)return true}return false})||($=true);break}case "time-based":{let N=f.refreshInterval??0;if(N<=0){$=true;break}let q=p.completedAt;if(!q){$=true;break}(Date.now()-Date.parse(q))/1e3<N&&($=true);break}case "manual":$=true;break}if($)continue}let y=st(f);if(y.length===0){u.push(g);continue}let k=[],w=[],C=[];for(let _ of y){if(i.has(_))continue;let $=o[_]||[];$.length===0?k.push(_):$.every(q=>xo(r.tasks[q]))?C.push({token:_,failedProducer:$[0]}):w.push(_);}k.length>0?l.push({taskName:g,missingTokens:k}):C.length>0?d.push({taskName:g,failedTokens:C.map(_=>_.token),failedProducers:[...new Set(C.map(_=>_.failedProducer))]}):w.length>0?c.push({taskName:g,waitingOn:w}):u.push(g);}let v={};if(u.length>1){let g=Gu(u,n);for(let[f,p]of Object.entries(g))p.length>1&&(v[f]=p);}return {eligible:u,pending:c,unresolved:l,blocked:d,conflicts:v}}function Uh(e){let t={};for(let[r,n]of Object.entries(e)){for(let s of Re(n))t[s]||(t[s]=[]),t[s].push(r);if(n.on)for(let s of Object.values(n.on))for(let o of s)t[o]||(t[o]=[]),t[o].includes(r)||t[o].push(r);if(n.on_failure)for(let s of n.on_failure)t[s]||(t[s]=[]),t[s].includes(r)||t[s].push(r);}return t}var Rr=class{buffer=[];append(t){this.buffer.push(t);}drain(){let t=this.buffer;return this.buffer=[],t}get size(){return this.buffer.length}};function To(e){let t=Ao(e);return Jh(t)}function Ao(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(Ao).join(",")+"]";let t=e;return "{"+Object.keys(t).sort().map(n=>JSON.stringify(n)+":"+Ao(t[n])).join(",")+"}"}function Jh(e){let t=0xcbf29ce484222325n,r=0x100000001b3n,n=0xffffffffffffffffn;for(let s=0;s<e.length;s++)t^=BigInt(e.charCodeAt(s)),t=t*r&n;return t.toString(16).padStart(16,"0")}function Hh(e){if(typeof Buffer<"u")return Buffer.from(e,"utf8").toString("base64url");if(typeof btoa=="function"){let t=new TextEncoder().encode(e),r="";for(let n of t)r+=String.fromCharCode(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}throw new Error("No base64 encoder available in this runtime")}function zh(e){if(typeof Buffer<"u")return Buffer.from(e,"base64url").toString("utf8");if(typeof atob=="function"){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),n=atob(r),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function Xu(e){let t=JSON.stringify({t:e,n:Date.now().toString(36)+Math.random().toString(36).slice(2,6)});return Hh(t)}function Wh(e){try{let t=JSON.parse(zh(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function Qu(e,t,r){let{handlers:n,onDrain:s}=t,o=new Rr,a="state"in e&&"config"in e?e:vn(e),i=false,u=new Set,c=new Map(Object.entries(n)),l=new Rr,d=false,v=false;function g(){if(!i){if(d){v=true;return}d=true;try{do v=!1,f();while(v)}finally{d=false;}}}function f(){let m=l.drain(),y=o.drain(),k=[...m,...y];k.length>0&&(a=Wu(a,k));let w=_r(a);k.length>0&&s?.(k,a,w);for(let C of w.eligible)h(C);for(let C of k)if(C.type==="task-progress"){let{taskName:_,update:$}=C;if(!a.config.tasks[_])continue;let q=a.state.tasks[_];if(!q||q.status!=="running")continue;let F=Xu(_),re=S(_,F,$).catch(U=>{i||(l.append({type:"task-failed",taskName:_,error:U.message??String(U),timestamp:new Date().toISOString()}),g());}).finally(()=>{u.delete(re);});u.add(re);}}function p(m){let k=a.config.tasks[m].requires??[],w=new Map;for(let[_,$]of Object.entries(a.config.tasks))for(let N of $.provides??[])w.set(N,_);let C={};for(let _ of k){let $=w.get(_);$?C[_]=a.state.tasks[$]?.data:C[_]=void 0;}return C}async function S(m,y,k){let w=a.config.tasks[m],C=w.taskHandlers??[],_=p(m);for(let $ of C){let N=c.get($);if(!N)throw new Error(`Handler '${$}' not found in registry (task '${m}')`);let q={nodeId:m,state:_,taskState:a.state.tasks[m],config:w,callbackToken:y,update:k};if(await N(q)==="task-initiate-failure")throw new Error(`Handler '${$}' returned task-initiate-failure (task '${m}')`)}}function h(m){let k=a.config.tasks[m]?.taskHandlers;if(!k||k.length===0)return;l.append({type:"task-started",taskName:m,timestamp:new Date().toISOString()}),g();let w=Xu(m),C=S(m,w).catch(_=>{i||(l.append({type:"task-failed",taskName:m,error:_.message??String(_),timestamp:new Date().toISOString()}),g());}).finally(()=>{u.delete(C);});u.add(C);}return {push(m){i||(m.type==="task-completed"&&m.data&&!m.dataHash&&(m={...m,dataHash:To(m.data)}),o.append(m),g());},pushAll(m){if(!i){for(let y of m)y.type==="task-completed"&&y.data&&!y.dataHash?o.append({...y,dataHash:To(y.data)}):o.append(y);g();}},resolveCallback(m,y,k){if(i)return;let w=Wh(m);if(!w)return;let{taskName:C}=w;if(a.config.tasks[C]){if(k&&k.length>0)o.append({type:"task-failed",taskName:C,error:k.join("; "),timestamp:new Date().toISOString()});else {let _=y&&Object.keys(y).length>0?To(y):void 0;o.append({type:"task-completed",taskName:C,data:y,dataHash:_,timestamp:new Date().toISOString()});}g();}},addNode(m,y){i||(o.append({type:"task-upsert",taskName:m,taskConfig:y,timestamp:new Date().toISOString()}),g());},removeNode(m){i||(o.append({type:"task-removal",taskName:m,timestamp:new Date().toISOString()}),g());},addRequires(m,y){i||(o.append({type:"node-requires-add",nodeName:m,tokens:y,timestamp:new Date().toISOString()}),g());},removeRequires(m,y){i||(o.append({type:"node-requires-remove",nodeName:m,tokens:y,timestamp:new Date().toISOString()}),g());},addProvides(m,y){i||(o.append({type:"node-provides-add",nodeName:m,tokens:y,timestamp:new Date().toISOString()}),g());},removeProvides(m,y){i||(o.append({type:"node-provides-remove",nodeName:m,tokens:y,timestamp:new Date().toISOString()}),g());},registerHandler(m,y){c.set(m,y);},unregisterHandler(m){c.delete(m);},retrigger(m){i||a.config.tasks[m]&&(o.append({type:"task-restart",taskName:m,timestamp:new Date().toISOString()}),g());},retriggerAll(m){if(!i){for(let y of m)a.config.tasks[y]&&o.append({type:"task-restart",taskName:y,timestamp:new Date().toISOString()});g();}},snapshot(){return kr(a)},getState(){return a},getSchedule(){return _r(a)},async waitForHandlers(){u.size>0&&await Promise.allSettled([...u]);},async dispose(m){m?.wait&&u.size>0&&await Promise.allSettled([...u]),i=true;}}}var Xh=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),Sn=Xh("./jsonata-sync.cjs"),tc=Sn;function Zu(e,t){if(!t||!e)return;let r=t.split("."),n=e;for(let s=0;s<r.length;s++){if(n==null)return;n=n[r[s]];}return n}function rc(e,t,r){let n=t.split("."),s=e;for(let o=0;o<n.length-1;o++)(s[n[o]]==null||typeof s[n[o]]!="object")&&(s[n[o]]={}),s=s[n[o]];s[n[n.length-1]]=r;}async function Qh(e,t){if(!e?.compute?.length)return e;e.card_data||(e.card_data={}),e.computed_values={},e._sourcesData=t?.sourcesData??{};let r=e.requires??{},n={card_data:e.card_data,requires:r,expects_data:r,fetched_sources:e._sourcesData,data:e.computed_values,computed_values:e.computed_values};for(let s of e.compute)try{let o=await Sn(s.expr).evaluate(n);rc(e.computed_values,s.bindTo,o),n.computed_values=e.computed_values;}catch{}return e}function Zh(e,t){if(!e?.compute?.length)return {ok:true,node:e};e.card_data||(e.card_data={}),e.computed_values={},e._sourcesData=t?.sourcesData??{};let r=e.requires??{},n={card_data:e.card_data,requires:r,expects_data:r,fetched_sources:e._sourcesData,data:e.computed_values,computed_values:e.computed_values},s=[];for(let o of e.compute)try{let a=tc(o.expr).evaluate(n);rc(e.computed_values,o.bindTo,a),n.computed_values=e.computed_values;}catch(a){let i=a instanceof Error?a.message:String(a);s.push({bindTo:o.bindTo,error:i});}return s.length>0?{ok:true,node:e,errors:s}:{ok:true,node:e}}async function eg(e,t,r){let n={...r??{},card_data:t.card_data??{},requires:t.requires??{},fetched_sources:t._sourcesData??{},computed_values:t.computed_values??{}};return Sn(e).evaluate(n)}function tg(e,t){return t.startsWith("fetched_sources.")?Zu(e._sourcesData??{},t.slice(16)):Zu(e,t)}var ec=new Set(["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]),rg=new Set(["id","meta","requires","provides","view","card_data","compute","source_defs"]);function ng(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:false,errors:["Node must be a non-null object"]};let r=e;(typeof r.id!="string"||!r.id)&&t.push("id: required, must be a non-empty string");for(let n of Object.keys(r))rg.has(n)||t.push(`Unknown top-level key: "${n}"`);if((r.card_data==null||typeof r.card_data!="object"||Array.isArray(r.card_data))&&t.push("card_data: required, must be an object"),r.meta!=null)if(typeof r.meta!="object"||Array.isArray(r.meta))t.push("meta: must be an object");else {let n=r.meta;n.title!=null&&typeof n.title!="string"&&t.push("meta.title: must be a string"),n.tags!=null&&!Array.isArray(n.tags)&&t.push("meta.tags: must be an array");}if(r.requires!=null&&!Array.isArray(r.requires)&&t.push("requires: must be an array of strings"),r.provides!=null&&(Array.isArray(r.provides)?r.provides.forEach((n,s)=>{if(!n||typeof n!="object"||Array.isArray(n))t.push(`provides[${s}]: must be an object with bindTo and ref`);else {let o=n;(typeof o.bindTo!="string"||!o.bindTo)&&t.push(`provides[${s}]: missing required "bindTo" string`),(typeof o.ref!="string"||!o.ref)&&t.push(`provides[${s}]: missing required "ref" string`);}}):t.push("provides: must be an array of { bindTo, ref } bindings")),r.compute!=null&&(Array.isArray(r.compute)?r.compute.forEach((n,s)=>{if(!n||typeof n!="object"||Array.isArray(n))t.push(`compute[${s}]: must be a compute step object`);else {let o=n;(typeof o.bindTo!="string"||!o.bindTo)&&t.push(`compute[${s}]: missing required "bindTo" property`),(typeof o.expr!="string"||!o.expr)&&t.push(`compute[${s}]: missing required "expr" string (JSONata expression)`);}}):t.push("compute: must be an array of compute steps")),r.source_defs!=null)if(!Array.isArray(r.source_defs))t.push("source_defs: must be an array");else {let n=new Set,s=new Set;r.source_defs.forEach((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))t.push(`source_defs[${a}]: must be an object`);else {let i=o;typeof i.bindTo!="string"||!i.bindTo?t.push(`source_defs[${a}]: missing required "bindTo" property`):(n.has(i.bindTo)&&t.push(`source_defs[${a}]: bindTo "${i.bindTo}" is not unique across source_defs`),n.add(i.bindTo)),typeof i.outputFile!="string"||!i.outputFile?t.push(`source_defs[${a}]: missing required "outputFile" property`):(s.has(i.outputFile)&&t.push(`source_defs[${a}]: outputFile "${i.outputFile}" is not unique across source_defs`),s.add(i.outputFile)),i.optionalForCompletionGating!=null&&typeof i.optionalForCompletionGating!="boolean"&&t.push(`source_defs[${a}]: optionalForCompletionGating must be a boolean`);}});}if(r.view!=null)if(typeof r.view!="object"||Array.isArray(r.view))t.push("view: must be an object");else {let n=r.view;!Array.isArray(n.elements)||n.elements.length===0?t.push("view.elements: required, must be a non-empty array"):n.elements.forEach((s,o)=>{if(!s||typeof s!="object"){t.push(`view.elements[${o}]: must be an object`);return}!s.kind||typeof s.kind!="string"?t.push(`view.elements[${o}].kind: required, must be a string`):ec.has(s.kind)||t.push(`view.elements[${o}].kind: unknown kind "${s.kind}". Valid: ${[...ec].join(", ")}`),s.data!=null&&(typeof s.data!="object"||Array.isArray(s.data))&&t.push(`view.elements[${o}].data: must be an object`);}),n.layout!=null&&(typeof n.layout!="object"||Array.isArray(n.layout))&&t.push("view.layout: must be an object"),n.features!=null&&(typeof n.features!="object"||Array.isArray(n.features))&&t.push("view.features: must be an object");}return {ok:t.length===0,errors:t}}async function sg(e,t){if(!e||e.length===0)return [];let r={card_data:t.card_data??{},requires:t.requires??{}};return Promise.all(e.map(async n=>{let s={};if(n.projections&&typeof n.projections=="object"&&!Array.isArray(n.projections)){for(let[o,a]of Object.entries(n.projections))if(typeof a=="string"&&a.trim().length>0)try{s[o]=await Sn(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}}))}function og(e,t){if(!e||e.length===0)return [];let r={card_data:t.card_data??{},requires:t.requires??{}};return e.map(n=>{let s={};if(n.projections&&typeof n.projections=="object"&&!Array.isArray(n.projections)){for(let[o,a]of Object.entries(n.projections))if(typeof a=="string"&&a.trim().length>0)try{s[o]=tc(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}})}var ot={run:Qh,runSync:Zh,eval:eg,resolve:tg,validate:ng,enrichSources:sg,enrichSourcesSync:og};function ag(e,t){let r;return /\.m?js$/i.test(e)?r="local-node":/\.py$/i.test(e)?r="local-python":r="local-process",{meta:"task-executor",howToRun:r,whatToRun:oe({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function wn(e){return JSON.stringify(e)}function kn(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}function _n(e,t){function r(){return e.readIndex()??{}}function n(s,o,a){let i=String(o||"").split(".").filter(Boolean);if(i.length===0)return a&&typeof a=="object"&&!Array.isArray(a)?a:{value:a};let u={...s},c=u;for(let l=0;l<i.length-1;l++){let d=i[l],v=c[d],g=v&&typeof v=="object"&&!Array.isArray(v)?{...v}:{};c[d]=g,c=g;}return c[i[i.length-1]]=a,u}return {readCard(s){let o=r()[s];return !o||!e.cardExists(o.key)?null:e.readCard(o.key)},readCardKey(s){return r()[s]?.key??null},readAllCards(){let s=[];for(let[o,a]of Object.entries(r())){if(!e.cardExists(a.key))continue;let i=e.readCard(a.key);i?s.push(i):t?.(`[card-store] could not read card "${o}" at key "${a.key}"`);}return s},readChecksumIndex(){let s={};for(let[o,a]of Object.entries(r()))s[o]=a.checksum;return s},changedSince(s){let o=r(),a=[];for(let[i,u]of Object.entries(o))s[i]!==u.checksum&&a.push(i);for(let i of Object.keys(s))o[i]||a.push(i);return a},validateUpsert(s,o){let a=r(),i=a[s],u=Object.entries(a).find(([,c])=>c.key===o);return i&&i.key!==o?{ok:false,error:`Card id "${s}" is already mapped to key "${i.key}", cannot remap to "${o}"`}:u&&u[0]!==s?{ok:false,error:`Key "${o}" is already mapped to card id "${u[0]}", cannot remap to "${s}"`}:{ok:true}},writeCard(s,o,a){let i=r(),u=a??i[s]?.key??e.defaultCardKey(s),c=e.writeCard(u,o);i[s]={key:u,checksum:c,updatedAt:new Date().toISOString()},e.writeIndex(i);},patchCard(s,o,a){let i=r(),u=i[s];if(!u||!e.cardExists(u.key))throw new Error(`card "${s}" not found`);let c=e.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${s}" is not patchable`);let l=n(c,o,a),d=e.writeCard(u.key,l);i[s]={key:u.key,checksum:d,updatedAt:new Date().toISOString()},e.writeIndex(i);},removeCard(s){let o=r();o[s]&&(delete o[s],e.writeIndex(o));},readIndex(){return r()}}}function Io(e,t){return {readSourceData(r,n){let s=e.read(`${r}/${n}`);if(s==null)return null;let o=s.trim();if(!o)return null;try{return JSON.parse(o)}catch{return o}},ingestSourceDataStaged(r,n,s,o){let a=t(s);e.write(`${r}/.staged/${o}/${n}`,a);},commitSourceData(r,n,s){let o=`${r}/.staged/${s}/${n}`,a=e.read(o);return a==null?false:(e.write(`${r}/${n}`,a),e.remove(o),true)},hasSource(r,n){return e.exists(`${r}/${n}`)}}}function oc(e){function t(r){let n=e.readAllEntries();if(!r)return n;let s=n.findIndex(o=>o.id===r);return s===-1?n:n.slice(s+1)}return {readEntriesAfterCursor(r){let n=t(r);return n.length===0?{events:[],newCursor:r}:{events:n.map(s=>s.event),newCursor:n[n.length-1].id}},pendingCount(r){return t(r).length},appendEvent(r){e.appendEntry({id:e.generateId(),event:r});}}}function ac(e,t){return {appendEntries(r,n){if(!r||n.length===0)return;let s=e.read(r)??[];e.write(r,[...s,...n]);},dispatchEntriesForJournalId(r,n){if(!r)return;let s=e.read(r);if(!(!s||s.length===0)){for(let o of s)try{n(o);}catch(a){let i=a instanceof Error?a.message:String(a);try{t(o,i);}catch{}}e.delete(r);}}}}var Cr="v1",at="board/graph",ic="board/lastJournalProcessedId";function nc(e){return `cards/${e}/runtime`}function uc(e){return {readRuntime(t){return e.read(nc(t))??{_sources:{}}},writeRuntime(t,r){e.write(nc(t),r);}}}function ig(e,t){let r={...e};for(let n of t.deleteKeys)delete r[n];return {...r,...t.shallowMerge}}function cc(e){return {readSnapshot(t){return e.readValues(t)},commitSnapshot(t,r){if(r.schemaVersion!==Cr)throw new Error(`Unsupported snapshot schema version: ${r.schemaVersion}`);let n=e.readValues(t);if(n.version!==r.expectedVersion)return {ok:false,reason:"version-mismatch",currentVersion:n.version};let s=ig(n.values,r);return {ok:true,newVersion:e.writeValues(t,s,r.deleteKeys)}}}}function Po(e){function t(r){let n=e.read(r);return n==null?null:typeof n=="string"?n:JSON.stringify(n)}return {readTaskExecutorRef(){let r=t("task-executor");if(r?.trim())return kn(r.trim())},writeTaskExecutorRef(r){e.write("task-executor",wn(r));},readChatHandlerRef(){let r=t("chat-handler");if(r?.trim())return kn(r.trim())},writeChatHandlerRef(r){e.write("chat-handler",wn(r));},readCardStoreRef(){return t("card-store-ref")},writeCardStoreRef(r){e.write("card-store-ref",r);},readOutputsStoreRef(){return t("outputs-store-ref")},writeOutputsStoreRef(r){e.write("outputs-store-ref",r);},readChatHandler(){return t("chat-handler")?.trim()||void 0},writeChatHandler(r){e.write("chat-handler",r);}}}function dc(e){return {writeComputedValues(t,r){e.write(`cards/${t}/computed_values`,r);},readComputedValues(t){return e.read(`cards/${t}/computed_values`)},readAllComputedValues(){let t={};for(let r of e.listKeys("cards/")){let n=r.match(/^cards\/([^/]+)\/computed_values$/);n&&(t[n[1]]=e.read(r));}return t},writeDataObjects(t){for(let[r,n]of Object.entries(t))r&&e.write(`data-objects/${r}`,n);},readDataObject(t){return e.read(`data-objects/${t}`)},readAllDataObjects(){let t={};for(let r of e.listKeys("data-objects/"))t[r.slice(13)]=e.read(r);return t},writeStatusSnapshot(t){e.write("status",t);},readStatusSnapshot(){return e.read("status")}}}function ug(e){return e?.lastRequestedAt?!e.lastFetchedAt||e.lastFetchedAt<e.lastRequestedAt:false}function cg(e,t){return e?.lastRequestedAt?ug(e)?"in-flight":!e.lastFetchedAt||e.lastFetchedAt<t?"dispatch":"idle":"dispatch"}function dg(e,t){let r={...e,lastFetchedAt:t};return delete r.lastError,r}function sc(e,t){let r={...e,lastError:t};return delete r.lastFetchedAt,r}function Rn(e,t){let r=t.state.tasks,n=t.config.tasks,s=Object.keys(r),o=_r(t),a={completed:0,failed:0,in_progress:0,pending:0,blocked:0,unresolved:0},i=new Map;for(let f of o.pending)i.set(f.taskName,f.waitingOn);for(let f of o.unresolved)i.set(f.taskName,f.missingTokens);for(let f of o.blocked)i.set(f.taskName,f.failedTokens);let u=new Map;for(let[f,p]of Object.entries(n))for(let S of p.requires??[]){let h=u.get(S)??[];h.push(f),u.set(S,h);}let c=s.sort().map(f=>{let p=r[f],S=n[f]??{requires:[],provides:[]};p.status==="completed"?a.completed+=1:p.status==="failed"?a.failed+=1:p.status==="in-progress"&&(a.in_progress+=1);let h=S.requires??[],m=S.provides??[],y=Object.keys(p.data??{}).sort(),k=h.filter(q=>t.state.availableOutputs.includes(q)),w=h.filter(q=>!t.state.availableOutputs.includes(q)),C=i.get(f)??w,_=new Set;for(let q of m)for(let F of u.get(q)??[])F!==f&&_.add(F);let $=p.failedAt,N=p.error?{message:p.error,code:"TASK_FAILED",at:$,source:"task-runtime"}:void 0;return {name:f,status:p.status,error:N,requires:h,requires_satisfied:k,requires_missing:w,provides_declared:m,provides_runtime:y,blocked_by:C,unblocks:Array.from(_).sort(),runtime:{attempt_count:p.executionCount??0,restart_count:p.retryCount??0,in_progress_since:p.status==="in-progress"?p.startedAt??null:null,last_transition_at:p.lastUpdated??null,last_completed_at:p.completedAt??null,last_restarted_at:p.startedAt??null,status_age_ms:p.lastUpdated?0:null}}});a.pending=o.pending.length,a.blocked=o.blocked.length,a.unresolved=o.unresolved.length;let l=c.map(f=>({name:f.name,fanOut:f.unblocks.length})).sort((f,p)=>p.fanOut-f.fanOut||f.name.localeCompare(p.name)),d=l.length>0?l[0]:{name:null,fanOut:0},v=new Set;for(let f of Object.values(n))for(let p of f.requires??[])v.add(p);let g=0;for(let[f,p]of Object.entries(n)){let S=(p.requires??[]).length===0,m=(p.provides??[]).some(y=>(u.get(y)??[]).some(k=>k!==f));S&&!m&&(g+=1);}return {schema_version:"v1",meta:{board:{path:e}},summary:{card_count:s.length,completed:a.completed,eligible:o.eligible.length,pending:a.pending,blocked:a.blocked,unresolved:a.unresolved,failed:a.failed,in_progress:a.in_progress,orphan_cards:g,topology:{edge_count:Array.from(v).length,max_fan_out_card:d.name,max_fan_out:d.fanOut}},cards:c}}function lg(){return new Date().toISOString()}function lc(e,t,r,n,s,o,a){return async i=>{let u=[],c=r.cardStore.readCard(i.nodeId);if(!c)return "task-initiate-failure";let l=c.id,d=c.card_data??{},v=c.source_defs??[],g=v.filter(M=>M.optionalForCompletionGating!==true),f=r.cardRuntimeStore.readRuntime(l),p=false,S=()=>{p&&(r.cardRuntimeStore.writeRuntime(l,f),p=false);},h=M=>({...f._sources[M]??{}}),m=(M,V)=>{f._sources[M]=V,p=true;},y=i.taskState?.executionCount??0,k=f._lastExecutionCount;if(typeof k=="number"&&k!==y&&(f._sources={},p=true),k!==y&&(f._lastExecutionCount=y,p=true),i.update){let M=i.update,V=M.outputFile;if(V){let R=h(V);if(M.failure)m(V,sc(R,M.reason??"unknown"));else {let b=M.rqt;if(!R.lastFetchedAt||b>R.lastFetchedAt){let E=typeof M.deliveryToken=="string"?M.deliveryToken:void 0,A=false;E&&(A=r.fetchedSourcesStore.commitSourceData(l,V,E)),A?m(V,dg(R,b)):m(V,sc(R,`source delivery commit failed for ${V} token=${String(E)}`));}}S();}}let w={};for(let M of v)if(M.outputFile){let V=r.fetchedSourcesStore.readSourceData(l,M.outputFile);V!==null&&(w[M.bindTo]=V);}let C={};for(let[M,V]of Object.entries(i.state??{}))if(V!==null&&typeof V=="object"&&!Array.isArray(V)){let R=V[M];C[M]=R!==void 0?R:V;}else C[M]=V;let _={id:l,card_data:{...d},requires:C,source_defs:v,compute:c.compute};_._sourcesData=w,c.compute&&ot.runSync(_,{sourcesData:w}),(o??r.outputStore.writeComputedValues.bind(r.outputStore))(l,_.computed_values??{});let $={...c},N=ot.enrichSourcesSync(Array.isArray(c.source_defs)?c.source_defs:void 0,{card_data:c.card_data,requires:C}),q=e.value;$.source_defs=Array.isArray(N)?N.map(M=>({...M,boardDir:typeof M.boardDir=="string"&&M.boardDir?M.boardDir:q})):N;let F=lg(),re=i.update?void 0:F,U=g.filter(M=>{let V=M.outputFile;if(typeof V!="string"||!V)return true;let R=h(V);re&&(R={...R,queueRequestedAt:re},m(V,R));let b=R.queueRequestedAt??R.lastRequestedAt??F,E=cg(R,b);return E==="in-flight"?false:E==="dispatch"});if(S(),U.length>0){let M=false,V=F;for(let R of U){let b=R.outputFile;if(typeof b!="string"||!b)continue;let E=h(b),A=E.queueRequestedAt??F;m(b,{...E,lastRequestedAt:A}),V=A,M=true;}return M&&S(),M&&(u.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:$,callbackToken:i.callbackToken,rqt:V}}),r.executionRequestStore.appendEntries(t,u)),"task-initiated"}let ce=c.provides??[],qe={};for(let{bindTo:M,ref:V}of ce)qe[M]=ot.resolve(_,V);return (a??r.outputStore.writeDataObjects.bind(r.outputStore))(qe),v.filter(M=>{if(M.optionalForCompletionGating!==true)return false;let V=h(M.outputFile);return !V.lastRequestedAt||!V.lastFetchedAt?true:V.lastFetchedAt<=V.lastRequestedAt}).length>0&&u.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:$,callbackToken:i.callbackToken,rqt:F}}),n(i.nodeId,qe),u.length>0&&r.executionRequestStore.appendEntries(t,u),"task-initiated"}}var Cn={settings:{completion:"manual",refreshStrategy:"data-changed"},tasks:{}};function fc(e){return {[at]:e.graph,[ic]:e.lastDrainedJournalId}}function pc(e){let t=e[at],r=e[ic];if(!t||typeof t!="object")throw new Error(`State snapshot is missing required key: ${at}`);return {graph:t,lastDrainedJournalId:typeof r=="string"?r:""}}function mc(e){let t=e.requires,r=e.provides?.map(n=>n.bindTo)??[];return {requires:t&&t.length>0?t:void 0,provides:r,taskHandlers:["card-handler"],description:e.meta?.title??e.id}}function Q(e){return e!==void 0?{status:"success",data:e}:{status:"success"}}function j(e){return {status:"fail",error:e}}function ee(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function fg(e){let t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCharCode(n)).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),n=atob(r),s=Uint8Array.from(n,o=>o.charCodeAt(0));return new TextDecoder().decode(s)}function $n(e){try{let t=JSON.parse(gc(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function pg(e){return fg(JSON.stringify(e))}function hc(e){try{let t=JSON.parse(gc(e));return typeof t?.cbk=="string"&&typeof t?.cid=="string"&&typeof t?.b=="string"&&typeof t?.d=="string"?t:null}catch{return null}}function Ce(){return new Date().toISOString()}function mg(e,t){let r=t.onWarn??(()=>{}),n=oe(e);function s(R){if(R.length!==0)try{let b=t.publishBoardChangeNotifications?.(R);b&&typeof b.catch=="function"&&b.catch(E=>r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${E instanceof Error?E.message:String(E)}`));}catch(b){r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${b instanceof Error?b.message:String(b)}`);}}function o(){let R=i().readCardStoreRef();if(!R)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let b=t.kvStorageForRef(R);return {readIndex(){return b.read("_index")},writeIndex(E){b.write("_index",E);},readCard(E){return b.read(E)},writeCard(E,A){return b.write(E,A),t.hashFn(A)},cardExists(E){return b.read(E)!==null},defaultCardKey(E){return E}}}let a={readValues(R){let b=t.kvStorage("state-snapshot"),E=b.listKeys().sort();if(E.length===0)return {version:null,values:{}};let A={};for(let Y of E)A[Y]=b.read(Y);return {version:t.hashFn(A),values:A}},writeValues(R,b,E){let A=t.kvStorage("state-snapshot");for(let Y of E)A.delete(Y);for(let[Y,te]of Object.entries(b))A.write(Y,te);return t.hashFn(b)}},i=()=>Po(t.kvStorage("config")),u=()=>cc(a),c=()=>oc(t.journalAdapter()),l=()=>_n(o(),r),d=()=>{let R=i().readOutputsStoreRef();if(!R)throw new Error(`Board at ${e.value} has no outputs store configured. Run: init --outputs-store-ref <b64-ref>`);return dc(t.kvStorageForRef(R))};function v(){return !!u().readSnapshot(e.value).values[at]}function g(){let R=u().readSnapshot(e.value);if(!R.values[at])throw new Error(`Board not initialized at ${e.value}`);return pc(R.values)}function f(R,b){let E=u().commitSnapshot(e.value,{schemaVersion:Cr,expectedVersion:b,commitId:t.genId(),committedAt:Ce(),deleteKeys:[],shallowMerge:fc(R)});if(!E.ok)throw new Error(`Snapshot commit failed (version mismatch): expected=${b??"null"} current=${E.currentVersion??"null"}`)}function p(R){c().appendEvent(R);}async function S(){let R=(I,D)=>{let ae=I.payload,ze=(ae?.enrichedCard??{}).id??ae?.cardId??"unknown";p({type:"task-failed",taskName:ze,error:D,timestamp:Ce()});},b=ac(t.kvStorage("execution-requests"),R),E=uc(t.kvStorage("card-runtime")),A=Io(t.blobStorage("sources"),I=>t.resolveBlob(I)),Y=new Map,te={readRuntime(I){return Y.get(I)??E.readRuntime(I)},writeRuntime(I,D){Y.set(I,D);}},ke=[],_e=new Map,Be={readSourceData(I,D){let ae=`${I}/${D}`;return _e.has(ae)?_e.get(ae):A.readSourceData(I,D)},ingestSourceDataStaged(I,D,ae,Ct){A.ingestSourceDataStaged(I,D,ae,Ct);},commitSourceData(I,D,ae){let Ct=`${I}/.staged/${ae}/${D}`,Tr=t.blobStorage("sources").read(Ct);if(Tr==null)return false;let $t=`${I}/${D}`,Fo=Tr.trim();try{_e.set($t,JSON.parse(Fo));}catch{_e.set($t,Fo);}return ke.push({cardId:I,outputFile:D,deliveryToken:ae}),true},hasSource(I,D){let ae=`${I}/${D}`;return _e.has(ae)?true:A.hasSource(I,D)}},De={cardStore:l(),cardRuntimeStore:te,fetchedSourcesStore:Be,outputStore:d(),executionRequestStore:b},ut=g(),ct=bn(ut.graph),{events:_t,newCursor:Rt}=c().readEntriesAfterCursor(ut.lastDrainedJournalId),dt=[],xn=[],Tn=[],No=new Map,wc=(I,D)=>{dt.push({type:"task-completed",taskName:I,data:D,timestamp:Ce()});},qo=(I,D)=>p({type:"task-failed",taskName:I,error:D,timestamp:Ce()}),Er=Qu(ct,{handlers:{"card-handler":lc(e,Rt,De,wc,qo,(I,D)=>{xn.push({cardId:I,values:D});},I=>{Tn.push(I);})}});for(dt=_t;dt.length>0;){let I=dt;dt=[];for(let D of I)if(D.type==="task-restart"){let ae=De.cardStore.readCard(D.taskName);ae&&No.set(D.taskName,ae);}Er.pushAll(I),await Er.waitForHandlers();}let Do=Er.getState();await Er.dispose({wait:true});let kc=u().readSnapshot(e.value).version;f({lastDrainedJournalId:Rt,graph:kr(Do)},kc);for(let{cardId:I,values:D}of xn)De.outputStore.writeComputedValues(I,D);for(let I of Tn)De.outputStore.writeDataObjects(I);for(let[I,D]of Y)E.writeRuntime(I,D);for(let{cardId:I,outputFile:D,deliveryToken:ae}of ke)A.commitSourceData(I,D,ae);let xr;try{xr=Rn(n,Do),De.outputStore.writeStatusSnapshot(xr);}catch(I){r(`[board-live-cards-public] status publish failed: ${I instanceof Error?I.message:String(I)}`);}let Gt=[];for(let{cardId:I,values:D}of xn)Gt.push({kind:"computed_values",cardId:I,values:D});for(let I of Tn)for(let[D,ae]of Object.entries(I))D&&Gt.push({kind:"data_object",key:D,payload:ae});for(let[I,D]of No)Gt.push({kind:"card_refreshed",cardId:I,card:D});xr!==void 0&&Gt.push({kind:"status",status:xr}),s(Gt);let _c=i().readTaskExecutorRef()??{howToRun:"built-in",whatToRun:oe({kind:"built-in",value:"source-cli-task-executor"})};b.dispatchEntriesForJournalId(Rt,I=>{if(I.taskKind!=="source-fetch"){r(`[process-accumulated-events] unknown taskKind "${I.taskKind}" \u2014 skipping`);return}let D=I.payload,ae=D.enrichedCard?.id??"unknown",Ct=D.enrichedCard?.source_defs??[];for(let ze of Ct){if(!ze.outputFile){r(`[dispatch] source "${ze.bindTo}" has no outputFile \u2014 skipping`);continue}let Tr=pg({cbk:D.callbackToken,rg:e.value,br:oe(e),cid:ae,b:ze.bindTo,d:ze.outputFile,cs:void 0,rqt:D.rqt});t.dispatchExecution(_c,{source_def:ze,base_ref:oe(e),callback:{token:Tr,via:t.selfRef}}).catch($t=>qo(ae,$t instanceof Error?$t.message:String($t)));}});}async function h(){try{let R=()=>{let E=g(),{events:A}=c().readEntriesAfterCursor(E.lastDrainedJournalId);A.length<=0||(h(),t.requestProcessAccumulated?.());},b=await Lo(t.lock,S,R);return Q({ran:b!==!1})}catch(R){return ee(R)}}function m(R){try{let b=R.params?.cardStoreRef;if(!b)return j("init requires params.cardStoreRef \u2014 create a card store with card-store-cli and pass its ref here");if(!v()){let te=vn(Cn);f({lastDrainedJournalId:"",graph:kr(te)},null);}let E=R.params?.outputsStoreRef;if(!E)return j("init requires params.outputsStoreRef \u2014 pass the outputs store ref here");let A=i();A.writeCardStoreRef(b),A.writeOutputsStoreRef(E);let Y=R.body??{};Y["task-executor-ref"]&&A.writeTaskExecutorRef(Y["task-executor-ref"]),Y["chat-handler-ref"]&&A.writeChatHandlerRef(Y["chat-handler-ref"]);try{d().writeStatusSnapshot(Rn(n,bn(g().graph)));}catch{}return Q()}catch(b){return ee(b)}}function y(R){try{let b=d().readStatusSnapshot();if(!b){b=Rn(n,bn(g().graph));try{d().writeStatusSnapshot(b);}catch{}}return Q(b)}catch(b){return ee(b)}}function k(R){try{let b=R.params?.id;return b?(p({type:"task-removal",taskName:b,timestamp:Ce()}),h(),Q()):j("removeCard requires params.id")}catch(b){return ee(b)}}function w(R){try{let b=R.params?.id;return b?(p({type:"task-restart",taskName:b,timestamp:Ce()}),h(),Q()):j("retrigger requires params.id")}catch(b){return ee(b)}}async function C(R){return h()}function _(R){try{let b=R.params?.cardId,E=R.params?.all,A=!!R.params?.restart;if(!b&&!E)return j("upsertCard requires --card-id <id> or --all");let Y=E?l().readAllCards().map(te=>te.id):[b];for(let te of Y)if(!l().readCard(te))return j(`Card "${te}" not found in board at ${e.value}`);for(let te of Y){let ke=l().readCard(te),_e=mc(ke),Be=t.hashFn(_e),De=t.kvStorage("card-upsert"),ut=De.read(te),ct=ut?.taskConfigHash!==Be;if(!(!ct&&!A)){if(ct){let _t=ut?.blobRef??l().readCardKey(te)??te;p({type:"task-upsert",taskName:te,taskConfig:_e,timestamp:Ce()}),De.write(te,{blobRef:_t,taskConfigHash:Be,updatedAt:Ce()});}A&&p({type:"task-restart",taskName:te,timestamp:Ce()});}}return h(),Q()}catch(b){return ee(b)}}function $(R){try{let b=R.params?.token;if(!b)return j("taskFailed requires params.token");let E=R.params?.error??"unknown error",A=$n(b);return A?(p({type:"task-failed",taskName:A.taskName,error:E,timestamp:Ce()}),h(),Q()):j("Invalid callback token")}catch(b){return ee(b)}}function N(R){try{let b=R.params?.token;if(!b)return j("taskProgress requires params.token");let A=(R.body??{}).update??{},Y=$n(b);return Y?(p({type:"task-progress",taskName:Y.taskName,update:A,timestamp:Ce()}),h(),Q()):j("Invalid callback token")}catch(b){return ee(b)}}function q(R){try{let b=R.params?.token,E=R.params?.ref;if(!b)return j("sourceDataFetched requires params.token");if(!E)return j("sourceDataFetched requires params.ref");let A=hc(b);if(!A)return j("Invalid source token");let{cbk:Y,cid:te,b:ke,d:_e,cs:Be,rqt:De}=A,ut=Io(t.blobStorage("sources"),dt=>t.resolveBlob(dt)),ct=t.genId();ut.ingestSourceDataStaged(te,_e,$e(E),ct);let _t=$n(Y);if(!_t)return j("Invalid callback token embedded in source token");let Rt=Ce();return p({type:"task-progress",taskName:_t.taskName,update:{bindTo:ke,outputFile:_e,fetchedAt:Rt,deliveryToken:ct,sourceChecksum:Be,rqt:De},timestamp:Rt}),h(),Q()}catch(b){return ee(b)}}function F(R){try{let b=R.params?.token,E=R.params?.reason??"unknown";if(!b)return j("sourceDataFetchFailure requires params.token");let A=hc(b);if(!A)return j("Invalid source token");let{cbk:Y,b:te,d:ke,cs:_e}=A,Be=$n(Y);return Be?(p({type:"task-progress",taskName:Be.taskName,update:{bindTo:te,outputFile:ke,failure:!0,reason:E,sourceChecksum:_e},timestamp:Ce()}),h(),Q()):j("Invalid callback token embedded in source token")}catch(b){return ee(b)}}function re(R){try{let b=i().readCardStoreRef();return b?Q({storeRef:b}):j(`Board at ${e.value} has no card store configured`)}catch(b){return ee(b)}}function U(R){try{let b=i().readOutputsStoreRef();return b?Q({storeRef:b}):j(`Board at ${e.value} has no outputs store configured`)}catch(b){return ee(b)}}function ce(R){try{let b=R.params?.key;if(!b)return j("getConfig requires params.key");let E=i(),A;switch(b){case "task-executor":A=E.readTaskExecutorRef()??null;break;case "chat-handler":A=E.readChatHandlerRef()??null;break;case "card-store-ref":A=E.readCardStoreRef();break;case "outputs-store-ref":A=E.readOutputsStoreRef();break;default:return j(`getConfig: unknown key "${b}"`)}return Q({value:A})}catch(b){return ee(b)}}function qe(R){try{let b=R.params?.key;if(!b)return j("getOutputsDataObject requires params.key");let E=d().readDataObject(b);return Q(E)}catch(b){return ee(b)}}function it(R){try{return Q(d().readAllDataObjects())}catch(b){return ee(b)}}function M(R){try{let b=R.params?.key;if(!b)return j("getOutputsComputedValues requires params.key");let E=d().readComputedValues(b);return Q(E)}catch(b){return ee(b)}}function V(R){try{return Q(d().readAllComputedValues())}catch(b){return ee(b)}}return {init:m,status:y,getCardStoreRef:re,getOutputsStoreRef:U,getConfig:ce,getOutputsDataObject:qe,getAllOutputsDataObjects:it,getOutputsComputedValues:M,getAllOutputsComputedValues:V,removeCard:k,retrigger:w,processAccumulatedEvents:C,upsertCard:_,taskFailed:$,taskProgress:N,sourceDataFetched:q,sourceDataFetchFailure:F}}function hg(e,t){let r=()=>Po(t.kvStorage("config"));function n(){let h=r().readCardStoreRef();if(!h)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let m=t.kvStorageForRef(h);return {readIndex(){return m.read("_index")},writeIndex(y){m.write("_index",y);},readCard(y){return m.read(y)},writeCard(y,k){return m.write(y,k),t.hashFn(k)},cardExists(y){return m.read(y)!==null},defaultCardKey(y){return y}}}let s=()=>_n(n(),t.onWarn??(()=>{}));function o(h,m){let y=t.validateSchema(m),k=[],w=r().readTaskExecutorRef();if(w&&Array.isArray(m.source_defs))for(let _ of m.source_defs){let $=typeof _.bindTo=="string"?_.bindTo:"(unknown)";try{let N;try{N=t.invokeExecutorSync(w,"validate-source-def",[],{timeout:1e4,input:JSON.stringify(_)});}catch(F){let re=F;if(N=typeof re?.stdout=="string"?re.stdout:"",!N.trim()){k.push(`source "${$}": executor validate-source-def failed \u2014 ${F instanceof Error?F.message:String(F)}`);continue}}let q=JSON.parse(N.trim());if(!q.ok&&Array.isArray(q.errors))for(let F of q.errors)k.push(`source "${$}": ${F}`);}catch(N){k.push(`source "${$}": executor validate-source-def failed \u2014 ${N instanceof Error?N.message:String(N)}`);}}let C=[...y.errors,...k];return Q({cardId:h,isValid:C.length===0,issues:C})}function a(h,m,y){let k=r().readTaskExecutorRef();if(!k)return j("No task-executor registered for this board");let w=typeof h.bindTo=="string"?h.bindTo:"source",C=t.makeTempFilePath(`probe-in-${w}`),_=t.makeTempFilePath(`probe-out-${w}`),$=t.makeTempFilePath(`probe-err-${w}`,".txt"),N={...h,boardDir:e.value,_projections:m},q=oe({kind:"fs-path",value:C}),F=oe({kind:"fs-path",value:_}),re=oe({kind:"fs-path",value:$});t.absoluteBlob.write(C,JSON.stringify(N,null,2));let U=null;try{if(t.invokeExecutorSync(k,"run-source-fetch",["--in-ref",q,"--out-ref",F,"--err-ref",re],{timeout:h.timeout??3e4}),U=t.absoluteBlob.read(_),U===null)return j("Executor produced no output file")}catch(ce){let qe=t.absoluteBlob.read($)?.trim()??(ce instanceof Error?ce.message:String(ce));return j(`Probe failed: ${qe}`)}finally{try{t.absoluteBlob.remove(C);}catch{}try{t.absoluteBlob.remove($);}catch{}}if(y){let ce=$e(y);t.absoluteBlob.write(ce.value,U);}else try{t.absoluteBlob.remove(_);}catch{}return Q({bindTo:w,resultSizeBytes:U.length})}function i(h){try{let m=h.params?.cardId,y=h.params?.all;if(!m&&!y)return j("validateCard requires --card-id <id> or --all");let k=y?s().readAllCards().map(C=>C.id):[m],w=[];for(let C of k){let _=s().readCard(C);if(!_){w.push({cardId:C,isValid:!1,issues:[`Card "${C}" not found`]});continue}let $=o(C,_);if($.status!=="success")return $;w.push($.data);}return Q(w)}catch(m){return ee(m)}}function u(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("validateCardPreflight requires card JSON object in body");let m=h.body,y=m["card-content"]??m,k=typeof y.id=="string"?y.id:"(unknown)",w=o(k,y),C=r().readTaskExecutorRef();if(C)try{let _=t.invokeExecutorSync(C,"validate-card-preflight",[],{timeout:1e4,input:JSON.stringify(y)}),$=JSON.parse(_.trim());if(!$.ok&&Array.isArray($.errors)&&$.errors.length>0){let N=[...w.status==="success"?w.data.issues:[],...$.errors];return Q({cardId:k,isValid:!1,issues:N})}}catch{}return w}catch(m){return ee(m)}}function c(h){try{let m=h.params?.cardId,y=h.params?.sourceIdx,k=h.params?.outRef;if(!m)return j("probeSource requires params.cardId");if(y===void 0)return j("probeSource requires params.sourceIdx");let C=(h.body??{})["mock-projections"]??{},_=s().readCard(m);if(!_)return j(`Card "${m}" not found`);let $=_.source_defs??[];return y<0||y>=$.length?j(`sourceIdx ${y} out of range (card has ${$.length} source(s))`):a($[y],C,k)}catch(m){return ee(m)}}function l(h){try{let m=h.params?.outRef,y=h.body;if(!y)return j('probeTmpSource requires body with "source-def" and "mock-projections"');let k=y["source-def"],w=y["mock-projections"]??{};return k?a(k,w,m):j('probeTmpSource body requires "source-def"')}catch(m){return ee(m)}}function d(h){try{let m=h.params?.sourceIdx,y=h.params?.outRef;if(m===void 0)return j("probeSourcePreflight requires params.sourceIdx");if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("probeSourcePreflight requires card JSON object in body");let k=h.body,w=k["card-content"]??k,C=k["mock-projections"]??{},_=w.source_defs??[];if(m<0||m>=_.length)return j(`sourceIdx ${m} out of range (card has ${_.length} source(s))`);let $=_[m],N=r().readTaskExecutorRef();if(N){let q=typeof $.bindTo=="string"?$.bindTo:"source";try{let F={...$,_projections:C},re=t.invokeExecutorSync(N,"probe-source-preflight",[],{timeout:$.timeout??1e4,input:JSON.stringify(F)}),U=JSON.parse(re.trim());return U.ok?Q({bindTo:q,reachable:U.reachable,latencyMs:U.latencyMs,note:U.note}):j(U.error??"Preflight probe failed")}catch{}}return a($,C,y)}catch(m){return ee(m)}}function v(h){try{let m=r().readTaskExecutorRef();if(!m)return j("No task-executor registered for this board");let y=t.invokeExecutorSync(m,"describe-capabilities",[],{timeout:1e4});return Q(JSON.parse(y.trim()))}catch(m){return ee(m)}}function g(h){try{let m=h.body;if(!m||!Array.isArray(m.ops))return j("updatesInCardStore requires body.ops array");let y=m.ops,k=s();for(let w of y){let C=w.op,_=w.id;if(!_)return j('op is missing "id"');if(C==="update"){let $=w["card-content"];if(!$)return j(`update op for "${_}" is missing "card-content"`);k.writeCard(_,$);}else return j(`Unknown op type: "${C??"(none)"}"`)}return Q()}catch(m){return ee(m)}}function f(h){try{let m=h.body;if(!m||!Array.isArray(m.ids))return j("readFromCardStore requires body.ids array");let y=m.ids,k=s(),w=y.map(C=>({id:C,"card-content":k.readCard(C)}));return Q({cards:w})}catch(m){return ee(m)}}function p(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("evalCardCompute requires a JSON object in body");let m=h.body,y=m["card-content"]??m,k=typeof y.id=="string"?y.id:"(unknown)",w=m["mock-fetched-sources"]??{},C=m["mock-requires"]??{},_=y.compute;if(!_||!Array.isArray(_)||_.length===0)return Q({cardId:k,ok:!0,computed_values:{},errors:[]});let $={id:k,card_data:y.card_data??{},requires:C,source_defs:y.source_defs,compute:_},N=ot.runSync($,{sourcesData:w}),q=N.node.computed_values??{},F=N.errors??[];return Q({cardId:k,ok:F.length===0,computed_values:q,errors:F})}catch(m){return ee(m)}}function S(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("simulateCardCycle requires a JSON object in body");let m=h.body,y=m["card-content"]??m,k=typeof y.id=="string"?y.id:"(unknown)",w=m["mock-fetched-sources"]??{},C=m["mock-requires"]??{},_=o(k,y),$=_.status==="success"?{isValid:_.data.isValid,issues:_.data.issues}:{isValid:!1,issues:[_.status==="fail"?_.error:"internal error"]},N=y.source_defs??[],q=y.card_data??{},F=[],re=[];if(N.length>0){F=ot.enrichSourcesSync(N,{card_data:q,requires:C});for(let b of F){let E=b.projections,A=b._projections;if(E&&A){for(let Y of Object.keys(E))if(A[Y]===void 0){let te=typeof b.bindTo=="string"?b.bindTo:"(unknown)";re.push({bindTo:te,key:Y,error:`Projection "${Y}" resolved to undefined`});}}}}let U=[],ce=m["task-executor-ref"],qe=(ce?.howToRun&&ce?.whatToRun?ce:void 0)??r().readTaskExecutorRef();for(let b=0;b<F.length;b++){let E=F[b],A=typeof E.bindTo=="string"?E.bindTo:`source_${b}`;if(!qe){U.push({bindTo:A,skipped:!0,error:"No task executor configured"});continue}try{let Y={...E},te=t.invokeExecutorSync(qe,"probe-source-preflight",[],{timeout:E.timeout??1e4,input:JSON.stringify(Y)}),ke=JSON.parse(te.trim());U.push({bindTo:A,reachable:ke.reachable,latencyMs:ke.latencyMs,error:ke.ok?void 0:ke.error});}catch{U.push({bindTo:A,skipped:!0,error:"Executor does not support probe-source-preflight"});}}let it=y.compute,M={},V=[];if(it&&Array.isArray(it)&&it.length>0){let b={id:k,card_data:q,requires:C,source_defs:y.source_defs,compute:it},E=ot.runSync(b,{sourcesData:w});M=E.node.computed_values??{},V=E.errors??[];}let R=$.isValid&&re.length===0&&V.length===0&&U.every(b=>b.reachable!==!1);return Q({cardId:k,ok:R,validation:$,source_probes:U,projection_errors:re,computed_values:M,compute_errors:V})}catch(m){return ee(m)}}return {validateCard:i,validateCardPreflight:u,probeSource:c,probeTmpSource:l,probeSourcePreflight:d,evalCardCompute:p,simulateCardCycle:S,describeTaskExecutorCapabilities:v,updatesInCardStore:g,readFromCardStore:f}}function gg(e){function t(s){return {status:"success",data:s}}function r(s){return {status:"fail",error:s}}function n(s){return {status:"error",error:s instanceof Error?s.message:String(s)}}return {get(s){try{let o=s.params?.id;if(o){let a=e.readCard(o);return a?t({cards:[a]}):r(`card "${o}" not found`)}return t({cards:e.readAllCards()})}catch(o){return n(o)}},set(s){try{let o=s.body;if(o==null)return r("set requires a body (card object or array of cards)");let a=Array.isArray(o)?o:[o];for(let i of a){if(typeof i.id!="string")return r("each card must have a string `id` field");e.writeCard(i.id,i);}return t({count:a.length})}catch(o){return n(o)}},del(s){try{let o=s.body?.ids??[],a=s.params?.id,i=a?[...o,a]:o;if(i.length===0)return r("del requires body.ids (string[]) or params.id");for(let u of i)e.removeCard(u);return t({count:i.length})}catch(o){return n(o)}},patch(s){try{let o=s.params?.id,a=s.params?.path;if(!o)return r("patch requires params.id");if(!a)return r("patch requires params.path");let i=s.body,u=i&&Object.prototype.hasOwnProperty.call(i,"value")?i.value:s.body;return e.patchCard(o,a,u),t({count:1})}catch(o){return n(o)}}}}function yg(e){function t(s){return {status:"success",data:s}}function r(s){return {status:"fail",error:s}}function n(s){return {status:"error",error:s instanceof Error?s.message:String(s)}}return {list(s){try{let o=s.params?.prefix??"";return t({artifacts:e.list(o)})}catch(o){return n(o)}},head(s){try{let o=s.params?.key;return o?t({artifact:e.head(o)}):r("head requires params.key")}catch(o){return n(o)}},put(s){try{let o=s.params?.key,a=s.params?.contentType;if(!o)return r("put requires params.key");let i=s.body;if(typeof i=="string")return t({artifact:e.putText(o,i,a)});if(i&&typeof i=="object"&&typeof i.text=="string")return t({artifact:e.putText(o,i.text,a)});if(i&&typeof i=="object"&&Array.isArray(i.bytes)){let u=i.bytes,c=new Uint8Array(u.map(l=>Math.max(0,Math.min(255,Number(l)||0))));return t({artifact:e.putBytes(o,c,a)})}return r("put requires body as string, {text}, or {bytes:number[]}")}catch(o){return n(o)}},get(s){try{let o=s.params?.key,a=s.params?.as??"base64";if(!o)return r("get requires params.key");let i=e.head(o);if(!i)return r(`artifact "${o}" not found`);if(a==="text"){let c=e.getText(o);return c===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,text:c})}let u=e.getBytes(o);return u===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,bytes:[...u]})}catch(o){return n(o)}},del(s){try{let o=s.params?.key;return o?(e.remove(o),t({ok:!0})):r("del requires params.key")}catch(o){return n(o)}}}}var En=".artifacts-index.json";function yc(){return new Date().toISOString()}function vc(e){return new TextEncoder().encode(e).byteLength}function $r(e){let t=e.read(En);if(!t)return {entries:{}};try{let r=JSON.parse(t);if(r&&r.entries&&typeof r.entries=="object")return r}catch{}return {entries:{}}}function Oo(e,t){e.write(En,JSON.stringify(t,null,2));}function vg(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function bc(e,t,r){e.entries[t]={key:t,size:r.size,updatedAt:r.updatedAt,contentType:r.contentType};}function jo(e){let t=String(e||"").match(/^(\d+)[-_]/);return t?parseInt(t[1],10):0}function bg(e){let t=String(e||"").trim();if(!t)return "upload.bin";let r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return (r>=0?t.slice(r+1):t)||"upload.bin"}function Sg(e){return String(e||"").toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"")||"file"}function wg(e){if(!e||e===".")return "";let t=String(e).replace(/^\./,"").toLowerCase().replace(/[^a-z0-9]/g,"");return t?`.${t}`:""}function kg(e){let t=bg(e),r=t.lastIndexOf(".");return r<=0||r===t.length-1?{stem:t,ext:""}:{stem:t.slice(0,r),ext:t.slice(r)}}function _g(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Rg(e){function t(r){let n=e.stat?vg(e.stat(r)):null;if(n)return n;let o=$r(e).entries[r];if(o)return {...o};if(!e.exists(r))return null;let a=e.read(r);return a===null?{key:r}:{key:r,size:vc(a)}}return {exists(r){return e.exists(r)},putText(r,n,s="text/plain; charset=utf-8"){e.write(r,n);let o=t(r)??{key:r};o.contentType=s,o.updatedAt=o.updatedAt??yc(),o.size=o.size??vc(n);let a=$r(e);return bc(a,r,o),Oo(e,a),o},putBytes(r,n,s="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,n);else {let i=JSON.stringify({__kind:"bytes-array",data:[...n]});e.write(r,i);}let o=t(r)??{key:r};o.contentType=s,o.updatedAt=o.updatedAt??yc(),o.size=o.size??n.byteLength;let a=$r(e);return bc(a,r,o),Oo(e,a),o},getText(r){let n=e.read(r);if(n===null){if(!e.readBytes)return null;let s=e.readBytes(r);return s===null?null:Buffer.from(s).toString("utf-8")}try{let s=JSON.parse(n);if(s&&s.__kind==="bytes-array"&&Array.isArray(s.data))return new TextDecoder("utf-8").decode(new Uint8Array(s.data))}catch{}return n},getBytes(r){if(e.readBytes){let s=e.readBytes(r);if(s!==null)return s}let n=e.read(r);if(n===null)return null;try{let s=JSON.parse(n);if(s&&s.__kind==="bytes-array"&&Array.isArray(s.data))return new Uint8Array(s.data)}catch{}return new TextEncoder().encode(n)},head:t,list(r=""){let n=new Map;if(e.listKeys)for(let o of e.listKeys(r)){if(o===En)continue;let a=t(o)??{key:o};n.set(o,a);}let s=$r(e);for(let[o,a]of Object.entries(s.entries))o===En||r&&!o.startsWith(r)||n.has(o)||n.set(o,{...a});return [...n.values()].sort((o,a)=>o.key.localeCompare(a.key))},remove(r){e.remove(r);let n=$r(e);delete n.entries[r],Oo(e,n);}}}function Cg(e,t){let r=t?.indexFileName||".index.json";function n(d){return `${d}/${r}`}function s(d){let v=e.getText(n(d));if(!v)return [];try{let g=JSON.parse(v);return Array.isArray(g)?g.filter(f=>f&&typeof f.stored_name=="string").map(f=>({serial:Number(f.serial||jo(String(f.stored_name))||0),role:String(f.role||"system").toLowerCase(),stored_name:String(f.stored_name),path:typeof f.path=="string"?f.path:`${d}/chats/${String(f.stored_name)}`,updated_at:typeof f.updated_at=="string"?f.updated_at:null})):[]}catch{return []}}function o(d,v){e.putText(n(d),JSON.stringify(v,null,2),"application/json; charset=utf-8");}function a(d){let v=s(d),g=0;for(let f of v){let p=Number(f.serial||0);Number.isFinite(p)&&p>g&&(g=p);}return g+1}function i(d,v){let g=s(d);g.push(v),o(d,g);}function u(d){let v=s(d),g=[];for(let f of v){let p=`${d}/${f.stored_name}`,S=e.getText(p);S!==null&&g.push({serial:Number(f.serial||jo(f.stored_name)||0),role:String(f.role||"system").toLowerCase(),text:S,path:typeof f.path=="string"?f.path:`${d}/chats/${f.stored_name}`,stored_name:f.stored_name,updated_at:f.updated_at||null});}return g.sort((f,p)=>f.serial-p.serial||f.stored_name.localeCompare(p.stored_name)),g}function c(d){let v=`${d}/`;for(let g of e.list(v))e.remove(g.key);}function l(d){let v=`${d}/`,g=e.list(v),f=0,p=0,S=false;for(let h of g){let m=h.key.slice(v.length);if(m===".processing"){S=true;continue}if(!/^(\d+)[-_]([a-z0-9_-]+)\.txt$/i.test(m))continue;f+=1;let y=h.updatedAt?Number(new Date(h.updatedAt).getTime()||0):0;y>p&&(p=y);}return {count:f,latest_mtime_ms:p,processing:S}}return {indexKey:n,loadIndex:s,saveIndex:o,nextSerial:a,appendIndexRecord:i,readRecords:u,clear:c,readSignal:l}}function $g(e){function t(s,o){let a=0,i=[];Array.isArray(o)&&i.push(...o);for(let u of e.list(`${s}/`))i.push(_g(u.key));for(let u of i){let c=jo(u);Number.isFinite(c)&&c>a&&(a=c);}return a+1}function r(s,o,a){let i=Number(a?.maxLen||32),{stem:u,ext:c}=kg(s),l=wg(c),d=Sg(u),v=`${String(o).padStart(3,"0")}-`,g=l,f=i-v.length-g.length;f<1&&(g="",f=i-v.length);let p=d.slice(0,Math.max(1,f)),S=`${v}${p}${g}`;return S.length>i&&(S=S.slice(0,i).replace(/\.$/,"")),S}function n(s,o,a){let i=t(s,a?.seedNames),u=r(o,i,{maxLen:a?.maxLen});for(;e.exists(`${s}/${u}`);)i+=1,u=r(o,i,{maxLen:a?.maxLen});return u}return {nextSerial:t,buildStoredName:r,allocateStoredName:n}}function Eg(){function e(s,o){if(!Array.isArray(s))return [];let a=[];for(let i of s){if(!i||typeof i!="object")continue;let u=i;typeof u.stored_name=="string"&&a.push({name:typeof u.name=="string"?u.name:u.stored_name,stored_name:u.stored_name,size:typeof u.size=="number"&&Number.isFinite(u.size)?u.size:null,mime_type:typeof u.mime_type=="string"?u.mime_type:null,path:typeof u.path=="string"?u.path:null,uploaded_at:typeof u.uploaded_at=="string"?u.uploaded_at:o||null});}return a}function t(s){return !s||typeof s!="object"?[]:e(s.files,void 0)}function r(s,o){let a=t(s);if(o.length===0)return s.files=a,a;let i=new Set(a.map(u=>u.stored_name));for(let u of o)i.has(u.stored_name)||(a.push(u),i.add(u.stored_name));return s.files=a,a}function n(s,o,a){let i=t(s);if(!Number.isInteger(o)||o<0||o>=i.length)return {ok:false,reason:"index_out_of_range"};let u=i[o];return !u||!u.stored_name?{ok:false,reason:"missing_stored_name"}:a&&a!==u.stored_name?{ok:false,reason:"stale_reference"}:{ok:true,file:u}}return {read:t,normalizeIncoming:e,merge:r,resolve:n}}function bb(){return {async invoke(e,t){if(e.howToRun!=="local-node")return {dispatched:false,error:`createNodeSpawnInvocationAdapter: unsupported howToRun "${e.howToRun}"`};let r="";try{let o=e.whatToRun,a=typeof o=="string"?$e(o):o;a.kind==="fs-path"&&(r=a.value);}catch{r="";}if(!r)return {dispatched:false,error:"createNodeSpawnInvocationAdapter: could not resolve fs-path from whatToRun"};let n={...t};if(n.chatsKeyPrefix&&n.chatsBlobBasePath){let o=String(n.chatsKeyPrefix).split("/")[0];n.chatDir=lt(String(n.chatsBlobBasePath),o);}delete n.chatsKeyPrefix,delete n.chatsBlobBasePath;let s=Buffer.from(JSON.stringify(n)).toString("base64");try{return child_process.spawn(process.execPath,[r,"--boardId",String(t.boardId??""),"--cardId",String(t.cardId??""),"--extraEncJson",s],{stdio:"ignore",windowsHide:!0}).unref(),{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}},async describe(e){if(e.howToRun!=="local-node")return null;let t="";try{let r=e.whatToRun,n=typeof r=="string"?$e(r):r;n.kind==="fs-path"&&(t=n.value);}catch{t="";}if(!t)return null;try{let r=child_process.spawnSync(process.execPath,[t,"describe"],{timeout:5e3,encoding:"utf-8",windowsHide:!0});return r.status!==0?null:JSON.parse(String(r.stdout).trim())}catch{return null}}}}var Ag=".board.lock";function Ig(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Pg(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Sc(e){if(e)return e;let t=Jo((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),r=[t,lt(t,"..","cli","node"),lt(t,"..","..","cli","node")];for(let n of r)try{return jn(n),n}catch{}throw new Error(`createFsBoardPlatformAdapter: could not resolve a public CLI directory from module dir ${t}`)}function Og(e,t,r){let{cliDir:n,opts:s}=Ig(t,r),o=Sc(n),a=e.value,i=s?.suppressSpawn?"":jn(o),u={meta:"board-live-cards",howToRun:"local-node",whatToRun:i?oe({kind:"fs-path",value:i}):"",...s?.notifyChannel?{extra:{notifyChannel:s.notifyChannel}}:{}};return {kvStorage:c=>Ln(lt(a,`.${c}`)),blobStorage:c=>c?jr(lt(a,c)):jr(a),journalAdapter:()=>na(a),lock:sa(lt(a,Ag)),selfRef:u,async dispatchExecution(c,l){if(s?.suppressSpawn)return {dispatched:false};try{let d=l.source_def?.bindTo??In().slice(0,8),v=Kt(a,`exec-in-${d}`),g=Kt(a,`exec-out-${d}`),f=Kt(a,`exec-err-${d}`,".txt"),p=oe({kind:"fs-path",value:v}),S=oe({kind:"fs-path",value:g}),h=oe({kind:"fs-path",value:f});return ta({kind:"fs-path",value:v}).write(v,JSON.stringify(l,null,2)),ea(c,{subcommand:"run-source-fetch",inRef:p,outRef:S,errRef:h},o),{dispatched:!0}}catch(d){return {dispatched:false,error:d instanceof Error?d.message:String(d)}}},resolveBlob(c){let l=Ko(c.value)?Mn().read(c.value):jr(a).read(c.value);if(l===null)throw new Error(`resolveBlob: blob not found: ::${c.kind}::${c.value}`);return l},hashFn:ra,genId:()=>Uo(`${Date.now()}-${Math.random()}`).slice(0,32),kvStorageForRef:c=>Ln($e(c).value),requestProcessAccumulated(){s?.suppressSpawn||Wo(o,e,s?.notifyChannel);},publishBoardChangeNotifications(c){if(!s?.notifyChannel||c.length===0)return;let l=c.map(d=>({id:In(),ts:new Date().toISOString(),boardRef:oe(e),notification:d}));Yo(s.notifyChannel,l,s.onWarn);},onWarn:s?.onWarn}}function Sb(e,t,r){let{cliDir:n,opts:s}=Pg(t,r),o=Sc(n),a=Og(e,o,s),i=Or();return {...a,invokeExecutorSync(u,c,l,d){let{command:v,baseArgs:g}=qn(u,o);return i.executeSync(v,[...g,c,...l],{timeout:d?.timeout??3e4,encoding:"utf-8",input:d?.input})},validateSchema(u){let c=Eo(u);return {ok:c.errors.length===0,errors:c.errors}},makeTempFilePath(u,c){return Kt(e.value,u,c)},absoluteBlob:Mn()}}function wb(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString());return typeof t.br=="string"?t.br:null}catch{return null}}
|
|
13
|
-
exports.BOARD_GRAPH_KEY=
|
|
12
|
+
`,"utf-8");},generateId(){return crypto.randomUUID()}}}function ma(e){return {tryAcquire(){try{if(!P__namespace.existsSync(e)){P__namespace.mkdirSync(ue__namespace.dirname(e),{recursive:!0});try{P__namespace.writeFileSync(e,"{}",{flag:"wx"});}catch{}}return properLockfile.lockSync(e,{retries:0})}catch{return null}}}}var ha={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://nsreehari.github.io/boards/live-cards.schema.json",definitions:{bind_ref:{description:"A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",type:"string",pattern:"^(card_data|requires|fetched_sources|computed_values)(\\.|$)"},bind_or_literal:{description:"A literal value or a bind reference object",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref"}},required:["bind"]}]},compute_expr:{description:"A declarative JSON compute expression",type:"object",required:["fn"],properties:{fn:{type:"string",description:"Function name from the built-in vocabulary",enum:["sum","avg","min","max","count","first","last","add","sub","mul","div","round","abs","mod","gt","gte","lt","lte","eq","neq","if","and","or","not","concat","upper","lower","template","filter","pluck","map","sort","slice","flat","unique","group","get","default","now","diff_days","format_date"]},input:{description:"card_data.path, literal, array of inputs, or nested compute_expr",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/definitions/compute_expr"}]},field:{type:"string",description:"For pluck/sum/group \u2014 the object key to extract"},where:{$ref:"#/definitions/compute_expr",description:"For filter \u2014 predicate expression ($ = current item)"},cond:{$ref:"#/definitions/compute_expr",description:"For if \u2014 condition expression"},then:{description:"For if \u2014 value when cond is truthy"},else:{description:"For if \u2014 value when cond is falsy"},format:{type:"string",description:"For format_date \u2014 date format string"}}},meta:{type:"object",properties:{title:{type:"string"},tags:{type:"array",items:{type:"string"}}}},requires:{type:"array",items:{type:"string"},description:"IDs of upstream nodes this node depends on"},provides:{type:"array",items:{type:"object",required:["bindTo","ref"],properties:{bindTo:{type:"string",description:"Token name published downstream"},ref:{type:"string",description:"Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)"}}},description:"Explicit bindings exposing computed or card_data values downstream as named tokens"},compute_step:{description:"A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",type:"object",required:["bindTo","expr"],properties:{bindTo:{type:"string",description:"Key in computed_values to write result"},expr:{type:"string",description:"JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }"}}},source_def:{description:"One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all source_defs in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",type:"object",required:["bindTo","outputFile"],additionalProperties:true,properties:{bindTo:{type:"string",description:"Key under fetched_sources.* available in compute expressions"},outputFile:{type:"string",description:"Board-relative path the executor writes its JSON result to. Presence of this file signals delivery."},projections:{type:"object",description:"Named data projections from card_data or requires, evaluated before the executor is called. Each key is a ref name; each value is a JSONata expression rooted at card_data or requires. The resolved values are passed to the executor as _projections. fetched_sources, computed_values, and source_defs are not accessible here \u2014 sources run before those exist.",additionalProperties:{type:"string"}},optionalForCompletionGating:{type:"boolean",default:false,description:"When true this source does not gate card completion. Default false when absent, so source_defs are completion-gating by default."},timeout:{type:"integer",minimum:0,default:12e4,description:"Executor/script timeout in ms. Default: 120 000 (2 min)."},script:{type:"string",description:"Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result."}}},render_element:{type:"object",required:["kind"],properties:{id:{type:"string",description:"Optional element ID for targeted updates"},kind:{enum:["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]},label:{type:"string",description:"Heading above this element"},className:{type:"string",description:"Bootstrap grid class, e.g. 'col-12 col-md-6'"},visible:{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy"},data:{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref",description:"card_data/requires/fetched_sources/computed_values path to read data from"},writeTo:{$ref:"#/definitions/bind_ref",description:"card_data path for user input (form, filter, todo, notes)"},columns:{type:"array",items:{type:"string"},description:"table: visible columns"},maxRows:{type:"integer",description:"table/list: max rows to display"},sortable:{type:"boolean",default:true,description:"table: enable click-to-sort"},placeholder:{type:"string",description:"Empty-state message"},chartType:{enum:["bar","line","pie","doughnut"]},chartOptions:{type:"object",description:"Chart.js options passthrough"},fields:{type:"object",description:"JSON Schema for form/filter fields"},thresholds:{type:"object",properties:{green:{type:"string"},amber:{type:"string"}}},colorMap:{type:"object",description:"badge: value \u2192 Bootstrap color"},style:{enum:["heading","muted","default"],description:"text: display style"},upload:{type:"boolean",default:true,description:"file-upload: show drop zone (false = read-only file list)"},accept:{type:"array",items:{type:"string"},description:"file-upload: allowed extensions"},multiple:{type:"boolean",default:true,description:"file-upload: allow multiple files"},fileAttach:{type:"boolean",default:false,description:"chat: enable inline file attachments"},fileAccept:{type:"array",items:{type:"string"},description:"chat: allowed attachment extensions"},buttons:{type:"array",description:"actions: button definitions",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},style:{type:"string",description:"Bootstrap button variant, e.g. 'success', 'outline-danger'"},size:{type:"string",default:"sm"},disabled:{oneOf:[{type:"boolean"},{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled"}]}}}}}}}},view:{type:"object",required:["elements"],properties:{elements:{type:"array",minItems:1,items:{$ref:"#/definitions/render_element"}},layout:{type:"object",properties:{board:{type:"object",properties:{col:{type:"integer",minimum:1,maximum:12},order:{type:"integer"}}},canvas:{type:"object",properties:{x:{type:"number"},y:{type:"number"},w:{type:"number"},h:{type:"number"}}}}},features:{type:"object",properties:{chat:{type:"boolean",default:false},notes:{type:"boolean",default:false},refresh:{type:"boolean",default:true}}}}}},title:"LiveCard",description:"A unified card node. Behavior depends on which sections are present (source_defs, compute, view, etc.)",type:"object",required:["id"],additionalProperties:false,properties:{id:{type:"string"},requires:{$ref:"#/definitions/requires"},provides:{$ref:"#/definitions/provides"},meta:{$ref:"#/definitions/meta"},view:{$ref:"#/definitions/view"},card_data:{type:"object",description:"Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",properties:{files:{type:"array",description:"Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",items:{type:"object",required:["name","stored_name"],properties:{name:{type:"string",minLength:1},stored_name:{type:"string",minLength:5,maxLength:32,pattern:"^[0-9]{3,}-[a-z0-9._-]+$"},size:{oneOf:[{type:"integer",minimum:0},{type:"null"}]},mime_type:{type:"string"},path:{type:"string",pattern:"^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$"},uploaded_at:{type:"string",format:"date-time"}},additionalProperties:false}}},additionalProperties:true},source_defs:{type:"array",description:"Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only source_defs that should not block task-completed.",items:{$ref:"#/definitions/source_def"}},compute:{type:"array",description:"Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",items:{$ref:"#/definitions/compute_step"}}}};var Uu=Lc(Bu());var Kh=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),Uh=Kh("./jsonata-sync.cjs"),vn=null;var Gu=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,Jh=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function Hh(e){let t=new Set,r;for(Gu.lastIndex=0;(r=Gu.exec(e))!==null;)t.add(r[1]);return t}function Ju(e){let t=Jh.exec(e);return t?t[1]:null}function Ku(e,t,r,n){try{Uh(e);}catch(o){let a=o instanceof Error?o.message:String(o);n.push(`${t}: invalid JSONata expression (${a})`);return}let s=Hh(e);for(let o of s)r.has(o)||n.push(`${t}: disallowed namespace "${o}" in expression`);}function Ao(e,t,r){if(Array.isArray(e)){e.forEach((s,o)=>{Ao(s,`${t}/${o}`,r);});return}if(typeof e=="string"){let s=Ju(e);if(!s)return;new Set(["card_data","requires","computed_values"]).has(s)||r.push(`${t}: disallowed namespace "${s}" in view reference`);return}if(!e||typeof e!="object")return;let n=e;for(let[s,o]of Object.entries(n))Ao(o,`${t}/${s}`,r);}function zh(){if(vn)return vn;let e=new Uu.default({allErrors:true});return Bh__default.default(e),vn=e.compile(ha),vn}function Hu(e){let t=zh(),r=t(e),n=(t.errors??[]).map(s=>`${s.instancePath||"/"}: ${s.message??"unknown error"}`);if(e&&typeof e=="object"&&!Array.isArray(e)){let s=e.source_defs;if(Array.isArray(s)){let o=new Set,a=new Set;s.forEach((i,u)=>{if(!i||typeof i!="object"||Array.isArray(i))return;let c=i;typeof c.bindTo=="string"&&c.bindTo&&(o.has(c.bindTo)&&n.push(`/source_defs/${u}/bindTo: bindTo "${c.bindTo}" must be unique across all source_defs`),o.add(c.bindTo)),typeof c.outputFile=="string"&&c.outputFile&&(a.has(c.outputFile)&&n.push(`/source_defs/${u}/outputFile: outputFile "${c.outputFile}" must be unique across all source_defs`),a.add(c.outputFile));});}}return !r||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function zu(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:true,errors:[]};let r=e,n=r.compute;Array.isArray(n)&&n.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.expr;typeof d!="string"||d.trim().length===0||Ku(d,`/compute/${l}/expr`,new Set(["card_data","requires","fetched_sources","computed_values"]),t);});let s=new Set(["card_data","requires","fetched_sources","computed_values"]),o=r.provides;Array.isArray(o)&&o.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.ref;if(typeof d!="string"||d.trim().length===0)return;let y=Ju(d);y===null?t.push(`/provides/${l}/ref: path "${d}" must start with a valid namespace (${[...s].join(", ")})`):s.has(y)||t.push(`/provides/${l}/ref: disallowed namespace "${y}" in path "${d}" (valid: ${[...s].join(", ")})`);});let a=r.view;a&&typeof a=="object"&&!Array.isArray(a)&&Ao(a,"/view",t);let i=new Set(["card_data","requires"]),u=r.source_defs;return Array.isArray(u)&&u.forEach((c,l)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let d=c.projections;if(!(!d||typeof d!="object"||Array.isArray(d)))for(let[y,g]of Object.entries(d))typeof g!="string"||g.trim().length===0||Ku(g,`/source_defs/${l}/projections/${y}`,i,t);}),{ok:t.length===0,errors:t}}function Io(e){let t=Hu(e);if(!t.ok)return t;let r=zu(e);return r.ok?{ok:true,errors:[]}:{ok:false,errors:r.errors}}var ot={RUNNING:"running",COMPLETED:"completed",FAILED:"failed",INACTIVATED:"inactivated"};function $e(e){return e?Array.isArray(e.provides)?e.provides:[]:[]}function at(e){return e?Array.isArray(e.requires)?e.requires:[]:[]}function Wu(e){return e.tasks??{}}function Po(e){return e?e.status===ot.FAILED||e.status===ot.INACTIVATED:false}function Yu(e,t){return e.refreshStrategy??t?.refreshStrategy??"data-changed"}function Xu(e){return e.maxExecutions}function Qu(e,t){let r=new Set;for(let[n,s]of Object.entries(t))if(s.status===ot.COMPLETED){let o=e.tasks[n];o&&$e(o).forEach(i=>r.add(i));}return Array.from(r)}function Zu(e,t){let r={};return e.forEach(n=>{let s=t[n];if(!s)return;$e(s).forEach(a=>{r[a]||(r[a]=[]),r[a].push(n);});}),r}function ec(e,t,r){let n=e.tasks[t]??kn(),s={};if(r){let a=r.tasks[t],i=at(a);for(let u of i)for(let[c,l]of Object.entries(r.tasks))if($e(l).includes(u)){let d=e.tasks[c];d?.lastDataHash&&(s[u]=d.lastDataHash);break}}let o={...n,status:"running",startedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),progress:0,error:void 0,startConsumedHashes:s};return {...e,tasks:{...e.tasks,[t]:o},lastUpdated:new Date().toISOString()}}function tc(e,t,r,n,s,o){let a=e.tasks[r]??kn(),i=t.tasks[r];if(!i)throw new Error(`Task "${r}" not found in graph`);let u;n&&i.on&&i.on[n]?u=i.on[n]:u=$e(i);let c=a.startConsumedHashes?{...a.startConsumedHashes}:{...a.lastConsumedHashes};if(!a.startConsumedHashes){let y=i.requires??[];for(let g of y)for(let[f,p]of Object.entries(t.tasks))if($e(p).includes(g)){let b=e.tasks[f];b?.lastDataHash&&(c[g]=b.lastDataHash);break}}let l={...a,status:"completed",completedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),executionCount:a.executionCount+1,lastEpoch:a.executionCount+1,lastDataHash:s,data:o,lastConsumedHashes:c,error:void 0},d=[...new Set([...e.availableOutputs,...u])];return {...e,tasks:{...e.tasks,[r]:l},availableOutputs:d,lastUpdated:new Date().toISOString()}}function rc(e,t,r,n){let s=e.tasks[r]??kn(),o=t.tasks[r];if(o?.retry){let u=s.retryCount+1;if(u<=o.retry.max_attempts){let c={...s,status:"not-started",retryCount:u,lastUpdated:new Date().toISOString(),error:n};return {...e,tasks:{...e.tasks,[r]:c},lastUpdated:new Date().toISOString()}}}let a={...s,status:"failed",failedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),error:n,executionCount:s.executionCount+1},i=e.availableOutputs;if(o?.on_failure&&o.on_failure.length>0&&(i=[...new Set([...e.availableOutputs,...o.on_failure])]),o?.circuit_breaker&&a.executionCount>=o.circuit_breaker.max_executions){let u=o.circuit_breaker.on_break;i=[...new Set([...i,...u])];}return {...e,tasks:{...e.tasks,[r]:a},availableOutputs:i,lastUpdated:new Date().toISOString()}}function nc(e,t,r,n){let s=e.tasks[t]??kn(),o={...s,progress:typeof n=="number"?n:s.progress,messages:[...s.messages??[],...r?[{message:r,timestamp:new Date().toISOString(),status:s.status}]:[]],lastUpdated:new Date().toISOString()};return {...e,tasks:{...e.tasks,[t]:o},lastUpdated:new Date().toISOString()}}function sc(e,t){let r=e.tasks[t];if(!r)return e;let n={...r,status:"not-started",startedAt:void 0,completedAt:void 0,failedAt:void 0,error:void 0,data:void 0,progress:null,lastUpdated:new Date().toISOString()};return {...e,tasks:{...e.tasks,[t]:n},lastUpdated:new Date().toISOString()}}function kn(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function bn(e,t){let r=`live-${Date.now()}`,n={};for(let o of Object.keys(e.tasks))n[o]=ac();let s={status:"running",tasks:n,availableOutputs:[],stuckDetection:{is_stuck:false,stuck_description:null,outputs_unresolvable:[],tasks_blocked:[]},lastUpdated:new Date().toISOString(),executionId:r,executionConfig:{executionMode:e.settings.execution_mode??"eligibility-mode",conflictStrategy:e.settings.conflict_strategy??"alphabetical",completionStrategy:e.settings.completion}};return {config:e,state:s}}function Wh(e,t){let{config:r,state:n}=e;if("executionId"in t&&t.executionId&&t.executionId!==n.executionId)return e;switch(t.type){case "task-started":return {config:r,state:ec(n,t.taskName,r)};case "task-completed":return {config:r,state:tc(n,r,t.taskName,t.result,t.dataHash,t.data)};case "task-failed":return {config:r,state:rc(n,r,t.taskName,t.error)};case "task-progress":return {config:r,state:nc(n,t.taskName,t.message,t.progress)};case "task-restart":return {config:r,state:sc(n,t.taskName)};case "inject-tokens":return {config:r,state:{...n,availableOutputs:[...new Set([...n.availableOutputs,...t.tokens])],lastUpdated:new Date().toISOString()}};case "agent-action":return {config:r,state:rg(n,t.action)};case "task-upsert":return Yh(e,t.taskName,t.taskConfig);case "task-removal":return Xh(e,t.taskName);case "node-requires-add":return Qh(e,t.nodeName,t.tokens);case "node-requires-remove":return Zh(e,t.nodeName,t.tokens);case "node-provides-add":return eg(e,t.nodeName,t.tokens);case "node-provides-remove":return tg(e,t.nodeName,t.tokens);default:return e}}function oc(e,t){return t.reduce((r,n)=>Wh(r,n),e)}function Yh(e,t,r){let n=!!e.config.tasks[t];return {config:{...e.config,tasks:{...e.config.tasks,[t]:r}},state:{...e.state,tasks:{...e.state.tasks,[t]:n?e.state.tasks[t]:ac()},lastUpdated:new Date().toISOString()}}}function Xh(e,t){if(!e.config.tasks[t])return e;let{[t]:r,...n}=e.config.tasks,{[t]:s,...o}=e.state.tasks;return {config:{...e.config,tasks:n},state:{...e.state,tasks:o,lastUpdated:new Date().toISOString()}}}function Qh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=at(n),o=r.filter(a=>!s.includes(a));return o.length===0?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,requires:[...s,...o]}}},state:e.state}}function Zh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=at(n),o=s.filter(a=>!r.includes(a));return o.length===s.length?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,requires:o}}},state:e.state}}function eg(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=$e(n),o=r.filter(a=>!s.includes(a));return o.length===0?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,provides:[...s,...o]}}},state:e.state}}function tg(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=$e(n),o=s.filter(a=>!r.includes(a));return o.length===s.length?e:{config:{...e.config,tasks:{...e.config.tasks,[t]:{...n,provides:o}}},state:e.state}}function Rr(e){return {version:1,config:e.config,state:e.state,snapshotAt:new Date().toISOString()}}function Sn(e){if(!e||typeof e!="object")throw new Error("Invalid snapshot: expected an object");let t=e;if(!t.config||typeof t.config!="object")throw new Error('Invalid snapshot: missing or invalid "config"');if(!t.state||typeof t.state!="object")throw new Error('Invalid snapshot: missing or invalid "state"');let r=t.config,n=t.state;if(!r.settings||typeof r.settings!="object")throw new Error("Invalid snapshot: config.settings missing");if(!r.tasks||typeof r.tasks!="object")throw new Error("Invalid snapshot: config.tasks missing");if(!n.tasks||typeof n.tasks!="object")throw new Error("Invalid snapshot: state.tasks missing");if(!Array.isArray(n.availableOutputs))throw new Error("Invalid snapshot: state.availableOutputs must be an array");return {config:r,state:n}}function ac(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function rg(e,t){let r=new Date().toISOString();switch(t){case "stop":return {...e,status:"stopped",lastUpdated:r};case "pause":return {...e,status:"paused",lastUpdated:r};case "resume":return {...e,status:"running",lastUpdated:r};default:return e}}function $r(e){let{config:t,state:r}=e,n=Wu(t);if(Object.keys(n).length===0)return {eligible:[],pending:[],unresolved:[],blocked:[],conflicts:{}};let o=ng(n),a=Qu(t,r.tasks),i=new Set([...a,...r.availableOutputs]),u=[],c=[],l=[],d=[];for(let[g,f]of Object.entries(n)){let p=r.tasks[g],b=Yu(f,t.settings),h=b!=="once";if(p?.status===ot.RUNNING||Po(p))continue;let m=Xu(f);if(m!==void 0&&p&&p.executionCount>=m||f.circuit_breaker&&p&&p.executionCount>=f.circuit_breaker.max_executions||!h&&p?.status===ot.COMPLETED)continue;if(h&&p?.status===ot.COMPLETED){let _=at(f),C=false;switch(b){case "data-changed":{_.length>0&&_.some(q=>{for(let[F,re]of Object.entries(n))if($e(re).includes(q)){let U=r.tasks[F];if(!U)continue;let ce=p.lastConsumedHashes?.[q];return U.lastDataHash==null?U.executionCount>p.lastEpoch:U.lastDataHash!==ce}return false})||(C=true);break}case "epoch-changed":{_.length>0&&_.some(q=>{for(let[F,re]of Object.entries(n))if($e(re).includes(q)){let U=r.tasks[F];if(U&&U.executionCount>p.lastEpoch)return true}return false})||(C=true);break}case "time-based":{let N=f.refreshInterval??0;if(N<=0){C=true;break}let q=p.completedAt;if(!q){C=true;break}(Date.now()-Date.parse(q))/1e3<N&&(C=true);break}case "manual":C=true;break}if(C)continue}let v=at(f);if(v.length===0){u.push(g);continue}let w=[],S=[],$=[];for(let _ of v){if(i.has(_))continue;let C=o[_]||[];C.length===0?w.push(_):C.every(q=>Po(r.tasks[q]))?$.push({token:_,failedProducer:C[0]}):S.push(_);}w.length>0?l.push({taskName:g,missingTokens:w}):$.length>0?d.push({taskName:g,failedTokens:$.map(_=>_.token),failedProducers:[...new Set($.map(_=>_.failedProducer))]}):S.length>0?c.push({taskName:g,waitingOn:S}):u.push(g);}let y={};if(u.length>1){let g=Zu(u,n);for(let[f,p]of Object.entries(g))p.length>1&&(y[f]=p);}return {eligible:u,pending:c,unresolved:l,blocked:d,conflicts:y}}function ng(e){let t={};for(let[r,n]of Object.entries(e)){for(let s of $e(n))t[s]||(t[s]=[]),t[s].push(r);if(n.on)for(let s of Object.values(n.on))for(let o of s)t[o]||(t[o]=[]),t[o].includes(r)||t[o].push(r);if(n.on_failure)for(let s of n.on_failure)t[s]||(t[s]=[]),t[s].includes(r)||t[s].push(r);}return t}var Cr=class{buffer=[];append(t){this.buffer.push(t);}drain(){let t=this.buffer;return this.buffer=[],t}get size(){return this.buffer.length}};function Oo(e){let t=jo(e);return sg(t)}function jo(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(jo).join(",")+"]";let t=e;return "{"+Object.keys(t).sort().map(n=>JSON.stringify(n)+":"+jo(t[n])).join(",")+"}"}function sg(e){let t=0xcbf29ce484222325n,r=0x100000001b3n,n=0xffffffffffffffffn;for(let s=0;s<e.length;s++)t^=BigInt(e.charCodeAt(s)),t=t*r&n;return t.toString(16).padStart(16,"0")}function og(e){if(typeof Buffer<"u")return Buffer.from(e,"utf8").toString("base64url");if(typeof btoa=="function"){let t=new TextEncoder().encode(e),r="";for(let n of t)r+=String.fromCharCode(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}throw new Error("No base64 encoder available in this runtime")}function ag(e){if(typeof Buffer<"u")return Buffer.from(e,"base64url").toString("utf8");if(typeof atob=="function"){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),n=atob(r),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function ic(e){let t=JSON.stringify({t:e,n:Date.now().toString(36)+Math.random().toString(36).slice(2,6)});return og(t)}function ig(e){try{let t=JSON.parse(ag(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function uc(e,t,r){let{handlers:n,onDrain:s}=t,o=new Cr,a="state"in e&&"config"in e?e:bn(e),i=false,u=new Set,c=new Map(Object.entries(n)),l=new Cr,d=false,y=false;function g(){if(!i){if(d){y=true;return}d=true;try{do y=!1,f();while(y)}finally{d=false;}}}function f(){let m=l.drain(),v=o.drain(),w=[...m,...v];w.length>0&&(a=oc(a,w));let S=$r(a);w.length>0&&s?.(w,a,S);for(let $ of S.eligible)h($);for(let $ of w)if($.type==="task-progress"){let{taskName:_,update:C}=$;if(!a.config.tasks[_])continue;let q=a.state.tasks[_];if(!q||q.status!=="running")continue;let F=ic(_),re=b(_,F,C).catch(U=>{i||(l.append({type:"task-failed",taskName:_,error:U.message??String(U),timestamp:new Date().toISOString()}),g());}).finally(()=>{u.delete(re);});u.add(re);}}function p(m){let w=a.config.tasks[m].requires??[],S=new Map;for(let[_,C]of Object.entries(a.config.tasks))for(let N of C.provides??[])S.set(N,_);let $={};for(let _ of w){let C=S.get(_);C?$[_]=a.state.tasks[C]?.data:$[_]=void 0;}return $}async function b(m,v,w){let S=a.config.tasks[m],$=S.taskHandlers??[],_=p(m);for(let C of $){let N=c.get(C);if(!N)throw new Error(`Handler '${C}' not found in registry (task '${m}')`);let q={nodeId:m,state:_,taskState:a.state.tasks[m],config:S,callbackToken:v,update:w};if(await N(q)==="task-initiate-failure")throw new Error(`Handler '${C}' returned task-initiate-failure (task '${m}')`)}}function h(m){let w=a.config.tasks[m]?.taskHandlers;if(!w||w.length===0)return;l.append({type:"task-started",taskName:m,timestamp:new Date().toISOString()}),g();let S=ic(m),$=b(m,S).catch(_=>{i||(l.append({type:"task-failed",taskName:m,error:_.message??String(_),timestamp:new Date().toISOString()}),g());}).finally(()=>{u.delete($);});u.add($);}return {push(m){i||(m.type==="task-completed"&&m.data&&!m.dataHash&&(m={...m,dataHash:Oo(m.data)}),o.append(m),g());},pushAll(m){if(!i){for(let v of m)v.type==="task-completed"&&v.data&&!v.dataHash?o.append({...v,dataHash:Oo(v.data)}):o.append(v);g();}},resolveCallback(m,v,w){if(i)return;let S=ig(m);if(!S)return;let{taskName:$}=S;if(a.config.tasks[$]){if(w&&w.length>0)o.append({type:"task-failed",taskName:$,error:w.join("; "),timestamp:new Date().toISOString()});else {let _=v&&Object.keys(v).length>0?Oo(v):void 0;o.append({type:"task-completed",taskName:$,data:v,dataHash:_,timestamp:new Date().toISOString()});}g();}},addNode(m,v){i||(o.append({type:"task-upsert",taskName:m,taskConfig:v,timestamp:new Date().toISOString()}),g());},removeNode(m){i||(o.append({type:"task-removal",taskName:m,timestamp:new Date().toISOString()}),g());},addRequires(m,v){i||(o.append({type:"node-requires-add",nodeName:m,tokens:v,timestamp:new Date().toISOString()}),g());},removeRequires(m,v){i||(o.append({type:"node-requires-remove",nodeName:m,tokens:v,timestamp:new Date().toISOString()}),g());},addProvides(m,v){i||(o.append({type:"node-provides-add",nodeName:m,tokens:v,timestamp:new Date().toISOString()}),g());},removeProvides(m,v){i||(o.append({type:"node-provides-remove",nodeName:m,tokens:v,timestamp:new Date().toISOString()}),g());},registerHandler(m,v){c.set(m,v);},unregisterHandler(m){c.delete(m);},retrigger(m){i||a.config.tasks[m]&&(o.append({type:"task-restart",taskName:m,timestamp:new Date().toISOString()}),g());},retriggerAll(m){if(!i){for(let v of m)a.config.tasks[v]&&o.append({type:"task-restart",taskName:v,timestamp:new Date().toISOString()});g();}},snapshot(){return Rr(a)},getState(){return a},getSchedule(){return $r(a)},async waitForHandlers(){u.size>0&&await Promise.allSettled([...u]);},async dispose(m){m?.wait&&u.size>0&&await Promise.allSettled([...u]),i=true;}}}var cg=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),wn=cg("./jsonata-sync.cjs"),lc=wn;function cc(e,t){if(!t||!e)return;let r=t.split("."),n=e;for(let s=0;s<r.length;s++){if(n==null)return;n=n[r[s]];}return n}function fc(e,t,r){let n=t.split("."),s=e;for(let o=0;o<n.length-1;o++)(s[n[o]]==null||typeof s[n[o]]!="object")&&(s[n[o]]={}),s=s[n[o]];s[n[n.length-1]]=r;}async function dg(e,t){if(!e?.compute?.length)return e;e.card_data||(e.card_data={}),e.computed_values={},e._sourcesData=t?.sourcesData??{};let r=e.requires??{},n={card_data:e.card_data,requires:r,expects_data:r,fetched_sources:e._sourcesData,data:e.computed_values,computed_values:e.computed_values};for(let s of e.compute)try{let o=await wn(s.expr).evaluate(n);fc(e.computed_values,s.bindTo,o),n.computed_values=e.computed_values;}catch{}return e}function lg(e,t){if(!e?.compute?.length)return {ok:true,node:e};e.card_data||(e.card_data={}),e.computed_values={},e._sourcesData=t?.sourcesData??{};let r=e.requires??{},n={card_data:e.card_data,requires:r,expects_data:r,fetched_sources:e._sourcesData,data:e.computed_values,computed_values:e.computed_values},s=[];for(let o of e.compute)try{let a=lc(o.expr).evaluate(n);fc(e.computed_values,o.bindTo,a),n.computed_values=e.computed_values;}catch(a){let i=a instanceof Error?a.message:String(a);s.push({bindTo:o.bindTo,error:i});}return s.length>0?{ok:true,node:e,errors:s}:{ok:true,node:e}}async function fg(e,t,r){let n={...r??{},card_data:t.card_data??{},requires:t.requires??{},fetched_sources:t._sourcesData??{},computed_values:t.computed_values??{}};return wn(e).evaluate(n)}function pg(e,t){return t.startsWith("fetched_sources.")?cc(e._sourcesData??{},t.slice(16)):cc(e,t)}var dc=new Set(["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]),mg=new Set(["id","meta","requires","provides","view","card_data","compute","source_defs"]);function hg(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:false,errors:["Node must be a non-null object"]};let r=e;(typeof r.id!="string"||!r.id)&&t.push("id: required, must be a non-empty string");for(let n of Object.keys(r))mg.has(n)||t.push(`Unknown top-level key: "${n}"`);if((r.card_data==null||typeof r.card_data!="object"||Array.isArray(r.card_data))&&t.push("card_data: required, must be an object"),r.meta!=null)if(typeof r.meta!="object"||Array.isArray(r.meta))t.push("meta: must be an object");else {let n=r.meta;n.title!=null&&typeof n.title!="string"&&t.push("meta.title: must be a string"),n.tags!=null&&!Array.isArray(n.tags)&&t.push("meta.tags: must be an array");}if(r.requires!=null&&!Array.isArray(r.requires)&&t.push("requires: must be an array of strings"),r.provides!=null&&(Array.isArray(r.provides)?r.provides.forEach((n,s)=>{if(!n||typeof n!="object"||Array.isArray(n))t.push(`provides[${s}]: must be an object with bindTo and ref`);else {let o=n;(typeof o.bindTo!="string"||!o.bindTo)&&t.push(`provides[${s}]: missing required "bindTo" string`),(typeof o.ref!="string"||!o.ref)&&t.push(`provides[${s}]: missing required "ref" string`);}}):t.push("provides: must be an array of { bindTo, ref } bindings")),r.compute!=null&&(Array.isArray(r.compute)?r.compute.forEach((n,s)=>{if(!n||typeof n!="object"||Array.isArray(n))t.push(`compute[${s}]: must be a compute step object`);else {let o=n;(typeof o.bindTo!="string"||!o.bindTo)&&t.push(`compute[${s}]: missing required "bindTo" property`),(typeof o.expr!="string"||!o.expr)&&t.push(`compute[${s}]: missing required "expr" string (JSONata expression)`);}}):t.push("compute: must be an array of compute steps")),r.source_defs!=null)if(!Array.isArray(r.source_defs))t.push("source_defs: must be an array");else {let n=new Set,s=new Set;r.source_defs.forEach((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))t.push(`source_defs[${a}]: must be an object`);else {let i=o;typeof i.bindTo!="string"||!i.bindTo?t.push(`source_defs[${a}]: missing required "bindTo" property`):(n.has(i.bindTo)&&t.push(`source_defs[${a}]: bindTo "${i.bindTo}" is not unique across source_defs`),n.add(i.bindTo)),typeof i.outputFile!="string"||!i.outputFile?t.push(`source_defs[${a}]: missing required "outputFile" property`):(s.has(i.outputFile)&&t.push(`source_defs[${a}]: outputFile "${i.outputFile}" is not unique across source_defs`),s.add(i.outputFile)),i.optionalForCompletionGating!=null&&typeof i.optionalForCompletionGating!="boolean"&&t.push(`source_defs[${a}]: optionalForCompletionGating must be a boolean`);}});}if(r.view!=null)if(typeof r.view!="object"||Array.isArray(r.view))t.push("view: must be an object");else {let n=r.view;!Array.isArray(n.elements)||n.elements.length===0?t.push("view.elements: required, must be a non-empty array"):n.elements.forEach((s,o)=>{if(!s||typeof s!="object"){t.push(`view.elements[${o}]: must be an object`);return}!s.kind||typeof s.kind!="string"?t.push(`view.elements[${o}].kind: required, must be a string`):dc.has(s.kind)||t.push(`view.elements[${o}].kind: unknown kind "${s.kind}". Valid: ${[...dc].join(", ")}`),s.data!=null&&(typeof s.data!="object"||Array.isArray(s.data))&&t.push(`view.elements[${o}].data: must be an object`);}),n.layout!=null&&(typeof n.layout!="object"||Array.isArray(n.layout))&&t.push("view.layout: must be an object"),n.features!=null&&(typeof n.features!="object"||Array.isArray(n.features))&&t.push("view.features: must be an object");}return {ok:t.length===0,errors:t}}async function gg(e,t){if(!e||e.length===0)return [];let r={card_data:t.card_data??{},requires:t.requires??{}};return Promise.all(e.map(async n=>{let s={};if(n.projections&&typeof n.projections=="object"&&!Array.isArray(n.projections)){for(let[o,a]of Object.entries(n.projections))if(typeof a=="string"&&a.trim().length>0)try{s[o]=await wn(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}}))}function yg(e,t){if(!e||e.length===0)return [];let r={card_data:t.card_data??{},requires:t.requires??{}};return e.map(n=>{let s={};if(n.projections&&typeof n.projections=="object"&&!Array.isArray(n.projections)){for(let[o,a]of Object.entries(n.projections))if(typeof a=="string"&&a.trim().length>0)try{s[o]=lc(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}})}var it={run:dg,runSync:lg,eval:fg,resolve:pg,validate:hg,enrichSources:gg,enrichSourcesSync:yg};function vg(e,t){let r;return /\.m?js$/i.test(e)?r="local-node":/\.py$/i.test(e)?r="local-python":r="local-process",{meta:"task-executor",howToRun:r,whatToRun:oe({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function _n(e){return JSON.stringify(e)}function Rn(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}function $n(e,t){function r(){return e.readIndex()??{}}function n(s,o,a){let i=String(o||"").split(".").filter(Boolean);if(i.length===0)return a&&typeof a=="object"&&!Array.isArray(a)?a:{value:a};let u={...s},c=u;for(let l=0;l<i.length-1;l++){let d=i[l],y=c[d],g=y&&typeof y=="object"&&!Array.isArray(y)?{...y}:{};c[d]=g,c=g;}return c[i[i.length-1]]=a,u}return {readCard(s){let o=r()[s];return !o||!e.cardExists(o.key)?null:e.readCard(o.key)},readCardKey(s){return r()[s]?.key??null},readAllCards(){let s=[];for(let[o,a]of Object.entries(r())){if(!e.cardExists(a.key))continue;let i=e.readCard(a.key);i?s.push(i):t?.(`[card-store] could not read card "${o}" at key "${a.key}"`);}return s},readChecksumIndex(){let s={};for(let[o,a]of Object.entries(r()))s[o]=a.checksum;return s},changedSince(s){let o=r(),a=[];for(let[i,u]of Object.entries(o))s[i]!==u.checksum&&a.push(i);for(let i of Object.keys(s))o[i]||a.push(i);return a},validateUpsert(s,o){let a=r(),i=a[s],u=Object.entries(a).find(([,c])=>c.key===o);return i&&i.key!==o?{ok:false,error:`Card id "${s}" is already mapped to key "${i.key}", cannot remap to "${o}"`}:u&&u[0]!==s?{ok:false,error:`Key "${o}" is already mapped to card id "${u[0]}", cannot remap to "${s}"`}:{ok:true}},writeCard(s,o,a){let i=r(),u=a??i[s]?.key??e.defaultCardKey(s),c=e.writeCard(u,o);i[s]={key:u,checksum:c,updatedAt:new Date().toISOString()},e.writeIndex(i);},patchCard(s,o,a){let i=r(),u=i[s];if(!u||!e.cardExists(u.key))throw new Error(`card "${s}" not found`);let c=e.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${s}" is not patchable`);let l=n(c,o,a),d=e.writeCard(u.key,l);i[s]={key:u.key,checksum:d,updatedAt:new Date().toISOString()},e.writeIndex(i);},removeCard(s){let o=r();o[s]&&(delete o[s],e.writeIndex(o));},readIndex(){return r()}}}function No(e,t){return {readSourceData(r,n){let s=e.read(`${r}/${n}`);if(s==null)return null;let o=s.trim();if(!o)return null;try{return JSON.parse(o)}catch{return o}},ingestSourceDataStaged(r,n,s,o){let a=t(s);e.write(`${r}/.staged/${o}/${n}`,a);},commitSourceData(r,n,s){let o=`${r}/.staged/${s}/${n}`,a=e.read(o);return a==null?false:(e.write(`${r}/${n}`,a),e.remove(o),true)},hasSource(r,n){return e.exists(`${r}/${n}`)}}}function hc(e){function t(r){let n=e.readAllEntries();if(!r)return n;let s=n.findIndex(o=>o.id===r);return s===-1?n:n.slice(s+1)}return {readEntriesAfterCursor(r){let n=t(r);return n.length===0?{events:[],newCursor:r}:{events:n.map(s=>s.event),newCursor:n[n.length-1].id}},pendingCount(r){return t(r).length},appendEvent(r){e.appendEntry({id:e.generateId(),event:r});}}}function gc(e,t){return {appendEntries(r,n){if(!r||n.length===0)return;let s=e.read(r)??[];e.write(r,[...s,...n]);},dispatchEntriesForJournalId(r,n){if(!r)return;let s=e.read(r);if(!(!s||s.length===0)){for(let o of s)try{n(o);}catch(a){let i=a instanceof Error?a.message:String(a);try{t(o,i);}catch{}}e.delete(r);}}}}var Er="v1",ut="board/graph",yc="board/lastJournalProcessedId";function pc(e){return `cards/${e}/runtime`}function vc(e){return {readRuntime(t){return e.read(pc(t))??{_sources:{}}},writeRuntime(t,r){e.write(pc(t),r);}}}function kg(e,t){let r={...e};for(let n of t.deleteKeys)delete r[n];return {...r,...t.shallowMerge}}function kc(e){return {readSnapshot(t){return e.readValues(t)},commitSnapshot(t,r){if(r.schemaVersion!==Er)throw new Error(`Unsupported snapshot schema version: ${r.schemaVersion}`);let n=e.readValues(t);if(n.version!==r.expectedVersion)return {ok:false,reason:"version-mismatch",currentVersion:n.version};let s=kg(n.values,r);return {ok:true,newVersion:e.writeValues(t,s,r.deleteKeys)}}}}function qo(e){function t(r){let n=e.read(r);return n==null?null:typeof n=="string"?n:JSON.stringify(n)}return {readTaskExecutorRef(){let r=t("task-executor");if(r?.trim())return Rn(r.trim())},writeTaskExecutorRef(r){e.write("task-executor",_n(r));},readChatHandlerRef(){let r=t("chat-handler");if(r?.trim())return Rn(r.trim())},writeChatHandlerRef(r){e.write("chat-handler",_n(r));},readCardStoreRef(){return t("card-store-ref")},writeCardStoreRef(r){e.write("card-store-ref",r);},readOutputsStoreRef(){return t("outputs-store-ref")},writeOutputsStoreRef(r){e.write("outputs-store-ref",r);},readChatHandler(){return t("chat-handler")?.trim()||void 0},writeChatHandler(r){e.write("chat-handler",r);}}}function bc(e){return {writeComputedValues(t,r){e.write(`cards/${t}/computed_values`,r);},readComputedValues(t){return e.read(`cards/${t}/computed_values`)},readAllComputedValues(){let t={};for(let r of e.listKeys("cards/")){let n=r.match(/^cards\/([^/]+)\/computed_values$/);n&&(t[n[1]]=e.read(r));}return t},writeDataObjects(t){for(let[r,n]of Object.entries(t))r&&e.write(`data-objects/${r}`,n);},readDataObject(t){return e.read(`data-objects/${t}`)},readAllDataObjects(){let t={};for(let r of e.listKeys("data-objects/"))t[r.slice(13)]=e.read(r);return t},writeStatusSnapshot(t){e.write("status",t);},readStatusSnapshot(){return e.read("status")}}}function bg(e){return e?.lastRequestedAt?!e.lastFetchedAt||e.lastFetchedAt<e.lastRequestedAt:false}function Sg(e,t){return e?.lastRequestedAt?bg(e)?"in-flight":!e.lastFetchedAt||e.lastFetchedAt<t?"dispatch":"idle":"dispatch"}function wg(e,t){let r={...e,lastFetchedAt:t};return delete r.lastError,r}function mc(e,t){let r={...e,lastError:t};return delete r.lastFetchedAt,r}function Cn(e,t){let r=t.state.tasks,n=t.config.tasks,s=Object.keys(r),o=$r(t),a={completed:0,failed:0,in_progress:0,pending:0,blocked:0,unresolved:0},i=new Map;for(let f of o.pending)i.set(f.taskName,f.waitingOn);for(let f of o.unresolved)i.set(f.taskName,f.missingTokens);for(let f of o.blocked)i.set(f.taskName,f.failedTokens);let u=new Map;for(let[f,p]of Object.entries(n))for(let b of p.requires??[]){let h=u.get(b)??[];h.push(f),u.set(b,h);}let c=s.sort().map(f=>{let p=r[f],b=n[f]??{requires:[],provides:[]};p.status==="completed"?a.completed+=1:p.status==="failed"?a.failed+=1:p.status==="in-progress"&&(a.in_progress+=1);let h=b.requires??[],m=b.provides??[],v=Object.keys(p.data??{}).sort(),w=h.filter(q=>t.state.availableOutputs.includes(q)),S=h.filter(q=>!t.state.availableOutputs.includes(q)),$=i.get(f)??S,_=new Set;for(let q of m)for(let F of u.get(q)??[])F!==f&&_.add(F);let C=p.failedAt,N=p.error?{message:p.error,code:"TASK_FAILED",at:C,source:"task-runtime"}:void 0;return {name:f,status:p.status,error:N,requires:h,requires_satisfied:w,requires_missing:S,provides_declared:m,provides_runtime:v,blocked_by:$,unblocks:Array.from(_).sort(),runtime:{attempt_count:p.executionCount??0,restart_count:p.retryCount??0,in_progress_since:p.status==="in-progress"?p.startedAt??null:null,last_transition_at:p.lastUpdated??null,last_completed_at:p.completedAt??null,last_restarted_at:p.startedAt??null,status_age_ms:p.lastUpdated?0:null}}});a.pending=o.pending.length,a.blocked=o.blocked.length,a.unresolved=o.unresolved.length;let l=c.map(f=>({name:f.name,fanOut:f.unblocks.length})).sort((f,p)=>p.fanOut-f.fanOut||f.name.localeCompare(p.name)),d=l.length>0?l[0]:{name:null,fanOut:0},y=new Set;for(let f of Object.values(n))for(let p of f.requires??[])y.add(p);let g=0;for(let[f,p]of Object.entries(n)){let b=(p.requires??[]).length===0,m=(p.provides??[]).some(v=>(u.get(v)??[]).some(w=>w!==f));b&&!m&&(g+=1);}return {schema_version:"v1",meta:{board:{path:e}},summary:{card_count:s.length,completed:a.completed,eligible:o.eligible.length,pending:a.pending,blocked:a.blocked,unresolved:a.unresolved,failed:a.failed,in_progress:a.in_progress,orphan_cards:g,topology:{edge_count:Array.from(y).length,max_fan_out_card:d.name,max_fan_out:d.fanOut}},cards:c}}function _g(){return new Date().toISOString()}function Sc(e,t,r,n,s,o,a){return async i=>{let u=[],c=r.cardStore.readCard(i.nodeId);if(!c)return "task-initiate-failure";let l=c.id,d=c.card_data??{},y=c.source_defs??[],g=y.filter(M=>M.optionalForCompletionGating!==true),f=r.cardRuntimeStore.readRuntime(l),p=false,b=()=>{p&&(r.cardRuntimeStore.writeRuntime(l,f),p=false);},h=M=>({...f._sources[M]??{}}),m=(M,V)=>{f._sources[M]=V,p=true;},v=i.taskState?.executionCount??0,w=f._lastExecutionCount;if(typeof w=="number"&&w!==v&&(f._sources={},p=true),w!==v&&(f._lastExecutionCount=v,p=true),i.update){let M=i.update,V=M.outputFile;if(V){let R=h(V);if(M.failure)m(V,mc(R,M.reason??"unknown"));else {let k=M.rqt;if(!R.lastFetchedAt||k>R.lastFetchedAt){let E=typeof M.deliveryToken=="string"?M.deliveryToken:void 0,A=false;E&&(A=r.fetchedSourcesStore.commitSourceData(l,V,E)),A?m(V,wg(R,k)):m(V,mc(R,`source delivery commit failed for ${V} token=${String(E)}`));}}b();}}let S={};for(let M of y)if(M.outputFile){let V=r.fetchedSourcesStore.readSourceData(l,M.outputFile);V!==null&&(S[M.bindTo]=V);}let $={};for(let[M,V]of Object.entries(i.state??{}))if(V!==null&&typeof V=="object"&&!Array.isArray(V)){let R=V[M];$[M]=R!==void 0?R:V;}else $[M]=V;let _={id:l,card_data:{...d},requires:$,source_defs:y,compute:c.compute};_._sourcesData=S,c.compute&&it.runSync(_,{sourcesData:S}),(o??r.outputStore.writeComputedValues.bind(r.outputStore))(l,_.computed_values??{});let C={...c},N=it.enrichSourcesSync(Array.isArray(c.source_defs)?c.source_defs:void 0,{card_data:c.card_data,requires:$}),q=e.value;C.source_defs=Array.isArray(N)?N.map(M=>({...M,boardDir:typeof M.boardDir=="string"&&M.boardDir?M.boardDir:q})):N;let F=_g(),re=i.update?void 0:F,U=g.filter(M=>{let V=M.outputFile;if(typeof V!="string"||!V)return true;let R=h(V);re&&(R={...R,queueRequestedAt:re},m(V,R));let k=R.queueRequestedAt??R.lastRequestedAt??F,E=Sg(R,k);return E==="in-flight"?false:E==="dispatch"});if(b(),U.length>0){let M=false,V=F;for(let R of U){let k=R.outputFile;if(typeof k!="string"||!k)continue;let E=h(k),A=E.queueRequestedAt??F;m(k,{...E,lastRequestedAt:A}),V=A,M=true;}return M&&b(),M&&(u.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:C,callbackToken:i.callbackToken,rqt:V}}),r.executionRequestStore.appendEntries(t,u)),"task-initiated"}let ce=c.provides??[],qe={};for(let{bindTo:M,ref:V}of ce)qe[M]=it.resolve(_,V);return (a??r.outputStore.writeDataObjects.bind(r.outputStore))(qe),y.filter(M=>{if(M.optionalForCompletionGating!==true)return false;let V=h(M.outputFile);return !V.lastRequestedAt||!V.lastFetchedAt?true:V.lastFetchedAt<=V.lastRequestedAt}).length>0&&u.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:C,callbackToken:i.callbackToken,rqt:F}}),n(i.nodeId,qe),u.length>0&&r.executionRequestStore.appendEntries(t,u),"task-initiated"}}var En={settings:{completion:"manual",refreshStrategy:"data-changed"},tasks:{}};function wc(e){return {[ut]:e.graph,[yc]:e.lastDrainedJournalId}}function _c(e){let t=e[ut],r=e[yc];if(!t||typeof t!="object")throw new Error(`State snapshot is missing required key: ${ut}`);return {graph:t,lastDrainedJournalId:typeof r=="string"?r:""}}function Rc(e){let t=e.requires,r=e.provides?.map(n=>n.bindTo)??[];return {requires:t&&t.length>0?t:void 0,provides:r,taskHandlers:["card-handler"],description:e.meta?.title??e.id}}function Q(e){return e!==void 0?{status:"success",data:e}:{status:"success"}}function j(e){return {status:"fail",error:e}}function ee(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function Rg(e){let t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCharCode(n)).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Cc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),n=atob(r),s=Uint8Array.from(n,o=>o.charCodeAt(0));return new TextDecoder().decode(s)}function xn(e){try{let t=JSON.parse(Cc(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function $g(e){return Rg(JSON.stringify(e))}function $c(e){try{let t=JSON.parse(Cc(e));return typeof t?.cbk=="string"&&typeof t?.cid=="string"&&typeof t?.b=="string"&&typeof t?.d=="string"?t:null}catch{return null}}function Ce(){return new Date().toISOString()}function Cg(e,t){let r=t.onWarn??(()=>{}),n=oe(e);function s(R){if(R.length!==0)try{let k=t.publishBoardChangeNotifications?.(R);k&&typeof k.catch=="function"&&k.catch(E=>r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${E instanceof Error?E.message:String(E)}`));}catch(k){r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${k instanceof Error?k.message:String(k)}`);}}function o(){let R=i().readCardStoreRef();if(!R)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let k=t.kvStorageForRef(R);return {readIndex(){return k.read("_index")},writeIndex(E){k.write("_index",E);},readCard(E){return k.read(E)},writeCard(E,A){return k.write(E,A),t.hashFn(A)},cardExists(E){return k.read(E)!==null},defaultCardKey(E){return E}}}let a={readValues(R){let k=t.kvStorage("state-snapshot"),E=k.listKeys().sort();if(E.length===0)return {version:null,values:{}};let A={};for(let Y of E)A[Y]=k.read(Y);return {version:t.hashFn(A),values:A}},writeValues(R,k,E){let A=t.kvStorage("state-snapshot");for(let Y of E)A.delete(Y);for(let[Y,te]of Object.entries(k))A.write(Y,te);return t.hashFn(k)}},i=()=>qo(t.kvStorage("config")),u=()=>kc(a),c=()=>hc(t.journalAdapter()),l=()=>$n(o(),r),d=()=>{let R=i().readOutputsStoreRef();if(!R)throw new Error(`Board at ${e.value} has no outputs store configured. Run: init --outputs-store-ref <b64-ref>`);return bc(t.kvStorageForRef(R))};function y(){return !!u().readSnapshot(e.value).values[ut]}function g(){let R=u().readSnapshot(e.value);if(!R.values[ut])throw new Error(`Board not initialized at ${e.value}`);return _c(R.values)}function f(R,k){let E=u().commitSnapshot(e.value,{schemaVersion:Er,expectedVersion:k,commitId:t.genId(),committedAt:Ce(),deleteKeys:[],shallowMerge:wc(R)});if(!E.ok)throw new Error(`Snapshot commit failed (version mismatch): expected=${k??"null"} current=${E.currentVersion??"null"}`)}function p(R){c().appendEvent(R);}async function b(){let R=(I,D)=>{let ae=I.payload,ze=(ae?.enrichedCard??{}).id??ae?.cardId??"unknown";p({type:"task-failed",taskName:ze,error:D,timestamp:Ce()});},k=gc(t.kvStorage("execution-requests"),R),E=vc(t.kvStorage("card-runtime")),A=No(t.blobStorage("sources"),I=>t.resolveBlob(I)),Y=new Map,te={readRuntime(I){return Y.get(I)??E.readRuntime(I)},writeRuntime(I,D){Y.set(I,D);}},we=[],_e=new Map,Be={readSourceData(I,D){let ae=`${I}/${D}`;return _e.has(ae)?_e.get(ae):A.readSourceData(I,D)},ingestSourceDataStaged(I,D,ae,Et){A.ingestSourceDataStaged(I,D,ae,Et);},commitSourceData(I,D,ae){let Et=`${I}/.staged/${ae}/${D}`,Ir=t.blobStorage("sources").read(Et);if(Ir==null)return false;let xt=`${I}/${D}`,Bo=Ir.trim();try{_e.set(xt,JSON.parse(Bo));}catch{_e.set(xt,Bo);}return we.push({cardId:I,outputFile:D,deliveryToken:ae}),true},hasSource(I,D){let ae=`${I}/${D}`;return _e.has(ae)?true:A.hasSource(I,D)}},De={cardStore:l(),cardRuntimeStore:te,fetchedSourcesStore:Be,outputStore:d(),executionRequestStore:k},dt=g(),lt=Sn(dt.graph),{events:$t,newCursor:Ct}=c().readEntriesAfterCursor(dt.lastDrainedJournalId),ft=[],An=[],In=[],Mo=new Map,Ic=(I,D)=>{ft.push({type:"task-completed",taskName:I,data:D,timestamp:Ce()});},Lo=(I,D)=>p({type:"task-failed",taskName:I,error:D,timestamp:Ce()}),Tr=uc(lt,{handlers:{"card-handler":Sc(e,Ct,De,Ic,Lo,(I,D)=>{An.push({cardId:I,values:D});},I=>{In.push(I);})}});for(ft=$t;ft.length>0;){let I=ft;ft=[];for(let D of I)if(D.type==="task-restart"){let ae=De.cardStore.readCard(D.taskName);ae&&Mo.set(D.taskName,ae);}Tr.pushAll(I),await Tr.waitForHandlers();}let Vo=Tr.getState();await Tr.dispose({wait:true});let Pc=u().readSnapshot(e.value).version;f({lastDrainedJournalId:Ct,graph:Rr(Vo)},Pc);for(let{cardId:I,values:D}of An)De.outputStore.writeComputedValues(I,D);for(let I of In)De.outputStore.writeDataObjects(I);for(let[I,D]of Y)E.writeRuntime(I,D);for(let{cardId:I,outputFile:D,deliveryToken:ae}of we)A.commitSourceData(I,D,ae);let Ar;try{Ar=Cn(n,Vo),De.outputStore.writeStatusSnapshot(Ar);}catch(I){r(`[board-live-cards-public] status publish failed: ${I instanceof Error?I.message:String(I)}`);}let Ut=[];for(let{cardId:I,values:D}of An)Ut.push({kind:"computed_values",cardId:I,values:D});for(let I of In)for(let[D,ae]of Object.entries(I))D&&Ut.push({kind:"data_object",key:D,payload:ae});for(let[I,D]of Mo)Ut.push({kind:"card_refreshed",cardId:I,card:D});Ar!==void 0&&Ut.push({kind:"status",status:Ar}),s(Ut);let Oc=i().readTaskExecutorRef()??{howToRun:"built-in",whatToRun:oe({kind:"built-in",value:"source-cli-task-executor"})};k.dispatchEntriesForJournalId(Ct,I=>{if(I.taskKind!=="source-fetch"){r(`[process-accumulated-events] unknown taskKind "${I.taskKind}" \u2014 skipping`);return}let D=I.payload,ae=D.enrichedCard?.id??"unknown",Et=D.enrichedCard?.source_defs??[];for(let ze of Et){if(!ze.outputFile){r(`[dispatch] source "${ze.bindTo}" has no outputFile \u2014 skipping`);continue}let Ir=$g({cbk:D.callbackToken,rg:e.value,br:oe(e),cid:ae,b:ze.bindTo,d:ze.outputFile,cs:void 0,rqt:D.rqt});t.dispatchExecution(Oc,{source_def:ze,base_ref:oe(e),callback:{token:Ir,via:t.selfRef}}).catch(xt=>Lo(ae,xt instanceof Error?xt.message:String(xt)));}});}async function h(){try{let R=()=>{let E=g(),{events:A}=c().readEntriesAfterCursor(E.lastDrainedJournalId);A.length<=0||(h(),t.requestProcessAccumulated?.());},k=await Ko(t.lock,b,R);return Q({ran:k!==!1})}catch(R){return ee(R)}}function m(R){try{let k=R.params?.cardStoreRef;if(!k)return j("init requires params.cardStoreRef \u2014 create a card store with card-store-cli and pass its ref here");if(!y()){let te=bn(En);f({lastDrainedJournalId:"",graph:Rr(te)},null);}let E=R.params?.outputsStoreRef;if(!E)return j("init requires params.outputsStoreRef \u2014 pass the outputs store ref here");let A=i();A.writeCardStoreRef(k),A.writeOutputsStoreRef(E);let Y=R.body??{};Y["task-executor-ref"]&&A.writeTaskExecutorRef(Y["task-executor-ref"]),Y["chat-handler-ref"]&&A.writeChatHandlerRef(Y["chat-handler-ref"]);try{d().writeStatusSnapshot(Cn(n,Sn(g().graph)));}catch{}return Q()}catch(k){return ee(k)}}function v(R){try{let k=d().readStatusSnapshot();if(!k){k=Cn(n,Sn(g().graph));try{d().writeStatusSnapshot(k);}catch{}}return Q(k)}catch(k){return ee(k)}}function w(R){try{let k=R.params?.id;return k?(p({type:"task-removal",taskName:k,timestamp:Ce()}),h(),Q()):j("removeCard requires params.id")}catch(k){return ee(k)}}function S(R){try{let k=R.params?.id;return k?(p({type:"task-restart",taskName:k,timestamp:Ce()}),h(),Q()):j("retrigger requires params.id")}catch(k){return ee(k)}}async function $(R){return h()}function _(R){try{let k=R.params?.cardId,E=R.params?.all,A=!!R.params?.restart;if(!k&&!E)return j("upsertCard requires --card-id <id> or --all");let Y=E?l().readAllCards().map(te=>te.id):[k];for(let te of Y)if(!l().readCard(te))return j(`Card "${te}" not found in board at ${e.value}`);for(let te of Y){let we=l().readCard(te),_e=Rc(we),Be=t.hashFn(_e),De=t.kvStorage("card-upsert"),dt=De.read(te),lt=dt?.taskConfigHash!==Be;if(!(!lt&&!A)){if(lt){let $t=dt?.blobRef??l().readCardKey(te)??te;p({type:"task-upsert",taskName:te,taskConfig:_e,timestamp:Ce()}),De.write(te,{blobRef:$t,taskConfigHash:Be,updatedAt:Ce()});}A&&p({type:"task-restart",taskName:te,timestamp:Ce()});}}return h(),Q()}catch(k){return ee(k)}}function C(R){try{let k=R.params?.token;if(!k)return j("taskFailed requires params.token");let E=R.params?.error??"unknown error",A=xn(k);return A?(p({type:"task-failed",taskName:A.taskName,error:E,timestamp:Ce()}),h(),Q()):j("Invalid callback token")}catch(k){return ee(k)}}function N(R){try{let k=R.params?.token;if(!k)return j("taskProgress requires params.token");let A=(R.body??{}).update??{},Y=xn(k);return Y?(p({type:"task-progress",taskName:Y.taskName,update:A,timestamp:Ce()}),h(),Q()):j("Invalid callback token")}catch(k){return ee(k)}}function q(R){try{let k=R.params?.token,E=R.params?.ref;if(!k)return j("sourceDataFetched requires params.token");if(!E)return j("sourceDataFetched requires params.ref");let A=$c(k);if(!A)return j("Invalid source token");let{cbk:Y,cid:te,b:we,d:_e,cs:Be,rqt:De}=A,dt=No(t.blobStorage("sources"),ft=>t.resolveBlob(ft)),lt=t.genId();dt.ingestSourceDataStaged(te,_e,Re(E),lt);let $t=xn(Y);if(!$t)return j("Invalid callback token embedded in source token");let Ct=Ce();return p({type:"task-progress",taskName:$t.taskName,update:{bindTo:we,outputFile:_e,fetchedAt:Ct,deliveryToken:lt,sourceChecksum:Be,rqt:De},timestamp:Ct}),h(),Q()}catch(k){return ee(k)}}function F(R){try{let k=R.params?.token,E=R.params?.reason??"unknown";if(!k)return j("sourceDataFetchFailure requires params.token");let A=$c(k);if(!A)return j("Invalid source token");let{cbk:Y,b:te,d:we,cs:_e}=A,Be=xn(Y);return Be?(p({type:"task-progress",taskName:Be.taskName,update:{bindTo:te,outputFile:we,failure:!0,reason:E,sourceChecksum:_e},timestamp:Ce()}),h(),Q()):j("Invalid callback token embedded in source token")}catch(k){return ee(k)}}function re(R){try{let k=i().readCardStoreRef();return k?Q({storeRef:k}):j(`Board at ${e.value} has no card store configured`)}catch(k){return ee(k)}}function U(R){try{let k=i().readOutputsStoreRef();return k?Q({storeRef:k}):j(`Board at ${e.value} has no outputs store configured`)}catch(k){return ee(k)}}function ce(R){try{let k=R.params?.key;if(!k)return j("getConfig requires params.key");let E=i(),A;switch(k){case "task-executor":A=E.readTaskExecutorRef()??null;break;case "chat-handler":A=E.readChatHandlerRef()??null;break;case "card-store-ref":A=E.readCardStoreRef();break;case "outputs-store-ref":A=E.readOutputsStoreRef();break;default:return j(`getConfig: unknown key "${k}"`)}return Q({value:A})}catch(k){return ee(k)}}function qe(R){try{let k=R.params?.key;if(!k)return j("getOutputsDataObject requires params.key");let E=d().readDataObject(k);return Q(E)}catch(k){return ee(k)}}function ct(R){try{return Q(d().readAllDataObjects())}catch(k){return ee(k)}}function M(R){try{let k=R.params?.key;if(!k)return j("getOutputsComputedValues requires params.key");let E=d().readComputedValues(k);return Q(E)}catch(k){return ee(k)}}function V(R){try{return Q(d().readAllComputedValues())}catch(k){return ee(k)}}return {init:m,status:v,getCardStoreRef:re,getOutputsStoreRef:U,getConfig:ce,getOutputsDataObject:qe,getAllOutputsDataObjects:ct,getOutputsComputedValues:M,getAllOutputsComputedValues:V,removeCard:w,retrigger:S,processAccumulatedEvents:$,upsertCard:_,taskFailed:C,taskProgress:N,sourceDataFetched:q,sourceDataFetchFailure:F}}function Eg(e,t){let r=()=>qo(t.kvStorage("config"));function n(){let h=r().readCardStoreRef();if(!h)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let m=t.kvStorageForRef(h);return {readIndex(){return m.read("_index")},writeIndex(v){m.write("_index",v);},readCard(v){return m.read(v)},writeCard(v,w){return m.write(v,w),t.hashFn(w)},cardExists(v){return m.read(v)!==null},defaultCardKey(v){return v}}}let s=()=>$n(n(),t.onWarn??(()=>{}));function o(h,m){let v=t.validateSchema(m),w=[],S=r().readTaskExecutorRef();if(S&&Array.isArray(m.source_defs))for(let _ of m.source_defs){let C=typeof _.bindTo=="string"?_.bindTo:"(unknown)";try{let N;try{N=t.invokeExecutorSync(S,"validate-source-def",[],{timeout:1e4,input:JSON.stringify(_)});}catch(F){let re=F;if(N=typeof re?.stdout=="string"?re.stdout:"",!N.trim()){w.push(`source "${C}": executor validate-source-def failed \u2014 ${F instanceof Error?F.message:String(F)}`);continue}}let q=JSON.parse(N.trim());if(!q.ok&&Array.isArray(q.errors))for(let F of q.errors)w.push(`source "${C}": ${F}`);}catch(N){w.push(`source "${C}": executor validate-source-def failed \u2014 ${N instanceof Error?N.message:String(N)}`);}}let $=[...v.errors,...w];return Q({cardId:h,isValid:$.length===0,issues:$})}function a(h,m,v){let w=r().readTaskExecutorRef();if(!w)return j("No task-executor registered for this board");let S=typeof h.bindTo=="string"?h.bindTo:"source",$=t.makeTempFilePath(`probe-in-${S}`),_=t.makeTempFilePath(`probe-out-${S}`),C=t.makeTempFilePath(`probe-err-${S}`,".txt"),N={...h,boardDir:e.value,_projections:m},q=oe({kind:"fs-path",value:$}),F=oe({kind:"fs-path",value:_}),re=oe({kind:"fs-path",value:C});t.absoluteBlob.write($,JSON.stringify(N,null,2));let U=null;try{if(t.invokeExecutorSync(w,"run-source-fetch",["--in-ref",q,"--out-ref",F,"--err-ref",re],{timeout:h.timeout??3e4}),U=t.absoluteBlob.read(_),U===null)return j("Executor produced no output file")}catch(ce){let qe=t.absoluteBlob.read(C)?.trim()??(ce instanceof Error?ce.message:String(ce));return j(`Probe failed: ${qe}`)}finally{try{t.absoluteBlob.remove($);}catch{}try{t.absoluteBlob.remove(C);}catch{}}if(v){let ce=Re(v);t.absoluteBlob.write(ce.value,U);}else try{t.absoluteBlob.remove(_);}catch{}return Q({bindTo:S,resultSizeBytes:U.length})}function i(h){try{let m=h.params?.cardId,v=h.params?.all;if(!m&&!v)return j("validateCard requires --card-id <id> or --all");let w=v?s().readAllCards().map($=>$.id):[m],S=[];for(let $ of w){let _=s().readCard($);if(!_){S.push({cardId:$,isValid:!1,issues:[`Card "${$}" not found`]});continue}let C=o($,_);if(C.status!=="success")return C;S.push(C.data);}return Q(S)}catch(m){return ee(m)}}function u(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("validateCardPreflight requires card JSON object in body");let m=h.body,v=m["card-content"]??m,w=typeof v.id=="string"?v.id:"(unknown)",S=o(w,v),$=r().readTaskExecutorRef();if($)try{let _=t.invokeExecutorSync($,"validate-card-preflight",[],{timeout:1e4,input:JSON.stringify(v)}),C=JSON.parse(_.trim());if(!C.ok&&Array.isArray(C.errors)&&C.errors.length>0){let N=[...S.status==="success"?S.data.issues:[],...C.errors];return Q({cardId:w,isValid:!1,issues:N})}}catch{}return S}catch(m){return ee(m)}}function c(h){try{let m=h.params?.cardId,v=h.params?.sourceIdx,w=h.params?.outRef;if(!m)return j("probeSource requires params.cardId");if(v===void 0)return j("probeSource requires params.sourceIdx");let $=(h.body??{})["mock-projections"]??{},_=s().readCard(m);if(!_)return j(`Card "${m}" not found`);let C=_.source_defs??[];return v<0||v>=C.length?j(`sourceIdx ${v} out of range (card has ${C.length} source(s))`):a(C[v],$,w)}catch(m){return ee(m)}}function l(h){try{let m=h.params?.outRef,v=h.body;if(!v)return j('probeTmpSource requires body with "source-def" and "mock-projections"');let w=v["source-def"],S=v["mock-projections"]??{};return w?a(w,S,m):j('probeTmpSource body requires "source-def"')}catch(m){return ee(m)}}function d(h){try{let m=h.params?.sourceIdx,v=h.params?.outRef;if(m===void 0)return j("probeSourcePreflight requires params.sourceIdx");if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("probeSourcePreflight requires card JSON object in body");let w=h.body,S=w["card-content"]??w,$=w["mock-projections"]??{},_=S.source_defs??[];if(m<0||m>=_.length)return j(`sourceIdx ${m} out of range (card has ${_.length} source(s))`);let C=_[m],N=r().readTaskExecutorRef();if(N){let q=typeof C.bindTo=="string"?C.bindTo:"source";try{let F={...C,_projections:$},re=t.invokeExecutorSync(N,"probe-source-preflight",[],{timeout:C.timeout??1e4,input:JSON.stringify(F)}),U=JSON.parse(re.trim());return U.ok?Q({bindTo:q,reachable:U.reachable,latencyMs:U.latencyMs,note:U.note}):j(U.error??"Preflight probe failed")}catch{}}return a(C,$,v)}catch(m){return ee(m)}}function y(h){try{let m=r().readTaskExecutorRef();if(!m)return j("No task-executor registered for this board");let v=t.invokeExecutorSync(m,"describe-capabilities",[],{timeout:1e4});return Q(JSON.parse(v.trim()))}catch(m){return ee(m)}}function g(h){try{let m=h.body;if(!m||!Array.isArray(m.ops))return j("updatesInCardStore requires body.ops array");let v=m.ops,w=s();for(let S of v){let $=S.op,_=S.id;if(!_)return j('op is missing "id"');if($==="update"){let C=S["card-content"];if(!C)return j(`update op for "${_}" is missing "card-content"`);w.writeCard(_,C);}else return j(`Unknown op type: "${$??"(none)"}"`)}return Q()}catch(m){return ee(m)}}function f(h){try{let m=h.body;if(!m||!Array.isArray(m.ids))return j("readFromCardStore requires body.ids array");let v=m.ids,w=s(),S=v.map($=>({id:$,"card-content":w.readCard($)}));return Q({cards:S})}catch(m){return ee(m)}}function p(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("evalCardCompute requires a JSON object in body");let m=h.body,v=m["card-content"]??m,w=typeof v.id=="string"?v.id:"(unknown)",S=m["mock-fetched-sources"]??{},$=m["mock-requires"]??{},_=v.compute;if(!_||!Array.isArray(_)||_.length===0)return Q({cardId:w,ok:!0,computed_values:{},errors:[]});let C={id:w,card_data:v.card_data??{},requires:$,source_defs:v.source_defs,compute:_},N=it.runSync(C,{sourcesData:S}),q=N.node.computed_values??{},F=N.errors??[];return Q({cardId:w,ok:F.length===0,computed_values:q,errors:F})}catch(m){return ee(m)}}function b(h){try{if(!h.body||typeof h.body!="object"||Array.isArray(h.body))return j("simulateCardCycle requires a JSON object in body");let m=h.body,v=m["card-content"]??m,w=typeof v.id=="string"?v.id:"(unknown)",S=m["mock-fetched-sources"]??{},$=m["mock-requires"]??{},_=o(w,v),C=_.status==="success"?{isValid:_.data.isValid,issues:_.data.issues}:{isValid:!1,issues:[_.status==="fail"?_.error:"internal error"]},N=v.source_defs??[],q=v.card_data??{},F=[],re=[];if(N.length>0){F=it.enrichSourcesSync(N,{card_data:q,requires:$});for(let k of F){let E=k.projections,A=k._projections;if(E&&A){for(let Y of Object.keys(E))if(A[Y]===void 0){let te=typeof k.bindTo=="string"?k.bindTo:"(unknown)";re.push({bindTo:te,key:Y,error:`Projection "${Y}" resolved to undefined`});}}}}let U=[],ce=m["task-executor-ref"],qe=(ce?.howToRun&&ce?.whatToRun?ce:void 0)??r().readTaskExecutorRef();for(let k=0;k<F.length;k++){let E=F[k],A=typeof E.bindTo=="string"?E.bindTo:`source_${k}`;if(!qe){U.push({bindTo:A,skipped:!0,error:"No task executor configured"});continue}try{let Y={...E},te=t.invokeExecutorSync(qe,"probe-source-preflight",[],{timeout:E.timeout??1e4,input:JSON.stringify(Y)}),we=JSON.parse(te.trim());U.push({bindTo:A,reachable:we.reachable,latencyMs:we.latencyMs,error:we.ok?void 0:we.error});}catch{U.push({bindTo:A,skipped:!0,error:"Executor does not support probe-source-preflight"});}}let ct=v.compute,M={},V=[];if(ct&&Array.isArray(ct)&&ct.length>0){let k={id:w,card_data:q,requires:$,source_defs:v.source_defs,compute:ct},E=it.runSync(k,{sourcesData:S});M=E.node.computed_values??{},V=E.errors??[];}let R=C.isValid&&re.length===0&&V.length===0&&U.every(k=>k.reachable!==!1);return Q({cardId:w,ok:R,validation:C,source_probes:U,projection_errors:re,computed_values:M,compute_errors:V})}catch(m){return ee(m)}}return {validateCard:i,validateCardPreflight:u,probeSource:c,probeTmpSource:l,probeSourcePreflight:d,evalCardCompute:p,simulateCardCycle:b,describeTaskExecutorCapabilities:y,updatesInCardStore:g,readFromCardStore:f}}function xg(e){function t(s){return {status:"success",data:s}}function r(s){return {status:"fail",error:s}}function n(s){return {status:"error",error:s instanceof Error?s.message:String(s)}}return {get(s){try{let o=s.params?.id;if(o){let a=e.readCard(o);return a?t({cards:[a]}):r(`card "${o}" not found`)}return t({cards:e.readAllCards()})}catch(o){return n(o)}},set(s){try{let o=s.body;if(o==null)return r("set requires a body (card object or array of cards)");let a=Array.isArray(o)?o:[o];for(let i of a){if(typeof i.id!="string")return r("each card must have a string `id` field");e.writeCard(i.id,i);}return t({count:a.length})}catch(o){return n(o)}},del(s){try{let o=s.body?.ids??[],a=s.params?.id,i=a?[...o,a]:o;if(i.length===0)return r("del requires body.ids (string[]) or params.id");for(let u of i)e.removeCard(u);return t({count:i.length})}catch(o){return n(o)}},patch(s){try{let o=s.params?.id,a=s.params?.path;if(!o)return r("patch requires params.id");if(!a)return r("patch requires params.path");let i=s.body,u=i&&Object.prototype.hasOwnProperty.call(i,"value")?i.value:s.body;return e.patchCard(o,a,u),t({count:1})}catch(o){return n(o)}}}}function Tg(e){function t(s){return {status:"success",data:s}}function r(s){return {status:"fail",error:s}}function n(s){return {status:"error",error:s instanceof Error?s.message:String(s)}}return {list(s){try{let o=s.params?.prefix??"";return t({artifacts:e.list(o)})}catch(o){return n(o)}},head(s){try{let o=s.params?.key;return o?t({artifact:e.head(o)}):r("head requires params.key")}catch(o){return n(o)}},put(s){try{let o=s.params?.key,a=s.params?.contentType;if(!o)return r("put requires params.key");let i=s.body;if(typeof i=="string")return t({artifact:e.putText(o,i,a)});if(i&&typeof i=="object"&&typeof i.text=="string")return t({artifact:e.putText(o,i.text,a)});if(i&&typeof i=="object"&&Array.isArray(i.bytes)){let u=i.bytes,c=new Uint8Array(u.map(l=>Math.max(0,Math.min(255,Number(l)||0))));return t({artifact:e.putBytes(o,c,a)})}return r("put requires body as string, {text}, or {bytes:number[]}")}catch(o){return n(o)}},get(s){try{let o=s.params?.key,a=s.params?.as??"base64";if(!o)return r("get requires params.key");let i=e.head(o);if(!i)return r(`artifact "${o}" not found`);if(a==="text"){let c=e.getText(o);return c===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,text:c})}let u=e.getBytes(o);return u===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,bytes:[...u]})}catch(o){return n(o)}},del(s){try{let o=s.params?.key;return o?(e.remove(o),t({ok:!0})):r("del requires params.key")}catch(o){return n(o)}}}}var Tn=".artifacts-index.json";function Ec(){return new Date().toISOString()}function xc(e){return new TextEncoder().encode(e).byteLength}function xr(e){let t=e.read(Tn);if(!t)return {entries:{}};try{let r=JSON.parse(t);if(r&&r.entries&&typeof r.entries=="object")return r}catch{}return {entries:{}}}function Do(e,t){e.write(Tn,JSON.stringify(t,null,2));}function Ag(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function Tc(e,t,r){e.entries[t]={key:t,size:r.size,updatedAt:r.updatedAt,contentType:r.contentType};}function Fo(e){let t=String(e||"").match(/^(\d+)[-_]/);return t?parseInt(t[1],10):0}function Ig(e){let t=String(e||"").trim();if(!t)return "upload.bin";let r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return (r>=0?t.slice(r+1):t)||"upload.bin"}function Pg(e){return String(e||"").toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"")||"file"}function Og(e){if(!e||e===".")return "";let t=String(e).replace(/^\./,"").toLowerCase().replace(/[^a-z0-9]/g,"");return t?`.${t}`:""}function jg(e){let t=Ig(e),r=t.lastIndexOf(".");return r<=0||r===t.length-1?{stem:t,ext:""}:{stem:t.slice(0,r),ext:t.slice(r)}}function Ng(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function qg(e){function t(r){let n=e.stat?Ag(e.stat(r)):null;if(n)return n;let o=xr(e).entries[r];if(o)return {...o};if(!e.exists(r))return null;let a=e.read(r);return a===null?{key:r}:{key:r,size:xc(a)}}return {exists(r){return e.exists(r)},putText(r,n,s="text/plain; charset=utf-8"){e.write(r,n);let o=t(r)??{key:r};o.contentType=s,o.updatedAt=o.updatedAt??Ec(),o.size=o.size??xc(n);let a=xr(e);return Tc(a,r,o),Do(e,a),o},putBytes(r,n,s="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,n);else {let i=JSON.stringify({__kind:"bytes-array",data:[...n]});e.write(r,i);}let o=t(r)??{key:r};o.contentType=s,o.updatedAt=o.updatedAt??Ec(),o.size=o.size??n.byteLength;let a=xr(e);return Tc(a,r,o),Do(e,a),o},getText(r){let n=e.read(r);if(n===null){if(!e.readBytes)return null;let s=e.readBytes(r);return s===null?null:Buffer.from(s).toString("utf-8")}try{let s=JSON.parse(n);if(s&&s.__kind==="bytes-array"&&Array.isArray(s.data))return new TextDecoder("utf-8").decode(new Uint8Array(s.data))}catch{}return n},getBytes(r){if(e.readBytes){let s=e.readBytes(r);if(s!==null)return s}let n=e.read(r);if(n===null)return null;try{let s=JSON.parse(n);if(s&&s.__kind==="bytes-array"&&Array.isArray(s.data))return new Uint8Array(s.data)}catch{}return new TextEncoder().encode(n)},head:t,list(r=""){let n=new Map;if(e.listKeys)for(let o of e.listKeys(r)){if(o===Tn)continue;let a=t(o)??{key:o};n.set(o,a);}let s=xr(e);for(let[o,a]of Object.entries(s.entries))o===Tn||r&&!o.startsWith(r)||n.has(o)||n.set(o,{...a});return [...n.values()].sort((o,a)=>o.key.localeCompare(a.key))},remove(r){e.remove(r);let n=xr(e);delete n.entries[r],Do(e,n);}}}function Dg(e,t){let r=t?.indexFileName||".index.json";function n(d){return `${d}/${r}`}function s(d){let y=e.getText(n(d));if(!y)return [];try{let g=JSON.parse(y);return Array.isArray(g)?g.filter(f=>f&&typeof f.stored_name=="string").map(f=>({serial:Number(f.serial||Fo(String(f.stored_name))||0),role:String(f.role||"system").toLowerCase(),stored_name:String(f.stored_name),path:typeof f.path=="string"?f.path:`${d}/chats/${String(f.stored_name)}`,updated_at:typeof f.updated_at=="string"?f.updated_at:null})):[]}catch{return []}}function o(d,y){e.putText(n(d),JSON.stringify(y,null,2),"application/json; charset=utf-8");}function a(d){let y=s(d),g=0;for(let f of y){let p=Number(f.serial||0);Number.isFinite(p)&&p>g&&(g=p);}return g+1}function i(d,y){let g=s(d);g.push(y),o(d,g);}function u(d){let y=s(d),g=[];for(let f of y){let p=`${d}/${f.stored_name}`,b=e.getText(p);b!==null&&g.push({serial:Number(f.serial||Fo(f.stored_name)||0),role:String(f.role||"system").toLowerCase(),text:b,path:typeof f.path=="string"?f.path:`${d}/chats/${f.stored_name}`,stored_name:f.stored_name,updated_at:f.updated_at||null});}return g.sort((f,p)=>f.serial-p.serial||f.stored_name.localeCompare(p.stored_name)),g}function c(d){let y=`${d}/`;for(let g of e.list(y))e.remove(g.key);}function l(d){let y=`${d}/`,g=e.list(y),f=0,p=0,b=false;for(let h of g){let m=h.key.slice(y.length);if(m===".processing"){b=true;continue}if(!/^(\d+)[-_]([a-z0-9_-]+)\.txt$/i.test(m))continue;f+=1;let v=h.updatedAt?Number(new Date(h.updatedAt).getTime()||0):0;v>p&&(p=v);}return {count:f,latest_mtime_ms:p,processing:b}}return {indexKey:n,loadIndex:s,saveIndex:o,nextSerial:a,appendIndexRecord:i,readRecords:u,clear:c,readSignal:l}}function Fg(e){function t(s,o){let a=0,i=[];Array.isArray(o)&&i.push(...o);for(let u of e.list(`${s}/`))i.push(Ng(u.key));for(let u of i){let c=Fo(u);Number.isFinite(c)&&c>a&&(a=c);}return a+1}function r(s,o,a){let i=Number(a?.maxLen||32),{stem:u,ext:c}=jg(s),l=Og(c),d=Pg(u),y=`${String(o).padStart(3,"0")}-`,g=l,f=i-y.length-g.length;f<1&&(g="",f=i-y.length);let p=d.slice(0,Math.max(1,f)),b=`${y}${p}${g}`;return b.length>i&&(b=b.slice(0,i).replace(/\.$/,"")),b}function n(s,o,a){let i=t(s,a?.seedNames),u=r(o,i,{maxLen:a?.maxLen});for(;e.exists(`${s}/${u}`);)i+=1,u=r(o,i,{maxLen:a?.maxLen});return u}return {nextSerial:t,buildStoredName:r,allocateStoredName:n}}function Mg(){function e(s,o){if(!Array.isArray(s))return [];let a=[];for(let i of s){if(!i||typeof i!="object")continue;let u=i;typeof u.stored_name=="string"&&a.push({name:typeof u.name=="string"?u.name:u.stored_name,stored_name:u.stored_name,size:typeof u.size=="number"&&Number.isFinite(u.size)?u.size:null,mime_type:typeof u.mime_type=="string"?u.mime_type:null,path:typeof u.path=="string"?u.path:null,uploaded_at:typeof u.uploaded_at=="string"?u.uploaded_at:o||null});}return a}function t(s){return !s||typeof s!="object"?[]:e(s.files,void 0)}function r(s,o){let a=t(s);if(o.length===0)return s.files=a,a;let i=new Set(a.map(u=>u.stored_name));for(let u of o)i.has(u.stored_name)||(a.push(u),i.add(u.stored_name));return s.files=a,a}function n(s,o,a){let i=t(s);if(!Number.isInteger(o)||o<0||o>=i.length)return {ok:false,reason:"index_out_of_range"};let u=i[o];return !u||!u.stored_name?{ok:false,reason:"missing_stored_name"}:a&&a!==u.stored_name?{ok:false,reason:"stale_reference"}:{ok:true,file:u}}return {read:t,normalizeIncoming:e,merge:r,resolve:n}}function Ik(){return {async invoke(e,t){if(e.howToRun!=="local-node")return {dispatched:false,error:`createNodeSpawnInvocationAdapter: unsupported howToRun "${e.howToRun}"`};let r="";try{let o=e.whatToRun,a=typeof o=="string"?Re(o):o;a.kind==="fs-path"&&(r=a.value);}catch{r="";}if(!r)return {dispatched:false,error:"createNodeSpawnInvocationAdapter: could not resolve fs-path from whatToRun"};let n={...t};if(n.chatsKeyPrefix&&n.chatsBlobBasePath){let o=String(n.chatsKeyPrefix).split("/")[0];n.chatDir=pt(String(n.chatsBlobBasePath),o);}delete n.chatsKeyPrefix,delete n.chatsBlobBasePath;let s=Buffer.from(JSON.stringify(n)).toString("base64");try{return child_process.spawn(process.execPath,[r,"--boardId",String(t.boardId??""),"--cardId",String(t.cardId??""),"--extraEncJson",s],{stdio:"ignore",windowsHide:!0}).unref(),{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}},async describe(e){if(e.howToRun!=="local-node")return null;let t="";try{let r=e.whatToRun,n=typeof r=="string"?Re(r):r;n.kind==="fs-path"&&(t=n.value);}catch{t="";}if(!t)return null;try{let r=child_process.spawnSync(process.execPath,[t,"describe"],{timeout:5e3,encoding:"utf-8",windowsHide:!0});return r.status!==0?null:JSON.parse(String(r.stdout).trim())}catch{return null}}}}var Bg=".board.lock";function Gg(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Kg(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Ac(e){if(e)return e;let t=Yo((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-live-cards-node.cjs', document.baseURI).href))),r=[t,pt(t,"..","cli","node"),pt(t,"..","..","cli","node")];for(let n of r)try{return qn(n),n}catch{}throw new Error(`createFsBoardPlatformAdapter: could not resolve a public CLI directory from module dir ${t}`)}function Ug(e,t,r){let{cliDir:n,opts:s}=Gg(t,r),o=Ac(n),a=e.value,i=s?.suppressSpawn?"":qn(o),u={meta:"board-live-cards",howToRun:"local-node",whatToRun:i?oe({kind:"fs-path",value:i}):"",...s?.notifyChannel?{extra:{notifyChannel:s.notifyChannel}}:{}};return {kvStorage:c=>Kn(pt(a,`.${c}`)),blobStorage:c=>c?qr(pt(a,c)):qr(a),journalAdapter:()=>pa(a),lock:ma(pt(a,Bg)),selfRef:u,async dispatchExecution(c,l){if(s?.suppressSpawn)return {dispatched:false};try{let d=l.source_def?.bindTo??On().slice(0,8),y=Jt(a,`exec-in-${d}`),g=Jt(a,`exec-out-${d}`),f=Jt(a,`exec-err-${d}`,".txt"),p=oe({kind:"fs-path",value:y}),b=oe({kind:"fs-path",value:g}),h=oe({kind:"fs-path",value:f});return la({kind:"fs-path",value:y}).write(y,JSON.stringify(l,null,2)),da(c,{subcommand:"run-source-fetch",inRef:p,outRef:b,errRef:h},o),{dispatched:!0}}catch(d){return {dispatched:false,error:d instanceof Error?d.message:String(d)}}},resolveBlob(c){let l=zo(c.value)?Gn().read(c.value):qr(a).read(c.value);if(l===null)throw new Error(`resolveBlob: blob not found: ::${c.kind}::${c.value}`);return l},hashFn:fa,genId:()=>Wo(`${Date.now()}-${Math.random()}`).slice(0,32),kvStorageForRef:c=>Kn(Re(c).value),requestProcessAccumulated(){s?.suppressSpawn||Zo(o,e,s?.notifyChannel);},publishBoardChangeNotifications(c){if(!s?.notifyChannel||c.length===0)return;let l=c.map(d=>({id:On(),ts:new Date().toISOString(),boardRef:oe(e),notification:d}));ea(s.notifyChannel,l,s.onWarn);},onWarn:s?.onWarn}}function Pk(e,t,r){let{cliDir:n,opts:s}=Kg(t,r),o=Ac(n),a=Ug(e,o,s),i=Nr();return {...a,invokeExecutorSync(u,c,l,d){let{command:y,baseArgs:g}=Fn(u,o);return i.executeSync(y,[...g,c,...l],{timeout:d?.timeout??3e4,encoding:"utf-8",input:d?.input})},validateSchema(u){let c=Io(u);return {ok:c.errors.length===0,errors:c.errors}},makeTempFilePath(u,c){return Jt(e.value,u,c)},absoluteBlob:Gn()}}function Ok(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString());return typeof t.br=="string"?t.br:null}catch{return null}}
|
|
13
|
+
exports.BOARD_GRAPH_KEY=ut;exports.EMPTY_CONFIG=En;exports.SNAPSHOT_SCHEMA_VERSION_V1=Er;exports.createArtifactsStore=qg;exports.createArtifactsStorePublic=Tg;exports.createBoardLiveCardsNonCorePublic=Eg;exports.createBoardLiveCardsPublic=Cg;exports.createCardFileMetadataStore=Mg;exports.createCardStore=$n;exports.createCardStorePublic=xg;exports.createChatArtifactsStore=Dg;exports.createExecutionRefInvoker=ud;exports.createFileArtifactsStore=Fg;exports.createFsBoardNonCorePlatformAdapter=Pk;exports.createFsBoardPlatformAdapter=Ug;exports.createNodeSpawnInvocationAdapter=Ik;exports.decodeBoardRefFromToken=Ok;exports.evaluateArgsMassaging=Mn;exports.executionRefFromScriptPath=vg;exports.invokeExecutionRef=ca;exports.invokeExecutionRefSync=Ln;exports.invokeRefSync=cd;exports.parseExecutionRef=Rn;exports.parseRef=Re;exports.serializeExecutionRef=_n;exports.serializeRef=oe;//# sourceMappingURL=board-live-cards-node.cjs.map
|
|
14
14
|
//# sourceMappingURL=board-live-cards-node.cjs.map
|