@yancyyu/openhermit 1.6.4 → 1.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +52 -140
  2. package/bin/hermit.mjs +39 -258
  3. package/dist-renderer/assets/{ProjectEditorOverlay-BcjkdR8y.js → ProjectEditorOverlay-14yC9eQy.js} +1 -1
  4. package/dist-renderer/assets/{TeamGraphOverlay-B9PP0b_t.js → TeamGraphOverlay-RAoJDOnS.js} +1 -1
  5. package/dist-renderer/assets/{_basePickBy-CPquAmj5.js → _basePickBy-BhDOA0cG.js} +1 -1
  6. package/dist-renderer/assets/{_baseUniq-A66EsJn2.js → _baseUniq-DjjY0tMN.js} +1 -1
  7. package/dist-renderer/assets/{arc-YLxbV3Qw.js → arc-CzoaaE90.js} +1 -1
  8. package/dist-renderer/assets/{architectureDiagram-VXUJARFQ-wwpiLSwy.js → architectureDiagram-VXUJARFQ-D7ZTVCML.js} +1 -1
  9. package/dist-renderer/assets/{blockDiagram-VD42YOAC-3CHE3NYR.js → blockDiagram-VD42YOAC-DDVOvV1H.js} +1 -1
  10. package/dist-renderer/assets/{c4Diagram-YG6GDRKO-K8hDNmEC.js → c4Diagram-YG6GDRKO-CMswQy_R.js} +1 -1
  11. package/dist-renderer/assets/channel-DjoT-21b.js +1 -0
  12. package/dist-renderer/assets/{chunk-4BX2VUAB-5OabZrhH.js → chunk-4BX2VUAB-aYfdMo75.js} +1 -1
  13. package/dist-renderer/assets/{chunk-55IACEB6-v2kdM_aT.js → chunk-55IACEB6-DUhZJ0mV.js} +1 -1
  14. package/dist-renderer/assets/{chunk-B4BG7PRW-C0Ju56SH.js → chunk-B4BG7PRW-BrGjG-E6.js} +1 -1
  15. package/dist-renderer/assets/{chunk-DI55MBZ5-DPTWTKRm.js → chunk-DI55MBZ5-CfPUMKlq.js} +1 -1
  16. package/dist-renderer/assets/{chunk-FMBD7UC4-DSkYppkv.js → chunk-FMBD7UC4-BMr0Vrdu.js} +1 -1
  17. package/dist-renderer/assets/{chunk-QN33PNHL-C_4cCLCl.js → chunk-QN33PNHL-C9gTfFZV.js} +1 -1
  18. package/dist-renderer/assets/{chunk-QZHKN3VN-ojL7PmOD.js → chunk-QZHKN3VN-TTPdfwHP.js} +1 -1
  19. package/dist-renderer/assets/{chunk-TZMSLE5B-D1g7Vl_v.js → chunk-TZMSLE5B-DPh3DBqf.js} +1 -1
  20. package/dist-renderer/assets/classDiagram-2ON5EDUG-C5mL3TLG.js +1 -0
  21. package/dist-renderer/assets/classDiagram-v2-WZHVMYZB-C5mL3TLG.js +1 -0
  22. package/dist-renderer/assets/clone-cS8bapaK.js +1 -0
  23. package/dist-renderer/assets/{cose-bilkent-S5V4N54A-TJnGh924.js → cose-bilkent-S5V4N54A-BFbgRWOS.js} +1 -1
  24. package/dist-renderer/assets/{dagre-6UL2VRFP-cPgfHhoX.js → dagre-6UL2VRFP-CfXdU7Il.js} +1 -1
  25. package/dist-renderer/assets/{diagram-PSM6KHXK-BS5Y-RR6.js → diagram-PSM6KHXK-MdOyrxZl.js} +1 -1
  26. package/dist-renderer/assets/{diagram-QEK2KX5R-D9AF7AGJ.js → diagram-QEK2KX5R-DpmnBR-A.js} +1 -1
  27. package/dist-renderer/assets/{diagram-S2PKOQOG-DTFUadMS.js → diagram-S2PKOQOG-JXgp2H5I.js} +1 -1
  28. package/dist-renderer/assets/{erDiagram-Q2GNP2WA-DB_StEwC.js → erDiagram-Q2GNP2WA-CRfYO8W3.js} +1 -1
  29. package/dist-renderer/assets/{flowDiagram-NV44I4VS-DGn40aPj.js → flowDiagram-NV44I4VS-BJvmgply.js} +1 -1
  30. package/dist-renderer/assets/{ganttDiagram-JELNMOA3-9NiFCSBT.js → ganttDiagram-JELNMOA3-BLXnpZat.js} +1 -1
  31. package/dist-renderer/assets/{gitGraphDiagram-V2S2FVAM-BdveeU3c.js → gitGraphDiagram-V2S2FVAM-BKtbxazQ.js} +1 -1
  32. package/dist-renderer/assets/{graph-aQYbgTDH.js → graph-D6n4zNVe.js} +1 -1
  33. package/dist-renderer/assets/{index-DmgKTZAa.js → index-3JdA9Dab.js} +529 -524
  34. package/dist-renderer/assets/{index-CaG9mf8s.css → index-C4x095x4.css} +1 -1
  35. package/dist-renderer/assets/{index-CWqPn0NY.js → index-CVdwMXdQ.js} +1 -1
  36. package/dist-renderer/assets/{index-DyEKO6GV.js → index-CkO1A9ft.js} +1 -1
  37. package/dist-renderer/assets/{index-oyepEosi.js → index-ar0tAtBS.js} +1 -1
  38. package/dist-renderer/assets/{index-CrCHolXN.js → index-c2GABSvo.js} +1 -1
  39. package/dist-renderer/assets/{index-DiAK42nd.js → index-trDFOqz-.js} +1 -1
  40. package/dist-renderer/assets/{infoDiagram-HS3SLOUP-Dmc_xn8U.js → infoDiagram-HS3SLOUP-Bqq_toop.js} +1 -1
  41. package/dist-renderer/assets/{journeyDiagram-XKPGCS4Q-D9LJr-B5.js → journeyDiagram-XKPGCS4Q-BRQs07r0.js} +1 -1
  42. package/dist-renderer/assets/{kanban-definition-3W4ZIXB7-CjOWoNys.js → kanban-definition-3W4ZIXB7-DHQnAijJ.js} +1 -1
  43. package/dist-renderer/assets/{layout-D6GzYK4K.js → layout-BljiazG5.js} +1 -1
  44. package/dist-renderer/assets/{linear-Dt3GyUQf.js → linear-fx8cDfux.js} +1 -1
  45. package/dist-renderer/assets/{mindmap-definition-VGOIOE7T-XwY2hZr8.js → mindmap-definition-VGOIOE7T-DCfQbCFK.js} +1 -1
  46. package/dist-renderer/assets/{pieDiagram-ADFJNKIX-BU4nfYd7.js → pieDiagram-ADFJNKIX-DyAFYy6H.js} +1 -1
  47. package/dist-renderer/assets/{quadrantDiagram-AYHSOK5B-BYk6f63x.js → quadrantDiagram-AYHSOK5B-CCvqn9gd.js} +1 -1
  48. package/dist-renderer/assets/{requirementDiagram-UZGBJVZJ-kbadr_bU.js → requirementDiagram-UZGBJVZJ-JYde-Xl2.js} +1 -1
  49. package/dist-renderer/assets/{sankeyDiagram-TZEHDZUN-ZstP2Vth.js → sankeyDiagram-TZEHDZUN-C2Im6-aG.js} +1 -1
  50. package/dist-renderer/assets/{sequenceDiagram-WL72ISMW-obK_-ssz.js → sequenceDiagram-WL72ISMW-X6JGIoEB.js} +1 -1
  51. package/dist-renderer/assets/{stateDiagram-FKZM4ZOC-BgZDg0VT.js → stateDiagram-FKZM4ZOC-BJTDs8MY.js} +1 -1
  52. package/dist-renderer/assets/{stateDiagram-v2-4FDKWEC3-CMa5sz7x.js → stateDiagram-v2-4FDKWEC3-DUrYslPS.js} +1 -1
  53. package/dist-renderer/assets/{timeline-definition-IT6M3QCI-BOmCNnab.js → timeline-definition-IT6M3QCI-C7ECznev.js} +1 -1
  54. package/dist-renderer/assets/{treemap-GDKQZRPO-BU0ha0Ww.js → treemap-GDKQZRPO-BRg3Zpk4.js} +1 -1
  55. package/dist-renderer/assets/{xychartDiagram-PRI3JC2R-BzAHNASi.js → xychartDiagram-PRI3JC2R-CoZGyc2f.js} +1 -1
  56. package/dist-renderer/index.html +2 -2
  57. package/package.json +23 -17
  58. package/src/main/server.ts +179 -23
  59. package/src/main/services/teams-mvp/TaskDispatchService.ts +440 -0
  60. package/src/main/services/teams-mvp/TeamProvisioningService.ts +36 -33
  61. package/src/main/services/teams-mvp/TeamWorkspaceService.ts +2 -0
  62. package/src/renderer/components/settings/SettingsTabs.tsx +8 -2
  63. package/src/renderer/components/settings/SettingsView.tsx +4 -0
  64. package/src/renderer/components/settings/sections/GeneralSection.tsx +168 -206
  65. package/src/renderer/components/settings/sections/TaskBusSection.tsx +176 -0
  66. package/src/renderer/components/sidebar/SidebarSessions.tsx +31 -4
  67. package/src/renderer/components/team/kanban/KanbanTaskCard.tsx +37 -0
  68. package/src/renderer/components/team/messages/MessageComposer.tsx +36 -228
  69. package/src/renderer/components/team/messages/MessagesPanel.tsx +0 -3
  70. package/src/renderer/store/slices/teamSlice.ts +30 -1
  71. package/src/shared/types/team.ts +73 -0
  72. package/dist-renderer/assets/channel-BSWYOYIc.js +0 -1
  73. package/dist-renderer/assets/classDiagram-2ON5EDUG-mw4yABob.js +0 -1
  74. package/dist-renderer/assets/classDiagram-v2-WZHVMYZB-mw4yABob.js +0 -1
  75. package/dist-renderer/assets/clone-KtZfFt-o.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e6 as kp,e7 as Cp,bj as uf,dS as Np,bn as wp,bk as je,aV as bp,aW as Il,dI as _p,dL as df,dM as ff,dJ as Ip,dX as $l,aY as Hn,aZ as oe,bl as $p,bf as Pp,ba as gt,e8 as Lp,e9 as _n}from"./index-DmgKTZAa.js";import{k as Sr,j as nl,g as Ur,S as Op,w as xp,x as Dp,c as hf,v as Le,y as pf,l as Mp,z as Fp,A as Gp,B as Up,C as jp,a as mf,d as j,i as tn,r as Ye,f as dt,D as Me}from"./_baseUniq-A66EsJn2.js";import{j as rl,m as M,d as zp,f as yt,g as kr,h as B,i as il,l as jn,e as Bp}from"./_basePickBy-CPquAmj5.js";import{c as Be}from"./clone-KtZfFt-o.js";var qp=Object.prototype,Wp=qp.hasOwnProperty,ut=kp(function(t,e){if(Cp(e)||uf(e)){Np(e,Sr(e),t);return}for(var n in e)Wp.call(e,n)&&wp(t,n,e[n])});function gf(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 Ui(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 Vp(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 Kp(t,e,n,r){return nl(t,function(i,s,a){e(r,i,n(i),a)}),r}function Hp(t,e){return function(n,r){var i=je(n)?Vp:Kp,s=e?e():{};return i(n,t,Ur(r),s)}}var Yp=200;function Xp(t,e,n,r){var i=-1,s=xp,a=!0,o=t.length,c=[],l=e.length;if(!o)return c;e.length>=Yp&&(s=Dp,a=!1,e=new Op(e));e:for(;++i<o;){var u=t[i],f=u;if(u=u!==0?u:0,a&&f===f){for(var p=l;p--;)if(e[p]===f)continue e;c.push(u)}else s(e,f,r)||c.push(u)}return c}var ga=bp(function(t,e){return Il(t)?Xp(t,hf(e,1,Il,!0)):[]});function Fe(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),gf(t,e<0?0:e,r)):[]}function Ci(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),e=r-e,gf(t,0,e<0?0:e)):[]}function Jp(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 Qp(t,e){var n=!0;return nl(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Nt(t,e,n){var r=je(t)?Jp:Qp;return r(t,Ur(e))}function bt(t){return t&&t.length?t[0]:void 0}function lt(t,e){return hf(M(t,e))}var Zp=Object.prototype,em=Zp.hasOwnProperty,tm=Hp(function(t,e,n){em.call(t,n)?t[n].push(e):_p(t,n,[e])}),nm="[object String]";function tt(t){return typeof t=="string"||!je(t)&&df(t)&&ff(t)==nm}var rm=Math.max;function Qe(t,e,n,r){t=uf(t)?t:Le(t),n=n?rl(n):0;var i=t.length;return n<0&&(n=rm(i+n,0)),tt(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&pf(t,e,n)>-1}function Pl(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return pf(t,e,i)}var im="[object RegExp]";function sm(t){return df(t)&&ff(t)==im}var Ll=$l&&$l.isRegExp,nn=Ll?Ip(Ll):sm,am="Expected a function";function om(t){if(typeof t!="function")throw new TypeError(am);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 _t(t,e){if(t==null)return{};var n=Mp(Fp(t),function(r){return[r]});return e=Ur(e),zp(t,n,function(r,i){return e(r,i[0])})}function ya(t,e){var n=je(t)?Gp:Up;return n(t,om(Ur(e)))}function cm(t,e){var n;return nl(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function yf(t,e,n){var r=je(t)?jp:cm;return r(t,Ur(e))}function sl(t){return t&&t.length?mf(t):[]}function lm(t,e){return t&&t.length?mf(t,Ur(e)):[]}function We(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function kt(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function fn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"items"in t}function um(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function ni(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Tf{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){const n=this.types[e.container.$type];if(!n)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const r=n.properties[e.property]?.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 Ni(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Rf(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function vf(t){return Ni(t)&&typeof t.fullText=="string"}class Ge{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 Ge(()=>({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 ot})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=dm(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 Ge(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?ot:{done:!1,value:e(i)}})}filter(e){return new Ge(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return ot})}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 Ge(()=>({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(Us(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return ot})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Ge(()=>({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(Us(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return ot})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Ge(()=>{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 Ge(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?ot:this.nextFn(n.state)))}distinct(e){return new Ge(()=>({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 ot})}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 dm(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Us(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ef=new Ge(()=>{},()=>ot),ot=Object.freeze({done:!0,value:void 0});function he(...t){if(t.length===1){const e=t[0];if(e instanceof Ge)return e;if(Us(e))return new Ge(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Ge(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:ot)}return t.length>1?new Ge(()=>({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++];Us(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return ot}):Ef}class al extends Ge{constructor(e,n,r){super(()=>({iterators: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 ot})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var ho;(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})(ho||(ho={}));function po(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&&po(i,e))}):We(r)&&(r.$container=t,r.$containerProperty=n,e.deep&&po(r,e)))}function Ta(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Qt(t){const n=Cs(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Cs(t){for(;t.$container;)t=t.$container;return t}function Ol(t){return kt(t)?t.ref?[t.ref]:[]:fn(t)?t.items.map(e=>e.ref):[]}function ol(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new Ge(()=>({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++,xl(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)&&xl(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return ot})}function ji(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 xl(t,e){if(!e)return!0;const n=t.$cstNode?.range;return n?Om(n,e):!1}function js(t){return new Ge(()=>({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(kt(r)||fn(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(kt(s)||fn(r))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return ot})}function fm(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]=Af(i.defaultValue))}function Af(t){return Array.isArray(t)?[...t.map(Af)]:t}const at={$type:"AbstractElement",cardinality:"cardinality"};function hm(t){return Z.isInstance(t,at.$type)}const Ns={$type:"AbstractParserRule"};function zi(t){return Z.isInstance(t,Ns.$type)}const hs={$type:"AbstractRule"},At={$type:"AbstractType"},Ln={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function Ra(t){return Z.isInstance(t,Ln.$type)}const ws={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function Sf(t){return Z.isInstance(t,ws.$type)}const Dl={$type:"ArrayLiteral",elements:"elements"},Ml={$type:"ArrayType",elementType:"elementType"},On={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function zn(t){return Z.isInstance(t,On.$type)}const mo={$type:"BooleanLiteral",true:"true"};function pm(t){return Z.isInstance(t,mo.$type)}const xn={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function mm(t){return Z.isInstance(t,xn.$type)}const tr={$type:"Condition"},bs={$type:"Conjunction",left:"left",right:"right"};function gm(t){return Z.isInstance(t,bs.$type)}const Dn={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function va(t){return Z.isInstance(t,Dn.$type)}const _s={$type:"Disjunction",left:"left",right:"right"};function ym(t){return Z.isInstance(t,_s.$type)}const go={$type:"EndOfFile",cardinality:"cardinality"};function Tm(t){return Z.isInstance(t,go.$type)}const In={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"},Fl={$type:"GrammarImport",path:"path"},or={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function cl(t){return Z.isInstance(t,or.$type)}const yo={$type:"InferredType",name:"name"};function kf(t){return Z.isInstance(t,yo.$type)}const Vt={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function zs(t){return Z.isInstance(t,Vt.$type)}const qa={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"},Gl={$type:"InfixRuleOperators",precedences:"precedences"},pi={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function Rm(t){return Z.isInstance(t,pi.$type)}const mi={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Bn(t){return Z.isInstance(t,mi.$type)}const ps={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"},cr={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function vm(t){return Z.isInstance(t,cr.$type)}const To={$type:"Negation",value:"value"};function Em(t){return Z.isInstance(t,To.$type)}const Ul={$type:"NumberLiteral",value:"value"},ms={$type:"Parameter",name:"name"},Ro={$type:"ParameterReference",parameter:"parameter"};function Am(t){return Z.isInstance(t,Ro.$type)}const Lt={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function an(t){return Z.isInstance(t,Lt.$type)}const Wa={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"},lr={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function Sm(t){return Z.isInstance(t,lr.$type)}const vo={$type:"ReturnType",name:"name"};function km(t){return Z.isInstance(t,vo.$type)}const ur={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function qn(t){return Z.isInstance(t,ur.$type)}const gi={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function Cm(t){return Z.isInstance(t,gi.$type)}const jl={$type:"StringLiteral",value:"value"},dr={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Nm(t){return Z.isInstance(t,dr.$type)}const pt={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"},fr={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function wm(t){return Z.isInstance(t,fr.$type)}const dn={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function on(t){return Z.isInstance(t,dn.$type)}const hr={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function bm(t){return Z.isInstance(t,hr.$type)}const Is={$type:"Type",name:"name",type:"type"};function _m(t){return Z.isInstance(t,Is.$type)}const ri={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"},ii={$type:"TypeDefinition"},zl={$type:"UnionType",types:"types"},$s={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function Cf(t){return Z.isInstance(t,$s.$type)}const pr={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function Im(t){return Z.isInstance(t,pr.$type)}const si={$type:"ValueLiteral"},yi={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function $m(t){return Z.isInstance(t,yi.$type)}class Nf extends Tf{constructor(){super(...arguments),this.types={AbstractElement:{name:at.$type,properties:{cardinality:{name:at.cardinality}},superTypes:[]},AbstractParserRule:{name:Ns.$type,properties:{},superTypes:[hs.$type,At.$type]},AbstractRule:{name:hs.$type,properties:{},superTypes:[]},AbstractType:{name:At.$type,properties:{},superTypes:[]},Action:{name:Ln.$type,properties:{cardinality:{name:Ln.cardinality},feature:{name:Ln.feature},inferredType:{name:Ln.inferredType},operator:{name:Ln.operator},type:{name:Ln.type,referenceType:At.$type}},superTypes:[at.$type]},Alternatives:{name:ws.$type,properties:{cardinality:{name:ws.cardinality},elements:{name:ws.elements,defaultValue:[]}},superTypes:[at.$type]},ArrayLiteral:{name:Dl.$type,properties:{elements:{name:Dl.elements,defaultValue:[]}},superTypes:[si.$type]},ArrayType:{name:Ml.$type,properties:{elementType:{name:Ml.elementType}},superTypes:[ii.$type]},Assignment:{name:On.$type,properties:{cardinality:{name:On.cardinality},feature:{name:On.feature},operator:{name:On.operator},predicate:{name:On.predicate},terminal:{name:On.terminal}},superTypes:[at.$type]},BooleanLiteral:{name:mo.$type,properties:{true:{name:mo.true,defaultValue:!1}},superTypes:[tr.$type,si.$type]},CharacterRange:{name:xn.$type,properties:{cardinality:{name:xn.cardinality},left:{name:xn.left},lookahead:{name:xn.lookahead},parenthesized:{name:xn.parenthesized,defaultValue:!1},right:{name:xn.right}},superTypes:[pt.$type]},Condition:{name:tr.$type,properties:{},superTypes:[]},Conjunction:{name:bs.$type,properties:{left:{name:bs.left},right:{name:bs.right}},superTypes:[tr.$type]},CrossReference:{name:Dn.$type,properties:{cardinality:{name:Dn.cardinality},deprecatedSyntax:{name:Dn.deprecatedSyntax,defaultValue:!1},isMulti:{name:Dn.isMulti,defaultValue:!1},terminal:{name:Dn.terminal},type:{name:Dn.type,referenceType:At.$type}},superTypes:[at.$type]},Disjunction:{name:_s.$type,properties:{left:{name:_s.left},right:{name:_s.right}},superTypes:[tr.$type]},EndOfFile:{name:go.$type,properties:{cardinality:{name:go.cardinality}},superTypes:[at.$type]},Grammar:{name:In.$type,properties:{imports:{name:In.imports,defaultValue:[]},interfaces:{name:In.interfaces,defaultValue:[]},isDeclared:{name:In.isDeclared,defaultValue:!1},name:{name:In.name},rules:{name:In.rules,defaultValue:[]},types:{name:In.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:Fl.$type,properties:{path:{name:Fl.path}},superTypes:[]},Group:{name:or.$type,properties:{cardinality:{name:or.cardinality},elements:{name:or.elements,defaultValue:[]},guardCondition:{name:or.guardCondition},predicate:{name:or.predicate}},superTypes:[at.$type]},InferredType:{name:yo.$type,properties:{name:{name:yo.name}},superTypes:[At.$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:At.$type}},superTypes:[Ns.$type]},InfixRuleOperatorList:{name:qa.$type,properties:{associativity:{name:qa.associativity},operators:{name:qa.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Gl.$type,properties:{precedences:{name:Gl.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:pi.$type,properties:{attributes:{name:pi.attributes,defaultValue:[]},name:{name:pi.name},superTypes:{name:pi.superTypes,defaultValue:[],referenceType:At.$type}},superTypes:[At.$type]},Keyword:{name:mi.$type,properties:{cardinality:{name:mi.cardinality},predicate:{name:mi.predicate},value:{name:mi.value}},superTypes:[at.$type]},NamedArgument:{name:ps.$type,properties:{calledByName:{name:ps.calledByName,defaultValue:!1},parameter:{name:ps.parameter,referenceType:ms.$type},value:{name:ps.value}},superTypes:[]},NegatedToken:{name:cr.$type,properties:{cardinality:{name:cr.cardinality},lookahead:{name:cr.lookahead},parenthesized:{name:cr.parenthesized,defaultValue:!1},terminal:{name:cr.terminal}},superTypes:[pt.$type]},Negation:{name:To.$type,properties:{value:{name:To.value}},superTypes:[tr.$type]},NumberLiteral:{name:Ul.$type,properties:{value:{name:Ul.value}},superTypes:[si.$type]},Parameter:{name:ms.$type,properties:{name:{name:ms.name}},superTypes:[]},ParameterReference:{name:Ro.$type,properties:{parameter:{name:Ro.parameter,referenceType:ms.$type}},superTypes:[tr.$type]},ParserRule:{name:Lt.$type,properties:{dataType:{name:Lt.dataType},definition:{name:Lt.definition},entry:{name:Lt.entry,defaultValue:!1},fragment:{name:Lt.fragment,defaultValue:!1},inferredType:{name:Lt.inferredType},name:{name:Lt.name},parameters:{name:Lt.parameters,defaultValue:[]},returnType:{name:Lt.returnType,referenceType:At.$type}},superTypes:[Ns.$type]},ReferenceType:{name:Wa.$type,properties:{isMulti:{name:Wa.isMulti,defaultValue:!1},referenceType:{name:Wa.referenceType}},superTypes:[ii.$type]},RegexToken:{name:lr.$type,properties:{cardinality:{name:lr.cardinality},lookahead:{name:lr.lookahead},parenthesized:{name:lr.parenthesized,defaultValue:!1},regex:{name:lr.regex}},superTypes:[pt.$type]},ReturnType:{name:vo.$type,properties:{name:{name:vo.name}},superTypes:[]},RuleCall:{name:ur.$type,properties:{arguments:{name:ur.arguments,defaultValue:[]},cardinality:{name:ur.cardinality},predicate:{name:ur.predicate},rule:{name:ur.rule,referenceType:hs.$type}},superTypes:[at.$type]},SimpleType:{name:gi.$type,properties:{primitiveType:{name:gi.primitiveType},stringType:{name:gi.stringType},typeRef:{name:gi.typeRef,referenceType:At.$type}},superTypes:[ii.$type]},StringLiteral:{name:jl.$type,properties:{value:{name:jl.value}},superTypes:[si.$type]},TerminalAlternatives:{name:dr.$type,properties:{cardinality:{name:dr.cardinality},elements:{name:dr.elements,defaultValue:[]},lookahead:{name:dr.lookahead},parenthesized:{name:dr.parenthesized,defaultValue:!1}},superTypes:[pt.$type]},TerminalElement:{name:pt.$type,properties:{cardinality:{name:pt.cardinality},lookahead:{name:pt.lookahead},parenthesized:{name:pt.parenthesized,defaultValue:!1}},superTypes:[at.$type]},TerminalGroup:{name:fr.$type,properties:{cardinality:{name:fr.cardinality},elements:{name:fr.elements,defaultValue:[]},lookahead:{name:fr.lookahead},parenthesized:{name:fr.parenthesized,defaultValue:!1}},superTypes:[pt.$type]},TerminalRule:{name:dn.$type,properties:{definition:{name:dn.definition},fragment:{name:dn.fragment,defaultValue:!1},hidden:{name:dn.hidden,defaultValue:!1},name:{name:dn.name},type:{name:dn.type}},superTypes:[hs.$type]},TerminalRuleCall:{name:hr.$type,properties:{cardinality:{name:hr.cardinality},lookahead:{name:hr.lookahead},parenthesized:{name:hr.parenthesized,defaultValue:!1},rule:{name:hr.rule,referenceType:dn.$type}},superTypes:[pt.$type]},Type:{name:Is.$type,properties:{name:{name:Is.name},type:{name:Is.type}},superTypes:[At.$type]},TypeAttribute:{name:ri.$type,properties:{defaultValue:{name:ri.defaultValue},isOptional:{name:ri.isOptional,defaultValue:!1},name:{name:ri.name},type:{name:ri.type}},superTypes:[]},TypeDefinition:{name:ii.$type,properties:{},superTypes:[]},UnionType:{name:zl.$type,properties:{types:{name:zl.types,defaultValue:[]}},superTypes:[ii.$type]},UnorderedGroup:{name:$s.$type,properties:{cardinality:{name:$s.cardinality},elements:{name:$s.elements,defaultValue:[]}},superTypes:[at.$type]},UntilToken:{name:pr.$type,properties:{cardinality:{name:pr.cardinality},lookahead:{name:pr.lookahead},parenthesized:{name:pr.parenthesized,defaultValue:!1},terminal:{name:pr.terminal}},superTypes:[pt.$type]},ValueLiteral:{name:si.$type,properties:{},superTypes:[]},Wildcard:{name:yi.$type,properties:{cardinality:{name:yi.cardinality},lookahead:{name:yi.lookahead},parenthesized:{name:yi.parenthesized,defaultValue:!1}},superTypes:[pt.$type]}}}}const Z=new Nf;function Eo(t){return new al(t,e=>Ni(e)?e.content:[],{includeRoot:!0})}function Pm(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Ao(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Bs(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 Lm(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 Om(t,e){return Lm(t,e)>Xt.After}const xm=/^[\w\p{L}]$/u;function Dm(t,e){if(t){const n=Mm(t,!0);if(n&&Bl(n,e))return n;if(vf(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Bl(s,e))return s}}}}function Bl(t,e){return Rf(t)&&e.includes(t.tokenType.name)}function Mm(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 wf extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function Bi(t,e="Error: Got unexpected value."){throw new Error(e)}function W(t){return t.charCodeAt(0)}function Va(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function ai(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function nr(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Fm(){throw Error("Internal Error - Should never get here!")}function ql(t){return t.type==="Character"}const qs=[];for(let t=W("0");t<=W("9");t++)qs.push(t);const Ws=[W("_")].concat(qs);for(let t=W("a");t<=W("z");t++)Ws.push(t);for(let t=W("A");t<=W("Z");t++)Ws.push(t);const Wl=[W(" "),W("\f"),W(`
1
+ import{e6 as kp,e7 as Cp,bj as uf,dS as Np,bn as wp,bk as je,aV as bp,aW as Il,dI as _p,dL as df,dM as ff,dJ as Ip,dX as $l,aY as Hn,aZ as oe,bl as $p,bf as Pp,ba as gt,e8 as Lp,e9 as _n}from"./index-3JdA9Dab.js";import{k as Sr,j as nl,g as Ur,S as Op,w as xp,x as Dp,c as hf,v as Le,y as pf,l as Mp,z as Fp,A as Gp,B as Up,C as jp,a as mf,d as j,i as tn,r as Ye,f as dt,D as Me}from"./_baseUniq-DjjY0tMN.js";import{j as rl,m as M,d as zp,f as yt,g as kr,h as B,i as il,l as jn,e as Bp}from"./_basePickBy-BhDOA0cG.js";import{c as Be}from"./clone-cS8bapaK.js";var qp=Object.prototype,Wp=qp.hasOwnProperty,ut=kp(function(t,e){if(Cp(e)||uf(e)){Np(e,Sr(e),t);return}for(var n in e)Wp.call(e,n)&&wp(t,n,e[n])});function gf(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 Ui(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 Vp(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 Kp(t,e,n,r){return nl(t,function(i,s,a){e(r,i,n(i),a)}),r}function Hp(t,e){return function(n,r){var i=je(n)?Vp:Kp,s=e?e():{};return i(n,t,Ur(r),s)}}var Yp=200;function Xp(t,e,n,r){var i=-1,s=xp,a=!0,o=t.length,c=[],l=e.length;if(!o)return c;e.length>=Yp&&(s=Dp,a=!1,e=new Op(e));e:for(;++i<o;){var u=t[i],f=u;if(u=u!==0?u:0,a&&f===f){for(var p=l;p--;)if(e[p]===f)continue e;c.push(u)}else s(e,f,r)||c.push(u)}return c}var ga=bp(function(t,e){return Il(t)?Xp(t,hf(e,1,Il,!0)):[]});function Fe(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),gf(t,e<0?0:e,r)):[]}function Ci(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:rl(e),e=r-e,gf(t,0,e<0?0:e)):[]}function Jp(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 Qp(t,e){var n=!0;return nl(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Nt(t,e,n){var r=je(t)?Jp:Qp;return r(t,Ur(e))}function bt(t){return t&&t.length?t[0]:void 0}function lt(t,e){return hf(M(t,e))}var Zp=Object.prototype,em=Zp.hasOwnProperty,tm=Hp(function(t,e,n){em.call(t,n)?t[n].push(e):_p(t,n,[e])}),nm="[object String]";function tt(t){return typeof t=="string"||!je(t)&&df(t)&&ff(t)==nm}var rm=Math.max;function Qe(t,e,n,r){t=uf(t)?t:Le(t),n=n?rl(n):0;var i=t.length;return n<0&&(n=rm(i+n,0)),tt(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&pf(t,e,n)>-1}function Pl(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return pf(t,e,i)}var im="[object RegExp]";function sm(t){return df(t)&&ff(t)==im}var Ll=$l&&$l.isRegExp,nn=Ll?Ip(Ll):sm,am="Expected a function";function om(t){if(typeof t!="function")throw new TypeError(am);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 _t(t,e){if(t==null)return{};var n=Mp(Fp(t),function(r){return[r]});return e=Ur(e),zp(t,n,function(r,i){return e(r,i[0])})}function ya(t,e){var n=je(t)?Gp:Up;return n(t,om(Ur(e)))}function cm(t,e){var n;return nl(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function yf(t,e,n){var r=je(t)?jp:cm;return r(t,Ur(e))}function sl(t){return t&&t.length?mf(t):[]}function lm(t,e){return t&&t.length?mf(t,Ur(e)):[]}function We(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function kt(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function fn(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"items"in t}function um(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function ni(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Tf{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){const n=this.types[e.container.$type];if(!n)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const r=n.properties[e.property]?.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 Ni(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Rf(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function vf(t){return Ni(t)&&typeof t.fullText=="string"}class Ge{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 Ge(()=>({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 ot})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=dm(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 Ge(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?ot:{done:!1,value:e(i)}})}filter(e){return new Ge(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return ot})}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 Ge(()=>({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(Us(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return ot})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new Ge(()=>({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(Us(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return ot})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new Ge(()=>{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 Ge(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?ot:this.nextFn(n.state)))}distinct(e){return new Ge(()=>({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 ot})}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 dm(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function Us(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ef=new Ge(()=>{},()=>ot),ot=Object.freeze({done:!0,value:void 0});function he(...t){if(t.length===1){const e=t[0];if(e instanceof Ge)return e;if(Us(e))return new Ge(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new Ge(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:ot)}return t.length>1?new Ge(()=>({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++];Us(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return ot}):Ef}class al extends Ge{constructor(e,n,r){super(()=>({iterators: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 ot})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var ho;(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})(ho||(ho={}));function po(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&&po(i,e))}):We(r)&&(r.$container=t,r.$containerProperty=n,e.deep&&po(r,e)))}function Ta(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Qt(t){const n=Cs(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Cs(t){for(;t.$container;)t=t.$container;return t}function Ol(t){return kt(t)?t.ref?[t.ref]:[]:fn(t)?t.items.map(e=>e.ref):[]}function ol(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new Ge(()=>({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++,xl(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)&&xl(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return ot})}function ji(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 xl(t,e){if(!e)return!0;const n=t.$cstNode?.range;return n?Om(n,e):!1}function js(t){return new Ge(()=>({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(kt(r)||fn(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(kt(s)||fn(r))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return ot})}function fm(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]=Af(i.defaultValue))}function Af(t){return Array.isArray(t)?[...t.map(Af)]:t}const at={$type:"AbstractElement",cardinality:"cardinality"};function hm(t){return Z.isInstance(t,at.$type)}const Ns={$type:"AbstractParserRule"};function zi(t){return Z.isInstance(t,Ns.$type)}const hs={$type:"AbstractRule"},At={$type:"AbstractType"},Ln={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};function Ra(t){return Z.isInstance(t,Ln.$type)}const ws={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};function Sf(t){return Z.isInstance(t,ws.$type)}const Dl={$type:"ArrayLiteral",elements:"elements"},Ml={$type:"ArrayType",elementType:"elementType"},On={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};function zn(t){return Z.isInstance(t,On.$type)}const mo={$type:"BooleanLiteral",true:"true"};function pm(t){return Z.isInstance(t,mo.$type)}const xn={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};function mm(t){return Z.isInstance(t,xn.$type)}const tr={$type:"Condition"},bs={$type:"Conjunction",left:"left",right:"right"};function gm(t){return Z.isInstance(t,bs.$type)}const Dn={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};function va(t){return Z.isInstance(t,Dn.$type)}const _s={$type:"Disjunction",left:"left",right:"right"};function ym(t){return Z.isInstance(t,_s.$type)}const go={$type:"EndOfFile",cardinality:"cardinality"};function Tm(t){return Z.isInstance(t,go.$type)}const In={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"},Fl={$type:"GrammarImport",path:"path"},or={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};function cl(t){return Z.isInstance(t,or.$type)}const yo={$type:"InferredType",name:"name"};function kf(t){return Z.isInstance(t,yo.$type)}const Vt={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};function zs(t){return Z.isInstance(t,Vt.$type)}const qa={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"},Gl={$type:"InfixRuleOperators",precedences:"precedences"},pi={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};function Rm(t){return Z.isInstance(t,pi.$type)}const mi={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};function Bn(t){return Z.isInstance(t,mi.$type)}const ps={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"},cr={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function vm(t){return Z.isInstance(t,cr.$type)}const To={$type:"Negation",value:"value"};function Em(t){return Z.isInstance(t,To.$type)}const Ul={$type:"NumberLiteral",value:"value"},ms={$type:"Parameter",name:"name"},Ro={$type:"ParameterReference",parameter:"parameter"};function Am(t){return Z.isInstance(t,Ro.$type)}const Lt={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};function an(t){return Z.isInstance(t,Lt.$type)}const Wa={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"},lr={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};function Sm(t){return Z.isInstance(t,lr.$type)}const vo={$type:"ReturnType",name:"name"};function km(t){return Z.isInstance(t,vo.$type)}const ur={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};function qn(t){return Z.isInstance(t,ur.$type)}const gi={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};function Cm(t){return Z.isInstance(t,gi.$type)}const jl={$type:"StringLiteral",value:"value"},dr={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function Nm(t){return Z.isInstance(t,dr.$type)}const pt={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"},fr={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};function wm(t){return Z.isInstance(t,fr.$type)}const dn={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};function on(t){return Z.isInstance(t,dn.$type)}const hr={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};function bm(t){return Z.isInstance(t,hr.$type)}const Is={$type:"Type",name:"name",type:"type"};function _m(t){return Z.isInstance(t,Is.$type)}const ri={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"},ii={$type:"TypeDefinition"},zl={$type:"UnionType",types:"types"},$s={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};function Cf(t){return Z.isInstance(t,$s.$type)}const pr={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};function Im(t){return Z.isInstance(t,pr.$type)}const si={$type:"ValueLiteral"},yi={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};function $m(t){return Z.isInstance(t,yi.$type)}class Nf extends Tf{constructor(){super(...arguments),this.types={AbstractElement:{name:at.$type,properties:{cardinality:{name:at.cardinality}},superTypes:[]},AbstractParserRule:{name:Ns.$type,properties:{},superTypes:[hs.$type,At.$type]},AbstractRule:{name:hs.$type,properties:{},superTypes:[]},AbstractType:{name:At.$type,properties:{},superTypes:[]},Action:{name:Ln.$type,properties:{cardinality:{name:Ln.cardinality},feature:{name:Ln.feature},inferredType:{name:Ln.inferredType},operator:{name:Ln.operator},type:{name:Ln.type,referenceType:At.$type}},superTypes:[at.$type]},Alternatives:{name:ws.$type,properties:{cardinality:{name:ws.cardinality},elements:{name:ws.elements,defaultValue:[]}},superTypes:[at.$type]},ArrayLiteral:{name:Dl.$type,properties:{elements:{name:Dl.elements,defaultValue:[]}},superTypes:[si.$type]},ArrayType:{name:Ml.$type,properties:{elementType:{name:Ml.elementType}},superTypes:[ii.$type]},Assignment:{name:On.$type,properties:{cardinality:{name:On.cardinality},feature:{name:On.feature},operator:{name:On.operator},predicate:{name:On.predicate},terminal:{name:On.terminal}},superTypes:[at.$type]},BooleanLiteral:{name:mo.$type,properties:{true:{name:mo.true,defaultValue:!1}},superTypes:[tr.$type,si.$type]},CharacterRange:{name:xn.$type,properties:{cardinality:{name:xn.cardinality},left:{name:xn.left},lookahead:{name:xn.lookahead},parenthesized:{name:xn.parenthesized,defaultValue:!1},right:{name:xn.right}},superTypes:[pt.$type]},Condition:{name:tr.$type,properties:{},superTypes:[]},Conjunction:{name:bs.$type,properties:{left:{name:bs.left},right:{name:bs.right}},superTypes:[tr.$type]},CrossReference:{name:Dn.$type,properties:{cardinality:{name:Dn.cardinality},deprecatedSyntax:{name:Dn.deprecatedSyntax,defaultValue:!1},isMulti:{name:Dn.isMulti,defaultValue:!1},terminal:{name:Dn.terminal},type:{name:Dn.type,referenceType:At.$type}},superTypes:[at.$type]},Disjunction:{name:_s.$type,properties:{left:{name:_s.left},right:{name:_s.right}},superTypes:[tr.$type]},EndOfFile:{name:go.$type,properties:{cardinality:{name:go.cardinality}},superTypes:[at.$type]},Grammar:{name:In.$type,properties:{imports:{name:In.imports,defaultValue:[]},interfaces:{name:In.interfaces,defaultValue:[]},isDeclared:{name:In.isDeclared,defaultValue:!1},name:{name:In.name},rules:{name:In.rules,defaultValue:[]},types:{name:In.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:Fl.$type,properties:{path:{name:Fl.path}},superTypes:[]},Group:{name:or.$type,properties:{cardinality:{name:or.cardinality},elements:{name:or.elements,defaultValue:[]},guardCondition:{name:or.guardCondition},predicate:{name:or.predicate}},superTypes:[at.$type]},InferredType:{name:yo.$type,properties:{name:{name:yo.name}},superTypes:[At.$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:At.$type}},superTypes:[Ns.$type]},InfixRuleOperatorList:{name:qa.$type,properties:{associativity:{name:qa.associativity},operators:{name:qa.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:Gl.$type,properties:{precedences:{name:Gl.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:pi.$type,properties:{attributes:{name:pi.attributes,defaultValue:[]},name:{name:pi.name},superTypes:{name:pi.superTypes,defaultValue:[],referenceType:At.$type}},superTypes:[At.$type]},Keyword:{name:mi.$type,properties:{cardinality:{name:mi.cardinality},predicate:{name:mi.predicate},value:{name:mi.value}},superTypes:[at.$type]},NamedArgument:{name:ps.$type,properties:{calledByName:{name:ps.calledByName,defaultValue:!1},parameter:{name:ps.parameter,referenceType:ms.$type},value:{name:ps.value}},superTypes:[]},NegatedToken:{name:cr.$type,properties:{cardinality:{name:cr.cardinality},lookahead:{name:cr.lookahead},parenthesized:{name:cr.parenthesized,defaultValue:!1},terminal:{name:cr.terminal}},superTypes:[pt.$type]},Negation:{name:To.$type,properties:{value:{name:To.value}},superTypes:[tr.$type]},NumberLiteral:{name:Ul.$type,properties:{value:{name:Ul.value}},superTypes:[si.$type]},Parameter:{name:ms.$type,properties:{name:{name:ms.name}},superTypes:[]},ParameterReference:{name:Ro.$type,properties:{parameter:{name:Ro.parameter,referenceType:ms.$type}},superTypes:[tr.$type]},ParserRule:{name:Lt.$type,properties:{dataType:{name:Lt.dataType},definition:{name:Lt.definition},entry:{name:Lt.entry,defaultValue:!1},fragment:{name:Lt.fragment,defaultValue:!1},inferredType:{name:Lt.inferredType},name:{name:Lt.name},parameters:{name:Lt.parameters,defaultValue:[]},returnType:{name:Lt.returnType,referenceType:At.$type}},superTypes:[Ns.$type]},ReferenceType:{name:Wa.$type,properties:{isMulti:{name:Wa.isMulti,defaultValue:!1},referenceType:{name:Wa.referenceType}},superTypes:[ii.$type]},RegexToken:{name:lr.$type,properties:{cardinality:{name:lr.cardinality},lookahead:{name:lr.lookahead},parenthesized:{name:lr.parenthesized,defaultValue:!1},regex:{name:lr.regex}},superTypes:[pt.$type]},ReturnType:{name:vo.$type,properties:{name:{name:vo.name}},superTypes:[]},RuleCall:{name:ur.$type,properties:{arguments:{name:ur.arguments,defaultValue:[]},cardinality:{name:ur.cardinality},predicate:{name:ur.predicate},rule:{name:ur.rule,referenceType:hs.$type}},superTypes:[at.$type]},SimpleType:{name:gi.$type,properties:{primitiveType:{name:gi.primitiveType},stringType:{name:gi.stringType},typeRef:{name:gi.typeRef,referenceType:At.$type}},superTypes:[ii.$type]},StringLiteral:{name:jl.$type,properties:{value:{name:jl.value}},superTypes:[si.$type]},TerminalAlternatives:{name:dr.$type,properties:{cardinality:{name:dr.cardinality},elements:{name:dr.elements,defaultValue:[]},lookahead:{name:dr.lookahead},parenthesized:{name:dr.parenthesized,defaultValue:!1}},superTypes:[pt.$type]},TerminalElement:{name:pt.$type,properties:{cardinality:{name:pt.cardinality},lookahead:{name:pt.lookahead},parenthesized:{name:pt.parenthesized,defaultValue:!1}},superTypes:[at.$type]},TerminalGroup:{name:fr.$type,properties:{cardinality:{name:fr.cardinality},elements:{name:fr.elements,defaultValue:[]},lookahead:{name:fr.lookahead},parenthesized:{name:fr.parenthesized,defaultValue:!1}},superTypes:[pt.$type]},TerminalRule:{name:dn.$type,properties:{definition:{name:dn.definition},fragment:{name:dn.fragment,defaultValue:!1},hidden:{name:dn.hidden,defaultValue:!1},name:{name:dn.name},type:{name:dn.type}},superTypes:[hs.$type]},TerminalRuleCall:{name:hr.$type,properties:{cardinality:{name:hr.cardinality},lookahead:{name:hr.lookahead},parenthesized:{name:hr.parenthesized,defaultValue:!1},rule:{name:hr.rule,referenceType:dn.$type}},superTypes:[pt.$type]},Type:{name:Is.$type,properties:{name:{name:Is.name},type:{name:Is.type}},superTypes:[At.$type]},TypeAttribute:{name:ri.$type,properties:{defaultValue:{name:ri.defaultValue},isOptional:{name:ri.isOptional,defaultValue:!1},name:{name:ri.name},type:{name:ri.type}},superTypes:[]},TypeDefinition:{name:ii.$type,properties:{},superTypes:[]},UnionType:{name:zl.$type,properties:{types:{name:zl.types,defaultValue:[]}},superTypes:[ii.$type]},UnorderedGroup:{name:$s.$type,properties:{cardinality:{name:$s.cardinality},elements:{name:$s.elements,defaultValue:[]}},superTypes:[at.$type]},UntilToken:{name:pr.$type,properties:{cardinality:{name:pr.cardinality},lookahead:{name:pr.lookahead},parenthesized:{name:pr.parenthesized,defaultValue:!1},terminal:{name:pr.terminal}},superTypes:[pt.$type]},ValueLiteral:{name:si.$type,properties:{},superTypes:[]},Wildcard:{name:yi.$type,properties:{cardinality:{name:yi.cardinality},lookahead:{name:yi.lookahead},parenthesized:{name:yi.parenthesized,defaultValue:!1}},superTypes:[pt.$type]}}}}const Z=new Nf;function Eo(t){return new al(t,e=>Ni(e)?e.content:[],{includeRoot:!0})}function Pm(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Ao(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Bs(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 Lm(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 Om(t,e){return Lm(t,e)>Xt.After}const xm=/^[\w\p{L}]$/u;function Dm(t,e){if(t){const n=Mm(t,!0);if(n&&Bl(n,e))return n;if(vf(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Bl(s,e))return s}}}}function Bl(t,e){return Rf(t)&&e.includes(t.tokenType.name)}function Mm(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 wf extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function Bi(t,e="Error: Got unexpected value."){throw new Error(e)}function W(t){return t.charCodeAt(0)}function Va(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function ai(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function nr(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Fm(){throw Error("Internal Error - Should never get here!")}function ql(t){return t.type==="Character"}const qs=[];for(let t=W("0");t<=W("9");t++)qs.push(t);const Ws=[W("_")].concat(qs);for(let t=W("a");t<=W("z");t++)Ws.push(t);for(let t=W("A");t<=W("Z");t++)Ws.push(t);const Wl=[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")],Gm=/[0-9a-fA-F]/,gs=/[0-9]/,Um=/[1-9]/;class bf{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":ai(r,"global");break;case"i":ai(r,"ignoreCase");break;case"m":ai(r,"multiLine");break;case"u":ai(r,"unicode");break;case"y":ai(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}}nr(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return Fm()}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;nr(n);break}if(!(e===!0&&n===void 0)&&nr(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()),nr(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=qs;break;case"D":e=qs,n=!0;break;case"s":e=Wl;break;case"S":e=Wl,n=!0;break;case"w":e=Ws;break;case"W":e=Ws,n=!0;break}if(nr(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(nr(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{_ as a,A as ei,B as si,Z as Lt,Y as ni,C as ai,D as ri,I as Et,ae as oi,J as hi,a3 as li,ab as xt,aa as It,ac as ci,av as ui,N as gi,b7 as xi,aD as Tt}from"./index-DmgKTZAa.js";import{i as di}from"./init-Gi6I4Gst.js";import{o as fi}from"./ordinal-Cboi1Yqb.js";import{l as Dt}from"./linear-Dt3GyUQf.js";import"./splashScene-C8lWNnm4.js";import"./defaultLocale-DX6XiGOO.js";function pi(t,i,e){t=+t,i=+i,e=(n=arguments.length)<2?(i=t,t=0,1):n<3?1:+e;for(var s=-1,n=Math.max(0,Math.ceil((i-t)/e))|0,x=new Array(n);++s<n;)x[s]=t+s*e;return x}function ht(){var t=fi().unknown(void 0),i=t.domain,e=t.range,s=0,n=1,x,g,m=!1,S=0,D=0,v=.5;delete t.unknown;function w(){var y=i().length,E=n<s,T=E?n:s,P=E?s:n;x=(P-T)/Math.max(1,y-S+D*2),m&&(x=Math.floor(x)),T+=(P-T-x*(y-S))*v,g=x*(1-S),m&&(T=Math.round(T),g=Math.round(g));var I=pi(y).map(function(p){return T+x*p});return e(E?I.reverse():I)}return t.domain=function(y){return arguments.length?(i(y),w()):i()},t.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,w()):[s,n]},t.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,m=!0,w()},t.bandwidth=function(){return g},t.step=function(){return x},t.round=function(y){return arguments.length?(m=!!y,w()):m},t.padding=function(y){return arguments.length?(S=Math.min(1,D=+y),w()):S},t.paddingInner=function(y){return arguments.length?(S=Math.min(1,y),w()):S},t.paddingOuter=function(y){return arguments.length?(D=+y,w()):D},t.align=function(y){return arguments.length?(v=Math.max(0,Math.min(1,y)),w()):v},t.copy=function(){return ht(i(),[s,n]).round(m).paddingInner(S).paddingOuter(D).align(v)},di.apply(w(),arguments)}var lt=function(){var t=a(function(O,o,c,u){for(c=c||{},u=O.length;u--;c[O[u]]=o);return c},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],n=[1,5],x=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],S=[1,25],D=[1,26],v=[1,28],w=[1,29],y=[1,30],E=[1,31],T=[1,32],P=[1,33],I=[1,34],p=[1,35],_=[1,36],l=[1,37],W=[1,43],z=[1,42],U=[1,47],X=[1,50],h=[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],C=[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],k=[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(o,c,u,d,A,r,j){var f=r.length-1;switch(A){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:[t(i,e,{3:1,4:2,7:4,5:s,34:n,35:x,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:n,35:x,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:x,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]},t(m,[2,34]),t(m,[2,35]),t(m,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:n,35:x,36:g}),{1:[2,3]},t(m,[2,5]),t(i,[2,7],{4:22,34:n,35:x,36:g}),{11:23,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:39,13:38,24:W,27:z,29:40,30:41,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:45,15:44,27:U,33:46,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:49,17:48,24:X,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:52,17:51,24:X,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{20:[1,53]},{22:[1,54]},t(h,[2,18]),{1:[2,2]},t(h,[2,8]),t(h,[2,9]),t(L,[2,37],{40:55,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l}),t(L,[2,38]),t(L,[2,39]),t(C,[2,40]),t(C,[2,42]),t(C,[2,43]),t(C,[2,44]),t(C,[2,45]),t(C,[2,46]),t(C,[2,47]),t(C,[2,48]),t(C,[2,49]),t(C,[2,50]),t(C,[2,51]),t(h,[2,10]),t(h,[2,22],{30:41,29:56,24:W,27:z}),t(h,[2,24]),t(h,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},t(h,[2,11]),t(h,[2,30],{33:60,27:U}),t(h,[2,32]),{31:[1,61]},t(h,[2,12]),{17:62,24:X},{25:63,27:k},t(h,[2,14]),{17:65,24:X},t(h,[2,16]),t(h,[2,17]),t(C,[2,41]),t(h,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(h,[2,31]),{27:[1,69]},t(h,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(h,[2,15]),t(h,[2,26]),t(h,[2,27]),{11:59,32:72,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},t(h,[2,33]),t(h,[2,19]),{25:73,27:k},{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(o,c){if(c.recoverable)this.trace(o);else{var u=new Error(o);throw u.hash=c,u}},"parseError"),parse:a(function(o){var c=this,u=[0],d=[],A=[null],r=[],j=this.table,f="",J=0,St=0,Zt=2,_t=1,Jt=r.slice.call(arguments,1),R=Object.create(this.lexer),Y={yy:{}};for(var nt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,nt)&&(Y.yy[nt]=this.yy[nt]);R.setInput(o,Y.yy),Y.yy.lexer=R,Y.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var at=R.yylloc;r.push(at);var ti=R.options&&R.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ii(V){u.length=u.length-2*V,A.length=A.length-V,r.length=r.length-V}a(ii,"popStack");function kt(){var V;return V=d.pop()||R.lex()||_t,typeof V!="number"&&(V instanceof Array&&(d=V,V=d.pop()),V=c.symbols_[V]||V),V}a(kt,"lex");for(var M,H,B,rt,q={},tt,F,Rt,it;;){if(H=u[u.length-1],this.defaultActions[H]?B=this.defaultActions[H]:((M===null||typeof M>"u")&&(M=kt()),B=j[H]&&j[H][M]),typeof B>"u"||!B.length||!B[0]){var ot="";it=[];for(tt in j[H])this.terminals_[tt]&&tt>Zt&&it.push("'"+this.terminals_[tt]+"'");R.showPosition?ot="Parse error on line "+(J+1)+`:
1
+ import{_ as a,A as ei,B as si,Z as Lt,Y as ni,C as ai,D as ri,I as Et,ae as oi,J as hi,a3 as li,ab as xt,aa as It,ac as ci,av as ui,N as gi,b7 as xi,aD as Tt}from"./index-3JdA9Dab.js";import{i as di}from"./init-Gi6I4Gst.js";import{o as fi}from"./ordinal-Cboi1Yqb.js";import{l as Dt}from"./linear-fx8cDfux.js";import"./splashScene-C8lWNnm4.js";import"./defaultLocale-DX6XiGOO.js";function pi(t,i,e){t=+t,i=+i,e=(n=arguments.length)<2?(i=t,t=0,1):n<3?1:+e;for(var s=-1,n=Math.max(0,Math.ceil((i-t)/e))|0,x=new Array(n);++s<n;)x[s]=t+s*e;return x}function ht(){var t=fi().unknown(void 0),i=t.domain,e=t.range,s=0,n=1,x,g,m=!1,S=0,D=0,v=.5;delete t.unknown;function w(){var y=i().length,E=n<s,T=E?n:s,P=E?s:n;x=(P-T)/Math.max(1,y-S+D*2),m&&(x=Math.floor(x)),T+=(P-T-x*(y-S))*v,g=x*(1-S),m&&(T=Math.round(T),g=Math.round(g));var I=pi(y).map(function(p){return T+x*p});return e(E?I.reverse():I)}return t.domain=function(y){return arguments.length?(i(y),w()):i()},t.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,w()):[s,n]},t.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,m=!0,w()},t.bandwidth=function(){return g},t.step=function(){return x},t.round=function(y){return arguments.length?(m=!!y,w()):m},t.padding=function(y){return arguments.length?(S=Math.min(1,D=+y),w()):S},t.paddingInner=function(y){return arguments.length?(S=Math.min(1,y),w()):S},t.paddingOuter=function(y){return arguments.length?(D=+y,w()):D},t.align=function(y){return arguments.length?(v=Math.max(0,Math.min(1,y)),w()):v},t.copy=function(){return ht(i(),[s,n]).round(m).paddingInner(S).paddingOuter(D).align(v)},di.apply(w(),arguments)}var lt=function(){var t=a(function(O,o,c,u){for(c=c||{},u=O.length;u--;c[O[u]]=o);return c},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],n=[1,5],x=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],S=[1,25],D=[1,26],v=[1,28],w=[1,29],y=[1,30],E=[1,31],T=[1,32],P=[1,33],I=[1,34],p=[1,35],_=[1,36],l=[1,37],W=[1,43],z=[1,42],U=[1,47],X=[1,50],h=[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],C=[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],k=[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(o,c,u,d,A,r,j){var f=r.length-1;switch(A){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:[t(i,e,{3:1,4:2,7:4,5:s,34:n,35:x,36:g}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:n,35:x,36:g}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:x,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]},t(m,[2,34]),t(m,[2,35]),t(m,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:n,35:x,36:g}),{1:[2,3]},t(m,[2,5]),t(i,[2,7],{4:22,34:n,35:x,36:g}),{11:23,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:39,13:38,24:W,27:z,29:40,30:41,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:45,15:44,27:U,33:46,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:49,17:48,24:X,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{11:52,17:51,24:X,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},{20:[1,53]},{22:[1,54]},t(h,[2,18]),{1:[2,2]},t(h,[2,8]),t(h,[2,9]),t(L,[2,37],{40:55,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l}),t(L,[2,38]),t(L,[2,39]),t(C,[2,40]),t(C,[2,42]),t(C,[2,43]),t(C,[2,44]),t(C,[2,45]),t(C,[2,46]),t(C,[2,47]),t(C,[2,48]),t(C,[2,49]),t(C,[2,50]),t(C,[2,51]),t(h,[2,10]),t(h,[2,22],{30:41,29:56,24:W,27:z}),t(h,[2,24]),t(h,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},t(h,[2,11]),t(h,[2,30],{33:60,27:U}),t(h,[2,32]),{31:[1,61]},t(h,[2,12]),{17:62,24:X},{25:63,27:k},t(h,[2,14]),{17:65,24:X},t(h,[2,16]),t(h,[2,17]),t(C,[2,41]),t(h,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(h,[2,31]),{27:[1,69]},t(h,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(h,[2,15]),t(h,[2,26]),t(h,[2,27]),{11:59,32:72,37:24,38:S,39:D,40:27,41:v,42:w,43:y,44:E,45:T,46:P,47:I,48:p,49:_,50:l},t(h,[2,33]),t(h,[2,19]),{25:73,27:k},{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(o,c){if(c.recoverable)this.trace(o);else{var u=new Error(o);throw u.hash=c,u}},"parseError"),parse:a(function(o){var c=this,u=[0],d=[],A=[null],r=[],j=this.table,f="",J=0,St=0,Zt=2,_t=1,Jt=r.slice.call(arguments,1),R=Object.create(this.lexer),Y={yy:{}};for(var nt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,nt)&&(Y.yy[nt]=this.yy[nt]);R.setInput(o,Y.yy),Y.yy.lexer=R,Y.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var at=R.yylloc;r.push(at);var ti=R.options&&R.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ii(V){u.length=u.length-2*V,A.length=A.length-V,r.length=r.length-V}a(ii,"popStack");function kt(){var V;return V=d.pop()||R.lex()||_t,typeof V!="number"&&(V instanceof Array&&(d=V,V=d.pop()),V=c.symbols_[V]||V),V}a(kt,"lex");for(var M,H,B,rt,q={},tt,F,Rt,it;;){if(H=u[u.length-1],this.defaultActions[H]?B=this.defaultActions[H]:((M===null||typeof M>"u")&&(M=kt()),B=j[H]&&j[H][M]),typeof B>"u"||!B.length||!B[0]){var ot="";it=[];for(tt in j[H])this.terminals_[tt]&&tt>Zt&&it.push("'"+this.terminals_[tt]+"'");R.showPosition?ot="Parse error on line "+(J+1)+`:
2
2
  `+R.showPosition()+`
3
3
  Expecting `+it.join(", ")+", got '"+(this.terminals_[M]||M)+"'":ot="Parse error on line "+(J+1)+": Unexpected "+(M==_t?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(ot,{text:R.match,token:this.terminals_[M]||M,line:R.yylineno,loc:at,expected:it})}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:u.push(M),A.push(R.yytext),r.push(R.yylloc),u.push(B[1]),M=null,St=R.yyleng,f=R.yytext,J=R.yylineno,at=R.yylloc;break;case 2:if(F=this.productions_[B[1]][1],q.$=A[A.length-F],q._$={first_line:r[r.length-(F||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(F||1)].first_column,last_column:r[r.length-1].last_column},ti&&(q._$.range=[r[r.length-(F||1)].range[0],r[r.length-1].range[1]]),rt=this.performAction.apply(q,[f,St,J,Y.yy,B[1],A,r].concat(Jt)),typeof rt<"u")return rt;F&&(u=u.slice(0,-1*F*2),A=A.slice(0,-1*F),r=r.slice(0,-1*F)),u.push(this.productions_[B[1]][0]),A.push(q.$),r.push(q._$),Rt=j[u[u.length-2]][u[u.length-1]],u.push(Rt);break;case 3:return!0}}return!0},"parse")},Ct=function(){var O={EOF:1,parseError:a(function(c,u){if(this.yy.parser)this.yy.parser.parseError(c,u);else throw new Error(c)},"parseError"),setInput:a(function(o,c){return this.yy=c||this.yy||{},this._input=o,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 o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var c=o.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:a(function(o){var c=o.length,u=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;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),u.length-1&&(this.yylineno-=u.length-1);var A=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:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-c]),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(o){this.unput(this.match.slice(o))},"less"),pastInput:a(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var o=this.pastInput(),c=new Array(o.length+1).join("-");return o+this.upcomingInput()+`
@@ -353,9 +353,9 @@
353
353
  } catch (e) {}
354
354
  })();
355
355
  </script>
356
- <script type="module" crossorigin src="/assets/index-DmgKTZAa.js"></script>
356
+ <script type="module" crossorigin src="/assets/index-3JdA9Dab.js"></script>
357
357
  <link rel="modulepreload" crossorigin href="/assets/splashScene-C8lWNnm4.js">
358
- <link rel="stylesheet" crossorigin href="/assets/index-CaG9mf8s.css">
358
+ <link rel="stylesheet" crossorigin href="/assets/index-C4x095x4.css">
359
359
  </head>
360
360
  <body>
361
361
  <div id="splash">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yancyyu/openhermit",
3
3
  "type": "module",
4
- "version": "1.6.4",
4
+ "version": "1.6.5",
5
5
  "description": "openHermit: team-oriented agent management workbench atop cc-connect.",
6
6
  "license": "AGPL-3.0",
7
7
  "author": {
@@ -29,6 +29,23 @@
29
29
  "package.json",
30
30
  "README.md"
31
31
  ],
32
+ "scripts": {
33
+ "dev": "node ./scripts/dev-mvp.mjs",
34
+ "dev:server": "tsx watch src/main/server.ts",
35
+ "dev:web": "vite --config vite.web.config.ts",
36
+ "build:web": "vite build --config vite.web.config.ts --outDir ../../dist-renderer --emptyOutDir",
37
+ "prepack": "pnpm build:web",
38
+ "start": "node bin/hermit.mjs",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src/ --cache --cache-location .eslintcache --cache-strategy content",
41
+ "lint:fix": "eslint src/ --fix --cache --cache-location .eslintcache --cache-strategy content",
42
+ "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
43
+ "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "test:coverage": "vitest run --coverage",
47
+ "prepare": "husky"
48
+ },
32
49
  "lint-staged": {
33
50
  "src/**/*.{ts,tsx,js,jsx}": [
34
51
  "prettier --write"
@@ -126,6 +143,9 @@
126
143
  "yet-another-react-lightbox": "^3.29.1",
127
144
  "zustand": "^4.5.0"
128
145
  },
146
+ "optionalDependencies": {
147
+ "ioredis": "^5.6.1"
148
+ },
129
149
  "devDependencies": {
130
150
  "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
131
151
  "@eslint/js": "^9.39.2",
@@ -164,19 +184,5 @@
164
184
  "vite": "^5.4.2",
165
185
  "vitest": "^3.1.4"
166
186
  },
167
- "scripts": {
168
- "dev": "node ./scripts/dev-mvp.mjs",
169
- "dev:server": "tsx watch src/main/server.ts",
170
- "dev:web": "vite --config vite.web.config.ts",
171
- "build:web": "vite build --config vite.web.config.ts --outDir ../../dist-renderer --emptyOutDir",
172
- "start": "node bin/hermit.mjs",
173
- "typecheck": "tsc --noEmit",
174
- "lint": "eslint src/ --cache --cache-location .eslintcache --cache-strategy content",
175
- "lint:fix": "eslint src/ --fix --cache --cache-location .eslintcache --cache-strategy content",
176
- "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
177
- "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css}\"",
178
- "test": "vitest run",
179
- "test:watch": "vitest",
180
- "test:coverage": "vitest run --coverage"
181
- }
182
- }
187
+ "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319"
188
+ }
@@ -36,6 +36,7 @@ import {
36
36
  } from 'node:fs';
37
37
  import os from 'node:os';
38
38
  import path from 'node:path';
39
+ import fs from 'node:fs/promises';
39
40
  import { fileURLToPath } from 'node:url';
40
41
 
41
42
  import cors from '@fastify/cors';
@@ -45,6 +46,8 @@ import Fastify from 'fastify';
45
46
  import { CcConnectBridge } from './services/ccConnect/CcConnectBridge';
46
47
  import { CcConnectClient } from './services/ccConnect/CcConnectClient';
47
48
  import { TeamProvisioningService } from './services/teams-mvp';
49
+ import { TaskDispatchService } from './services/teams-mvp/TaskDispatchService';
50
+ import type { TaskBusConfig } from '@shared/types/team';
48
51
  import { UpdateService } from './services/UpdateService';
49
52
 
50
53
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -180,6 +183,7 @@ const bridge = new CcConnectBridge({
180
183
  bridgeToken: runtimeConfig.ccBridgeToken || runtimeConfig.ccToken,
181
184
  });
182
185
  const svc = new TeamProvisioningService(cc, bridge);
186
+ const taskDispatch = new TaskDispatchService(svc['workspace']);
183
187
 
184
188
  function normalizeStringArray(value: unknown): string[] {
185
189
  if (!Array.isArray(value)) {
@@ -1618,17 +1622,26 @@ const MCP_TOOLS = [
1618
1622
  },
1619
1623
  },
1620
1624
  {
1621
- name: 'create_task',
1622
- description: '创建任务,可分配给其他团队',
1625
+ name: 'list_teams',
1626
+ description: '列出所有可用的团队(本地和远程)。用于发现可以派发任务的目标团队。',
1627
+ inputSchema: {
1628
+ type: 'object',
1629
+ properties: {},
1630
+ },
1631
+ },
1632
+ {
1633
+ name: 'dispatch_task',
1634
+ description: `将任务派发给另一个团队。当前团队通过 team_slug 参数指定。${taskDispatch.dispatchRulesText}`,
1623
1635
  inputSchema: {
1624
1636
  type: 'object',
1625
1637
  properties: {
1626
- team_slug: { type: 'string', description: '创建任务的团队 slug' },
1627
- title: { type: 'string', description: '任务标题' },
1638
+ team_slug: { type: 'string', description: '当前团队 slug(即发出派发的团队)' },
1639
+ target_team: { type: 'string', description: '目标团队 slug(可通过 list_teams 查询)' },
1640
+ subject: { type: 'string', description: '任务标题' },
1628
1641
  description: { type: 'string', description: '任务描述(可选)' },
1629
- assignee: { type: 'string', description: '分配给哪个团队的 slug(可选)' },
1642
+ prompt: { type: 'string', description: '给目标团队的执行指令(可选)' },
1630
1643
  },
1631
- required: ['team_slug', 'title'],
1644
+ required: ['team_slug', 'target_team', 'subject'],
1632
1645
  },
1633
1646
  },
1634
1647
  ];
@@ -1654,21 +1667,27 @@ async function executeMcpTool(
1654
1667
  const patch: Record<string, unknown> = { status: 'done' };
1655
1668
  if (args.result) patch.result = args.result;
1656
1669
  const task = await svc.patchTask(args.team_slug, args.task_id, patch);
1670
+ // Notify origin team if this was a dispatched task
1671
+ await taskDispatch.onTaskCompleted(args.team_slug, args.task_id).catch(() => {});
1657
1672
  return text(task);
1658
1673
  }
1659
1674
 
1660
- if (toolName === 'create_task') {
1661
- const task = await svc.createTask(args.team_slug, {
1662
- title: args.title,
1663
- description: args.description,
1664
- assignee: args.assignee ?? null,
1665
- });
1666
- if (task.assignee) {
1667
- svc.dispatchTask(args.team_slug, task).catch(() => {
1668
- /* best-effort */
1669
- });
1670
- }
1671
- return text(task);
1675
+ if (toolName === 'list_teams') {
1676
+ const teams = await taskDispatch.listTeams();
1677
+ return text(teams);
1678
+ }
1679
+
1680
+ if (toolName === 'dispatch_task') {
1681
+ const result = await taskDispatch.dispatchTask(
1682
+ args.team_slug,
1683
+ {
1684
+ subject: args.subject,
1685
+ description: args.description,
1686
+ prompt: args.prompt,
1687
+ },
1688
+ args.target_team
1689
+ );
1690
+ return text(result);
1672
1691
  }
1673
1692
 
1674
1693
  throw new Error(`Unknown tool: ${toolName}`);
@@ -3813,12 +3832,149 @@ app.post('/api/teams/tool-approval/read-file', async () => ({ content: '' }));
3813
3832
  // validate-cli-args
3814
3833
  app.post('/api/teams/validate-cli-args', async () => ({ valid: true, args: [], errors: [] }));
3815
3834
 
3816
- // cross-team stubs
3817
- app.post('/api/cross-team/send', async () => ({ ok: true }));
3818
- app.get('/api/cross-team/targets', async () => []);
3819
- app.get<{ Params: { name: string } }>('/api/cross-team/outbox/:name', async () => []);
3835
+ // cross-team task dispatch endpoints
3836
+ app.post<{
3837
+ Body: {
3838
+ fromTeam: string;
3839
+ toTeam: string;
3840
+ subject: string;
3841
+ description?: string;
3842
+ prompt?: string;
3843
+ };
3844
+ }>('/api/cross-team/send', async (request) => {
3845
+ const { fromTeam, toTeam, subject, description, prompt } = request.body ?? {};
3846
+ if (!toTeam || !subject) return { ok: false, error: 'toTeam and subject are required' };
3847
+ const result = await taskDispatch.dispatchTask(
3848
+ fromTeam ?? 'unknown',
3849
+ { subject, description, prompt },
3850
+ toTeam
3851
+ );
3852
+ return { ok: true, dispatchId: result.dispatchId, status: result.status };
3853
+ });
3854
+
3855
+ app.get<{ Querystring: { excludeTeam?: string } }>('/api/cross-team/targets', async (request) => {
3856
+ const excludeTeam = request.query.excludeTeam;
3857
+ // Fetch teams from workspace + alive status from cc-connect
3858
+ const allTeams = await svc.listTeams();
3859
+ let aliveSet = new Set<string>();
3860
+ try {
3861
+ const projects = await cc.listProjects();
3862
+ const states = await Promise.all(
3863
+ projects.map(async (p) => {
3864
+ let isAlive = false;
3865
+ try {
3866
+ const detail = await cc.getProject(p.name);
3867
+ isAlive =
3868
+ Array.isArray(detail.platforms) && detail.platforms.some((pl: any) => pl.connected);
3869
+ } catch {
3870
+ /* degraded */
3871
+ }
3872
+ return { name: p.name, isAlive };
3873
+ })
3874
+ );
3875
+ aliveSet = new Set(states.filter((s) => s.isAlive).map((s) => s.name));
3876
+ } catch {
3877
+ /* cc-connect unavailable */
3878
+ }
3879
+
3880
+ return allTeams
3881
+ .filter((t) => t.slug !== excludeTeam && !t.pendingDelete)
3882
+ .map((t) => ({
3883
+ teamName: t.slug,
3884
+ displayName: t.displayName || t.slug,
3885
+ description: t.description,
3886
+ color: t.color,
3887
+ isOnline: aliveSet.has(t.bindProject),
3888
+ }));
3889
+ });
3890
+
3891
+ app.get<{ Params: { name: string } }>('/api/cross-team/outbox/:name', async (request) => {
3892
+ const teamSlug = request.params.name;
3893
+ const tasks = await svc.readTasks(teamSlug);
3894
+ const pending = tasks.filter(
3895
+ (t: any) => t.dispatchMeta?.status === 'dispatched' && t.dispatchMeta?.originTeam === teamSlug
3896
+ );
3897
+ return { pending };
3898
+ });
3899
+
3900
+ // Task bus settings
3901
+ app.get('/api/settings/task-bus', async () => {
3902
+ const configPath = path.join(os.homedir(), '.hermit', 'settings.json');
3903
+ try {
3904
+ const raw = await fs.readFile(configPath, 'utf-8');
3905
+ const settings = JSON.parse(raw);
3906
+ return settings.taskBus ?? { enabled: false, redis: { host: '127.0.0.1', port: 6379 } };
3907
+ } catch {
3908
+ return { enabled: false, redis: { host: '127.0.0.1', port: 6379 } };
3909
+ }
3910
+ });
3911
+
3912
+ app.put<{ Body: TaskBusConfig }>('/api/settings/task-bus', async (request) => {
3913
+ const config = request.body;
3914
+ const configPath = path.join(os.homedir(), '.hermit', 'settings.json');
3915
+ let settings: Record<string, unknown> = {};
3916
+ try {
3917
+ const raw = await fs.readFile(configPath, 'utf-8');
3918
+ settings = JSON.parse(raw);
3919
+ } catch {
3920
+ // File doesn't exist yet
3921
+ }
3922
+ settings.taskBus = config;
3923
+ await fs.mkdir(path.dirname(configPath), { recursive: true });
3924
+ await fs.writeFile(configPath, JSON.stringify(settings, null, 2));
3925
+
3926
+ // Auto-inject CLAUDE.md instructions when enabling
3927
+ if (config?.enabled) {
3928
+ try {
3929
+ const projects = await cc.listProjects();
3930
+ for (const p of projects) {
3931
+ let workDir = '';
3932
+ let slug = p.name;
3933
+ try {
3934
+ const meta = await svc.readTeamManifest(p.name);
3935
+ if (typeof meta.workDir === 'string') workDir = meta.workDir.trim();
3936
+ if (meta.slug) slug = meta.slug;
3937
+ } catch {
3938
+ /* no local manifest */
3939
+ }
3940
+ if (!workDir) {
3941
+ try {
3942
+ const detail = await cc.getProject(p.name);
3943
+ if (typeof detail.work_dir === 'string') workDir = detail.work_dir.trim();
3944
+ } catch {
3945
+ // ignore
3946
+ }
3947
+ }
3948
+ if (workDir) {
3949
+ await svc.injectTeamInstructions(workDir, slug);
3950
+ }
3951
+ }
3952
+ } catch (err) {
3953
+ request.log.warn({ err }, 'CLAUDE.md injection failed');
3954
+ }
3955
+
3956
+ // Reconnect TaskDispatchService with Redis (optional)
3957
+ taskDispatch.dispose();
3958
+ try {
3959
+ await taskDispatch.start(config);
3960
+ return {
3961
+ ok: true,
3962
+ connected: true,
3963
+ message: `Redis 连接成功,分布式派发已启用`,
3964
+ };
3965
+ } catch {
3966
+ return {
3967
+ ok: true,
3968
+ connected: false,
3969
+ message: `Redis 连接失败,仅本地派发`,
3970
+ };
3971
+ }
3972
+ }
3973
+
3974
+ taskDispatch.dispose();
3975
+ return { ok: true, connected: false, message: 'Task bus disabled' };
3976
+ });
3820
3977
 
3821
- // review stubs
3822
3978
  app.get<{ Params: { name: string; memberName: string } }>(
3823
3979
  '/api/teams/:name/review/agent-changes/:memberName',
3824
3980
  async (request) => ({