claudius-core 0.9.0 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/manager.md +13 -3
- package/.claude/agents/worker.md +27 -50
- package/.claude/rules/testing.md +4 -7
- package/.claude/scripts/merge-pr.sh +24 -55
- package/.claude/scripts/project-status.sh +67 -0
- package/.claude/skills/build/SKILL.md +17 -3
- package/.claude-plugin/marketplace.json +2 -2
- package/dist/config-migrations.js +1 -1
- package/dist/config-migrations.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/daemon/ideation.d.ts.map +1 -1
- package/dist/daemon/ideation.js +11 -48
- package/dist/daemon/ideation.js.map +1 -1
- package/dist/daemon/pulse-state.d.ts +59 -0
- package/dist/daemon/pulse-state.d.ts.map +1 -0
- package/dist/daemon/pulse-state.js +122 -0
- package/dist/daemon/pulse-state.js.map +1 -0
- package/dist/daemon/pulse.js +2 -2
- package/dist/daemon/pulse.js.map +1 -1
- package/dist/lib/github.d.ts +36 -0
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +72 -3
- package/dist/lib/github.js.map +1 -1
- package/dist/studio/assets/{_basePickBy-B-dYIPO9.js → _basePickBy-CaRVkU_i.js} +1 -1
- package/dist/studio/assets/{_baseUniq-DtSwUsWb.js → _baseUniq-DB9CANVr.js} +1 -1
- package/dist/studio/assets/{arc-BSHCxjoI.js → arc-DwNKwVLD.js} +1 -1
- package/dist/studio/assets/{architectureDiagram-VXUJARFQ-HuyB70lr.js → architectureDiagram-VXUJARFQ-CDW4khKr.js} +1 -1
- package/dist/studio/assets/{blockDiagram-VD42YOAC-B9HUfXTF.js → blockDiagram-VD42YOAC-D6_LSve2.js} +1 -1
- package/dist/studio/assets/{c4Diagram-YG6GDRKO-CZkxr6sB.js → c4Diagram-YG6GDRKO-SFPE64AJ.js} +1 -1
- package/dist/studio/assets/channel-h6J62PW8.js +1 -0
- package/dist/studio/assets/{chunk-4BX2VUAB-DN6HQi6o.js → chunk-4BX2VUAB-BqHoEHlQ.js} +1 -1
- package/dist/studio/assets/{chunk-55IACEB6-BisQl6jn.js → chunk-55IACEB6-DkHQ5WBd.js} +1 -1
- package/dist/studio/assets/{chunk-B4BG7PRW-Bdix9s7H.js → chunk-B4BG7PRW-CW_kq6KT.js} +1 -1
- package/dist/studio/assets/{chunk-DI55MBZ5-DAIoIssd.js → chunk-DI55MBZ5-DNDwEGQ5.js} +1 -1
- package/dist/studio/assets/{chunk-FMBD7UC4-DNH4o1Hu.js → chunk-FMBD7UC4-5PX-ftxQ.js} +1 -1
- package/dist/studio/assets/{chunk-QN33PNHL-B22BHIBA.js → chunk-QN33PNHL-QkQfQaqN.js} +1 -1
- package/dist/studio/assets/{chunk-QZHKN3VN-7BKcU0AB.js → chunk-QZHKN3VN-Do2RvhJA.js} +1 -1
- package/dist/studio/assets/{chunk-TZMSLE5B-BNK-Y8sm.js → chunk-TZMSLE5B-xiebau4j.js} +1 -1
- package/dist/studio/assets/classDiagram-2ON5EDUG-D8lIj2-P.js +1 -0
- package/dist/studio/assets/classDiagram-v2-WZHVMYZB-D8lIj2-P.js +1 -0
- package/dist/studio/assets/clone-Chwjzlof.js +1 -0
- package/dist/studio/assets/{cose-bilkent-S5V4N54A-C1h3-66S.js → cose-bilkent-S5V4N54A-Apnpf-ki.js} +1 -1
- package/dist/studio/assets/{dagre-6UL2VRFP-ua8g2h-7.js → dagre-6UL2VRFP-BxyPIzB8.js} +1 -1
- package/dist/studio/assets/{diagram-PSM6KHXK-B64zbYxC.js → diagram-PSM6KHXK-24YoaI-e.js} +1 -1
- package/dist/studio/assets/{diagram-QEK2KX5R-KdhA98u6.js → diagram-QEK2KX5R-lHpdi46q.js} +1 -1
- package/dist/studio/assets/{diagram-S2PKOQOG-DALWb6Tg.js → diagram-S2PKOQOG-9u1_ee6B.js} +1 -1
- package/dist/studio/assets/{erDiagram-Q2GNP2WA-CadgQK9g.js → erDiagram-Q2GNP2WA-Dlmgb2ym.js} +1 -1
- package/dist/studio/assets/{flowDiagram-NV44I4VS-DO4RmSUY.js → flowDiagram-NV44I4VS-5sj_GCzk.js} +1 -1
- package/dist/studio/assets/{ganttDiagram-JELNMOA3-Cxb9OlHt.js → ganttDiagram-JELNMOA3-CUJF-slV.js} +1 -1
- package/dist/studio/assets/{gitGraphDiagram-V2S2FVAM-otm97EPi.js → gitGraphDiagram-V2S2FVAM-CKpDBk3b.js} +1 -1
- package/dist/studio/assets/{graph-5oKS2LK4.js → graph-BRYklN25.js} +1 -1
- package/dist/studio/assets/{index-DU1UoE3B.js → index-WEgtt1oI.js} +2 -2
- package/dist/studio/assets/{infoDiagram-HS3SLOUP-DTgzXTlP.js → infoDiagram-HS3SLOUP-DKF6awtp.js} +1 -1
- package/dist/studio/assets/{journeyDiagram-XKPGCS4Q-Bl7_rMO-.js → journeyDiagram-XKPGCS4Q-CgrhL8R0.js} +1 -1
- package/dist/studio/assets/{kanban-definition-3W4ZIXB7-DfXkmWYb.js → kanban-definition-3W4ZIXB7-28MC-pF6.js} +1 -1
- package/dist/studio/assets/{layout-CfjDDkzK.js → layout-gwYv6lHv.js} +1 -1
- package/dist/studio/assets/{linear-Bg2mbmM0.js → linear-Dl48BTRW.js} +1 -1
- package/dist/studio/assets/{mermaid.core-Cwhxv6mz.js → mermaid.core-YPNEyw9M.js} +4 -4
- package/dist/studio/assets/{mindmap-definition-VGOIOE7T-Di0QPIFD.js → mindmap-definition-VGOIOE7T-CNO-62gT.js} +1 -1
- package/dist/studio/assets/{pieDiagram-ADFJNKIX-Cuw6mZ_s.js → pieDiagram-ADFJNKIX-DutNO8TU.js} +1 -1
- package/dist/studio/assets/{quadrantDiagram-AYHSOK5B-BfzOkC1I.js → quadrantDiagram-AYHSOK5B-CyL-T3po.js} +1 -1
- package/dist/studio/assets/{requirementDiagram-UZGBJVZJ-CsTE75LG.js → requirementDiagram-UZGBJVZJ-Decs2Rps.js} +1 -1
- package/dist/studio/assets/{sankeyDiagram-TZEHDZUN-AsrOeW85.js → sankeyDiagram-TZEHDZUN-CXQHF2nL.js} +1 -1
- package/dist/studio/assets/{sequenceDiagram-WL72ISMW-CpNum0nP.js → sequenceDiagram-WL72ISMW-C9cFuo_6.js} +1 -1
- package/dist/studio/assets/{stateDiagram-FKZM4ZOC-BFtnF9LR.js → stateDiagram-FKZM4ZOC-Dvs2TeCM.js} +1 -1
- package/dist/studio/assets/stateDiagram-v2-4FDKWEC3-NKg7XNVy.js +1 -0
- package/dist/studio/assets/{timeline-definition-IT6M3QCI-D8wb271_.js → timeline-definition-IT6M3QCI-BpsJlgf7.js} +1 -1
- package/dist/studio/assets/{treemap-GDKQZRPO-DbBWYkT8.js → treemap-GDKQZRPO-DVxRTPr1.js} +1 -1
- package/dist/studio/assets/{xychartDiagram-PRI3JC2R-ChIi73X1.js → xychartDiagram-PRI3JC2R-QUfHK5a4.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/templates/config.yaml +10 -2
- package/dist/templates/templates/config.yaml +2 -2
- package/global/agents/sleepless.md +46 -27
- package/global/scripts/project-sync.sh +92 -55
- package/package.json +2 -2
- package/dist/studio/assets/channel-CsDzmrvf.js +0 -1
- package/dist/studio/assets/classDiagram-2ON5EDUG-BPqf3_Tt.js +0 -1
- package/dist/studio/assets/classDiagram-v2-WZHVMYZB-BPqf3_Tt.js +0 -1
- package/dist/studio/assets/clone-BFu3hFPa.js +0 -1
- package/dist/studio/assets/stateDiagram-v2-4FDKWEC3-BSIEq3zy.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xh=Object.defineProperty;var Dh=(t,e,n)=>e in t?xh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ln=(t,e,n)=>Dh(t,typeof e!="symbol"?e+"":e,n);import{a as Mh,_ as An}from"./index-DU1UoE3B.js";import{bA as Fh,bB as Gh,aP as _d,bk as Uh,aT as qh,aQ as je,ar as jh,as as _l,ba as zh,bd as Id,be as Pd,bb as Bh,bp as Il,au as Xn,av as ae,aR as Wh,aL as Vh}from"./mermaid.core-Cwhxv6mz.js";import{k as jr,j as nl,g as Yr,S as Kh,w as Hh,x as Yh,c as $d,v as $e,y as Ld,l as Xh,z as Jh,A as Qh,B as Zh,C as ep,a as Od,d as q,i as tn,r as Je,f as ht,D as Fe}from"./_baseUniq-DtSwUsWb.js";import{j as rl,m as M,d as tp,f as yt,g as zr,h as z,i as il,l as zn,e as np}from"./_basePickBy-B-dYIPO9.js";import{c as Be}from"./clone-BFu3hFPa.js";var rp=Object.prototype,ip=rp.hasOwnProperty,ft=Fh(function(t,e){if(Gh(e)||_d(e)){Uh(e,jr(e),t);return}for(var n in e)ip.call(e,n)&&qh(t,n,e[n])});function xd(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function rs(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}function sp(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function ap(t,e,n,r){return nl(t,function(i,s,a){e(r,i,n(i),a)}),r}function op(t,e){return function(n,r){var i=je(n)?sp:ap,s=e?e():{};return i(n,t,Yr(r),s)}}var cp=200;function lp(t,e,n,r){var i=-1,s=Hh,a=!0,o=t.length,c=[],l=e.length;if(!o)return c;e.length>=cp&&(s=Yh,a=!1,e=new Kh(e));e:for(;++i<o;){var u=t[i],f=u;if(u=u!==0?u:0,a&&f===f){for(var g=l;g--;)if(e[g]===f)continue e;c.push(u)}else s(e,f,r)||c.push(u)}return c}var Ia=jh(function(t,e){return _l(t)?lp(t,$d(e,1,_l,!0)):[]});function Ge(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),xd(t,e<0?0:e,r)):[]}function Bi(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),e=r-e,xd(t,0,e<0?0:e)):[]}function up(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function dp(t,e){var n=!0;return nl(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Ct(t,e,n){var r=je(t)?up:dp;return r(t,Yr(e))}function wt(t){return t&&t.length?t[0]:void 0}function dt(t,e){return $d(M(t,e))}var fp=Object.prototype,hp=fp.hasOwnProperty,pp=op(function(t,e,n){hp.call(t,n)?t[n].push(e):zh(t,n,[e])}),mp="[object String]";function nt(t){return typeof t=="string"||!je(t)&&Id(t)&&Pd(t)==mp}var gp=Math.max;function et(t,e,n,r){t=_d(t)?t:$e(t),n=n?rl(n):0;var i=t.length;return n<0&&(n=gp(i+n,0)),nt(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ld(t,e,n)>-1}function Pl(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return Ld(t,e,i)}var yp="[object RegExp]";function Tp(t){return Id(t)&&Pd(t)==yp}var $l=Il&&Il.isRegExp,nn=$l?Bh($l):Tp,Rp="Expected a function";function vp(t){if(typeof t!="function")throw new TypeError(Rp);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Nt(t,e){if(t==null)return{};var n=Xh(Jh(t),function(r){return[r]});return e=Yr(e),tp(t,n,function(r,i){return e(r,i[0])})}function Pa(t,e){var n=je(t)?Qh:Zh;return n(t,vp(Yr(e)))}function Ep(t,e){var n;return nl(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function Dd(t,e,n){var r=je(t)?ep:Ep;return r(t,Yr(e))}function sl(t){return t&&t.length?Od(t):[]}function Ap(t,e){return t&&t.length?Od(t,Yr(e)):[]}function We(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function St(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function dn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"items"in t}function Sp(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function hi(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Md{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){var i;const n=this.types[e.container.$type];if(!n)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const r=(i=n.properties[e.property])==null?void 0:i.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){const n=this.types[e];return n||{name:e,properties:{},superTypes:[]}}isInstance(e,n){return We(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.types[e],a=s?s.superTypes.some(o=>this.isSubtype(o,n)):!1;return r[n]=a,a}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function Wi(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Fd(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Gd(t){return Wi(t)&&typeof t.fullText=="string"}class Ue{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ue(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return lt})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=Cp(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Ue(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?lt:{done:!1,value:e(i)}})}filter(e){return new Ue(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return lt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new Ue(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(oa(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return lt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Ue(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(oa(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return lt})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Ue(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new Ue(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?lt:this.nextFn(n.state)))}distinct(e){return new Ue(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return lt})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function Cp(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function oa(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ud=new Ue(()=>{},()=>lt),lt=Object.freeze({done:!0,value:void 0});function ge(...t){if(t.length===1){const e=t[0];if(e instanceof Ue)return e;if(oa(e))return new Ue(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Ue(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:lt)}return t.length>1?new Ue(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];oa(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return lt}):Ud}class al extends Ue{constructor(e,n,r){super(()=>({iterators:r!=null&&r.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return lt})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Ro;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(Ro||(Ro={}));function vo(t,e={}){for(const[n,r]of Object.entries(t))n.startsWith("$")||(Array.isArray(r)?r.forEach((i,s)=>{We(i)&&(i.$container=t,i.$containerProperty=n,i.$containerIndex=s,e.deep&&vo(i,e))}):We(r)&&(r.$container=t,r.$containerProperty=n,e.deep&&vo(r,e)))}function $a(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Qt(t){const n=Vs(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Vs(t){for(;t.$container;)t=t.$container;return t}function Ll(t){return St(t)?t.ref?[t.ref]:[]:dn(t)?t.items.map(e=>e.ref):[]}function ol(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e==null?void 0:e.range;return new Ue(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(We(s)){if(r.keyIndex++,Ol(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(We(o)&&Ol(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return lt})}function is(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new al(t,n=>ol(n,e))}function Zt(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new al(t,n=>ol(n,e),{includeRoot:!0})}function Ol(t,e){var r;if(!e)return!0;const n=(r=t.$cstNode)==null?void 0:r.range;return n?Kp(n,e):!1}function ca(t){return new Ue(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(St(r)||dn(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(St(s)||dn(r))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return lt})}function kp(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of Object.values(n.properties))i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=qd(i.defaultValue))}function qd(t){return Array.isArray(t)?[...t.map(qd)]:t}const ct={$type:"AbstractElement",cardinality:"cardinality"};function wp(t){return ee.isInstance(t,ct.$type)}const Ks={$type:"AbstractParserRule"};function ss(t){return ee.isInstance(t,Ks.$type)}const Ps={$type:"AbstractRule"},Et={$type:"AbstractType"},xn={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function La(t){return ee.isInstance(t,xn.$type)}const Hs={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function jd(t){return ee.isInstance(t,Hs.$type)}const xl={$type:"ArrayLiteral",elements:"elements"},Dl={$type:"ArrayType",elementType:"elementType"},Dn={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function Bn(t){return ee.isInstance(t,Dn.$type)}const Eo={$type:"BooleanLiteral",true:"true"};function Np(t){return ee.isInstance(t,Eo.$type)}const Mn={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function bp(t){return ee.isInstance(t,Mn.$type)}const rr={$type:"Condition"},Ys={$type:"Conjunction",left:"left",right:"right"};function _p(t){return ee.isInstance(t,Ys.$type)}const Fn={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function Oa(t){return ee.isInstance(t,Fn.$type)}const Xs={$type:"Disjunction",left:"left",right:"right"};function Ip(t){return ee.isInstance(t,Xs.$type)}const Ao={$type:"EndOfFile",cardinality:"cardinality"};function Pp(t){return ee.isInstance(t,Ao.$type)}const Sn={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"},Ml={$type:"GrammarImport",path:"path"},lr={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function cl(t){return ee.isInstance(t,lr.$type)}const So={$type:"InferredType",name:"name"};function zd(t){return ee.isInstance(t,So.$type)}const Vt={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function la(t){return ee.isInstance(t,Vt.$type)}const Ha={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"},Fl={$type:"InfixRuleOperators",precedences:"precedences"},Oi={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function $p(t){return ee.isInstance(t,Oi.$type)}const xi={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Wn(t){return ee.isInstance(t,xi.$type)}const $s={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"},ur={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function Lp(t){return ee.isInstance(t,ur.$type)}const Co={$type:"Negation",value:"value"};function Op(t){return ee.isInstance(t,Co.$type)}const Gl={$type:"NumberLiteral",value:"value"},Ls={$type:"Parameter",name:"name"},ko={$type:"ParameterReference",parameter:"parameter"};function xp(t){return ee.isInstance(t,ko.$type)}const Pt={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function sn(t){return ee.isInstance(t,Pt.$type)}const Ya={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"},dr={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function Dp(t){return ee.isInstance(t,dr.$type)}const wo={$type:"ReturnType",name:"name"};function Mp(t){return ee.isInstance(t,wo.$type)}const fr={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function Vn(t){return ee.isInstance(t,fr.$type)}const Di={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function Fp(t){return ee.isInstance(t,Di.$type)}const Ul={$type:"StringLiteral",value:"value"},hr={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Gp(t){return ee.isInstance(t,hr.$type)}const gt={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"},pr={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Up(t){return ee.isInstance(t,pr.$type)}const un={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function an(t){return ee.isInstance(t,un.$type)}const mr={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function qp(t){return ee.isInstance(t,mr.$type)}const Js={$type:"Type",name:"name",type:"type"};function jp(t){return ee.isInstance(t,Js.$type)}const pi={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"},mi={$type:"TypeDefinition"},ql={$type:"UnionType",types:"types"},Qs={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function Bd(t){return ee.isInstance(t,Qs.$type)}const gr={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function zp(t){return ee.isInstance(t,gr.$type)}const gi={$type:"ValueLiteral"},Mi={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function Bp(t){return ee.isInstance(t,Mi.$type)}class Wd extends Md{constructor(){super(...arguments),this.types={AbstractElement:{name:ct.$type,properties:{cardinality:{name:ct.cardinality}},superTypes:[]},AbstractParserRule:{name:Ks.$type,properties:{},superTypes:[Ps.$type,Et.$type]},AbstractRule:{name:Ps.$type,properties:{},superTypes:[]},AbstractType:{name:Et.$type,properties:{},superTypes:[]},Action:{name:xn.$type,properties:{cardinality:{name:xn.cardinality},feature:{name:xn.feature},inferredType:{name:xn.inferredType},operator:{name:xn.operator},type:{name:xn.type,referenceType:Et.$type}},superTypes:[ct.$type]},Alternatives:{name:Hs.$type,properties:{cardinality:{name:Hs.cardinality},elements:{name:Hs.elements,defaultValue:[]}},superTypes:[ct.$type]},ArrayLiteral:{name:xl.$type,properties:{elements:{name:xl.elements,defaultValue:[]}},superTypes:[gi.$type]},ArrayType:{name:Dl.$type,properties:{elementType:{name:Dl.elementType}},superTypes:[mi.$type]},Assignment:{name:Dn.$type,properties:{cardinality:{name:Dn.cardinality},feature:{name:Dn.feature},operator:{name:Dn.operator},predicate:{name:Dn.predicate},terminal:{name:Dn.terminal}},superTypes:[ct.$type]},BooleanLiteral:{name:Eo.$type,properties:{true:{name:Eo.true,defaultValue:!1}},superTypes:[rr.$type,gi.$type]},CharacterRange:{name:Mn.$type,properties:{cardinality:{name:Mn.cardinality},left:{name:Mn.left},lookahead:{name:Mn.lookahead},parenthesized:{name:Mn.parenthesized,defaultValue:!1},right:{name:Mn.right}},superTypes:[gt.$type]},Condition:{name:rr.$type,properties:{},superTypes:[]},Conjunction:{name:Ys.$type,properties:{left:{name:Ys.left},right:{name:Ys.right}},superTypes:[rr.$type]},CrossReference:{name:Fn.$type,properties:{cardinality:{name:Fn.cardinality},deprecatedSyntax:{name:Fn.deprecatedSyntax,defaultValue:!1},isMulti:{name:Fn.isMulti,defaultValue:!1},terminal:{name:Fn.terminal},type:{name:Fn.type,referenceType:Et.$type}},superTypes:[ct.$type]},Disjunction:{name:Xs.$type,properties:{left:{name:Xs.left},right:{name:Xs.right}},superTypes:[rr.$type]},EndOfFile:{name:Ao.$type,properties:{cardinality:{name:Ao.cardinality}},superTypes:[ct.$type]},Grammar:{name:Sn.$type,properties:{imports:{name:Sn.imports,defaultValue:[]},interfaces:{name:Sn.interfaces,defaultValue:[]},isDeclared:{name:Sn.isDeclared,defaultValue:!1},name:{name:Sn.name},rules:{name:Sn.rules,defaultValue:[]},types:{name:Sn.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:Ml.$type,properties:{path:{name:Ml.path}},superTypes:[]},Group:{name:lr.$type,properties:{cardinality:{name:lr.cardinality},elements:{name:lr.elements,defaultValue:[]},guardCondition:{name:lr.guardCondition},predicate:{name:lr.predicate}},superTypes:[ct.$type]},InferredType:{name:So.$type,properties:{name:{name:So.name}},superTypes:[Et.$type]},InfixRule:{name:Vt.$type,properties:{call:{name:Vt.call},dataType:{name:Vt.dataType},inferredType:{name:Vt.inferredType},name:{name:Vt.name},operators:{name:Vt.operators},parameters:{name:Vt.parameters,defaultValue:[]},returnType:{name:Vt.returnType,referenceType:Et.$type}},superTypes:[Ks.$type]},InfixRuleOperatorList:{name:Ha.$type,properties:{associativity:{name:Ha.associativity},operators:{name:Ha.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Fl.$type,properties:{precedences:{name:Fl.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:Oi.$type,properties:{attributes:{name:Oi.attributes,defaultValue:[]},name:{name:Oi.name},superTypes:{name:Oi.superTypes,defaultValue:[],referenceType:Et.$type}},superTypes:[Et.$type]},Keyword:{name:xi.$type,properties:{cardinality:{name:xi.cardinality},predicate:{name:xi.predicate},value:{name:xi.value}},superTypes:[ct.$type]},NamedArgument:{name:$s.$type,properties:{calledByName:{name:$s.calledByName,defaultValue:!1},parameter:{name:$s.parameter,referenceType:Ls.$type},value:{name:$s.value}},superTypes:[]},NegatedToken:{name:ur.$type,properties:{cardinality:{name:ur.cardinality},lookahead:{name:ur.lookahead},parenthesized:{name:ur.parenthesized,defaultValue:!1},terminal:{name:ur.terminal}},superTypes:[gt.$type]},Negation:{name:Co.$type,properties:{value:{name:Co.value}},superTypes:[rr.$type]},NumberLiteral:{name:Gl.$type,properties:{value:{name:Gl.value}},superTypes:[gi.$type]},Parameter:{name:Ls.$type,properties:{name:{name:Ls.name}},superTypes:[]},ParameterReference:{name:ko.$type,properties:{parameter:{name:ko.parameter,referenceType:Ls.$type}},superTypes:[rr.$type]},ParserRule:{name:Pt.$type,properties:{dataType:{name:Pt.dataType},definition:{name:Pt.definition},entry:{name:Pt.entry,defaultValue:!1},fragment:{name:Pt.fragment,defaultValue:!1},inferredType:{name:Pt.inferredType},name:{name:Pt.name},parameters:{name:Pt.parameters,defaultValue:[]},returnType:{name:Pt.returnType,referenceType:Et.$type}},superTypes:[Ks.$type]},ReferenceType:{name:Ya.$type,properties:{isMulti:{name:Ya.isMulti,defaultValue:!1},referenceType:{name:Ya.referenceType}},superTypes:[mi.$type]},RegexToken:{name:dr.$type,properties:{cardinality:{name:dr.cardinality},lookahead:{name:dr.lookahead},parenthesized:{name:dr.parenthesized,defaultValue:!1},regex:{name:dr.regex}},superTypes:[gt.$type]},ReturnType:{name:wo.$type,properties:{name:{name:wo.name}},superTypes:[]},RuleCall:{name:fr.$type,properties:{arguments:{name:fr.arguments,defaultValue:[]},cardinality:{name:fr.cardinality},predicate:{name:fr.predicate},rule:{name:fr.rule,referenceType:Ps.$type}},superTypes:[ct.$type]},SimpleType:{name:Di.$type,properties:{primitiveType:{name:Di.primitiveType},stringType:{name:Di.stringType},typeRef:{name:Di.typeRef,referenceType:Et.$type}},superTypes:[mi.$type]},StringLiteral:{name:Ul.$type,properties:{value:{name:Ul.value}},superTypes:[gi.$type]},TerminalAlternatives:{name:hr.$type,properties:{cardinality:{name:hr.cardinality},elements:{name:hr.elements,defaultValue:[]},lookahead:{name:hr.lookahead},parenthesized:{name:hr.parenthesized,defaultValue:!1}},superTypes:[gt.$type]},TerminalElement:{name:gt.$type,properties:{cardinality:{name:gt.cardinality},lookahead:{name:gt.lookahead},parenthesized:{name:gt.parenthesized,defaultValue:!1}},superTypes:[ct.$type]},TerminalGroup:{name:pr.$type,properties:{cardinality:{name:pr.cardinality},elements:{name:pr.elements,defaultValue:[]},lookahead:{name:pr.lookahead},parenthesized:{name:pr.parenthesized,defaultValue:!1}},superTypes:[gt.$type]},TerminalRule:{name:un.$type,properties:{definition:{name:un.definition},fragment:{name:un.fragment,defaultValue:!1},hidden:{name:un.hidden,defaultValue:!1},name:{name:un.name},type:{name:un.type}},superTypes:[Ps.$type]},TerminalRuleCall:{name:mr.$type,properties:{cardinality:{name:mr.cardinality},lookahead:{name:mr.lookahead},parenthesized:{name:mr.parenthesized,defaultValue:!1},rule:{name:mr.rule,referenceType:un.$type}},superTypes:[gt.$type]},Type:{name:Js.$type,properties:{name:{name:Js.name},type:{name:Js.type}},superTypes:[Et.$type]},TypeAttribute:{name:pi.$type,properties:{defaultValue:{name:pi.defaultValue},isOptional:{name:pi.isOptional,defaultValue:!1},name:{name:pi.name},type:{name:pi.type}},superTypes:[]},TypeDefinition:{name:mi.$type,properties:{},superTypes:[]},UnionType:{name:ql.$type,properties:{types:{name:ql.types,defaultValue:[]}},superTypes:[mi.$type]},UnorderedGroup:{name:Qs.$type,properties:{cardinality:{name:Qs.cardinality},elements:{name:Qs.elements,defaultValue:[]}},superTypes:[ct.$type]},UntilToken:{name:gr.$type,properties:{cardinality:{name:gr.cardinality},lookahead:{name:gr.lookahead},parenthesized:{name:gr.parenthesized,defaultValue:!1},terminal:{name:gr.terminal}},superTypes:[gt.$type]},ValueLiteral:{name:gi.$type,properties:{},superTypes:[]},Wildcard:{name:Mi.$type,properties:{cardinality:{name:Mi.cardinality},lookahead:{name:Mi.lookahead},parenthesized:{name:Mi.parenthesized,defaultValue:!1}},superTypes:[gt.$type]}}}}const ee=new Wd;function No(t){return new al(t,e=>Wi(e)?e.content:[],{includeRoot:!0})}function Wp(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function bo(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function ua(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var Xt;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(Xt||(Xt={}));function Vp(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return Xt.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return Xt.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?Xt.Inside:n?Xt.OverlapBack:r?Xt.OverlapFront:Xt.Outside}function Kp(t,e){return Vp(t,e)>Xt.After}const Hp=/^[\w\p{L}]$/u;function Yp(t,e){if(t){const n=Xp(t,!0);if(n&&jl(n,e))return n;if(Gd(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(jl(s,e))return s}}}}function jl(t,e){return Fd(t)&&e.includes(t.tokenType.name)}function Xp(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}class Vd extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function as(t,e="Error: Got unexpected value."){throw new Error(e)}function W(t){return t.charCodeAt(0)}function Xa(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function yi(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ir(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Jp(){throw Error("Internal Error - Should never get here!")}function zl(t){return t.type==="Character"}const da=[];for(let t=W("0");t<=W("9");t++)da.push(t);const fa=[W("_")].concat(da);for(let t=W("a");t<=W("z");t++)fa.push(t);for(let t=W("A");t<=W("Z");t++)fa.push(t);const Bl=[W(" "),W("\f"),W(`
|
|
1
|
+
var xh=Object.defineProperty;var Dh=(t,e,n)=>e in t?xh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ln=(t,e,n)=>Dh(t,typeof e!="symbol"?e+"":e,n);import{a as Mh,_ as An}from"./index-WEgtt1oI.js";import{bA as Fh,bB as Gh,aP as _d,bk as Uh,aT as qh,aQ as je,ar as jh,as as _l,ba as zh,bd as Id,be as Pd,bb as Bh,bp as Il,au as Xn,av as ae,aR as Wh,aL as Vh}from"./mermaid.core-YPNEyw9M.js";import{k as jr,j as nl,g as Yr,S as Kh,w as Hh,x as Yh,c as $d,v as $e,y as Ld,l as Xh,z as Jh,A as Qh,B as Zh,C as ep,a as Od,d as q,i as tn,r as Je,f as ht,D as Fe}from"./_baseUniq-DB9CANVr.js";import{j as rl,m as M,d as tp,f as yt,g as zr,h as z,i as il,l as zn,e as np}from"./_basePickBy-CaRVkU_i.js";import{c as Be}from"./clone-Chwjzlof.js";var rp=Object.prototype,ip=rp.hasOwnProperty,ft=Fh(function(t,e){if(Gh(e)||_d(e)){Uh(e,jr(e),t);return}for(var n in e)ip.call(e,n)&&qh(t,n,e[n])});function xd(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function rs(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}function sp(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function ap(t,e,n,r){return nl(t,function(i,s,a){e(r,i,n(i),a)}),r}function op(t,e){return function(n,r){var i=je(n)?sp:ap,s=e?e():{};return i(n,t,Yr(r),s)}}var cp=200;function lp(t,e,n,r){var i=-1,s=Hh,a=!0,o=t.length,c=[],l=e.length;if(!o)return c;e.length>=cp&&(s=Yh,a=!1,e=new Kh(e));e:for(;++i<o;){var u=t[i],f=u;if(u=u!==0?u:0,a&&f===f){for(var g=l;g--;)if(e[g]===f)continue e;c.push(u)}else s(e,f,r)||c.push(u)}return c}var Ia=jh(function(t,e){return _l(t)?lp(t,$d(e,1,_l,!0)):[]});function Ge(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),xd(t,e<0?0:e,r)):[]}function Bi(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),e=r-e,xd(t,0,e<0?0:e)):[]}function up(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function dp(t,e){var n=!0;return nl(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Ct(t,e,n){var r=je(t)?up:dp;return r(t,Yr(e))}function wt(t){return t&&t.length?t[0]:void 0}function dt(t,e){return $d(M(t,e))}var fp=Object.prototype,hp=fp.hasOwnProperty,pp=op(function(t,e,n){hp.call(t,n)?t[n].push(e):zh(t,n,[e])}),mp="[object String]";function nt(t){return typeof t=="string"||!je(t)&&Id(t)&&Pd(t)==mp}var gp=Math.max;function et(t,e,n,r){t=_d(t)?t:$e(t),n=n?rl(n):0;var i=t.length;return n<0&&(n=gp(i+n,0)),nt(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ld(t,e,n)>-1}function Pl(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return Ld(t,e,i)}var yp="[object RegExp]";function Tp(t){return Id(t)&&Pd(t)==yp}var $l=Il&&Il.isRegExp,nn=$l?Bh($l):Tp,Rp="Expected a function";function vp(t){if(typeof t!="function")throw new TypeError(Rp);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Nt(t,e){if(t==null)return{};var n=Xh(Jh(t),function(r){return[r]});return e=Yr(e),tp(t,n,function(r,i){return e(r,i[0])})}function Pa(t,e){var n=je(t)?Qh:Zh;return n(t,vp(Yr(e)))}function Ep(t,e){var n;return nl(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function Dd(t,e,n){var r=je(t)?ep:Ep;return r(t,Yr(e))}function sl(t){return t&&t.length?Od(t):[]}function Ap(t,e){return t&&t.length?Od(t,Yr(e)):[]}function We(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function St(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function dn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"items"in t}function Sp(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function hi(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Md{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){var i;const n=this.types[e.container.$type];if(!n)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const r=(i=n.properties[e.property])==null?void 0:i.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){const n=this.types[e];return n||{name:e,properties:{},superTypes:[]}}isInstance(e,n){return We(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.types[e],a=s?s.superTypes.some(o=>this.isSubtype(o,n)):!1;return r[n]=a,a}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function Wi(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Fd(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Gd(t){return Wi(t)&&typeof t.fullText=="string"}class Ue{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ue(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return lt})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=Cp(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Ue(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?lt:{done:!1,value:e(i)}})}filter(e){return new Ue(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return lt})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new Ue(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(oa(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return lt})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Ue(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(oa(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return lt})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Ue(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new Ue(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?lt:this.nextFn(n.state)))}distinct(e){return new Ue(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return lt})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function Cp(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function oa(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ud=new Ue(()=>{},()=>lt),lt=Object.freeze({done:!0,value:void 0});function ge(...t){if(t.length===1){const e=t[0];if(e instanceof Ue)return e;if(oa(e))return new Ue(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Ue(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:lt)}return t.length>1?new Ue(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];oa(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return lt}):Ud}class al extends Ue{constructor(e,n,r){super(()=>({iterators:r!=null&&r.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return lt})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Ro;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(Ro||(Ro={}));function vo(t,e={}){for(const[n,r]of Object.entries(t))n.startsWith("$")||(Array.isArray(r)?r.forEach((i,s)=>{We(i)&&(i.$container=t,i.$containerProperty=n,i.$containerIndex=s,e.deep&&vo(i,e))}):We(r)&&(r.$container=t,r.$containerProperty=n,e.deep&&vo(r,e)))}function $a(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Qt(t){const n=Vs(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Vs(t){for(;t.$container;)t=t.$container;return t}function Ll(t){return St(t)?t.ref?[t.ref]:[]:dn(t)?t.items.map(e=>e.ref):[]}function ol(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e==null?void 0:e.range;return new Ue(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(We(s)){if(r.keyIndex++,Ol(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(We(o)&&Ol(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return lt})}function is(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new al(t,n=>ol(n,e))}function Zt(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new al(t,n=>ol(n,e),{includeRoot:!0})}function Ol(t,e){var r;if(!e)return!0;const n=(r=t.$cstNode)==null?void 0:r.range;return n?Kp(n,e):!1}function ca(t){return new Ue(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(St(r)||dn(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(St(s)||dn(r))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return lt})}function kp(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of Object.values(n.properties))i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=qd(i.defaultValue))}function qd(t){return Array.isArray(t)?[...t.map(qd)]:t}const ct={$type:"AbstractElement",cardinality:"cardinality"};function wp(t){return ee.isInstance(t,ct.$type)}const Ks={$type:"AbstractParserRule"};function ss(t){return ee.isInstance(t,Ks.$type)}const Ps={$type:"AbstractRule"},Et={$type:"AbstractType"},xn={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function La(t){return ee.isInstance(t,xn.$type)}const Hs={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function jd(t){return ee.isInstance(t,Hs.$type)}const xl={$type:"ArrayLiteral",elements:"elements"},Dl={$type:"ArrayType",elementType:"elementType"},Dn={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function Bn(t){return ee.isInstance(t,Dn.$type)}const Eo={$type:"BooleanLiteral",true:"true"};function Np(t){return ee.isInstance(t,Eo.$type)}const Mn={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function bp(t){return ee.isInstance(t,Mn.$type)}const rr={$type:"Condition"},Ys={$type:"Conjunction",left:"left",right:"right"};function _p(t){return ee.isInstance(t,Ys.$type)}const Fn={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function Oa(t){return ee.isInstance(t,Fn.$type)}const Xs={$type:"Disjunction",left:"left",right:"right"};function Ip(t){return ee.isInstance(t,Xs.$type)}const Ao={$type:"EndOfFile",cardinality:"cardinality"};function Pp(t){return ee.isInstance(t,Ao.$type)}const Sn={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"},Ml={$type:"GrammarImport",path:"path"},lr={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function cl(t){return ee.isInstance(t,lr.$type)}const So={$type:"InferredType",name:"name"};function zd(t){return ee.isInstance(t,So.$type)}const Vt={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function la(t){return ee.isInstance(t,Vt.$type)}const Ha={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"},Fl={$type:"InfixRuleOperators",precedences:"precedences"},Oi={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function $p(t){return ee.isInstance(t,Oi.$type)}const xi={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Wn(t){return ee.isInstance(t,xi.$type)}const $s={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"},ur={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function Lp(t){return ee.isInstance(t,ur.$type)}const Co={$type:"Negation",value:"value"};function Op(t){return ee.isInstance(t,Co.$type)}const Gl={$type:"NumberLiteral",value:"value"},Ls={$type:"Parameter",name:"name"},ko={$type:"ParameterReference",parameter:"parameter"};function xp(t){return ee.isInstance(t,ko.$type)}const Pt={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function sn(t){return ee.isInstance(t,Pt.$type)}const Ya={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"},dr={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function Dp(t){return ee.isInstance(t,dr.$type)}const wo={$type:"ReturnType",name:"name"};function Mp(t){return ee.isInstance(t,wo.$type)}const fr={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function Vn(t){return ee.isInstance(t,fr.$type)}const Di={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function Fp(t){return ee.isInstance(t,Di.$type)}const Ul={$type:"StringLiteral",value:"value"},hr={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Gp(t){return ee.isInstance(t,hr.$type)}const gt={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"},pr={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Up(t){return ee.isInstance(t,pr.$type)}const un={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function an(t){return ee.isInstance(t,un.$type)}const mr={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function qp(t){return ee.isInstance(t,mr.$type)}const Js={$type:"Type",name:"name",type:"type"};function jp(t){return ee.isInstance(t,Js.$type)}const pi={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"},mi={$type:"TypeDefinition"},ql={$type:"UnionType",types:"types"},Qs={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function Bd(t){return ee.isInstance(t,Qs.$type)}const gr={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function zp(t){return ee.isInstance(t,gr.$type)}const gi={$type:"ValueLiteral"},Mi={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function Bp(t){return ee.isInstance(t,Mi.$type)}class Wd extends Md{constructor(){super(...arguments),this.types={AbstractElement:{name:ct.$type,properties:{cardinality:{name:ct.cardinality}},superTypes:[]},AbstractParserRule:{name:Ks.$type,properties:{},superTypes:[Ps.$type,Et.$type]},AbstractRule:{name:Ps.$type,properties:{},superTypes:[]},AbstractType:{name:Et.$type,properties:{},superTypes:[]},Action:{name:xn.$type,properties:{cardinality:{name:xn.cardinality},feature:{name:xn.feature},inferredType:{name:xn.inferredType},operator:{name:xn.operator},type:{name:xn.type,referenceType:Et.$type}},superTypes:[ct.$type]},Alternatives:{name:Hs.$type,properties:{cardinality:{name:Hs.cardinality},elements:{name:Hs.elements,defaultValue:[]}},superTypes:[ct.$type]},ArrayLiteral:{name:xl.$type,properties:{elements:{name:xl.elements,defaultValue:[]}},superTypes:[gi.$type]},ArrayType:{name:Dl.$type,properties:{elementType:{name:Dl.elementType}},superTypes:[mi.$type]},Assignment:{name:Dn.$type,properties:{cardinality:{name:Dn.cardinality},feature:{name:Dn.feature},operator:{name:Dn.operator},predicate:{name:Dn.predicate},terminal:{name:Dn.terminal}},superTypes:[ct.$type]},BooleanLiteral:{name:Eo.$type,properties:{true:{name:Eo.true,defaultValue:!1}},superTypes:[rr.$type,gi.$type]},CharacterRange:{name:Mn.$type,properties:{cardinality:{name:Mn.cardinality},left:{name:Mn.left},lookahead:{name:Mn.lookahead},parenthesized:{name:Mn.parenthesized,defaultValue:!1},right:{name:Mn.right}},superTypes:[gt.$type]},Condition:{name:rr.$type,properties:{},superTypes:[]},Conjunction:{name:Ys.$type,properties:{left:{name:Ys.left},right:{name:Ys.right}},superTypes:[rr.$type]},CrossReference:{name:Fn.$type,properties:{cardinality:{name:Fn.cardinality},deprecatedSyntax:{name:Fn.deprecatedSyntax,defaultValue:!1},isMulti:{name:Fn.isMulti,defaultValue:!1},terminal:{name:Fn.terminal},type:{name:Fn.type,referenceType:Et.$type}},superTypes:[ct.$type]},Disjunction:{name:Xs.$type,properties:{left:{name:Xs.left},right:{name:Xs.right}},superTypes:[rr.$type]},EndOfFile:{name:Ao.$type,properties:{cardinality:{name:Ao.cardinality}},superTypes:[ct.$type]},Grammar:{name:Sn.$type,properties:{imports:{name:Sn.imports,defaultValue:[]},interfaces:{name:Sn.interfaces,defaultValue:[]},isDeclared:{name:Sn.isDeclared,defaultValue:!1},name:{name:Sn.name},rules:{name:Sn.rules,defaultValue:[]},types:{name:Sn.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:Ml.$type,properties:{path:{name:Ml.path}},superTypes:[]},Group:{name:lr.$type,properties:{cardinality:{name:lr.cardinality},elements:{name:lr.elements,defaultValue:[]},guardCondition:{name:lr.guardCondition},predicate:{name:lr.predicate}},superTypes:[ct.$type]},InferredType:{name:So.$type,properties:{name:{name:So.name}},superTypes:[Et.$type]},InfixRule:{name:Vt.$type,properties:{call:{name:Vt.call},dataType:{name:Vt.dataType},inferredType:{name:Vt.inferredType},name:{name:Vt.name},operators:{name:Vt.operators},parameters:{name:Vt.parameters,defaultValue:[]},returnType:{name:Vt.returnType,referenceType:Et.$type}},superTypes:[Ks.$type]},InfixRuleOperatorList:{name:Ha.$type,properties:{associativity:{name:Ha.associativity},operators:{name:Ha.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Fl.$type,properties:{precedences:{name:Fl.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:Oi.$type,properties:{attributes:{name:Oi.attributes,defaultValue:[]},name:{name:Oi.name},superTypes:{name:Oi.superTypes,defaultValue:[],referenceType:Et.$type}},superTypes:[Et.$type]},Keyword:{name:xi.$type,properties:{cardinality:{name:xi.cardinality},predicate:{name:xi.predicate},value:{name:xi.value}},superTypes:[ct.$type]},NamedArgument:{name:$s.$type,properties:{calledByName:{name:$s.calledByName,defaultValue:!1},parameter:{name:$s.parameter,referenceType:Ls.$type},value:{name:$s.value}},superTypes:[]},NegatedToken:{name:ur.$type,properties:{cardinality:{name:ur.cardinality},lookahead:{name:ur.lookahead},parenthesized:{name:ur.parenthesized,defaultValue:!1},terminal:{name:ur.terminal}},superTypes:[gt.$type]},Negation:{name:Co.$type,properties:{value:{name:Co.value}},superTypes:[rr.$type]},NumberLiteral:{name:Gl.$type,properties:{value:{name:Gl.value}},superTypes:[gi.$type]},Parameter:{name:Ls.$type,properties:{name:{name:Ls.name}},superTypes:[]},ParameterReference:{name:ko.$type,properties:{parameter:{name:ko.parameter,referenceType:Ls.$type}},superTypes:[rr.$type]},ParserRule:{name:Pt.$type,properties:{dataType:{name:Pt.dataType},definition:{name:Pt.definition},entry:{name:Pt.entry,defaultValue:!1},fragment:{name:Pt.fragment,defaultValue:!1},inferredType:{name:Pt.inferredType},name:{name:Pt.name},parameters:{name:Pt.parameters,defaultValue:[]},returnType:{name:Pt.returnType,referenceType:Et.$type}},superTypes:[Ks.$type]},ReferenceType:{name:Ya.$type,properties:{isMulti:{name:Ya.isMulti,defaultValue:!1},referenceType:{name:Ya.referenceType}},superTypes:[mi.$type]},RegexToken:{name:dr.$type,properties:{cardinality:{name:dr.cardinality},lookahead:{name:dr.lookahead},parenthesized:{name:dr.parenthesized,defaultValue:!1},regex:{name:dr.regex}},superTypes:[gt.$type]},ReturnType:{name:wo.$type,properties:{name:{name:wo.name}},superTypes:[]},RuleCall:{name:fr.$type,properties:{arguments:{name:fr.arguments,defaultValue:[]},cardinality:{name:fr.cardinality},predicate:{name:fr.predicate},rule:{name:fr.rule,referenceType:Ps.$type}},superTypes:[ct.$type]},SimpleType:{name:Di.$type,properties:{primitiveType:{name:Di.primitiveType},stringType:{name:Di.stringType},typeRef:{name:Di.typeRef,referenceType:Et.$type}},superTypes:[mi.$type]},StringLiteral:{name:Ul.$type,properties:{value:{name:Ul.value}},superTypes:[gi.$type]},TerminalAlternatives:{name:hr.$type,properties:{cardinality:{name:hr.cardinality},elements:{name:hr.elements,defaultValue:[]},lookahead:{name:hr.lookahead},parenthesized:{name:hr.parenthesized,defaultValue:!1}},superTypes:[gt.$type]},TerminalElement:{name:gt.$type,properties:{cardinality:{name:gt.cardinality},lookahead:{name:gt.lookahead},parenthesized:{name:gt.parenthesized,defaultValue:!1}},superTypes:[ct.$type]},TerminalGroup:{name:pr.$type,properties:{cardinality:{name:pr.cardinality},elements:{name:pr.elements,defaultValue:[]},lookahead:{name:pr.lookahead},parenthesized:{name:pr.parenthesized,defaultValue:!1}},superTypes:[gt.$type]},TerminalRule:{name:un.$type,properties:{definition:{name:un.definition},fragment:{name:un.fragment,defaultValue:!1},hidden:{name:un.hidden,defaultValue:!1},name:{name:un.name},type:{name:un.type}},superTypes:[Ps.$type]},TerminalRuleCall:{name:mr.$type,properties:{cardinality:{name:mr.cardinality},lookahead:{name:mr.lookahead},parenthesized:{name:mr.parenthesized,defaultValue:!1},rule:{name:mr.rule,referenceType:un.$type}},superTypes:[gt.$type]},Type:{name:Js.$type,properties:{name:{name:Js.name},type:{name:Js.type}},superTypes:[Et.$type]},TypeAttribute:{name:pi.$type,properties:{defaultValue:{name:pi.defaultValue},isOptional:{name:pi.isOptional,defaultValue:!1},name:{name:pi.name},type:{name:pi.type}},superTypes:[]},TypeDefinition:{name:mi.$type,properties:{},superTypes:[]},UnionType:{name:ql.$type,properties:{types:{name:ql.types,defaultValue:[]}},superTypes:[mi.$type]},UnorderedGroup:{name:Qs.$type,properties:{cardinality:{name:Qs.cardinality},elements:{name:Qs.elements,defaultValue:[]}},superTypes:[ct.$type]},UntilToken:{name:gr.$type,properties:{cardinality:{name:gr.cardinality},lookahead:{name:gr.lookahead},parenthesized:{name:gr.parenthesized,defaultValue:!1},terminal:{name:gr.terminal}},superTypes:[gt.$type]},ValueLiteral:{name:gi.$type,properties:{},superTypes:[]},Wildcard:{name:Mi.$type,properties:{cardinality:{name:Mi.cardinality},lookahead:{name:Mi.lookahead},parenthesized:{name:Mi.parenthesized,defaultValue:!1}},superTypes:[gt.$type]}}}}const ee=new Wd;function No(t){return new al(t,e=>Wi(e)?e.content:[],{includeRoot:!0})}function Wp(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function bo(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function ua(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var Xt;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(Xt||(Xt={}));function Vp(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<=e.start.character)return Xt.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return Xt.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?Xt.Inside:n?Xt.OverlapBack:r?Xt.OverlapFront:Xt.Outside}function Kp(t,e){return Vp(t,e)>Xt.After}const Hp=/^[\w\p{L}]$/u;function Yp(t,e){if(t){const n=Xp(t,!0);if(n&&jl(n,e))return n;if(Gd(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(jl(s,e))return s}}}}function jl(t,e){return Fd(t)&&e.includes(t.tokenType.name)}function Xp(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}class Vd extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function as(t,e="Error: Got unexpected value."){throw new Error(e)}function W(t){return t.charCodeAt(0)}function Xa(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function yi(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ir(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Jp(){throw Error("Internal Error - Should never get here!")}function zl(t){return t.type==="Character"}const da=[];for(let t=W("0");t<=W("9");t++)da.push(t);const fa=[W("_")].concat(da);for(let t=W("a");t<=W("z");t++)fa.push(t);for(let t=W("A");t<=W("Z");t++)fa.push(t);const Bl=[W(" "),W("\f"),W(`
|
|
2
2
|
`),W("\r"),W(" "),W("\v"),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W("\u2028"),W("\u2029"),W(" "),W(" "),W(" "),W("\uFEFF")],Qp=/[0-9a-fA-F]/,Os=/[0-9]/,Zp=/[1-9]/;class Kd{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":yi(r,"global");break;case"i":yi(r,"ignoreCase");break;case"m":yi(r,"multiLine");break;case"u":yi(r,"unicode");break;case"y":yi(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}ir(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return Jp()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;ir(n);break}if(!(e===!0&&n===void 0)&&ir(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ir(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[W(`
|
|
3
3
|
`),W("\r"),W("\u2028"),W("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=da;break;case"D":e=da,n=!0;break;case"s":e=Bl;break;case"S":e=Bl,n=!0;break;case"w":e=fa;break;case"W":e=fa,n=!0;break}if(ir(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=W("\f");break;case"n":e=W(`
|
|
4
4
|
`);break;case"r":e=W("\r");break;case"t":e=W(" ");break;case"v":e=W("\v");break}if(ir(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:W("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:W(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as gi,g as xi,t as Xt,q as di,a as fi,b as pi,_ as a,l as Nt,K as mi,e as yi,z as bi,H as St,i as Ai,F as Yt,G as wi,a1 as Ci,aF as Si,a9 as Wt}from"./mermaid.core-
|
|
1
|
+
import{s as gi,g as xi,t as Xt,q as di,a as fi,b as pi,_ as a,l as Nt,K as mi,e as yi,z as bi,H as St,i as Ai,F as Yt,G as wi,a1 as Ci,aF as Si,a9 as Wt}from"./mermaid.core-YPNEyw9M.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-Dl48BTRW.js";import"./index-WEgtt1oI.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function yt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,g,m=!1,p=0,k=0,v=.5;delete e.unknown;function C(){var b=t().length,E=n<s,D=E?n:s,P=E?s:n;o=(P-D)/Math.max(1,b-p+k*2),m&&(o=Math.floor(o)),D+=(P-D-o*(b-p))*v,g=o*(1-p),m&&(D=Math.round(D),g=Math.round(g));var I=Ri(b).map(function(y){return D+o*y});return i(E?I.reverse():I)}return e.domain=function(b){return arguments.length?(t(b),C()):t()},e.range=function(b){return arguments.length?([s,n]=b,s=+s,n=+n,C()):[s,n]},e.rangeRound=function(b){return[s,n]=b,s=+s,n=+n,m=!0,C()},e.bandwidth=function(){return g},e.step=function(){return o},e.round=function(b){return arguments.length?(m=!!b,C()):m},e.padding=function(b){return arguments.length?(p=Math.min(1,k=+b),C()):p},e.paddingInner=function(b){return arguments.length?(p=Math.min(1,b),C()):p},e.paddingOuter=function(b){return arguments.length?(k=+b,C()):k},e.align=function(b){return arguments.length?(v=Math.max(0,Math.min(1,b)),C()):v},e.copy=function(){return yt(t(),[s,n]).round(m).paddingInner(p).paddingOuter(k).align(v)},_i.apply(C(),arguments)}var bt=(function(){var e=a(function(F,h,u,x){for(u=u||{},x=F.length;x--;u[F[x]]=h);return u},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],p=[1,25],k=[1,26],v=[1,28],C=[1,29],b=[1,30],E=[1,31],D=[1,32],P=[1,33],I=[1,34],y=[1,35],_=[1,36],c=[1,37],W=[1,43],z=[1,42],U=[1,47],X=[1,50],l=[1,10,12,14,16,18,19,21,23,34,35,36],L=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],S=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],R=[1,64],$={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,u,x,d,w,r,at){var f=r.length-1;switch(w){case 5:d.setOrientation(r[f]);break;case 9:d.setDiagramTitle(r[f].text.trim());break;case 12:d.setLineData({text:"",type:"text"},r[f]);break;case 13:d.setLineData(r[f-1],r[f]);break;case 14:d.setBarData({text:"",type:"text"},r[f]);break;case 15:d.setBarData(r[f-1],r[f]);break;case 16:this.$=r[f].trim(),d.setAccTitle(this.$);break;case 17:case 18:this.$=r[f].trim(),d.setAccDescription(this.$);break;case 19:this.$=r[f-1];break;case 20:this.$=[Number(r[f-2]),...r[f]];break;case 21:this.$=[Number(r[f])];break;case 22:d.setXAxisTitle(r[f]);break;case 23:d.setXAxisTitle(r[f-1]);break;case 24:d.setXAxisTitle({type:"text",text:""});break;case 25:d.setXAxisBand(r[f]);break;case 26:d.setXAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 27:this.$=r[f-1];break;case 28:this.$=[r[f-2],...r[f]];break;case 29:this.$=[r[f]];break;case 30:d.setYAxisTitle(r[f]);break;case 31:d.setYAxisTitle(r[f-1]);break;case 32:d.setYAxisTitle({type:"text",text:""});break;case 33:d.setYAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 37:this.$={text:r[f],type:"text"};break;case 38:this.$={text:r[f],type:"text"};break;case 39:this.$={text:r[f],type:"markdown"};break;case 40:this.$=r[f];break;case 41:this.$=r[f-1]+""+r[f];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:g}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:g}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(m,[2,34]),e(m,[2,35]),e(m,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:g}),{1:[2,3]},e(m,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:g}),{11:23,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:39,13:38,24:W,27:z,29:40,30:41,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:45,15:44,27:U,33:46,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:49,17:48,24:X,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:52,17:51,24:X,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{20:[1,53]},{22:[1,54]},e(l,[2,18]),{1:[2,2]},e(l,[2,8]),e(l,[2,9]),e(L,[2,37],{40:55,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c}),e(L,[2,38]),e(L,[2,39]),e(S,[2,40]),e(S,[2,42]),e(S,[2,43]),e(S,[2,44]),e(S,[2,45]),e(S,[2,46]),e(S,[2,47]),e(S,[2,48]),e(S,[2,49]),e(S,[2,50]),e(S,[2,51]),e(l,[2,10]),e(l,[2,22],{30:41,29:56,24:W,27:z}),e(l,[2,24]),e(l,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},e(l,[2,11]),e(l,[2,30],{33:60,27:U}),e(l,[2,32]),{31:[1,61]},e(l,[2,12]),{17:62,24:X},{25:63,27:R},e(l,[2,14]),{17:65,24:X},e(l,[2,16]),e(l,[2,17]),e(S,[2,41]),e(l,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(l,[2,31]),{27:[1,69]},e(l,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(l,[2,15]),e(l,[2,26]),e(l,[2,27]),{11:59,32:72,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},e(l,[2,33]),e(l,[2,19]),{25:73,27:R},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,u){if(u.recoverable)this.trace(h);else{var x=new Error(h);throw x.hash=u,x}},"parseError"),parse:a(function(h){var u=this,x=[0],d=[],w=[null],r=[],at=this.table,f="",lt=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),T=Object.create(this.lexer),Y={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(Y.yy[dt]=this.yy[dt]);T.setInput(h,Y.yy),Y.yy.lexer=T,Y.yy.parser=this,typeof T.yylloc>"u"&&(T.yylloc={});var ft=T.yylloc;r.push(ft);var ci=T.options&&T.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(V){x.length=x.length-2*V,w.length=w.length-V,r.length=r.length-V}a(ui,"popStack");function Vt(){var V;return V=d.pop()||T.lex()||Mt,typeof V!="number"&&(V instanceof Array&&(d=V,V=d.pop()),V=u.symbols_[V]||V),V}a(Vt,"lex");for(var M,H,B,pt,q={},ct,O,Bt,ut;;){if(H=x[x.length-1],this.defaultActions[H]?B=this.defaultActions[H]:((M===null||typeof M>"u")&&(M=Vt()),B=at[H]&&at[H][M]),typeof B>"u"||!B.length||!B[0]){var mt="";ut=[];for(ct in at[H])this.terminals_[ct]&&ct>hi&&ut.push("'"+this.terminals_[ct]+"'");T.showPosition?mt="Parse error on line "+(lt+1)+`:
|
|
2
2
|
`+T.showPosition()+`
|
|
3
3
|
Expecting `+ut.join(", ")+", got '"+(this.terminals_[M]||M)+"'":mt="Parse error on line "+(lt+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(mt,{text:T.match,token:this.terminals_[M]||M,line:T.yylineno,loc:ft,expected:ut})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+M);switch(B[0]){case 1:x.push(M),w.push(T.yytext),r.push(T.yylloc),x.push(B[1]),M=null,It=T.yyleng,f=T.yytext,lt=T.yylineno,ft=T.yylloc;break;case 2:if(O=this.productions_[B[1]][1],q.$=w[w.length-O],q._$={first_line:r[r.length-(O||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(O||1)].first_column,last_column:r[r.length-1].last_column},ci&&(q._$.range=[r[r.length-(O||1)].range[0],r[r.length-1].range[1]]),pt=this.performAction.apply(q,[f,It,lt,Y.yy,B[1],w,r].concat(li)),typeof pt<"u")return pt;O&&(x=x.slice(0,-1*O*2),w=w.slice(0,-1*O),r=r.slice(0,-1*O)),x.push(this.productions_[B[1]][0]),w.push(q.$),r.push(q._$),Bt=at[x[x.length-2]][x[x.length-1]],x.push(Bt);break;case 3:return!0}}return!0},"parse")},Et=(function(){var F={EOF:1,parseError:a(function(u,x){if(this.yy.parser)this.yy.parser.parseError(u,x);else throw new Error(u)},"parseError"),setInput:a(function(h,u){return this.yy=u||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var u=h.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var u=h.length,x=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===d.length?this.yylloc.first_column:0)+d[d.length-x.length].length-x[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),u=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
package/dist/studio/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>Claudia Browser</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect x='2' y='2' width='28' height='28' rx='6' fill='%23c05050'/><rect x='6' y='13' width='20' height='12' rx='3' fill='none' stroke='white' stroke-width='1.5'/><circle cx='16' cy='8' r='2.5' fill='none' stroke='white' stroke-width='1.5'/><line x1='16' y1='10.5' x2='16' y2='13' stroke='white' stroke-width='1.5'/><circle cx='12' cy='19.5' r='1.5' fill='white'/><circle cx='20' cy='19.5' r='1.5' fill='white'/></svg>" />
|
|
8
8
|
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-WEgtt1oI.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DFEN7xgU.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
@@ -22,7 +22,7 @@ autonomy:
|
|
|
22
22
|
pulse:
|
|
23
23
|
enabled: false
|
|
24
24
|
intervalMinutes: 15
|
|
25
|
-
timezone:
|
|
25
|
+
# timezone: Asia/Bangkok # optional — defaults to machine timezone if omitted
|
|
26
26
|
activeHours: { start: "09:00", end: "22:00" }
|
|
27
27
|
budgetCapUsd: 50
|
|
28
28
|
maxIssuesPerDay: 5
|
|
@@ -51,7 +51,7 @@ slack:
|
|
|
51
51
|
|
|
52
52
|
owner:
|
|
53
53
|
name: ""
|
|
54
|
-
timezone:
|
|
54
|
+
# timezone: Asia/Bangkok # optional — defaults to machine timezone if omitted
|
|
55
55
|
slackUserId: ""
|
|
56
56
|
|
|
57
57
|
# Project goals — guide autonomous prioritization and ideation.
|
|
@@ -60,3 +60,11 @@ goals: []
|
|
|
60
60
|
# - "Ship v1 by end of March"
|
|
61
61
|
# - "Full test coverage for auth module"
|
|
62
62
|
# - "Performance: < 200ms API response times"
|
|
63
|
+
|
|
64
|
+
# Agent CLI config — which tool + model workers use.
|
|
65
|
+
# Omit this section to use the defaults (claude + sonnet).
|
|
66
|
+
# agent:
|
|
67
|
+
# command: claude # "claude" or "codex" — CLI spawned for workers
|
|
68
|
+
# model: claude-sonnet-4-5 # passed as --model flag to the CLI
|
|
69
|
+
# flags: # extra flags forwarded verbatim
|
|
70
|
+
# - --dangerously-skip-permissions
|
|
@@ -22,7 +22,7 @@ autonomy:
|
|
|
22
22
|
pulse:
|
|
23
23
|
enabled: false
|
|
24
24
|
intervalMinutes: 15
|
|
25
|
-
timezone:
|
|
25
|
+
# timezone: Asia/Bangkok # optional — defaults to machine timezone if omitted
|
|
26
26
|
activeHours: { start: "09:00", end: "22:00" }
|
|
27
27
|
budgetCapUsd: 50
|
|
28
28
|
maxIssuesPerDay: 5
|
|
@@ -51,7 +51,7 @@ slack:
|
|
|
51
51
|
|
|
52
52
|
owner:
|
|
53
53
|
name: ""
|
|
54
|
-
timezone:
|
|
54
|
+
# timezone: Asia/Bangkok # optional — defaults to machine timezone if omitted
|
|
55
55
|
slackUserId: ""
|
|
56
56
|
|
|
57
57
|
# Project goals — guide autonomous prioritization and ideation.
|
|
@@ -17,14 +17,14 @@ You NEVER write code. You NEVER modify repos directly. You ONLY scan, spawn, and
|
|
|
17
17
|
### 0. Clean Up Stale Running Entries
|
|
18
18
|
|
|
19
19
|
Before anything else, remove stale entries from `.claudius/active-builds.jsonl`
|
|
20
|
-
(entries with `startedAt` more than
|
|
20
|
+
(entries with `startedAt` more than 45 minutes ago — workers should never take longer):
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
node -e "
|
|
24
24
|
const fs = require('fs');
|
|
25
25
|
const path = '.claudius/active-builds.jsonl';
|
|
26
26
|
if (!fs.existsSync(path)) process.exit(0);
|
|
27
|
-
const cutoff = Date.now() -
|
|
27
|
+
const cutoff = Date.now() - 45 * 60 * 1000;
|
|
28
28
|
const lines = fs.readFileSync(path, 'utf8').split('\n').filter(Boolean);
|
|
29
29
|
const fresh = lines.filter(l => {
|
|
30
30
|
try { const e = JSON.parse(l); return new Date(e.startedAt).getTime() > cutoff; }
|
|
@@ -40,8 +40,8 @@ fs.writeFileSync(path, fresh.join('\n') + (fresh.length ? '\n' : ''));
|
|
|
40
40
|
cat .claudius/config.yaml
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Parse: `repos[]`, `pulse.budgetCapUsd`, `pulse.activeHours`, `pulse.timezone
|
|
44
|
-
`
|
|
43
|
+
Parse: `repos[]`, `pulse.budgetCapUsd`, `pulse.activeHours`, `pulse.timezone` (optional —
|
|
44
|
+
defaults to machine timezone via `Intl.DateTimeFormat().resolvedOptions().timeZone`).
|
|
45
45
|
|
|
46
46
|
Note: each repo's `agent.command` (default: `claude`) is read per-repo in Step 5 when spawning
|
|
47
47
|
workers — it lives in each repo's own `.claudius/config.yaml`, not the global config.
|
|
@@ -94,20 +94,16 @@ After running: `node .claude/scripts/cadence-update.mjs lastBudgetRollup`
|
|
|
94
94
|
Log a health-check entry to `.claudius/pulse-log.jsonl`. Future: check per-repo daemon status.
|
|
95
95
|
After running: `node .claude/scripts/cadence-update.mjs lastDaemonHealth`
|
|
96
96
|
|
|
97
|
-
### 3.
|
|
97
|
+
### 3. Identify Repos Ready for Workers
|
|
98
98
|
|
|
99
|
+
Load currently running repos from active-builds.jsonl:
|
|
99
100
|
```bash
|
|
100
|
-
grep '"status":"running"' .claudius/active-builds.jsonl 2>/dev/null
|
|
101
|
+
RUNNING_REPOS=$(grep '"status":"running"' .claudius/active-builds.jsonl 2>/dev/null \
|
|
102
|
+
| node -e "const lines=require('fs').readFileSync('/dev/stdin','utf8').split('\n').filter(Boolean); \
|
|
103
|
+
console.log(lines.map(l=>{try{return JSON.parse(l).repo}catch{return ''}}).filter(Boolean).join(','))")
|
|
101
104
|
```
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
If slots <= 0 → log `"all slots occupied"` and exit. Next 2-min cycle picks up.
|
|
106
|
-
|
|
107
|
-
### 4. Scan Repos for Work
|
|
108
|
-
|
|
109
|
-
For each repo in repos[] (skip repos that already have a `"running"` entry in
|
|
110
|
-
active-builds.jsonl):
|
|
106
|
+
For each repo in repos[] — **skip if it already has a running worker** (its name is in `RUNNING_REPOS`):
|
|
111
107
|
|
|
112
108
|
```bash
|
|
113
109
|
gh issue list --repo <repo.github> --label ready --json number,title,labels --limit 5
|
|
@@ -117,10 +113,12 @@ Filter out issues that carry the `codex` label — those are Codex territory. Do
|
|
|
117
113
|
|
|
118
114
|
**A repo "has work" if it has ≥ 1 ready issue WITHOUT the `codex` label.**
|
|
119
115
|
|
|
120
|
-
|
|
116
|
+
`maxConcurrentBuilds` in config is per-repo (how many issues a worker builds in parallel).
|
|
117
|
+
Sleepless spawns one worker per repo that has work — no global cap.
|
|
118
|
+
|
|
119
|
+
### 4. Spawn Workers
|
|
121
120
|
|
|
122
|
-
For each repo with work (
|
|
123
|
-
for next cycle):
|
|
121
|
+
For each repo with work (that doesn't already have a running worker):
|
|
124
122
|
|
|
125
123
|
**Track BEFORE spawning** (prevents double-spawn on fast cycles):
|
|
126
124
|
```bash
|
|
@@ -145,37 +143,58 @@ process.stdout.write(c.agent?.model ?? 'claude-sonnet-4-5');
|
|
|
145
143
|
```
|
|
146
144
|
|
|
147
145
|
**If `AGENT_COMMAND = "claude"` (default):**
|
|
148
|
-
Spawn via Bash tool —
|
|
146
|
+
Spawn via Bash tool — write prompt to a temp file to avoid shell escaping issues,
|
|
147
|
+
then `nohup` + `disown` so the worker survives after sleepless exits:
|
|
149
148
|
|
|
150
149
|
```bash
|
|
151
|
-
GLOBAL_DIR=$(pwd)
|
|
152
|
-
|
|
150
|
+
GLOBAL_DIR=$(pwd)
|
|
151
|
+
PROMPT_FILE=$(mktemp /tmp/claudius-prompt-XXXXXX)
|
|
152
|
+
cat > "$PROMPT_FILE" << 'PROMPT_EOF'
|
|
153
|
+
Claudius worker for <repo.name>. Repo: <repo.path>. Global dir: GLOBAL_DIR_PLACEHOLDER.
|
|
153
154
|
Follow .claude/agents/worker.md. One full cycle: recover stale claims → merge open PRs
|
|
154
155
|
→ pick ready issues (skip codex-labeled) → develop in parallel → review → merge → exit.
|
|
155
|
-
Clean up active-builds.jsonl entry for this repo when done. Report WORKER_OK.
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
Clean up active-builds.jsonl entry for this repo when done. Report WORKER_OK.
|
|
157
|
+
PROMPT_EOF
|
|
158
|
+
sed -i '' "s|GLOBAL_DIR_PLACEHOLDER|$GLOBAL_DIR|" "$PROMPT_FILE"
|
|
159
|
+
nohup bash -c "cd <repo.path> && cat $PROMPT_FILE | claude --print --dangerously-skip-permissions --agent worker -w; rm -f $PROMPT_FILE" \
|
|
158
160
|
> /tmp/claudius-worker-<repo.name>.log 2>&1 &
|
|
159
161
|
disown $!
|
|
160
162
|
```
|
|
161
163
|
|
|
162
164
|
**If `AGENT_COMMAND = "codex"`:**
|
|
163
165
|
```bash
|
|
164
|
-
nohup bash -c "cd <repo.path> &&
|
|
165
|
-
| codex exec -m '$AGENT_MODEL' --dangerously-bypass-approvals-and-sandbox" \
|
|
166
|
+
nohup bash -c "cd <repo.path> && cat $PROMPT_FILE | codex exec -m '$AGENT_MODEL' --dangerously-bypass-approvals-and-sandbox; rm -f $PROMPT_FILE" \
|
|
166
167
|
> /tmp/claudius-worker-<repo.name>.log 2>&1 &
|
|
167
168
|
disown $!
|
|
168
169
|
```
|
|
169
170
|
|
|
171
|
+
**Verify the spawn took hold** — wait briefly and check the log file appeared.
|
|
172
|
+
If the nohup command failed silently, remove the active-builds entry so the slot isn't wasted:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
sleep 5
|
|
176
|
+
if [ ! -f /tmp/claudius-worker-<repo.name>.log ]; then
|
|
177
|
+
echo "WARNING: worker for <repo.name> failed to start — freeing slot"
|
|
178
|
+
node -e "
|
|
179
|
+
const fs = require('fs');
|
|
180
|
+
const f = '.claudius/active-builds.jsonl';
|
|
181
|
+
if (!fs.existsSync(f)) process.exit(0);
|
|
182
|
+
const lines = fs.readFileSync(f,'utf8').split('\n').filter(Boolean);
|
|
183
|
+
const kept = lines.filter(l => { try { return JSON.parse(l).repo !== '<repo.name>'; } catch { return true; } });
|
|
184
|
+
fs.writeFileSync(f, kept.join('\n') + (kept.length ? '\n' : ''));
|
|
185
|
+
"
|
|
186
|
+
fi
|
|
187
|
+
```
|
|
188
|
+
|
|
170
189
|
`nohup` + `disown` ensures workers survive even if sleepless is killed by its job timeout.
|
|
171
190
|
The `-w` flag creates an isolated git worktree for each claude worker session.
|
|
172
191
|
|
|
173
|
-
###
|
|
192
|
+
### 5. Log and Exit
|
|
174
193
|
|
|
175
194
|
Append one line to `.claudius/pulse-log.jsonl`:
|
|
176
195
|
|
|
177
196
|
```json
|
|
178
|
-
{"timestamp":"<ISO>","type":"sleepless","reposScanned":<N>,"workersSpawned":<N>,"
|
|
197
|
+
{"timestamp":"<ISO>","type":"sleepless","reposScanned":<N>,"workersSpawned":<N>,"reposAlreadyRunning":<N>}
|
|
179
198
|
```
|
|
180
199
|
|
|
181
200
|
Exit. Cycle complete.
|
|
@@ -2,37 +2,61 @@
|
|
|
2
2
|
# project-sync.sh — sync GitHub Project #6 (Claudius Global) status from issue labels
|
|
3
3
|
# Usage: bash .claude/scripts/project-sync.sh <repo1> <repo2> ...
|
|
4
4
|
# Repos in "owner/name" format, e.g. SharadKumar/claudius
|
|
5
|
+
#
|
|
6
|
+
# Sets BOTH Status and Execution fields:
|
|
7
|
+
# ready → Status: Todo, Execution: Queued
|
|
8
|
+
# in-progress → Status: In Progress, Execution: Running
|
|
5
9
|
|
|
6
10
|
PROJECT_OWNER="SharadKumar"
|
|
7
11
|
PROJECT_NUM=6
|
|
8
12
|
PROJECT_ID="PVT_kwHOAFO-EM4BRTW5"
|
|
9
13
|
STATUS_FIELD="PVTSSF_lAHOAFO-EM4BRTW5zg_K3tE"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
EXECUTION_FIELD="PVTSSF_lAHOAFO-EM4BRTW5zg_Lokk"
|
|
15
|
+
|
|
16
|
+
# Status option IDs
|
|
17
|
+
TODO_STATUS="6ed537f9"
|
|
18
|
+
IN_PROGRESS_STATUS="0d583361"
|
|
19
|
+
|
|
20
|
+
# Execution option IDs
|
|
21
|
+
QUEUED_EXEC="f00eea4e"
|
|
22
|
+
RUNNING_EXEC="14585208"
|
|
23
|
+
|
|
24
|
+
# --- Phase 1: Prune closed + excluded items ---
|
|
25
|
+
# Paginate through ALL project items (100 per page) to find items to remove.
|
|
26
|
+
echo "[project-sync] pruning closed/excluded items..."
|
|
27
|
+
CURSOR=""
|
|
28
|
+
HAS_NEXT="true"
|
|
29
|
+
while [ "$HAS_NEXT" = "true" ]; do
|
|
30
|
+
if [ -z "$CURSOR" ]; then
|
|
31
|
+
AFTER_CLAUSE=""
|
|
32
|
+
else
|
|
33
|
+
AFTER_CLAUSE=", after: \"$CURSOR\""
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
PAGE_JSON=$(gh api graphql -f query='
|
|
37
|
+
{
|
|
38
|
+
user(login: "'"$PROJECT_OWNER"'") {
|
|
39
|
+
projectV2(number: '"$PROJECT_NUM"') {
|
|
40
|
+
items(first: 100'"$AFTER_CLAUSE"') {
|
|
41
|
+
pageInfo { hasNextPage endCursor }
|
|
42
|
+
nodes {
|
|
43
|
+
id
|
|
44
|
+
content {
|
|
45
|
+
... on Issue {
|
|
46
|
+
number
|
|
47
|
+
state
|
|
48
|
+
repository { nameWithOwner }
|
|
49
|
+
labels(first: 10) { nodes { name } }
|
|
50
|
+
}
|
|
26
51
|
}
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
54
|
}
|
|
30
55
|
}
|
|
31
|
-
}
|
|
32
|
-
}' 2>/dev/null) || { echo "[project-sync] GraphQL failed"; exit 1; }
|
|
56
|
+
}' 2>/dev/null) || { echo "[project-sync] GraphQL page failed"; break; }
|
|
33
57
|
|
|
34
|
-
# Prune codex/epic/spec items
|
|
35
|
-
echo "$
|
|
58
|
+
# Prune closed issues and codex/epic/spec items from this page
|
|
59
|
+
echo "$PAGE_JSON" | python3 - <<'PYEOF'
|
|
36
60
|
import json, subprocess, sys
|
|
37
61
|
data = json.loads(sys.stdin.read())
|
|
38
62
|
nodes = data['data']['user']['projectV2']['items']['nodes']
|
|
@@ -40,59 +64,72 @@ for item in nodes:
|
|
|
40
64
|
c = item.get('content', {})
|
|
41
65
|
if not c:
|
|
42
66
|
continue
|
|
67
|
+
# Remove closed issues — closing IS done, no board presence needed
|
|
68
|
+
if c.get('state') == 'CLOSED':
|
|
69
|
+
subprocess.run(
|
|
70
|
+
['gh', 'project', 'item-delete', '6', '--owner', 'SharadKumar', '--id', item['id']],
|
|
71
|
+
capture_output=True
|
|
72
|
+
)
|
|
73
|
+
print(f"[project-sync] pruned closed {c.get('repository',{}).get('nameWithOwner','')}#{c.get('number','')}")
|
|
74
|
+
continue
|
|
43
75
|
labels = [l['name'] for l in c.get('labels', {}).get('nodes', [])]
|
|
44
76
|
if any(l in labels for l in ['codex', 'epic', 'spec']):
|
|
45
|
-
|
|
77
|
+
subprocess.run(
|
|
46
78
|
['gh', 'project', 'item-delete', '6', '--owner', 'SharadKumar', '--id', item['id']],
|
|
47
79
|
capture_output=True
|
|
48
80
|
)
|
|
49
81
|
print(f"[project-sync] pruned {item['id']} ({c.get('repository',{}).get('nameWithOwner','')}#{c.get('number','')})")
|
|
50
82
|
PYEOF
|
|
51
83
|
|
|
52
|
-
|
|
53
|
-
get_item_id() {
|
|
54
|
-
local REPO="$1" NUM="$2"
|
|
55
|
-
echo "$ITEMS_JSON" | python3 -c "
|
|
84
|
+
HAS_NEXT=$(echo "$PAGE_JSON" | python3 -c "
|
|
56
85
|
import json, sys
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
d = json.loads(sys.stdin.read())
|
|
87
|
+
pi = d['data']['user']['projectV2']['items']['pageInfo']
|
|
88
|
+
print('true' if pi['hasNextPage'] else 'false')
|
|
89
|
+
")
|
|
90
|
+
CURSOR=$(echo "$PAGE_JSON" | python3 -c "
|
|
91
|
+
import json, sys
|
|
92
|
+
d = json.loads(sys.stdin.read())
|
|
93
|
+
print(d['data']['user']['projectV2']['items']['pageInfo']['endCursor'] or '')
|
|
94
|
+
")
|
|
95
|
+
done
|
|
66
96
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
97
|
+
# --- Phase 2: Ensure ready + in-progress issues are on the board with correct fields ---
|
|
98
|
+
# Uses gh project item-add (idempotent — returns item ID whether new or existing).
|
|
99
|
+
|
|
100
|
+
set_project_state() {
|
|
101
|
+
local REPO="$1" NUM="$2" STATUS_OPT="$3" EXEC_OPT="$4"
|
|
102
|
+
|
|
103
|
+
# item-add is idempotent — adds if missing, returns existing item ID if present
|
|
70
104
|
local ITEM_ID
|
|
71
|
-
ITEM_ID=$(
|
|
105
|
+
ITEM_ID=$(gh project item-add "$PROJECT_NUM" --owner "$PROJECT_OWNER" \
|
|
106
|
+
--url "https://github.com/$REPO/issues/$NUM" --format json --jq '.id' 2>/dev/null || echo "")
|
|
72
107
|
|
|
73
108
|
if [ -z "$ITEM_ID" ]; then
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
--url "https://github.com/$REPO/issues/$NUM" 2>/dev/null || true
|
|
77
|
-
# Re-fetch just this item's ID
|
|
78
|
-
ITEM_ID=$(gh api graphql -f query='{user(login:"'"$PROJECT_OWNER"'"){projectV2(number:'"$PROJECT_NUM"'){items(first:100){nodes{id content{...on Issue{number repository{nameWithOwner}}}}}}}}' \
|
|
79
|
-
--jq ".data.user.projectV2.items.nodes[] | select(.content.number == $NUM and .content.repository.nameWithOwner == \"$REPO\") | .id" 2>/dev/null | head -1)
|
|
109
|
+
echo "[project-sync] could not add $REPO#$NUM to project" >&2
|
|
110
|
+
return
|
|
80
111
|
fi
|
|
81
112
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
113
|
+
# Set Status field
|
|
114
|
+
gh project item-edit --id "$ITEM_ID" \
|
|
115
|
+
--project-id "$PROJECT_ID" \
|
|
116
|
+
--field-id "$STATUS_FIELD" \
|
|
117
|
+
--single-select-option-id "$STATUS_OPT" 2>/dev/null || true
|
|
118
|
+
|
|
119
|
+
# Set Execution field
|
|
120
|
+
gh project item-edit --id "$ITEM_ID" \
|
|
121
|
+
--project-id "$PROJECT_ID" \
|
|
122
|
+
--field-id "$EXECUTION_FIELD" \
|
|
123
|
+
--single-select-option-id "$EXEC_OPT" 2>/dev/null || true
|
|
124
|
+
|
|
125
|
+
echo "[project-sync] $REPO#$NUM → Status+Execution set"
|
|
89
126
|
}
|
|
90
127
|
|
|
91
128
|
# Process each repo
|
|
92
129
|
for REPO in "$@"; do
|
|
93
130
|
echo "[project-sync] scanning $REPO..."
|
|
94
131
|
|
|
95
|
-
# Ready issues → Todo
|
|
132
|
+
# Ready issues → Todo / Queued
|
|
96
133
|
gh issue list --repo "$REPO" --label ready --state open \
|
|
97
134
|
--json number,labels --limit 50 2>/dev/null \
|
|
98
135
|
| python3 -c "
|
|
@@ -103,10 +140,10 @@ for i in issues:
|
|
|
103
140
|
if not any(l in labels for l in ['codex','epic','spec']):
|
|
104
141
|
print(i['number'])
|
|
105
142
|
" | while read -r NUM; do
|
|
106
|
-
|
|
143
|
+
set_project_state "$REPO" "$NUM" "$TODO_STATUS" "$QUEUED_EXEC"
|
|
107
144
|
done
|
|
108
145
|
|
|
109
|
-
# In-progress + claude → In Progress
|
|
146
|
+
# In-progress + claude → In Progress / Running
|
|
110
147
|
gh issue list --repo "$REPO" --label in-progress --label claude --state open \
|
|
111
148
|
--json number,labels --limit 50 2>/dev/null \
|
|
112
149
|
| python3 -c "
|
|
@@ -117,7 +154,7 @@ for i in issues:
|
|
|
117
154
|
if not any(l in labels for l in ['codex','epic']):
|
|
118
155
|
print(i['number'])
|
|
119
156
|
" | while read -r NUM; do
|
|
120
|
-
|
|
157
|
+
set_project_state "$REPO" "$NUM" "$IN_PROGRESS_STATUS" "$RUNNING_EXEC"
|
|
121
158
|
done
|
|
122
159
|
done
|
|
123
160
|
|