yaml-flow 8.4.16 → 8.4.18
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 +3 -3
- package/browser/board-livecards-client.js +1 -1
- package/browser/board-livecards-localstorage.js +6 -6
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +1 -1
- package/cli/bundled/board-live-cards-cli.mjs +18 -18
- package/cli/bundled/card-store-cli.mjs +78 -78
- package/cli/bundled/chat-store-cli.mjs +10 -10
- package/cli/{types-YNCagczT.d.ts → types-juH2nFpz.d.ts} +12 -0
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/artifacts-store-public.d.cts +1 -1
- package/lib/artifacts-store-public.d.ts +1 -1
- package/lib/board-live-cards-node.cjs +12 -12
- package/lib/board-live-cards-node.d.cts +4 -4
- package/lib/board-live-cards-node.d.ts +4 -4
- package/lib/board-live-cards-node.js +12 -12
- package/lib/{board-live-cards-public-CQ82CDdS.d.cts → board-live-cards-public-B4RcYPC_.d.cts} +12 -0
- package/lib/{board-live-cards-public-CtlVp0L3.d.ts → board-live-cards-public-ydXuA4zh.d.ts} +12 -0
- package/lib/board-live-cards-public.cjs +2 -2
- package/lib/board-live-cards-public.d.cts +1 -1
- package/lib/board-live-cards-public.d.ts +1 -1
- package/lib/board-live-cards-public.js +2 -2
- package/lib/board-live-cards-server-runtime.cjs +4 -4
- package/lib/board-live-cards-server-runtime.d.cts +2 -2
- package/lib/board-live-cards-server-runtime.d.ts +2 -2
- package/lib/board-live-cards-server-runtime.js +4 -4
- package/lib/board-livegraph-runtime/index.cjs +1 -1
- package/lib/board-livegraph-runtime/index.d.cts +1 -1
- package/lib/board-livegraph-runtime/index.d.ts +1 -1
- package/lib/board-livegraph-runtime/index.js +1 -1
- package/lib/card-store-public.cjs +1 -1
- package/lib/card-store-public.d.cts +12 -1
- package/lib/card-store-public.d.ts +12 -1
- package/lib/card-store-public.js +1 -1
- package/lib/chat-store-public.cjs +1 -1
- package/lib/chat-store-public.d.cts +5 -2
- package/lib/chat-store-public.d.ts +5 -2
- package/lib/chat-store-public.js +1 -1
- package/lib/continuous-event-graph/index.cjs +2 -2
- package/lib/continuous-event-graph/index.d.cts +2 -2
- package/lib/continuous-event-graph/index.d.ts +2 -2
- package/lib/continuous-event-graph/index.js +2 -2
- package/lib/index.cjs +12 -12
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -12
- package/lib/{live-cards-bridge-b25aAVvE.d.cts → live-cards-bridge-Bwi-lbBT.d.cts} +2 -0
- package/lib/{live-cards-bridge-DC_ZU0eS.d.ts → live-cards-bridge-YL6AWawT.d.ts} +2 -0
- package/lib/server-runtime/index.cjs +4 -4
- package/lib/server-runtime/index.d.cts +3 -3
- package/lib/server-runtime/index.d.ts +3 -3
- package/lib/server-runtime/index.js +4 -4
- package/lib/{types-vTfV-Zkn.d.ts → types-1L1D33mr.d.ts} +1 -1
- package/lib/{types-D1R0JHIs.d.cts → types-D501gMQt.d.cts} +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {spawnSync,spawn,execFile,execFileSync}from'child_process';import*as b from'fs';import {existsSync}from'fs';import*as Un from'os';import*as Y from'path';import {dirname,resolve}from'path';import*as ia from'net';import {fileURLToPath}from'url';import {createHash,randomUUID}from'crypto';import {createRequire}from'module';import {lockSync}from'proper-lockfile';import gh from'ajv-formats';var Zc=Object.create;var na=Object.defineProperty;var ed=Object.getOwnPropertyDescriptor;var td=Object.getOwnPropertyNames;var rd=Object.getPrototypeOf,nd=Object.prototype.hasOwnProperty;var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var sd=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of td(t))!nd.call(e,s)&&s!==r&&na(e,s,{get:()=>t[s],enumerable:!(n=ed(t,s))||n.enumerable});return e};var od=(e,t,r)=>(r=e!=null?Zc(rd(e)):{},sd(na(r,"default",{value:e,enumerable:true}),e));var cr=T(ee=>{Object.defineProperty(ee,"__esModule",{value:true});ee.regexpCode=ee.getEsmExportName=ee.getProperty=ee.safeStringify=ee.stringify=ee.strConcat=ee.addCodeArg=ee.str=ee._=ee.nil=ee._Code=ee.Name=ee.IDENTIFIER=ee._CodeOrName=void 0;var ir=class{};ee._CodeOrName=ir;ee.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Tt=class extends ir{constructor(t){if(super(),!ee.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}}};ee.Name=Tt;var Me=class extends ir{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 Tt&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ee._Code=Me;ee.nil=new Me("");function Ia(e,...t){let r=[e[0]],n=0;for(;n<t.length;)os(r,t[n]),r.push(e[++n]);return new Me(r)}ee._=Ia;var ss=new Me("+");function Pa(e,...t){let r=[ur(e[0])],n=0;for(;n<t.length;)r.push(ss),os(r,t[n]),r.push(ss,ur(e[++n]));return Bd(r),new Me(r)}ee.str=Pa;function os(e,t){t instanceof Me?e.push(...t._items):t instanceof Tt?e.push(t):e.push(Ud(t));}ee.addCodeArg=os;function Bd(e){let t=1;for(;t<e.length-1;){if(e[t]===ss){let r=Kd(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+";}t++;}}function Kd(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Tt||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 Tt))return `"${e}${t.slice(1)}`}function Gd(e,t){return t.emptyStr()?e:e.emptyStr()?t:Pa`${e}${t}`}ee.strConcat=Gd;function Ud(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ur(Array.isArray(e)?e.join(","):e)}function Jd(e){return new Me(ur(e))}ee.stringify=Jd;function ur(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ee.safeStringify=ur;function zd(e){return typeof e=="string"&&ee.IDENTIFIER.test(e)?new Me(`.${e}`):Ia`[${e}]`}ee.getProperty=zd;function Hd(e){if(typeof e=="string"&&ee.IDENTIFIER.test(e))return new Me(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ee.getEsmExportName=Hd;function Wd(e){return new Me(e.toString())}ee.regexpCode=Wd;});var us=T(Ae=>{Object.defineProperty(Ae,"__esModule",{value:true});Ae.ValueScope=Ae.ValueScopeName=Ae.Scope=Ae.varKinds=Ae.UsedValueState=void 0;var Te=cr(),as=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value;}},Qr;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed";})(Qr||(Ae.UsedValueState=Qr={}));Ae.varKinds={const:new Te.Name("const"),let:new Te.Name("let"),var:new Te.Name("var")};var Zr=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r;}toName(t){return t instanceof Te.Name?t:this.name(t)}name(t){return new Te.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}}};Ae.Scope=Zr;var en=class extends Te.Name{constructor(t,r){super(r),this.prefix=t;}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0, Te._)`.${new Te.Name(r)}[${n}]`;}};Ae.ValueScopeName=en;var Yd=(0, Te._)`\n`,is=class extends Zr{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Yd:Te.nil};}get(){return this._scope}name(t){return new en(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 d=i.get(a);if(d)return d}else i=this._values[o]=new Map;i.set(a,s);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,s.setValue(r,{property:o,itemIndex:u}),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, Te._)`${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=Te.nil;for(let a in t){let i=t[a];if(!i)continue;let c=n[a]=n[a]||new Map;i.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let d=r(u);if(d){let l=this.opts.es5?Ae.varKinds.var:Ae.varKinds.const;o=(0, Te._)`${o}${l} ${u} = ${d};${this.opts._n}`;}else if(d=s?.(u))o=(0, Te._)`${o}${d}${this.opts._n}`;else throw new as(u);c.set(u,Qr.Completed);});}return o}};Ae.ValueScope=is;});var U=T(G=>{Object.defineProperty(G,"__esModule",{value:true});G.or=G.and=G.not=G.CodeGen=G.operators=G.varKinds=G.ValueScopeName=G.ValueScope=G.Scope=G.Name=G.regexpCode=G.stringify=G.getProperty=G.nil=G.strConcat=G.str=G._=void 0;var W=cr(),ze=us(),ft=cr();Object.defineProperty(G,"_",{enumerable:true,get:function(){return ft._}});Object.defineProperty(G,"str",{enumerable:true,get:function(){return ft.str}});Object.defineProperty(G,"strConcat",{enumerable:true,get:function(){return ft.strConcat}});Object.defineProperty(G,"nil",{enumerable:true,get:function(){return ft.nil}});Object.defineProperty(G,"getProperty",{enumerable:true,get:function(){return ft.getProperty}});Object.defineProperty(G,"stringify",{enumerable:true,get:function(){return ft.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:true,get:function(){return ft.regexpCode}});Object.defineProperty(G,"Name",{enumerable:true,get:function(){return ft.Name}});var sn=us();Object.defineProperty(G,"Scope",{enumerable:true,get:function(){return sn.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:true,get:function(){return sn.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:true,get:function(){return sn.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:true,get:function(){return sn.varKinds}});G.operators={GT:new W._Code(">"),GTE:new W._Code(">="),LT:new W._Code("<"),LTE:new W._Code("<="),EQ:new W._Code("==="),NEQ:new W._Code("!=="),NOT:new W._Code("!"),OR:new W._Code("||"),AND:new W._Code("&&"),ADD:new W._Code("+")};var st=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},cs=class extends st{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n;}render({es5:t,_n:r}){let n=t?ze.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=Gt(this.rhs,t,r)),this}get names(){return this.rhs instanceof W._CodeOrName?this.rhs.names:{}}},tn=class extends st{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 W.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Gt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof W.Name?{}:{...this.lhs.names};return nn(t,this.rhs)}},ds=class extends tn{constructor(t,r,n,s){super(t,n,s),this.op=r;}render({_n:t}){return `${this.lhs} ${this.op}= ${this.rhs};`+t}},ls=class extends st{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `${this.label}:`+t}},fs=class extends st{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `break${this.label?` ${this.label}`:""};`+t}},ps=class extends st{constructor(t){super(),this.error=t;}render({_n:t}){return `throw ${this.error};`+t}get names(){return this.error.names}},ms=class extends st{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=Gt(this.code,t,r),this}get names(){return this.code instanceof W._CodeOrName?this.code.names:{}}},dr=class extends st{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)||(Xd(t,o.names),n.splice(s,1));}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Pt(t,r.names),{})}},ot=class extends dr{render(t){return "{"+t._n+super.render(t)+"}"+t._n}},gs=class extends dr{},Kt=class extends ot{};Kt.kind="else";var At=class e extends ot{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 Kt(n):n;}if(r)return t===false?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Oa(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=Gt(this.condition,t,r),this}get names(){let t=super.names;return nn(t,this.condition),this.else&&Pt(t,this.else.names),t}};At.kind="if";var It=class extends ot{};It.kind="for";var hs=class extends It{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=Gt(this.iteration,t,r),this}get names(){return Pt(super.names,this.iteration.names)}},ys=class extends It{constructor(t,r,n,s){super(),this.varKind=t,this.name=r,this.from=n,this.to=s;}render(t){let r=t.es5?ze.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=nn(super.names,this.from);return nn(t,this.to)}},rn=class extends It{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=Gt(this.iterable,t,r),this}get names(){return Pt(super.names,this.iterable.names)}},lr=class extends ot{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)}};lr.kind="func";var fr=class extends dr{render(t){return "return "+super.render(t)}};fr.kind="return";var vs=class extends ot{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&&Pt(t,this.catch.names),this.finally&&Pt(t,this.finally.names),t}},pr=class extends ot{constructor(t){super(),this.error=t;}render(t){return `catch(${this.error})`+super.render(t)}};pr.kind="catch";var mr=class extends ot{render(t){return "finally"+super.render(t)}};mr.kind="finally";var Ss=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
-
`:""},this._extScope=t,this._scope=new ze.Scope({parent:t}),this._nodes=[new gs];}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 cs(t,o,n)),o}const(t,r,n){return this._def(ze.varKinds.const,t,r,n)}let(t,r,n){return this._def(ze.varKinds.let,t,r,n)}var(t,r,n){return this._def(ze.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new tn(t,r,n))}add(t,r){return this._leafNode(new ds(t,G.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==W.nil&&this._leafNode(new ms(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, W.addCodeArg)(r,s));return r.push("}"),new W._Code(r)}if(t,r,n){if(this._blockNode(new At(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 At(t))}else(){return this._elseNode(new Kt)}endIf(){return this._endBlockNode(At,Kt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new hs(t),r)}forRange(t,r,n,s,o=this.opts.es5?ze.varKinds.var:ze.varKinds.let){let a=this._scope.toName(t);return this._for(new ys(o,a,r,n),()=>s(a))}forOf(t,r,n,s=ze.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof W.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, W._)`${a}.length`,i=>{this.var(o,(0, W._)`${a}[${i}]`),n(o);})}return this._for(new rn("of",s,o,r),()=>n(o))}forIn(t,r,n,s=this.opts.es5?ze.varKinds.var:ze.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0, W._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new rn("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(It)}label(t){return this._leafNode(new ls(t))}break(t){return this._leafNode(new fs(t))}return(t){let r=new fr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(fr)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new vs;if(this._blockNode(s),this.code(t),r){let o=this.name("e");this._currNode=s.catch=new pr(o),r(o);}return n&&(this._currNode=s.finally=new mr,this.code(n)),this._endBlockNode(pr,mr)}throw(t){return this._leafNode(new ps(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=W.nil,n,s){return this._blockNode(new lr(t,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(lr)}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 At))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;}};G.CodeGen=Ss;function Pt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function nn(e,t){return t instanceof W._CodeOrName?Pt(e,t.names):e}function Gt(e,t,r){if(e instanceof W.Name)return n(e);if(!s(e))return e;return new W._Code(e._items.reduce((o,a)=>(a instanceof W.Name&&(a=n(a)),a instanceof W._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 W._Code&&o._items.some(a=>a instanceof W.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function Xd(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0);}function Oa(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0, W._)`!${ks(e)}`}G.not=Oa;var Qd=ja(G.operators.AND);function Zd(...e){return e.reduce(Qd)}G.and=Zd;var el=ja(G.operators.OR);function tl(...e){return e.reduce(el)}G.or=tl;function ja(e){return (t,r)=>t===W.nil?r:r===W.nil?t:(0, W._)`${ks(t)} ${e} ${ks(r)}`}function ks(e){return e instanceof W.Name?e:(0, W._)`(${e})`}});var X=T(J=>{Object.defineProperty(J,"__esModule",{value:true});J.checkStrictMode=J.getErrorPath=J.Type=J.useFunc=J.setEvaluated=J.evaluatedPropsToName=J.mergeEvaluated=J.eachItem=J.unescapeJsonPointer=J.escapeJsonPointer=J.escapeFragment=J.unescapeFragment=J.schemaRefOrVal=J.schemaHasRulesButRef=J.schemaHasRules=J.checkUnknownRules=J.alwaysValidSchema=J.toHash=void 0;var se=U(),rl=cr();function nl(e){let t={};for(let r of e)t[r]=true;return t}J.toHash=nl;function sl(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?true:(Fa(e,t),!Da(t,e.self.RULES.all))}J.alwaysValidSchema=sl;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]||Va(e,`unknown keyword: "${o}"`);}J.checkUnknownRules=Fa;function Da(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(t[r])return true;return false}J.schemaHasRules=Da;function ol(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(r!=="$ref"&&t.all[r])return true;return false}J.schemaHasRulesButRef=ol;function al({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, se._)`${r}`}return (0, se._)`${e}${t}${(0, se.getProperty)(n)}`}J.schemaRefOrVal=al;function il(e){return Ma(decodeURIComponent(e))}J.unescapeFragment=il;function ul(e){return encodeURIComponent(bs(e))}J.escapeFragment=ul;function bs(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}J.escapeJsonPointer=bs;function Ma(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}J.unescapeJsonPointer=Ma;function cl(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e);}J.eachItem=cl;function Na({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return (s,o,a,i)=>{let c=a===void 0?o:a instanceof se.Name?(o instanceof se.Name?e(s,o,a):t(s,o,a),a):o instanceof se.Name?(t(s,a,o),o):r(o,a);return i===se.Name&&!(c instanceof se.Name)?n(s,c):c}}J.mergeEvaluated={props:Na({mergeNames:(e,t,r)=>e.if((0, se._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0, se._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0, se._)`${r} || {}`).code((0, se._)`Object.assign(${r}, ${t})`));}),mergeToName:(e,t,r)=>e.if((0, se._)`${r} !== true`,()=>{t===true?e.assign(r,true):(e.assign(r,(0, se._)`${r} || {}`),_s(e,r,t));}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:La}),items:Na({mergeNames:(e,t,r)=>e.if((0, se._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0, se._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0, se._)`${r} !== true`,()=>e.assign(r,t===true?true:(0, se._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function La(e,t){if(t===true)return e.var("props",true);let r=e.var("props",(0, se._)`{}`);return t!==void 0&&_s(e,r,t),r}J.evaluatedPropsToName=La;function _s(e,t,r){Object.keys(r).forEach(n=>e.assign((0, se._)`${t}${(0, se.getProperty)(n)}`,true));}J.setEvaluated=_s;var qa={};function dl(e,t){return e.scopeValue("func",{ref:t,code:qa[t.code]||(qa[t.code]=new rl._Code(t.code))})}J.useFunc=dl;var ws;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str";})(ws||(J.Type=ws={}));function ll(e,t,r){if(e instanceof se.Name){let n=t===ws.Num;return r?n?(0, se._)`"[" + ${e} + "]"`:(0, se._)`"['" + ${e} + "']"`:n?(0, se._)`"/" + ${e}`:(0, se._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, se.getProperty)(e).toString():"/"+bs(e)}J.getErrorPath=ll;function Va(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===true)throw new Error(t);e.self.logger.warn(t);}}J.checkStrictMode=Va;});var at=T(Rs=>{Object.defineProperty(Rs,"__esModule",{value:true});var ye=U(),fl={data:new ye.Name("data"),valCxt:new ye.Name("valCxt"),instancePath:new ye.Name("instancePath"),parentData:new ye.Name("parentData"),parentDataProperty:new ye.Name("parentDataProperty"),rootData:new ye.Name("rootData"),dynamicAnchors:new ye.Name("dynamicAnchors"),vErrors:new ye.Name("vErrors"),errors:new ye.Name("errors"),this:new ye.Name("this"),self:new ye.Name("self"),scope:new ye.Name("scope"),json:new ye.Name("json"),jsonPos:new ye.Name("jsonPos"),jsonLen:new ye.Name("jsonLen"),jsonPart:new ye.Name("jsonPart")};Rs.default=fl;});var gr=T(ve=>{Object.defineProperty(ve,"__esModule",{value:true});ve.extendErrors=ve.resetErrorsCount=ve.reportExtraError=ve.reportError=ve.keyword$DataError=ve.keywordError=void 0;var Q=U(),on=X(),_e=at();ve.keywordError={message:({keyword:e})=>(0, Q.str)`must pass "${e}" keyword validation`};ve.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0, Q.str)`"${e}" keyword must be ${t} ($data)`:(0, Q.str)`"${e}" keyword is invalid ($data)`};function pl(e,t=ve.keywordError,r,n){let{it:s}=e,{gen:o,compositeRule:a,allErrors:i}=s,c=Ga(e,t,r);n??(a||i)?Ba(o,c):Ka(s,(0, Q._)`[${c}]`);}ve.reportError=pl;function ml(e,t=ve.keywordError,r){let{it:n}=e,{gen:s,compositeRule:o,allErrors:a}=n,i=Ga(e,t,r);Ba(s,i),o||a||Ka(n,_e.default.vErrors);}ve.reportExtraError=ml;function gl(e,t){e.assign(_e.default.errors,t),e.if((0, Q._)`${_e.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0, Q._)`${_e.default.vErrors}.length`,t),()=>e.assign(_e.default.vErrors,null)));}ve.resetErrorsCount=gl;function hl({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,_e.default.errors,i=>{e.const(a,(0, Q._)`${_e.default.vErrors}[${i}]`),e.if((0, Q._)`${a}.instancePath === undefined`,()=>e.assign((0, Q._)`${a}.instancePath`,(0, Q.strConcat)(_e.default.instancePath,o.errorPath))),e.assign((0, Q._)`${a}.schemaPath`,(0, Q.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0, Q._)`${a}.schema`,r),e.assign((0, Q._)`${a}.data`,n));});}ve.extendErrors=hl;function Ba(e,t){let r=e.const("err",t);e.if((0, Q._)`${_e.default.vErrors} === null`,()=>e.assign(_e.default.vErrors,(0, Q._)`[${r}]`),(0, Q._)`${_e.default.vErrors}.push(${r})`),e.code((0, Q._)`${_e.default.errors}++`);}function Ka(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;s.$async?r.throw((0, Q._)`new ${e.ValidationError}(${t})`):(r.assign((0, Q._)`${n}.errors`,t),r.return(false));}var Ot={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function Ga(e,t,r){let{createErrors:n}=e.it;return n===false?(0, Q._)`{}`:yl(e,t,r)}function yl(e,t,r={}){let{gen:n,it:s}=e,o=[vl(s,r),Sl(e,r)];return kl(e,t,o),n.object(...o)}function vl({errorPath:e},{instancePath:t}){let r=t?(0, Q.str)`${e}${(0, on.getErrorPath)(t,on.Type.Str)}`:e;return [_e.default.instancePath,(0, Q.strConcat)(_e.default.instancePath,r)]}function Sl({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:(0, Q.str)`${t}/${e}`;return r&&(s=(0, Q.str)`${s}${(0, on.getErrorPath)(r,on.Type.Str)}`),[Ot.schemaPath,s]}function kl(e,{params:t,message:r},n){let{keyword:s,data:o,schemaValue:a,it:i}=e,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:l}=i;n.push([Ot.keyword,s],[Ot.params,typeof t=="function"?t(e):t||(0, Q._)`{}`]),c.messages&&n.push([Ot.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Ot.schema,a],[Ot.parentSchema,(0, Q._)`${d}${l}`],[_e.default.data,o]),u&&n.push([Ot.propertyName,u]);}});var Ja=T(Ut=>{Object.defineProperty(Ut,"__esModule",{value:true});Ut.boolOrEmptySchema=Ut.topBoolOrEmptySchema=void 0;var wl=gr(),bl=U(),_l=at(),Rl={message:"boolean schema is false"};function Cl(e){let{gen:t,schema:r,validateName:n}=e;r===false?Ua(e,false):typeof r=="object"&&r.$async===true?t.return(_l.default.data):(t.assign((0, bl._)`${n}.errors`,null),t.return(true));}Ut.topBoolOrEmptySchema=Cl;function $l(e,t){let{gen:r,schema:n}=e;n===false?(r.var(t,false),Ua(e)):r.var(t,true);}Ut.boolOrEmptySchema=$l;function Ua(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, wl.reportError)(s,Rl,void 0,t);}});var Cs=T(Jt=>{Object.defineProperty(Jt,"__esModule",{value:true});Jt.getRules=Jt.isJSONType=void 0;var El=["string","number","integer","boolean","null","object","array"],xl=new Set(El);function Tl(e){return typeof e=="string"&&xl.has(e)}Jt.isJSONType=Tl;function Al(){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:{}}}Jt.getRules=Al;});var $s=T(pt=>{Object.defineProperty(pt,"__esModule",{value:true});pt.shouldUseRule=pt.shouldUseGroup=pt.schemaHasRulesForType=void 0;function Il({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==true&&za(e,n)}pt.schemaHasRulesForType=Il;function za(e,t){return t.rules.some(r=>Ha(e,r))}pt.shouldUseGroup=za;function Ha(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))}pt.shouldUseRule=Ha;});var hr=T(Se=>{Object.defineProperty(Se,"__esModule",{value:true});Se.reportTypeError=Se.checkDataTypes=Se.checkDataType=Se.coerceAndCheckDataType=Se.getJSONTypes=Se.getSchemaTypes=Se.DataType=void 0;var Pl=Cs(),Ol=$s(),jl=gr(),K=U(),Wa=X(),zt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong";})(zt||(Se.DataType=zt={}));function Nl(e){let t=Ya(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}Se.getSchemaTypes=Nl;function Ya(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Pl.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Se.getJSONTypes=Ya;function ql(e,t){let{gen:r,data:n,opts:s}=e,o=Fl(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0, Ol.schemaHasRulesForType)(e,t[0]));if(a){let i=xs(t,n,s.strictNumbers,zt.Wrong);r.if(i,()=>{o.length?Dl(e,t,o):Ts(e);});}return a}Se.coerceAndCheckDataType=ql;var Xa=new Set(["string","number","integer","boolean","null"]);function Fl(e,t){return t?e.filter(r=>Xa.has(r)||t==="array"&&r==="array"):[]}function Dl(e,t,r){let{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0, K._)`typeof ${s}`),i=n.let("coerced",(0, K._)`undefined`);o.coerceTypes==="array"&&n.if((0, K._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0, K._)`${s}[0]`).assign(a,(0, K._)`typeof ${s}`).if(xs(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0, K._)`${i} !== undefined`);for(let u of r)(Xa.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),Ts(e),n.endIf(),n.if((0, K._)`${i} !== undefined`,()=>{n.assign(s,i),Ml(e,i);});function c(u){switch(u){case "string":n.elseIf((0, K._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0, K._)`"" + ${s}`).elseIf((0, K._)`${s} === null`).assign(i,(0, K._)`""`);return;case "number":n.elseIf((0, K._)`${a} == "boolean" || ${s} === null
|
|
1
|
+
import {spawnSync,spawn,execFile,execFileSync}from'child_process';import*as _ from'fs';import {existsSync}from'fs';import*as zn from'os';import*as X from'path';import {dirname,resolve}from'path';import*as da from'net';import {fileURLToPath}from'url';import {createHash,randomUUID}from'crypto';import {createRequire}from'module';import {lockSync}from'proper-lockfile';import Sh from'ajv-formats';var nd=Object.create;var aa=Object.defineProperty;var sd=Object.getOwnPropertyDescriptor;var od=Object.getOwnPropertyNames;var ad=Object.getPrototypeOf,id=Object.prototype.hasOwnProperty;var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ud=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of od(t))!id.call(e,s)&&s!==r&&aa(e,s,{get:()=>t[s],enumerable:!(n=sd(t,s))||n.enumerable});return e};var cd=(e,t,r)=>(r=e!=null?nd(ad(e)):{},ud(aa(r,"default",{value:e,enumerable:true}),e));var dr=T(ee=>{Object.defineProperty(ee,"__esModule",{value:true});ee.regexpCode=ee.getEsmExportName=ee.getProperty=ee.safeStringify=ee.stringify=ee.strConcat=ee.addCodeArg=ee.str=ee._=ee.nil=ee._Code=ee.Name=ee.IDENTIFIER=ee._CodeOrName=void 0;var ur=class{};ee._CodeOrName=ur;ee.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var At=class extends ur{constructor(t){if(super(),!ee.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}}};ee.Name=At;var Me=class extends ur{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 At&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ee._Code=Me;ee.nil=new Me("");function Oa(e,...t){let r=[e[0]],n=0;for(;n<t.length;)is(r,t[n]),r.push(e[++n]);return new Me(r)}ee._=Oa;var as=new Me("+");function Na(e,...t){let r=[cr(e[0])],n=0;for(;n<t.length;)r.push(as),is(r,t[n]),r.push(as,cr(e[++n]));return Jd(r),new Me(r)}ee.str=Na;function is(e,t){t instanceof Me?e.push(...t._items):t instanceof At?e.push(t):e.push(Wd(t));}ee.addCodeArg=is;function Jd(e){let t=1;for(;t<e.length-1;){if(e[t]===as){let r=zd(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+";}t++;}}function zd(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof At||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 At))return `"${e}${t.slice(1)}`}function Hd(e,t){return t.emptyStr()?e:e.emptyStr()?t:Na`${e}${t}`}ee.strConcat=Hd;function Wd(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:cr(Array.isArray(e)?e.join(","):e)}function Yd(e){return new Me(cr(e))}ee.stringify=Yd;function cr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ee.safeStringify=cr;function Xd(e){return typeof e=="string"&&ee.IDENTIFIER.test(e)?new Me(`.${e}`):Oa`[${e}]`}ee.getProperty=Xd;function Qd(e){if(typeof e=="string"&&ee.IDENTIFIER.test(e))return new Me(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ee.getEsmExportName=Qd;function Zd(e){return new Me(e.toString())}ee.regexpCode=Zd;});var ds=T(Te=>{Object.defineProperty(Te,"__esModule",{value:true});Te.ValueScope=Te.ValueScopeName=Te.Scope=Te.varKinds=Te.UsedValueState=void 0;var Ae=dr(),us=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value;}},Zr;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed";})(Zr||(Te.UsedValueState=Zr={}));Te.varKinds={const:new Ae.Name("const"),let:new Ae.Name("let"),var:new Ae.Name("var")};var en=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r;}toName(t){return t instanceof Ae.Name?t:this.name(t)}name(t){return new Ae.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}}};Te.Scope=en;var tn=class extends Ae.Name{constructor(t,r){super(r),this.prefix=t;}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0, Ae._)`.${new Ae.Name(r)}[${n}]`;}};Te.ValueScopeName=tn;var el=(0, Ae._)`\n`,cs=class extends en{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?el:Ae.nil};}get(){return this._scope}name(t){return new tn(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 d=i.get(a);if(d)return d}else i=this._values[o]=new Map;i.set(a,s);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,s.setValue(r,{property:o,itemIndex:u}),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, Ae._)`${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=Ae.nil;for(let a in t){let i=t[a];if(!i)continue;let c=n[a]=n[a]||new Map;i.forEach(u=>{if(c.has(u))return;c.set(u,Zr.Started);let d=r(u);if(d){let l=this.opts.es5?Te.varKinds.var:Te.varKinds.const;o=(0, Ae._)`${o}${l} ${u} = ${d};${this.opts._n}`;}else if(d=s?.(u))o=(0, Ae._)`${o}${d}${this.opts._n}`;else throw new us(u);c.set(u,Zr.Completed);});}return o}};Te.ValueScope=cs;});var U=T(G=>{Object.defineProperty(G,"__esModule",{value:true});G.or=G.and=G.not=G.CodeGen=G.operators=G.varKinds=G.ValueScopeName=G.ValueScope=G.Scope=G.Name=G.regexpCode=G.stringify=G.getProperty=G.nil=G.strConcat=G.str=G._=void 0;var Y=dr(),ze=ds(),pt=dr();Object.defineProperty(G,"_",{enumerable:true,get:function(){return pt._}});Object.defineProperty(G,"str",{enumerable:true,get:function(){return pt.str}});Object.defineProperty(G,"strConcat",{enumerable:true,get:function(){return pt.strConcat}});Object.defineProperty(G,"nil",{enumerable:true,get:function(){return pt.nil}});Object.defineProperty(G,"getProperty",{enumerable:true,get:function(){return pt.getProperty}});Object.defineProperty(G,"stringify",{enumerable:true,get:function(){return pt.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:true,get:function(){return pt.regexpCode}});Object.defineProperty(G,"Name",{enumerable:true,get:function(){return pt.Name}});var on=ds();Object.defineProperty(G,"Scope",{enumerable:true,get:function(){return on.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:true,get:function(){return on.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:true,get:function(){return on.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:true,get:function(){return on.varKinds}});G.operators={GT:new Y._Code(">"),GTE:new Y._Code(">="),LT:new Y._Code("<"),LTE:new Y._Code("<="),EQ:new Y._Code("==="),NEQ:new Y._Code("!=="),NOT:new Y._Code("!"),OR:new Y._Code("||"),AND:new Y._Code("&&"),ADD:new Y._Code("+")};var nt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},ls=class extends nt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n;}render({es5:t,_n:r}){let n=t?ze.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=zt(this.rhs,t,r)),this}get names(){return this.rhs instanceof Y._CodeOrName?this.rhs.names:{}}},rn=class extends nt{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 Y.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=zt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Y.Name?{}:{...this.lhs.names};return sn(t,this.rhs)}},fs=class extends rn{constructor(t,r,n,s){super(t,n,s),this.op=r;}render({_n:t}){return `${this.lhs} ${this.op}= ${this.rhs};`+t}},ps=class extends nt{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `${this.label}:`+t}},ms=class extends nt{constructor(t){super(),this.label=t,this.names={};}render({_n:t}){return `break${this.label?` ${this.label}`:""};`+t}},gs=class extends nt{constructor(t){super(),this.error=t;}render({_n:t}){return `throw ${this.error};`+t}get names(){return this.error.names}},hs=class extends nt{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=zt(this.code,t,r),this}get names(){return this.code instanceof Y._CodeOrName?this.code.names:{}}},lr=class extends nt{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)||(tl(t,o.names),n.splice(s,1));}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Pt(t,r.names),{})}},st=class extends lr{render(t){return "{"+t._n+super.render(t)+"}"+t._n}},ys=class extends lr{},Jt=class extends st{};Jt.kind="else";var Tt=class e extends st{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 Jt(n):n;}if(r)return t===false?r instanceof e?r:r.nodes:this.nodes.length?this:new e(qa(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=zt(this.condition,t,r),this}get names(){let t=super.names;return sn(t,this.condition),this.else&&Pt(t,this.else.names),t}};Tt.kind="if";var It=class extends st{};It.kind="for";var vs=class extends It{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=zt(this.iteration,t,r),this}get names(){return Pt(super.names,this.iteration.names)}},Ss=class extends It{constructor(t,r,n,s){super(),this.varKind=t,this.name=r,this.from=n,this.to=s;}render(t){let r=t.es5?ze.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=sn(super.names,this.from);return sn(t,this.to)}},nn=class extends It{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=zt(this.iterable,t,r),this}get names(){return Pt(super.names,this.iterable.names)}},fr=class extends st{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)}};fr.kind="func";var pr=class extends lr{render(t){return "return "+super.render(t)}};pr.kind="return";var ks=class extends st{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&&Pt(t,this.catch.names),this.finally&&Pt(t,this.finally.names),t}},mr=class extends st{constructor(t){super(),this.error=t;}render(t){return `catch(${this.error})`+super.render(t)}};mr.kind="catch";var gr=class extends st{render(t){return "finally"+super.render(t)}};gr.kind="finally";var ws=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=t,this._scope=new ze.Scope({parent:t}),this._nodes=[new ys];}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 ls(t,o,n)),o}const(t,r,n){return this._def(ze.varKinds.const,t,r,n)}let(t,r,n){return this._def(ze.varKinds.let,t,r,n)}var(t,r,n){return this._def(ze.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new rn(t,r,n))}add(t,r){return this._leafNode(new fs(t,G.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Y.nil&&this._leafNode(new hs(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, Y.addCodeArg)(r,s));return r.push("}"),new Y._Code(r)}if(t,r,n){if(this._blockNode(new Tt(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 Tt(t))}else(){return this._elseNode(new Jt)}endIf(){return this._endBlockNode(Tt,Jt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new vs(t),r)}forRange(t,r,n,s,o=this.opts.es5?ze.varKinds.var:ze.varKinds.let){let a=this._scope.toName(t);return this._for(new Ss(o,a,r,n),()=>s(a))}forOf(t,r,n,s=ze.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof Y.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, Y._)`${a}.length`,i=>{this.var(o,(0, Y._)`${a}[${i}]`),n(o);})}return this._for(new nn("of",s,o,r),()=>n(o))}forIn(t,r,n,s=this.opts.es5?ze.varKinds.var:ze.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0, Y._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new nn("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(It)}label(t){return this._leafNode(new ps(t))}break(t){return this._leafNode(new ms(t))}return(t){let r=new pr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(pr)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new ks;if(this._blockNode(s),this.code(t),r){let o=this.name("e");this._currNode=s.catch=new mr(o),r(o);}return n&&(this._currNode=s.finally=new gr,this.code(n)),this._endBlockNode(mr,gr)}throw(t){return this._leafNode(new gs(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=Y.nil,n,s){return this._blockNode(new fr(t,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(fr)}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 Tt))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;}};G.CodeGen=ws;function Pt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function sn(e,t){return t instanceof Y._CodeOrName?Pt(e,t.names):e}function zt(e,t,r){if(e instanceof Y.Name)return n(e);if(!s(e))return e;return new Y._Code(e._items.reduce((o,a)=>(a instanceof Y.Name&&(a=n(a)),a instanceof Y._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 Y._Code&&o._items.some(a=>a instanceof Y.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function tl(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0);}function qa(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0, Y._)`!${bs(e)}`}G.not=qa;var rl=Fa(G.operators.AND);function nl(...e){return e.reduce(rl)}G.and=nl;var sl=Fa(G.operators.OR);function ol(...e){return e.reduce(sl)}G.or=ol;function Fa(e){return (t,r)=>t===Y.nil?r:r===Y.nil?t:(0, Y._)`${bs(t)} ${e} ${bs(r)}`}function bs(e){return e instanceof Y.Name?e:(0, Y._)`(${e})`}});var Q=T(J=>{Object.defineProperty(J,"__esModule",{value:true});J.checkStrictMode=J.getErrorPath=J.Type=J.useFunc=J.setEvaluated=J.evaluatedPropsToName=J.mergeEvaluated=J.eachItem=J.unescapeJsonPointer=J.escapeJsonPointer=J.escapeFragment=J.unescapeFragment=J.schemaRefOrVal=J.schemaHasRulesButRef=J.schemaHasRules=J.checkUnknownRules=J.alwaysValidSchema=J.toHash=void 0;var se=U(),al=dr();function il(e){let t={};for(let r of e)t[r]=true;return t}J.toHash=il;function ul(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?true:(La(e,t),!Va(t,e.self.RULES.all))}J.alwaysValidSchema=ul;function La(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}"`);}J.checkUnknownRules=La;function Va(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(t[r])return true;return false}J.schemaHasRules=Va;function cl(e,t){if(typeof e=="boolean")return !e;for(let r in e)if(r!=="$ref"&&t.all[r])return true;return false}J.schemaHasRulesButRef=cl;function dl({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, se._)`${r}`}return (0, se._)`${e}${t}${(0, se.getProperty)(n)}`}J.schemaRefOrVal=dl;function ll(e){return Ba(decodeURIComponent(e))}J.unescapeFragment=ll;function fl(e){return encodeURIComponent(Rs(e))}J.escapeFragment=fl;function Rs(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}J.escapeJsonPointer=Rs;function Ba(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}J.unescapeJsonPointer=Ba;function pl(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e);}J.eachItem=pl;function Da({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return (s,o,a,i)=>{let c=a===void 0?o:a instanceof se.Name?(o instanceof se.Name?e(s,o,a):t(s,o,a),a):o instanceof se.Name?(t(s,a,o),o):r(o,a);return i===se.Name&&!(c instanceof se.Name)?n(s,c):c}}J.mergeEvaluated={props:Da({mergeNames:(e,t,r)=>e.if((0, se._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0, se._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0, se._)`${r} || {}`).code((0, se._)`Object.assign(${r}, ${t})`));}),mergeToName:(e,t,r)=>e.if((0, se._)`${r} !== true`,()=>{t===true?e.assign(r,true):(e.assign(r,(0, se._)`${r} || {}`),Cs(e,r,t));}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:Ka}),items:Da({mergeNames:(e,t,r)=>e.if((0, se._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0, se._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0, se._)`${r} !== true`,()=>e.assign(r,t===true?true:(0, se._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Ka(e,t){if(t===true)return e.var("props",true);let r=e.var("props",(0, se._)`{}`);return t!==void 0&&Cs(e,r,t),r}J.evaluatedPropsToName=Ka;function Cs(e,t,r){Object.keys(r).forEach(n=>e.assign((0, se._)`${t}${(0, se.getProperty)(n)}`,true));}J.setEvaluated=Cs;var Ma={};function ml(e,t){return e.scopeValue("func",{ref:t,code:Ma[t.code]||(Ma[t.code]=new al._Code(t.code))})}J.useFunc=ml;var _s;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str";})(_s||(J.Type=_s={}));function gl(e,t,r){if(e instanceof se.Name){let n=t===_s.Num;return r?n?(0, se._)`"[" + ${e} + "]"`:(0, se._)`"['" + ${e} + "']"`:n?(0, se._)`"/" + ${e}`:(0, se._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, se.getProperty)(e).toString():"/"+Rs(e)}J.getErrorPath=gl;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);}}J.checkStrictMode=Ga;});var ot=T($s=>{Object.defineProperty($s,"__esModule",{value:true});var ye=U(),hl={data:new ye.Name("data"),valCxt:new ye.Name("valCxt"),instancePath:new ye.Name("instancePath"),parentData:new ye.Name("parentData"),parentDataProperty:new ye.Name("parentDataProperty"),rootData:new ye.Name("rootData"),dynamicAnchors:new ye.Name("dynamicAnchors"),vErrors:new ye.Name("vErrors"),errors:new ye.Name("errors"),this:new ye.Name("this"),self:new ye.Name("self"),scope:new ye.Name("scope"),json:new ye.Name("json"),jsonPos:new ye.Name("jsonPos"),jsonLen:new ye.Name("jsonLen"),jsonPart:new ye.Name("jsonPart")};$s.default=hl;});var hr=T(ve=>{Object.defineProperty(ve,"__esModule",{value:true});ve.extendErrors=ve.resetErrorsCount=ve.reportExtraError=ve.reportError=ve.keyword$DataError=ve.keywordError=void 0;var Z=U(),an=Q(),_e=ot();ve.keywordError={message:({keyword:e})=>(0, Z.str)`must pass "${e}" keyword validation`};ve.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 yl(e,t=ve.keywordError,r,n){let{it:s}=e,{gen:o,compositeRule:a,allErrors:i}=s,c=za(e,t,r);n??(a||i)?Ua(o,c):Ja(s,(0, Z._)`[${c}]`);}ve.reportError=yl;function vl(e,t=ve.keywordError,r){let{it:n}=e,{gen:s,compositeRule:o,allErrors:a}=n,i=za(e,t,r);Ua(s,i),o||a||Ja(n,_e.default.vErrors);}ve.reportExtraError=vl;function Sl(e,t){e.assign(_e.default.errors,t),e.if((0, Z._)`${_e.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0, Z._)`${_e.default.vErrors}.length`,t),()=>e.assign(_e.default.vErrors,null)));}ve.resetErrorsCount=Sl;function kl({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,_e.default.errors,i=>{e.const(a,(0, Z._)`${_e.default.vErrors}[${i}]`),e.if((0, Z._)`${a}.instancePath === undefined`,()=>e.assign((0, Z._)`${a}.instancePath`,(0, Z.strConcat)(_e.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));});}ve.extendErrors=kl;function Ua(e,t){let r=e.const("err",t);e.if((0, Z._)`${_e.default.vErrors} === null`,()=>e.assign(_e.default.vErrors,(0, Z._)`[${r}]`),(0, Z._)`${_e.default.vErrors}.push(${r})`),e.code((0, Z._)`${_e.default.errors}++`);}function Ja(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 jt={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 za(e,t,r){let{createErrors:n}=e.it;return n===false?(0, Z._)`{}`:wl(e,t,r)}function wl(e,t,r={}){let{gen:n,it:s}=e,o=[bl(s,r),_l(e,r)];return Rl(e,t,o),n.object(...o)}function bl({errorPath:e},{instancePath:t}){let r=t?(0, Z.str)`${e}${(0, an.getErrorPath)(t,an.Type.Str)}`:e;return [_e.default.instancePath,(0, Z.strConcat)(_e.default.instancePath,r)]}function _l({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, an.getErrorPath)(r,an.Type.Str)}`),[jt.schemaPath,s]}function Rl(e,{params:t,message:r},n){let{keyword:s,data:o,schemaValue:a,it:i}=e,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:l}=i;n.push([jt.keyword,s],[jt.params,typeof t=="function"?t(e):t||(0, Z._)`{}`]),c.messages&&n.push([jt.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([jt.schema,a],[jt.parentSchema,(0, Z._)`${d}${l}`],[_e.default.data,o]),u&&n.push([jt.propertyName,u]);}});var Wa=T(Ht=>{Object.defineProperty(Ht,"__esModule",{value:true});Ht.boolOrEmptySchema=Ht.topBoolOrEmptySchema=void 0;var Cl=hr(),$l=U(),El=ot(),xl={message:"boolean schema is false"};function Al(e){let{gen:t,schema:r,validateName:n}=e;r===false?Ha(e,false):typeof r=="object"&&r.$async===true?t.return(El.default.data):(t.assign((0, $l._)`${n}.errors`,null),t.return(true));}Ht.topBoolOrEmptySchema=Al;function Tl(e,t){let{gen:r,schema:n}=e;n===false?(r.var(t,false),Ha(e)):r.var(t,true);}Ht.boolOrEmptySchema=Tl;function Ha(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, Cl.reportError)(s,xl,void 0,t);}});var Es=T(Wt=>{Object.defineProperty(Wt,"__esModule",{value:true});Wt.getRules=Wt.isJSONType=void 0;var Il=["string","number","integer","boolean","null","object","array"],Pl=new Set(Il);function jl(e){return typeof e=="string"&&Pl.has(e)}Wt.isJSONType=jl;function Ol(){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:{}}}Wt.getRules=Ol;});var xs=T(mt=>{Object.defineProperty(mt,"__esModule",{value:true});mt.shouldUseRule=mt.shouldUseGroup=mt.schemaHasRulesForType=void 0;function Nl({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==true&&Ya(e,n)}mt.schemaHasRulesForType=Nl;function Ya(e,t){return t.rules.some(r=>Xa(e,r))}mt.shouldUseGroup=Ya;function Xa(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))}mt.shouldUseRule=Xa;});var yr=T(Se=>{Object.defineProperty(Se,"__esModule",{value:true});Se.reportTypeError=Se.checkDataTypes=Se.checkDataType=Se.coerceAndCheckDataType=Se.getJSONTypes=Se.getSchemaTypes=Se.DataType=void 0;var ql=Es(),Fl=xs(),Dl=hr(),K=U(),Qa=Q(),Yt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong";})(Yt||(Se.DataType=Yt={}));function Ml(e){let t=Za(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}Se.getSchemaTypes=Ml;function Za(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(ql.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Se.getJSONTypes=Za;function Ll(e,t){let{gen:r,data:n,opts:s}=e,o=Vl(t,s.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0, Fl.schemaHasRulesForType)(e,t[0]));if(a){let i=Ts(t,n,s.strictNumbers,Yt.Wrong);r.if(i,()=>{o.length?Bl(e,t,o):Is(e);});}return a}Se.coerceAndCheckDataType=Ll;var ei=new Set(["string","number","integer","boolean","null"]);function Vl(e,t){return t?e.filter(r=>ei.has(r)||t==="array"&&r==="array"):[]}function Bl(e,t,r){let{gen:n,data:s,opts:o}=e,a=n.let("dataType",(0, K._)`typeof ${s}`),i=n.let("coerced",(0, K._)`undefined`);o.coerceTypes==="array"&&n.if((0, K._)`${a} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0, K._)`${s}[0]`).assign(a,(0, K._)`typeof ${s}`).if(Ts(t,s,o.strictNumbers),()=>n.assign(i,s))),n.if((0, K._)`${i} !== undefined`);for(let u of r)(ei.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),Is(e),n.endIf(),n.if((0, K._)`${i} !== undefined`,()=>{n.assign(s,i),Kl(e,i);});function c(u){switch(u){case "string":n.elseIf((0, K._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0, K._)`"" + ${s}`).elseIf((0, K._)`${s} === null`).assign(i,(0, K._)`""`);return;case "number":n.elseIf((0, K._)`${a} == "boolean" || ${s} === null
|
|
3
3
|
|| (${a} == "string" && ${s} && ${s} == +${s})`).assign(i,(0, K._)`+${s}`);return;case "integer":n.elseIf((0, K._)`${a} === "boolean" || ${s} === null
|
|
4
4
|
|| (${a} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(i,(0, K._)`+${s}`);return;case "boolean":n.elseIf((0, K._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(i,false).elseIf((0, K._)`${s} === "true" || ${s} === 1`).assign(i,true);return;case "null":n.elseIf((0, K._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(i,null);return;case "array":n.elseIf((0, K._)`${a} === "string" || ${a} === "number"
|
|
5
|
-
|| ${a} === "boolean" || ${s} === null`).assign(i,(0, K._)`[${s}]`);}}}function Ml({gen:e,parentData:t,parentDataProperty:r},n){e.if((0, K._)`${t} !== undefined`,()=>e.assign((0, K._)`${t}[${r}]`,n));}function Es(e,t,r,n=zt.Correct){let s=n===zt.Correct?K.operators.EQ:K.operators.NEQ,o;switch(e){case "null":return (0, K._)`${t} ${s} null`;case "array":o=(0, K._)`Array.isArray(${t})`;break;case "object":o=(0, K._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case "integer":o=a((0, K._)`!(${t} % 1) && !isNaN(${t})`);break;case "number":o=a();break;default:return (0, K._)`typeof ${t} ${s} ${e}`}return n===zt.Correct?o:(0, K.not)(o);function a(i=K.nil){return (0, K.and)((0, K._)`typeof ${t} == "number"`,i,r?(0, K._)`isFinite(${t})`:K.nil)}}Se.checkDataType=Es;function xs(e,t,r,n){if(e.length===1)return Es(e[0],t,r,n);let s,o=(0, Wa.toHash)(e);if(o.array&&o.object){let a=(0, K._)`typeof ${t} != "object"`;s=o.null?a:(0, K._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object;}else s=K.nil;o.number&&delete o.integer;for(let a in o)s=(0, K.and)(s,Es(a,t,r,n));return s}Se.checkDataTypes=xs;var Ll={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0, K._)`{type: ${e}}`:(0, K._)`{type: ${t}}`};function Ts(e){let t=Vl(e);(0, jl.reportError)(t,Ll);}Se.reportTypeError=Ts;function Vl(e){let{gen:t,data:r,schema:n}=e,s=(0, Wa.schemaRefOrVal)(e,n,"type");return {gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var Za=T(an=>{Object.defineProperty(an,"__esModule",{value:true});an.assignDefaults=void 0;var Ht=U(),Bl=X();function Kl(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)Qa(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Qa(e,o,s.default));}an.assignDefaults=Kl;function Qa(e,t,r){let{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;let i=(0, Ht._)`${o}${(0, Ht.getProperty)(t)}`;if(s){(0, Bl.checkStrictMode)(e,`default is ignored for: ${i}`);return}let c=(0, Ht._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0, Ht._)`${c} || ${i} === null || ${i} === ""`),n.if(c,(0, Ht._)`${i} = ${(0, Ht.stringify)(r)}`);}});var Le=T(ne=>{Object.defineProperty(ne,"__esModule",{value:true});ne.validateUnion=ne.validateArray=ne.usePattern=ne.callValidateCode=ne.schemaProperties=ne.allSchemaProperties=ne.noPropertyInData=ne.propertyInData=ne.isOwnProperty=ne.hasPropFunc=ne.reportMissingProp=ne.checkMissingProp=ne.checkReportMissingProp=void 0;var ie=U(),As=X(),mt=at(),Gl=X();function Ul(e,t){let{gen:r,data:n,it:s}=e;r.if(Ps(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0, ie._)`${t}`},true),e.error();});}ne.checkReportMissingProp=Ul;function Jl({gen:e,data:t,it:{opts:r}},n,s){return (0, ie.or)(...n.map(o=>(0, ie.and)(Ps(e,t,o,r.ownProperties),(0, ie._)`${s} = ${o}`)))}ne.checkMissingProp=Jl;function zl(e,t){e.setParams({missingProperty:t},true),e.error();}ne.reportMissingProp=zl;function ei(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, ie._)`Object.prototype.hasOwnProperty`})}ne.hasPropFunc=ei;function Is(e,t,r){return (0, ie._)`${ei(e)}.call(${t}, ${r})`}ne.isOwnProperty=Is;function Hl(e,t,r,n){let s=(0, ie._)`${t}${(0, ie.getProperty)(r)} !== undefined`;return n?(0, ie._)`${s} && ${Is(e,t,r)}`:s}ne.propertyInData=Hl;function Ps(e,t,r,n){let s=(0, ie._)`${t}${(0, ie.getProperty)(r)} === undefined`;return n?(0, ie.or)(s,(0, ie.not)(Is(e,t,r))):s}ne.noPropertyInData=Ps;function ti(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ne.allSchemaProperties=ti;function Wl(e,t){return ti(t).filter(r=>!(0, As.alwaysValidSchema)(e,t[r]))}ne.schemaProperties=Wl;function Yl({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,c,u){let d=u?(0, ie._)`${e}, ${t}, ${n}${s}`:t,l=[[mt.default.instancePath,(0, ie.strConcat)(mt.default.instancePath,o)],[mt.default.parentData,a.parentData],[mt.default.parentDataProperty,a.parentDataProperty],[mt.default.rootData,mt.default.rootData]];a.opts.dynamicRef&&l.push([mt.default.dynamicAnchors,mt.default.dynamicAnchors]);let m=(0, ie._)`${d}, ${r.object(...l)}`;return c!==ie.nil?(0, ie._)`${i}.call(${c}, ${m})`:(0, ie._)`${i}(${m})`}ne.callValidateCode=Yl;var Xl=(0, ie._)`new RegExp`;function Ql({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, ie._)`${s.code==="new RegExp"?Xl:(0, Gl.useFunc)(e,s)}(${r}, ${n})`})}ne.usePattern=Ql;function Zl(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 c=t.const("len",(0, ie._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:As.Type.Num},o),t.if((0, ie.not)(o),i);});}}ne.validateArray=Zl;function ef(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0, As.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let a=t.let("valid",false),i=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:n,schemaProp:u,compositeRule:true},i);t.assign(a,(0, ie._)`${a} || ${i}`),e.mergeValidEvaluated(d,i)||t.if((0, ie.not)(a));})),e.result(a,()=>e.reset(),()=>e.error(true));}ne.validateUnion=ef;});var si=T(Xe=>{Object.defineProperty(Xe,"__esModule",{value:true});Xe.validateKeywordUsage=Xe.validSchemaType=Xe.funcKeywordCode=Xe.macroKeywordCode=void 0;var Re=U(),jt=at(),tf=Le(),rf=gr();function nf(e,t){let{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),c=ni(r,n,i);a.opts.validateSchema!==false&&a.self.validateSchema(i,true);let u=r.name("valid");e.subschema({schema:i,schemaPath:Re.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:true},u),e.pass(u,()=>e.error(true));}Xe.macroKeywordCode=nf;function sf(e,t){var r;let{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:c}=e;af(c,t);let u=!i&&t.compile?t.compile.call(c.self,o,a,c):t.validate,d=ni(n,s,u),l=n.let("valid");e.block$data(l,m),e.ok((r=t.valid)!==null&&r!==void 0?r:l);function m(){if(t.errors===false)p(),t.modifying&&ri(e),S(()=>e.error());else {let _=t.async?g():f();t.modifying&&ri(e),S(()=>of(e,_));}}function g(){let _=n.let("ruleErrs",null);return n.try(()=>p((0, Re._)`await `),w=>n.assign(l,false).if((0, Re._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(_,(0, Re._)`${w}.errors`),()=>n.throw(w))),_}function f(){let _=(0, Re._)`${d}.errors`;return n.assign(_,null),p(Re.nil),_}function p(_=t.async?(0, Re._)`await `:Re.nil){let w=c.opts.passContext?jt.default.this:jt.default.self,R=!("compile"in t&&!i||t.schema===false);n.assign(l,(0, Re._)`${_}${(0, tf.callValidateCode)(e,d,w,R)}`,t.modifying);}function S(_){var w;n.if((0, Re.not)((w=t.valid)!==null&&w!==void 0?w:l),_);}}Xe.funcKeywordCode=sf;function ri(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0, Re._)`${n.parentData}[${n.parentDataProperty}]`));}function of(e,t){let{gen:r}=e;r.if((0, Re._)`Array.isArray(${t})`,()=>{r.assign(jt.default.vErrors,(0, Re._)`${jt.default.vErrors} === null ? ${t} : ${jt.default.vErrors}.concat(${t})`).assign(jt.default.errors,(0, Re._)`${jt.default.vErrors}.length`),(0, rf.extendErrors)(e);},()=>e.error());}function af({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function ni(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, Re.stringify)(r)})}function uf(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")}Xe.validSchemaType=uf;function cf({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 c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Xe.validateKeywordUsage=cf;});var ai=T(gt=>{Object.defineProperty(gt,"__esModule",{value:true});gt.extendSubschemaMode=gt.extendSubschemaData=gt.getSubschema=void 0;var Qe=U(),oi=X();function df(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, Qe._)`${e.schemaPath}${(0, Qe.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0, Qe._)`${e.schemaPath}${(0, Qe.getProperty)(t)}${(0, Qe.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0, oi.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')}gt.getSubschema=df;function lf(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:u,dataPathArr:d,opts:l}=t,m=i.let("data",(0, Qe._)`${t.data}${(0, Qe.getProperty)(r)}`,true);c(m),e.errorPath=(0, Qe.str)`${u}${(0, oi.getErrorPath)(r,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0, Qe._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty];}if(s!==void 0){let u=s instanceof Qe.Name?s:i.let("data",s,true);c(u),a!==void 0&&(e.propertyName=a);}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u];}}gt.extendSubschemaData=lf;function ff(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;}gt.extendSubschemaMode=ff;});var Os=T((dv,ii)=>{ii.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 ci=T((lv,ui)=>{var ht=ui.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(){};un(t,n,s,e,"",e);};ht.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};ht.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};ht.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};ht.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 un(e,t,r,n,s,o,a,i,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,c,u);for(var d in n){var l=n[d];if(Array.isArray(l)){if(d in ht.arrayKeywords)for(var m=0;m<l.length;m++)un(e,t,r,l[m],s+"/"+d+"/"+m,o,s,d,n,m);}else if(d in ht.propsKeywords){if(l&&typeof l=="object")for(var g in l)un(e,t,r,l[g],s+"/"+d+"/"+pf(g),o,s,d,n,g);}else (d in ht.keywords||e.allKeys&&!(d in ht.skipKeywords))&&un(e,t,r,l,s+"/"+d,o,s,d,n);}r(n,s,o,a,i,c,u);}}function pf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var yr=T(Ie=>{Object.defineProperty(Ie,"__esModule",{value:true});Ie.getSchemaRefs=Ie.resolveUrl=Ie.normalizeId=Ie._getFullPath=Ie.getFullPath=Ie.inlineRef=void 0;var mf=X(),gf=Os(),hf=ci(),yf=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vf(e,t=true){return typeof e=="boolean"?true:t===true?!js(e):t?di(e)<=t:false}Ie.inlineRef=vf;var Sf=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function js(e){for(let t in e){if(Sf.has(t))return true;let r=e[t];if(Array.isArray(r)&&r.some(js)||typeof r=="object"&&js(r))return true}return false}function di(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!yf.has(r)&&(typeof e[r]=="object"&&(0, mf.eachItem)(e[r],n=>t+=di(n)),t===1/0))return 1/0}return t}function li(e,t="",r){r!==false&&(t=Wt(t));let n=e.parse(t);return fi(e,n)}Ie.getFullPath=li;function fi(e,t){return e.serialize(t).split("#")[0]+"#"}Ie._getFullPath=fi;var kf=/#\/?$/;function Wt(e){return e?e.replace(kf,""):""}Ie.normalizeId=Wt;function wf(e,t,r){return r=Wt(r),e.resolve(t,r)}Ie.resolveUrl=wf;var bf=/^[a-z_][-a-z0-9._]*$/i;function _f(e,t){if(typeof e=="boolean")return {};let{schemaId:r,uriResolver:n}=this.opts,s=Wt(e[r]||t),o={"":s},a=li(n,s,false),i={},c=new Set;return hf(e,{allKeys:true},(l,m,g,f)=>{if(f===void 0)return;let p=a+m,S=o[f];typeof l[r]=="string"&&(S=_.call(this,l[r])),w.call(this,l.$anchor),w.call(this,l.$dynamicAnchor),o[m]=S;function _(R){let j=this.opts.uriResolver.resolve;if(R=Wt(S?j(S,R):R),c.has(R))throw d(R);c.add(R);let v=this.refs[R];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?u(l,v.schema,R):R!==Wt(p)&&(R[0]==="#"?(u(l,i[R],R),i[R]=l):this.refs[R]=p),R}function w(R){if(typeof R=="string"){if(!bf.test(R))throw new Error(`invalid anchor "${R}"`);_.call(this,`#${R}`);}}}),i;function u(l,m,g){if(m!==void 0&&!gf(l,m))throw d(g)}function d(l){return new Error(`reference "${l}" resolves to more than one schema`)}}Ie.getSchemaRefs=_f;});var kr=T(yt=>{Object.defineProperty(yt,"__esModule",{value:true});yt.getData=yt.KeywordCxt=yt.validateFunctionCode=void 0;var yi=Ja(),pi=hr(),qs=$s(),cn=hr(),Rf=Za(),Sr=si(),Ns=ai(),O=U(),V=at(),Cf=yr(),it=X(),vr=gr();function $f(e){if(ki(e)&&(wi(e),Si(e))){Tf(e);return}vi(e,()=>(0, yi.topBoolOrEmptySchema)(e));}yt.validateFunctionCode=$f;function vi({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0, O._)`${V.default.data}, ${V.default.valCxt}`,n.$async,()=>{e.code((0, O._)`"use strict"; ${mi(r,s)}`),xf(e,s),e.code(o);}):e.func(t,(0, O._)`${V.default.data}, ${Ef(s)}`,n.$async,()=>e.code(mi(r,s)).code(o));}function Ef(e){return (0, O._)`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${e.dynamicRef?(0, O._)`, ${V.default.dynamicAnchors}={}`:O.nil}}={}`}function xf(e,t){e.if(V.default.valCxt,()=>{e.var(V.default.instancePath,(0, O._)`${V.default.valCxt}.${V.default.instancePath}`),e.var(V.default.parentData,(0, O._)`${V.default.valCxt}.${V.default.parentData}`),e.var(V.default.parentDataProperty,(0, O._)`${V.default.valCxt}.${V.default.parentDataProperty}`),e.var(V.default.rootData,(0, O._)`${V.default.valCxt}.${V.default.rootData}`),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0, O._)`${V.default.valCxt}.${V.default.dynamicAnchors}`);},()=>{e.var(V.default.instancePath,(0, O._)`""`),e.var(V.default.parentData,(0, O._)`undefined`),e.var(V.default.parentDataProperty,(0, O._)`undefined`),e.var(V.default.rootData,V.default.data),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0, O._)`{}`);});}function Tf(e){let{schema:t,opts:r,gen:n}=e;vi(e,()=>{r.$comment&&t.$comment&&_i(e),jf(e),n.let(V.default.vErrors,null),n.let(V.default.errors,0),r.unevaluated&&Af(e),bi(e),Ff(e);});}function Af(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0, O._)`${r}.evaluated`),t.if((0, O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0, O._)`${e.evaluated}.props`,(0, O._)`undefined`)),t.if((0, O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0, O._)`${e.evaluated}.items`,(0, O._)`undefined`));}function mi(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0, O._)`/*# sourceURL=${r} */`:O.nil}function If(e,t){if(ki(e)&&(wi(e),Si(e))){Pf(e,t);return}(0, yi.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 ki(e){return typeof e.schema!="boolean"}function Pf(e,t){let{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&_i(e),Nf(e),qf(e);let o=n.const("_errs",V.default.errors);bi(e,o),n.var(t,(0, O._)`${o} === ${V.default.errors}`);}function wi(e){(0, it.checkUnknownRules)(e),Of(e);}function bi(e,t){if(e.opts.jtd)return gi(e,[],false,t);let r=(0, pi.getSchemaTypes)(e.schema),n=(0, pi.coerceAndCheckDataType)(e,r);gi(e,r,!n,t);}function Of(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0, it.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function jf(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, it.checkStrictMode)(e,"default is ignored in the schema root");}function Nf(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0, Cf.resolveUrl)(e.opts.uriResolver,e.baseId,t));}function qf(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function _i({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===true)e.code((0, O._)`${V.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let a=(0, O.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0, O._)`${V.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`);}}function Ff(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0, O._)`${V.default.errors} === 0`,()=>t.return(V.default.data),()=>t.throw((0, O._)`new ${s}(${V.default.vErrors})`)):(t.assign((0, O._)`${n}.errors`,V.default.vErrors),o.unevaluated&&Df(e),t.return((0, O._)`${V.default.errors} === 0`));}function Df({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0, O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0, O._)`${t}.items`,n);}function gi(e,t,r,n){let{gen:s,schema:o,data:a,allErrors:i,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0, it.schemaHasRulesButRef)(o,d))){s.block(()=>Ci(e,"$ref",d.all.$ref.definition));return}c.jtd||Mf(e,t),s.block(()=>{for(let m of d.rules)l(m);l(d.post);});function l(m){(0, qs.shouldUseGroup)(o,m)&&(m.type?(s.if((0, cn.checkDataType)(m.type,a,c.strictNumbers)),hi(e,m),t.length===1&&t[0]===m.type&&r&&(s.else(),(0, cn.reportTypeError)(e)),s.endIf()):hi(e,m),i||s.if((0, O._)`${V.default.errors} === ${n||0}`));}}function hi(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0, Rf.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0, qs.shouldUseRule)(n,o)&&Ci(e,o.keyword,o.definition,t.type);});}function Mf(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Lf(e,t),e.opts.allowUnionTypes||Vf(e,t),Bf(e,e.dataTypes));}function Lf(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Ri(e.dataTypes,r)||Fs(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`);}),Gf(e,t);}}function Vf(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Fs(e,"use allowUnionTypes to allow union type keyword");}function Bf(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0, qs.shouldUseRule)(e.schema,s)){let{type:o}=s.definition;o.length&&!o.some(a=>Kf(t,a))&&Fs(e,`missing type "${o.join(",")}" for keyword "${n}"`);}}}function Kf(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Ri(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Gf(e,t){let r=[];for(let n of e.dataTypes)Ri(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r;}function Fs(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0, it.checkStrictMode)(e,t,e.opts.strictTypes);}var dn=class{constructor(t,r,n){if((0, Sr.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, it.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",$i(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0, Sr.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",V.default.errors));}result(t,r,n){this.failResult((0, O.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, O.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, O._)`${r} !== undefined && (${(0, O.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?vr.reportExtraError:vr.reportError)(this,this.def.error,r);}$dataError(){(0, vr.reportError)(this,this.def.$dataError||vr.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, vr.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=O.nil){this.gen.block(()=>{this.check$data(t,n),r();});}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0, O.or)((0, O._)`${s} === undefined`,r)),t!==O.nil&&n.assign(t,true),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,false)),n.else();}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return (0, O.or)(a(),i());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return (0, O._)`${(0, cn.checkDataTypes)(c,r,o.opts.strictNumbers,cn.DataType.Wrong)}`}return O.nil}function i(){if(s.validateSchema){let c=t.scopeValue("validate$data",{ref:s.validateSchema});return (0, O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0, Ns.getSubschema)(this.it,t);(0, Ns.extendSubschemaData)(n,this.it,t),(0, Ns.extendSubschemaMode)(n,t);let s={...this.it,...n,items:void 0,props:void 0};return If(s,r),s}mergeEvaluated(t,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==true&&t.props!==void 0&&(n.props=it.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==true&&t.items!==void 0&&(n.items=it.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,O.Name)),true}};yt.KeywordCxt=dn;function Ci(e,t,r,n){let s=new dn(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0, Sr.funcKeywordCode)(s,r):"macro"in r?(0, Sr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0, Sr.funcKeywordCode)(s,r);}var Uf=/^\/(?:[^~]|~0|~1)*$/,Jf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $i(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return V.default.rootData;if(e[0]==="/"){if(!Uf.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=V.default.rootData;}else {let u=Jf.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(s=u[2],s==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(o=r[t-d],!s)return o}let a=o,i=s.split("/");for(let u of i)u&&(o=(0, O._)`${o}${(0, O.getProperty)((0, it.unescapeJsonPointer)(u))}`,a=(0, O._)`${a} && ${o}`);return a;function c(u,d){return `Cannot access ${u} ${d} levels up, current level is ${t}`}}yt.getData=$i;});var ln=T(Ms=>{Object.defineProperty(Ms,"__esModule",{value:true});var Ds=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=true;}};Ms.default=Ds;});var wr=T(Bs=>{Object.defineProperty(Bs,"__esModule",{value:true});var Ls=yr(),Vs=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0, Ls.resolveUrl)(t,r,n),this.missingSchema=(0, Ls.normalizeId)((0, Ls.getFullPath)(t,this.missingRef));}};Bs.default=Vs;});var pn=T(Ve=>{Object.defineProperty(Ve,"__esModule",{value:true});Ve.resolveSchema=Ve.getCompilingSchema=Ve.resolveRef=Ve.compileSchema=Ve.SchemaEnv=void 0;var He=U(),zf=ln(),Nt=at(),We=yr(),Ei=X(),Hf=kr(),Yt=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, We.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={};}};Ve.SchemaEnv=Yt;function Gs(e){let t=xi.call(this,e);if(t)return t;let r=(0, We.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new He.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),i;e.$async&&(i=a.scopeValue("Error",{ref:zf.default,code:(0, He._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Nt.default.data,parentData:Nt.default.parentData,parentDataProperty:Nt.default.parentDataProperty,dataNames:[Nt.default.data],dataPathArr:[He.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0, He.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:He.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, He._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,Hf.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let l=a.toString();d=`${a.scopeRefs(Nt.default.scope)}return ${l}`,this.opts.code.process&&(d=this.opts.code.process(d,e));let g=new Function(`${Nt.default.self}`,`${Nt.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{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:c,validateCode:l,scopeValues:a._values}),this.opts.unevaluated){let{props:f,items:p}=u;g.evaluated={props:f instanceof He.Name?void 0:f,items:p instanceof He.Name?void 0:p,dynamicProps:f instanceof He.Name,dynamicItems:p instanceof He.Name},g.source&&(g.source.evaluated=(0,He.stringify)(g.evaluated));}return e.validate=g,e}catch(l){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),l}finally{this._compilations.delete(e);}}Ve.compileSchema=Gs;function Wf(e,t,r){var n;r=(0, We.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=Qf.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 Yt({schema:a,schemaId:i,root:e,baseId:t}));}if(o!==void 0)return e.refs[r]=Yf.call(this,o)}Ve.resolveRef=Wf;function Yf(e){return (0, We.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Gs.call(this,e)}function xi(e){for(let t of this._compilations)if(Xf(t,e))return t}Ve.getCompilingSchema=xi;function Xf(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Qf(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||fn.call(this,e,t)}function fn(e,t){let r=this.opts.uriResolver.parse(t),n=(0, We._getFullPath)(this.opts.uriResolver,r),s=(0, We.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Ks.call(this,r,e);let o=(0, We.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=fn.call(this,e,a);return typeof i?.schema!="object"?void 0:Ks.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Gs.call(this,a),o===(0, We.normalizeId)(t)){let{schema:i}=a,{schemaId:c}=this.opts,u=i[c];return u&&(s=(0, We.resolveUrl)(this.opts.uriResolver,s,u)),new Yt({schema:i,schemaId:c,root:e,baseId:s})}return Ks.call(this,r,a)}}Ve.resolveSchema=fn;var Zf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ks(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 c=r[(0, Ei.unescapeFragment)(i)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Zf.has(i)&&u&&(t=(0, We.resolveUrl)(this.opts.uriResolver,t,u));}let o;if(typeof r!="boolean"&&r.$ref&&!(0, Ei.schemaHasRulesButRef)(r,this.RULES)){let i=(0, We.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=fn.call(this,n,i);}let{schemaId:a}=this.opts;if(o=o||new Yt({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var Ti=T((yv,ep)=>{ep.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 Js=T((vv,Oi)=>{var tp=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Ii=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 Us(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 rp=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ai(e){return e.length=0,true}function np(e,t,r){if(e.length){let n=Us(e);if(n!=="")t.push(n);else return r.error=true,false;e.length=0;}return true}function sp(e){let t=0,r={error:false,address:"",zone:""},n=[],s=[],o=false,a=false,i=np;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(o===true&&(a=true),!i(s,n,r))break;if(++t>7){r.error=true;break}c>0&&e[c-1]===":"&&(o=true),n.push(":");continue}else if(u==="%"){if(!i(s,n,r))break;i=Ai;}else {s.push(u);continue}}return s.length&&(i===Ai?r.zone=s.join(""):a?n.push(s.join("")):n.push(Us(s))),r.address=n.join(""),r}function Pi(e){if(op(e,":")<2)return {host:e,isIPV6:false};let t=sp(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 op(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function ap(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 ip(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 up(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Ii(r)){let n=Pi(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}Oi.exports={nonSimpleDomain:rp,recomposeAuthority:up,normalizeComponentEncoding:ip,removeDotSegments:ap,isIPv4:Ii,isUUID:tp,normalizeIPv6:Pi,stringArrayToHexStripped:Us};});var Di=T((Sv,Fi)=>{var{isUUID:cp}=Js(),dp=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,lp=["http","https","ws","wss","urn","urn:uuid"];function fp(e){return lp.indexOf(e)!==-1}function zs(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 ji(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Ni(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 pp(e){return e.secure=zs(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function mp(e){if((e.port===(zs(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 gp(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(dp);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=Hs(s);e.path=void 0,o&&(e=o.parse(e,t));}else e.error=e.error||"URN can not be parsed.";return e}function hp(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=Hs(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 yp(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!cp(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function vp(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var qi={scheme:"http",domainHost:true,parse:ji,serialize:Ni},Sp={scheme:"https",domainHost:qi.domainHost,parse:ji,serialize:Ni},mn={scheme:"ws",domainHost:true,parse:pp,serialize:mp},kp={scheme:"wss",domainHost:mn.domainHost,parse:mn.parse,serialize:mn.serialize},wp={scheme:"urn",parse:gp,serialize:hp,skipNormalize:true},bp={scheme:"urn:uuid",parse:yp,serialize:vp,skipNormalize:true},gn={http:qi,https:Sp,ws:mn,wss:kp,urn:wp,"urn:uuid":bp};Object.setPrototypeOf(gn,null);function Hs(e){return e&&(gn[e]||gn[e.toLowerCase()])||void 0}Fi.exports={wsIsSecure:zs,SCHEMES:gn,isValidSchemeName:fp,getSchemeHandler:Hs};});var Vi=T((kv,yn)=>{var{normalizeIPv6:_p,removeDotSegments:br,recomposeAuthority:Rp,normalizeComponentEncoding:hn,isIPv4:Cp,nonSimpleDomain:$p}=Js(),{SCHEMES:Ep,getSchemeHandler:Mi}=Di();function xp(e,t){return typeof e=="string"?e=Ze(ut(e,t),t):typeof e=="object"&&(e=ut(Ze(e,t),t)),e}function Tp(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=Li(ut(e,n),ut(t,n),n,true);return n.skipEscape=true,Ze(s,n)}function Li(e,t,r,n){let s={};return n||(e=ut(Ze(e,r),r),t=ut(Ze(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=br(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=br(t.path||""),s.query=t.query):(t.path?(t.path[0]==="/"?s.path=br(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=br(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 Ap(e,t,r){return typeof e=="string"?(e=unescape(e),e=Ze(hn(ut(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=Ze(hn(e,true),{...r,skipEscape:true})),typeof t=="string"?(t=unescape(t),t=Ze(hn(ut(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=Ze(hn(t,true),{...r,skipEscape:true})),e.toLowerCase()===t.toLowerCase()}function Ze(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=Rp(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=br(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 Ip=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ut(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(Ip);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(Cp(n.host)===false){let c=_p(n.host);n.host=c.host.toLowerCase(),s=c.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&&$p(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 Ws={SCHEMES:Ep,normalize:xp,resolve:Tp,resolveComponent:Li,equal:Ap,serialize:Ze,parse:ut};yn.exports=Ws;yn.exports.default=Ws;yn.exports.fastUri=Ws;});var Ki=T(Ys=>{Object.defineProperty(Ys,"__esModule",{value:true});var Bi=Vi();Bi.code='require("ajv/dist/runtime/uri").default';Ys.default=Bi;});var Xi=T(ge=>{Object.defineProperty(ge,"__esModule",{value:true});ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=void 0;var Pp=kr();Object.defineProperty(ge,"KeywordCxt",{enumerable:true,get:function(){return Pp.KeywordCxt}});var Xt=U();Object.defineProperty(ge,"_",{enumerable:true,get:function(){return Xt._}});Object.defineProperty(ge,"str",{enumerable:true,get:function(){return Xt.str}});Object.defineProperty(ge,"stringify",{enumerable:true,get:function(){return Xt.stringify}});Object.defineProperty(ge,"nil",{enumerable:true,get:function(){return Xt.nil}});Object.defineProperty(ge,"Name",{enumerable:true,get:function(){return Xt.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:true,get:function(){return Xt.CodeGen}});var Op=ln(),Hi=wr(),jp=Cs(),_r=pn(),Np=U(),Rr=yr(),vn=hr(),Qs=X(),Gi=Ti(),qp=Ki(),Wi=(e,t)=>new RegExp(e,t);Wi.code="new RegExp";var Fp=["removeAdditional","useDefaults","coerceTypes"],Dp=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Mp={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."},Lp={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ui=200;function Vp(e){var t,r,n,s,o,a,i,c,u,d,l,m,g,f,p,S,_,w,R,j,v,h,k,$,E;let x=e.strict,I=(t=e.code)===null||t===void 0?void 0:t.optimize,F=I===true||I===void 0?1:I||0,N=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Wi,pe=(s=e.uriResolver)!==null&&s!==void 0?s:qp.default;return {strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:x)!==null&&a!==void 0?a:true,strictNumbers:(c=(i=e.strictNumbers)!==null&&i!==void 0?i:x)!==null&&c!==void 0?c:true,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:x)!==null&&d!==void 0?d:"log",strictTuples:(m=(l=e.strictTuples)!==null&&l!==void 0?l:x)!==null&&m!==void 0?m:"log",strictRequired:(f=(g=e.strictRequired)!==null&&g!==void 0?g:x)!==null&&f!==void 0?f:false,code:e.code?{...e.code,optimize:F,regExp:N}:{optimize:F,regExp:N},loopRequired:(p=e.loopRequired)!==null&&p!==void 0?p:Ui,loopEnum:(S=e.loopEnum)!==null&&S!==void 0?S:Ui,meta:(_=e.meta)!==null&&_!==void 0?_:true,messages:(w=e.messages)!==null&&w!==void 0?w:true,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:true,schemaId:(j=e.schemaId)!==null&&j!==void 0?j:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:true,validateSchema:(h=e.validateSchema)!==null&&h!==void 0?h:true,validateFormats:(k=e.validateFormats)!==null&&k!==void 0?k:true,unicodeRegExp:($=e.unicodeRegExp)!==null&&$!==void 0?$:true,int32range:(E=e.int32range)!==null&&E!==void 0?E:true,uriResolver:pe}}var Cr=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Vp(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Np.ValueScope({scope:{},prefixes:Dp,es5:r,lines:n}),this.logger=zp(t.logger);let s=t.validateFormats;t.validateFormats=false,this.RULES=(0, jp.getRules)(),Ji.call(this,Mp,t,"NOT SUPPORTED"),Ji.call(this,Lp,t,"DEPRECATED","warn"),this._metaOpts=Up.call(this),t.formats&&Kp.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Gp.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Bp.call(this),t.validateFormats=s;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,s=Gi;n==="id"&&(s={...Gi},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(d,l){await o.call(this,d.$schema);let m=this._addSchema(d,l);return m.validate||a.call(this,m)}async function o(d){d&&!this.getSchema(d)&&await s.call(this,{$ref:d},true);}async function a(d){try{return this._compileSchemaEnv(d)}catch(l){if(!(l instanceof Hi.default))throw l;return i.call(this,l),await c.call(this,l.missingSchema),a.call(this,d)}}function i({missingSchema:d,missingRef:l}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${l} cannot be resolved`)}async function c(d){let l=await u.call(this,d);this.refs[d]||await o.call(this,l.$schema),this.refs[d]||this.addSchema(l,d,r);}async function u(d){let l=this._loading[d];if(l)return l;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d];}}}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, Rr.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=zi.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,s=new _r.SchemaEnv({schema:{},schemaId:n});if(r=_r.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=zi.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, Rr.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, Qs.eachItem)(n,o=>Xs.call(this,o)),this;Xp.call(this,r);let s={...r,type:(0, vn.getJSONTypes)(r.type),schemaType:(0, vn.getJSONTypes)(r.schemaType)};return (0, Qs.eachItem)(n,s.type.length===0?o=>Xs.call(this,o,s):o=>s.type.forEach(a=>Xs.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 c=n[i];if(typeof c!="object")continue;let{$data:u}=c.definition,d=a[i];u&&d&&(a[i]=Yi(d));}}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 c=this._cache.get(t);if(c!==void 0)return c;n=(0, Rr.normalizeId)(a||n);let u=Rr.getSchemaRefs.call(this,t,n);return c=new _r.SchemaEnv({schema:t,schemaId:i,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(t,true),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):_r.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{_r.compileSchema.call(this,t);}finally{this.opts=r;}}};Cr.ValidationError=Op.default;Cr.MissingRefError=Hi.default;ge.default=Cr;function Ji(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 zi(e){return e=(0, Rr.normalizeId)(e),this.schemas[e]||this.refs[e]}function Bp(){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 Kp(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t);}}function Gp(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 Up(){let e={...this.opts};for(let t of Fp)delete e[t];return e}var Jp={log(){},warn(){},error(){}};function zp(e){if(e===false)return Jp;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 Hp=/^[a-z_$][a-z0-9_$:-]*$/i;function Wp(e,t){let{RULES:r}=this;if((0, Qs.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Hp.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 Xs(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:c})=>c===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, vn.getJSONTypes)(t.type),schemaType:(0, vn.getJSONTypes)(t.schemaType)}};t.before?Yp.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c));}function Yp(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 Xp(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Yi(t)),e.validateSchema=this.compile(t,true));}var Qp={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Yi(e){return {anyOf:[e,Qp]}}});var Qi=T(Zs=>{Object.defineProperty(Zs,"__esModule",{value:true});var Zp={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zs.default=Zp;});var ru=T(qt=>{Object.defineProperty(qt,"__esModule",{value:true});qt.callRef=qt.getValidate=void 0;var em=wr(),Zi=Le(),Pe=U(),Qt=at(),eu=pn(),Sn=X(),tm={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return l();let d=eu.resolveRef.call(c,u,s,r);if(d===void 0)throw new em.default(n.opts.uriResolver,s,r);if(d instanceof eu.SchemaEnv)return m(d);return g(d);function l(){if(o===u)return kn(e,a,o,o.$async);let f=t.scopeValue("root",{ref:u});return kn(e,(0, Pe._)`${f}.validate`,u,u.$async)}function m(f){let p=tu(e,f);kn(e,p,f,f.$async);}function g(f){let p=t.scopeValue("schema",i.code.source===true?{ref:f,code:(0, Pe.stringify)(f)}:{ref:f}),S=t.name("valid"),_=e.subschema({schema:f,dataTypes:[],schemaPath:Pe.nil,topSchemaRef:p,errSchemaPath:r},S);e.mergeEvaluated(_),e.ok(S);}}};function tu(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0, Pe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qt.getValidate=tu;function kn(e,t,r,n){let{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:c}=o,u=c.passContext?Qt.default.this:Pe.nil;n?d():l();function d(){if(!i.$async)throw new Error("async schema referenced by sync schema");let f=s.let("valid");s.try(()=>{s.code((0, Pe._)`await ${(0, Zi.callValidateCode)(e,t,u)}`),g(t),a||s.assign(f,true);},p=>{s.if((0, Pe._)`!(${p} instanceof ${o.ValidationError})`,()=>s.throw(p)),m(p),a||s.assign(f,false);}),e.ok(f);}function l(){e.result((0, Zi.callValidateCode)(e,t,u),()=>g(t),()=>m(t));}function m(f){let p=(0, Pe._)`${f}.errors`;s.assign(Qt.default.vErrors,(0, Pe._)`${Qt.default.vErrors} === null ? ${p} : ${Qt.default.vErrors}.concat(${p})`),s.assign(Qt.default.errors,(0, Pe._)`${Qt.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=Sn.mergeEvaluated.props(s,S.props,o.props));else {let _=s.var("props",(0, Pe._)`${f}.evaluated.props`);o.props=Sn.mergeEvaluated.props(s,_,o.props,Pe.Name);}if(o.items!==true)if(S&&!S.dynamicItems)S.items!==void 0&&(o.items=Sn.mergeEvaluated.items(s,S.items,o.items));else {let _=s.var("items",(0, Pe._)`${f}.evaluated.items`);o.items=Sn.mergeEvaluated.items(s,_,o.items,Pe.Name);}}}qt.callRef=kn;qt.default=tm;});var nu=T(eo=>{Object.defineProperty(eo,"__esModule",{value:true});var rm=Qi(),nm=ru(),sm=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",rm.default,nm.default];eo.default=sm;});var su=T(to=>{Object.defineProperty(to,"__esModule",{value:true});var wn=U(),vt=wn.operators,bn={maximum:{okStr:"<=",ok:vt.LTE,fail:vt.GT},minimum:{okStr:">=",ok:vt.GTE,fail:vt.LT},exclusiveMaximum:{okStr:"<",ok:vt.LT,fail:vt.GTE},exclusiveMinimum:{okStr:">",ok:vt.GT,fail:vt.LTE}},om={message:({keyword:e,schemaCode:t})=>(0, wn.str)`must be ${bn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0, wn._)`{comparison: ${bn[e].okStr}, limit: ${t}}`},am={keyword:Object.keys(bn),type:"number",schemaType:"number",$data:true,error:om,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0, wn._)`${r} ${bn[t].fail} ${n} || isNaN(${r})`);}};to.default=am;});var ou=T(ro=>{Object.defineProperty(ro,"__esModule",{value:true});var $r=U(),im={message:({schemaCode:e})=>(0, $r.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0, $r._)`{multipleOf: ${e}}`},um={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:im,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0, $r._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0, $r._)`${a} !== parseInt(${a})`;e.fail$data((0, $r._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`);}};ro.default=um;});var iu=T(no=>{Object.defineProperty(no,"__esModule",{value:true});function au(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}no.default=au;au.code='require("ajv/dist/runtime/ucs2length").default';});var uu=T(so=>{Object.defineProperty(so,"__esModule",{value:true});var Ft=U(),cm=X(),dm=iu(),lm={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return (0, Ft.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0, Ft._)`{limit: ${e}}`},fm={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:lm,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?Ft.operators.GT:Ft.operators.LT,a=s.opts.unicode===false?(0, Ft._)`${r}.length`:(0, Ft._)`${(0, cm.useFunc)(e.gen,dm.default)}(${r})`;e.fail$data((0, Ft._)`${a} ${o} ${n}`);}};so.default=fm;});var cu=T(oo=>{Object.defineProperty(oo,"__esModule",{value:true});var pm=Le(),mm=X(),Zt=U(),gm={message:({schemaCode:e})=>(0, Zt.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0, Zt._)`{pattern: ${e}}`},hm={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:gm,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:c}=a.opts.code,u=c.code==="new RegExp"?(0, Zt._)`new RegExp`:(0, mm.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,(0, Zt._)`${u}(${o}, ${i}).test(${r})`),()=>t.assign(d,false)),e.fail$data((0, Zt._)`!${d}`);}else {let c=(0, pm.usePattern)(e,s);e.fail$data((0, Zt._)`!${c}.test(${r})`);}}};oo.default=hm;});var du=T(ao=>{Object.defineProperty(ao,"__esModule",{value:true});var Er=U(),ym={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return (0, Er.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0, Er._)`{limit: ${e}}`},vm={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:ym,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Er.operators.GT:Er.operators.LT;e.fail$data((0, Er._)`Object.keys(${r}).length ${s} ${n}`);}};ao.default=vm;});var lu=T(io=>{Object.defineProperty(io,"__esModule",{value:true});var xr=Le(),Tr=U(),Sm=X(),km={message:({params:{missingProperty:e}})=>(0, Tr.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0, Tr._)`{missingProperty: ${e}}`},wm={keyword:"required",type:"object",schemaType:"array",$data:true,error:km,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 c=r.length>=i.loopRequired;if(a.allErrors?u():d(),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,_=`required property "${p}" is not defined at "${S}" (strictRequired)`;(0, Sm.checkStrictMode)(a,_,a.opts.strictRequired);}}function u(){if(c||o)e.block$data(Tr.nil,l);else for(let g of r)(0, xr.checkReportMissingProp)(e,g);}function d(){let g=t.let("missing");if(c||o){let f=t.let("valid",true);e.block$data(f,()=>m(g,f)),e.ok(f);}else t.if((0, xr.checkMissingProp)(e,r,g)),(0, xr.reportMissingProp)(e,g),t.else();}function l(){t.forOf("prop",n,g=>{e.setParams({missingProperty:g}),t.if((0, xr.noPropertyInData)(t,s,g,i.ownProperties),()=>e.error());});}function m(g,f){e.setParams({missingProperty:g}),t.forOf(g,n,()=>{t.assign(f,(0, xr.propertyInData)(t,s,g,i.ownProperties)),t.if((0, Tr.not)(f),()=>{e.error(),t.break();});},Tr.nil);}}};io.default=wm;});var fu=T(uo=>{Object.defineProperty(uo,"__esModule",{value:true});var Ar=U(),bm={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return (0, Ar.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0, Ar._)`{limit: ${e}}`},_m={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:bm,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Ar.operators.GT:Ar.operators.LT;e.fail$data((0, Ar._)`${r}.length ${s} ${n}`);}};uo.default=_m;});var _n=T(co=>{Object.defineProperty(co,"__esModule",{value:true});var pu=Os();pu.code='require("ajv/dist/runtime/equal").default';co.default=pu;});var mu=T(fo=>{Object.defineProperty(fo,"__esModule",{value:true});var lo=hr(),he=U(),Rm=X(),Cm=_n(),$m={message:({params:{i:e,j:t}})=>(0, he.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0, he._)`{i: ${e}, j: ${t}}`},Em={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:$m,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;let c=t.let("valid"),u=o.items?(0, lo.getSchemaTypes)(o.items):[];e.block$data(c,d,(0, he._)`${a} === false`),e.ok(c);function d(){let f=t.let("i",(0, he._)`${r}.length`),p=t.let("j");e.setParams({i:f,j:p}),t.assign(c,true),t.if((0, he._)`${f} > 1`,()=>(l()?m:g)(f,p));}function l(){return u.length>0&&!u.some(f=>f==="object"||f==="array")}function m(f,p){let S=t.name("item"),_=(0, lo.checkDataTypes)(u,S,i.opts.strictNumbers,lo.DataType.Wrong),w=t.const("indices",(0, he._)`{}`);t.for((0, he._)`;${f}--;`,()=>{t.let(S,(0, he._)`${r}[${f}]`),t.if(_,(0, he._)`continue`),u.length>1&&t.if((0, he._)`typeof ${S} == "string"`,(0, he._)`${S} += "_"`),t.if((0, he._)`typeof ${w}[${S}] == "number"`,()=>{t.assign(p,(0, he._)`${w}[${S}]`),e.error(),t.assign(c,false).break();}).code((0, he._)`${w}[${S}] = ${f}`);});}function g(f,p){let S=(0, Rm.useFunc)(t,Cm.default),_=t.name("outer");t.label(_).for((0, he._)`;${f}--;`,()=>t.for((0, he._)`${p} = ${f}; ${p}--;`,()=>t.if((0, he._)`${S}(${r}[${f}], ${r}[${p}])`,()=>{e.error(),t.assign(c,false).break(_);})));}}};fo.default=Em;});var gu=T(mo=>{Object.defineProperty(mo,"__esModule",{value:true});var po=U(),xm=X(),Tm=_n(),Am={message:"must be equal to constant",params:({schemaCode:e})=>(0, po._)`{allowedValue: ${e}}`},Im={keyword:"const",$data:true,error:Am,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0, po._)`!${(0, xm.useFunc)(t,Tm.default)}(${r}, ${s})`):e.fail((0, po._)`${o} !== ${r}`);}};mo.default=Im;});var hu=T(go=>{Object.defineProperty(go,"__esModule",{value:true});var Ir=U(),Pm=X(),Om=_n(),jm={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0, Ir._)`{allowedValues: ${e}}`},Nm={keyword:"enum",schemaType:"array",$data:true,error:jm,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,c,u=()=>c??(c=(0, Pm.useFunc)(t,Om.default)),d;if(i||n)d=t.let("valid"),e.block$data(d,l);else {if(!Array.isArray(s))throw new Error("ajv implementation error");let g=t.const("vSchema",o);d=(0, Ir.or)(...s.map((f,p)=>m(g,p)));}e.pass(d);function l(){t.assign(d,false),t.forOf("v",o,g=>t.if((0, Ir._)`${u()}(${r}, ${g})`,()=>t.assign(d,true).break()));}function m(g,f){let p=s[f];return typeof p=="object"&&p!==null?(0, Ir._)`${u()}(${r}, ${g}[${f}])`:(0, Ir._)`${r} === ${p}`}}};go.default=Nm;});var yu=T(ho=>{Object.defineProperty(ho,"__esModule",{value:true});var qm=su(),Fm=ou(),Dm=uu(),Mm=cu(),Lm=du(),Vm=lu(),Bm=fu(),Km=mu(),Gm=gu(),Um=hu(),Jm=[qm.default,Fm.default,Dm.default,Mm.default,Lm.default,Vm.default,Bm.default,Km.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Gm.default,Um.default];ho.default=Jm;});var vo=T(Pr=>{Object.defineProperty(Pr,"__esModule",{value:true});Pr.validateAdditionalItems=void 0;var Dt=U(),yo=X(),zm={message:({params:{len:e}})=>(0, Dt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, Dt._)`{limit: ${e}}`},Hm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:zm,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0, yo.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}vu(e,n);}};function vu(e,t){let{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=true;let i=r.const("len",(0, Dt._)`${s}.length`);if(n===false)e.setParams({len:t.length}),e.pass((0, Dt._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0, yo.alwaysValidSchema)(a,n)){let u=r.var("valid",(0, Dt._)`${i} <= ${t.length}`);r.if((0, Dt.not)(u),()=>c(u)),e.ok(u);}function c(u){r.forRange("i",t.length,i,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:yo.Type.Num},u),a.allErrors||r.if((0, Dt.not)(u),()=>r.break());});}}Pr.validateAdditionalItems=vu;Pr.default=Hm;});var So=T(Or=>{Object.defineProperty(Or,"__esModule",{value:true});Or.validateTuple=void 0;var Su=U(),Rn=X(),Wm=Le(),Ym={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return ku(e,"additionalItems",t);r.items=true,!(0, Rn.alwaysValidSchema)(r,t)&&e.ok((0, Wm.validateArray)(e));}};function ku(e,t,r=e.schema){let{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;d(s),i.opts.unevaluated&&r.length&&i.items!==true&&(i.items=Rn.mergeEvaluated.items(n,r.length,i.items));let c=n.name("valid"),u=n.const("len",(0, Su._)`${o}.length`);r.forEach((l,m)=>{(0, Rn.alwaysValidSchema)(i,l)||(n.if((0, Su._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c));});function d(l){let{opts:m,errSchemaPath:g}=i,f=r.length,p=f===l.minItems&&(f===l.maxItems||l[t]===false);if(m.strictTuples&&!p){let S=`"${a}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${g}"`;(0, Rn.checkStrictMode)(i,S,m.strictTuples);}}}Or.validateTuple=ku;Or.default=Ym;});var wu=T(ko=>{Object.defineProperty(ko,"__esModule",{value:true});var Xm=So(),Qm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0, Xm.validateTuple)(e,"items")};ko.default=Qm;});var _u=T(wo=>{Object.defineProperty(wo,"__esModule",{value:true});var bu=U(),Zm=X(),eg=Le(),tg=vo(),rg={message:({params:{len:e}})=>(0, bu.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, bu._)`{limit: ${e}}`},ng={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:rg,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=true,!(0, Zm.alwaysValidSchema)(n,t)&&(s?(0, tg.validateAdditionalItems)(e,s):e.ok((0, eg.validateArray)(e)));}};wo.default=ng;});var Ru=T(bo=>{Object.defineProperty(bo,"__esModule",{value:true});var Be=U(),Cn=X(),sg={message:({params:{min:e,max:t}})=>t===void 0?(0, Be.str)`must contain at least ${e} valid item(s)`:(0, Be.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0, Be._)`{minContains: ${e}}`:(0, Be._)`{minContains: ${e}, maxContains: ${t}}`},og={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:sg,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e,a,i,{minContains:c,maxContains:u}=n;o.opts.next?(a=c===void 0?1:c,i=u):a=1;let d=t.const("len",(0, Be._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0, Cn.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0, Cn.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0, Cn.alwaysValidSchema)(o,r)){let p=(0, Be._)`${d} >= ${a}`;i!==void 0&&(p=(0, Be._)`${p} && ${d} <= ${i}`),e.pass(p);return}o.items=true;let l=t.name("valid");i===void 0&&a===1?g(l,()=>t.if(l,()=>t.break())):a===0?(t.let(l,true),i!==void 0&&t.if((0, Be._)`${s}.length > 0`,m)):(t.let(l,false),m()),e.result(l,()=>e.reset());function m(){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,d,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:Cn.Type.Num,compositeRule:true},p),S();});}function f(p){t.code((0, Be._)`${p}++`),i===void 0?t.if((0, Be._)`${p} >= ${a}`,()=>t.assign(l,true).break()):(t.if((0, Be._)`${p} > ${i}`,()=>t.assign(l,false).break()),a===1?t.assign(l,true):t.if((0, Be._)`${p} >= ${a}`,()=>t.assign(l,true)));}}};bo.default=og;});var Eu=T(et=>{Object.defineProperty(et,"__esModule",{value:true});et.validateSchemaDeps=et.validatePropertyDeps=et.error=void 0;var _o=U(),ag=X(),jr=Le();et.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return (0, _o.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0, _o._)`{property: ${e},
|
|
5
|
+
|| ${a} === "boolean" || ${s} === null`).assign(i,(0, K._)`[${s}]`);}}}function Kl({gen:e,parentData:t,parentDataProperty:r},n){e.if((0, K._)`${t} !== undefined`,()=>e.assign((0, K._)`${t}[${r}]`,n));}function As(e,t,r,n=Yt.Correct){let s=n===Yt.Correct?K.operators.EQ:K.operators.NEQ,o;switch(e){case "null":return (0, K._)`${t} ${s} null`;case "array":o=(0, K._)`Array.isArray(${t})`;break;case "object":o=(0, K._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case "integer":o=a((0, K._)`!(${t} % 1) && !isNaN(${t})`);break;case "number":o=a();break;default:return (0, K._)`typeof ${t} ${s} ${e}`}return n===Yt.Correct?o:(0, K.not)(o);function a(i=K.nil){return (0, K.and)((0, K._)`typeof ${t} == "number"`,i,r?(0, K._)`isFinite(${t})`:K.nil)}}Se.checkDataType=As;function Ts(e,t,r,n){if(e.length===1)return As(e[0],t,r,n);let s,o=(0, Qa.toHash)(e);if(o.array&&o.object){let a=(0, K._)`typeof ${t} != "object"`;s=o.null?a:(0, K._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object;}else s=K.nil;o.number&&delete o.integer;for(let a in o)s=(0, K.and)(s,As(a,t,r,n));return s}Se.checkDataTypes=Ts;var Gl={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0, K._)`{type: ${e}}`:(0, K._)`{type: ${t}}`};function Is(e){let t=Ul(e);(0, Dl.reportError)(t,Gl);}Se.reportTypeError=Is;function Ul(e){let{gen:t,data:r,schema:n}=e,s=(0, Qa.schemaRefOrVal)(e,n,"type");return {gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var ri=T(un=>{Object.defineProperty(un,"__esModule",{value:true});un.assignDefaults=void 0;var Xt=U(),Jl=Q();function zl(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)ti(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>ti(e,o,s.default));}un.assignDefaults=zl;function ti(e,t,r){let{gen:n,compositeRule:s,data:o,opts:a}=e;if(r===void 0)return;let i=(0, Xt._)`${o}${(0, Xt.getProperty)(t)}`;if(s){(0, Jl.checkStrictMode)(e,`default is ignored for: ${i}`);return}let c=(0, Xt._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0, Xt._)`${c} || ${i} === null || ${i} === ""`),n.if(c,(0, Xt._)`${i} = ${(0, Xt.stringify)(r)}`);}});var Le=T(ne=>{Object.defineProperty(ne,"__esModule",{value:true});ne.validateUnion=ne.validateArray=ne.usePattern=ne.callValidateCode=ne.schemaProperties=ne.allSchemaProperties=ne.noPropertyInData=ne.propertyInData=ne.isOwnProperty=ne.hasPropFunc=ne.reportMissingProp=ne.checkMissingProp=ne.checkReportMissingProp=void 0;var ie=U(),Ps=Q(),gt=ot(),Hl=Q();function Wl(e,t){let{gen:r,data:n,it:s}=e;r.if(Os(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0, ie._)`${t}`},true),e.error();});}ne.checkReportMissingProp=Wl;function Yl({gen:e,data:t,it:{opts:r}},n,s){return (0, ie.or)(...n.map(o=>(0, ie.and)(Os(e,t,o,r.ownProperties),(0, ie._)`${s} = ${o}`)))}ne.checkMissingProp=Yl;function Xl(e,t){e.setParams({missingProperty:t},true),e.error();}ne.reportMissingProp=Xl;function ni(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, ie._)`Object.prototype.hasOwnProperty`})}ne.hasPropFunc=ni;function js(e,t,r){return (0, ie._)`${ni(e)}.call(${t}, ${r})`}ne.isOwnProperty=js;function Ql(e,t,r,n){let s=(0, ie._)`${t}${(0, ie.getProperty)(r)} !== undefined`;return n?(0, ie._)`${s} && ${js(e,t,r)}`:s}ne.propertyInData=Ql;function Os(e,t,r,n){let s=(0, ie._)`${t}${(0, ie.getProperty)(r)} === undefined`;return n?(0, ie.or)(s,(0, ie.not)(js(e,t,r))):s}ne.noPropertyInData=Os;function si(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ne.allSchemaProperties=si;function Zl(e,t){return si(t).filter(r=>!(0, Ps.alwaysValidSchema)(e,t[r]))}ne.schemaProperties=Zl;function ef({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:a},i,c,u){let d=u?(0, ie._)`${e}, ${t}, ${n}${s}`:t,l=[[gt.default.instancePath,(0, ie.strConcat)(gt.default.instancePath,o)],[gt.default.parentData,a.parentData],[gt.default.parentDataProperty,a.parentDataProperty],[gt.default.rootData,gt.default.rootData]];a.opts.dynamicRef&&l.push([gt.default.dynamicAnchors,gt.default.dynamicAnchors]);let m=(0, ie._)`${d}, ${r.object(...l)}`;return c!==ie.nil?(0, ie._)`${i}.call(${c}, ${m})`:(0, ie._)`${i}(${m})`}ne.callValidateCode=ef;var tf=(0, ie._)`new RegExp`;function rf({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, ie._)`${s.code==="new RegExp"?tf:(0, Hl.useFunc)(e,s)}(${r}, ${n})`})}ne.usePattern=rf;function nf(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 c=t.const("len",(0, ie._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Ps.Type.Num},o),t.if((0, ie.not)(o),i);});}}ne.validateArray=nf;function sf(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0, Ps.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let a=t.let("valid",false),i=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:n,schemaProp:u,compositeRule:true},i);t.assign(a,(0, ie._)`${a} || ${i}`),e.mergeValidEvaluated(d,i)||t.if((0, ie.not)(a));})),e.result(a,()=>e.reset(),()=>e.error(true));}ne.validateUnion=sf;});var ii=T(Xe=>{Object.defineProperty(Xe,"__esModule",{value:true});Xe.validateKeywordUsage=Xe.validSchemaType=Xe.funcKeywordCode=Xe.macroKeywordCode=void 0;var Re=U(),Ot=ot(),of=Le(),af=hr();function uf(e,t){let{gen:r,keyword:n,schema:s,parentSchema:o,it:a}=e,i=t.macro.call(a.self,s,o,a),c=ai(r,n,i);a.opts.validateSchema!==false&&a.self.validateSchema(i,true);let u=r.name("valid");e.subschema({schema:i,schemaPath:Re.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:true},u),e.pass(u,()=>e.error(true));}Xe.macroKeywordCode=uf;function cf(e,t){var r;let{gen:n,keyword:s,schema:o,parentSchema:a,$data:i,it:c}=e;lf(c,t);let u=!i&&t.compile?t.compile.call(c.self,o,a,c):t.validate,d=ai(n,s,u),l=n.let("valid");e.block$data(l,m),e.ok((r=t.valid)!==null&&r!==void 0?r:l);function m(){if(t.errors===false)p(),t.modifying&&oi(e),S(()=>e.error());else {let b=t.async?h():f();t.modifying&&oi(e),S(()=>df(e,b));}}function h(){let b=n.let("ruleErrs",null);return n.try(()=>p((0, Re._)`await `),j=>n.assign(l,false).if((0, Re._)`${j} instanceof ${c.ValidationError}`,()=>n.assign(b,(0, Re._)`${j}.errors`),()=>n.throw(j))),b}function f(){let b=(0, Re._)`${d}.errors`;return n.assign(b,null),p(Re.nil),b}function p(b=t.async?(0, Re._)`await `:Re.nil){let j=c.opts.passContext?Ot.default.this:Ot.default.self,w=!("compile"in t&&!i||t.schema===false);n.assign(l,(0, Re._)`${b}${(0, of.callValidateCode)(e,d,j,w)}`,t.modifying);}function S(b){var j;n.if((0, Re.not)((j=t.valid)!==null&&j!==void 0?j:l),b);}}Xe.funcKeywordCode=cf;function oi(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0, Re._)`${n.parentData}[${n.parentDataProperty}]`));}function df(e,t){let{gen:r}=e;r.if((0, Re._)`Array.isArray(${t})`,()=>{r.assign(Ot.default.vErrors,(0, Re._)`${Ot.default.vErrors} === null ? ${t} : ${Ot.default.vErrors}.concat(${t})`).assign(Ot.default.errors,(0, Re._)`${Ot.default.vErrors}.length`),(0, af.extendErrors)(e);},()=>e.error());}function lf({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function ai(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, Re.stringify)(r)})}function ff(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")}Xe.validSchemaType=ff;function pf({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 c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Xe.validateKeywordUsage=pf;});var ci=T(ht=>{Object.defineProperty(ht,"__esModule",{value:true});ht.extendSubschemaMode=ht.extendSubschemaData=ht.getSubschema=void 0;var Qe=U(),ui=Q();function mf(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, Qe._)`${e.schemaPath}${(0, Qe.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0, Qe._)`${e.schemaPath}${(0, Qe.getProperty)(t)}${(0, Qe.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0, ui.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')}ht.getSubschema=mf;function gf(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:u,dataPathArr:d,opts:l}=t,m=i.let("data",(0, Qe._)`${t.data}${(0, Qe.getProperty)(r)}`,true);c(m),e.errorPath=(0, Qe.str)`${u}${(0, ui.getErrorPath)(r,n,l.jsPropertySyntax)}`,e.parentDataProperty=(0, Qe._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty];}if(s!==void 0){let u=s instanceof Qe.Name?s:i.let("data",s,true);c(u),a!==void 0&&(e.propertyName=a);}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u];}}ht.extendSubschemaData=gf;function hf(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;}ht.extendSubschemaMode=hf;});var Ns=T((pv,di)=>{di.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 fi=T((mv,li)=>{var yt=li.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(){};cn(t,n,s,e,"",e);};yt.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};yt.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};yt.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};yt.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 cn(e,t,r,n,s,o,a,i,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,a,i,c,u);for(var d in n){var l=n[d];if(Array.isArray(l)){if(d in yt.arrayKeywords)for(var m=0;m<l.length;m++)cn(e,t,r,l[m],s+"/"+d+"/"+m,o,s,d,n,m);}else if(d in yt.propsKeywords){if(l&&typeof l=="object")for(var h in l)cn(e,t,r,l[h],s+"/"+d+"/"+yf(h),o,s,d,n,h);}else (d in yt.keywords||e.allKeys&&!(d in yt.skipKeywords))&&cn(e,t,r,l,s+"/"+d,o,s,d,n);}r(n,s,o,a,i,c,u);}}function yf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var vr=T(Ie=>{Object.defineProperty(Ie,"__esModule",{value:true});Ie.getSchemaRefs=Ie.resolveUrl=Ie.normalizeId=Ie._getFullPath=Ie.getFullPath=Ie.inlineRef=void 0;var vf=Q(),Sf=Ns(),kf=fi(),wf=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function bf(e,t=true){return typeof e=="boolean"?true:t===true?!qs(e):t?pi(e)<=t:false}Ie.inlineRef=bf;var _f=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qs(e){for(let t in e){if(_f.has(t))return true;let r=e[t];if(Array.isArray(r)&&r.some(qs)||typeof r=="object"&&qs(r))return true}return false}function pi(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!wf.has(r)&&(typeof e[r]=="object"&&(0, vf.eachItem)(e[r],n=>t+=pi(n)),t===1/0))return 1/0}return t}function mi(e,t="",r){r!==false&&(t=Qt(t));let n=e.parse(t);return gi(e,n)}Ie.getFullPath=mi;function gi(e,t){return e.serialize(t).split("#")[0]+"#"}Ie._getFullPath=gi;var Rf=/#\/?$/;function Qt(e){return e?e.replace(Rf,""):""}Ie.normalizeId=Qt;function Cf(e,t,r){return r=Qt(r),e.resolve(t,r)}Ie.resolveUrl=Cf;var $f=/^[a-z_][-a-z0-9._]*$/i;function Ef(e,t){if(typeof e=="boolean")return {};let{schemaId:r,uriResolver:n}=this.opts,s=Qt(e[r]||t),o={"":s},a=mi(n,s,false),i={},c=new Set;return kf(e,{allKeys:true},(l,m,h,f)=>{if(f===void 0)return;let p=a+m,S=o[f];typeof l[r]=="string"&&(S=b.call(this,l[r])),j.call(this,l.$anchor),j.call(this,l.$dynamicAnchor),o[m]=S;function b(w){let E=this.opts.uriResolver.resolve;if(w=Qt(S?E(S,w):w),c.has(w))throw d(w);c.add(w);let y=this.refs[w];return typeof y=="string"&&(y=this.refs[y]),typeof y=="object"?u(l,y.schema,w):w!==Qt(p)&&(w[0]==="#"?(u(l,i[w],w),i[w]=l):this.refs[w]=p),w}function j(w){if(typeof w=="string"){if(!$f.test(w))throw new Error(`invalid anchor "${w}"`);b.call(this,`#${w}`);}}}),i;function u(l,m,h){if(m!==void 0&&!Sf(l,m))throw d(h)}function d(l){return new Error(`reference "${l}" resolves to more than one schema`)}}Ie.getSchemaRefs=Ef;});var wr=T(vt=>{Object.defineProperty(vt,"__esModule",{value:true});vt.getData=vt.KeywordCxt=vt.validateFunctionCode=void 0;var ki=Wa(),hi=yr(),Ds=xs(),dn=yr(),xf=ri(),kr=ii(),Fs=ci(),O=U(),V=ot(),Af=vr(),at=Q(),Sr=hr();function Tf(e){if(_i(e)&&(Ri(e),bi(e))){jf(e);return}wi(e,()=>(0, ki.topBoolOrEmptySchema)(e));}vt.validateFunctionCode=Tf;function wi({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0, O._)`${V.default.data}, ${V.default.valCxt}`,n.$async,()=>{e.code((0, O._)`"use strict"; ${yi(r,s)}`),Pf(e,s),e.code(o);}):e.func(t,(0, O._)`${V.default.data}, ${If(s)}`,n.$async,()=>e.code(yi(r,s)).code(o));}function If(e){return (0, O._)`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${e.dynamicRef?(0, O._)`, ${V.default.dynamicAnchors}={}`:O.nil}}={}`}function Pf(e,t){e.if(V.default.valCxt,()=>{e.var(V.default.instancePath,(0, O._)`${V.default.valCxt}.${V.default.instancePath}`),e.var(V.default.parentData,(0, O._)`${V.default.valCxt}.${V.default.parentData}`),e.var(V.default.parentDataProperty,(0, O._)`${V.default.valCxt}.${V.default.parentDataProperty}`),e.var(V.default.rootData,(0, O._)`${V.default.valCxt}.${V.default.rootData}`),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0, O._)`${V.default.valCxt}.${V.default.dynamicAnchors}`);},()=>{e.var(V.default.instancePath,(0, O._)`""`),e.var(V.default.parentData,(0, O._)`undefined`),e.var(V.default.parentDataProperty,(0, O._)`undefined`),e.var(V.default.rootData,V.default.data),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0, O._)`{}`);});}function jf(e){let{schema:t,opts:r,gen:n}=e;wi(e,()=>{r.$comment&&t.$comment&&$i(e),Df(e),n.let(V.default.vErrors,null),n.let(V.default.errors,0),r.unevaluated&&Of(e),Ci(e),Vf(e);});}function Of(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0, O._)`${r}.evaluated`),t.if((0, O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0, O._)`${e.evaluated}.props`,(0, O._)`undefined`)),t.if((0, O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0, O._)`${e.evaluated}.items`,(0, O._)`undefined`));}function yi(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0, O._)`/*# sourceURL=${r} */`:O.nil}function Nf(e,t){if(_i(e)&&(Ri(e),bi(e))){qf(e,t);return}(0, ki.boolOrEmptySchema)(e,t);}function bi({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 _i(e){return typeof e.schema!="boolean"}function qf(e,t){let{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&$i(e),Mf(e),Lf(e);let o=n.const("_errs",V.default.errors);Ci(e,o),n.var(t,(0, O._)`${o} === ${V.default.errors}`);}function Ri(e){(0, at.checkUnknownRules)(e),Ff(e);}function Ci(e,t){if(e.opts.jtd)return vi(e,[],false,t);let r=(0, hi.getSchemaTypes)(e.schema),n=(0, hi.coerceAndCheckDataType)(e,r);vi(e,r,!n,t);}function Ff(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0, at.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function Df(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, at.checkStrictMode)(e,"default is ignored in the schema root");}function Mf(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0, Af.resolveUrl)(e.opts.uriResolver,e.baseId,t));}function Lf(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function $i({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===true)e.code((0, O._)`${V.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let a=(0, O.str)`${n}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code((0, O._)`${V.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`);}}function Vf(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0, O._)`${V.default.errors} === 0`,()=>t.return(V.default.data),()=>t.throw((0, O._)`new ${s}(${V.default.vErrors})`)):(t.assign((0, O._)`${n}.errors`,V.default.vErrors),o.unevaluated&&Bf(e),t.return((0, O._)`${V.default.errors} === 0`));}function Bf({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0, O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0, O._)`${t}.items`,n);}function vi(e,t,r,n){let{gen:s,schema:o,data:a,allErrors:i,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0, at.schemaHasRulesButRef)(o,d))){s.block(()=>xi(e,"$ref",d.all.$ref.definition));return}c.jtd||Kf(e,t),s.block(()=>{for(let m of d.rules)l(m);l(d.post);});function l(m){(0, Ds.shouldUseGroup)(o,m)&&(m.type?(s.if((0, dn.checkDataType)(m.type,a,c.strictNumbers)),Si(e,m),t.length===1&&t[0]===m.type&&r&&(s.else(),(0, dn.reportTypeError)(e)),s.endIf()):Si(e,m),i||s.if((0, O._)`${V.default.errors} === ${n||0}`));}}function Si(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0, xf.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0, Ds.shouldUseRule)(n,o)&&xi(e,o.keyword,o.definition,t.type);});}function Kf(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Gf(e,t),e.opts.allowUnionTypes||Uf(e,t),Jf(e,e.dataTypes));}function Gf(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Ei(e.dataTypes,r)||Ms(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`);}),Hf(e,t);}}function Uf(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Ms(e,"use allowUnionTypes to allow union type keyword");}function Jf(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0, Ds.shouldUseRule)(e.schema,s)){let{type:o}=s.definition;o.length&&!o.some(a=>zf(t,a))&&Ms(e,`missing type "${o.join(",")}" for keyword "${n}"`);}}}function zf(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Ei(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Hf(e,t){let r=[];for(let n of e.dataTypes)Ei(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r;}function Ms(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0, at.checkStrictMode)(e,t,e.opts.strictTypes);}var ln=class{constructor(t,r,n){if((0, kr.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, at.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",Ai(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0, kr.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",V.default.errors));}result(t,r,n){this.failResult((0, O.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, O.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, O._)`${r} !== undefined && (${(0, O.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?Sr.reportExtraError:Sr.reportError)(this,this.def.error,r);}$dataError(){(0, Sr.reportError)(this,this.def.$dataError||Sr.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, Sr.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=O.nil){this.gen.block(()=>{this.check$data(t,n),r();});}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:a}=this;n.if((0, O.or)((0, O._)`${s} === undefined`,r)),t!==O.nil&&n.assign(t,true),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,false)),n.else();}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return (0, O.or)(a(),i());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return (0, O._)`${(0, dn.checkDataTypes)(c,r,o.opts.strictNumbers,dn.DataType.Wrong)}`}return O.nil}function i(){if(s.validateSchema){let c=t.scopeValue("validate$data",{ref:s.validateSchema});return (0, O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0, Fs.getSubschema)(this.it,t);(0, Fs.extendSubschemaData)(n,this.it,t),(0, Fs.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=at.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==true&&t.items!==void 0&&(n.items=at.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,O.Name)),true}};vt.KeywordCxt=ln;function xi(e,t,r,n){let s=new ln(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0, kr.funcKeywordCode)(s,r):"macro"in r?(0, kr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0, kr.funcKeywordCode)(s,r);}var Wf=/^\/(?:[^~]|~0|~1)*$/,Yf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ai(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return V.default.rootData;if(e[0]==="/"){if(!Wf.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=V.default.rootData;}else {let u=Yf.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(s=u[2],s==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(o=r[t-d],!s)return o}let a=o,i=s.split("/");for(let u of i)u&&(o=(0, O._)`${o}${(0, O.getProperty)((0, at.unescapeJsonPointer)(u))}`,a=(0, O._)`${a} && ${o}`);return a;function c(u,d){return `Cannot access ${u} ${d} levels up, current level is ${t}`}}vt.getData=Ai;});var fn=T(Vs=>{Object.defineProperty(Vs,"__esModule",{value:true});var Ls=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=true;}};Vs.default=Ls;});var br=T(Gs=>{Object.defineProperty(Gs,"__esModule",{value:true});var Bs=vr(),Ks=class extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0, Bs.resolveUrl)(t,r,n),this.missingSchema=(0, Bs.normalizeId)((0, Bs.getFullPath)(t,this.missingRef));}};Gs.default=Ks;});var mn=T(Ve=>{Object.defineProperty(Ve,"__esModule",{value:true});Ve.resolveSchema=Ve.getCompilingSchema=Ve.resolveRef=Ve.compileSchema=Ve.SchemaEnv=void 0;var He=U(),Xf=fn(),Nt=ot(),We=vr(),Ti=Q(),Qf=wr(),Zt=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, We.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={};}};Ve.SchemaEnv=Zt;function Js(e){let t=Ii.call(this,e);if(t)return t;let r=(0, We.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,a=new He.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),i;e.$async&&(i=a.scopeValue("Error",{ref:Xf.default,code:(0, He._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Nt.default.data,parentData:Nt.default.parentData,parentDataProperty:Nt.default.parentDataProperty,dataNames:[Nt.default.data],dataPathArr:[He.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0, He.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:He.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, He._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,Qf.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let l=a.toString();d=`${a.scopeRefs(Nt.default.scope)}return ${l}`,this.opts.code.process&&(d=this.opts.code.process(d,e));let h=new Function(`${Nt.default.self}`,`${Nt.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async&&(h.$async=!0),this.opts.code.source===!0&&(h.source={validateName:c,validateCode:l,scopeValues:a._values}),this.opts.unevaluated){let{props:f,items:p}=u;h.evaluated={props:f instanceof He.Name?void 0:f,items:p instanceof He.Name?void 0:p,dynamicProps:f instanceof He.Name,dynamicItems:p instanceof He.Name},h.source&&(h.source.evaluated=(0,He.stringify)(h.evaluated));}return e.validate=h,e}catch(l){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),l}finally{this._compilations.delete(e);}}Ve.compileSchema=Js;function Zf(e,t,r){var n;r=(0, We.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let o=rp.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 Zt({schema:a,schemaId:i,root:e,baseId:t}));}if(o!==void 0)return e.refs[r]=ep.call(this,o)}Ve.resolveRef=Zf;function ep(e){return (0, We.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Js.call(this,e)}function Ii(e){for(let t of this._compilations)if(tp(t,e))return t}Ve.getCompilingSchema=Ii;function tp(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function rp(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||pn.call(this,e,t)}function pn(e,t){let r=this.opts.uriResolver.parse(t),n=(0, We._getFullPath)(this.opts.uriResolver,r),s=(0, We.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Us.call(this,r,e);let o=(0, We.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=pn.call(this,e,a);return typeof i?.schema!="object"?void 0:Us.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Js.call(this,a),o===(0, We.normalizeId)(t)){let{schema:i}=a,{schemaId:c}=this.opts,u=i[c];return u&&(s=(0, We.resolveUrl)(this.opts.uriResolver,s,u)),new Zt({schema:i,schemaId:c,root:e,baseId:s})}return Us.call(this,r,a)}}Ve.resolveSchema=pn;var np=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Us(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 c=r[(0, Ti.unescapeFragment)(i)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!np.has(i)&&u&&(t=(0, We.resolveUrl)(this.opts.uriResolver,t,u));}let o;if(typeof r!="boolean"&&r.$ref&&!(0, Ti.schemaHasRulesButRef)(r,this.RULES)){let i=(0, We.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=pn.call(this,n,i);}let{schemaId:a}=this.opts;if(o=o||new Zt({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var Pi=T((kv,sp)=>{sp.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 Hs=T((wv,qi)=>{var op=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Oi=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 zs(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 ap=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function ji(e){return e.length=0,true}function ip(e,t,r){if(e.length){let n=zs(e);if(n!=="")t.push(n);else return r.error=true,false;e.length=0;}return true}function up(e){let t=0,r={error:false,address:"",zone:""},n=[],s=[],o=false,a=false,i=ip;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(o===true&&(a=true),!i(s,n,r))break;if(++t>7){r.error=true;break}c>0&&e[c-1]===":"&&(o=true),n.push(":");continue}else if(u==="%"){if(!i(s,n,r))break;i=ji;}else {s.push(u);continue}}return s.length&&(i===ji?r.zone=s.join(""):a?n.push(s.join("")):n.push(zs(s))),r.address=n.join(""),r}function Ni(e){if(cp(e,":")<2)return {host:e,isIPV6:false};let t=up(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 cp(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function dp(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 lp(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 fp(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Oi(r)){let n=Ni(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}qi.exports={nonSimpleDomain:ap,recomposeAuthority:fp,normalizeComponentEncoding:lp,removeDotSegments:dp,isIPv4:Oi,isUUID:op,normalizeIPv6:Ni,stringArrayToHexStripped:zs};});var Vi=T((bv,Li)=>{var{isUUID:pp}=Hs(),mp=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,gp=["http","https","ws","wss","urn","urn:uuid"];function hp(e){return gp.indexOf(e)!==-1}function Ws(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 Fi(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 yp(e){return e.secure=Ws(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function vp(e){if((e.port===(Ws(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 Sp(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(mp);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=Ys(s);e.path=void 0,o&&(e=o.parse(e,t));}else e.error=e.error||"URN can not be parsed.";return e}function kp(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=Ys(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 wp(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!pp(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function bp(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Mi={scheme:"http",domainHost:true,parse:Fi,serialize:Di},_p={scheme:"https",domainHost:Mi.domainHost,parse:Fi,serialize:Di},gn={scheme:"ws",domainHost:true,parse:yp,serialize:vp},Rp={scheme:"wss",domainHost:gn.domainHost,parse:gn.parse,serialize:gn.serialize},Cp={scheme:"urn",parse:Sp,serialize:kp,skipNormalize:true},$p={scheme:"urn:uuid",parse:wp,serialize:bp,skipNormalize:true},hn={http:Mi,https:_p,ws:gn,wss:Rp,urn:Cp,"urn:uuid":$p};Object.setPrototypeOf(hn,null);function Ys(e){return e&&(hn[e]||hn[e.toLowerCase()])||void 0}Li.exports={wsIsSecure:Ws,SCHEMES:hn,isValidSchemeName:hp,getSchemeHandler:Ys};});var Gi=T((_v,vn)=>{var{normalizeIPv6:Ep,removeDotSegments:_r,recomposeAuthority:xp,normalizeComponentEncoding:yn,isIPv4:Ap,nonSimpleDomain:Tp}=Hs(),{SCHEMES:Ip,getSchemeHandler:Bi}=Vi();function Pp(e,t){return typeof e=="string"?e=Ze(it(e,t),t):typeof e=="object"&&(e=it(Ze(e,t),t)),e}function jp(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=Ki(it(e,n),it(t,n),n,true);return n.skipEscape=true,Ze(s,n)}function Ki(e,t,r,n){let s={};return n||(e=it(Ze(e,r),r),t=it(Ze(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=_r(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=_r(t.path||""),s.query=t.query):(t.path?(t.path[0]==="/"?s.path=_r(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=_r(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 Op(e,t,r){return typeof e=="string"?(e=unescape(e),e=Ze(yn(it(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=Ze(yn(e,true),{...r,skipEscape:true})),typeof t=="string"?(t=unescape(t),t=Ze(yn(it(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=Ze(yn(t,true),{...r,skipEscape:true})),e.toLowerCase()===t.toLowerCase()}function Ze(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=Bi(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=xp(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=_r(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 Np=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function it(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(Np);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(Ap(n.host)===false){let c=Ep(n.host);n.host=c.host.toLowerCase(),s=c.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=Bi(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===false&&Tp(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 Xs={SCHEMES:Ip,normalize:Pp,resolve:jp,resolveComponent:Ki,equal:Op,serialize:Ze,parse:it};vn.exports=Xs;vn.exports.default=Xs;vn.exports.fastUri=Xs;});var Ji=T(Qs=>{Object.defineProperty(Qs,"__esModule",{value:true});var Ui=Gi();Ui.code='require("ajv/dist/runtime/uri").default';Qs.default=Ui;});var eu=T(ge=>{Object.defineProperty(ge,"__esModule",{value:true});ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=void 0;var qp=wr();Object.defineProperty(ge,"KeywordCxt",{enumerable:true,get:function(){return qp.KeywordCxt}});var er=U();Object.defineProperty(ge,"_",{enumerable:true,get:function(){return er._}});Object.defineProperty(ge,"str",{enumerable:true,get:function(){return er.str}});Object.defineProperty(ge,"stringify",{enumerable:true,get:function(){return er.stringify}});Object.defineProperty(ge,"nil",{enumerable:true,get:function(){return er.nil}});Object.defineProperty(ge,"Name",{enumerable:true,get:function(){return er.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:true,get:function(){return er.CodeGen}});var Fp=fn(),Xi=br(),Dp=Es(),Rr=mn(),Mp=U(),Cr=vr(),Sn=yr(),eo=Q(),zi=Pi(),Lp=Ji(),Qi=(e,t)=>new RegExp(e,t);Qi.code="new RegExp";var Vp=["removeAdditional","useDefaults","coerceTypes"],Bp=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Kp={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."},Gp={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Hi=200;function Up(e){var t,r,n,s,o,a,i,c,u,d,l,m,h,f,p,S,b,j,w,E,y,v,k,R,$;let x=e.strict,P=(t=e.code)===null||t===void 0?void 0:t.optimize,D=P===true||P===void 0?1:P||0,q=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Qi,de=(s=e.uriResolver)!==null&&s!==void 0?s:Lp.default;return {strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:x)!==null&&a!==void 0?a:true,strictNumbers:(c=(i=e.strictNumbers)!==null&&i!==void 0?i:x)!==null&&c!==void 0?c:true,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:x)!==null&&d!==void 0?d:"log",strictTuples:(m=(l=e.strictTuples)!==null&&l!==void 0?l:x)!==null&&m!==void 0?m:"log",strictRequired:(f=(h=e.strictRequired)!==null&&h!==void 0?h:x)!==null&&f!==void 0?f:false,code:e.code?{...e.code,optimize:D,regExp:q}:{optimize:D,regExp:q},loopRequired:(p=e.loopRequired)!==null&&p!==void 0?p:Hi,loopEnum:(S=e.loopEnum)!==null&&S!==void 0?S:Hi,meta:(b=e.meta)!==null&&b!==void 0?b:true,messages:(j=e.messages)!==null&&j!==void 0?j:true,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:true,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(y=e.addUsedSchema)!==null&&y!==void 0?y:true,validateSchema:(v=e.validateSchema)!==null&&v!==void 0?v:true,validateFormats:(k=e.validateFormats)!==null&&k!==void 0?k:true,unicodeRegExp:(R=e.unicodeRegExp)!==null&&R!==void 0?R:true,int32range:($=e.int32range)!==null&&$!==void 0?$:true,uriResolver:de}}var $r=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Up(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Mp.ValueScope({scope:{},prefixes:Bp,es5:r,lines:n}),this.logger=Xp(t.logger);let s=t.validateFormats;t.validateFormats=false,this.RULES=(0, Dp.getRules)(),Wi.call(this,Kp,t,"NOT SUPPORTED"),Wi.call(this,Gp,t,"DEPRECATED","warn"),this._metaOpts=Wp.call(this),t.formats&&zp.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Hp.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Jp.call(this),t.validateFormats=s;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,s=zi;n==="id"&&(s={...zi},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(d,l){await o.call(this,d.$schema);let m=this._addSchema(d,l);return m.validate||a.call(this,m)}async function o(d){d&&!this.getSchema(d)&&await s.call(this,{$ref:d},true);}async function a(d){try{return this._compileSchemaEnv(d)}catch(l){if(!(l instanceof Xi.default))throw l;return i.call(this,l),await c.call(this,l.missingSchema),a.call(this,d)}}function i({missingSchema:d,missingRef:l}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${l} cannot be resolved`)}async function c(d){let l=await u.call(this,d);this.refs[d]||await o.call(this,l.$schema),this.refs[d]||this.addSchema(l,d,r);}async function u(d){let l=this._loading[d];if(l)return l;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d];}}}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, Cr.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=Yi.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Rr.SchemaEnv({schema:{},schemaId:n});if(r=Rr.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=Yi.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, Cr.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(Zp.call(this,n,r),!r)return (0, eo.eachItem)(n,o=>Zs.call(this,o)),this;tm.call(this,r);let s={...r,type:(0, Sn.getJSONTypes)(r.type),schemaType:(0, Sn.getJSONTypes)(r.schemaType)};return (0, eo.eachItem)(n,s.type.length===0?o=>Zs.call(this,o,s):o=>s.type.forEach(a=>Zs.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 c=n[i];if(typeof c!="object")continue;let{$data:u}=c.definition,d=a[i];u&&d&&(a[i]=Zi(d));}}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 c=this._cache.get(t);if(c!==void 0)return c;n=(0, Cr.normalizeId)(a||n);let u=Cr.getSchemaRefs.call(this,t,n);return c=new Rr.SchemaEnv({schema:t,schemaId:i,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(t,true),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Rr.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{Rr.compileSchema.call(this,t);}finally{this.opts=r;}}};$r.ValidationError=Fp.default;$r.MissingRefError=Xi.default;ge.default=$r;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 Yi(e){return e=(0, Cr.normalizeId)(e),this.schemas[e]||this.refs[e]}function Jp(){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 zp(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t);}}function Hp(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 Wp(){let e={...this.opts};for(let t of Vp)delete e[t];return e}var Yp={log(){},warn(){},error(){}};function Xp(e){if(e===false)return Yp;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 Qp=/^[a-z_$][a-z0-9_$:-]*$/i;function Zp(e,t){let{RULES:r}=this;if((0, eo.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Qp.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 Zs(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:c})=>c===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, Sn.getJSONTypes)(t.type),schemaType:(0, Sn.getJSONTypes)(t.schemaType)}};t.before?em.call(this,a,i,t.before):a.rules.push(i),o.all[e]=i,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c));}function em(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 tm(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Zi(t)),e.validateSchema=this.compile(t,true));}var rm={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Zi(e){return {anyOf:[e,rm]}}});var tu=T(to=>{Object.defineProperty(to,"__esModule",{value:true});var nm={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};to.default=nm;});var ou=T(qt=>{Object.defineProperty(qt,"__esModule",{value:true});qt.callRef=qt.getValidate=void 0;var sm=br(),ru=Le(),Pe=U(),tr=ot(),nu=mn(),kn=Q(),om={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:a,opts:i,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return l();let d=nu.resolveRef.call(c,u,s,r);if(d===void 0)throw new sm.default(n.opts.uriResolver,s,r);if(d instanceof nu.SchemaEnv)return m(d);return h(d);function l(){if(o===u)return wn(e,a,o,o.$async);let f=t.scopeValue("root",{ref:u});return wn(e,(0, Pe._)`${f}.validate`,u,u.$async)}function m(f){let p=su(e,f);wn(e,p,f,f.$async);}function h(f){let p=t.scopeValue("schema",i.code.source===true?{ref:f,code:(0, Pe.stringify)(f)}:{ref:f}),S=t.name("valid"),b=e.subschema({schema:f,dataTypes:[],schemaPath:Pe.nil,topSchemaRef:p,errSchemaPath:r},S);e.mergeEvaluated(b),e.ok(S);}}};function su(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0, Pe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qt.getValidate=su;function wn(e,t,r,n){let{gen:s,it:o}=e,{allErrors:a,schemaEnv:i,opts:c}=o,u=c.passContext?tr.default.this:Pe.nil;n?d():l();function d(){if(!i.$async)throw new Error("async schema referenced by sync schema");let f=s.let("valid");s.try(()=>{s.code((0, Pe._)`await ${(0, ru.callValidateCode)(e,t,u)}`),h(t),a||s.assign(f,true);},p=>{s.if((0, Pe._)`!(${p} instanceof ${o.ValidationError})`,()=>s.throw(p)),m(p),a||s.assign(f,false);}),e.ok(f);}function l(){e.result((0, ru.callValidateCode)(e,t,u),()=>h(t),()=>m(t));}function m(f){let p=(0, Pe._)`${f}.errors`;s.assign(tr.default.vErrors,(0, Pe._)`${tr.default.vErrors} === null ? ${p} : ${tr.default.vErrors}.concat(${p})`),s.assign(tr.default.errors,(0, Pe._)`${tr.default.vErrors}.length`);}function h(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=kn.mergeEvaluated.props(s,S.props,o.props));else {let b=s.var("props",(0, Pe._)`${f}.evaluated.props`);o.props=kn.mergeEvaluated.props(s,b,o.props,Pe.Name);}if(o.items!==true)if(S&&!S.dynamicItems)S.items!==void 0&&(o.items=kn.mergeEvaluated.items(s,S.items,o.items));else {let b=s.var("items",(0, Pe._)`${f}.evaluated.items`);o.items=kn.mergeEvaluated.items(s,b,o.items,Pe.Name);}}}qt.callRef=wn;qt.default=om;});var au=T(ro=>{Object.defineProperty(ro,"__esModule",{value:true});var am=tu(),im=ou(),um=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",am.default,im.default];ro.default=um;});var iu=T(no=>{Object.defineProperty(no,"__esModule",{value:true});var bn=U(),St=bn.operators,_n={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}},cm={message:({keyword:e,schemaCode:t})=>(0, bn.str)`must be ${_n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0, bn._)`{comparison: ${_n[e].okStr}, limit: ${t}}`},dm={keyword:Object.keys(_n),type:"number",schemaType:"number",$data:true,error:cm,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0, bn._)`${r} ${_n[t].fail} ${n} || isNaN(${r})`);}};no.default=dm;});var uu=T(so=>{Object.defineProperty(so,"__esModule",{value:true});var Er=U(),lm={message:({schemaCode:e})=>(0, Er.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0, Er._)`{multipleOf: ${e}}`},fm={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:lm,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),i=o?(0, Er._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0, Er._)`${a} !== parseInt(${a})`;e.fail$data((0, Er._)`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`);}};so.default=fm;});var du=T(oo=>{Object.defineProperty(oo,"__esModule",{value:true});function cu(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}oo.default=cu;cu.code='require("ajv/dist/runtime/ucs2length").default';});var lu=T(ao=>{Object.defineProperty(ao,"__esModule",{value:true});var Ft=U(),pm=Q(),mm=du(),gm={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return (0, Ft.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0, Ft._)`{limit: ${e}}`},hm={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:gm,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?Ft.operators.GT:Ft.operators.LT,a=s.opts.unicode===false?(0, Ft._)`${r}.length`:(0, Ft._)`${(0, pm.useFunc)(e.gen,mm.default)}(${r})`;e.fail$data((0, Ft._)`${a} ${o} ${n}`);}};ao.default=hm;});var fu=T(io=>{Object.defineProperty(io,"__esModule",{value:true});var ym=Le(),vm=Q(),rr=U(),Sm={message:({schemaCode:e})=>(0, rr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0, rr._)`{pattern: ${e}}`},km={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:Sm,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:c}=a.opts.code,u=c.code==="new RegExp"?(0, rr._)`new RegExp`:(0, vm.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,(0, rr._)`${u}(${o}, ${i}).test(${r})`),()=>t.assign(d,false)),e.fail$data((0, rr._)`!${d}`);}else {let c=(0, ym.usePattern)(e,s);e.fail$data((0, rr._)`!${c}.test(${r})`);}}};io.default=km;});var pu=T(uo=>{Object.defineProperty(uo,"__esModule",{value:true});var xr=U(),wm={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return (0, xr.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0, xr._)`{limit: ${e}}`},bm={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:wm,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?xr.operators.GT:xr.operators.LT;e.fail$data((0, xr._)`Object.keys(${r}).length ${s} ${n}`);}};uo.default=bm;});var mu=T(co=>{Object.defineProperty(co,"__esModule",{value:true});var Ar=Le(),Tr=U(),_m=Q(),Rm={message:({params:{missingProperty:e}})=>(0, Tr.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0, Tr._)`{missingProperty: ${e}}`},Cm={keyword:"required",type:"object",schemaType:"array",$data:true,error:Rm,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 c=r.length>=i.loopRequired;if(a.allErrors?u():d(),i.strictRequired){let h=e.parentSchema.properties,{definedProperties:f}=e.it;for(let p of r)if(h?.[p]===void 0&&!f.has(p)){let S=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${p}" is not defined at "${S}" (strictRequired)`;(0, _m.checkStrictMode)(a,b,a.opts.strictRequired);}}function u(){if(c||o)e.block$data(Tr.nil,l);else for(let h of r)(0, Ar.checkReportMissingProp)(e,h);}function d(){let h=t.let("missing");if(c||o){let f=t.let("valid",true);e.block$data(f,()=>m(h,f)),e.ok(f);}else t.if((0, Ar.checkMissingProp)(e,r,h)),(0, Ar.reportMissingProp)(e,h),t.else();}function l(){t.forOf("prop",n,h=>{e.setParams({missingProperty:h}),t.if((0, Ar.noPropertyInData)(t,s,h,i.ownProperties),()=>e.error());});}function m(h,f){e.setParams({missingProperty:h}),t.forOf(h,n,()=>{t.assign(f,(0, Ar.propertyInData)(t,s,h,i.ownProperties)),t.if((0, Tr.not)(f),()=>{e.error(),t.break();});},Tr.nil);}}};co.default=Cm;});var gu=T(lo=>{Object.defineProperty(lo,"__esModule",{value:true});var Ir=U(),$m={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return (0, Ir.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0, Ir._)`{limit: ${e}}`},Em={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:$m,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Ir.operators.GT:Ir.operators.LT;e.fail$data((0, Ir._)`${r}.length ${s} ${n}`);}};lo.default=Em;});var Rn=T(fo=>{Object.defineProperty(fo,"__esModule",{value:true});var hu=Ns();hu.code='require("ajv/dist/runtime/equal").default';fo.default=hu;});var yu=T(mo=>{Object.defineProperty(mo,"__esModule",{value:true});var po=yr(),he=U(),xm=Q(),Am=Rn(),Tm={message:({params:{i:e,j:t}})=>(0, he.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0, he._)`{i: ${e}, j: ${t}}`},Im={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:Tm,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:a,it:i}=e;if(!n&&!s)return;let c=t.let("valid"),u=o.items?(0, po.getSchemaTypes)(o.items):[];e.block$data(c,d,(0, he._)`${a} === false`),e.ok(c);function d(){let f=t.let("i",(0, he._)`${r}.length`),p=t.let("j");e.setParams({i:f,j:p}),t.assign(c,true),t.if((0, he._)`${f} > 1`,()=>(l()?m:h)(f,p));}function l(){return u.length>0&&!u.some(f=>f==="object"||f==="array")}function m(f,p){let S=t.name("item"),b=(0, po.checkDataTypes)(u,S,i.opts.strictNumbers,po.DataType.Wrong),j=t.const("indices",(0, he._)`{}`);t.for((0, he._)`;${f}--;`,()=>{t.let(S,(0, he._)`${r}[${f}]`),t.if(b,(0, he._)`continue`),u.length>1&&t.if((0, he._)`typeof ${S} == "string"`,(0, he._)`${S} += "_"`),t.if((0, he._)`typeof ${j}[${S}] == "number"`,()=>{t.assign(p,(0, he._)`${j}[${S}]`),e.error(),t.assign(c,false).break();}).code((0, he._)`${j}[${S}] = ${f}`);});}function h(f,p){let S=(0, xm.useFunc)(t,Am.default),b=t.name("outer");t.label(b).for((0, he._)`;${f}--;`,()=>t.for((0, he._)`${p} = ${f}; ${p}--;`,()=>t.if((0, he._)`${S}(${r}[${f}], ${r}[${p}])`,()=>{e.error(),t.assign(c,false).break(b);})));}}};mo.default=Im;});var vu=T(ho=>{Object.defineProperty(ho,"__esModule",{value:true});var go=U(),Pm=Q(),jm=Rn(),Om={message:"must be equal to constant",params:({schemaCode:e})=>(0, go._)`{allowedValue: ${e}}`},Nm={keyword:"const",$data:true,error:Om,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0, go._)`!${(0, Pm.useFunc)(t,jm.default)}(${r}, ${s})`):e.fail((0, go._)`${o} !== ${r}`);}};ho.default=Nm;});var Su=T(yo=>{Object.defineProperty(yo,"__esModule",{value:true});var Pr=U(),qm=Q(),Fm=Rn(),Dm={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0, Pr._)`{allowedValues: ${e}}`},Mm={keyword:"enum",schemaType:"array",$data:true,error:Dm,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,c,u=()=>c??(c=(0, qm.useFunc)(t,Fm.default)),d;if(i||n)d=t.let("valid"),e.block$data(d,l);else {if(!Array.isArray(s))throw new Error("ajv implementation error");let h=t.const("vSchema",o);d=(0, Pr.or)(...s.map((f,p)=>m(h,p)));}e.pass(d);function l(){t.assign(d,false),t.forOf("v",o,h=>t.if((0, Pr._)`${u()}(${r}, ${h})`,()=>t.assign(d,true).break()));}function m(h,f){let p=s[f];return typeof p=="object"&&p!==null?(0, Pr._)`${u()}(${r}, ${h}[${f}])`:(0, Pr._)`${r} === ${p}`}}};yo.default=Mm;});var ku=T(vo=>{Object.defineProperty(vo,"__esModule",{value:true});var Lm=iu(),Vm=uu(),Bm=lu(),Km=fu(),Gm=pu(),Um=mu(),Jm=gu(),zm=yu(),Hm=vu(),Wm=Su(),Ym=[Lm.default,Vm.default,Bm.default,Km.default,Gm.default,Um.default,Jm.default,zm.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Hm.default,Wm.default];vo.default=Ym;});var ko=T(jr=>{Object.defineProperty(jr,"__esModule",{value:true});jr.validateAdditionalItems=void 0;var Dt=U(),So=Q(),Xm={message:({params:{len:e}})=>(0, Dt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, Dt._)`{limit: ${e}}`},Qm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Xm,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0, So.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}wu(e,n);}};function wu(e,t){let{gen:r,schema:n,data:s,keyword:o,it:a}=e;a.items=true;let i=r.const("len",(0, Dt._)`${s}.length`);if(n===false)e.setParams({len:t.length}),e.pass((0, Dt._)`${i} <= ${t.length}`);else if(typeof n=="object"&&!(0, So.alwaysValidSchema)(a,n)){let u=r.var("valid",(0, Dt._)`${i} <= ${t.length}`);r.if((0, Dt.not)(u),()=>c(u)),e.ok(u);}function c(u){r.forRange("i",t.length,i,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:So.Type.Num},u),a.allErrors||r.if((0, Dt.not)(u),()=>r.break());});}}jr.validateAdditionalItems=wu;jr.default=Qm;});var wo=T(Or=>{Object.defineProperty(Or,"__esModule",{value:true});Or.validateTuple=void 0;var bu=U(),Cn=Q(),Zm=Le(),eg={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return _u(e,"additionalItems",t);r.items=true,!(0, Cn.alwaysValidSchema)(r,t)&&e.ok((0, Zm.validateArray)(e));}};function _u(e,t,r=e.schema){let{gen:n,parentSchema:s,data:o,keyword:a,it:i}=e;d(s),i.opts.unevaluated&&r.length&&i.items!==true&&(i.items=Cn.mergeEvaluated.items(n,r.length,i.items));let c=n.name("valid"),u=n.const("len",(0, bu._)`${o}.length`);r.forEach((l,m)=>{(0, Cn.alwaysValidSchema)(i,l)||(n.if((0, bu._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c));});function d(l){let{opts:m,errSchemaPath:h}=i,f=r.length,p=f===l.minItems&&(f===l.maxItems||l[t]===false);if(m.strictTuples&&!p){let S=`"${a}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0, Cn.checkStrictMode)(i,S,m.strictTuples);}}}Or.validateTuple=_u;Or.default=eg;});var Ru=T(bo=>{Object.defineProperty(bo,"__esModule",{value:true});var tg=wo(),rg={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0, tg.validateTuple)(e,"items")};bo.default=rg;});var $u=T(_o=>{Object.defineProperty(_o,"__esModule",{value:true});var Cu=U(),ng=Q(),sg=Le(),og=ko(),ag={message:({params:{len:e}})=>(0, Cu.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0, Cu._)`{limit: ${e}}`},ig={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:ag,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=true,!(0, ng.alwaysValidSchema)(n,t)&&(s?(0, og.validateAdditionalItems)(e,s):e.ok((0, sg.validateArray)(e)));}};_o.default=ig;});var Eu=T(Ro=>{Object.defineProperty(Ro,"__esModule",{value:true});var Be=U(),$n=Q(),ug={message:({params:{min:e,max:t}})=>t===void 0?(0, Be.str)`must contain at least ${e} valid item(s)`:(0, Be.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0, Be._)`{minContains: ${e}}`:(0, Be._)`{minContains: ${e}, maxContains: ${t}}`},cg={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:ug,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e,a,i,{minContains:c,maxContains:u}=n;o.opts.next?(a=c===void 0?1:c,i=u):a=1;let d=t.const("len",(0, Be._)`${s}.length`);if(e.setParams({min:a,max:i}),i===void 0&&a===0){(0, $n.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0, $n.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0, $n.alwaysValidSchema)(o,r)){let p=(0, Be._)`${d} >= ${a}`;i!==void 0&&(p=(0, Be._)`${p} && ${d} <= ${i}`),e.pass(p);return}o.items=true;let l=t.name("valid");i===void 0&&a===1?h(l,()=>t.if(l,()=>t.break())):a===0?(t.let(l,true),i!==void 0&&t.if((0, Be._)`${s}.length > 0`,m)):(t.let(l,false),m()),e.result(l,()=>e.reset());function m(){let p=t.name("_valid"),S=t.let("count",0);h(p,()=>t.if(p,()=>f(S)));}function h(p,S){t.forRange("i",0,d,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:$n.Type.Num,compositeRule:true},p),S();});}function f(p){t.code((0, Be._)`${p}++`),i===void 0?t.if((0, Be._)`${p} >= ${a}`,()=>t.assign(l,true).break()):(t.if((0, Be._)`${p} > ${i}`,()=>t.assign(l,false).break()),a===1?t.assign(l,true):t.if((0, Be._)`${p} >= ${a}`,()=>t.assign(l,true)));}}};Ro.default=cg;});var Tu=T(et=>{Object.defineProperty(et,"__esModule",{value:true});et.validateSchemaDeps=et.validatePropertyDeps=et.error=void 0;var Co=U(),dg=Q(),Nr=Le();et.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 ig={keyword:"dependencies",type:"object",schemaType:"object",error:et.error,code(e){let[t,r]=ug(e);Cu(e,t),$u(e,r);}};function ug({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 Cu(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 c=(0, jr.propertyInData)(r,n,a,s.opts.ownProperties);e.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),s.allErrors?r.if(c,()=>{for(let u of i)(0, jr.checkReportMissingProp)(e,u);}):(r.if((0, _o._)`${c} && (${(0, jr.checkMissingProp)(e,i,o)})`),(0, jr.reportMissingProp)(e,o),r.else());}}et.validatePropertyDeps=Cu;function $u(e,t=e.schema){let{gen:r,data:n,keyword:s,it:o}=e,a=r.name("valid");for(let i in t)(0, ag.alwaysValidSchema)(o,t[i])||(r.if((0, jr.propertyInData)(r,n,i,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:i},a);e.mergeValidEvaluated(c,a);},()=>r.var(a,true)),e.ok(a));}et.validateSchemaDeps=$u;et.default=ig;});var Tu=T(Ro=>{Object.defineProperty(Ro,"__esModule",{value:true});var xu=U(),cg=X(),dg={message:"property name must be valid",params:({params:e})=>(0, xu._)`{propertyName: ${e.propertyName}}`},lg={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dg,code(e){let{gen:t,schema:r,data:n,it:s}=e;if((0, cg.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, xu.not)(o),()=>{e.error(true),s.allErrors||t.break();});}),e.ok(o);}};Ro.default=lg;});var $o=T(Co=>{Object.defineProperty(Co,"__esModule",{value:true});var $n=Le(),Ye=U(),fg=at(),En=X(),pg={message:"must NOT have additional properties",params:({params:e})=>(0, Ye._)`{additionalProperty: ${e.additionalProperty}}`},mg={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:pg,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:c}=a;if(a.props=true,c.removeAdditional!=="all"&&(0, En.alwaysValidSchema)(a,r))return;let u=(0, $n.allSchemaProperties)(n.properties),d=(0, $n.allSchemaProperties)(n.patternProperties);l(),e.ok((0, Ye._)`${o} === ${fg.default.errors}`);function l(){t.forIn("key",s,S=>{!u.length&&!d.length?f(S):t.if(m(S),()=>f(S));});}function m(S){let _;if(u.length>8){let w=(0, En.schemaRefOrVal)(a,n.properties,"properties");_=(0, $n.isOwnProperty)(t,w,S);}else u.length?_=(0, Ye.or)(...u.map(w=>(0, Ye._)`${S} === ${w}`)):_=Ye.nil;return d.length&&(_=(0, Ye.or)(_,...d.map(w=>(0, Ye._)`${(0, $n.usePattern)(e,w)}.test(${S})`))),(0, Ye.not)(_)}function g(S){t.code((0, Ye._)`delete ${s}[${S}]`);}function f(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===false){g(S);return}if(r===false){e.setParams({additionalProperty:S}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0, En.alwaysValidSchema)(a,r)){let _=t.name("valid");c.removeAdditional==="failing"?(p(S,_,false),t.if((0, Ye.not)(_),()=>{e.reset(),g(S);})):(p(S,_),i||t.if((0, Ye.not)(_),()=>t.break()));}}function p(S,_,w){let R={keyword:"additionalProperties",dataProp:S,dataPropType:En.Type.Str};w===false&&Object.assign(R,{compositeRule:true,createErrors:false,allErrors:false}),e.subschema(R,_);}}};Co.default=mg;});var Pu=T(xo=>{Object.defineProperty(xo,"__esModule",{value:true});var gg=kr(),Au=Le(),Eo=X(),Iu=$o(),hg={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&&Iu.default.code(new gg.KeywordCxt(o,Iu.default,"additionalProperties"));let a=(0, Au.allSchemaProperties)(r);for(let l of a)o.definedProperties.add(l);o.opts.unevaluated&&a.length&&o.props!==true&&(o.props=Eo.mergeEvaluated.props(t,(0, Eo.toHash)(a),o.props));let i=a.filter(l=>!(0, Eo.alwaysValidSchema)(o,r[l]));if(i.length===0)return;let c=t.name("valid");for(let l of i)u(l)?d(l):(t.if((0, Au.propertyInData)(t,s,l,o.opts.ownProperties)),d(l),o.allErrors||t.else().var(c,true),t.endIf()),e.it.definedProperties.add(l),e.ok(c);function u(l){return o.opts.useDefaults&&!o.compositeRule&&r[l].default!==void 0}function d(l){e.subschema({keyword:"properties",schemaProp:l,dataProp:l},c);}}};xo.default=hg;});var qu=T(To=>{Object.defineProperty(To,"__esModule",{value:true});var Ou=Le(),xn=U(),ju=X(),Nu=X(),yg={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, Ou.allSchemaProperties)(r),c=i.filter(p=>(0, ju.alwaysValidSchema)(o,r[p]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===true))return;let u=a.strictSchema&&!a.allowMatchingProperties&&s.properties,d=t.name("valid");o.props!==true&&!(o.props instanceof xn.Name)&&(o.props=(0, Nu.evaluatedPropsToName)(t,o.props));let{props:l}=o;m();function m(){for(let p of i)u&&g(p),o.allErrors?f(p):(t.var(d,true),f(p),t.if(d));}function g(p){for(let S in u)new RegExp(p).test(S)&&(0, ju.checkStrictMode)(o,`property ${S} matches pattern ${p} (use allowMatchingProperties)`);}function f(p){t.forIn("key",n,S=>{t.if((0, xn._)`${(0, Ou.usePattern)(e,p)}.test(${S})`,()=>{let _=c.includes(p);_||e.subschema({keyword:"patternProperties",schemaProp:p,dataProp:S,dataPropType:Nu.Type.Str},d),o.opts.unevaluated&&l!==true?t.assign((0, xn._)`${l}[${S}]`,true):!_&&!o.allErrors&&t.if((0, xn.not)(d),()=>t.break());});});}}};To.default=yg;});var Fu=T(Ao=>{Object.defineProperty(Ao,"__esModule",{value:true});var vg=X(),Sg={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){let{gen:t,schema:r,it:n}=e;if((0, vg.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"}};Ao.default=Sg;});var Du=T(Io=>{Object.defineProperty(Io,"__esModule",{value:true});var kg=Le(),wg={keyword:"anyOf",schemaType:"array",trackErrors:true,code:kg.validateUnion,error:{message:"must match a schema in anyOf"}};Io.default=wg;});var Mu=T(Po=>{Object.defineProperty(Po,"__esModule",{value:true});var Tn=U(),bg=X(),_g={message:"must match exactly one schema in oneOf",params:({params:e})=>(0, Tn._)`{passingSchemas: ${e.passing}}`},Rg={keyword:"oneOf",schemaType:"array",trackErrors:true,error:_g,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),c=t.name("_valid");e.setParams({passing:i}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(true));function u(){o.forEach((d,l)=>{let m;(0, bg.alwaysValidSchema)(s,d)?t.var(c,true):m=e.subschema({keyword:"oneOf",schemaProp:l,compositeRule:true},c),l>0&&t.if((0, Tn._)`${c} && ${a}`).assign(a,false).assign(i,(0, Tn._)`[${i}, ${l}]`).else(),t.if(c,()=>{t.assign(a,true),t.assign(i,l),m&&e.mergeEvaluated(m,Tn.Name);});});}}};Po.default=Rg;});var Lu=T(Oo=>{Object.defineProperty(Oo,"__esModule",{value:true});var Cg=X(),$g={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, Cg.alwaysValidSchema)(n,o))return;let i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i);});}};Oo.default=$g;});var Ku=T(jo=>{Object.defineProperty(jo,"__esModule",{value:true});var An=U(),Bu=X(),Eg={message:({params:e})=>(0, An.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0, An._)`{failingKeyword: ${e.ifClause}}`},xg={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:Eg,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0, Bu.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=Vu(n,"then"),o=Vu(n,"else");if(!s&&!o)return;let a=t.let("valid",true),i=t.name("_valid");if(c(),e.reset(),s&&o){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(i,u("then",d),u("else",d));}else s?t.if(i,u("then")):t.if((0, An.not)(i),u("else"));e.pass(a,()=>e.error(true));function c(){let d=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},i);e.mergeEvaluated(d);}function u(d,l){return ()=>{let m=e.subschema({keyword:d},i);t.assign(a,i),e.mergeValidEvaluated(m,a),l?t.assign(l,(0, An._)`${d}`):e.setParams({ifClause:d});}}}};function Vu(e,t){let r=e.schema[t];return r!==void 0&&!(0, Bu.alwaysValidSchema)(e,r)}jo.default=xg;});var Gu=T(No=>{Object.defineProperty(No,"__esModule",{value:true});var Tg=X(),Ag={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0, Tg.checkStrictMode)(r,`"${e}" without "if" is ignored`);}};No.default=Ag;});var Uu=T(qo=>{Object.defineProperty(qo,"__esModule",{value:true});var Ig=vo(),Pg=wu(),Og=So(),jg=_u(),Ng=Ru(),qg=Eu(),Fg=Tu(),Dg=$o(),Mg=Pu(),Lg=qu(),Vg=Fu(),Bg=Du(),Kg=Mu(),Gg=Lu(),Ug=Ku(),Jg=Gu();function zg(e=false){let t=[Vg.default,Bg.default,Kg.default,Gg.default,Ug.default,Jg.default,Fg.default,Dg.default,qg.default,Mg.default,Lg.default];return e?t.push(Pg.default,jg.default):t.push(Ig.default,Og.default),t.push(Ng.default),t}qo.default=zg;});var Ju=T(Fo=>{Object.defineProperty(Fo,"__esModule",{value:true});var de=U(),Hg={message:({schemaCode:e})=>(0, de.str)`must match format "${e}"`,params:({schemaCode:e})=>(0, de._)`{format: ${e}}`},Wg={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:Hg,code(e,t){let{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:l}=i;if(!c.validateFormats)return;s?m():g();function m(){let f=r.scopeValue("formats",{ref:l.formats,code:c.code.formats}),p=r.const("fDef",(0, de._)`${f}[${a}]`),S=r.let("fType"),_=r.let("format");r.if((0, de._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(S,(0, de._)`${p}.type || "string"`).assign(_,(0, de._)`${p}.validate`),()=>r.assign(S,(0, de._)`"string"`).assign(_,p)),e.fail$data((0, de.or)(w(),R()));function w(){return c.strictSchema===false?de.nil:(0, de._)`${a} && !${_}`}function R(){let j=d.$async?(0, de._)`(${p}.async ? await ${_}(${n}) : ${_}(${n}))`:(0, de._)`${_}(${n})`,v=(0, de._)`(typeof ${_} == "function" ? ${j} : ${_}.test(${n}))`;return (0, de._)`${_} && ${_} !== true && ${S} === ${t} && !${v}`}}function g(){let f=l.formats[o];if(!f){w();return}if(f===true)return;let[p,S,_]=R(f);p===t&&e.pass(j());function w(){if(c.strictSchema===false){l.logger.warn(v());return}throw new Error(v());function v(){return `unknown format "${o}" ignored in schema at path "${u}"`}}function R(v){let h=v instanceof RegExp?(0, de.regexpCode)(v):c.code.formats?(0, de._)`${c.code.formats}${(0, de.getProperty)(o)}`:void 0,k=r.scopeValue("formats",{key:o,ref:v,code:h});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0, de._)`${k}.validate`]:["string",v,k]}function j(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!d.$async)throw new Error("async format in sync schema");return (0, de._)`await ${_}(${n})`}return typeof S=="function"?(0, de._)`${_}(${n})`:(0, de._)`${_}.test(${n})`}}}};Fo.default=Wg;});var zu=T(Do=>{Object.defineProperty(Do,"__esModule",{value:true});var Yg=Ju(),Xg=[Yg.default];Do.default=Xg;});var Hu=T(er=>{Object.defineProperty(er,"__esModule",{value:true});er.contentVocabulary=er.metadataVocabulary=void 0;er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var Yu=T(Mo=>{Object.defineProperty(Mo,"__esModule",{value:true});var Qg=nu(),Zg=yu(),eh=Uu(),th=zu(),Wu=Hu(),rh=[Qg.default,Zg.default,(0, eh.default)(),th.default,Wu.metadataVocabulary,Wu.contentVocabulary];Mo.default=rh;});var Qu=T(In=>{Object.defineProperty(In,"__esModule",{value:true});In.DiscrError=void 0;var Xu;(function(e){e.Tag="tag",e.Mapping="mapping";})(Xu||(In.DiscrError=Xu={}));});var ec=T(Vo=>{Object.defineProperty(Vo,"__esModule",{value:true});var tr=U(),Lo=Qu(),Zu=pn(),nh=wr(),sh=X(),oh={message:({params:{discrError:e,tagName:t}})=>e===Lo.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0, tr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},ah={keyword:"discriminator",type:"object",schemaType:"object",error:oh,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 c=t.let("valid",false),u=t.const("tag",(0, tr._)`${r}${(0, tr.getProperty)(i)}`);t.if((0, tr._)`typeof ${u} == "string"`,()=>d(),()=>e.error(false,{discrError:Lo.DiscrError.Tag,tag:u,tagName:i})),e.ok(c);function d(){let g=m();t.if(false);for(let f in g)t.elseIf((0, tr._)`${u} === ${f}`),t.assign(c,l(g[f]));t.else(),e.error(false,{discrError:Lo.DiscrError.Mapping,tag:u,tagName:i}),t.endIf();}function l(g){let f=t.name("valid"),p=e.subschema({keyword:"oneOf",schemaProp:g},f);return e.mergeEvaluated(p,tr.Name),f}function m(){var g;let f={},p=_(s),S=true;for(let j=0;j<a.length;j++){let v=a[j];if(v?.$ref&&!(0, sh.schemaHasRulesButRef)(v,o.self.RULES)){let k=v.$ref;if(v=Zu.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,k),v instanceof Zu.SchemaEnv&&(v=v.schema),v===void 0)throw new nh.default(o.opts.uriResolver,o.baseId,k)}let h=(g=v?.properties)===null||g===void 0?void 0:g[i];if(typeof h!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);S=S&&(p||_(v)),w(h,j);}if(!S)throw new Error(`discriminator: "${i}" must be required`);return f;function _({required:j}){return Array.isArray(j)&&j.includes(i)}function w(j,v){if(j.const)R(j.const,v);else if(j.enum)for(let h of j.enum)R(h,v);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function R(j,v){if(typeof j!="string"||j in f)throw new Error(`discriminator: "${i}" values must be unique strings`);f[j]=v;}}}};Vo.default=ah;});var tc=T((uS,ih)=>{ih.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 nc=T((ue,Bo)=>{Object.defineProperty(ue,"__esModule",{value:true});ue.MissingRefError=ue.ValidationError=ue.CodeGen=ue.Name=ue.nil=ue.stringify=ue.str=ue._=ue.KeywordCxt=ue.Ajv=void 0;var uh=Xi(),ch=Yu(),dh=ec(),rc=tc(),lh=["/properties"],Pn="http://json-schema.org/draft-07/schema",rr=class extends uh.default{_addVocabularies(){super._addVocabularies(),ch.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(rc,lh):rc;this.addMetaSchema(t,Pn,false),this.refs["http://json-schema.org/schema"]=Pn;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pn)?Pn:void 0)}};ue.Ajv=rr;Bo.exports=ue=rr;Bo.exports.Ajv=rr;Object.defineProperty(ue,"__esModule",{value:true});ue.default=rr;var fh=kr();Object.defineProperty(ue,"KeywordCxt",{enumerable:true,get:function(){return fh.KeywordCxt}});var nr=U();Object.defineProperty(ue,"_",{enumerable:true,get:function(){return nr._}});Object.defineProperty(ue,"str",{enumerable:true,get:function(){return nr.str}});Object.defineProperty(ue,"stringify",{enumerable:true,get:function(){return nr.stringify}});Object.defineProperty(ue,"nil",{enumerable:true,get:function(){return nr.nil}});Object.defineProperty(ue,"Name",{enumerable:true,get:function(){return nr.Name}});Object.defineProperty(ue,"CodeGen",{enumerable:true,get:function(){return nr.CodeGen}});var ph=ln();Object.defineProperty(ue,"ValidationError",{enumerable:true,get:function(){return ph.default}});var mh=wr();Object.defineProperty(ue,"MissingRefError",{enumerable:true,get:function(){return mh.default}});});var Br="b64:";function ad(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 id(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 `${Br}${ad(JSON.stringify(e))}`}function Ge(e){if(!e.startsWith(Br))throw new Error(`Invalid ref format (expected ${Br}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(id(e.slice(Br.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 sa(e,t,r){let n=e.tryAcquire();if(!n)return false;try{await t();}finally{n();}return r?.(),true}function xe(...e){return Y.join(...e)}function ua(e){return Y.isAbsolute(e)}function Jn(){return randomUUID()}function ca(e){return createHash("sha256").update(e).digest("hex")}function da(e){return Y.dirname(fileURLToPath(e))}function pd(e){if(typeof e=="object"&&e!==null){let{command:r,args:n=[],...s}=e,o=aa(r,n);return {...s,command:o.command,args:o.args}}let t=la(e);if(t.length===0)throw new Error(`Empty command spec: ${JSON.stringify(e)}`);return aa(t[0],t.slice(1))}function aa(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 la(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 zn(e){return process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)}function fa(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a}=e;return execFileSync(r,n,{shell:zn(r),timeout:a,encoding:t?.encoding??"utf-8",cwd:s,windowsHide:true,env:o?{...process.env,...o}:void 0,input:t?.input})}function md(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a=3e4}=e;execFile(r,n,{shell:zn(r),encoding:"utf8",windowsHide:true,timeout:a,maxBuffer:10*1024*1024,cwd:s,env:o?{...process.env,...o}:void 0},(i,c,u)=>t(i??null,c,u));}Y.join(Un.tmpdir(),".board-live-cards-git-bash-cache.json");function Gr(e){let{command:t,args:r=[]}=e;if(process.platform==="win32"){spawn(t,r,{stdio:"ignore",windowsHide:true,shell:zn(t)}).unref();return}spawn(t,r,{detached:true,stdio:"ignore"}).unref();}function Hn(e,t,r){let n=Y.join(e,"board-live-cards-cli.js");if(b.existsSync(n))return {cmd:process.execPath,args:[n,t,...r]};let s=Y.join(e,"board-live-cards-cli.ts"),a=[Y.join(e,"..","..","..","node_modules","tsx","dist","cli.mjs"),Y.join(e,"..","..","node_modules","tsx","dist","cli.mjs"),Y.join(e,"..","..","..","node_modules",".bin","tsx"),Y.join(e,"..","..","node_modules",".bin","tsx")].find(c=>b.existsSync(c));return b.existsSync(s)&&b.existsSync(a)?{cmd:process.execPath,args:[a,s,t,...r]}:{cmd:process.platform==="win32"?"npx.cmd":"npx",args:["tsx",s,t,...r]}}function Wn(e){let t=Y.join(e,"board-live-cards-cli.mjs");if(b.existsSync(t))return t;let r=Y.join(e,"..","..","..","dev","board-live-cards-cli.js");if(b.existsSync(r))return r;let n=Y.join(e,"..","..","dev","board-live-cards-cli.js");if(b.existsSync(n))return n;let s=Y.join(e,"board-live-cards-cli.js");if(b.existsSync(s))return s;throw new Error(`resolveBoardCliCallbackTarget: cannot find callback target in ${e} (expected dev/board-live-cards-cli.js wrapper, ${s}, or ${t})`)}function pa(e,t,r){let n=["--base-ref",oe(t)];r&&n.push("--notify-channel",r);let{cmd:s,args:o}=Hn(e,"process-accumulated-events",n);Gr({command:s,args:o});}function gd(e){return process.platform==="win32"?`\\\\.\\pipe\\${e}`:Y.join(Un.tmpdir(),`${e}.sock`)}var Kr=new Map;function ma(e,t,r){if(t.length===0)return;let n=t.map(i=>JSON.stringify(i)).join(`
|
|
8
|
+
deps: ${r}}`};var lg={keyword:"dependencies",type:"object",schemaType:"object",error:et.error,code(e){let[t,r]=fg(e);xu(e,t),Au(e,r);}};function fg({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 xu(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 c=(0, Nr.propertyInData)(r,n,a,s.opts.ownProperties);e.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),s.allErrors?r.if(c,()=>{for(let u of i)(0, Nr.checkReportMissingProp)(e,u);}):(r.if((0, Co._)`${c} && (${(0, Nr.checkMissingProp)(e,i,o)})`),(0, Nr.reportMissingProp)(e,o),r.else());}}et.validatePropertyDeps=xu;function Au(e,t=e.schema){let{gen:r,data:n,keyword:s,it:o}=e,a=r.name("valid");for(let i in t)(0, dg.alwaysValidSchema)(o,t[i])||(r.if((0, Nr.propertyInData)(r,n,i,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:i},a);e.mergeValidEvaluated(c,a);},()=>r.var(a,true)),e.ok(a));}et.validateSchemaDeps=Au;et.default=lg;});var Pu=T($o=>{Object.defineProperty($o,"__esModule",{value:true});var Iu=U(),pg=Q(),mg={message:"property name must be valid",params:({params:e})=>(0, Iu._)`{propertyName: ${e.propertyName}}`},gg={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:mg,code(e){let{gen:t,schema:r,data:n,it:s}=e;if((0, pg.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, Iu.not)(o),()=>{e.error(true),s.allErrors||t.break();});}),e.ok(o);}};$o.default=gg;});var xo=T(Eo=>{Object.defineProperty(Eo,"__esModule",{value:true});var En=Le(),Ye=U(),hg=ot(),xn=Q(),yg={message:"must NOT have additional properties",params:({params:e})=>(0, Ye._)`{additionalProperty: ${e.additionalProperty}}`},vg={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:yg,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:c}=a;if(a.props=true,c.removeAdditional!=="all"&&(0, xn.alwaysValidSchema)(a,r))return;let u=(0, En.allSchemaProperties)(n.properties),d=(0, En.allSchemaProperties)(n.patternProperties);l(),e.ok((0, Ye._)`${o} === ${hg.default.errors}`);function l(){t.forIn("key",s,S=>{!u.length&&!d.length?f(S):t.if(m(S),()=>f(S));});}function m(S){let b;if(u.length>8){let j=(0, xn.schemaRefOrVal)(a,n.properties,"properties");b=(0, En.isOwnProperty)(t,j,S);}else u.length?b=(0, Ye.or)(...u.map(j=>(0, Ye._)`${S} === ${j}`)):b=Ye.nil;return d.length&&(b=(0, Ye.or)(b,...d.map(j=>(0, Ye._)`${(0, En.usePattern)(e,j)}.test(${S})`))),(0, Ye.not)(b)}function h(S){t.code((0, Ye._)`delete ${s}[${S}]`);}function f(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===false){h(S);return}if(r===false){e.setParams({additionalProperty:S}),e.error(),i||t.break();return}if(typeof r=="object"&&!(0, xn.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(p(S,b,false),t.if((0, Ye.not)(b),()=>{e.reset(),h(S);})):(p(S,b),i||t.if((0, Ye.not)(b),()=>t.break()));}}function p(S,b,j){let w={keyword:"additionalProperties",dataProp:S,dataPropType:xn.Type.Str};j===false&&Object.assign(w,{compositeRule:true,createErrors:false,allErrors:false}),e.subschema(w,b);}}};Eo.default=vg;});var Nu=T(To=>{Object.defineProperty(To,"__esModule",{value:true});var Sg=wr(),ju=Le(),Ao=Q(),Ou=xo(),kg={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&&Ou.default.code(new Sg.KeywordCxt(o,Ou.default,"additionalProperties"));let a=(0, ju.allSchemaProperties)(r);for(let l of a)o.definedProperties.add(l);o.opts.unevaluated&&a.length&&o.props!==true&&(o.props=Ao.mergeEvaluated.props(t,(0, Ao.toHash)(a),o.props));let i=a.filter(l=>!(0, Ao.alwaysValidSchema)(o,r[l]));if(i.length===0)return;let c=t.name("valid");for(let l of i)u(l)?d(l):(t.if((0, ju.propertyInData)(t,s,l,o.opts.ownProperties)),d(l),o.allErrors||t.else().var(c,true),t.endIf()),e.it.definedProperties.add(l),e.ok(c);function u(l){return o.opts.useDefaults&&!o.compositeRule&&r[l].default!==void 0}function d(l){e.subschema({keyword:"properties",schemaProp:l,dataProp:l},c);}}};To.default=kg;});var Mu=T(Io=>{Object.defineProperty(Io,"__esModule",{value:true});var qu=Le(),An=U(),Fu=Q(),Du=Q(),wg={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, qu.allSchemaProperties)(r),c=i.filter(p=>(0, Fu.alwaysValidSchema)(o,r[p]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===true))return;let u=a.strictSchema&&!a.allowMatchingProperties&&s.properties,d=t.name("valid");o.props!==true&&!(o.props instanceof An.Name)&&(o.props=(0, Du.evaluatedPropsToName)(t,o.props));let{props:l}=o;m();function m(){for(let p of i)u&&h(p),o.allErrors?f(p):(t.var(d,true),f(p),t.if(d));}function h(p){for(let S in u)new RegExp(p).test(S)&&(0, Fu.checkStrictMode)(o,`property ${S} matches pattern ${p} (use allowMatchingProperties)`);}function f(p){t.forIn("key",n,S=>{t.if((0, An._)`${(0, qu.usePattern)(e,p)}.test(${S})`,()=>{let b=c.includes(p);b||e.subschema({keyword:"patternProperties",schemaProp:p,dataProp:S,dataPropType:Du.Type.Str},d),o.opts.unevaluated&&l!==true?t.assign((0, An._)`${l}[${S}]`,true):!b&&!o.allErrors&&t.if((0, An.not)(d),()=>t.break());});});}}};Io.default=wg;});var Lu=T(Po=>{Object.defineProperty(Po,"__esModule",{value:true});var bg=Q(),_g={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){let{gen:t,schema:r,it:n}=e;if((0, bg.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=_g;});var Vu=T(jo=>{Object.defineProperty(jo,"__esModule",{value:true});var Rg=Le(),Cg={keyword:"anyOf",schemaType:"array",trackErrors:true,code:Rg.validateUnion,error:{message:"must match a schema in anyOf"}};jo.default=Cg;});var Bu=T(Oo=>{Object.defineProperty(Oo,"__esModule",{value:true});var Tn=U(),$g=Q(),Eg={message:"must match exactly one schema in oneOf",params:({params:e})=>(0, Tn._)`{passingSchemas: ${e.passing}}`},xg={keyword:"oneOf",schemaType:"array",trackErrors:true,error:Eg,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),c=t.name("_valid");e.setParams({passing:i}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(true));function u(){o.forEach((d,l)=>{let m;(0, $g.alwaysValidSchema)(s,d)?t.var(c,true):m=e.subschema({keyword:"oneOf",schemaProp:l,compositeRule:true},c),l>0&&t.if((0, Tn._)`${c} && ${a}`).assign(a,false).assign(i,(0, Tn._)`[${i}, ${l}]`).else(),t.if(c,()=>{t.assign(a,true),t.assign(i,l),m&&e.mergeEvaluated(m,Tn.Name);});});}}};Oo.default=xg;});var Ku=T(No=>{Object.defineProperty(No,"__esModule",{value:true});var Ag=Q(),Tg={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, Ag.alwaysValidSchema)(n,o))return;let i=e.subschema({keyword:"allOf",schemaProp:a},s);e.ok(s),e.mergeEvaluated(i);});}};No.default=Tg;});var Ju=T(qo=>{Object.defineProperty(qo,"__esModule",{value:true});var In=U(),Uu=Q(),Ig={message:({params:e})=>(0, In.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0, In._)`{failingKeyword: ${e.ifClause}}`},Pg={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:Ig,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0, Uu.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(c(),e.reset(),s&&o){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(i,u("then",d),u("else",d));}else s?t.if(i,u("then")):t.if((0, In.not)(i),u("else"));e.pass(a,()=>e.error(true));function c(){let d=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},i);e.mergeEvaluated(d);}function u(d,l){return ()=>{let m=e.subschema({keyword:d},i);t.assign(a,i),e.mergeValidEvaluated(m,a),l?t.assign(l,(0, In._)`${d}`):e.setParams({ifClause:d});}}}};function Gu(e,t){let r=e.schema[t];return r!==void 0&&!(0, Uu.alwaysValidSchema)(e,r)}qo.default=Pg;});var zu=T(Fo=>{Object.defineProperty(Fo,"__esModule",{value:true});var jg=Q(),Og={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0, jg.checkStrictMode)(r,`"${e}" without "if" is ignored`);}};Fo.default=Og;});var Hu=T(Do=>{Object.defineProperty(Do,"__esModule",{value:true});var Ng=ko(),qg=Ru(),Fg=wo(),Dg=$u(),Mg=Eu(),Lg=Tu(),Vg=Pu(),Bg=xo(),Kg=Nu(),Gg=Mu(),Ug=Lu(),Jg=Vu(),zg=Bu(),Hg=Ku(),Wg=Ju(),Yg=zu();function Xg(e=false){let t=[Ug.default,Jg.default,zg.default,Hg.default,Wg.default,Yg.default,Vg.default,Bg.default,Lg.default,Kg.default,Gg.default];return e?t.push(qg.default,Dg.default):t.push(Ng.default,Fg.default),t.push(Mg.default),t}Do.default=Xg;});var Wu=T(Mo=>{Object.defineProperty(Mo,"__esModule",{value:true});var le=U(),Qg={message:({schemaCode:e})=>(0, le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0, le._)`{format: ${e}}`},Zg={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:Qg,code(e,t){let{gen:r,data:n,$data:s,schema:o,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:l}=i;if(!c.validateFormats)return;s?m():h();function m(){let f=r.scopeValue("formats",{ref:l.formats,code:c.code.formats}),p=r.const("fDef",(0, le._)`${f}[${a}]`),S=r.let("fType"),b=r.let("format");r.if((0, le._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(S,(0, le._)`${p}.type || "string"`).assign(b,(0, le._)`${p}.validate`),()=>r.assign(S,(0, le._)`"string"`).assign(b,p)),e.fail$data((0, le.or)(j(),w()));function j(){return c.strictSchema===false?le.nil:(0, le._)`${a} && !${b}`}function w(){let E=d.$async?(0, le._)`(${p}.async ? await ${b}(${n}) : ${b}(${n}))`:(0, le._)`${b}(${n})`,y=(0, le._)`(typeof ${b} == "function" ? ${E} : ${b}.test(${n}))`;return (0, le._)`${b} && ${b} !== true && ${S} === ${t} && !${y}`}}function h(){let f=l.formats[o];if(!f){j();return}if(f===true)return;let[p,S,b]=w(f);p===t&&e.pass(E());function j(){if(c.strictSchema===false){l.logger.warn(y());return}throw new Error(y());function y(){return `unknown format "${o}" ignored in schema at path "${u}"`}}function w(y){let v=y instanceof RegExp?(0, le.regexpCode)(y):c.code.formats?(0, le._)`${c.code.formats}${(0, le.getProperty)(o)}`:void 0,k=r.scopeValue("formats",{key:o,ref:y,code:v});return typeof y=="object"&&!(y instanceof RegExp)?[y.type||"string",y.validate,(0, le._)`${k}.validate`]:["string",y,k]}function E(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!d.$async)throw new Error("async format in sync schema");return (0, le._)`await ${b}(${n})`}return typeof S=="function"?(0, le._)`${b}(${n})`:(0, le._)`${b}.test(${n})`}}}};Mo.default=Zg;});var Yu=T(Lo=>{Object.defineProperty(Lo,"__esModule",{value:true});var eh=Wu(),th=[eh.default];Lo.default=th;});var Xu=T(nr=>{Object.defineProperty(nr,"__esModule",{value:true});nr.contentVocabulary=nr.metadataVocabulary=void 0;nr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];nr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var Zu=T(Vo=>{Object.defineProperty(Vo,"__esModule",{value:true});var rh=au(),nh=ku(),sh=Hu(),oh=Yu(),Qu=Xu(),ah=[rh.default,nh.default,(0, sh.default)(),oh.default,Qu.metadataVocabulary,Qu.contentVocabulary];Vo.default=ah;});var tc=T(Pn=>{Object.defineProperty(Pn,"__esModule",{value:true});Pn.DiscrError=void 0;var ec;(function(e){e.Tag="tag",e.Mapping="mapping";})(ec||(Pn.DiscrError=ec={}));});var nc=T(Ko=>{Object.defineProperty(Ko,"__esModule",{value:true});var sr=U(),Bo=tc(),rc=mn(),ih=br(),uh=Q(),ch={message:({params:{discrError:e,tagName:t}})=>e===Bo.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0, sr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},dh={keyword:"discriminator",type:"object",schemaType:"object",error:ch,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 c=t.let("valid",false),u=t.const("tag",(0, sr._)`${r}${(0, sr.getProperty)(i)}`);t.if((0, sr._)`typeof ${u} == "string"`,()=>d(),()=>e.error(false,{discrError:Bo.DiscrError.Tag,tag:u,tagName:i})),e.ok(c);function d(){let h=m();t.if(false);for(let f in h)t.elseIf((0, sr._)`${u} === ${f}`),t.assign(c,l(h[f]));t.else(),e.error(false,{discrError:Bo.DiscrError.Mapping,tag:u,tagName:i}),t.endIf();}function l(h){let f=t.name("valid"),p=e.subschema({keyword:"oneOf",schemaProp:h},f);return e.mergeEvaluated(p,sr.Name),f}function m(){var h;let f={},p=b(s),S=true;for(let E=0;E<a.length;E++){let y=a[E];if(y?.$ref&&!(0, uh.schemaHasRulesButRef)(y,o.self.RULES)){let k=y.$ref;if(y=rc.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,k),y instanceof rc.SchemaEnv&&(y=y.schema),y===void 0)throw new ih.default(o.opts.uriResolver,o.baseId,k)}let v=(h=y?.properties)===null||h===void 0?void 0:h[i];if(typeof v!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);S=S&&(p||b(y)),j(v,E);}if(!S)throw new Error(`discriminator: "${i}" must be required`);return f;function b({required:E}){return Array.isArray(E)&&E.includes(i)}function j(E,y){if(E.const)w(E.const,y);else if(E.enum)for(let v of E.enum)w(v,y);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function w(E,y){if(typeof E!="string"||E in f)throw new Error(`discriminator: "${i}" values must be unique strings`);f[E]=y;}}}};Ko.default=dh;});var sc=T((lS,lh)=>{lh.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 ac=T((ue,Go)=>{Object.defineProperty(ue,"__esModule",{value:true});ue.MissingRefError=ue.ValidationError=ue.CodeGen=ue.Name=ue.nil=ue.stringify=ue.str=ue._=ue.KeywordCxt=ue.Ajv=void 0;var fh=eu(),ph=Zu(),mh=nc(),oc=sc(),gh=["/properties"],jn="http://json-schema.org/draft-07/schema",or=class extends fh.default{_addVocabularies(){super._addVocabularies(),ph.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(mh.default);}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(oc,gh):oc;this.addMetaSchema(t,jn,false),this.refs["http://json-schema.org/schema"]=jn;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(jn)?jn:void 0)}};ue.Ajv=or;Go.exports=ue=or;Go.exports.Ajv=or;Object.defineProperty(ue,"__esModule",{value:true});ue.default=or;var hh=wr();Object.defineProperty(ue,"KeywordCxt",{enumerable:true,get:function(){return hh.KeywordCxt}});var ar=U();Object.defineProperty(ue,"_",{enumerable:true,get:function(){return ar._}});Object.defineProperty(ue,"str",{enumerable:true,get:function(){return ar.str}});Object.defineProperty(ue,"stringify",{enumerable:true,get:function(){return ar.stringify}});Object.defineProperty(ue,"nil",{enumerable:true,get:function(){return ar.nil}});Object.defineProperty(ue,"Name",{enumerable:true,get:function(){return ar.Name}});Object.defineProperty(ue,"CodeGen",{enumerable:true,get:function(){return ar.CodeGen}});var yh=fn();Object.defineProperty(ue,"ValidationError",{enumerable:true,get:function(){return yh.default}});var vh=br();Object.defineProperty(ue,"MissingRefError",{enumerable:true,get:function(){return vh.default}});});var Kr="b64:";function dd(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 ld(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 `${Kr}${dd(JSON.stringify(e))}`}function Ge(e){if(!e.startsWith(Kr))throw new Error(`Invalid ref format (expected ${Kr}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(ld(e.slice(Kr.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 ia(e,t,r){let n=e.tryAcquire();if(!n)return false;try{await t();}finally{n();}return r?.(),true}function xe(...e){return X.join(...e)}function la(e){return X.isAbsolute(e)}function Hn(){return randomUUID()}function fa(e){return createHash("sha256").update(e).digest("hex")}function pa(e){return X.dirname(fileURLToPath(e))}function yd(e){if(typeof e=="object"&&e!==null){let{command:r,args:n=[],...s}=e,o=ca(r,n);return {...s,command:o.command,args:o.args}}let t=ma(e);if(t.length===0)throw new Error(`Empty command spec: ${JSON.stringify(e)}`);return ca(t[0],t.slice(1))}function ca(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 ma(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 Wn(e){return process.platform==="win32"&&/\.(cmd|bat)$/i.test(e)}function ga(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a}=e;return execFileSync(r,n,{shell:Wn(r),timeout:a,encoding:t?.encoding??"utf-8",cwd:s,windowsHide:true,env:o?{...process.env,...o}:void 0,input:t?.input})}function vd(e,t){let{command:r,args:n=[],cwd:s,env:o,timeoutMs:a=3e4}=e;execFile(r,n,{shell:Wn(r),encoding:"utf8",windowsHide:true,timeout:a,maxBuffer:10*1024*1024,cwd:s,env:o?{...process.env,...o}:void 0},(i,c,u)=>t(i??null,c,u));}X.join(zn.tmpdir(),".board-live-cards-git-bash-cache.json");function Ur(e){let{command:t,args:r=[]}=e;if(process.platform==="win32"){spawn(t,r,{stdio:"ignore",windowsHide:true,shell:Wn(t)}).unref();return}spawn(t,r,{detached:true,stdio:"ignore"}).unref();}function Yn(e,t,r){let n=X.join(e,"board-live-cards-cli.js");if(_.existsSync(n))return {cmd:process.execPath,args:[n,t,...r]};let s=X.join(e,"board-live-cards-cli.ts"),a=[X.join(e,"..","..","..","node_modules","tsx","dist","cli.mjs"),X.join(e,"..","..","node_modules","tsx","dist","cli.mjs"),X.join(e,"..","..","..","node_modules",".bin","tsx"),X.join(e,"..","..","node_modules",".bin","tsx")].find(c=>_.existsSync(c));return _.existsSync(s)&&_.existsSync(a)?{cmd:process.execPath,args:[a,s,t,...r]}:{cmd:process.platform==="win32"?"npx.cmd":"npx",args:["tsx",s,t,...r]}}function Xn(e){let t=X.join(e,"board-live-cards-cli.mjs");if(_.existsSync(t))return t;let r=X.join(e,"..","..","..","dev","board-live-cards-cli.js");if(_.existsSync(r))return r;let n=X.join(e,"..","..","dev","board-live-cards-cli.js");if(_.existsSync(n))return n;let s=X.join(e,"board-live-cards-cli.js");if(_.existsSync(s))return s;throw new Error(`resolveBoardCliCallbackTarget: cannot find callback target in ${e} (expected dev/board-live-cards-cli.js wrapper, ${s}, or ${t})`)}function ha(e,t,r){let n=["--base-ref",oe(t)];r&&n.push("--notify-channel",r);let{cmd:s,args:o}=Yn(e,"process-accumulated-events",n);Ur({command:s,args:o});}function Sd(e){return process.platform==="win32"?`\\\\.\\pipe\\${e}`:X.join(zn.tmpdir(),`${e}.sock`)}var Gr=new Map;function ya(e,t,r){if(t.length===0)return;let n=t.map(i=>JSON.stringify(i)).join(`
|
|
9
9
|
`)+`
|
|
10
|
-
`,s=Kr.get(e);if(s&&!s.socket.destroyed){s.ready?s.socket.write(n):s.queue.push(n);return}let o=gd(e),a=ia.createConnection(o);s={socket:a,ready:false,queue:[n]},Kr.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)}`),Kr.delete(e);}),a.on("close",()=>{Kr.delete(e);});}function Ur(){return {executeSync(e,t,r){return fa({command:e,args:t,cwd:r?.cwd,timeoutMs:r?.timeout,env:r?.env},{encoding:r?.encoding,input:r?.input})},executeAsync(e,t,r){md({command:e,args:t},r);},resolveInvocation(e,t){let r=pd({command:e,args:t});return {cmd:r.command,args:r.args??[]}},splitCommand:la,spawnDetached(e,t){Gr({command:e,args:t});}}}var ha=dirname(fileURLToPath(import.meta.url)),kd=createRequire(import.meta.url);function wd(){let e=resolve(ha,"./jsonata-sync.cjs");return existsSync(e)?e:resolve(ha,"../../card-compute/jsonata-sync.cjs")}var Et=kd(wd());function ar(e){e.registerFunction("fsPathRef",t=>oe({kind:"fs-path",value:String(t)}),"<s:s>");}function Yn(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{let a=Et(o);ar(a),s.push(String(a.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{let s=Et(e.stdinTemplate);ar(s),n.stdin=s.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{let s=Et(e.urlTemplate);ar(s),n.url=String(s.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=Et(e.headerTemplate);ar(s);let o=s.evaluate(t);if(typeof o!="object"||o===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(o)}`);n.headers=o;}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{let s=Et(e.bodyTemplate);ar(s),n.body=s.evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.bodyTemplate failed: ${o}`)}return n}var _d=createRequire(import.meta.url);function Rd(e){return typeof e=="object"?e:Ge(e)}function va(e){let t=Y.basename(String(e||"").trim());if(!t)throw new Error(`resolveYamlFlowCliPath: expected non-empty cli file name, got ${JSON.stringify(e)}`);let r=Y.dirname(_d.resolve("yaml-flow/package.json")),n=t.replace(/\.[^.]+$/,""),s=Y.join(r,"cli","bundled",`${n}.mjs`);if(b.existsSync(s))return s;let o=Y.join(r,"cli","node",t);if(b.existsSync(o))return o;throw new Error(`resolveYamlFlowCliPath: could not find ${t} under cli/bundled or cli/node in ${r}`)}function Je(e){let t=Rd(e);return t.kind==="yaml-flow-cli"?va(t.value):t.value}function Cd(e,t){let r=Je(e);switch(r){case "source-cli-task-executor":{let n=Y.join(t,"source-cli-task-executor.js");if(b.existsSync(n))return {command:process.execPath,args:[n]};let s=Y.join(t,"source-cli-task-executor.ts"),o=Y.join(t,"..","..","node_modules","tsx","dist","cli.mjs"),a=Y.join(t,"..","..","node_modules",".bin","tsx"),i=b.existsSync(o)?o:a;return b.existsSync(s)&&b.existsSync(i)?{command:process.execPath,args:[i,s]}:{command:process.execPath,args:[n]}}case "board-live-cards":{let{cmd:n,args:s}=Hn(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}=Cd(e.whatToRun,t);return {command:n,baseArgs:s}}let r=(typeof e.whatToRun=="object",Je(e.whatToRun));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 $d(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 Ed(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 Jr(e,t){return Sa(e,t)}function ka(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 wa(e,t){return {...t,whatToRun:Je(e.whatToRun),...e.extra?{extra:e.extra}:{}}}function Xn(e,t,r="invokeExecutionRef"){return Yn(e,t,r)}function ba(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 lt(e){return {result:"failure",data:{error:e}}}function dt(e,t,r){let n=r?.label??"invokeExecutionRefSync",s=r?.cliDir??r?.cwd??process.cwd(),o;try{o=Xn(e.argsMassaging,wa(e,t),n);}catch(l){let m=l instanceof Error?l.message:String(l);return lt(m)}let a;try{a=Jr(e,s);}catch(l){let m=l instanceof Error?l.message:String(l);return lt(`[${n}] ref resolution failed: ${m}`)}let i=[...a.baseArgs,...o.cmdArgs??[]],c=JSON.stringify(o.stdin??t),u=Ur(),d;try{d=u.executeSync(a.command,i,{timeout:r?.timeoutMs??3e4,encoding:"utf-8",cwd:r?.cwd,input:c});}catch(l){let m=l,g=(m.stderr?String(m.stderr):"").trim(),f=typeof m.status=="number"?m.status:"unknown",p=g||m.message;return lt(`[${n}] ref exited with status ${f}${p?`: ${p}`:""}`)}try{return ba(ka(d))}catch{return {result:"success",data:{stdout:d.trim()}}}}async function ya(e,t,r){let n=r?.label??"invokeExecutionRef",s;try{s=Xn(e.argsMassaging,wa(e,t),n);}catch(u){let d=u instanceof Error?u.message:String(u);return lt(d)}let o=Je(e.whatToRun),a=s.headers?{"Content-Type":"application/json",...s.headers}:{"Content-Type":"application/json"},i=s.url??o,c;if(e.howToRun==="http:get"){let u=s.body&&typeof s.body=="object"&&!Array.isArray(s.body)?s.body:t,d=new URLSearchParams(Object.entries(u).filter(([,l])=>l!=null).map(([l,m])=>[l,String(m)]));d.size>0&&(i=`${i}${i.includes("?")?"&":"?"}${d.toString()}`);}else c=JSON.stringify(s.body??t);try{let u=await fetch(i,{method:e.howToRun==="http:get"?"GET":"POST",headers:a,body:c});if(!u.ok){let l=await u.text().catch(()=>"");return lt(`[${n}] HTTP ${u.status}${l?`: ${l}`:""}`)}let d=await u.text();if(!d.trim())return {result:"success",data:{}};try{return ba(ka(d))}catch{return {result:"success",data:{stdout:d.trim()}}}}catch(u){let d=u instanceof Error?u.message:String(u);return lt(`[${n}] ${d}`)}}var xd={"local-node":async(e,t,r)=>dt(e,t,r),"local-python":async(e,t,r)=>dt(e,t,r),"local-process":async(e,t,r)=>dt(e,t,r),"built-in":async(e,t,r)=>dt(e,t,r),"http:post":ya,"http:get":ya},Td={"local-node":dt,"local-python":dt,"local-process":dt,"built-in":dt};async function _a(e,t,r){let n=r?.transports?.[e.howToRun]??xd[e.howToRun];return n?n(e,t,r):lt(`[${r?.label??"invokeExecutionRef"}] unsupported howToRun: ${e.howToRun}`)}function Qn(e,t,r){let n=r?.syncTransports?.[e.howToRun]??Td[e.howToRun];return n?n(e,t,r):lt(`[${r?.label??"invokeExecutionRefSync"}] unsupported sync howToRun: ${e.howToRun}`)}function Ad(e){return {invoke(t,r){return _a(t,r,e)},invokeSync(t,r){return Qn(t,r,e)}}}function Id(e,t,r){return Qn(e,t,r)}async function Pd(e,t){let r={...t,whatToRun:Je(e.whatToRun)},n=Yn(e.argsMassaging,r,"_invokeTaskExecutorHttp"),s=n.url??Je(e.whatToRun),o=n.body?n.body:Ed(t,e.extra),a={"Content-Type":"application/json"},i=n.headers?{...a,...n.headers}:a,c=await fetch(s,{method:e.howToRun==="http:get"?"GET":"POST",headers:i,body:JSON.stringify(o)});if(!c.ok){let d=await c.text().catch(()=>"");return {status:"error",error:`HTTP ${c.status}: ${d}`}}let u=await c.json().catch(()=>null);return u&&typeof u.status=="string"?u:{status:"success"}}function Ra(e,t,r){if(e.howToRun==="http:post"||e.howToRun==="http:get"){Pd(e,t).catch(i=>{console.error(`[dispatchTaskExecutorDetached] HTTP dispatch failed: ${i.message}`);});return}let{command:s,baseArgs:o}=Sa(e,r),a=$d(t,e.extra);Gr({command:s,args:[...o,...a]});}function nt(e,t){if(process.platform!=="win32"){b.renameSync(e,t);return}let r=[10,20,40,80,160];for(let n=0;n<=r.length;n++)try{b.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 Bt(e){function t(s){return Y.join(e,...s.split("/"))}function r(s){return Y.relative(e,s).replace(/\\/g,"/")}function n(s,o){if(b.existsSync(s))for(let a of b.readdirSync(s,{withFileTypes:true})){let i=Y.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(!b.existsSync(o))return null;try{return b.readFileSync(o,"utf-8")}catch{return null}},write(s,o){let a=t(s),i=`${a}.${process.pid}.${randomUUID()}.tmp`;b.mkdirSync(Y.dirname(a),{recursive:true}),b.writeFileSync(i,o,"utf-8"),nt(i,a);},exists(s){return b.existsSync(t(s))},remove(s){let o=t(s);try{b.existsSync(o)&&b.unlinkSync(o);}catch{}},readBytes(s){let o=t(s);if(!b.existsSync(o))return null;try{return new Uint8Array(b.readFileSync(o))}catch{return null}},writeBytes(s,o){let a=t(s),i=`${a}.${process.pid}.${randomUUID()}.tmp`;b.mkdirSync(Y.dirname(a),{recursive:true}),b.writeFileSync(i,Buffer.from(o)),nt(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(!b.existsSync(o))return null;try{let a=b.statSync(o);return {key:s,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}},keyRef(s){return {kind:"fs-path",value:t(s)}}}}function rs(){return {read(e){if(!b.existsSync(e))return null;try{return b.readFileSync(e,"utf-8")}catch{return null}},write(e,t){let r=`${e}.${process.pid}.${randomUUID()}.tmp`;b.mkdirSync(Y.dirname(e),{recursive:true}),b.writeFileSync(r,t,"utf-8"),nt(r,e);},exists(e){return b.existsSync(e)},remove(e){try{b.existsSync(e)&&b.unlinkSync(e);}catch{}},readBytes(e){if(!b.existsSync(e))return null;try{return new Uint8Array(b.readFileSync(e))}catch{return null}},writeBytes(e,t){let r=`${e}.${process.pid}.${randomUUID()}.tmp`;b.mkdirSync(Y.dirname(e),{recursive:true}),b.writeFileSync(r,Buffer.from(t)),nt(r,e);},stat(e){if(!b.existsSync(e))return null;try{let t=b.statSync(e);return {key:e,size:Number(t.size||0),updatedAt:new Date(t.mtimeMs).toISOString()}}catch{return null}},listKeys(e){return []}}}var Zn="__scratch-marker",es="__scratch-config.json",Nd=1440*60*1e3,qd=720*60*1e3,Fd=500;function Ca(e,t){if(!e)return t;let r=e.replace(/[^A-Za-z0-9._-]/g,"_");return r.length>0?r:t}function Wr(e){b.mkdirSync(e,{recursive:true});let t=Y.join(e,Zn),r=Y.join(e,es),n=!b.existsSync(t);if(n)try{b.writeFileSync(t,`scratch-store
|
|
10
|
+
`,s=Gr.get(e);if(s&&!s.socket.destroyed){s.ready?s.socket.write(n):s.queue.push(n);return}let o=Sd(e),a=da.createConnection(o);s={socket:a,ready:false,queue:[n]},Gr.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)}`),Gr.delete(e);}),a.on("close",()=>{Gr.delete(e);});}function Jr(){return {executeSync(e,t,r){return ga({command:e,args:t,cwd:r?.cwd,timeoutMs:r?.timeout,env:r?.env},{encoding:r?.encoding,input:r?.input})},executeAsync(e,t,r){vd({command:e,args:t},r);},resolveInvocation(e,t){let r=yd({command:e,args:t});return {cmd:r.command,args:r.args??[]}},splitCommand:ma,spawnDetached(e,t){Ur({command:e,args:t});}}}var Sa=dirname(fileURLToPath(import.meta.url)),Rd=createRequire(import.meta.url);function Cd(){let e=resolve(Sa,"./jsonata-sync.cjs");return existsSync(e)?e:resolve(Sa,"../../card-compute/jsonata-sync.cjs")}var Et=Rd(Cd());function ir(e){e.registerFunction("fsPathRef",t=>oe({kind:"fs-path",value:String(t)}),"<s:s>");}function Qn(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{let a=Et(o);ir(a),s.push(String(a.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{let s=Et(e.stdinTemplate);ir(s),n.stdin=s.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{let s=Et(e.urlTemplate);ir(s),n.url=String(s.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=Et(e.headerTemplate);ir(s);let o=s.evaluate(t);if(typeof o!="object"||o===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(o)}`);n.headers=o;}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{let s=Et(e.bodyTemplate);ir(s),n.body=s.evaluate(t);}catch(s){let o=s instanceof Error?s.message:String(s);throw new Error(`[${r}] argsMassaging.bodyTemplate failed: ${o}`)}return n}var Ed=createRequire(import.meta.url);function xd(e){return typeof e=="object"?e:Ge(e)}function wa(e){let t=X.basename(String(e||"").trim());if(!t)throw new Error(`resolveYamlFlowCliPath: expected non-empty cli file name, got ${JSON.stringify(e)}`);let r=X.dirname(Ed.resolve("yaml-flow/package.json")),n=t.replace(/\.[^.]+$/,""),s=X.join(r,"cli","bundled",`${n}.mjs`);if(_.existsSync(s))return s;let o=X.join(r,"cli","node",t);if(_.existsSync(o))return o;throw new Error(`resolveYamlFlowCliPath: could not find ${t} under cli/bundled or cli/node in ${r}`)}function Je(e){let t=xd(e);return t.kind==="yaml-flow-cli"?wa(t.value):t.value}function Ad(e,t){let r=Je(e);switch(r){case "source-cli-task-executor":{let n=X.join(t,"source-cli-task-executor.js");if(_.existsSync(n))return {command:process.execPath,args:[n]};let s=X.join(t,"source-cli-task-executor.ts"),o=X.join(t,"..","..","node_modules","tsx","dist","cli.mjs"),a=X.join(t,"..","..","node_modules",".bin","tsx"),i=_.existsSync(o)?o:a;return _.existsSync(s)&&_.existsSync(i)?{command:process.execPath,args:[i,s]}:{command:process.execPath,args:[n]}}case "board-live-cards":{let{cmd:n,args:s}=Yn(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 ba(e,t){if(e.howToRun==="built-in"){let{command:n,args:s}=Ad(e.whatToRun,t);return {command:n,baseArgs:s}}let r=(typeof e.whatToRun=="object",Je(e.whatToRun));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 Td(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 Id(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 zr(e,t){return ba(e,t)}function _a(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 Ra(e,t){return {...t,whatToRun:Je(e.whatToRun),...e.extra?{extra:e.extra}:{}}}function Zn(e,t,r="invokeExecutionRef"){return Qn(e,t,r)}function Ca(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 ft(e){return {result:"failure",data:{error:e}}}function lt(e,t,r){let n=r?.label??"invokeExecutionRefSync",s=r?.cliDir??r?.cwd??process.cwd(),o;try{o=Zn(e.argsMassaging,Ra(e,t),n);}catch(l){let m=l instanceof Error?l.message:String(l);return ft(m)}let a;try{a=zr(e,s);}catch(l){let m=l instanceof Error?l.message:String(l);return ft(`[${n}] ref resolution failed: ${m}`)}let i=[...a.baseArgs,...o.cmdArgs??[]],c=JSON.stringify(o.stdin??t),u=Jr(),d;try{d=u.executeSync(a.command,i,{timeout:r?.timeoutMs??3e4,encoding:"utf-8",cwd:r?.cwd,input:c});}catch(l){let m=l,h=(m.stderr?String(m.stderr):"").trim(),f=typeof m.status=="number"?m.status:"unknown",p=h||m.message;return ft(`[${n}] ref exited with status ${f}${p?`: ${p}`:""}`)}try{return Ca(_a(d))}catch{return {result:"success",data:{stdout:d.trim()}}}}async function ka(e,t,r){let n=r?.label??"invokeExecutionRef",s;try{s=Zn(e.argsMassaging,Ra(e,t),n);}catch(u){let d=u instanceof Error?u.message:String(u);return ft(d)}let o=Je(e.whatToRun),a=s.headers?{"Content-Type":"application/json",...s.headers}:{"Content-Type":"application/json"},i=s.url??o,c;if(e.howToRun==="http:get"){let u=s.body&&typeof s.body=="object"&&!Array.isArray(s.body)?s.body:t,d=new URLSearchParams(Object.entries(u).filter(([,l])=>l!=null).map(([l,m])=>[l,String(m)]));d.size>0&&(i=`${i}${i.includes("?")?"&":"?"}${d.toString()}`);}else c=JSON.stringify(s.body??t);try{let u=await fetch(i,{method:e.howToRun==="http:get"?"GET":"POST",headers:a,body:c});if(!u.ok){let l=await u.text().catch(()=>"");return ft(`[${n}] HTTP ${u.status}${l?`: ${l}`:""}`)}let d=await u.text();if(!d.trim())return {result:"success",data:{}};try{return Ca(_a(d))}catch{return {result:"success",data:{stdout:d.trim()}}}}catch(u){let d=u instanceof Error?u.message:String(u);return ft(`[${n}] ${d}`)}}var Pd={"local-node":async(e,t,r)=>lt(e,t,r),"local-python":async(e,t,r)=>lt(e,t,r),"local-process":async(e,t,r)=>lt(e,t,r),"built-in":async(e,t,r)=>lt(e,t,r),"http:post":ka,"http:get":ka},jd={"local-node":lt,"local-python":lt,"local-process":lt,"built-in":lt};async function $a(e,t,r){let n=r?.transports?.[e.howToRun]??Pd[e.howToRun];return n?n(e,t,r):ft(`[${r?.label??"invokeExecutionRef"}] unsupported howToRun: ${e.howToRun}`)}function es(e,t,r){let n=r?.syncTransports?.[e.howToRun]??jd[e.howToRun];return n?n(e,t,r):ft(`[${r?.label??"invokeExecutionRefSync"}] unsupported sync howToRun: ${e.howToRun}`)}function Od(e){return {invoke(t,r){return $a(t,r,e)},invokeSync(t,r){return es(t,r,e)}}}function Nd(e,t,r){return es(e,t,r)}async function qd(e,t){let r={...t,whatToRun:Je(e.whatToRun)},n=Qn(e.argsMassaging,r,"_invokeTaskExecutorHttp"),s=n.url??Je(e.whatToRun),o=n.body?n.body:Id(t,e.extra),a={"Content-Type":"application/json"},i=n.headers?{...a,...n.headers}:a,c=await fetch(s,{method:e.howToRun==="http:get"?"GET":"POST",headers:i,body:JSON.stringify(o)});if(!c.ok){let d=await c.text().catch(()=>"");return {status:"error",error:`HTTP ${c.status}: ${d}`}}let u=await c.json().catch(()=>null);return u&&typeof u.status=="string"?u:{status:"success"}}function Ea(e,t,r){if(e.howToRun==="http:post"||e.howToRun==="http:get"){qd(e,t).catch(i=>{console.error(`[dispatchTaskExecutorDetached] HTTP dispatch failed: ${i.message}`);});return}let{command:s,baseArgs:o}=ba(e,r),a=Td(t,e.extra);Ur({command:s,args:[...o,...a]});}function rt(e,t){if(process.platform!=="win32"){_.renameSync(e,t);return}let r=[10,20,40,80,160];for(let n=0;n<=r.length;n++)try{_.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 Ut(e){function t(s){return X.join(e,...s.split("/"))}function r(s){return X.relative(e,s).replace(/\\/g,"/")}function n(s,o){if(_.existsSync(s))for(let a of _.readdirSync(s,{withFileTypes:true})){let i=X.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(!_.existsSync(o))return null;try{return _.readFileSync(o,"utf-8")}catch{return null}},write(s,o){let a=t(s),i=`${a}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(a),{recursive:true}),_.writeFileSync(i,o,"utf-8"),rt(i,a);},exists(s){return _.existsSync(t(s))},remove(s){let o=t(s);try{_.existsSync(o)&&_.unlinkSync(o);}catch{}},readBytes(s){let o=t(s);if(!_.existsSync(o))return null;try{return new Uint8Array(_.readFileSync(o))}catch{return null}},writeBytes(s,o){let a=t(s),i=`${a}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(a),{recursive:true}),_.writeFileSync(i,Buffer.from(o)),rt(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(!_.existsSync(o))return null;try{let a=_.statSync(o);return {key:s,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}},keyRef(s){return {kind:"fs-path",value:t(s)}}}}function ss(){return {read(e){if(!_.existsSync(e))return null;try{return _.readFileSync(e,"utf-8")}catch{return null}},write(e,t){let r=`${e}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(e),{recursive:true}),_.writeFileSync(r,t,"utf-8"),rt(r,e);},exists(e){return _.existsSync(e)},remove(e){try{_.existsSync(e)&&_.unlinkSync(e);}catch{}},readBytes(e){if(!_.existsSync(e))return null;try{return new Uint8Array(_.readFileSync(e))}catch{return null}},writeBytes(e,t){let r=`${e}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(e),{recursive:true}),_.writeFileSync(r,Buffer.from(t)),rt(r,e);},stat(e){if(!_.existsSync(e))return null;try{let t=_.statSync(e);return {key:e,size:Number(t.size||0),updatedAt:new Date(t.mtimeMs).toISOString()}}catch{return null}},listKeys(e){return []}}}var ts="__scratch-marker",rs="__scratch-config.json",Md=1440*60*1e3,Ld=720*60*1e3,Vd=500;function xa(e,t){if(!e)return t;let r=e.replace(/[^A-Za-z0-9._-]/g,"_");return r.length>0?r:t}function Yr(e){_.mkdirSync(e,{recursive:true});let t=X.join(e,ts),r=X.join(e,rs),n=!_.existsSync(t);if(n)try{_.writeFileSync(t,`scratch-store
|
|
11
11
|
${new Date().toISOString()}
|
|
12
|
-
`,"utf-8");}catch{}function s(){if(!
|
|
12
|
+
`,"utf-8");}catch{}function s(){if(!_.existsSync(r))return {};try{let u=_.readFileSync(r,"utf-8"),d=JSON.parse(u);return d&&typeof d=="object"&&!Array.isArray(d)?d:{}}catch{return {}}}function o(u){let d=`${r}.${process.pid}.${randomUUID()}.tmp`;try{_.writeFileSync(d,JSON.stringify(u,null,2),"utf-8"),rt(d,r);}catch{}}if(n){let u=s();typeof u["retention.lastSweepAt"]!="number"&&(u["retention.lastSweepAt"]=Date.now(),o(u));}function a(){if(!_.existsSync(t))return;let u=s(),d=typeof u["retention.maxAgeMs"]=="number"?u["retention.maxAgeMs"]:Md,l=typeof u["retention.sweepIntervalMs"]=="number"?u["retention.sweepIntervalMs"]:Ld;if(d<=0||l<=0)return;let m=typeof u["retention.lastSweepAt"]=="number"?u["retention.lastSweepAt"]:0,h=Date.now();if(h-m<l)return;u["retention.lastSweepAt"]=h,o(u);let f=h;try{let p=_.readdirSync(e,{withFileTypes:!0});for(let S of p){if(Date.now()-f>Vd)break;if(!S.isFile()||S.name===ts||S.name===rs)continue;let b=X.join(e,S.name);try{let j=_.statSync(b);if(h-j.mtimeMs>d)try{_.unlinkSync(b);}catch{}}catch{}}}catch{}}function i(u,d){let l=xa(u,"scratch"),m=xa(d,".json"),h=m.startsWith(".")?m:`.${m}`,f=`${l}-${Date.now()}-${randomUUID().slice(0,8)}${h}`;return X.join(e,f)}function c(u,d){let l=`${u}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(u),{recursive:true}),_.writeFileSync(l,d,"utf-8"),rt(l,u);}return {read(u){if(!_.existsSync(u))return null;try{return _.readFileSync(u,"utf-8")}catch{return null}},write(u,d){c(u,d);try{a();}catch{}},exists(u){return _.existsSync(u)},remove(u){try{_.existsSync(u)&&_.unlinkSync(u);}catch{}},readBytes(u){if(!_.existsSync(u))return null;try{return new Uint8Array(_.readFileSync(u))}catch{return null}},writeBytes(u,d){let l=`${u}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(u),{recursive:true}),_.writeFileSync(l,Buffer.from(d)),rt(l,u);try{a();}catch{}},stat(u){if(!_.existsSync(u))return null;try{let d=_.statSync(u);return {key:u,size:Number(d.size||0),updatedAt:new Date(d.mtimeMs).toISOString()}}catch{return null}},listKeys(u){try{let d=_.readdirSync(e,{withFileTypes:!0}),l=[];for(let m of d){if(!m.isFile()||m.name===ts||m.name===rs)continue;let h=X.join(e,m.name);(!u||h.startsWith(u))&&l.push(h);}return l.sort()}catch{return []}},getUniqueKey(u,d){return i(u,d)},create(u,d,l){let m=i(d,l);c(m,u);try{a();}catch{}return m},keyRef(u){return {kind:"fs-path",value:u}},config:{get(u){return s()[u]??null},set(u,d){let l=s();d==null?delete l[u]:l[u]=d,o(l);}}}}var Bd="__archive-marker",Kd="__archive-config.json",Hr="streams",Wr="blobs",Gd=500;function Aa(e){let t=e.replace(/[^A-Za-z0-9._-]/g,"_");if(!t)throw new Error("Archive segment name cannot be empty after sanitization");return t}function Xr(e){_.mkdirSync(e,{recursive:true}),_.mkdirSync(X.join(e,Hr),{recursive:true}),_.mkdirSync(X.join(e,Wr),{recursive:true});let t=X.join(e,Bd),r=X.join(e,Kd);if(!_.existsSync(t))try{_.writeFileSync(t,`archive-store
|
|
13
13
|
${new Date().toISOString()}
|
|
14
|
-
`,"utf-8");}catch{}function n(){if(!
|
|
15
|
-
`).filter(Boolean).map(n=>JSON.parse(n)):[]}return {append(r){let n={id:randomUUID(),payload:r};return
|
|
16
|
-
`,"utf-8"),n},readAll(){return t()},readAfter(r){let n=t();if(!r)return {entries:n,newCursor:n.length>0?n[n.length-1].id:null};let s=n.findIndex(a=>a.id===r),o=s===-1?n:n.slice(s+1);return {entries:o,newCursor:o.length>0?o[o.length-1].id:r}},clear(){
|
|
17
|
-
`).filter(Boolean).map(n=>JSON.parse(n)):[]},appendEntry(r){
|
|
18
|
-
`,"utf-8");},generateId(){return randomUUID()}}}function Ta(e){return {tryAcquire(){try{if(!b.existsSync(e)){b.mkdirSync(Y.dirname(e),{recursive:!0});try{b.writeFileSync(e,"{}",{flag:"wx"});}catch{}}return lockSync(e,{retries:0})}catch{return null}}}}var Aa={$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"},chat:{type:"boolean",description:"Whether this file entry is associated with a chat interaction"}},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 ac=od(nc());var yh=createRequire(import.meta.url),vh=yh("./jsonata-sync.cjs"),On=null;var sc=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,Sh=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function kh(e){let t=new Set,r;for(sc.lastIndex=0;(r=sc.exec(e))!==null;)t.add(r[1]);return t}function ic(e){let t=Sh.exec(e);return t?t[1]:null}function oc(e,t,r,n){try{vh(e);}catch(o){let a=o instanceof Error?o.message:String(o);n.push(`${t}: invalid JSONata expression (${a})`);return}let s=kh(e);for(let o of s)r.has(o)||n.push(`${t}: disallowed namespace "${o}" in expression`);}function Ko(e,t,r){if(Array.isArray(e)){e.forEach((s,o)=>{Ko(s,`${t}/${o}`,r);});return}if(typeof e=="string"){let s=ic(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))Ko(o,`${t}/${s}`,r);}function wh(){if(On)return On;let e=new ac.default({allErrors:true});return gh(e),On=e.compile(Aa),On}function uc(e){let t=wh(),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,c)=>{if(!i||typeof i!="object"||Array.isArray(i))return;let u=i;typeof u.bindTo=="string"&&u.bindTo&&(o.has(u.bindTo)&&n.push(`/source_defs/${c}/bindTo: bindTo "${u.bindTo}" must be unique across all source_defs`),o.add(u.bindTo)),typeof u.outputFile=="string"&&u.outputFile&&(a.has(u.outputFile)&&n.push(`/source_defs/${c}/outputFile: outputFile "${u.outputFile}" must be unique across all source_defs`),a.add(u.outputFile));});}}return !r||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function cc(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((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.expr;typeof l!="string"||l.trim().length===0||oc(l,`/compute/${d}/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((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.ref;if(typeof l!="string"||l.trim().length===0)return;let m=ic(l);m===null?t.push(`/provides/${d}/ref: path "${l}" must start with a valid namespace (${[...s].join(", ")})`):s.has(m)||t.push(`/provides/${d}/ref: disallowed namespace "${m}" in path "${l}" (valid: ${[...s].join(", ")})`);});let a=r.view;a&&typeof a=="object"&&!Array.isArray(a)&&Ko(a,"/view",t);let i=new Set(["card_data","requires"]),c=r.source_defs;return Array.isArray(c)&&c.forEach((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.projections;if(!(!l||typeof l!="object"||Array.isArray(l)))for(let[m,g]of Object.entries(l))typeof g!="string"||g.trim().length===0||oc(g,`/source_defs/${d}/projections/${m}`,i,t);}),{ok:t.length===0,errors:t}}function Go(e){let t=uc(e);if(!t.ok)return t;let r=cc(e);return r.ok?{ok:true,errors:[]}:{ok:false,errors:r.errors}}function dc(e){return String(e).replace(/[^a-zA-Z0-9_-]/g,"_")}function lc(e){let t=e.payload??{};return {id:e.id,role:typeof t.role=="string"?t.role:"system",text:typeof t.text=="string"?t.text:"",files:Array.isArray(t.files)?t.files:[],updated_at:typeof t.updated_at=="string"?t.updated_at:""}}function Uo(e,t){let r=s=>`chats/${dc(s)}/processing`,n=s=>`chats/${dc(s)}/config`;return {append(s,o,a,i=[]){return e(s).append({role:o,text:a,files:i,updated_at:new Date().toISOString()}).id},readAll(s){return e(s).readAll().map(lc)},readAfter(s,o){let a=e(s).readAfter(o);return {records:a.entries.map(lc),cursor:a.newCursor}},clear(s){e(s).clear?.();},setProcessing(s,o){o?t.write(r(s),true):t.delete(r(s));},isProcessing(s){return t.read(r(s))===true},getConfig(s){return t.read(n(s))??{}},setConfig(s,o){let a=t.read(n(s))??{};t.write(n(s),{...a,...o});}}}function bh(){let e=globalThis.crypto;return typeof e?.randomUUID=="function"?String(e.randomUUID()):`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}function _h(){let e=new Map,t=new Map;function r(n){return e.has(n)||e.set(n,[]),e.get(n)}return {append(n,s,o,a=[]){let i={id:bh(),role:s,text:o,files:a,updated_at:new Date().toISOString()};return r(n).push(i),i.id},readAll(n){return r(n).slice()},readAfter(n,s){let o=r(n);if(!s)return {records:o.slice(),cursor:o.length>0?o[o.length-1].id:null};let a=o.findIndex(c=>c.id===s),i=a===-1?o.slice():o.slice(a+1);return {records:i,cursor:i.length>0?i[i.length-1].id:s}},clear(n){e.set(n,[]);},setProcessing(n,s){s?t.set(`p:${n}`,true):t.delete(`p:${n}`);},isProcessing(n){return t.get(`p:${n}`)===true},getConfig(n){return t.get(`c:${n}`)??{}},setConfig(n,s){let o=t.get(`c:${n}`)??{};t.set(`c:${n}`,{...o,...s});}}}var St={RUNNING:"running",COMPLETED:"completed",FAILED:"failed",INACTIVATED:"inactivated"};function Ne(e){return e?Array.isArray(e.provides)?e.provides:[]:[]}function kt(e){return e?Array.isArray(e.requires)?e.requires:[]:[]}function fc(e){return e.tasks??{}}function Jo(e){return e?e.status===St.FAILED||e.status===St.INACTIVATED:false}function pc(e,t){return e.refreshStrategy??t?.refreshStrategy??"data-changed"}function mc(e){return e.maxExecutions}function gc(e,t){let r=new Set;for(let[n,s]of Object.entries(t))if(s.status===St.COMPLETED){let o=e.tasks[n];o&&Ne(o).forEach(i=>r.add(i));}return Array.from(r)}function hc(e,t){let r={};return e.forEach(n=>{let s=t[n];if(!s)return;Ne(s).forEach(a=>{r[a]||(r[a]=[]),r[a].push(n);});}),r}function yc(e,t,r){let n=e.tasks[t]??jn(),s={};if(r){let a=r.tasks[t],i=kt(a);for(let c of i)for(let[u,d]of Object.entries(r.tasks))if(Ne(d).includes(c)){let l=e.tasks[u];l?.lastDataHash&&(s[c]=l.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 vc(e,t,r,n,s,o){let a=e.tasks[r]??jn(),i=t.tasks[r];if(!i)throw new Error(`Task "${r}" not found in graph`);let c;n&&i.on&&i.on[n]?c=i.on[n]:c=Ne(i);let u=a.startConsumedHashes?{...a.startConsumedHashes}:{...a.lastConsumedHashes};if(!a.startConsumedHashes){let m=i.requires??[];for(let g of m)for(let[f,p]of Object.entries(t.tasks))if(Ne(p).includes(g)){let S=e.tasks[f];S?.lastDataHash&&(u[g]=S.lastDataHash);break}}let d={...a,status:"completed",completedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),executionCount:a.executionCount+1,lastEpoch:a.executionCount+1,lastDataHash:s,data:o,lastConsumedHashes:u,error:void 0},l=[...new Set([...e.availableOutputs,...c])];return {...e,tasks:{...e.tasks,[r]:d},availableOutputs:l,lastUpdated:new Date().toISOString()}}function Sc(e,t,r,n){let s=e.tasks[r]??jn(),o=t.tasks[r];if(o?.retry){let c=s.retryCount+1;if(c<=o.retry.max_attempts){let u={...s,status:"not-started",retryCount:c,lastUpdated:new Date().toISOString(),error:n};return {...e,tasks:{...e.tasks,[r]:u},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 c=o.circuit_breaker.on_break;i=[...new Set([...i,...c])];}return {...e,tasks:{...e.tasks,[r]:a},availableOutputs:i,lastUpdated:new Date().toISOString()}}function kc(e,t,r,n){let s=e.tasks[t]??jn(),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 wc(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 jn(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function Nn(e,t){let r=`live-${Date.now()}`,n={};for(let o of Object.keys(e.tasks))n[o]=_c();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 Rh(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:yc(n,t.taskName,r)};case "task-completed":return {config:r,state:vc(n,r,t.taskName,t.result,t.dataHash,t.data)};case "task-failed":return {config:r,state:Sc(n,r,t.taskName,t.error)};case "task-progress":return {config:r,state:kc(n,t.taskName,t.message,t.progress)};case "task-restart":return {config:r,state:wc(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:Ih(n,t.action)};case "task-upsert":return Ch(e,t.taskName,t.taskConfig);case "task-removal":return $h(e,t.taskName);case "node-requires-add":return Eh(e,t.nodeName,t.tokens);case "node-requires-remove":return xh(e,t.nodeName,t.tokens);case "node-provides-add":return Th(e,t.nodeName,t.tokens);case "node-provides-remove":return Ah(e,t.nodeName,t.tokens);default:return e}}function bc(e,t){return t.reduce((r,n)=>Rh(r,n),e)}function Ch(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]:_c()},lastUpdated:new Date().toISOString()}}}function $h(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 Eh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=kt(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 xh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=kt(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 Th(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Ne(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 Ah(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Ne(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 Nr(e){return {version:1,config:e.config,state:e.state,snapshotAt:new Date().toISOString()}}function qn(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 _c(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function Ih(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 qr(e){let{config:t,state:r}=e,n=fc(t);if(Object.keys(n).length===0)return {eligible:[],pending:[],unresolved:[],blocked:[],conflicts:{}};let o=Ph(n),a=gc(t,r.tasks),i=new Set([...a,...r.availableOutputs]),c=[],u=[],d=[],l=[];for(let[g,f]of Object.entries(n)){let p=r.tasks[g],S=pc(f,t.settings),_=S!=="once";if(p?.status===St.RUNNING||Jo(p))continue;let w=mc(f);if(w!==void 0&&p&&p.executionCount>=w||f.circuit_breaker&&p&&p.executionCount>=f.circuit_breaker.max_executions||!_&&p?.status===St.COMPLETED)continue;if(_&&p?.status===St.COMPLETED){let k=kt(f),$=false;switch(S){case "data-changed":{k.length>0&&k.some(x=>{for(let[I,F]of Object.entries(n))if(Ne(F).includes(x)){let N=r.tasks[I];if(!N)continue;let pe=p.lastConsumedHashes?.[x];return N.lastDataHash==null?N.executionCount>p.lastEpoch:N.lastDataHash!==pe}return false})||($=true);break}case "epoch-changed":{k.length>0&&k.some(x=>{for(let[I,F]of Object.entries(n))if(Ne(F).includes(x)){let N=r.tasks[I];if(N&&N.executionCount>p.lastEpoch)return true}return false})||($=true);break}case "time-based":{let E=f.refreshInterval??0;if(E<=0){$=true;break}let x=p.completedAt;if(!x){$=true;break}(Date.now()-Date.parse(x))/1e3<E&&($=true);break}case "manual":$=true;break}if($)continue}let R=kt(f);if(R.length===0){c.push(g);continue}let j=[],v=[],h=[];for(let k of R){if(i.has(k))continue;let $=o[k]||[];$.length===0?j.push(k):$.every(x=>Jo(r.tasks[x]))?h.push({token:k,failedProducer:$[0]}):v.push(k);}j.length>0?d.push({taskName:g,missingTokens:j}):h.length>0?l.push({taskName:g,failedTokens:h.map(k=>k.token),failedProducers:[...new Set(h.map(k=>k.failedProducer))]}):v.length>0?u.push({taskName:g,waitingOn:v}):c.push(g);}let m={};if(c.length>1){let g=hc(c,n);for(let[f,p]of Object.entries(g))p.length>1&&(m[f]=p);}return {eligible:c,pending:u,unresolved:d,blocked:l,conflicts:m}}function Ph(e){let t={};for(let[r,n]of Object.entries(e)){for(let s of Ne(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 Fr=class{buffer=[];append(t){this.buffer.push(t);}drain(){let t=this.buffer;return this.buffer=[],t}get size(){return this.buffer.length}};function zo(e){let t=Ho(e);return Oh(t)}function Ho(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(Ho).join(",")+"]";let t=e;return "{"+Object.keys(t).sort().map(n=>JSON.stringify(n)+":"+Ho(t[n])).join(",")+"}"}function Oh(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 jh(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 Nh(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 Rc(e){let t=JSON.stringify({t:e,n:Date.now().toString(36)+Math.random().toString(36).slice(2,6)});return jh(t)}function qh(e){try{let t=JSON.parse(Nh(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function Cc(e,t,r){let{handlers:n,onDrain:s}=t,o=new Fr,a="state"in e&&"config"in e?e:Nn(e),i=false,c=new Set,u=new Map(Object.entries(n)),d=new Fr,l=false,m=false;function g(){if(!i){if(l){m=true;return}l=true;try{do m=!1,f();while(m)}finally{l=false;}}}function f(){let w=d.drain(),R=o.drain(),j=[...w,...R];j.length>0&&(a=bc(a,j));let v=qr(a);j.length>0&&s?.(j,a,v);for(let h of v.eligible)_(h);for(let h of j)if(h.type==="task-progress"){let{taskName:k,update:$}=h;if(!a.config.tasks[k])continue;let x=a.state.tasks[k];if(!x||x.status!=="running")continue;let I=Rc(k),F=S(k,I,$).catch(N=>{i||(d.append({type:"task-failed",taskName:k,error:N.message??String(N),timestamp:new Date().toISOString()}),g());}).finally(()=>{c.delete(F);});c.add(F);}}function p(w){let j=a.config.tasks[w].requires??[],v=new Map;for(let[k,$]of Object.entries(a.config.tasks))for(let E of $.provides??[])v.set(E,k);let h={};for(let k of j){let $=v.get(k);$?h[k]=a.state.tasks[$]?.data:h[k]=void 0;}return h}async function S(w,R,j){let v=a.config.tasks[w],h=v.taskHandlers??[],k=p(w);for(let $ of h){let E=u.get($);if(!E)throw new Error(`Handler '${$}' not found in registry (task '${w}')`);let x={nodeId:w,state:k,taskState:a.state.tasks[w],config:v,callbackToken:R,update:j};if(await E(x)==="task-initiate-failure")throw new Error(`Handler '${$}' returned task-initiate-failure (task '${w}')`)}}function _(w){let j=a.config.tasks[w]?.taskHandlers;if(!j||j.length===0)return;d.append({type:"task-started",taskName:w,timestamp:new Date().toISOString()}),g();let v=Rc(w),h=S(w,v).catch(k=>{i||(d.append({type:"task-failed",taskName:w,error:k.message??String(k),timestamp:new Date().toISOString()}),g());}).finally(()=>{c.delete(h);});c.add(h);}return {push(w){i||(w.type==="task-completed"&&w.data&&!w.dataHash&&(w={...w,dataHash:zo(w.data)}),o.append(w),g());},pushAll(w){if(!i){for(let R of w)R.type==="task-completed"&&R.data&&!R.dataHash?o.append({...R,dataHash:zo(R.data)}):o.append(R);g();}},resolveCallback(w,R,j){if(i)return;let v=qh(w);if(!v)return;let{taskName:h}=v;if(a.config.tasks[h]){if(j&&j.length>0)o.append({type:"task-failed",taskName:h,error:j.join("; "),timestamp:new Date().toISOString()});else {let k=R&&Object.keys(R).length>0?zo(R):void 0;o.append({type:"task-completed",taskName:h,data:R,dataHash:k,timestamp:new Date().toISOString()});}g();}},addNode(w,R){i||(o.append({type:"task-upsert",taskName:w,taskConfig:R,timestamp:new Date().toISOString()}),g());},removeNode(w){i||(o.append({type:"task-removal",taskName:w,timestamp:new Date().toISOString()}),g());},addRequires(w,R){i||(o.append({type:"node-requires-add",nodeName:w,tokens:R,timestamp:new Date().toISOString()}),g());},removeRequires(w,R){i||(o.append({type:"node-requires-remove",nodeName:w,tokens:R,timestamp:new Date().toISOString()}),g());},addProvides(w,R){i||(o.append({type:"node-provides-add",nodeName:w,tokens:R,timestamp:new Date().toISOString()}),g());},removeProvides(w,R){i||(o.append({type:"node-provides-remove",nodeName:w,tokens:R,timestamp:new Date().toISOString()}),g());},registerHandler(w,R){u.set(w,R);},unregisterHandler(w){u.delete(w);},retrigger(w){i||a.config.tasks[w]&&(o.append({type:"task-restart",taskName:w,timestamp:new Date().toISOString()}),g());},retriggerAll(w){if(!i){for(let R of w)a.config.tasks[R]&&o.append({type:"task-restart",taskName:R,timestamp:new Date().toISOString()});g();}},snapshot(){return Nr(a)},getState(){return a},getSchedule(){return qr(a)},async waitForHandlers(){c.size>0&&await Promise.allSettled([...c]);},async dispose(w){w?.wait&&c.size>0&&await Promise.allSettled([...c]),i=true;}}}var Dh=createRequire(import.meta.url),Fn=Dh("./jsonata-sync.cjs"),xc=Fn;function $c(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 Tc(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 Mh(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 Fn(s.expr).evaluate(n);Tc(e.computed_values,s.bindTo,o),n.computed_values=e.computed_values;}catch{}return e}function Lh(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=xc(o.expr).evaluate(n);Tc(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 Vh(e,t,r){let n={...r??{},card_data:t.card_data??{},requires:t.requires??{},fetched_sources:t._sourcesData??{},computed_values:t.computed_values??{}};return Fn(e).evaluate(n)}function Bh(e,t){return t.startsWith("fetched_sources.")?$c(e._sourcesData??{},t.slice(16)):$c(e,t)}var Ec=new Set(["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]),Kh=new Set(["id","meta","requires","provides","view","card_data","compute","source_defs"]);function Gh(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))Kh.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 Uh(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 Fn(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}}))}function Jh(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]=xc(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}})}var wt={run:Mh,runSync:Lh,eval:Vh,resolve:Bh,validate:Gh,enrichSources:Uh,enrichSourcesSync:Jh};function zh(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 Wo(e){return JSON.stringify(e)}function Yo(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 Dn(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 c={...s},u=c;for(let d=0;d<i.length-1;d++){let l=i[d],m=u[l],g=m&&typeof m=="object"&&!Array.isArray(m)?{...m}:{};u[l]=g,u=g;}return u[i[i.length-1]]=a,c}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,c]of Object.entries(o))s[i]!==c.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],c=Object.entries(a).find(([,u])=>u.key===o);return i&&i.key!==o?{ok:false,error:`Card id "${s}" is already mapped to key "${i.key}", cannot remap to "${o}"`}:c&&c[0]!==s?{ok:false,error:`Key "${o}" is already mapped to card id "${c[0]}", cannot remap to "${s}"`}:{ok:true}},writeCard(s,o,a){let i=r(),c=a??i[s]?.key??e.defaultCardKey(s),u=e.writeCard(c,o);i[s]={key:c,checksum:u,updatedAt:new Date().toISOString()},e.writeIndex(i);},patchCard(s,o,a){let i=r(),c=i[s];if(!c||!e.cardExists(c.key))throw new Error(`card "${s}" not found`);let u=e.readCard(c.key);if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`card "${s}" is not patchable`);let d=n(u,o,a),l=e.writeCard(c.key,d);i[s]={key:c.key,checksum:l,updatedAt:new Date().toISOString()},e.writeIndex(i);},removeCard(s){let o=r(),a=o[s];a&&(e.removeCard(a.key),delete o[s],e.writeIndex(o));},readIndex(){return r()}}}function Mn(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}`)},listSources(r){return e.listKeys(`${r}/`).filter(n=>!n.includes("/.staged/")).map(n=>n.slice(`${r}/`.length))}}}function jc(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 Nc(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 Dr="v1",bt="board/graph",qc="board/lastJournalProcessedId";function Ac(e){return `cards/${e}/runtime`}function Fc(e){return {readRuntime(t){return e.read(Ac(t))??{_sources:{}}},writeRuntime(t,r){e.write(Ac(t),r);}}}function Hh(e,t){let r={...e};for(let n of t.deleteKeys)delete r[n];return {...r,...t.shallowMerge}}function Dc(e){return {readSnapshot(t){return e.readValues(t)},commitSnapshot(t,r){if(r.schemaVersion!==Dr)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=Hh(n.values,r);return {ok:true,newVersion:e.writeValues(t,s,r.deleteKeys)}}}}function Xo(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 Yo(r.trim())},writeTaskExecutorRef(r){e.write("task-executor",Wo(r));},readChatHandlerFlow(){return e.read("chat-handler-flow")},writeChatHandlerFlow(r){e.write("chat-handler-flow",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);},readScratchStoreRef(){return t("scratch-store-ref")},writeScratchStoreRef(r){e.write("scratch-store-ref",r);},readArchiveStoreRef(){return t("archive-store-ref")},writeArchiveStoreRef(r){e.write("archive-store-ref",r);},readChatStoreRef(){return t("chat-store-ref")},writeChatStoreRef(r){e.write("chat-store-ref",r);},readArtifactsStoreRef(){return t("artifacts-store-ref")},writeArtifactsStoreRef(r){e.write("artifacts-store-ref",r);}}}function Mc(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 Ic(e){return e?{lastRequestedToken:e.lastRequestedToken,lastCompletedToken:e.lastCompletedToken,lastCompletionStatus:e.lastCompletionStatus??(e.lastCompletedToken?"success":"not-started"),queueRequestedToken:e.queueRequestedToken}:{lastCompletionStatus:"not-started"}}function Wh(e){return e?.lastRequestedToken?e.lastCompletedToken!==e.lastRequestedToken:false}function Pc(e,t){return e?.lastRequestedToken?Wh(e)?"in-flight":!e.lastCompletedToken||e.lastCompletedToken<t?"dispatch":"idle":"dispatch"}function Yh(e,t){return {...e,lastCompletedToken:t,lastCompletionStatus:"success"}}function Oc(e,t){return {...e,lastCompletedToken:t,lastCompletionStatus:"failure"}}function Ln(e,t){let r=t.state.tasks,n=t.config.tasks,s=Object.keys(r),o=qr(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 c=new Map;for(let[f,p]of Object.entries(n))for(let S of p.requires??[]){let _=c.get(S)??[];_.push(f),c.set(S,_);}let u=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 _=S.requires??[],w=S.provides??[],R=Object.keys(p.data??{}).sort(),j=_.filter(x=>t.state.availableOutputs.includes(x)),v=_.filter(x=>!t.state.availableOutputs.includes(x)),h=i.get(f)??v,k=new Set;for(let x of w)for(let I of c.get(x)??[])I!==f&&k.add(I);let $=p.failedAt,E=p.error?{message:p.error,code:"TASK_FAILED",at:$,source:"task-runtime"}:void 0;return {name:f,status:p.status,error:E,requires:_,requires_satisfied:j,requires_missing:v,provides_declared:w,provides_runtime:R,blocked_by:h,unblocks:Array.from(k).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 d=u.map(f=>({name:f.name,fanOut:f.unblocks.length})).sort((f,p)=>p.fanOut-f.fanOut||f.name.localeCompare(p.name)),l=d.length>0?d[0]:{name:null,fanOut:0},m=new Set;for(let f of Object.values(n))for(let p of f.requires??[])m.add(p);let g=0;for(let[f,p]of Object.entries(n)){let S=(p.requires??[]).length===0,w=(p.provides??[]).some(R=>(c.get(R)??[]).some(j=>j!==f));S&&!w&&(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(m).length,max_fan_out_card:l.name,max_fan_out:l.fanOut}},cards:u}}function Xh(){return new Date().toISOString()}function Lc(e,t,r,n,s,o,a){return async i=>{let c=[],u=r.cardStore.readCard(i.nodeId);if(!u)return "task-initiate-failure";let d=u.id,l=u.card_data??{},m=u.source_defs??[],g=m.filter(D=>D.optionalForCompletionGating!==true),f=r.cardRuntimeStore.readRuntime(d),p=false,S=()=>{p&&(r.cardRuntimeStore.writeRuntime(d,f),p=false);},_=D=>Ic(f._sources[D]),w=(D,B)=>{f._sources[D]=Ic(B),p=true;},R=i.taskState?.executionCount??0;if(f._lastExecutionCount!==R&&(f._sources={},f._lastExecutionCount=R,p=true),i.update){let D=i.update,B=D.outputFile;if(B){let te=_(B);if(D.failure){let fe=D.rqt??te.lastRequestedToken??te.queueRequestedToken;fe&&w(B,Oc(te,fe));}else {let fe=D.rqt;if(!te.lastCompletedToken||fe>te.lastCompletedToken){let $e=typeof D.deliveryToken=="string"?D.deliveryToken:void 0,tt=false;$e&&(tt=r.fetchedSourcesStore.commitSourceData(d,B,$e)),tt?w(B,Yh(te,fe)):w(B,Oc(te,fe));}}S();}}let v={};for(let D of m)if(D.outputFile){let B=r.fetchedSourcesStore.readSourceData(d,D.outputFile);B!==null&&(v[D.bindTo]=B);}let h={};for(let[D,B]of Object.entries(i.state??{}))if(B!==null&&typeof B=="object"&&!Array.isArray(B)){let te=B[D];h[D]=te!==void 0?te:B;}else h[D]=B;let k={id:d,card_data:{...l},requires:h,source_defs:m,compute:u.compute};k._sourcesData=v,u.compute&&wt.runSync(k,{sourcesData:v}),(o??r.outputStore.writeComputedValues.bind(r.outputStore))(d,k.computed_values??{});let $={...u},E=wt.enrichSourcesSync(Array.isArray(u.source_defs)?u.source_defs:void 0,{card_data:u.card_data,requires:h}),x=e.value;$.source_defs=Array.isArray(E)?E.map(D=>({...D,boardDir:typeof D.boardDir=="string"&&D.boardDir?D.boardDir:x})):E;let I=Xh(),F=i.update?void 0:I,N=g.filter(D=>{let B=D.outputFile;if(typeof B!="string"||!B)return true;let te=_(B);F&&(te={...te,queueRequestedToken:F},w(B,te));let fe=te.queueRequestedToken??te.lastRequestedToken??I,$e=Pc(te,fe);return $e==="in-flight"?false:$e==="dispatch"});if(S(),N.length>0){let D=false,B=I;for(let te of N){let fe=te.outputFile;if(typeof fe!="string"||!fe)continue;let $e=_(fe),tt=$e.queueRequestedToken??I;w(fe,{...$e,lastRequestedToken:tt}),B=tt,D=true;}return D&&S(),D&&(c.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:$,callbackToken:i.callbackToken,rqt:B}}),r.executionRequestStore.appendEntries(t,c)),"task-initiated"}if(g.some(D=>{let B=D.outputFile;if(typeof B!="string"||!B)return false;let te=_(B),fe=te.queueRequestedToken??te.lastRequestedToken??I;return Pc(te,fe)==="in-flight"}))return "task-initiated";let le=u.provides??[],Ce={};for(let{bindTo:D,ref:B}of le)Ce[D]=wt.resolve(k,B);return (a??r.outputStore.writeDataObjects.bind(r.outputStore))(Ce),m.filter(D=>{if(D.optionalForCompletionGating!==true)return false;let B=_(D.outputFile);return !B.lastRequestedToken||!B.lastCompletedToken?true:B.lastCompletedToken<=B.lastRequestedToken}).length>0&&c.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:$,callbackToken:i.callbackToken,rqt:I}}),n(i.nodeId,Ce),c.length>0&&r.executionRequestStore.appendEntries(t,c),"task-initiated"}}var Vn={settings:{completion:"manual",refreshStrategy:"data-changed"},tasks:{}};function Vc(e){return {[bt]:e.graph,[qc]:e.lastDrainedJournalId}}function Bc(e){let t=e[bt],r=e[qc];if(!t||typeof t!="object")throw new Error(`State snapshot is missing required key: ${bt}`);return {graph:t,lastDrainedJournalId:typeof r=="string"?r:""}}function Kc(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 z(e){return e!==void 0?{status:"success",data:e}:{status:"success"}}function M(e){return {status:"fail",error:e}}function Z(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function Qh(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 Uc(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 Bn(e){try{let t=JSON.parse(Uc(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function Zh(e){return Qh(JSON.stringify(e))}function Gc(e){try{let t=JSON.parse(Uc(e));return typeof t?.cbk=="string"&&typeof t?.cid=="string"&&typeof t?.b=="string"&&typeof t?.d=="string"?t:null}catch{return null}}function ke(){return new Date().toISOString()}function ey(e,t){let r=t.onWarn??(()=>{}),n=oe(e);function s(C){if(C.length!==0)try{let y=t.publishBoardChangeNotifications?.(C);y&&typeof y.catch=="function"&&y.catch(A=>r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${A instanceof Error?A.message:String(A)}`));}catch(y){r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${y instanceof Error?y.message:String(y)}`);}}function o(){let C=i().readCardStoreRef();if(!C)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let y=t.kvStorageForRef(C);return {readIndex(){return y.read("_index")},writeIndex(A){y.write("_index",A);},readCard(A){return y.read(A)},writeCard(A,q){return y.write(A,q),t.hashFn(q)},removeCard(A){y.delete(A);},cardExists(A){return y.read(A)!==null},defaultCardKey(A){return A}}}let a={readValues(C){let y=t.kvStorage("state-snapshot"),A=y.listKeys().sort();if(A.length===0)return {version:null,values:{}};let q={};for(let H of A)q[H]=y.read(H);return {version:t.hashFn(q),values:q}},writeValues(C,y,A){let q=t.kvStorage("state-snapshot");for(let H of A)q.delete(H);for(let[H,re]of Object.entries(y))q.write(H,re);return t.hashFn(y)}},i=()=>Xo(t.kvStorage("config")),c=()=>Dc(a),u=()=>jc(t.journalAdapter()),d=()=>Dn(o(),r),l=()=>{let C=i().readOutputsStoreRef();if(!C)throw new Error(`Board at ${e.value} has no outputs store configured. Run: init --outputs-store-ref <b64-ref>`);return Mc(t.kvStorageForRef(C))},m=()=>{let C=i().readArchiveStoreRef();return C?t.archiveFactoryForRef(C):t.archiveFactory()};function g(){return !!c().readSnapshot(e.value).values[bt]}function f(){let C=c().readSnapshot(e.value);if(!C.values[bt])throw new Error(`Board not initialized at ${e.value}`);return Bc(C.values)}function p(C,y){let A=c().commitSnapshot(e.value,{schemaVersion:Dr,expectedVersion:y,commitId:t.genId(),committedAt:ke(),deleteKeys:[],shallowMerge:Vc(C)});if(!A.ok)throw new Error(`Snapshot commit failed (version mismatch): expected=${y??"null"} current=${A.currentVersion??"null"}`)}function S(C){u().appendEvent(C);}async function _(){let C=(P,L)=>{let ae=P.payload,Ke=(ae?.enrichedCard??{}).id??ae?.cardId??"unknown";S({type:"task-failed",taskName:Ke,error:L,timestamp:ke()});},y=Nc(t.kvStorage("execution-requests"),C),A=Fc(t.kvStorage("card-runtime")),q=Mn(t.blobStorage("sources"),P=>t.resolveBlob(P)),H=new Map,re={readRuntime(P){return H.get(P)??A.readRuntime(P)},writeRuntime(P,L){H.set(P,L);}},Ee=[],ce=new Map,je={readSourceData(P,L){let ae=`${P}/${L}`;return ce.has(ae)?ce.get(ae):q.readSourceData(P,L)},ingestSourceDataStaged(P,L,ae,ct){q.ingestSourceDataStaged(P,L,ae,ct);},commitSourceData(P,L,ae){let ct=`${P}/.staged/${ae}/${L}`,Vr=t.blobStorage("sources").read(ct);if(Vr==null)return false;let Vt=`${P}/${L}`,ra=Vr.trim();try{ce.set(Vt,JSON.parse(ra));}catch{ce.set(Vt,ra);}return Ee.push({cardId:P,outputFile:L,deliveryToken:ae}),true},hasSource(P,L){let ae=`${P}/${L}`;return ce.has(ae)?true:q.hasSource(P,L)},listSources(P){let L=q.listSources(P),ae=new Set;for(let Ke of ce.keys())Ke.startsWith(`${P}/`)&&ae.add(Ke.slice(`${P}/`.length));let ct=new Set([...L,...ae]);return Array.from(ct)}},be={cardStore:d(),cardRuntimeStore:re,fetchedSourcesStore:je,outputStore:l(),executionRequestStore:y},Rt=f(),Ct=qn(Rt.graph),{events:Mt,newCursor:Lt}=u().readEntriesAfterCursor(Rt.lastDrainedJournalId),$t=[],Kn=[],Gn=[],Zo=new Map,Yc=(P,L)=>{$t.push({type:"task-completed",taskName:P,data:L,timestamp:ke()});try{m().stream("exec-history").append({taskName:P,status:"completed",completedAt:ke()});}catch{}},ea=(P,L)=>{S({type:"task-failed",taskName:P,error:L,timestamp:ke()});try{m().stream("exec-history").append({taskName:P,status:"failed",error:L,completedAt:ke()});}catch{}},Mr=Cc(Ct,{handlers:{"card-handler":Lc(e,Lt,be,Yc,ea,(P,L)=>{Kn.push({cardId:P,values:L});},P=>{Gn.push(P);})}});for($t=Mt;$t.length>0;){let P=$t;$t=[];for(let L of P)if(L.type==="task-restart"){let ae=be.cardStore.readCard(L.taskName);ae&&Zo.set(L.taskName,ae);}Mr.pushAll(P),await Mr.waitForHandlers();}let ta=Mr.getState();await Mr.dispose({wait:true});let Xc=c().readSnapshot(e.value).version;p({lastDrainedJournalId:Lt,graph:Nr(ta)},Xc);for(let{cardId:P,values:L}of Kn)be.outputStore.writeComputedValues(P,L);for(let P of Gn)be.outputStore.writeDataObjects(P);for(let[P,L]of H)A.writeRuntime(P,L);for(let{cardId:P,outputFile:L,deliveryToken:ae}of Ee)q.commitSourceData(P,L,ae);let Lr;try{Lr=Ln(n,ta),be.outputStore.writeStatusSnapshot(Lr);}catch(P){r(`[board-live-cards-public] status publish failed: ${P instanceof Error?P.message:String(P)}`);}let or=[];for(let{cardId:P,values:L}of Kn)or.push({kind:"computed_values",cardId:P,values:L});for(let P of Gn)for(let[L,ae]of Object.entries(P))L&&or.push({kind:"data_object",key:L,payload:ae});for(let[P,L]of Zo)or.push({kind:"card_refreshed",cardId:P,card:L});Lr!==void 0&&or.push({kind:"status",status:Lr}),s(or);let Qc=i().readTaskExecutorRef()??{howToRun:"built-in",whatToRun:oe({kind:"built-in",value:"source-cli-task-executor"})};y.dispatchEntriesForJournalId(Lt,P=>{if(P.taskKind!=="source-fetch"){r(`[process-accumulated-events] unknown taskKind "${P.taskKind}" \u2014 skipping`);return}let L=P.payload,ae=L.enrichedCard?.id??"unknown",ct=L.enrichedCard?.source_defs??[];for(let Ke of ct){if(!Ke.outputFile){r(`[dispatch] source "${Ke.bindTo}" has no outputFile \u2014 skipping`);continue}let Vr=Zh({cbk:L.callbackToken,rg:e.value,br:oe(e),cid:ae,b:Ke.bindTo,d:Ke.outputFile,cs:void 0,rqt:L.rqt});t.dispatchExecution(Qc,{source_def:Ke,base_ref:oe(e),callback:{token:Vr,via:t.selfRef}}).catch(Vt=>ea(ae,Vt instanceof Error?Vt.message:String(Vt)));}});}async function w(){try{let C=()=>{let A=f(),{events:q}=u().readEntriesAfterCursor(A.lastDrainedJournalId);q.length<=0||(w(),t.requestProcessAccumulated?.());},y=await sa(t.lock,_,C);return z({ran:y!==!1})}catch(C){return Z(C)}}function R(){w(),t.requestProcessAccumulated?.();}function j(C){try{let y=C.params?.cardStoreRef;if(!y)return M("init requires params.cardStoreRef \u2014 create a card store with card-store-cli and pass its ref here");if(!g()){let be=Nn(Vn);p({lastDrainedJournalId:"",graph:Nr(be)},null);}let A=C.params?.outputsStoreRef;if(!A)return M("init requires params.outputsStoreRef \u2014 pass the outputs store ref here");let q=C.params?.scratchStoreRef,H=C.params?.archiveStoreRef,re=C.params?.chatStoreRef,Ee=C.params?.artifactsStoreRef,ce=i();ce.writeCardStoreRef(y),ce.writeOutputsStoreRef(A),q&&ce.writeScratchStoreRef(q),H&&ce.writeArchiveStoreRef(H),re&&ce.writeChatStoreRef(re),Ee&&ce.writeArtifactsStoreRef(Ee);let je=C.body??{};je["task-executor-ref"]&&ce.writeTaskExecutorRef(je["task-executor-ref"]),Object.prototype.hasOwnProperty.call(je,"chat-handler-flow")&&ce.writeChatHandlerFlow(je["chat-handler-flow"]);try{l().writeStatusSnapshot(Ln(n,qn(f().graph)));}catch{}return z()}catch(y){return Z(y)}}function v(C){try{let y=l().readStatusSnapshot();if(!y){y=Ln(n,qn(f().graph));try{l().writeStatusSnapshot(y);}catch{}}return z(y)}catch(y){return Z(y)}}function h(C){try{let y=C.params?.id;return y?(S({type:"task-removal",taskName:y,timestamp:ke()}),R(),z()):M("removeCard requires params.id")}catch(y){return Z(y)}}function k(C){try{let y=C.params?.id;return y?(S({type:"task-restart",taskName:y,timestamp:ke()}),R(),z()):M("retrigger requires params.id")}catch(y){return Z(y)}}async function $(C){return w()}function E(C){try{let y=C.params?.cardId,A=C.params?.all,q=!!C.params?.restart;if(!y&&!A)return M("upsertCard requires --card-id <id> or --all");let H=A?d().readAllCards().map(re=>re.id):[y];for(let re of H)if(!d().readCard(re))return M(`Card "${re}" not found in board at ${e.value}`);for(let re of H){let Ee=d().readCard(re),ce=Kc(Ee),je=t.hashFn(ce),be=t.kvStorage("card-upsert"),Rt=be.read(re),Ct=Rt?.taskConfigHash!==je;if(!(!Ct&&!q)){if(Ct){let Mt=Rt?.blobRef??d().readCardKey(re)??re;S({type:"task-upsert",taskName:re,taskConfig:ce,timestamp:ke()}),be.write(re,{blobRef:Mt,taskConfigHash:je,updatedAt:ke()});}q&&S({type:"task-restart",taskName:re,timestamp:ke()});}}return R(),z()}catch(y){return Z(y)}}function x(C){try{let y=C.params?.token;if(!y)return M("taskFailed requires params.token");let A=C.params?.error??"unknown error",q=Bn(y);if(!q)return M("Invalid callback token");S({type:"task-failed",taskName:q.taskName,error:A,timestamp:ke()});try{m().stream("exec-history").append({taskName:q.taskName,status:"failed",error:A,completedAt:ke()});}catch{}return R(),z()}catch(y){return Z(y)}}function I(C){try{let y=C.params?.token;if(!y)return M("taskProgress requires params.token");let q=(C.body??{}).update??{},H=Bn(y);return H?(S({type:"task-progress",taskName:H.taskName,update:q,timestamp:ke()}),R(),z()):M("Invalid callback token")}catch(y){return Z(y)}}function F(C){try{let y=C.params?.token,A=C.params?.ref;if(!y)return M("sourceDataFetched requires params.token");if(!A)return M("sourceDataFetched requires params.ref");let q=Gc(y);if(!q)return M("Invalid source token");let{cbk:H,cid:re,b:Ee,d:ce,cs:je,rqt:be}=q,Rt=Mn(t.blobStorage("sources"),$t=>t.resolveBlob($t)),Ct=t.genId();Rt.ingestSourceDataStaged(re,ce,Ge(A),Ct);let Mt=Bn(H);if(!Mt)return M("Invalid callback token embedded in source token");let Lt=ke();return S({type:"task-progress",taskName:Mt.taskName,update:{bindTo:Ee,outputFile:ce,fetchedAt:Lt,deliveryToken:Ct,sourceChecksum:je,rqt:be},timestamp:Lt}),R(),z()}catch(y){return Z(y)}}function N(C){try{let y=C.params?.token,A=C.params?.reason??"unknown";if(!y)return M("sourceDataFetchFailure requires params.token");let q=Gc(y);if(!q)return M("Invalid source token");let{cbk:H,b:re,d:Ee,cs:ce,rqt:je}=q,be=Bn(H);return be?(S({type:"task-progress",taskName:be.taskName,update:{bindTo:re,outputFile:Ee,failure:!0,reason:A,sourceChecksum:ce,rqt:je},timestamp:ke()}),R(),z()):M("Invalid callback token embedded in source token")}catch(y){return Z(y)}}function pe(C){try{let y=i().readCardStoreRef();return y?z({storeRef:y}):M(`Board at ${e.value} has no card store configured`)}catch(y){return Z(y)}}function le(C){try{let y=i().readOutputsStoreRef();return y?z({storeRef:y}):M(`Board at ${e.value} has no outputs store configured`)}catch(y){return Z(y)}}function Ce(C){try{let y=i().readScratchStoreRef();return z({storeRef:y})}catch(y){return Z(y)}}function qe(C){try{let y=i().readArchiveStoreRef();return z({storeRef:y})}catch(y){return Z(y)}}function D(C){try{let y=i().readChatStoreRef();return z({storeRef:y})}catch(y){return Z(y)}}function B(C){try{let y=i().readArtifactsStoreRef();return z({storeRef:y})}catch(y){return Z(y)}}function te(C){try{let y=C.params?.key;if(!y)return M("getConfig requires params.key");let A=i(),q;switch(y){case "task-executor":q=A.readTaskExecutorRef()??null;break;case "chat-handler-flow":q=A.readChatHandlerFlow()??null;break;case "card-store-ref":q=A.readCardStoreRef();break;case "outputs-store-ref":q=A.readOutputsStoreRef();break;case "scratch-store-ref":q=A.readScratchStoreRef();break;case "archive-store-ref":q=A.readArchiveStoreRef();break;case "chat-store-ref":q=A.readChatStoreRef();break;case "artifacts-store-ref":q=A.readArtifactsStoreRef();break;default:return M(`getConfig: unknown key "${y}"`)}return z({value:q})}catch(y){return Z(y)}}function fe(C){try{let y=C.params?.key;if(!y)return M("getOutputsDataObject requires params.key");let A=l().readDataObject(y);return z(A)}catch(y){return Z(y)}}function $e(C){try{return z(l().readAllDataObjects())}catch(y){return Z(y)}}function tt(C){try{let y=C.params?.key;if(!y)return M("getOutputsComputedValues requires params.key");let A=l().readComputedValues(y);return z(A)}catch(y){return Z(y)}}function we(C){try{return z(l().readAllComputedValues())}catch(y){return Z(y)}}function Oe(){return Mn(t.blobStorage("sources"),C=>t.resolveBlob(C))}function rt(C){let y=t.blobStorage("sources").keyRef?.(C);return y?oe(y):C}function _t(C){try{let y=C.params?.key;if(!y)return M("getOutputsFetchedSources requires params.key");let A=Oe().listSources(y),q={};for(let H of A)q[H]=rt(`${y}/${H}`);return z(q)}catch(y){return Z(y)}}function sr(C){try{let y=Oe(),A=new Set;for(let H of t.blobStorage("sources").listKeys()){let re=H.indexOf("/");re>0&&!H.includes("/.staged/")&&A.add(H.slice(0,re));}let q={};for(let H of A){let re=y.listSources(H);if(re.length>0){q[H]={};for(let Ee of re)q[H][Ee]=rt(`${H}/${Ee}`);}}return z(q)}catch(y){return Z(y)}}return {init:j,status:v,getCardStoreRef:pe,getOutputsStoreRef:le,getScratchStoreRef:Ce,getArchiveStoreRef:qe,getChatStoreRef:D,getArtifactsStoreRef:B,getConfig:te,getOutputsDataObject:fe,getAllOutputsDataObjects:$e,getOutputsComputedValues:tt,getAllOutputsComputedValues:we,getOutputsFetchedSources:_t,getAllOutputsFetchedSources:sr,removeCard:h,retrigger:k,processAccumulatedEvents:$,upsertCard:E,taskFailed:x,taskProgress:I,sourceDataFetched:F,sourceDataFetchFailure:N}}function ty(e,t){let r=()=>Xo(t.kvStorage("config"));function n(){let v=r().readCardStoreRef();if(!v)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let h=t.kvStorageForRef(v);return {readIndex(){return h.read("_index")},writeIndex(k){h.write("_index",k);},readCard(k){return h.read(k)},writeCard(k,$){return h.write(k,$),t.hashFn($)},removeCard(k){h.delete(k);},cardExists(k){return h.read(k)!==null},defaultCardKey(k){return k}}}let s=()=>Dn(n(),t.onWarn??(()=>{})),o=()=>{let v=r().readScratchStoreRef();return v?t.scratchStorageForRef(v):t.scratchStorage()};function a(v,h){let k=t.validateSchema(h),$=[],E=r().readTaskExecutorRef();if(E&&Array.isArray(h.source_defs))for(let I of h.source_defs){let F=typeof I.bindTo=="string"?I.bindTo:"(unknown)";try{let N;try{N=t.invokeExecutorSync(E,"validate-source-def",[],{timeout:t.executorTimeouts?.validationMs??1e4,input:JSON.stringify(I)});}catch(le){let Ce=le;if(N=typeof Ce?.stdout=="string"?Ce.stdout:"",!N.trim()){$.push(`source "${F}": executor validate-source-def failed \u2014 ${le instanceof Error?le.message:String(le)}`);continue}}let pe=JSON.parse(N.trim());if(!pe.ok&&Array.isArray(pe.errors))for(let le of pe.errors)$.push(`source "${F}": ${le}`);}catch(N){$.push(`source "${F}": executor validate-source-def failed \u2014 ${N instanceof Error?N.message:String(N)}`);}}let x=[...k.errors,...$];return z({cardId:v,isValid:x.length===0,issues:x})}function i(v,h){let k=r().readTaskExecutorRef();if(!k)throw new Error("No task-executor registered for this board");let $=typeof v.bindTo=="string"?v.bindTo:"source",E=o(),x={...v,boardDir:e.value,_projections:h},I=E.create(JSON.stringify(x,null,2),`probe-in-${$}`,".json"),F=E.getUniqueKey(`probe-out-${$}`,".json"),N=E.getUniqueKey(`probe-err-${$}`,".txt"),pe=oe(E.keyRef(I)),le=oe(E.keyRef(F)),Ce=oe(E.keyRef(N)),qe=null;try{if(t.invokeExecutorSync(k,"run-source-fetch",["--in-ref",pe,"--out-ref",le,"--err-ref",Ce],{timeout:v.timeout??t.executorTimeouts?.probeMs??6e4}),qe=E.read(F),qe===null)throw new Error("Executor produced no output file")}catch(D){let B=E.read(N)?.trim()??(D instanceof Error?D.message:String(D));throw new Error(`Probe failed: ${B}`)}finally{try{E.remove(I);}catch{}try{E.remove(N);}catch{}}return {bindTo:$,result:qe}}function c(v,h,k){let $;try{$=i(v,h);}catch(E){return M(E instanceof Error?E.message:String(E))}if(k){let E=Ge(k);t.absoluteBlob.write(E.value,$.result);}return z({bindTo:$.bindTo,resultSizeBytes:$.result.length})}function u(v,h){let k=v.params?.sourceIdx,$=v.params?.outRef;if(k===void 0)return M(`${h} requires params.sourceIdx`);if(!v.body||typeof v.body!="object"||Array.isArray(v.body))return M(`${h} requires card JSON object in body`);let E=v.body,x=E["card-content"]??E,I=E["mock-projections"]??{},F=x.source_defs??[];if(k<0||k>=F.length)return M(`sourceIdx ${k} out of range (card has ${F.length} source(s))`);let N=F[k],pe=typeof N.bindTo=="string"?N.bindTo:"source";return {src:N,bindTo:pe,outRef:$,mockProjections:I}}function d(v){try{let h=v.params?.cardId,k=v.params?.all;if(!h&&!k)return M("validateCard requires --card-id <id> or --all");let $=k?s().readAllCards().map(x=>x.id):[h],E=[];for(let x of $){let I=s().readCard(x);if(!I){E.push({cardId:x,isValid:!1,issues:[`Card "${x}" not found`]});continue}let F=a(x,I);if(F.status!=="success")return F;E.push(F.data);}return z(E)}catch(h){return Z(h)}}function l(v){try{if(!v.body||typeof v.body!="object"||Array.isArray(v.body))return M("validateCardPreflight requires card JSON object in body");let h=v.body,k=h["card-content"]??h,$=typeof k.id=="string"?k.id:"(unknown)",E=a($,k),x=r().readTaskExecutorRef();if(x)try{let I=t.invokeExecutorSync(x,"validate-card-preflight",[],{timeout:t.executorTimeouts?.validationMs??1e4,input:JSON.stringify(k)}),F=JSON.parse(I.trim());if(!F.ok&&Array.isArray(F.errors)&&F.errors.length>0){let N=[...E.status==="success"?E.data.issues:[],...F.errors];return z({cardId:$,isValid:!1,issues:N})}}catch{}return E}catch(h){return Z(h)}}function m(v){try{let h=v.params?.cardId,k=v.params?.sourceIdx,$=v.params?.outRef;if(!h)return M("probeSource requires params.cardId");if(k===void 0)return M("probeSource requires params.sourceIdx");let x=(v.body??{})["mock-projections"]??{},I=s().readCard(h);if(!I)return M(`Card "${h}" not found`);let F=I.source_defs??[];return k<0||k>=F.length?M(`sourceIdx ${k} out of range (card has ${F.length} source(s))`):c(F[k],x,$)}catch(h){return Z(h)}}function g(v){try{let h=v.params?.outRef,k=v.body;if(!k)return M('probeTmpSource requires body with "source-def" and "mock-projections"');let $=k["source-def"],E=k["mock-projections"]??{};return $?c($,E,h):M('probeTmpSource body requires "source-def"')}catch(h){return Z(h)}}function f(v){try{let h=u(v,"probeSourcePreflight");if("status"in h)return h;let k=r().readTaskExecutorRef();if(!k)return M("No task-executor registered for this board");try{let $={...h.src,_projections:h.mockProjections},E=t.invokeExecutorSync(k,"probe-source-preflight",[],{timeout:h.src.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify($)}),x=JSON.parse(E.trim());return x.ok?z({bindTo:h.bindTo,reachable:x.reachable,latencyMs:x.latencyMs,note:x.note}):M(x.error??"Preflight probe failed")}catch{return M("Executor does not support probe-source-preflight")}}catch(h){return Z(h)}}function p(v){try{let h=u(v,"runSourcePreflight");if("status"in h)return h;let k=r().readTaskExecutorRef();if(k)try{let I={...h.src,_projections:h.mockProjections},F=t.invokeExecutorSync(k,"run-source-preflight",[],{timeout:h.src.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify(I)}),N=JSON.parse(F.trim());return N.ok?z({bindTo:N.bindTo??h.bindTo,reachable:N.reachable,latencyMs:N.latencyMs,kind:N.kind,resultValue:N.resultValue,note:N.note}):M(N.error??"Source preflight failed")}catch{}let $=Date.now(),E=i(h.src,h.mockProjections);if(h.outRef){let I=Ge(h.outRef);t.absoluteBlob.write(I.value,E.result);}let x=E.result;try{x=JSON.parse(E.result);}catch{}return z({bindTo:E.bindTo,reachable:!0,latencyMs:Date.now()-$,resultValue:x,note:"Actual fetch preflight passed"})}catch(h){return Z(h)}}function S(v){try{let h=r().readTaskExecutorRef();if(!h)return M("No task-executor registered for this board");let k=t.invokeExecutorSync(h,"describe-capabilities",[],{timeout:t.executorTimeouts?.describeMs??1e4});return z(JSON.parse(k.trim()))}catch(h){return Z(h)}}function _(v){try{let h=v.body;if(!h||!Array.isArray(h.ops))return M("updatesInCardStore requires body.ops array");let k=h.ops,$=s();for(let E of k){let x=E.op,I=E.id;if(!I)return M('op is missing "id"');if(x==="update"){let F=E["card-content"];if(!F)return M(`update op for "${I}" is missing "card-content"`);$.writeCard(I,F);}else return M(`Unknown op type: "${x??"(none)"}"`)}return z()}catch(h){return Z(h)}}function w(v){try{let h=v.body;if(!h||!Array.isArray(h.ids))return M("readFromCardStore requires body.ids array");let k=h.ids,$=s(),E=k.map(x=>({id:x,"card-content":$.readCard(x)}));return z({cards:E})}catch(h){return Z(h)}}function R(v){try{if(!v.body||typeof v.body!="object"||Array.isArray(v.body))return M("evalCardCompute requires a JSON object in body");let h=v.body,k=h["card-content"]??h,$=typeof k.id=="string"?k.id:"(unknown)",E=h["mock-fetched-sources"]??{},x=h["mock-requires"]??{},I=k.compute;if(!I||!Array.isArray(I)||I.length===0)return z({cardId:$,ok:!0,computed_values:{},errors:[]});let F={id:$,card_data:k.card_data??{},requires:x,source_defs:k.source_defs,compute:I},N=wt.runSync(F,{sourcesData:E}),pe=N.node.computed_values??{},le=N.errors??[];return z({cardId:$,ok:le.length===0,computed_values:pe,errors:le})}catch(h){return Z(h)}}function j(v){try{if(!v.body||typeof v.body!="object"||Array.isArray(v.body))return M("simulateCardCycle requires a JSON object in body");let h=v.body,k=h["card-content"]??h,$=typeof k.id=="string"?k.id:"(unknown)",E=h["mock-fetched-sources"]??{},x=h["mock-requires"]??{},I=a($,k),F=I.status==="success"?{isValid:I.data.isValid,issues:I.data.issues}:{isValid:!1,issues:[I.status==="fail"?I.error:"internal error"]},N=k.source_defs??[],pe=k.card_data??{},le=[],Ce=[];if(N.length>0){le=wt.enrichSourcesSync(N,{card_data:pe,requires:x});for(let we of le){let Oe=we.projections,rt=we._projections;if(Oe&&rt){for(let _t of Object.keys(Oe))if(rt[_t]===void 0){let sr=typeof we.bindTo=="string"?we.bindTo:"(unknown)";Ce.push({bindTo:sr,key:_t,error:`Projection "${_t}" resolved to undefined`});}}}}let qe=[],D=h["task-executor-ref"],B=(D?.howToRun&&D?.whatToRun?D:void 0)??r().readTaskExecutorRef();for(let we=0;we<le.length;we++){let Oe=le[we],rt=typeof Oe.bindTo=="string"?Oe.bindTo:`source_${we}`;if(!B){qe.push({bindTo:rt,skipped:!0,error:"No task executor configured"});continue}try{let _t={...Oe},sr=t.invokeExecutorSync(B,"run-source-preflight",[],{timeout:Oe.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify(_t)}),C=JSON.parse(sr.trim());qe.push({bindTo:rt,reachable:C.reachable,latencyMs:C.latencyMs,error:C.ok?void 0:C.error});}catch{qe.push({bindTo:rt,skipped:!0,error:"Executor does not support run-source-preflight"});}}let te=k.compute,fe={},$e=[];if(te&&Array.isArray(te)&&te.length>0){let we={id:$,card_data:pe,requires:x,source_defs:k.source_defs,compute:te},Oe=wt.runSync(we,{sourcesData:E});fe=Oe.node.computed_values??{},$e=Oe.errors??[];}let tt=F.isValid&&Ce.length===0&&$e.length===0&&qe.every(we=>we.reachable!==!1);return z({cardId:$,ok:tt,validation:F,source_probes:qe,projection_errors:Ce,computed_values:fe,compute_errors:$e})}catch(h){return Z(h)}}return {validateCard:d,validateCardPreflight:l,probeSource:m,probeTmpSource:g,probeSourcePreflight:f,runSourcePreflight:p,evalCardCompute:R,simulateCardCycle:j,describeTaskExecutorCapabilities:S,updatesInCardStore:_,readFromCardStore:w}}function ry(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 c of i)e.removeCard(c);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,c=i&&Object.prototype.hasOwnProperty.call(i,"value")?i.value:s.body;return e.patchCard(o,a,c),t({count:1})}catch(o){return n(o)}}}}function ny(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 c=i.bytes,u=new Uint8Array(c.map(d=>Math.max(0,Math.min(255,Number(d)||0))));return t({artifact:e.putBytes(o,u,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 u=e.getText(o);return u===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,text:u})}let c=e.getBytes(o);return c===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,bytes:[...c]})}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)}}}}function Jc(){return new Date().toISOString()}function zc(e){return new TextEncoder().encode(e).byteLength}function sy(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function oy(e){let t=String(e||"").match(/^(\d+)[-_]/);return t?parseInt(t[1],10):0}function ay(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 iy(e){return String(e||"").toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"")||"file"}function uy(e){if(!e||e===".")return "";let t=String(e).replace(/^\./,"").toLowerCase().replace(/[^a-z0-9]/g,"");return t?`.${t}`:""}function cy(e){let t=ay(e),r=t.lastIndexOf(".");return r<=0||r===t.length-1?{stem:t,ext:""}:{stem:t.slice(0,r),ext:t.slice(r)}}function dy(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Qo(e){function t(r){let n=e.stat?sy(e.stat(r)):null;if(n)return n;if(!e.exists(r))return null;let s=e.read(r);return s===null?{key:r}:{key:r,size:zc(s)}}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};return o.contentType=s,o.updatedAt=o.updatedAt??Jc(),o.size=o.size??zc(n),o},putBytes(r,n,s="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,n);else {let a=JSON.stringify({__kind:"bytes-array",data:[...n]});e.write(r,a);}let o=t(r)??{key:r};return o.contentType=s,o.updatedAt=o.updatedAt??Jc(),o.size=o.size??n.byteLength,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=""){return e.listKeys(r).map(n=>t(n)??{key:n}).sort((n,s)=>n.key.localeCompare(s.key))},remove(r){e.remove(r);}}}function ly(e){function t(s,o){let a=0,i=[];Array.isArray(o)&&i.push(...o);for(let c of e.list(`${s}/`))i.push(dy(c.key));for(let c of i){let u=oy(c);Number.isFinite(u)&&u>a&&(a=u);}return a+1}function r(s,o,a){let i=Number(a?.maxLen||32),{stem:c,ext:u}=cy(s),d=uy(u),l=iy(c),m=`${String(o).padStart(3,"0")}-`,g=d,f=i-m.length-g.length;f<1&&(g="",f=i-m.length);let p=l.slice(0,Math.max(1,f)),S=`${m}${p}${g}`;return S.length>i&&(S=S.slice(0,i).replace(/\.$/,"")),S}function n(s,o,a){let i=t(s,a?.seedNames),c=r(o,i,{maxLen:a?.maxLen});for(;e.exists(`${s}/${c}`);)i+=1,c=r(o,i,{maxLen:a?.maxLen});return c}return {nextSerial:t,buildStoredName:r,allocateStoredName:n}}function fy(){function e(s,o){if(!Array.isArray(s))return [];let a=[];for(let i of s){if(!i||typeof i!="object")continue;let c=i;typeof c.stored_name=="string"&&a.push({name:typeof c.name=="string"?c.name:c.stored_name,stored_name:c.stored_name,size:typeof c.size=="number"&&Number.isFinite(c.size)?c.size:null,mime_type:typeof c.mime_type=="string"?c.mime_type:null,uploaded_at:typeof c.uploaded_at=="string"?c.uploaded_at:o||null,chat:c.chat===true});}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(c=>c.stored_name));for(let c of o)i.has(c.stored_name)||(a.push(c),i.add(c.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 c=i[o];return !c||!c.stored_name?{ok:false,reason:"missing_stored_name"}:a&&a!==c.stored_name?{ok:false,reason:"stale_reference"}:{ok:true,file:c}}return {read:t,normalizeIncoming:e,merge:r,resolve:n}}function ok(){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;r=Je(o);}catch{r="";}if(!r)return {dispatched:false,error:"createNodeSpawnInvocationAdapter: could not resolve executable path from whatToRun"};let n={...t},s=Buffer.from(JSON.stringify(n)).toString("base64");try{return 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;t=Je(r);}catch{t="";}if(!t)return null;try{let r=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 gy=".board.lock";function Hc(e,t){if(!e||!t)return false;let r=String(e).replace(/[\\/]+$/,"").split(/[\\/]+/).filter(Boolean);return r.length>0&&r[r.length-1]===t}function hy(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function yy(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Wc(e){if(e)return e;let t=da(import.meta.url),r=[t,xe(t,"..","cli","node"),xe(t,"..","..","cli","node")];for(let n of r)try{return Wn(n),n}catch{}throw new Error(`createFsBoardPlatformAdapter: could not resolve a public CLI directory from module dir ${t}`)}function vy(e,t,r){let{cliDir:n,opts:s}=hy(t,r),o=Wc(n),a=e.value,c={meta:"board-live-cards",howToRun:"local-node",whatToRun:(s?.suppressSpawn?"":Wn(o))?oe({kind:"yaml-flow-cli",value:"board-live-cards-cli.js"}):"",...s?.notifyChannel?{extra:{notifyChannel:s.notifyChannel}}:{}};return {kvStorage:u=>Xr(xe(a,`.${u}`)),blobStorage:u=>u?Bt(xe(a,u)):Bt(a),scratchStorage:()=>Wr(xe(a,".tmp")),scratchStorageForRef:u=>Wr(Ge(u).value),archiveFactory:()=>Yr(xe(a,"archive")),archiveFactoryForRef:u=>Yr(Ge(u).value),journalAdapter:()=>xa(a),lock:Ta(xe(a,gy)),selfRef:c,async dispatchExecution(u,d){if(s?.suppressSpawn)return {dispatched:false};try{let l=d.source_def?.bindTo??Jn().slice(0,8),m=Wr(xe(a,".tmp")),g=m.create(JSON.stringify(d,null,2),`exec-in-${l}`,".json"),f=m.getUniqueKey(`exec-out-${l}`,".json"),p=m.getUniqueKey(`exec-err-${l}`,".txt"),S=oe(m.keyRef(g)),_=oe(m.keyRef(f)),w=oe(m.keyRef(p));return Ra(u,{subcommand:"run-source-fetch",inRef:S,outRef:_,errRef:w},o),{dispatched:!0}}catch(l){let m=l instanceof Error?l.message:String(l);try{let g=Yr(xe(a,"archive")),f=new Date().toISOString().replace(/[:.]/g,"-"),p=d.source_def?.bindTo??"unknown";g.blob("exec-failures").write(`${f}-${p}.json`,JSON.stringify({error:m,args:d,ref:u,at:new Date().toISOString()},null,2));}catch{}return {dispatched:false,error:m}}},resolveBlob(u){let d=ua(u.value)?rs().read(u.value):Bt(a).read(u.value);if(d===null)throw new Error(`resolveBlob: blob not found: ::${u.kind}::${u.value}`);return d},hashFn:Ea,genId:()=>ca(`${Date.now()}-${Math.random()}`).slice(0,32),kvStorageForRef:u=>Xr(Ge(u).value),requestProcessAccumulated(){s?.suppressSpawn||pa(o,e,s?.notifyChannel);},publishBoardChangeNotifications(u){if(!s?.notifyChannel||u.length===0)return;let d=u.map(l=>({id:Jn(),ts:new Date().toISOString(),boardRef:oe(e),notification:l}));ma(s.notifyChannel,d,s.onWarn);},onWarn:s?.onWarn}}function ak(e,t,r){let{cliDir:n,opts:s}=yy(t,r),o=Wc(n),a=vy(e,o,s),i=Ur();return {...a,invokeExecutorSync(c,u,d,l){let{command:m,baseArgs:g}=Jr(c,o),f=c.extra?["--extra",Buffer.from(JSON.stringify(c.extra)).toString("base64")]:[];return i.executeSync(m,[...g,u,...d,...f],{timeout:l?.timeout??3e4,encoding:"utf-8",input:l?.input})},validateSchema(c){let u=Go(c);return {ok:u.errors.length===0,errors:u.errors}},absoluteBlob:rs()}}function ik(e,t={}){let r=t.chatsSubdir??"chats",n=t.kvSubdir??".kv",s=n?[n,"chat"]:["chat"],o=r&&!Hc(e,r)?xe(e,r):e,a=Xr(xe(e,...s));return Uo(i=>{let u=`${String(i).replace(/[^a-zA-Z0-9_-]/g,"_")}.jsonl`,d=xe(o,u);return ns(d)},a)}function uk(e,t={}){let r=t.filesSubdir??"files",n=r&&!Hc(e,r)?xe(e,r):e;return Qo(Bt(n))}function ck(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString());return typeof t.br=="string"?t.br:null}catch{return null}}
|
|
19
|
-
export{
|
|
14
|
+
`,"utf-8");}catch{}function n(){if(!_.existsSync(r))return {};try{let a=_.readFileSync(r,"utf-8"),i=JSON.parse(a);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return {}}}function s(a){let i=`${r}.${process.pid}.${randomUUID()}.tmp`;try{_.writeFileSync(i,JSON.stringify(a,null,2),"utf-8"),rt(i,r);}catch{}}function o(){if(!_.existsSync(t))return;let a=n(),i=typeof a["retention.maxAgeMs"]=="number"?a["retention.maxAgeMs"]:0,c=typeof a["retention.sweepIntervalMs"]=="number"?a["retention.sweepIntervalMs"]:0;if(i<=0||c<=0)return;let u=typeof a["retention.lastSweepAt"]=="number"?a["retention.lastSweepAt"]:0,d=Date.now();if(d-u<c)return;a["retention.lastSweepAt"]=d,s(a);let l=d,m=h=>{let f;try{f=_.readdirSync(h,{withFileTypes:!0});}catch{return}for(let p of f){if(Date.now()-l>Gd)return;let S=X.join(h,p.name);if(p.isDirectory()){m(S);continue}if(p.isFile())try{let b=_.statSync(S);if(d-b.mtimeMs>i)try{_.unlinkSync(S);}catch{}}catch{}}};m(X.join(e,Hr)),m(X.join(e,Wr));}return {stream(a){let i=Aa(a),c=X.join(e,Hr,`${i}.jsonl`),u=os(c);return {append(d){let l=u.append(d);try{o();}catch{}return l},readAll:()=>u.readAll(),readAfter:d=>u.readAfter(d),clear:()=>{u.clear&&u.clear();}}},blob(a){let i=Aa(a),c=X.join(e,Wr,i);_.mkdirSync(c,{recursive:true});let u=Ut(c);return {read:d=>u.read(d),write:(d,l)=>{u.write(d,l);try{o();}catch{}},exists:d=>u.exists(d),remove:d=>u.remove(d),readBytes:u.readBytes?d=>u.readBytes(d):void 0,writeBytes:u.writeBytes?(d,l)=>{u.writeBytes(d,l);try{o();}catch{}}:void 0,listKeys:d=>u.listKeys(d),stat:u.stat?d=>u.stat(d):void 0}},listStreams(a){let i=X.join(e,Hr);try{return _.readdirSync(i,{withFileTypes:!0}).filter(c=>c.isFile()&&c.name.endsWith(".jsonl")).map(c=>c.name.slice(0,-6)).filter(c=>!a||c.startsWith(a)).sort()}catch{return []}},listBlobs(a){let i=X.join(e,Wr);try{return _.readdirSync(i,{withFileTypes:!0}).filter(c=>c.isDirectory()).map(c=>c.name).filter(c=>!a||c.startsWith(a)).sort()}catch{return []}},config:{get(a){return n()[a]??null},set(a,i){let c=n();i==null?delete c[a]:c[a]=i,s(c);}}}}function Qr(e){function t(n){return X.join(e,...n.split("/"))+".json"}function r(n,s,o,a){if(_.existsSync(n))for(let i of _.readdirSync(n,{withFileTypes:true})){let c=s?`${s}/${i.name}`:i.name;if(i.isDirectory()){r(X.join(n,i.name),c,o,a);continue}if(!i.isFile()||!i.name.endsWith(".json"))continue;let u=c.replace(/\.json$/,"");(!o||u.startsWith(o))&&a.push(u);}}return {read(n){let s=t(n);if(!_.existsSync(s))return null;try{return JSON.parse(_.readFileSync(s,"utf-8"))}catch{return null}},write(n,s){let o=t(n),a=`${o}.${process.pid}.${randomUUID()}.tmp`;_.mkdirSync(X.dirname(o),{recursive:true}),_.writeFileSync(a,JSON.stringify(s,null,2),"utf-8"),rt(a,o);},delete(n){let s=t(n);try{_.existsSync(s)&&_.unlinkSync(s);}catch{}},listKeys(n){let s=[];return r(e,"",n,s),s.sort()}}}function os(e){function t(){if(!_.existsSync(e))return [];let r=_.readFileSync(e,"utf-8").trim();return r?r.split(`
|
|
15
|
+
`).filter(Boolean).map(n=>JSON.parse(n)):[]}return {append(r){let n={id:randomUUID(),payload:r};return _.mkdirSync(X.dirname(e),{recursive:true}),_.appendFileSync(e,JSON.stringify(n)+`
|
|
16
|
+
`,"utf-8"),n},readAll(){return t()},readAfter(r){let n=t();if(!r)return {entries:n,newCursor:n.length>0?n[n.length-1].id:null};let s=n.findIndex(a=>a.id===r),o=s===-1?n:n.slice(s+1);return {entries:o,newCursor:o.length>0?o[o.length-1].id:r}},clear(){_.existsSync(e)&&_.truncateSync(e,0);}}}function ns(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return `[${e.map(ns).join(",")}]`;let t=e;return `{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${ns(t[n])}`).join(",")}}`}function Ta(e){return createHash("sha256").update(ns(e)).digest("hex")}function Ia(e){let t=X.join(e,"board-journal.jsonl");return {readAllEntries(){if(!_.existsSync(t))return [];let r=_.readFileSync(t,"utf-8").trim();return r?r.split(`
|
|
17
|
+
`).filter(Boolean).map(n=>JSON.parse(n)):[]},appendEntry(r){_.appendFileSync(t,JSON.stringify(r)+`
|
|
18
|
+
`,"utf-8");},generateId(){return randomUUID()}}}function Pa(e){return {tryAcquire(){try{if(!_.existsSync(e)){_.mkdirSync(X.dirname(e),{recursive:!0});try{_.writeFileSync(e,"{}",{flag:"wx"});}catch{}}return lockSync(e,{retries:0})}catch{return null}}}}var ja={$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"},chat:{type:"boolean",description:"Whether this file entry is associated with a chat interaction"}},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 cc=cd(ac());var wh=createRequire(import.meta.url),bh=wh("./jsonata-sync.cjs"),On=null;var ic=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,_h=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function Rh(e){let t=new Set,r;for(ic.lastIndex=0;(r=ic.exec(e))!==null;)t.add(r[1]);return t}function dc(e){let t=_h.exec(e);return t?t[1]:null}function uc(e,t,r,n){try{bh(e);}catch(o){let a=o instanceof Error?o.message:String(o);n.push(`${t}: invalid JSONata expression (${a})`);return}let s=Rh(e);for(let o of s)r.has(o)||n.push(`${t}: disallowed namespace "${o}" in expression`);}function Uo(e,t,r){if(Array.isArray(e)){e.forEach((s,o)=>{Uo(s,`${t}/${o}`,r);});return}if(typeof e=="string"){let s=dc(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))Uo(o,`${t}/${s}`,r);}function Ch(){if(On)return On;let e=new cc.default({allErrors:true});return Sh(e),On=e.compile(ja),On}function lc(e){let t=Ch(),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,c)=>{if(!i||typeof i!="object"||Array.isArray(i))return;let u=i;typeof u.bindTo=="string"&&u.bindTo&&(o.has(u.bindTo)&&n.push(`/source_defs/${c}/bindTo: bindTo "${u.bindTo}" must be unique across all source_defs`),o.add(u.bindTo)),typeof u.outputFile=="string"&&u.outputFile&&(a.has(u.outputFile)&&n.push(`/source_defs/${c}/outputFile: outputFile "${u.outputFile}" must be unique across all source_defs`),a.add(u.outputFile));});}}return !r||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function fc(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((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.expr;typeof l!="string"||l.trim().length===0||uc(l,`/compute/${d}/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((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.ref;if(typeof l!="string"||l.trim().length===0)return;let m=dc(l);m===null?t.push(`/provides/${d}/ref: path "${l}" must start with a valid namespace (${[...s].join(", ")})`):s.has(m)||t.push(`/provides/${d}/ref: disallowed namespace "${m}" in path "${l}" (valid: ${[...s].join(", ")})`);});let a=r.view;a&&typeof a=="object"&&!Array.isArray(a)&&Uo(a,"/view",t);let i=new Set(["card_data","requires"]),c=r.source_defs;return Array.isArray(c)&&c.forEach((u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return;let l=u.projections;if(!(!l||typeof l!="object"||Array.isArray(l)))for(let[m,h]of Object.entries(l))typeof h!="string"||h.trim().length===0||uc(h,`/source_defs/${d}/projections/${m}`,i,t);}),{ok:t.length===0,errors:t}}function Jo(e){let t=lc(e);if(!t.ok)return t;let r=fc(e);return r.ok?{ok:true,errors:[]}:{ok:false,errors:r.errors}}function pc(e){return String(e).replace(/[^a-zA-Z0-9_-]/g,"_")}function mc(e){let t=e.payload??{};return {id:e.id,role:typeof t.role=="string"?t.role:"system",text:typeof t.text=="string"?t.text:"",files:Array.isArray(t.files)?t.files:[],updated_at:typeof t.updated_at=="string"?t.updated_at:""}}function zo(e,t){let r=s=>`chats/${pc(s)}/processing`,n=s=>`chats/${pc(s)}/config`;return {append(s,o,a,i=[]){return e(s).append({role:o,text:a,files:i,updated_at:new Date().toISOString()}).id},readAll(s){return e(s).readAll().map(mc)},readAfter(s,o){let a=e(s).readAfter(o);return {records:a.entries.map(mc),cursor:a.newCursor}},clear(s){e(s).clear?.();},setProcessing(s,o){o?t.write(r(s),true):t.delete(r(s));},isProcessing(s){return t.read(r(s))===true},getConfig(s){return t.read(n(s))??{}},setConfig(s,o){let a=t.read(n(s))??{};t.write(n(s),{...a,...o});}}}function $h(){let e=globalThis.crypto;return typeof e?.randomUUID=="function"?String(e.randomUUID()):`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Eh(){let e=new Map,t=new Map;function r(n){return e.has(n)||e.set(n,[]),e.get(n)}return {append(n,s,o,a=[]){let i={id:$h(),role:s,text:o,files:a,updated_at:new Date().toISOString()};return r(n).push(i),i.id},readAll(n){return r(n).slice()},readAfter(n,s){let o=r(n);if(!s)return {records:o.slice(),cursor:o.length>0?o[o.length-1].id:null};let a=o.findIndex(c=>c.id===s),i=a===-1?o.slice():o.slice(a+1);return {records:i,cursor:i.length>0?i[i.length-1].id:s}},clear(n){e.set(n,[]);},setProcessing(n,s){s?t.set(`p:${n}`,true):t.delete(`p:${n}`);},isProcessing(n){return t.get(`p:${n}`)===true},getConfig(n){return t.get(`c:${n}`)??{}},setConfig(n,s){let o=t.get(`c:${n}`)??{};t.set(`c:${n}`,{...o,...s});}}}var kt={RUNNING:"running",COMPLETED:"completed",FAILED:"failed",INACTIVATED:"inactivated"};function Oe(e){return e?Array.isArray(e.provides)?e.provides:[]:[]}function wt(e){return e?Array.isArray(e.requires)?e.requires:[]:[]}function gc(e){return e.tasks??{}}function Ho(e){return e?e.status===kt.FAILED||e.status===kt.INACTIVATED:false}function hc(e,t){return e.refreshStrategy??t?.refreshStrategy??"data-changed"}function yc(e){return e.maxExecutions}function vc(e,t){let r=new Set;for(let[n,s]of Object.entries(t))if(s.status===kt.COMPLETED){let o=e.tasks[n];o&&Oe(o).forEach(i=>r.add(i));}return Array.from(r)}function Sc(e,t){let r={};return e.forEach(n=>{let s=t[n];if(!s)return;Oe(s).forEach(a=>{r[a]||(r[a]=[]),r[a].push(n);});}),r}function kc(e,t,r){let n=e.tasks[t]??Nn(),s={};if(r){let a=r.tasks[t],i=wt(a);for(let c of i)for(let[u,d]of Object.entries(r.tasks))if(Oe(d).includes(c)){let l=e.tasks[u];l?.lastDataHash&&(s[c]=l.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 wc(e,t,r,n,s,o){let a=e.tasks[r]??Nn(),i=t.tasks[r];if(!i)throw new Error(`Task "${r}" not found in graph`);let c;n&&i.on&&i.on[n]?c=i.on[n]:c=Oe(i);let u=a.startConsumedHashes?{...a.startConsumedHashes}:{...a.lastConsumedHashes};if(!a.startConsumedHashes){let m=i.requires??[];for(let h of m)for(let[f,p]of Object.entries(t.tasks))if(Oe(p).includes(h)){let S=e.tasks[f];S?.lastDataHash&&(u[h]=S.lastDataHash);break}}let d={...a,status:"completed",completedAt:new Date().toISOString(),lastUpdated:new Date().toISOString(),executionCount:a.executionCount+1,lastEpoch:a.executionCount+1,lastDataHash:s,data:o,lastConsumedHashes:u,error:void 0},l=[...new Set([...e.availableOutputs,...c])];return {...e,tasks:{...e.tasks,[r]:d},availableOutputs:l,lastUpdated:new Date().toISOString()}}function bc(e,t,r,n){let s=e.tasks[r]??Nn(),o=t.tasks[r];if(o?.retry){let c=s.retryCount+1;if(c<=o.retry.max_attempts){let u={...s,status:"not-started",retryCount:c,lastUpdated:new Date().toISOString(),error:n};return {...e,tasks:{...e.tasks,[r]:u},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 c=o.circuit_breaker.on_break;i=[...new Set([...i,...c])];}return {...e,tasks:{...e.tasks,[r]:a},availableOutputs:i,lastUpdated:new Date().toISOString()}}function _c(e,t,r,n){let s=e.tasks[t]??Nn(),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 Rc(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 Nn(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function qn(e,t){let r=`live-${Date.now()}`,n={};for(let o of Object.keys(e.tasks))n[o]=$c();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 xh(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:kc(n,t.taskName,r)};case "task-completed":return {config:r,state:wc(n,r,t.taskName,t.result,t.dataHash,t.data)};case "task-failed":return {config:r,state:bc(n,r,t.taskName,t.error)};case "task-progress":return {config:r,state:_c(n,t.taskName,t.message,t.progress)};case "task-restart":return {config:r,state:Rc(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:Nh(n,t.action)};case "task-upsert":return Ah(e,t.taskName,t.taskConfig);case "task-removal":return Th(e,t.taskName);case "node-requires-add":return Ih(e,t.nodeName,t.tokens);case "node-requires-remove":return Ph(e,t.nodeName,t.tokens);case "node-provides-add":return jh(e,t.nodeName,t.tokens);case "node-provides-remove":return Oh(e,t.nodeName,t.tokens);default:return e}}function Cc(e,t){return t.reduce((r,n)=>xh(r,n),e)}function Ah(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]:$c()},lastUpdated:new Date().toISOString()}}}function Th(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 Ih(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=wt(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 Ph(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=wt(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 jh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Oe(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 Oh(e,t,r){let n=e.config.tasks[t];if(!n)return e;let s=Oe(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 qr(e){return {version:1,config:e.config,state:e.state,snapshotAt:new Date().toISOString()}}function Fn(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 $c(){return {status:"not-started",executionCount:0,retryCount:0,lastEpoch:0,messages:[],progress:null}}function Nh(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 Fr(e){let{config:t,state:r}=e,n=gc(t);if(Object.keys(n).length===0)return {eligible:[],pending:[],unresolved:[],blocked:[],conflicts:{}};let o=qh(n),a=vc(t,r.tasks),i=new Set([...a,...r.availableOutputs]),c=[],u=[],d=[],l=[];for(let[h,f]of Object.entries(n)){let p=r.tasks[h],S=hc(f,t.settings),b=S!=="once";if(p?.status===kt.RUNNING||Ho(p))continue;let j=yc(f);if(j!==void 0&&p&&p.executionCount>=j||f.circuit_breaker&&p&&p.executionCount>=f.circuit_breaker.max_executions||!b&&p?.status===kt.COMPLETED)continue;if(b&&p?.status===kt.COMPLETED){let k=wt(f),R=false;switch(S){case "data-changed":{k.length>0&&k.some(x=>{for(let[P,D]of Object.entries(n))if(Oe(D).includes(x)){let q=r.tasks[P];if(!q)continue;let de=p.lastConsumedHashes?.[x];return q.lastDataHash==null?q.executionCount>p.lastEpoch:q.lastDataHash!==de}return false})||(R=true);break}case "epoch-changed":{k.length>0&&k.some(x=>{for(let[P,D]of Object.entries(n))if(Oe(D).includes(x)){let q=r.tasks[P];if(q&&q.executionCount>p.lastEpoch)return true}return false})||(R=true);break}case "time-based":{let $=f.refreshInterval??0;if($<=0){R=true;break}let x=p.completedAt;if(!x){R=true;break}(Date.now()-Date.parse(x))/1e3<$&&(R=true);break}case "manual":R=true;break}if(R)continue}let w=wt(f);if(w.length===0){c.push(h);continue}let E=[],y=[],v=[];for(let k of w){if(i.has(k))continue;let R=o[k]||[];R.length===0?E.push(k):R.every(x=>Ho(r.tasks[x]))?v.push({token:k,failedProducer:R[0]}):y.push(k);}E.length>0?d.push({taskName:h,missingTokens:E}):v.length>0?l.push({taskName:h,failedTokens:v.map(k=>k.token),failedProducers:[...new Set(v.map(k=>k.failedProducer))]}):y.length>0?u.push({taskName:h,waitingOn:y}):c.push(h);}let m={};if(c.length>1){let h=Sc(c,n);for(let[f,p]of Object.entries(h))p.length>1&&(m[f]=p);}return {eligible:c,pending:u,unresolved:d,blocked:l,conflicts:m}}function qh(e){let t={};for(let[r,n]of Object.entries(e)){for(let s of Oe(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 Dr=class{buffer=[];append(t){this.buffer.push(t);}drain(){let t=this.buffer;return this.buffer=[],t}get size(){return this.buffer.length}};function Wo(e){let t=Yo(e);return Fh(t)}function Yo(e){if(e==null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return "["+e.map(Yo).join(",")+"]";let t=e;return "{"+Object.keys(t).sort().map(n=>JSON.stringify(n)+":"+Yo(t[n])).join(",")+"}"}function Fh(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 Dh(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 Mh(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 Ec(e){let t=JSON.stringify({t:e,n:Date.now().toString(36)+Math.random().toString(36).slice(2,6)});return Dh(t)}function Lh(e){try{let t=JSON.parse(Mh(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function xc(e,t,r){let{handlers:n,onNodeRemoved:s,onDrain:o}=t,a=new Dr,i="state"in e&&"config"in e?e:qn(e),c=false,u=new Set,d=new Map(Object.entries(n)),l=new Dr,m=false,h=false;function f(){if(!c){if(m){h=true;return}m=true;try{do h=!1,p();while(h)}finally{m=false;}}}function p(){let w=l.drain(),E=a.drain(),y=[...w,...E];if(y.length>0&&(i=Cc(i,y),s)){for(let k of y)if(k.type==="task-removal")try{s(k.taskName);}catch(R){console.warn("[reactive] onNodeRemoved failed:",R instanceof Error?R.message:String(R));}}let v=Fr(i);y.length>0&&o?.(y,i,v);for(let k of v.eligible)j(k);for(let k of y)if(k.type==="task-progress"){let{taskName:R,update:$}=k;if(!i.config.tasks[R])continue;let P=i.state.tasks[R];if(!P||P.status!=="running")continue;let D=Ec(R),q=b(R,D,$).catch(de=>{c||(l.append({type:"task-failed",taskName:R,error:de.message??String(de),timestamp:new Date().toISOString()}),f());}).finally(()=>{u.delete(q);});u.add(q);}}function S(w){let y=i.config.tasks[w].requires??[],v=new Map;for(let[R,$]of Object.entries(i.config.tasks))for(let x of $.provides??[])v.set(x,R);let k={};for(let R of y){let $=v.get(R);$?k[R]=i.state.tasks[$]?.data:k[R]=void 0;}return k}async function b(w,E,y){let v=i.config.tasks[w],k=v.taskHandlers??[],R=S(w);for(let $ of k){let x=d.get($);if(!x)throw new Error(`Handler '${$}' not found in registry (task '${w}')`);let P={nodeId:w,state:R,taskState:i.state.tasks[w],config:v,callbackToken:E,update:y};if(await x(P)==="task-initiate-failure")throw new Error(`Handler '${$}' returned task-initiate-failure (task '${w}')`)}}function j(w){let y=i.config.tasks[w]?.taskHandlers;if(!y||y.length===0)return;l.append({type:"task-started",taskName:w,timestamp:new Date().toISOString()}),f();let v=Ec(w),k=b(w,v).catch(R=>{c||(l.append({type:"task-failed",taskName:w,error:R.message??String(R),timestamp:new Date().toISOString()}),f());}).finally(()=>{u.delete(k);});u.add(k);}return {push(w){c||(w.type==="task-completed"&&w.data&&!w.dataHash&&(w={...w,dataHash:Wo(w.data)}),a.append(w),f());},pushAll(w){if(!c){for(let E of w)E.type==="task-completed"&&E.data&&!E.dataHash?a.append({...E,dataHash:Wo(E.data)}):a.append(E);f();}},resolveCallback(w,E,y){if(c)return;let v=Lh(w);if(!v)return;let{taskName:k}=v;if(i.config.tasks[k]){if(y&&y.length>0)a.append({type:"task-failed",taskName:k,error:y.join("; "),timestamp:new Date().toISOString()});else {let R=E&&Object.keys(E).length>0?Wo(E):void 0;a.append({type:"task-completed",taskName:k,data:E,dataHash:R,timestamp:new Date().toISOString()});}f();}},addNode(w,E){c||(a.append({type:"task-upsert",taskName:w,taskConfig:E,timestamp:new Date().toISOString()}),f());},removeNode(w){c||(a.append({type:"task-removal",taskName:w,timestamp:new Date().toISOString()}),f());},addRequires(w,E){c||(a.append({type:"node-requires-add",nodeName:w,tokens:E,timestamp:new Date().toISOString()}),f());},removeRequires(w,E){c||(a.append({type:"node-requires-remove",nodeName:w,tokens:E,timestamp:new Date().toISOString()}),f());},addProvides(w,E){c||(a.append({type:"node-provides-add",nodeName:w,tokens:E,timestamp:new Date().toISOString()}),f());},removeProvides(w,E){c||(a.append({type:"node-provides-remove",nodeName:w,tokens:E,timestamp:new Date().toISOString()}),f());},registerHandler(w,E){d.set(w,E);},unregisterHandler(w){d.delete(w);},retrigger(w){c||i.config.tasks[w]&&(a.append({type:"task-restart",taskName:w,timestamp:new Date().toISOString()}),f());},retriggerAll(w){if(!c){for(let E of w)i.config.tasks[E]&&a.append({type:"task-restart",taskName:E,timestamp:new Date().toISOString()});f();}},snapshot(){return qr(i)},getState(){return i},getSchedule(){return Fr(i)},async waitForHandlers(){u.size>0&&await Promise.allSettled([...u]);},async dispose(w){w?.wait&&u.size>0&&await Promise.allSettled([...u]),c=true;}}}var Bh=createRequire(import.meta.url),Dn=Bh("./jsonata-sync.cjs"),Ic=Dn;function Ac(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 Pc(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 Kh(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 Dn(s.expr).evaluate(n);Pc(e.computed_values,s.bindTo,o),n.computed_values=e.computed_values;}catch{}return e}function Gh(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=Ic(o.expr).evaluate(n);Pc(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 Uh(e,t,r){let n={...r??{},card_data:t.card_data??{},requires:t.requires??{},fetched_sources:t._sourcesData??{},computed_values:t.computed_values??{}};return Dn(e).evaluate(n)}function Jh(e,t){return t.startsWith("fetched_sources.")?Ac(e._sourcesData??{},t.slice(16)):Ac(e,t)}var Tc=new Set(["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]),zh=new Set(["id","meta","requires","provides","view","card_data","compute","source_defs"]);function Hh(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))zh.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`):Tc.has(s.kind)||t.push(`view.elements[${o}].kind: unknown kind "${s.kind}". Valid: ${[...Tc].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 Wh(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 Dn(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}}))}function Yh(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]=Ic(a).evaluate(r);}catch{s[o]=void 0;}}return {...n,_projections:s}})}var bt={run:Kh,runSync:Gh,eval:Uh,resolve:Jh,validate:Hh,enrichSources:Wh,enrichSourcesSync:Yh};function Xh(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 Xo(e){return JSON.stringify(e)}function Qo(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 Mn(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 c={...s},u=c;for(let d=0;d<i.length-1;d++){let l=i[d],m=u[l],h=m&&typeof m=="object"&&!Array.isArray(m)?{...m}:{};u[l]=h,u=h;}return u[i[i.length-1]]=a,c}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,c]of Object.entries(o))s[i]!==c.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],c=Object.entries(a).find(([,u])=>u.key===o);return i&&i.key!==o?{ok:false,error:`Card id "${s}" is already mapped to key "${i.key}", cannot remap to "${o}"`}:c&&c[0]!==s?{ok:false,error:`Key "${o}" is already mapped to card id "${c[0]}", cannot remap to "${s}"`}:{ok:true}},writeCard(s,o,a){let i=r(),c=a??i[s]?.key??e.defaultCardKey(s),u=e.writeCard(c,o);i[s]={key:c,checksum:u,updatedAt:new Date().toISOString()},e.writeIndex(i);},patchCard(s,o,a){let i=r(),c=i[s];if(!c||!e.cardExists(c.key))throw new Error(`card "${s}" not found`);let u=e.readCard(c.key);if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`card "${s}" is not patchable`);let d=n(u,o,a),l=e.writeCard(c.key,d);i[s]={key:c.key,checksum:l,updatedAt:new Date().toISOString()},e.writeIndex(i);},removeCard(s){let o=r(),a=o[s];a&&(e.removeCard(a.key),delete o[s],e.writeIndex(o));},readIndex(){return r()}}}function Ln(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}`)},listSources(r){return e.listKeys(`${r}/`).filter(n=>!n.includes("/.staged/")).map(n=>n.slice(`${r}/`.length))}}}function Fc(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 Dc(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 Mr="v1",_t="board/graph",Mc="board/lastJournalProcessedId";function jc(e){return `cards/${e}/runtime`}function Lc(e){return {readRuntime(t){return e.read(jc(t))??{_sources:{}}},writeRuntime(t,r){e.write(jc(t),r);}}}function Qh(e,t){let r={...e};for(let n of t.deleteKeys)delete r[n];return {...r,...t.shallowMerge}}function Vc(e){return {readSnapshot(t){return e.readValues(t)},commitSnapshot(t,r){if(r.schemaVersion!==Mr)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=Qh(n.values,r);return {ok:true,newVersion:e.writeValues(t,s,r.deleteKeys)}}}}function Zo(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 Qo(r.trim())},writeTaskExecutorRef(r){e.write("task-executor",Xo(r));},readChatHandlerFlow(){return e.read("chat-handler-flow")},writeChatHandlerFlow(r){e.write("chat-handler-flow",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);},readScratchStoreRef(){return t("scratch-store-ref")},writeScratchStoreRef(r){e.write("scratch-store-ref",r);},readArchiveStoreRef(){return t("archive-store-ref")},writeArchiveStoreRef(r){e.write("archive-store-ref",r);},readChatStoreRef(){return t("chat-store-ref")},writeChatStoreRef(r){e.write("chat-store-ref",r);},readArtifactsStoreRef(){return t("artifacts-store-ref")},writeArtifactsStoreRef(r){e.write("artifacts-store-ref",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 Oc(e){return e?{lastRequestedToken:e.lastRequestedToken,lastCompletedToken:e.lastCompletedToken,lastCompletionStatus:e.lastCompletionStatus??(e.lastCompletedToken?"success":"not-started"),queueRequestedToken:e.queueRequestedToken}:{lastCompletionStatus:"not-started"}}function Zh(e){return e?.lastRequestedToken?e.lastCompletedToken!==e.lastRequestedToken:false}function Nc(e,t){return e?.lastRequestedToken?Zh(e)?"in-flight":!e.lastCompletedToken||e.lastCompletedToken<t?"dispatch":"idle":"dispatch"}function ey(e,t){return {...e,lastCompletedToken:t,lastCompletionStatus:"success"}}function qc(e,t){return {...e,lastCompletedToken:t,lastCompletionStatus:"failure"}}function Vn(e,t){let r=t.state.tasks,n=t.config.tasks,s=Object.keys(r),o=Fr(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 c=new Map;for(let[f,p]of Object.entries(n))for(let S of p.requires??[]){let b=c.get(S)??[];b.push(f),c.set(S,b);}let u=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 b=S.requires??[],j=S.provides??[],w=Object.keys(p.data??{}).sort(),E=b.filter(x=>t.state.availableOutputs.includes(x)),y=b.filter(x=>!t.state.availableOutputs.includes(x)),v=i.get(f)??y,k=new Set;for(let x of j)for(let P of c.get(x)??[])P!==f&&k.add(P);let R=p.failedAt,$=p.error?{message:p.error,code:"TASK_FAILED",at:R,source:"task-runtime"}:void 0;return {name:f,status:p.status,error:$,requires:b,requires_satisfied:E,requires_missing:y,provides_declared:j,provides_runtime:w,blocked_by:v,unblocks:Array.from(k).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 d=u.map(f=>({name:f.name,fanOut:f.unblocks.length})).sort((f,p)=>p.fanOut-f.fanOut||f.name.localeCompare(p.name)),l=d.length>0?d[0]:{name:null,fanOut:0},m=new Set;for(let f of Object.values(n))for(let p of f.requires??[])m.add(p);let h=0;for(let[f,p]of Object.entries(n)){let S=(p.requires??[]).length===0,j=(p.provides??[]).some(w=>(c.get(w)??[]).some(E=>E!==f));S&&!j&&(h+=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:h,topology:{edge_count:Array.from(m).length,max_fan_out_card:l.name,max_fan_out:l.fanOut}},cards:u}}function ty(){return new Date().toISOString()}function Kc(e,t,r,n,s,o,a){return async i=>{let c=[],u=r.cardStore.readCard(i.nodeId);if(!u)return "task-initiate-failure";let d=u.id,l=u.card_data??{},m=u.source_defs??[],h=m.filter(M=>M.optionalForCompletionGating!==true),f=r.cardRuntimeStore.readRuntime(d),p=false,S=()=>{p&&(r.cardRuntimeStore.writeRuntime(d,f),p=false);},b=M=>Oc(f._sources[M]),j=(M,B)=>{f._sources[M]=Oc(B),p=true;},w=i.taskState?.executionCount??0;if(f._lastExecutionCount!==w&&(f._sources={},f._lastExecutionCount=w,p=true),i.update){let M=i.update,B=M.outputFile;if(B){let te=b(B);if(M.failure){let pe=M.rqt??te.lastRequestedToken??te.queueRequestedToken;pe&&j(B,qc(te,pe));}else {let pe=M.rqt;if(!te.lastCompletedToken||pe>te.lastCompletedToken){let $e=typeof M.deliveryToken=="string"?M.deliveryToken:void 0,tt=false;$e&&(tt=r.fetchedSourcesStore.commitSourceData(d,B,$e)),tt?j(B,ey(te,pe)):j(B,qc(te,pe));}}S();}}let y={};for(let M of m)if(M.outputFile){let B=r.fetchedSourcesStore.readSourceData(d,M.outputFile);B!==null&&(y[M.bindTo]=B);}let v={};for(let[M,B]of Object.entries(i.state??{}))if(B!==null&&typeof B=="object"&&!Array.isArray(B)){let te=B[M];v[M]=te!==void 0?te:B;}else v[M]=B;let k={id:d,card_data:{...l},requires:v,source_defs:m,compute:u.compute};k._sourcesData=y,u.compute&&bt.runSync(k,{sourcesData:y}),(o??r.outputStore.writeComputedValues.bind(r.outputStore))(d,k.computed_values??{});let R={...u},$=bt.enrichSourcesSync(Array.isArray(u.source_defs)?u.source_defs:void 0,{card_data:u.card_data,requires:v}),x=e.value;R.source_defs=Array.isArray($)?$.map(M=>({...M,boardDir:typeof M.boardDir=="string"&&M.boardDir?M.boardDir:x})):$;let P=ty(),D=i.update?void 0:P,q=h.filter(M=>{let B=M.outputFile;if(typeof B!="string"||!B)return true;let te=b(B);D&&(te={...te,queueRequestedToken:D},j(B,te));let pe=te.queueRequestedToken??te.lastRequestedToken??P,$e=Nc(te,pe);return $e==="in-flight"?false:$e==="dispatch"});if(S(),q.length>0){let M=false,B=P;for(let te of q){let pe=te.outputFile;if(typeof pe!="string"||!pe)continue;let $e=b(pe),tt=$e.queueRequestedToken??P;j(pe,{...$e,lastRequestedToken:tt}),B=tt,M=true;}return M&&S(),M&&(c.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:R,callbackToken:i.callbackToken,rqt:B}}),r.executionRequestStore.appendEntries(t,c)),"task-initiated"}if(h.some(M=>{let B=M.outputFile;if(typeof B!="string"||!B)return false;let te=b(B),pe=te.queueRequestedToken??te.lastRequestedToken??P;return Nc(te,pe)==="in-flight"}))return "task-initiated";let fe=u.provides??[],Ce={};for(let{bindTo:M,ref:B}of fe)Ce[M]=bt.resolve(k,B);return (a??r.outputStore.writeDataObjects.bind(r.outputStore))(Ce),m.filter(M=>{if(M.optionalForCompletionGating!==true)return false;let B=b(M.outputFile);return !B.lastRequestedToken||!B.lastCompletedToken?true:B.lastCompletedToken<=B.lastRequestedToken}).length>0&&c.push({taskKind:"source-fetch",payload:{boardRef:oe(e),enrichedCard:R,callbackToken:i.callbackToken,rqt:P}}),n(i.nodeId,Ce),c.length>0&&r.executionRequestStore.appendEntries(t,c),"task-initiated"}}var Bn={settings:{completion:"manual",refreshStrategy:"data-changed"},tasks:{}};function Gc(e){return {[_t]:e.graph,[Mc]:e.lastDrainedJournalId}}function Uc(e){let t=e[_t],r=e[Mc];if(!t||typeof t!="object")throw new Error(`State snapshot is missing required key: ${_t}`);return {graph:t,lastDrainedJournalId:typeof r=="string"?r:""}}function Jc(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 ea(e){function t(o){return {status:"success",data:o}}function r(o){return {status:"fail",error:o}}function n(o){return {status:"error",error:o instanceof Error?o.message:String(o)}}function s(o){if(Array.isArray(o))return o;if(o&&typeof o=="object"){let a=o;return Array.isArray(a.files)?a.files:[o]}return null}return {get(o){try{let a=o.params?.id;if(a){let i=e.readCard(a);return i?t({cards:[i]}):r(`card "${a}" not found`)}return t({cards:e.readAllCards()})}catch(a){return n(a)}},set(o){try{let a=o.body;if(a==null)return r("set requires a body (card object or array of cards)");let i=Array.isArray(a)?a:[a];for(let c of i){if(typeof c.id!="string")return r("each card must have a string `id` field");e.writeCard(c.id,c);}return t({count:i.length})}catch(a){return n(a)}},del(o){try{let a=o.body?.ids??[],i=o.params?.id,c=i?[...a,i]:a;if(c.length===0)return r("del requires body.ids (string[]) or params.id");for(let u of c)e.removeCard(u);return t({count:c.length})}catch(a){return n(a)}},patch(o){try{let a=o.params?.id,i=o.params?.path;if(!a)return r("patch requires params.id");if(!i)return r("patch requires params.path");let c=o.body,u=c&&Object.prototype.hasOwnProperty.call(c,"value")?c.value:o.body;return e.patchCard(a,i,u),t({count:1})}catch(a){return n(a)}},appendFiles(o){try{let a=o.params?.id;if(!a)return r("appendFiles requires params.id");let i=e.readCard(a);if(!i)return r(`card "${a}" not found`);let c=s(o.body);if(!c||c.length===0)return r("appendFiles requires a file metadata object, array, or body.files array");let u=i.card_data&&typeof i.card_data=="object"&&!Array.isArray(i.card_data)?i.card_data:{},d=Array.isArray(u.files)?u.files:[],l=[...d,...c],m=c.map((f,p)=>({idx:d.length+p,entry:f})),h=this.patch({params:{id:a,path:"card_data.files"},body:{value:l}});return h.status!=="success"?h:t({files_added:m})}catch(a){return n(a)}}}}function z(e){return e!==void 0?{status:"success",data:e}:{status:"success"}}function F(e){return {status:"fail",error:e}}function W(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function ry(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 Hc(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 Kn(e){try{let t=JSON.parse(Hc(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function ny(e){return ry(JSON.stringify(e))}function zc(e){try{let t=JSON.parse(Hc(e));return typeof t?.cbk=="string"&&typeof t?.cid=="string"&&typeof t?.b=="string"&&typeof t?.d=="string"?t:null}catch{return null}}function ke(){return new Date().toISOString()}function sy(e,t){let r=t.onWarn??(()=>{}),n=oe(e);function s(C){if(C.length!==0)try{let g=t.publishBoardChangeNotifications?.(C);g&&typeof g.catch=="function"&&g.catch(A=>r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${A instanceof Error?A.message:String(A)}`));}catch(g){r(`[board-live-cards-public] publishBoardChangeNotifications failed: ${g instanceof Error?g.message:String(g)}`);}}function o(){let C=i().readCardStoreRef();if(!C)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let g=t.kvStorageForRef(C);return {readIndex(){return g.read("_index")},writeIndex(A){g.write("_index",A);},readCard(A){return g.read(A)},writeCard(A,N){return g.write(A,N),t.hashFn(N)},removeCard(A){g.delete(A);},cardExists(A){return g.read(A)!==null},defaultCardKey(A){return A}}}let a={readValues(C){let g=t.kvStorage("state-snapshot"),A=g.listKeys().sort();if(A.length===0)return {version:null,values:{}};let N={};for(let H of A)N[H]=g.read(H);return {version:t.hashFn(N),values:N}},writeValues(C,g,A){let N=t.kvStorage("state-snapshot");for(let H of A)N.delete(H);for(let[H,re]of Object.entries(g))N.write(H,re);return t.hashFn(g)}},i=()=>Zo(t.kvStorage("config")),c=()=>Vc(a),u=()=>Fc(t.journalAdapter()),d=()=>Mn(o(),r),l=()=>{let C=i().readOutputsStoreRef();if(!C)throw new Error(`Board at ${e.value} has no outputs store configured. Run: init --outputs-store-ref <b64-ref>`);return Bc(t.kvStorageForRef(C))},m=()=>{let C=i().readArchiveStoreRef();return C?t.archiveFactoryForRef(C):t.archiveFactory()};function h(){return !!c().readSnapshot(e.value).values[_t]}function f(){let C=c().readSnapshot(e.value);if(!C.values[_t])throw new Error(`Board not initialized at ${e.value}`);return Uc(C.values)}function p(C,g){let A=c().commitSnapshot(e.value,{schemaVersion:Mr,expectedVersion:g,commitId:t.genId(),committedAt:ke(),deleteKeys:[],shallowMerge:Gc(C)});if(!A.ok)throw new Error(`Snapshot commit failed (version mismatch): expected=${g??"null"} current=${A.currentVersion??"null"}`)}function S(C){u().appendEvent(C);}async function b(){let C=(I,L)=>{let ae=I.payload,Ke=(ae?.enrichedCard??{}).id??ae?.cardId??"unknown";S({type:"task-failed",taskName:Ke,error:L,timestamp:ke()});},g=Dc(t.kvStorage("execution-requests"),C),A=Lc(t.kvStorage("card-runtime")),N=Ln(t.blobStorage("sources"),I=>t.resolveBlob(I)),H=new Map,re={readRuntime(I){return H.get(I)??A.readRuntime(I)},writeRuntime(I,L){H.set(I,L);}},Ee=[],ce=new Map,je={readSourceData(I,L){let ae=`${I}/${L}`;return ce.has(ae)?ce.get(ae):N.readSourceData(I,L)},ingestSourceDataStaged(I,L,ae,dt){N.ingestSourceDataStaged(I,L,ae,dt);},commitSourceData(I,L,ae){let dt=`${I}/.staged/${ae}/${L}`,Br=t.blobStorage("sources").read(dt);if(Br==null)return false;let Gt=`${I}/${L}`,oa=Br.trim();try{ce.set(Gt,JSON.parse(oa));}catch{ce.set(Gt,oa);}return Ee.push({cardId:I,outputFile:L,deliveryToken:ae}),true},hasSource(I,L){let ae=`${I}/${L}`;return ce.has(ae)?true:N.hasSource(I,L)},listSources(I){let L=N.listSources(I),ae=new Set;for(let Ke of ce.keys())Ke.startsWith(`${I}/`)&&ae.add(Ke.slice(`${I}/`.length));let dt=new Set([...L,...ae]);return Array.from(dt)}},be={cardStore:d(),cardRuntimeStore:re,fetchedSourcesStore:je,outputStore:l(),executionRequestStore:g},Rt=f(),Ct=Fn(Rt.graph),{events:Vt,newCursor:Bt}=u().readEntriesAfterCursor(Rt.lastDrainedJournalId),$t=[],Gn=[],Un=[],Jn=new Map,ra=new Set,ed=(I,L)=>{$t.push({type:"task-completed",taskName:I,data:L,timestamp:ke()});try{m().stream("exec-history").append({taskName:I,status:"completed",completedAt:ke()});}catch{}},na=(I,L)=>{S({type:"task-failed",taskName:I,error:L,timestamp:ke()});try{m().stream("exec-history").append({taskName:I,status:"failed",error:L,completedAt:ke()});}catch{}},Lr=xc(Ct,{handlers:{"card-handler":Kc(e,Bt,be,ed,na,(I,L)=>{Gn.push({cardId:I,values:L});},I=>{Un.push(I);})},onNodeRemoved:I=>{Jn.delete(I),H.delete(I),ra.add(I);}});for($t=Vt;$t.length>0;){let I=$t;$t=[];for(let L of I)if(L.type==="task-restart"){let ae=be.cardStore.readCard(L.taskName);ae&&Jn.set(L.taskName,ae);}Lr.pushAll(I),await Lr.waitForHandlers();}let sa=Lr.getState();await Lr.dispose({wait:true});let td=c().readSnapshot(e.value).version;p({lastDrainedJournalId:Bt,graph:qr(sa)},td);for(let{cardId:I,values:L}of Gn)be.outputStore.writeComputedValues(I,L);for(let I of Un)be.outputStore.writeDataObjects(I);for(let[I,L]of H)A.writeRuntime(I,L);for(let{cardId:I,outputFile:L,deliveryToken:ae}of Ee)N.commitSourceData(I,L,ae);let Vr;try{Vr=Vn(n,sa),be.outputStore.writeStatusSnapshot(Vr);}catch(I){r(`[board-live-cards-public] status publish failed: ${I instanceof Error?I.message:String(I)}`);}let Kt=[];for(let{cardId:I,values:L}of Gn)Kt.push({kind:"computed_values",cardId:I,values:L});for(let I of Un)for(let[L,ae]of Object.entries(I))L&&Kt.push({kind:"data_object",key:L,payload:ae});for(let[I,L]of Jn)Kt.push({kind:"card_refreshed",cardId:I,card:L});for(let I of ra)Kt.push({kind:"card_removed",cardId:I});Vr!==void 0&&Kt.push({kind:"status",status:Vr}),s(Kt);let rd=i().readTaskExecutorRef()??{howToRun:"built-in",whatToRun:oe({kind:"built-in",value:"source-cli-task-executor"})};g.dispatchEntriesForJournalId(Bt,I=>{if(I.taskKind!=="source-fetch"){r(`[process-accumulated-events] unknown taskKind "${I.taskKind}" \u2014 skipping`);return}let L=I.payload,ae=L.enrichedCard?.id??"unknown",dt=L.enrichedCard?.source_defs??[];for(let Ke of dt){if(!Ke.outputFile){r(`[dispatch] source "${Ke.bindTo}" has no outputFile \u2014 skipping`);continue}let Br=ny({cbk:L.callbackToken,rg:e.value,br:oe(e),cid:ae,b:Ke.bindTo,d:Ke.outputFile,cs:void 0,rqt:L.rqt});t.dispatchExecution(rd,{source_def:Ke,base_ref:oe(e),callback:{token:Br,via:t.selfRef}}).catch(Gt=>na(ae,Gt instanceof Error?Gt.message:String(Gt)));}});}async function j(){try{let C=()=>{let A=f(),{events:N}=u().readEntriesAfterCursor(A.lastDrainedJournalId);N.length<=0||(j(),t.requestProcessAccumulated?.());},g=await ia(t.lock,b,C);return z({ran:g!==!1})}catch(C){return W(C)}}function w(){j(),t.requestProcessAccumulated?.();}function E(C){try{let g=C.params?.cardStoreRef;if(!g)return F("init requires params.cardStoreRef \u2014 create a card store with card-store-cli and pass its ref here");if(!h()){let be=qn(Bn);p({lastDrainedJournalId:"",graph:qr(be)},null);}let A=C.params?.outputsStoreRef;if(!A)return F("init requires params.outputsStoreRef \u2014 pass the outputs store ref here");let N=C.params?.scratchStoreRef,H=C.params?.archiveStoreRef,re=C.params?.chatStoreRef,Ee=C.params?.artifactsStoreRef,ce=i();ce.writeCardStoreRef(g),ce.writeOutputsStoreRef(A),N&&ce.writeScratchStoreRef(N),H&&ce.writeArchiveStoreRef(H),re&&ce.writeChatStoreRef(re),Ee&&ce.writeArtifactsStoreRef(Ee);let je=C.body??{};je["task-executor-ref"]&&ce.writeTaskExecutorRef(je["task-executor-ref"]),Object.prototype.hasOwnProperty.call(je,"chat-handler-flow")&&ce.writeChatHandlerFlow(je["chat-handler-flow"]);try{l().writeStatusSnapshot(Vn(n,Fn(f().graph)));}catch{}return z()}catch(g){return W(g)}}function y(C){try{let g=l().readStatusSnapshot();if(!g){g=Vn(n,Fn(f().graph));try{l().writeStatusSnapshot(g);}catch{}}return z(g)}catch(g){return W(g)}}function v(C){try{let g=C.params?.id;return g?(S({type:"task-removal",taskName:g,timestamp:ke()}),w(),z()):F("removeCard requires params.id")}catch(g){return W(g)}}function k(C){try{let g=C.params?.cardId;if(!g)return F("addCardFiles requires params.cardId");let A=ea(d()).appendFiles({params:{id:g},body:C.body});if(A.status!=="success")return A;let N=R({params:{cardId:g}});return N.status!=="success"?N:z({cardId:g,files_added:A.data.files_added,notified:!0})}catch(g){return W(g)}}function R(C){try{let g=C.params?.cardId;if(!g)return F("cardRefreshedNotify requires params.cardId");let A=d().readCard(g);return A?(s([{kind:"card_refreshed",cardId:g,card:A}]),z({cardId:g,notified:!0})):F(`Card "${g}" not found in board at ${e.value}`)}catch(g){return W(g)}}function $(C){try{let g=C.params?.id;return g?(S({type:"task-restart",taskName:g,timestamp:ke()}),w(),z()):F("retrigger requires params.id")}catch(g){return W(g)}}async function x(C){return j()}function P(C){try{let g=C.params?.cardId,A=C.params?.all,N=!!C.params?.restart;if(!g&&!A)return F("upsertCard requires --card-id <id> or --all");let H=A?d().readAllCards().map(re=>re.id):[g];for(let re of H)if(!d().readCard(re))return F(`Card "${re}" not found in board at ${e.value}`);for(let re of H){let Ee=d().readCard(re),ce=Jc(Ee),je=t.hashFn(ce),be=t.kvStorage("card-upsert"),Rt=be.read(re),Ct=Rt?.taskConfigHash!==je;if(!(!Ct&&!N)){if(Ct){let Vt=Rt?.blobRef??d().readCardKey(re)??re;S({type:"task-upsert",taskName:re,taskConfig:ce,timestamp:ke()}),be.write(re,{blobRef:Vt,taskConfigHash:je,updatedAt:ke()});}N&&S({type:"task-restart",taskName:re,timestamp:ke()});}}return w(),z()}catch(g){return W(g)}}function D(C){try{let g=C.params?.token;if(!g)return F("taskFailed requires params.token");let A=C.params?.error??"unknown error",N=Kn(g);if(!N)return F("Invalid callback token");S({type:"task-failed",taskName:N.taskName,error:A,timestamp:ke()});try{m().stream("exec-history").append({taskName:N.taskName,status:"failed",error:A,completedAt:ke()});}catch{}return w(),z()}catch(g){return W(g)}}function q(C){try{let g=C.params?.token;if(!g)return F("taskProgress requires params.token");let N=(C.body??{}).update??{},H=Kn(g);return H?(S({type:"task-progress",taskName:H.taskName,update:N,timestamp:ke()}),w(),z()):F("Invalid callback token")}catch(g){return W(g)}}function de(C){try{let g=C.params?.token,A=C.params?.ref;if(!g)return F("sourceDataFetched requires params.token");if(!A)return F("sourceDataFetched requires params.ref");let N=zc(g);if(!N)return F("Invalid source token");let{cbk:H,cid:re,b:Ee,d:ce,cs:je,rqt:be}=N,Rt=Ln(t.blobStorage("sources"),$t=>t.resolveBlob($t)),Ct=t.genId();Rt.ingestSourceDataStaged(re,ce,Ge(A),Ct);let Vt=Kn(H);if(!Vt)return F("Invalid callback token embedded in source token");let Bt=ke();return S({type:"task-progress",taskName:Vt.taskName,update:{bindTo:Ee,outputFile:ce,fetchedAt:Bt,deliveryToken:Ct,sourceChecksum:je,rqt:be},timestamp:Bt}),w(),z()}catch(g){return W(g)}}function fe(C){try{let g=C.params?.token,A=C.params?.reason??"unknown";if(!g)return F("sourceDataFetchFailure requires params.token");let N=zc(g);if(!N)return F("Invalid source token");let{cbk:H,b:re,d:Ee,cs:ce,rqt:je}=N,be=Kn(H);return be?(S({type:"task-progress",taskName:be.taskName,update:{bindTo:re,outputFile:Ee,failure:!0,reason:A,sourceChecksum:ce,rqt:je},timestamp:ke()}),w(),z()):F("Invalid callback token embedded in source token")}catch(g){return W(g)}}function Ce(C){try{let g=i().readCardStoreRef();return g?z({storeRef:g}):F(`Board at ${e.value} has no card store configured`)}catch(g){return W(g)}}function Ne(C){try{let g=i().readOutputsStoreRef();return g?z({storeRef:g}):F(`Board at ${e.value} has no outputs store configured`)}catch(g){return W(g)}}function M(C){try{let g=i().readScratchStoreRef();return z({storeRef:g})}catch(g){return W(g)}}function B(C){try{let g=i().readArchiveStoreRef();return z({storeRef:g})}catch(g){return W(g)}}function te(C){try{let g=i().readChatStoreRef();return z({storeRef:g})}catch(g){return W(g)}}function pe(C){try{let g=i().readArtifactsStoreRef();return z({storeRef:g})}catch(g){return W(g)}}function $e(C){try{let g=C.params?.key;if(!g)return F("getConfig requires params.key");let A=i(),N;switch(g){case "task-executor":N=A.readTaskExecutorRef()??null;break;case "chat-handler-flow":N=A.readChatHandlerFlow()??null;break;case "card-store-ref":N=A.readCardStoreRef();break;case "outputs-store-ref":N=A.readOutputsStoreRef();break;case "scratch-store-ref":N=A.readScratchStoreRef();break;case "archive-store-ref":N=A.readArchiveStoreRef();break;case "chat-store-ref":N=A.readChatStoreRef();break;case "artifacts-store-ref":N=A.readArtifactsStoreRef();break;default:return F(`getConfig: unknown key "${g}"`)}return z({value:N})}catch(g){return W(g)}}function tt(C){try{let g=C.params?.key;if(!g)return F("getOutputsDataObject requires params.key");let A=l().readDataObject(g);return z(A)}catch(g){return W(g)}}function we(C){try{return z(l().readAllDataObjects())}catch(g){return W(g)}}function qe(C){try{let g=C.params?.key;if(!g)return F("getOutputsComputedValues requires params.key");let A=l().readComputedValues(g);return z(A)}catch(g){return W(g)}}function ut(C){try{return z(l().readAllComputedValues())}catch(g){return W(g)}}function ct(){return Ln(t.blobStorage("sources"),C=>t.resolveBlob(C))}function Mt(C){let g=t.blobStorage("sources").keyRef?.(C);return g?oe(g):C}function Lt(C){try{let g=C.params?.key;if(!g)return F("getOutputsFetchedSources requires params.key");let A=ct().listSources(g),N={};for(let H of A)N[H]=Mt(`${g}/${H}`);return z(N)}catch(g){return W(g)}}function Zc(C){try{let g=ct(),A=new Set;for(let H of t.blobStorage("sources").listKeys()){let re=H.indexOf("/");re>0&&!H.includes("/.staged/")&&A.add(H.slice(0,re));}let N={};for(let H of A){let re=g.listSources(H);if(re.length>0){N[H]={};for(let Ee of re)N[H][Ee]=Mt(`${H}/${Ee}`);}}return z(N)}catch(g){return W(g)}}return {init:E,status:y,getCardStoreRef:Ce,getOutputsStoreRef:Ne,getScratchStoreRef:M,getArchiveStoreRef:B,getChatStoreRef:te,getArtifactsStoreRef:pe,getConfig:$e,getOutputsDataObject:tt,getAllOutputsDataObjects:we,getOutputsComputedValues:qe,getAllOutputsComputedValues:ut,getOutputsFetchedSources:Lt,getAllOutputsFetchedSources:Zc,removeCard:v,addCardFiles:k,cardRefreshedNotify:R,retrigger:$,processAccumulatedEvents:x,upsertCard:P,taskFailed:D,taskProgress:q,sourceDataFetched:de,sourceDataFetchFailure:fe}}function oy(e,t){let r=()=>Zo(t.kvStorage("config"));function n(){let y=r().readCardStoreRef();if(!y)throw new Error(`Board at ${e.value} has no card store configured. Run: init --base-ref <ref> --store-ref <b64-ref>`);let v=t.kvStorageForRef(y);return {readIndex(){return v.read("_index")},writeIndex(k){v.write("_index",k);},readCard(k){return v.read(k)},writeCard(k,R){return v.write(k,R),t.hashFn(R)},removeCard(k){v.delete(k);},cardExists(k){return v.read(k)!==null},defaultCardKey(k){return k}}}let s=()=>Mn(n(),t.onWarn??(()=>{})),o=()=>{let y=r().readScratchStoreRef();return y?t.scratchStorageForRef(y):t.scratchStorage()};function a(y,v){let k=t.validateSchema(v),R=[],$=r().readTaskExecutorRef();if($&&Array.isArray(v.source_defs))for(let P of v.source_defs){let D=typeof P.bindTo=="string"?P.bindTo:"(unknown)";try{let q;try{q=t.invokeExecutorSync($,"validate-source-def",[],{timeout:t.executorTimeouts?.validationMs??1e4,input:JSON.stringify(P)});}catch(fe){let Ce=fe;if(q=typeof Ce?.stdout=="string"?Ce.stdout:"",!q.trim()){R.push(`source "${D}": executor validate-source-def failed \u2014 ${fe instanceof Error?fe.message:String(fe)}`);continue}}let de=JSON.parse(q.trim());if(!de.ok&&Array.isArray(de.errors))for(let fe of de.errors)R.push(`source "${D}": ${fe}`);}catch(q){R.push(`source "${D}": executor validate-source-def failed \u2014 ${q instanceof Error?q.message:String(q)}`);}}let x=[...k.errors,...R];return z({cardId:y,isValid:x.length===0,issues:x})}function i(y,v){let k=r().readTaskExecutorRef();if(!k)throw new Error("No task-executor registered for this board");let R=typeof y.bindTo=="string"?y.bindTo:"source",$=o(),x={...y,boardDir:e.value,_projections:v},P=$.create(JSON.stringify(x,null,2),`probe-in-${R}`,".json"),D=$.getUniqueKey(`probe-out-${R}`,".json"),q=$.getUniqueKey(`probe-err-${R}`,".txt"),de=oe($.keyRef(P)),fe=oe($.keyRef(D)),Ce=oe($.keyRef(q)),Ne=null;try{if(t.invokeExecutorSync(k,"run-source-fetch",["--in-ref",de,"--out-ref",fe,"--err-ref",Ce],{timeout:y.timeout??t.executorTimeouts?.probeMs??6e4}),Ne=$.read(D),Ne===null)throw new Error("Executor produced no output file")}catch(M){let B=$.read(q)?.trim()??(M instanceof Error?M.message:String(M));throw new Error(`Probe failed: ${B}`)}finally{try{$.remove(P);}catch{}try{$.remove(q);}catch{}}return {bindTo:R,result:Ne}}function c(y,v,k){let R;try{R=i(y,v);}catch($){return F($ instanceof Error?$.message:String($))}if(k){let $=Ge(k);t.absoluteBlob.write($.value,R.result);}return z({bindTo:R.bindTo,resultSizeBytes:R.result.length})}function u(y,v){let k=y.params?.sourceIdx,R=y.params?.outRef;if(k===void 0)return F(`${v} requires params.sourceIdx`);if(!y.body||typeof y.body!="object"||Array.isArray(y.body))return F(`${v} requires card JSON object in body`);let $=y.body,x=$["card-content"]??$,P=$["mock-projections"]??{},D=x.source_defs??[];if(k<0||k>=D.length)return F(`sourceIdx ${k} out of range (card has ${D.length} source(s))`);let q=D[k],de=typeof q.bindTo=="string"?q.bindTo:"source";return {src:q,bindTo:de,outRef:R,mockProjections:P}}function d(y){try{let v=y.params?.cardId,k=y.params?.all;if(!v&&!k)return F("validateCard requires --card-id <id> or --all");let R=k?s().readAllCards().map(x=>x.id):[v],$=[];for(let x of R){let P=s().readCard(x);if(!P){$.push({cardId:x,isValid:!1,issues:[`Card "${x}" not found`]});continue}let D=a(x,P);if(D.status!=="success")return D;$.push(D.data);}return z($)}catch(v){return W(v)}}function l(y){try{if(!y.body||typeof y.body!="object"||Array.isArray(y.body))return F("validateCardPreflight requires card JSON object in body");let v=y.body,k=v["card-content"]??v,R=typeof k.id=="string"?k.id:"(unknown)",$=a(R,k),x=r().readTaskExecutorRef();if(x)try{let P=t.invokeExecutorSync(x,"validate-card-preflight",[],{timeout:t.executorTimeouts?.validationMs??1e4,input:JSON.stringify(k)}),D=JSON.parse(P.trim());if(!D.ok&&Array.isArray(D.errors)&&D.errors.length>0){let q=[...$.status==="success"?$.data.issues:[],...D.errors];return z({cardId:R,isValid:!1,issues:q})}}catch{}return $}catch(v){return W(v)}}function m(y){try{let v=y.params?.cardId,k=y.params?.sourceIdx,R=y.params?.outRef;if(!v)return F("probeSource requires params.cardId");if(k===void 0)return F("probeSource requires params.sourceIdx");let x=(y.body??{})["mock-projections"]??{},P=s().readCard(v);if(!P)return F(`Card "${v}" not found`);let D=P.source_defs??[];return k<0||k>=D.length?F(`sourceIdx ${k} out of range (card has ${D.length} source(s))`):c(D[k],x,R)}catch(v){return W(v)}}function h(y){try{let v=y.params?.outRef,k=y.body;if(!k)return F('probeTmpSource requires body with "source-def" and "mock-projections"');let R=k["source-def"],$=k["mock-projections"]??{};return R?c(R,$,v):F('probeTmpSource body requires "source-def"')}catch(v){return W(v)}}function f(y){try{let v=u(y,"probeSourcePreflight");if("status"in v)return v;let k=r().readTaskExecutorRef();if(!k)return F("No task-executor registered for this board");try{let R={...v.src,_projections:v.mockProjections},$=t.invokeExecutorSync(k,"probe-source-preflight",[],{timeout:v.src.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify(R)}),x=JSON.parse($.trim());return x.ok?z({bindTo:v.bindTo,reachable:x.reachable,latencyMs:x.latencyMs,note:x.note}):F(x.error??"Preflight probe failed")}catch{return F("Executor does not support probe-source-preflight")}}catch(v){return W(v)}}function p(y){try{let v=u(y,"runSourcePreflight");if("status"in v)return v;let k=r().readTaskExecutorRef();if(k)try{let P={...v.src,_projections:v.mockProjections},D=t.invokeExecutorSync(k,"run-source-preflight",[],{timeout:v.src.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify(P)}),q=JSON.parse(D.trim());return q.ok?z({bindTo:q.bindTo??v.bindTo,reachable:q.reachable,latencyMs:q.latencyMs,kind:q.kind,resultValue:q.resultValue,note:q.note}):F(q.error??"Source preflight failed")}catch{}let R=Date.now(),$=i(v.src,v.mockProjections);if(v.outRef){let P=Ge(v.outRef);t.absoluteBlob.write(P.value,$.result);}let x=$.result;try{x=JSON.parse($.result);}catch{}return z({bindTo:$.bindTo,reachable:!0,latencyMs:Date.now()-R,resultValue:x,note:"Actual fetch preflight passed"})}catch(v){return W(v)}}function S(y){try{let v=r().readTaskExecutorRef();if(!v)return F("No task-executor registered for this board");let k=t.invokeExecutorSync(v,"describe-capabilities",[],{timeout:t.executorTimeouts?.describeMs??1e4});return z(JSON.parse(k.trim()))}catch(v){return W(v)}}function b(y){try{let v=y.body;if(!v||!Array.isArray(v.ops))return F("updatesInCardStore requires body.ops array");let k=v.ops,R=s();for(let $ of k){let x=$.op,P=$.id;if(!P)return F('op is missing "id"');if(x==="update"){let D=$["card-content"];if(!D)return F(`update op for "${P}" is missing "card-content"`);R.writeCard(P,D);}else return F(`Unknown op type: "${x??"(none)"}"`)}return z()}catch(v){return W(v)}}function j(y){try{let v=y.body;if(!v||!Array.isArray(v.ids))return F("readFromCardStore requires body.ids array");let k=v.ids,R=s(),$=k.map(x=>({id:x,"card-content":R.readCard(x)}));return z({cards:$})}catch(v){return W(v)}}function w(y){try{if(!y.body||typeof y.body!="object"||Array.isArray(y.body))return F("evalCardCompute requires a JSON object in body");let v=y.body,k=v["card-content"]??v,R=typeof k.id=="string"?k.id:"(unknown)",$=v["mock-fetched-sources"]??{},x=v["mock-requires"]??{},P=k.compute;if(!P||!Array.isArray(P)||P.length===0)return z({cardId:R,ok:!0,computed_values:{},errors:[]});let D={id:R,card_data:k.card_data??{},requires:x,source_defs:k.source_defs,compute:P},q=bt.runSync(D,{sourcesData:$}),de=q.node.computed_values??{},fe=q.errors??[];return z({cardId:R,ok:fe.length===0,computed_values:de,errors:fe})}catch(v){return W(v)}}function E(y){try{if(!y.body||typeof y.body!="object"||Array.isArray(y.body))return F("simulateCardCycle requires a JSON object in body");let v=y.body,k=v["card-content"]??v,R=typeof k.id=="string"?k.id:"(unknown)",$=v["mock-fetched-sources"]??{},x=v["mock-requires"]??{},P=a(R,k),D=P.status==="success"?{isValid:P.data.isValid,issues:P.data.issues}:{isValid:!1,issues:[P.status==="fail"?P.error:"internal error"]},q=k.source_defs??[],de=k.card_data??{},fe=[],Ce=[];if(q.length>0){fe=bt.enrichSourcesSync(q,{card_data:de,requires:x});for(let we of fe){let qe=we.projections,ut=we._projections;if(qe&&ut){for(let ct of Object.keys(qe))if(ut[ct]===void 0){let Mt=typeof we.bindTo=="string"?we.bindTo:"(unknown)";Ce.push({bindTo:Mt,key:ct,error:`Projection "${ct}" resolved to undefined`});}}}}let Ne=[],M=v["task-executor-ref"],B=(M?.howToRun&&M?.whatToRun?M:void 0)??r().readTaskExecutorRef();for(let we=0;we<fe.length;we++){let qe=fe[we],ut=typeof qe.bindTo=="string"?qe.bindTo:`source_${we}`;if(!B){Ne.push({bindTo:ut,skipped:!0,error:"No task executor configured"});continue}try{let ct={...qe},Mt=t.invokeExecutorSync(B,"run-source-preflight",[],{timeout:qe.timeout??t.executorTimeouts?.preflightMs??6e4,input:JSON.stringify(ct)}),Lt=JSON.parse(Mt.trim());Ne.push({bindTo:ut,reachable:Lt.reachable,latencyMs:Lt.latencyMs,error:Lt.ok?void 0:Lt.error});}catch{Ne.push({bindTo:ut,skipped:!0,error:"Executor does not support run-source-preflight"});}}let te=k.compute,pe={},$e=[];if(te&&Array.isArray(te)&&te.length>0){let we={id:R,card_data:de,requires:x,source_defs:k.source_defs,compute:te},qe=bt.runSync(we,{sourcesData:$});pe=qe.node.computed_values??{},$e=qe.errors??[];}let tt=D.isValid&&Ce.length===0&&$e.length===0&&Ne.every(we=>we.reachable!==!1);return z({cardId:R,ok:tt,validation:D,source_probes:Ne,projection_errors:Ce,computed_values:pe,compute_errors:$e})}catch(v){return W(v)}}return {validateCard:d,validateCardPreflight:l,probeSource:m,probeTmpSource:h,probeSourcePreflight:f,runSourcePreflight:p,evalCardCompute:w,simulateCardCycle:E,describeTaskExecutorCapabilities:S,updatesInCardStore:b,readFromCardStore:j}}function ay(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 c=i.bytes,u=new Uint8Array(c.map(d=>Math.max(0,Math.min(255,Number(d)||0))));return t({artifact:e.putBytes(o,u,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 u=e.getText(o);return u===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,text:u})}let c=e.getBytes(o);return c===null?r(`artifact "${o}" not found`):t({key:o,contentType:i.contentType,size:i.size,bytes:[...c]})}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)}}}}function Wc(){return new Date().toISOString()}function Yc(e){return new TextEncoder().encode(e).byteLength}function iy(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function uy(e){let t=String(e||"").match(/^(\d+)[-_]/);return t?parseInt(t[1],10):0}function cy(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 dy(e){return String(e||"").toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"")||"file"}function ly(e){if(!e||e===".")return "";let t=String(e).replace(/^\./,"").toLowerCase().replace(/[^a-z0-9]/g,"");return t?`.${t}`:""}function fy(e){let t=cy(e),r=t.lastIndexOf(".");return r<=0||r===t.length-1?{stem:t,ext:""}:{stem:t.slice(0,r),ext:t.slice(r)}}function py(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function ta(e){function t(r){let n=e.stat?iy(e.stat(r)):null;if(n)return n;if(!e.exists(r))return null;let s=e.read(r);return s===null?{key:r}:{key:r,size:Yc(s)}}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};return o.contentType=s,o.updatedAt=o.updatedAt??Wc(),o.size=o.size??Yc(n),o},putBytes(r,n,s="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,n);else {let a=JSON.stringify({__kind:"bytes-array",data:[...n]});e.write(r,a);}let o=t(r)??{key:r};return o.contentType=s,o.updatedAt=o.updatedAt??Wc(),o.size=o.size??n.byteLength,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=""){return e.listKeys(r).map(n=>t(n)??{key:n}).sort((n,s)=>n.key.localeCompare(s.key))},remove(r){e.remove(r);}}}function my(e){function t(s,o){let a=0,i=[];Array.isArray(o)&&i.push(...o);for(let c of e.list(`${s}/`))i.push(py(c.key));for(let c of i){let u=uy(c);Number.isFinite(u)&&u>a&&(a=u);}return a+1}function r(s,o,a){let i=Number(a?.maxLen||32),{stem:c,ext:u}=fy(s),d=ly(u),l=dy(c),m=`${String(o).padStart(3,"0")}-`,h=d,f=i-m.length-h.length;f<1&&(h="",f=i-m.length);let p=l.slice(0,Math.max(1,f)),S=`${m}${p}${h}`;return S.length>i&&(S=S.slice(0,i).replace(/\.$/,"")),S}function n(s,o,a){let i=t(s,a?.seedNames),c=r(o,i,{maxLen:a?.maxLen});for(;e.exists(`${s}/${c}`);)i+=1,c=r(o,i,{maxLen:a?.maxLen});return c}return {nextSerial:t,buildStoredName:r,allocateStoredName:n}}function gy(){function e(s,o){if(!Array.isArray(s))return [];let a=[];for(let i of s){if(!i||typeof i!="object")continue;let c=i;typeof c.stored_name=="string"&&a.push({name:typeof c.name=="string"?c.name:c.stored_name,stored_name:c.stored_name,size:typeof c.size=="number"&&Number.isFinite(c.size)?c.size:null,mime_type:typeof c.mime_type=="string"?c.mime_type:null,uploaded_at:typeof c.uploaded_at=="string"?c.uploaded_at:o||null,chat:c.chat===true});}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(c=>c.stored_name));for(let c of o)i.has(c.stored_name)||(a.push(c),i.add(c.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 c=i[o];return !c||!c.stored_name?{ok:false,reason:"missing_stored_name"}:a&&a!==c.stored_name?{ok:false,reason:"stale_reference"}:{ok:true,file:c}}return {read:t,normalizeIncoming:e,merge:r,resolve:n}}function ck(){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;r=Je(o);}catch{r="";}if(!r)return {dispatched:false,error:"createNodeSpawnInvocationAdapter: could not resolve executable path from whatToRun"};let n={...t},s=Buffer.from(JSON.stringify(n)).toString("base64");try{return 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;t=Je(r);}catch{t="";}if(!t)return null;try{let r=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 vy=".board.lock";function Xc(e,t){if(!e||!t)return false;let r=String(e).replace(/[\\/]+$/,"").split(/[\\/]+/).filter(Boolean);return r.length>0&&r[r.length-1]===t}function Sy(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function ky(e,t){return typeof e=="string"?{cliDir:e,opts:t}:{cliDir:void 0,opts:e}}function Qc(e){if(e)return e;let t=pa(import.meta.url),r=[t,xe(t,"..","cli","node"),xe(t,"..","..","cli","node")];for(let n of r)try{return Xn(n),n}catch{}throw new Error(`createFsBoardPlatformAdapter: could not resolve a public CLI directory from module dir ${t}`)}function wy(e,t,r){let{cliDir:n,opts:s}=Sy(t,r),o=Qc(n),a=e.value,c={meta:"board-live-cards",howToRun:"local-node",whatToRun:(s?.suppressSpawn?"":Xn(o))?oe({kind:"yaml-flow-cli",value:"board-live-cards-cli.js"}):"",...s?.notifyChannel?{extra:{notifyChannel:s.notifyChannel}}:{}};return {kvStorage:u=>Qr(xe(a,`.${u}`)),blobStorage:u=>u?Ut(xe(a,u)):Ut(a),scratchStorage:()=>Yr(xe(a,".tmp")),scratchStorageForRef:u=>Yr(Ge(u).value),archiveFactory:()=>Xr(xe(a,"archive")),archiveFactoryForRef:u=>Xr(Ge(u).value),journalAdapter:()=>Ia(a),lock:Pa(xe(a,vy)),selfRef:c,async dispatchExecution(u,d){if(s?.suppressSpawn)return {dispatched:false};try{let l=d.source_def?.bindTo??Hn().slice(0,8),m=Yr(xe(a,".tmp")),h=m.create(JSON.stringify(d,null,2),`exec-in-${l}`,".json"),f=m.getUniqueKey(`exec-out-${l}`,".json"),p=m.getUniqueKey(`exec-err-${l}`,".txt"),S=oe(m.keyRef(h)),b=oe(m.keyRef(f)),j=oe(m.keyRef(p));return Ea(u,{subcommand:"run-source-fetch",inRef:S,outRef:b,errRef:j},o),{dispatched:!0}}catch(l){let m=l instanceof Error?l.message:String(l);try{let h=Xr(xe(a,"archive")),f=new Date().toISOString().replace(/[:.]/g,"-"),p=d.source_def?.bindTo??"unknown";h.blob("exec-failures").write(`${f}-${p}.json`,JSON.stringify({error:m,args:d,ref:u,at:new Date().toISOString()},null,2));}catch{}return {dispatched:false,error:m}}},resolveBlob(u){let d=la(u.value)?ss().read(u.value):Ut(a).read(u.value);if(d===null)throw new Error(`resolveBlob: blob not found: ::${u.kind}::${u.value}`);return d},hashFn:Ta,genId:()=>fa(`${Date.now()}-${Math.random()}`).slice(0,32),kvStorageForRef:u=>Qr(Ge(u).value),requestProcessAccumulated(){s?.suppressSpawn||ha(o,e,s?.notifyChannel);},publishBoardChangeNotifications(u){if(!s?.notifyChannel||u.length===0)return;let d=u.map(l=>({id:Hn(),ts:new Date().toISOString(),boardRef:oe(e),notification:l}));ya(s.notifyChannel,d,s.onWarn);},onWarn:s?.onWarn}}function dk(e,t,r){let{cliDir:n,opts:s}=ky(t,r),o=Qc(n),a=wy(e,o,s),i=Jr();return {...a,invokeExecutorSync(c,u,d,l){let{command:m,baseArgs:h}=zr(c,o),f=c.extra?["--extra",Buffer.from(JSON.stringify(c.extra)).toString("base64")]:[];return i.executeSync(m,[...h,u,...d,...f],{timeout:l?.timeout??3e4,encoding:"utf-8",input:l?.input})},validateSchema(c){let u=Jo(c);return {ok:u.errors.length===0,errors:u.errors}},absoluteBlob:ss()}}function lk(e,t={}){let r=t.chatsSubdir??"chats",n=t.kvSubdir??".kv",s=n?[n,"chat"]:["chat"],o=r&&!Xc(e,r)?xe(e,r):e,a=Qr(xe(e,...s));return zo(i=>{let u=`${String(i).replace(/[^a-zA-Z0-9_-]/g,"_")}.jsonl`,d=xe(o,u);return os(d)},a)}function fk(e,t={}){let r=t.filesSubdir??"files",n=r&&!Xc(e,r)?xe(e,r):e;return ta(Ut(n))}function pk(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString());return typeof t.br=="string"?t.br:null}catch{return null}}
|
|
19
|
+
export{_t as BOARD_GRAPH_KEY,Bn as EMPTY_CONFIG,Mr as SNAPSHOT_SCHEMA_VERSION_V1,zr as buildLocalBaseSpec,ta as createArtifactsStore,ay as createArtifactsStorePublic,oy as createBoardLiveCardsNonCorePublic,sy as createBoardLiveCardsPublic,gy as createCardFileMetadataStore,Mn as createCardStore,ea as createCardStorePublic,zo as createChatStorage,Od as createExecutionRefInvoker,my as createFileArtifactsStore,lk as createFsBoardChatStorage,fk as createFsBoardFileArtifactsStore,dk as createFsBoardNonCorePlatformAdapter,wy as createFsBoardPlatformAdapter,Eh as createInMemoryChatStorage,ck as createNodeSpawnInvocationAdapter,pk as decodeBoardRefFromToken,Zn as evaluateArgsMassaging,Xh as executionRefFromScriptPath,$a as invokeExecutionRef,es as invokeExecutionRefSync,Nd as invokeRefSync,Qo as parseExecutionRef,Ge as parseRef,Je as resolveWhatToRunValue,wa as resolveYamlFlowCliPath,Xo as serializeExecutionRef,oe as serializeRef};//# sourceMappingURL=board-live-cards-node.js.map
|
|
20
20
|
//# sourceMappingURL=board-live-cards-node.js.map
|