@a-company/paradigm 7.2.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{accept-orchestration-XW44LF5Y.js → accept-orchestration-JA3A3TSU.js} +1 -1
  2. package/dist/calibrate-SH6PRZFD.js +2 -0
  3. package/dist/calibration-aggregate-5IVXSBDP.js +2 -0
  4. package/dist/calibration-aggregate-DUEE3LL2.js +4 -0
  5. package/dist/{captain-CAXGHC2V.js → captain-ILBN2IKJ.js} +1 -1
  6. package/dist/{captain-CWCLFOXV.js → captain-J4FZ5PRU.js} +1 -1
  7. package/dist/{chunk-W3VWORQZ.js → chunk-3F4QP2Z5.js} +1 -1
  8. package/dist/{chunk-QPQBXRXX.js → chunk-5VR7FKS5.js} +1 -1
  9. package/dist/chunk-7BZPDOOQ.js +25 -0
  10. package/dist/{chunk-XSKIXXFW.js → chunk-7HUPVOAY.js} +12 -12
  11. package/dist/{chunk-ASBK55FU.js → chunk-DLMDHS2X.js} +1 -1
  12. package/dist/{chunk-6HYRS3PH.js → chunk-IBKCMLOW.js} +8 -8
  13. package/dist/{chunk-USYV5QYU.js → chunk-KA6QEI3C.js} +1 -1
  14. package/dist/{chunk-UNSI6DVD.js → chunk-L3AOKDMU.js} +1 -1
  15. package/dist/chunk-MBKTVQS2.js +2 -0
  16. package/dist/{chunk-RZRFYGND.js → chunk-O4ADSTSY.js} +12 -12
  17. package/dist/chunk-RPGSQQTS.js +2 -0
  18. package/dist/chunk-RQHZUPLO.js +4 -0
  19. package/dist/chunk-SD3KVW5Q.js +2 -0
  20. package/dist/chunk-VKVVIN6J.js +25 -0
  21. package/dist/{chunk-2KK4JQ55.js → chunk-VR2LLUYE.js} +1 -1
  22. package/dist/{chunk-NRP2KJ6I.js → chunk-YNFF7XHV.js} +2 -2
  23. package/dist/{diff-Z2YSIRC4.js → diff-NZSJW3V3.js} +1 -1
  24. package/dist/dist-6TDAY6TQ-HMSTBL57.js +39 -0
  25. package/dist/{docs-OWJ7EPD7.js → docs-DWU3T2BV.js} +1 -1
  26. package/dist/github-GI3HX3N5.js +4 -0
  27. package/dist/index.js +6 -6
  28. package/dist/mcp.js +1 -1
  29. package/dist/{orchestrate-C5NM5MFN.js → orchestrate-C7SI4J7C.js} +1 -1
  30. package/dist/orchestration-4MJKBSGM.js +2 -0
  31. package/dist/orchestration-S2ESNKSA.js +2 -0
  32. package/dist/platform-server-IOWHNS7Q.js +25 -0
  33. package/dist/{reindex-W67B2LQP.js → reindex-G2JLIGOQ.js} +1 -1
  34. package/dist/reindex-JR3PXYQE.js +2 -0
  35. package/dist/{sentinel-EFPEX246.js → sentinel-RIEQWALQ.js} +1 -1
  36. package/dist/{sentinel-bridge-UR2MKARY.js → sentinel-bridge-D4LFDFCH.js} +1 -1
  37. package/dist/serve-PWAFVYYC.js +9 -0
  38. package/dist/{server-4D77LCST.js → server-K7G3IHR3.js} +1 -1
  39. package/dist/{shift-UDKXCIW7.js → shift-HGXZ5THV.js} +1 -1
  40. package/dist/{spawn-I6XG57S2.js → spawn-PHA2SVQ3.js} +1 -1
  41. package/dist/sync-layer-C2PF273N.js +2 -0
  42. package/dist/task-PRLQ4VPK.js +3 -0
  43. package/dist/task-loader-EIXPKHA3.js +2 -0
  44. package/dist/task-loader-LFEE6OU7.js +2 -0
  45. package/dist/task-settlement-A2T6EACG.js +3 -0
  46. package/dist/task-settlement-ZXOY4YGX.js +3 -0
  47. package/dist/{team-6WNNLBAO.js → team-KP4HMUB5.js} +1 -1
  48. package/dist/tools-NOMEIBS7.js +2 -0
  49. package/dist/{tools-SDWAFQMQ.js → tools-YW3Q27UI.js} +11 -11
  50. package/package.json +2 -6
  51. package/platform-ui/dist/assets/{AmbientSection-CwatqcBD.js → AmbientSection-xoxr3DQg.js} +1 -1
  52. package/platform-ui/dist/assets/{DocsSection-BZ2SFJBZ.js → DocsSection-Us2qksna.js} +1 -1
  53. package/platform-ui/dist/assets/{GitSection-MNNYU1tO.js → GitSection-DIHZyadf.js} +1 -1
  54. package/platform-ui/dist/assets/{GraphSection-COYjb4Pt.js → GraphSection-9TO0L1IO.js} +1 -1
  55. package/platform-ui/dist/assets/{LoreSection-B0hUbfsJ.js → LoreSection-DVDit8Aw.js} +1 -1
  56. package/platform-ui/dist/assets/{SentinelSection-BCxW1DCp.js → SentinelSection-a5_VNYcx.js} +1 -1
  57. package/platform-ui/dist/assets/{SymphonySection-BsucZRqy.js → SymphonySection-cRHEoJ9t.js} +1 -1
  58. package/platform-ui/dist/assets/TasksSection-44_gDO3L.css +1 -0
  59. package/platform-ui/dist/assets/TasksSection-h8x3qRIj.js +1 -0
  60. package/platform-ui/dist/assets/{TeamSection-C0QNTudW.js → TeamSection-mFoDyNic.js} +1 -1
  61. package/platform-ui/dist/assets/{UniversitySection-DN1-g9pw.js → UniversitySection-D99YRjmC.js} +1 -1
  62. package/platform-ui/dist/assets/{index-DwUT8pju.js → index-D_wB2S_2.js} +11 -11
  63. package/platform-ui/dist/index.html +1 -1
  64. package/dist/calibrate-PHVP7RPH.js +0 -4
  65. package/dist/chunk-3I3TITBA.js +0 -25
  66. package/dist/chunk-3YM5ABNX.js +0 -2
  67. package/dist/chunk-727PXENG.js +0 -2
  68. package/dist/chunk-K7KT6FL3.js +0 -25
  69. package/dist/chunk-XMAV5AG6.js +0 -2
  70. package/dist/dist-GQ42YS5N-4HIJZVBB.js +0 -39
  71. package/dist/github-4X4MYINS.js +0 -4
  72. package/dist/lore-server-FC2GMDLT.js +0 -14
  73. package/dist/orchestration-EVWQWTOV.js +0 -2
  74. package/dist/orchestration-UP3KFUJT.js +0 -2
  75. package/dist/platform-server-FXF3XFHM.js +0 -25
  76. package/dist/reindex-QZYOD5K4.js +0 -2
  77. package/dist/serve-L52ZUTU6.js +0 -10
  78. package/dist/serve-ZT2Z54NK.js +0 -8
  79. package/dist/task-KFND4HLF.js +0 -3
  80. package/dist/task-loader-HBZ3KRH2.js +0 -2
  81. package/dist/task-loader-IO4UVFUD.js +0 -2
  82. package/dist/task-settlement-NF7PFSNE.js +0 -3
  83. package/dist/task-settlement-TATNPY6L.js +0 -3
  84. package/dist/tools-GDWT74O6.js +0 -2
  85. package/graph-ui/dist/assets/index-BlgXTl53.css +0 -1
  86. package/graph-ui/dist/assets/index-Bq5nXK8p.js +0 -63
  87. package/graph-ui/dist/index.html +0 -13
  88. package/lore-ui/dist/assets/index-C3EixkjW.css +0 -1
  89. package/lore-ui/dist/assets/index-DKhNxgtW.js +0 -56
  90. package/lore-ui/dist/index.html +0 -13
  91. package/platform-ui/dist/assets/CanvasSection-dFAthehN.js +0 -9
  92. package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-company/paradigm",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "description": "Unified CLI for Paradigm developer tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,16 +14,12 @@
14
14
  "files": [
15
15
  "dist",
16
16
  "templates",
17
- "lore-ui/dist",
18
- "graph-ui/dist",
19
17
  "platform-ui/dist"
20
18
  ],
21
19
  "scripts": {
22
- "build": "node scripts/generate-hooks.mjs && tsup && npm run build:sentinel-assets && npm run build:university-assets",
20
+ "build": "node scripts/generate-hooks.mjs && tsup && npm run build:platform-ui && npm run build:sentinel-assets && npm run build:university-assets",
23
21
  "build:sentinel-assets": "rm -rf dist/sentinel-ui && cp -r ../sentinel/ui/dist dist/sentinel-ui",
24
22
  "check:hooks": "node scripts/generate-hooks.mjs --check",
25
- "build:lore-ui": "cd lore-ui && npx vite build",
26
- "build:graph-ui": "cd graph-ui && npx vite build",
27
23
  "build:platform-ui": "cd platform-ui && npx vite build",
28
24
  "build:university-assets": "rm -rf dist/university-ui dist/university-content && cp -r ../university/ui/dist dist/university-ui && cp -r ../university/src/content dist/university-content",
29
25
  "dev": "tsup src/index.ts --format esm --dts --watch",
@@ -1 +1 @@
1
- import{c as j,r as u,e as N,j as n,S as b}from"./index-DwUT8pju.js";let l=null,m=null;const y=j((e,s)=>({events:[],nominations:[],debates:[],loading:!1,eventFilter:{},fetchEvents:async t=>{l==null||l.abort(),l=new AbortController;const{signal:a}=l;e({loading:!0});try{const c=t||s().eventFilter,o=new URLSearchParams;c.type&&o.set("type",c.type),c.since&&o.set("since",c.since);const r=await fetch(`/api/ambient/events?${o}`,{signal:a});if(!r.ok)throw new Error(`HTTP ${r.status}`);const d=await r.json();e({events:d.events||[],loading:!1})}catch(c){if(c instanceof Error&&c.name==="AbortError")return;e({loading:!1})}},fetchNominations:async()=>{m==null||m.abort(),m=new AbortController;const{signal:t}=m;try{const a=await fetch("/api/ambient/nominations?pending_only=true&include_debates=true",{signal:t});if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();e({nominations:c.nominations||[],debates:c.debates||[]})}catch(a){if(a instanceof Error&&a.name==="AbortError")return}},engageNomination:async(t,a)=>{try{const c=await fetch(`/api/ambient/nominations/${encodeURIComponent(t)}/engage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:a})});if(!c.ok)throw new Error(`HTTP ${c.status}`);e(o=>({nominations:o.nominations.map(r=>r.id===t?{...r,engaged:!0,response:a}:r)}))}catch{s().fetchNominations()}},setEventFilter:t=>{e({eventFilter:t}),s().fetchEvents(t)},connectSSE:()=>{const t=new EventSource("/api/ambient/stream");return t.onmessage=a=>{try{const c=JSON.parse(a.data);e(o=>({events:[c,...o.events].slice(0,200)}))}catch{}},t.onerror=()=>{},()=>t.close()}})),p={critical:0,high:1,medium:2,low:3};function w(e){try{const s=new Date(e),a=Date.now()-s.getTime();return a<6e4?"just now":a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<6048e5?`${Math.floor(a/864e5)}d ago`:s.toLocaleDateString()}catch{return""}}function E(e){return["file_change","tool_call","sentinel","agent"].includes(e)?`ambient__type-badge--${e}`:"ambient__type-badge--default"}function S(e){return["critical","high","medium","low"].includes(e)?`ambient__urgency-badge--${e}`:"ambient__urgency-badge--low"}function A(e){const s=Date.now()-36e5;return e.filter(t=>{try{return new Date(t.timestamp).getTime()>s}catch{return!1}}).length}function T(e){const s=new Set(e.map(t=>t.type));return Array.from(s).sort()}function D({event:e}){return n.jsxs("div",{className:"ambient__event-item",children:[n.jsx("span",{className:`ambient__type-badge ${E(e.type)}`,children:e.type.replace(/_/g," ")}),n.jsxs("div",{className:"ambient__event-body",children:[n.jsxs("div",{className:"ambient__event-top-row",children:[e.context&&n.jsx("span",{className:"ambient__event-context",children:e.context}),!e.context&&e.source&&n.jsx("span",{className:"ambient__event-context",children:e.source})]}),e.path&&n.jsx("span",{className:"ambient__event-path",children:e.path}),e.symbols&&e.symbols.length>0&&n.jsx("div",{className:"ambient__event-symbols",children:e.symbols.map(s=>n.jsx("span",{className:"ambient__event-symbol",children:s},s))})]}),n.jsx("span",{className:"ambient__event-time",children:w(e.timestamp)})]})}function $({nomination:e,onEngage:s}){const t=e.engaged;return n.jsxs("div",{className:"ambient__nom-item",children:[n.jsxs("div",{className:"ambient__nom-header",children:[n.jsx("span",{className:`ambient__urgency-badge ${S(e.urgency)}`,children:e.urgency}),n.jsx("span",{className:"ambient__nom-agent",children:e.agent}),n.jsx("span",{className:"ambient__nom-type",children:e.type})]}),n.jsx("div",{className:"ambient__nom-brief",children:e.brief}),!t&&n.jsxs("div",{className:"ambient__nom-actions",children:[n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--accept",onClick:()=>s(e.id,"accepted"),children:"Accept"}),n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--dismiss",onClick:()=>s(e.id,"dismissed"),children:"Dismiss"})]}),t&&n.jsx("div",{style:{fontSize:11,color:"var(--p-text-muted)",fontStyle:"italic"},children:e.response==="accepted"?"Accepted":e.response==="dismissed"?"Dismissed":"Deferred"})]})}function k({debate:e}){return n.jsxs("div",{className:"ambient__debate-item",children:[n.jsx("div",{className:"ambient__debate-topic",children:e.topic}),n.jsxs("div",{className:"ambient__debate-meta",children:[e.type," · ",e.nominations.length," nomination",e.nominations.length!==1?"s":""]})]})}function R(){const{events:e,nominations:s,debates:t,loading:a,eventFilter:c,fetchEvents:o,fetchNominations:r,engageNomination:d,setEventFilter:g,connectSSE:v}=y(),h=u.useRef(null);u.useEffect(()=>{o(),r();const i=v();return h.current=setInterval(()=>{N.getState().activeSection==="ambient"&&r()},1e4),()=>{i(),h.current&&clearInterval(h.current)}},[]);const _=s.filter(i=>!i.engaged).sort((i,x)=>(p[i.urgency]??99)-(p[x.urgency]??99)),f=T(e);return a&&e.length===0?n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsx("p",{style:{color:"var(--p-text-muted)"},children:"Loading..."})]}):n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsxs("div",{className:"ambient__cards",children:[n.jsx(b,{value:A(e),label:"Events (last hour)",accent:"var(--p-accent-blue)"}),n.jsx(b,{value:_.length,label:"Pending Nominations",accent:"var(--p-accent-orange)"}),n.jsx(b,{value:t.length,label:"Active Debates",accent:"var(--p-accent-purple)"})]}),n.jsxs("div",{className:"ambient__grid",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"ambient__section-header",children:[n.jsx("span",{className:"ambient__section-header-title",children:"Event Stream"}),n.jsxs("select",{className:"ambient__filter-select",value:c.type||"",onChange:i=>g({...c,type:i.target.value||void 0}),children:[n.jsx("option",{value:"",children:"All types"}),f.map(i=>n.jsx("option",{value:i,children:i.replace(/_/g," ")},i))]})]}),n.jsxs("div",{className:"ambient__events",children:[e.length===0&&n.jsx("div",{className:"ambient__events-empty",children:"No events recorded yet"}),e.map(i=>n.jsx(D,{event:i},i.id))]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"ambient__section-title",children:"Nominations"}),n.jsxs("div",{className:"ambient__nominations",children:[_.length===0&&n.jsx("div",{className:"ambient__nominations-empty",children:"No pending nominations"}),_.map(i=>n.jsx($,{nomination:i,onEngage:d},i.id))]}),t.length>0&&n.jsxs("div",{className:"ambient__debates",children:[n.jsx("div",{className:"ambient__section-title",children:"Debates"}),t.map(i=>n.jsx(k,{debate:i},i.id))]})]})]})]})}export{R as default};
1
+ import{c as j,r as u,b as N,j as n,S as _}from"./index-D_wB2S_2.js";let l=null,m=null;const y=j((e,s)=>({events:[],nominations:[],debates:[],loading:!1,eventFilter:{},fetchEvents:async t=>{l==null||l.abort(),l=new AbortController;const{signal:a}=l;e({loading:!0});try{const c=t||s().eventFilter,o=new URLSearchParams;c.type&&o.set("type",c.type),c.since&&o.set("since",c.since);const r=await fetch(`/api/ambient/events?${o}`,{signal:a});if(!r.ok)throw new Error(`HTTP ${r.status}`);const d=await r.json();e({events:d.events||[],loading:!1})}catch(c){if(c instanceof Error&&c.name==="AbortError")return;e({loading:!1})}},fetchNominations:async()=>{m==null||m.abort(),m=new AbortController;const{signal:t}=m;try{const a=await fetch("/api/ambient/nominations?pending_only=true&include_debates=true",{signal:t});if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();e({nominations:c.nominations||[],debates:c.debates||[]})}catch(a){if(a instanceof Error&&a.name==="AbortError")return}},engageNomination:async(t,a)=>{try{const c=await fetch(`/api/ambient/nominations/${encodeURIComponent(t)}/engage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:a})});if(!c.ok)throw new Error(`HTTP ${c.status}`);e(o=>({nominations:o.nominations.map(r=>r.id===t?{...r,engaged:!0,response:a}:r)}))}catch{s().fetchNominations()}},setEventFilter:t=>{e({eventFilter:t}),s().fetchEvents(t)},connectSSE:()=>{const t=new EventSource("/api/ambient/stream");return t.onmessage=a=>{try{const c=JSON.parse(a.data);e(o=>({events:[c,...o.events].slice(0,200)}))}catch{}},t.onerror=()=>{},()=>t.close()}})),p={critical:0,high:1,medium:2,low:3};function w(e){try{const s=new Date(e),a=Date.now()-s.getTime();return a<6e4?"just now":a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<6048e5?`${Math.floor(a/864e5)}d ago`:s.toLocaleDateString()}catch{return""}}function E(e){return["file_change","tool_call","sentinel","agent"].includes(e)?`ambient__type-badge--${e}`:"ambient__type-badge--default"}function S(e){return["critical","high","medium","low"].includes(e)?`ambient__urgency-badge--${e}`:"ambient__urgency-badge--low"}function A(e){const s=Date.now()-36e5;return e.filter(t=>{try{return new Date(t.timestamp).getTime()>s}catch{return!1}}).length}function T(e){const s=new Set(e.map(t=>t.type));return Array.from(s).sort()}function D({event:e}){return n.jsxs("div",{className:"ambient__event-item",children:[n.jsx("span",{className:`ambient__type-badge ${E(e.type)}`,children:e.type.replace(/_/g," ")}),n.jsxs("div",{className:"ambient__event-body",children:[n.jsxs("div",{className:"ambient__event-top-row",children:[e.context&&n.jsx("span",{className:"ambient__event-context",children:e.context}),!e.context&&e.source&&n.jsx("span",{className:"ambient__event-context",children:e.source})]}),e.path&&n.jsx("span",{className:"ambient__event-path",children:e.path}),e.symbols&&e.symbols.length>0&&n.jsx("div",{className:"ambient__event-symbols",children:e.symbols.map(s=>n.jsx("span",{className:"ambient__event-symbol",children:s},s))})]}),n.jsx("span",{className:"ambient__event-time",children:w(e.timestamp)})]})}function $({nomination:e,onEngage:s}){const t=e.engaged;return n.jsxs("div",{className:"ambient__nom-item",children:[n.jsxs("div",{className:"ambient__nom-header",children:[n.jsx("span",{className:`ambient__urgency-badge ${S(e.urgency)}`,children:e.urgency}),n.jsx("span",{className:"ambient__nom-agent",children:e.agent}),n.jsx("span",{className:"ambient__nom-type",children:e.type})]}),n.jsx("div",{className:"ambient__nom-brief",children:e.brief}),!t&&n.jsxs("div",{className:"ambient__nom-actions",children:[n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--accept",onClick:()=>s(e.id,"accepted"),children:"Accept"}),n.jsx("button",{className:"ambient__nom-btn ambient__nom-btn--dismiss",onClick:()=>s(e.id,"dismissed"),children:"Dismiss"})]}),t&&n.jsx("div",{style:{fontSize:11,color:"var(--p-text-muted)",fontStyle:"italic"},children:e.response==="accepted"?"Accepted":e.response==="dismissed"?"Dismissed":"Deferred"})]})}function k({debate:e}){return n.jsxs("div",{className:"ambient__debate-item",children:[n.jsx("div",{className:"ambient__debate-topic",children:e.topic}),n.jsxs("div",{className:"ambient__debate-meta",children:[e.type," · ",e.nominations.length," nomination",e.nominations.length!==1?"s":""]})]})}function R(){const{events:e,nominations:s,debates:t,loading:a,eventFilter:c,fetchEvents:o,fetchNominations:r,engageNomination:d,setEventFilter:g,connectSSE:v}=y(),h=u.useRef(null);u.useEffect(()=>{o(),r();const i=v();return h.current=setInterval(()=>{N.getState().activeSection==="ambient"&&r()},1e4),()=>{i(),h.current&&clearInterval(h.current)}},[]);const b=s.filter(i=>!i.engaged).sort((i,x)=>(p[i.urgency]??99)-(p[x.urgency]??99)),f=T(e);return a&&e.length===0?n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsx("p",{style:{color:"var(--p-text-muted)"},children:"Loading..."})]}):n.jsxs("div",{className:"ambient",children:[n.jsx("h1",{className:"ambient__title",children:"Ambient"}),n.jsxs("div",{className:"ambient__cards",children:[n.jsx(_,{value:A(e),label:"Events (last hour)",accent:"var(--p-accent-blue)"}),n.jsx(_,{value:b.length,label:"Pending Nominations",accent:"var(--p-accent-orange)"}),n.jsx(_,{value:t.length,label:"Active Debates",accent:"var(--p-accent-purple)"})]}),n.jsxs("div",{className:"ambient__grid",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"ambient__section-header",children:[n.jsx("span",{className:"ambient__section-header-title",children:"Event Stream"}),n.jsxs("select",{className:"ambient__filter-select",value:c.type||"",onChange:i=>g({...c,type:i.target.value||void 0}),children:[n.jsx("option",{value:"",children:"All types"}),f.map(i=>n.jsx("option",{value:i,children:i.replace(/_/g," ")},i))]})]}),n.jsxs("div",{className:"ambient__events",children:[e.length===0&&n.jsx("div",{className:"ambient__events-empty",children:"No events recorded yet"}),e.map(i=>n.jsx(D,{event:i},i.id))]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"ambient__section-title",children:"Nominations"}),n.jsxs("div",{className:"ambient__nominations",children:[b.length===0&&n.jsx("div",{className:"ambient__nominations-empty",children:"No pending nominations"}),b.map(i=>n.jsx($,{nomination:i,onEngage:d},i.id))]}),t.length>0&&n.jsxs("div",{className:"ambient__debates",children:[n.jsx("div",{className:"ambient__section-title",children:"Debates"}),t.map(i=>n.jsx(k,{debate:i},i.id))]})]})]})]})}export{R as default};
@@ -1 +1 @@
1
- import{c as u,r as x,j as s,R as b}from"./index-DwUT8pju.js";const d=u((a,e)=>({manifest:null,activePage:null,pageData:null,searchQuery:"",searchResults:[],loading:!1,searchLoading:!1,sidebarCollapsed:{},fetchManifest:async()=>{try{const n=await fetch("/api/docs/manifest");if(n.ok){const r=await n.json();a({manifest:r});const o={};for(const l of r.groups||[])if(o[l.id]=l.collapsed,l.subgroups)for(const i of l.subgroups)o[`${l.id}/${i.id}`]=i.collapsed;a({sidebarCollapsed:o})}}catch{}},selectPage:async(n,r)=>{a({loading:!0,activePage:{kind:n,id:r}});try{let o="";switch(n){case"symbol":o=`/api/docs/symbol/${encodeURIComponent(r)}`;break;case"flow":o=`/api/docs/flow/${encodeURIComponent(r)}`;break;case"portal":o="/api/docs/portal";break;case"custom":o=`/api/docs/page/${encodeURIComponent(r)}`;break}const l=await fetch(o);if(l.ok){const i=await l.json();a({pageData:i,loading:!1})}else a({pageData:null,loading:!1})}catch{a({pageData:null,loading:!1})}},search:async n=>{if(a({searchQuery:n,searchLoading:!0}),!n.trim()){a({searchResults:[],searchLoading:!1});return}try{const r=await fetch(`/api/docs/search?q=${encodeURIComponent(n)}&limit=20`);if(r.ok){const o=await r.json();a({searchResults:o.results||[],searchLoading:!1})}else a({searchResults:[],searchLoading:!1})}catch{a({searchResults:[],searchLoading:!1})}},clearSearch:()=>a({searchQuery:"",searchResults:[]}),toggleGroup:n=>{const r=e().sidebarCollapsed;a({sidebarCollapsed:{...r,[n]:!r[n]}})}})),y={component:"var(--p-symbol-component)",flow:"var(--p-symbol-flow)",gate:"var(--p-symbol-gate)",signal:"var(--p-symbol-signal)",aspect:"var(--p-symbol-aspect)",custom:"var(--p-accent-blue)",portal:"var(--p-accent-orange)",guide:"var(--p-accent-green)"},N={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"};function f(){const a=d(c=>c.manifest),e=d(c=>c.activePage),n=d(c=>c.searchQuery),r=d(c=>c.sidebarCollapsed),o=d(c=>c.selectPage),l=d(c=>c.search),i=d(c=>c.clearSearch),t=d(c=>c.toggleGroup),h=x.useCallback(c=>{const g=c.target.value;g?l(g):i()},[l,i]),m=x.useCallback(c=>{i(),o({component:"symbol",signal:"symbol",aspect:"symbol",gate:"symbol",flow:"flow",portal:"portal",custom:"custom",guide:"custom"}[c.kind]||"symbol",c.id)},[o,i]);return a?s.jsxs("div",{className:"docs-sidebar",children:[s.jsx("div",{className:"docs-sidebar__search",children:s.jsx("input",{type:"text",placeholder:"Search docs...",value:n,onChange:h,className:"docs-sidebar__search-input"})}),s.jsx("div",{className:"docs-sidebar__groups",children:a.groups.map(c=>s.jsx(_,{group:c,collapsed:r[c.id]??c.collapsed,activePage:e,sidebarCollapsed:r,onToggle:t,onItemClick:m},c.id))})]}):s.jsx("div",{className:"docs-sidebar docs-sidebar--loading",children:"Loading..."})}function _({group:a,collapsed:e,activePage:n,sidebarCollapsed:r,onToggle:o,onItemClick:l}){var i;return s.jsxs("div",{className:"docs-sidebar__group",children:[s.jsxs("button",{className:"docs-sidebar__group-header",onClick:()=>o(a.id),children:[s.jsx("span",{className:"docs-sidebar__group-arrow",children:e?"▸":"▾"}),s.jsx("span",{className:"docs-sidebar__group-label",children:a.label}),s.jsx("span",{className:"docs-sidebar__group-count",children:a.items.length})]}),!e&&s.jsxs(s.Fragment,{children:[(i=a.subgroups)==null?void 0:i.map(t=>s.jsx(_,{group:t,collapsed:r[`${a.id}/${t.id}`]??t.collapsed,activePage:n,sidebarCollapsed:r,onToggle:h=>o(`${a.id}/${h}`),onItemClick:l},t.id)),a.items.map(t=>s.jsxs("button",{className:`docs-sidebar__item ${(n==null?void 0:n.id)===t.id?"docs-sidebar__item--active":""}`,onClick:()=>l(t),title:t.description,children:[s.jsx("span",{className:"docs-sidebar__item-prefix",style:{color:y[t.kind]},children:N[t.kind]||""}),s.jsx("span",{className:"docs-sidebar__item-label",children:t.label}),t.badge&&s.jsx("span",{className:"docs-sidebar__item-badge",children:t.badge})]},t.id))]})]})}const v={"#":"var(--p-symbol-component)",$:"var(--p-symbol-flow)","^":"var(--p-symbol-gate)","!":"var(--p-symbol-signal)","~":"var(--p-symbol-aspect)"};function p({symbol:a,label:e}){const n=d(m=>m.selectPage),r=d(m=>m.clearSearch),o=a.charAt(0),l=v[o]||"var(--p-text-primary)",i=a.replace(/^[#$^!~]/,""),h={"#":"symbol",$:"flow","^":"symbol","!":"symbol","~":"symbol"}[o]||"symbol";return s.jsx("button",{className:"symbol-link",style:{color:l},onClick:()=>{r(),n(h,i)},title:e||a,children:e||a})}function k({entries:a}){return a.length===0?null:s.jsx("table",{className:"docs-table docs-table--properties",children:s.jsx("tbody",{children:a.map(e=>s.jsxs("tr",{children:[s.jsx("td",{className:"docs-table__key",children:e.key}),s.jsx("td",{className:"docs-table__value",children:s.jsx("code",{children:e.value})})]},e.key))})})}function w({data:a}){var n,r,o,l,i,t,h,m;const e=a;return s.jsxs("div",{className:"docs-page docs-page--symbol",children:[s.jsxs("header",{className:"docs-page__header",children:[s.jsx("span",{className:"docs-page__symbol","data-kind":e.category,children:e.symbol}),s.jsx("h1",{className:"docs-page__title",children:e.name}),e.componentType&&s.jsx("span",{className:"docs-page__type",children:e.componentType})]}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),((n=e.tags)==null?void 0:n.length)>0&&s.jsx("div",{className:"docs-page__tags",children:e.tags.map(c=>s.jsx("span",{className:"docs-page__tag",children:c},c))}),s.jsx(k,{entries:[{key:"Path",value:e.path},...e.parent?[{key:"Parent",value:e.parent}]:[],...(r=e.children)!=null&&r.length?[{key:"Children",value:e.children.join(", ")}]:[]]}),((o=e.related)==null?void 0:o.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Related Symbols"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.related.map(c=>s.jsx(p,{symbol:c},c))})]}),((l=e.referencedBy)==null?void 0:l.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Referenced By"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.referencedBy.map(c=>s.jsx(p,{symbol:c},c))})]}),((i=e.references)==null?void 0:i.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"References"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.references.map(c=>s.jsx(p,{symbol:c},c))})]}),((t=e.flows)==null?void 0:t.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Flows"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.flows.map(c=>s.jsx(p,{symbol:`$${c.id}`,label:c.name},c.id))})]}),((h=e.gates)==null?void 0:h.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Gates"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.gates.map(c=>s.jsx(p,{symbol:`^${c.id}`,label:c.description},c.id))})]}),((m=e.guides)==null?void 0:m.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Related Guides"}),e.guides.map(c=>s.jsx("div",{className:"docs-page__guide",children:c.title},c.id))]})]})}const j={gate:"var(--p-symbol-gate)",action:"var(--p-symbol-component)",signal:"var(--p-symbol-signal)"};function S({steps:a}){return s.jsx("div",{className:"flow-steps",children:a.map((e,n)=>s.jsxs("div",{className:"flow-steps__step",children:[s.jsxs("div",{className:"flow-steps__connector",children:[s.jsx("span",{className:"flow-steps__dot",style:{background:j[e.type]||"var(--p-text-muted)"}}),n<a.length-1&&s.jsx("span",{className:"flow-steps__line"})]}),s.jsxs("div",{className:"flow-steps__content",children:[s.jsx("span",{className:"flow-steps__type",style:{color:j[e.type]},children:e.type}),s.jsx(p,{symbol:e.symbol}),e.description&&s.jsx("span",{className:"flow-steps__desc",children:e.description})]})]},n))})}function R({data:a}){var n,r;const e=a;return s.jsxs("div",{className:"docs-page docs-page--flow",children:[s.jsxs("header",{className:"docs-page__header",children:[s.jsx("span",{className:"docs-page__symbol","data-kind":"flows",children:e.symbol}),s.jsx("h1",{className:"docs-page__title",children:e.name})]}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),e.trigger&&s.jsxs("div",{className:"docs-page__trigger",children:[s.jsx("strong",{children:"Trigger:"})," ",s.jsx("code",{children:e.trigger})]}),((n=e.steps)==null?void 0:n.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Steps"}),s.jsx(S,{steps:e.steps})]}),e.successSignal&&s.jsxs("div",{className:"docs-page__signal",children:[s.jsx("strong",{children:"Success:"})," ",s.jsx(p,{symbol:e.successSignal})]}),e.errorSignal&&s.jsxs("div",{className:"docs-page__signal docs-page__signal--error",children:[s.jsx("strong",{children:"Error:"})," ",s.jsx(p,{symbol:e.errorSignal})]}),((r=e.tags)==null?void 0:r.length)>0&&s.jsx("div",{className:"docs-page__tags",children:e.tags.map(o=>s.jsx("span",{className:"docs-page__tag",children:o},o))})]})}function $({gates:a}){return a.length===0?s.jsx("span",{className:"gate-chain--empty",children:"none"}):s.jsx("span",{className:"gate-chain",children:a.map((e,n)=>s.jsxs(b.Fragment,{children:[n>0&&s.jsx("span",{className:"gate-chain__separator",children:" → "}),s.jsx(p,{symbol:e.symbol,label:e.description||e.symbol})]},e.symbol))})}function C({data:a}){var n,r;const e=a;return s.jsxs("div",{className:"docs-page docs-page--portal",children:[s.jsx("header",{className:"docs-page__header",children:s.jsx("h1",{className:"docs-page__title",children:"Portal — Gates & Routes"})}),((n=e.gates)==null?void 0:n.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Gates"}),s.jsxs("table",{className:"docs-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Gate"}),s.jsx("th",{children:"Description"}),s.jsx("th",{children:"Routes"})]})}),s.jsx("tbody",{children:e.gates.map(o=>{var l;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(p,{symbol:o.symbol})}),s.jsx("td",{children:o.description}),s.jsx("td",{children:((l=o.routes)==null?void 0:l.length)||0})]},o.symbol)})})]})]}),((r=e.routes)==null?void 0:r.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Routes"}),s.jsxs("table",{className:"docs-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Method"}),s.jsx("th",{children:"Route"}),s.jsx("th",{children:"Gate Chain"})]})}),s.jsx("tbody",{children:e.routes.map((o,l)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{className:"docs-method",children:o.method})}),s.jsx("td",{children:s.jsx("code",{children:o.route})}),s.jsx("td",{children:s.jsx($,{gates:o.gates||[]})})]},l))})]})]}),(!e.gates||e.gates.length===0)&&(!e.routes||e.routes.length===0)&&s.jsx("p",{className:"docs-page__empty",children:"No portal.yaml found. Add one to document your API authorization."})]})}function P({data:a}){const e=a;return s.jsxs("div",{className:"docs-page docs-page--custom",children:[s.jsx("header",{className:"docs-page__header",children:s.jsx("h1",{className:"docs-page__title",children:e.title||e.slug})}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),s.jsx("div",{className:"docs-page__body",dangerouslySetInnerHTML:{__html:D(e.body||"")}})]})}function D(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\n\n/g,"</p><p>").replace(/^/,"<p>").replace(/$/,"</p>")}function L(){const a=d(l=>l.searchResults),e=d(l=>l.searchQuery),n=d(l=>l.searchLoading),r=d(l=>l.selectPage),o=d(l=>l.clearSearch);return n?s.jsx("div",{className:"docs__loading",children:"Searching..."}):s.jsxs("div",{className:"docs-search",children:[s.jsxs("h2",{className:"docs-search__title",children:[a.length," result",a.length!==1?"s":"",' for "',e,'"']}),a.length===0&&s.jsx("p",{className:"docs-search__empty",children:"No matching documentation found."}),s.jsx("div",{className:"docs-search__results",children:a.map(l=>s.jsxs("button",{className:"docs-search__result",onClick:()=>{o(),r({component:"symbol",signal:"symbol",aspect:"symbol",gate:"symbol",flow:"flow",portal:"portal",custom:"custom"}[l.kind]||"symbol",l.id)},children:[s.jsxs("div",{className:"docs-search__result-header",children:[s.jsx("span",{className:"docs-search__result-kind","data-kind":l.kind,children:l.kind}),s.jsx("span",{className:"docs-search__result-label",children:l.label})]}),s.jsx("p",{className:"docs-search__result-desc",children:l.description})]},l.id))})]})}function G(){const a=d(t=>t.manifest),e=d(t=>t.activePage),n=d(t=>t.pageData),r=d(t=>t.loading),o=d(t=>t.searchQuery),l=d(t=>t.fetchManifest);x.useEffect(()=>{l()},[]);const i=()=>{if(o)return s.jsx(L,{});if(r)return s.jsx("div",{className:"docs__loading",children:"Loading..."});if(!e||!n)return s.jsxs("div",{className:"docs__welcome",children:[s.jsx("h2",{children:(a==null?void 0:a.title)||"Documentation"}),s.jsx("p",{children:"Select a symbol from the sidebar to view its documentation."}),a&&s.jsxs("div",{className:"docs__stats",children:[s.jsxs("span",{children:[a.totalSymbols," symbols documented"]}),Object.entries(a.symbolCounts).map(([t,h])=>s.jsxs("span",{className:"docs__stat-item",children:[t,": ",h]},t))]})]});switch(e.kind){case"symbol":return s.jsx(w,{data:n});case"flow":return s.jsx(R,{data:n});case"portal":return s.jsx(C,{data:n});case"custom":return s.jsx(P,{data:n});default:return null}};return s.jsxs("div",{className:"docs",children:[s.jsx(f,{}),s.jsx("div",{className:"docs__content",children:i()})]})}export{G as default};
1
+ import{c as u,r as x,j as s,R as b}from"./index-D_wB2S_2.js";const d=u((a,e)=>({manifest:null,activePage:null,pageData:null,searchQuery:"",searchResults:[],loading:!1,searchLoading:!1,sidebarCollapsed:{},fetchManifest:async()=>{try{const n=await fetch("/api/docs/manifest");if(n.ok){const r=await n.json();a({manifest:r});const o={};for(const l of r.groups||[])if(o[l.id]=l.collapsed,l.subgroups)for(const i of l.subgroups)o[`${l.id}/${i.id}`]=i.collapsed;a({sidebarCollapsed:o})}}catch{}},selectPage:async(n,r)=>{a({loading:!0,activePage:{kind:n,id:r}});try{let o="";switch(n){case"symbol":o=`/api/docs/symbol/${encodeURIComponent(r)}`;break;case"flow":o=`/api/docs/flow/${encodeURIComponent(r)}`;break;case"portal":o="/api/docs/portal";break;case"custom":o=`/api/docs/page/${encodeURIComponent(r)}`;break}const l=await fetch(o);if(l.ok){const i=await l.json();a({pageData:i,loading:!1})}else a({pageData:null,loading:!1})}catch{a({pageData:null,loading:!1})}},search:async n=>{if(a({searchQuery:n,searchLoading:!0}),!n.trim()){a({searchResults:[],searchLoading:!1});return}try{const r=await fetch(`/api/docs/search?q=${encodeURIComponent(n)}&limit=20`);if(r.ok){const o=await r.json();a({searchResults:o.results||[],searchLoading:!1})}else a({searchResults:[],searchLoading:!1})}catch{a({searchResults:[],searchLoading:!1})}},clearSearch:()=>a({searchQuery:"",searchResults:[]}),toggleGroup:n=>{const r=e().sidebarCollapsed;a({sidebarCollapsed:{...r,[n]:!r[n]}})}})),y={component:"var(--p-symbol-component)",flow:"var(--p-symbol-flow)",gate:"var(--p-symbol-gate)",signal:"var(--p-symbol-signal)",aspect:"var(--p-symbol-aspect)",custom:"var(--p-accent-blue)",portal:"var(--p-accent-orange)",guide:"var(--p-accent-green)"},N={component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"};function f(){const a=d(c=>c.manifest),e=d(c=>c.activePage),n=d(c=>c.searchQuery),r=d(c=>c.sidebarCollapsed),o=d(c=>c.selectPage),l=d(c=>c.search),i=d(c=>c.clearSearch),t=d(c=>c.toggleGroup),h=x.useCallback(c=>{const g=c.target.value;g?l(g):i()},[l,i]),m=x.useCallback(c=>{i(),o({component:"symbol",signal:"symbol",aspect:"symbol",gate:"symbol",flow:"flow",portal:"portal",custom:"custom",guide:"custom"}[c.kind]||"symbol",c.id)},[o,i]);return a?s.jsxs("div",{className:"docs-sidebar",children:[s.jsx("div",{className:"docs-sidebar__search",children:s.jsx("input",{type:"text",placeholder:"Search docs...",value:n,onChange:h,className:"docs-sidebar__search-input"})}),s.jsx("div",{className:"docs-sidebar__groups",children:a.groups.map(c=>s.jsx(_,{group:c,collapsed:r[c.id]??c.collapsed,activePage:e,sidebarCollapsed:r,onToggle:t,onItemClick:m},c.id))})]}):s.jsx("div",{className:"docs-sidebar docs-sidebar--loading",children:"Loading..."})}function _({group:a,collapsed:e,activePage:n,sidebarCollapsed:r,onToggle:o,onItemClick:l}){var i;return s.jsxs("div",{className:"docs-sidebar__group",children:[s.jsxs("button",{className:"docs-sidebar__group-header",onClick:()=>o(a.id),children:[s.jsx("span",{className:"docs-sidebar__group-arrow",children:e?"▸":"▾"}),s.jsx("span",{className:"docs-sidebar__group-label",children:a.label}),s.jsx("span",{className:"docs-sidebar__group-count",children:a.items.length})]}),!e&&s.jsxs(s.Fragment,{children:[(i=a.subgroups)==null?void 0:i.map(t=>s.jsx(_,{group:t,collapsed:r[`${a.id}/${t.id}`]??t.collapsed,activePage:n,sidebarCollapsed:r,onToggle:h=>o(`${a.id}/${h}`),onItemClick:l},t.id)),a.items.map(t=>s.jsxs("button",{className:`docs-sidebar__item ${(n==null?void 0:n.id)===t.id?"docs-sidebar__item--active":""}`,onClick:()=>l(t),title:t.description,children:[s.jsx("span",{className:"docs-sidebar__item-prefix",style:{color:y[t.kind]},children:N[t.kind]||""}),s.jsx("span",{className:"docs-sidebar__item-label",children:t.label}),t.badge&&s.jsx("span",{className:"docs-sidebar__item-badge",children:t.badge})]},t.id))]})]})}const v={"#":"var(--p-symbol-component)",$:"var(--p-symbol-flow)","^":"var(--p-symbol-gate)","!":"var(--p-symbol-signal)","~":"var(--p-symbol-aspect)"};function p({symbol:a,label:e}){const n=d(m=>m.selectPage),r=d(m=>m.clearSearch),o=a.charAt(0),l=v[o]||"var(--p-text-primary)",i=a.replace(/^[#$^!~]/,""),h={"#":"symbol",$:"flow","^":"symbol","!":"symbol","~":"symbol"}[o]||"symbol";return s.jsx("button",{className:"symbol-link",style:{color:l},onClick:()=>{r(),n(h,i)},title:e||a,children:e||a})}function k({entries:a}){return a.length===0?null:s.jsx("table",{className:"docs-table docs-table--properties",children:s.jsx("tbody",{children:a.map(e=>s.jsxs("tr",{children:[s.jsx("td",{className:"docs-table__key",children:e.key}),s.jsx("td",{className:"docs-table__value",children:s.jsx("code",{children:e.value})})]},e.key))})})}function w({data:a}){var n,r,o,l,i,t,h,m;const e=a;return s.jsxs("div",{className:"docs-page docs-page--symbol",children:[s.jsxs("header",{className:"docs-page__header",children:[s.jsx("span",{className:"docs-page__symbol","data-kind":e.category,children:e.symbol}),s.jsx("h1",{className:"docs-page__title",children:e.name}),e.componentType&&s.jsx("span",{className:"docs-page__type",children:e.componentType})]}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),((n=e.tags)==null?void 0:n.length)>0&&s.jsx("div",{className:"docs-page__tags",children:e.tags.map(c=>s.jsx("span",{className:"docs-page__tag",children:c},c))}),s.jsx(k,{entries:[{key:"Path",value:e.path},...e.parent?[{key:"Parent",value:e.parent}]:[],...(r=e.children)!=null&&r.length?[{key:"Children",value:e.children.join(", ")}]:[]]}),((o=e.related)==null?void 0:o.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Related Symbols"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.related.map(c=>s.jsx(p,{symbol:c},c))})]}),((l=e.referencedBy)==null?void 0:l.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Referenced By"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.referencedBy.map(c=>s.jsx(p,{symbol:c},c))})]}),((i=e.references)==null?void 0:i.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"References"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.references.map(c=>s.jsx(p,{symbol:c},c))})]}),((t=e.flows)==null?void 0:t.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Flows"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.flows.map(c=>s.jsx(p,{symbol:`$${c.id}`,label:c.name},c.id))})]}),((h=e.gates)==null?void 0:h.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Gates"}),s.jsx("div",{className:"docs-page__symbol-list",children:e.gates.map(c=>s.jsx(p,{symbol:`^${c.id}`,label:c.description},c.id))})]}),((m=e.guides)==null?void 0:m.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Related Guides"}),e.guides.map(c=>s.jsx("div",{className:"docs-page__guide",children:c.title},c.id))]})]})}const j={gate:"var(--p-symbol-gate)",action:"var(--p-symbol-component)",signal:"var(--p-symbol-signal)"};function S({steps:a}){return s.jsx("div",{className:"flow-steps",children:a.map((e,n)=>s.jsxs("div",{className:"flow-steps__step",children:[s.jsxs("div",{className:"flow-steps__connector",children:[s.jsx("span",{className:"flow-steps__dot",style:{background:j[e.type]||"var(--p-text-muted)"}}),n<a.length-1&&s.jsx("span",{className:"flow-steps__line"})]}),s.jsxs("div",{className:"flow-steps__content",children:[s.jsx("span",{className:"flow-steps__type",style:{color:j[e.type]},children:e.type}),s.jsx(p,{symbol:e.symbol}),e.description&&s.jsx("span",{className:"flow-steps__desc",children:e.description})]})]},n))})}function R({data:a}){var n,r;const e=a;return s.jsxs("div",{className:"docs-page docs-page--flow",children:[s.jsxs("header",{className:"docs-page__header",children:[s.jsx("span",{className:"docs-page__symbol","data-kind":"flows",children:e.symbol}),s.jsx("h1",{className:"docs-page__title",children:e.name})]}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),e.trigger&&s.jsxs("div",{className:"docs-page__trigger",children:[s.jsx("strong",{children:"Trigger:"})," ",s.jsx("code",{children:e.trigger})]}),((n=e.steps)==null?void 0:n.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Steps"}),s.jsx(S,{steps:e.steps})]}),e.successSignal&&s.jsxs("div",{className:"docs-page__signal",children:[s.jsx("strong",{children:"Success:"})," ",s.jsx(p,{symbol:e.successSignal})]}),e.errorSignal&&s.jsxs("div",{className:"docs-page__signal docs-page__signal--error",children:[s.jsx("strong",{children:"Error:"})," ",s.jsx(p,{symbol:e.errorSignal})]}),((r=e.tags)==null?void 0:r.length)>0&&s.jsx("div",{className:"docs-page__tags",children:e.tags.map(o=>s.jsx("span",{className:"docs-page__tag",children:o},o))})]})}function $({gates:a}){return a.length===0?s.jsx("span",{className:"gate-chain--empty",children:"none"}):s.jsx("span",{className:"gate-chain",children:a.map((e,n)=>s.jsxs(b.Fragment,{children:[n>0&&s.jsx("span",{className:"gate-chain__separator",children:" → "}),s.jsx(p,{symbol:e.symbol,label:e.description||e.symbol})]},e.symbol))})}function C({data:a}){var n,r;const e=a;return s.jsxs("div",{className:"docs-page docs-page--portal",children:[s.jsx("header",{className:"docs-page__header",children:s.jsx("h1",{className:"docs-page__title",children:"Portal — Gates & Routes"})}),((n=e.gates)==null?void 0:n.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Gates"}),s.jsxs("table",{className:"docs-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Gate"}),s.jsx("th",{children:"Description"}),s.jsx("th",{children:"Routes"})]})}),s.jsx("tbody",{children:e.gates.map(o=>{var l;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(p,{symbol:o.symbol})}),s.jsx("td",{children:o.description}),s.jsx("td",{children:((l=o.routes)==null?void 0:l.length)||0})]},o.symbol)})})]})]}),((r=e.routes)==null?void 0:r.length)>0&&s.jsxs("section",{className:"docs-page__section",children:[s.jsx("h2",{children:"Routes"}),s.jsxs("table",{className:"docs-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Method"}),s.jsx("th",{children:"Route"}),s.jsx("th",{children:"Gate Chain"})]})}),s.jsx("tbody",{children:e.routes.map((o,l)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx("code",{className:"docs-method",children:o.method})}),s.jsx("td",{children:s.jsx("code",{children:o.route})}),s.jsx("td",{children:s.jsx($,{gates:o.gates||[]})})]},l))})]})]}),(!e.gates||e.gates.length===0)&&(!e.routes||e.routes.length===0)&&s.jsx("p",{className:"docs-page__empty",children:"No portal.yaml found. Add one to document your API authorization."})]})}function P({data:a}){const e=a;return s.jsxs("div",{className:"docs-page docs-page--custom",children:[s.jsx("header",{className:"docs-page__header",children:s.jsx("h1",{className:"docs-page__title",children:e.title||e.slug})}),e.description&&s.jsx("p",{className:"docs-page__description",children:e.description}),s.jsx("div",{className:"docs-page__body",dangerouslySetInnerHTML:{__html:D(e.body||"")}})]})}function D(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\n\n/g,"</p><p>").replace(/^/,"<p>").replace(/$/,"</p>")}function L(){const a=d(l=>l.searchResults),e=d(l=>l.searchQuery),n=d(l=>l.searchLoading),r=d(l=>l.selectPage),o=d(l=>l.clearSearch);return n?s.jsx("div",{className:"docs__loading",children:"Searching..."}):s.jsxs("div",{className:"docs-search",children:[s.jsxs("h2",{className:"docs-search__title",children:[a.length," result",a.length!==1?"s":"",' for "',e,'"']}),a.length===0&&s.jsx("p",{className:"docs-search__empty",children:"No matching documentation found."}),s.jsx("div",{className:"docs-search__results",children:a.map(l=>s.jsxs("button",{className:"docs-search__result",onClick:()=>{o(),r({component:"symbol",signal:"symbol",aspect:"symbol",gate:"symbol",flow:"flow",portal:"portal",custom:"custom"}[l.kind]||"symbol",l.id)},children:[s.jsxs("div",{className:"docs-search__result-header",children:[s.jsx("span",{className:"docs-search__result-kind","data-kind":l.kind,children:l.kind}),s.jsx("span",{className:"docs-search__result-label",children:l.label})]}),s.jsx("p",{className:"docs-search__result-desc",children:l.description})]},l.id))})]})}function G(){const a=d(t=>t.manifest),e=d(t=>t.activePage),n=d(t=>t.pageData),r=d(t=>t.loading),o=d(t=>t.searchQuery),l=d(t=>t.fetchManifest);x.useEffect(()=>{l()},[]);const i=()=>{if(o)return s.jsx(L,{});if(r)return s.jsx("div",{className:"docs__loading",children:"Loading..."});if(!e||!n)return s.jsxs("div",{className:"docs__welcome",children:[s.jsx("h2",{children:(a==null?void 0:a.title)||"Documentation"}),s.jsx("p",{children:"Select a symbol from the sidebar to view its documentation."}),a&&s.jsxs("div",{className:"docs__stats",children:[s.jsxs("span",{children:[a.totalSymbols," symbols documented"]}),Object.entries(a.symbolCounts).map(([t,h])=>s.jsxs("span",{className:"docs__stat-item",children:[t,": ",h]},t))]})]});switch(e.kind){case"symbol":return s.jsx(w,{data:n});case"flow":return s.jsx(R,{data:n});case"portal":return s.jsx(C,{data:n});case"custom":return s.jsx(P,{data:n});default:return null}};return s.jsxs("div",{className:"docs",children:[s.jsx(f,{}),s.jsx("div",{className:"docs__content",children:i()})]})}export{G as default};
@@ -1,4 +1,4 @@
1
- import{c as O,j as s,r as f}from"./index-DwUT8pju.js";let x=null,j=null,N=null,v=null,w=null;const r=O((a,c)=>({branch:"",ahead:0,behind:0,staged:[],unstaged:[],untracked:[],commits:[],commitTotal:0,commitOffset:0,branches:[],selectedFile:null,selectedFileStaged:!1,diffContent:"",commitMessage:"",activeTab:"files",loading:!1,pushing:!1,committing:!1,symbols:[],fetchStatus:async()=>{x==null||x.abort(),x=new AbortController;const{signal:i}=x;try{const e=await fetch("/api/git/status",{signal:i});if(!e.ok)return;const t=await e.json();a({branch:t.branch,ahead:t.ahead,behind:t.behind,staged:t.staged,unstaged:t.unstaged,untracked:t.untracked})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},fetchBranches:async()=>{j==null||j.abort(),j=new AbortController;const{signal:i}=j;try{const e=await fetch("/api/git/branches",{signal:i});if(!e.ok)return;const t=await e.json();a({branches:t.branches||[]})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},fetchLog:async(i=!0)=>{N==null||N.abort(),N=new AbortController;const{signal:e}=N;try{const t=i?0:c().commitOffset,n=await fetch(`/api/git/log?limit=20&offset=${t}`,{signal:e});if(!n.ok)return;const l=await n.json();a(i?{commits:l.commits,commitTotal:l.total,commitOffset:20}:m=>({commits:[...m.commits,...l.commits],commitTotal:l.total,commitOffset:m.commitOffset+20}))}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},loadMoreCommits:async()=>{await c().fetchLog(!1)},selectFile:async(i,e)=>{v==null||v.abort(),v=new AbortController;const{signal:t}=v;a({selectedFile:i,selectedFileStaged:e,diffContent:""});try{const n=new URLSearchParams({path:i});e&&n.set("staged","true");const l=await fetch(`/api/git/diff?${n}`,{signal:t});if(!l.ok)return;const m=await l.json();a({diffContent:m.diff||"(no diff available)"})}catch(n){if(n instanceof Error&&n.name==="AbortError")return;a({diffContent:"(error loading diff)"})}},clearSelection:()=>a({selectedFile:null,diffContent:""}),stageFiles:async i=>{try{(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:i})})).ok&&await c().fetchStatus()}catch{}},unstageFiles:async i=>{try{(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:i})})).ok&&await c().fetchStatus()}catch{}},commit:async()=>{const i=c().commitMessage.trim();if(!i)return!1;a({committing:!0});try{return(await fetch("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:i})})).ok?(a({commitMessage:""}),await Promise.all([c().fetchStatus(),c().fetchLog()]),!0):!1}catch{return!1}finally{a({committing:!1})}},push:async()=>{a({pushing:!0});try{return(await fetch("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"}})).ok?(await c().fetchStatus(),!0):!1}catch{return!1}finally{a({pushing:!1})}},setCommitMessage:i=>a({commitMessage:i}),setActiveTab:i=>a({activeTab:i}),fetchSymbols:async()=>{w==null||w.abort(),w=new AbortController;const{signal:i}=w;try{const e=await fetch("/api/symbols",{signal:i});if(!e.ok)return;const l=((await e.json()).symbols||[]).map(m=>`${{component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"}[m.category||""]||"#"}${m.name||m.id}`);a({symbols:l})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},refresh:async()=>{a({loading:!0}),await Promise.all([c().fetchStatus(),c().fetchLog(),c().fetchBranches()]),a({loading:!1})}}));function D(){const a=r(n=>n.branch),c=r(n=>n.ahead),i=r(n=>n.behind),e=r(n=>n.refresh),t=r(n=>n.loading);return s.jsxs("div",{className:"git-branch-bar",children:[s.jsxs("div",{className:"git-branch-bar__left",children:[s.jsx("span",{className:"git-branch-bar__icon",children:"⎇"}),s.jsx("span",{className:"git-branch-bar__name",children:a||"..."}),c>0&&s.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--ahead",title:`${c} ahead`,children:["↑",c]}),i>0&&s.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--behind",title:`${i} behind`,children:["↓",i]})]}),s.jsx("button",{className:"git-branch-bar__refresh",onClick:e,disabled:t,title:"Refresh",children:t?"⏳":"↻"})]})}function L({title:a,files:c,type:i,selectedFile:e,onSelect:t,onAction:n,actionLabel:l}){return c.length===0?null:s.jsxs("div",{className:"git-file-group",children:[s.jsxs("div",{className:"git-file-group__header",children:[s.jsx("span",{className:"git-file-group__title",children:a}),s.jsx("span",{className:"git-file-group__count",children:c.length})]}),c.map(m=>s.jsxs("div",{className:`git-file-item ${e===m?"git-file-item--selected":""}`,onClick:()=>t(m,i==="staged"),children:[s.jsx("span",{className:`git-file-item__indicator git-file-item__indicator--${i}`}),s.jsx("span",{className:"git-file-item__name",title:m,children:m}),s.jsx("button",{className:"git-file-item__action",onClick:d=>{d.stopPropagation(),n([m])},title:l,children:i==="staged"?"−":"+"})]},m))]})}function P(){const a=r(d=>d.staged),c=r(d=>d.unstaged),i=r(d=>d.untracked),e=r(d=>d.selectedFile),t=r(d=>d.selectFile),n=r(d=>d.stageFiles),l=r(d=>d.unstageFiles),m=a.length===0&&c.length===0&&i.length===0;return s.jsxs("div",{className:"git-file-list",children:[m&&s.jsx("div",{className:"git-file-list__empty",children:"Working tree clean"}),s.jsx(L,{title:"Staged",files:a,type:"staged",selectedFile:e,onSelect:t,onAction:l,actionLabel:"Unstage"}),s.jsx(L,{title:"Modified",files:c,type:"unstaged",selectedFile:e,onSelect:t,onAction:n,actionLabel:"Stage"}),s.jsx(L,{title:"Untracked",files:i,type:"untracked",selectedFile:e,onSelect:t,onAction:n,actionLabel:"Stage"})]})}function R(a){const c=a.split(`
1
+ import{c as O,j as s,r as f}from"./index-D_wB2S_2.js";let x=null,j=null,N=null,v=null,w=null;const r=O((a,c)=>({branch:"",ahead:0,behind:0,staged:[],unstaged:[],untracked:[],commits:[],commitTotal:0,commitOffset:0,branches:[],selectedFile:null,selectedFileStaged:!1,diffContent:"",commitMessage:"",activeTab:"files",loading:!1,pushing:!1,committing:!1,symbols:[],fetchStatus:async()=>{x==null||x.abort(),x=new AbortController;const{signal:i}=x;try{const e=await fetch("/api/git/status",{signal:i});if(!e.ok)return;const t=await e.json();a({branch:t.branch,ahead:t.ahead,behind:t.behind,staged:t.staged,unstaged:t.unstaged,untracked:t.untracked})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},fetchBranches:async()=>{j==null||j.abort(),j=new AbortController;const{signal:i}=j;try{const e=await fetch("/api/git/branches",{signal:i});if(!e.ok)return;const t=await e.json();a({branches:t.branches||[]})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},fetchLog:async(i=!0)=>{N==null||N.abort(),N=new AbortController;const{signal:e}=N;try{const t=i?0:c().commitOffset,n=await fetch(`/api/git/log?limit=20&offset=${t}`,{signal:e});if(!n.ok)return;const l=await n.json();a(i?{commits:l.commits,commitTotal:l.total,commitOffset:20}:m=>({commits:[...m.commits,...l.commits],commitTotal:l.total,commitOffset:m.commitOffset+20}))}catch(t){if(t instanceof Error&&t.name==="AbortError")return}},loadMoreCommits:async()=>{await c().fetchLog(!1)},selectFile:async(i,e)=>{v==null||v.abort(),v=new AbortController;const{signal:t}=v;a({selectedFile:i,selectedFileStaged:e,diffContent:""});try{const n=new URLSearchParams({path:i});e&&n.set("staged","true");const l=await fetch(`/api/git/diff?${n}`,{signal:t});if(!l.ok)return;const m=await l.json();a({diffContent:m.diff||"(no diff available)"})}catch(n){if(n instanceof Error&&n.name==="AbortError")return;a({diffContent:"(error loading diff)"})}},clearSelection:()=>a({selectedFile:null,diffContent:""}),stageFiles:async i=>{try{(await fetch("/api/git/stage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:i})})).ok&&await c().fetchStatus()}catch{}},unstageFiles:async i=>{try{(await fetch("/api/git/unstage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:i})})).ok&&await c().fetchStatus()}catch{}},commit:async()=>{const i=c().commitMessage.trim();if(!i)return!1;a({committing:!0});try{return(await fetch("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:i})})).ok?(a({commitMessage:""}),await Promise.all([c().fetchStatus(),c().fetchLog()]),!0):!1}catch{return!1}finally{a({committing:!1})}},push:async()=>{a({pushing:!0});try{return(await fetch("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"}})).ok?(await c().fetchStatus(),!0):!1}catch{return!1}finally{a({pushing:!1})}},setCommitMessage:i=>a({commitMessage:i}),setActiveTab:i=>a({activeTab:i}),fetchSymbols:async()=>{w==null||w.abort(),w=new AbortController;const{signal:i}=w;try{const e=await fetch("/api/symbols",{signal:i});if(!e.ok)return;const l=((await e.json()).symbols||[]).map(m=>`${{component:"#",flow:"$",gate:"^",signal:"!",aspect:"~"}[m.category||""]||"#"}${m.name||m.id}`);a({symbols:l})}catch(e){if(e instanceof Error&&e.name==="AbortError")return}},refresh:async()=>{a({loading:!0}),await Promise.all([c().fetchStatus(),c().fetchLog(),c().fetchBranches()]),a({loading:!1})}}));function D(){const a=r(n=>n.branch),c=r(n=>n.ahead),i=r(n=>n.behind),e=r(n=>n.refresh),t=r(n=>n.loading);return s.jsxs("div",{className:"git-branch-bar",children:[s.jsxs("div",{className:"git-branch-bar__left",children:[s.jsx("span",{className:"git-branch-bar__icon",children:"⎇"}),s.jsx("span",{className:"git-branch-bar__name",children:a||"..."}),c>0&&s.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--ahead",title:`${c} ahead`,children:["↑",c]}),i>0&&s.jsxs("span",{className:"git-branch-bar__badge git-branch-bar__badge--behind",title:`${i} behind`,children:["↓",i]})]}),s.jsx("button",{className:"git-branch-bar__refresh",onClick:e,disabled:t,title:"Refresh",children:t?"⏳":"↻"})]})}function L({title:a,files:c,type:i,selectedFile:e,onSelect:t,onAction:n,actionLabel:l}){return c.length===0?null:s.jsxs("div",{className:"git-file-group",children:[s.jsxs("div",{className:"git-file-group__header",children:[s.jsx("span",{className:"git-file-group__title",children:a}),s.jsx("span",{className:"git-file-group__count",children:c.length})]}),c.map(m=>s.jsxs("div",{className:`git-file-item ${e===m?"git-file-item--selected":""}`,onClick:()=>t(m,i==="staged"),children:[s.jsx("span",{className:`git-file-item__indicator git-file-item__indicator--${i}`}),s.jsx("span",{className:"git-file-item__name",title:m,children:m}),s.jsx("button",{className:"git-file-item__action",onClick:d=>{d.stopPropagation(),n([m])},title:l,children:i==="staged"?"−":"+"})]},m))]})}function P(){const a=r(d=>d.staged),c=r(d=>d.unstaged),i=r(d=>d.untracked),e=r(d=>d.selectedFile),t=r(d=>d.selectFile),n=r(d=>d.stageFiles),l=r(d=>d.unstageFiles),m=a.length===0&&c.length===0&&i.length===0;return s.jsxs("div",{className:"git-file-list",children:[m&&s.jsx("div",{className:"git-file-list__empty",children:"Working tree clean"}),s.jsx(L,{title:"Staged",files:a,type:"staged",selectedFile:e,onSelect:t,onAction:l,actionLabel:"Unstage"}),s.jsx(L,{title:"Modified",files:c,type:"unstaged",selectedFile:e,onSelect:t,onAction:n,actionLabel:"Stage"}),s.jsx(L,{title:"Untracked",files:i,type:"untracked",selectedFile:e,onSelect:t,onAction:n,actionLabel:"Stage"})]})}function R(a){const c=a.split(`
2
2
  `).slice(0,2e3),i=[];let e=0,t=0;for(const n of c)if(n.startsWith("@@")){const l=n.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);l&&(e=parseInt(l[1]),t=parseInt(l[2])),i.push({type:"hunk",content:n})}else n.startsWith("+")?(i.push({type:"add",content:n,lineNum:String(t)}),t++):n.startsWith("-")?(i.push({type:"remove",content:n,lineNum:String(e)}),e++):n.startsWith("diff ")||n.startsWith("index ")||n.startsWith("---")||n.startsWith("+++")?i.push({type:"context",content:n}):(i.push({type:"context",content:n,lineNum:String(t)}),e++,t++);return i}function W(){const a=r(e=>e.selectedFile),c=r(e=>e.diffContent);if(!a)return s.jsx("div",{className:"git-diff-empty",children:"Select a file to view its diff"});const i=R(c);return s.jsxs("div",{className:"git-diff",children:[s.jsx("div",{className:"git-diff__header",children:a}),s.jsx("pre",{className:"git-diff__content",children:i.map((e,t)=>s.jsxs("div",{className:`git-diff__line git-diff__line--${e.type}`,children:[s.jsx("span",{className:"git-diff__gutter",children:e.lineNum||""}),s.jsx("span",{className:"git-diff__text",children:e.content})]},t))})]})}const B="#$^!~";function G(){const a=r(o=>o.commitMessage),c=r(o=>o.setCommitMessage),i=r(o=>o.commit),e=r(o=>o.push),t=r(o=>o.committing),n=r(o=>o.pushing),l=r(o=>o.staged),m=r(o=>o.symbols),d=r(o=>o.ahead),C=f.useRef(null),[p,_]=f.useState([]),[k,T]=f.useState(0),[S,E]=f.useState(-1),A=f.useCallback(()=>{const o=C.current;if(!o)return;const g=o.selectionStart,y=o.value.substring(0,g);let b=-1;for(let h=y.length-1;h>=0;h--){const u=y[h];if(u===" "||u===`
3
3
  `)break;if(B.includes(u)){b=h;break}}if(b>=0){const h=y.substring(b).toLowerCase(),u=m.filter($=>$.toLowerCase().startsWith(h)).slice(0,8);_(u),T(0),E(b)}else _([]),E(-1)},[m]),F=f.useCallback(o=>{const g=C.current;if(!g||S<0)return;const y=a.substring(0,S),b=a.substring(g.selectionStart),h=y+o+" "+b;c(h),_([]),E(-1),setTimeout(()=>{if(g){const u=S+o.length+1;g.selectionStart=u,g.selectionEnd=u,g.focus()}},0)},[a,S,c]),M=f.useCallback(o=>{p.length>0&&(o.key==="ArrowDown"?(o.preventDefault(),T(g=>Math.min(g+1,p.length-1))):o.key==="ArrowUp"?(o.preventDefault(),T(g=>Math.max(g-1,0))):o.key==="Enter"||o.key==="Tab"?(o.preventDefault(),F(p[k])):o.key==="Escape"&&_([]))},[p,k,F]);return f.useEffect(()=>{const o=()=>_([]);return document.addEventListener("click",o),()=>document.removeEventListener("click",o)},[]),s.jsxs("div",{className:"git-commit-composer",children:[s.jsxs("div",{className:"git-commit-composer__input-wrap",children:[s.jsx("textarea",{ref:C,className:"git-commit-composer__textarea",placeholder:l.length>0?"Commit message...":"No staged files to commit",value:a,onChange:o=>{c(o.target.value),A()},onKeyUp:A,onKeyDown:M,disabled:l.length===0,rows:3}),p.length>0&&s.jsx("div",{className:"git-commit-composer__suggestions",onClick:o=>o.stopPropagation(),children:p.map((o,g)=>s.jsx("div",{className:`git-commit-composer__suggestion ${g===k?"git-commit-composer__suggestion--active":""}`,onClick:()=>F(o),children:o},o))})]}),s.jsxs("div",{className:"git-commit-composer__actions",children:[s.jsx("button",{className:"git-commit-composer__btn git-commit-composer__btn--commit",onClick:i,disabled:t||l.length===0||!a.trim(),children:t?"Committing...":`Commit (${l.length})`}),s.jsx("button",{className:"git-commit-composer__btn git-commit-composer__btn--push",onClick:e,disabled:n||d===0,children:n?"Pushing...":`Push${d>0?` (${d})`:""}`})]})]})}const I={"#":"var(--p-symbol-component)",$:"var(--p-symbol-flow)","^":"var(--p-symbol-gate)","!":"var(--p-symbol-signal)","~":"var(--p-symbol-aspect)"};function U(a){try{const c=new Date(a),e=Date.now()-c.getTime();return e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:e<6048e5?`${Math.floor(e/864e5)}d ago`:c.toLocaleDateString()}catch{return a}}function H(){const a=r(t=>t.commits),c=r(t=>t.commitOffset),i=r(t=>t.commitTotal),e=r(t=>t.loadMoreCommits);return s.jsxs("div",{className:"git-commit-log",children:[a.length===0&&s.jsx("div",{className:"git-commit-log__empty",children:"No commits found"}),a.map(t=>s.jsxs("div",{className:"git-commit-log__item",children:[s.jsxs("div",{className:"git-commit-log__header",children:[s.jsx("span",{className:"git-commit-log__hash",children:t.shortHash}),s.jsx("span",{className:"git-commit-log__message",children:t.message.split(`
4
4
  `)[0]})]}),s.jsxs("div",{className:"git-commit-log__meta",children:[s.jsx("span",{className:"git-commit-log__author",children:t.author}),s.jsx("span",{className:"git-commit-log__date",children:U(t.date)}),t.symbols.length>0&&s.jsx("span",{className:"git-commit-log__symbols",children:t.symbols.map(n=>s.jsx("span",{className:"git-commit-log__symbol-badge",style:{color:I[n[0]]||"var(--p-text-muted)"},children:n},n))})]})]},t.hash)),c<i&&s.jsx("button",{className:"git-commit-log__load-more",onClick:e,children:"Load more"})]})}const J=[{id:"files",label:"Changes"},{id:"log",label:"History"}];function q(){const a=r(t=>t.activeTab),c=r(t=>t.setActiveTab),i=r(t=>t.refresh),e=r(t=>t.fetchSymbols);return f.useEffect(()=>{i(),e()},[]),s.jsxs("div",{className:"git-section",children:[s.jsx(D,{}),s.jsx("div",{className:"git-tabs",children:J.map(t=>s.jsx("button",{className:`git-tabs__btn ${a===t.id?"git-tabs__btn--active":""}`,onClick:()=>c(t.id),children:t.label},t.id))}),a==="files"&&s.jsxs("div",{className:"git-files-layout",children:[s.jsxs("div",{className:"git-files-layout__sidebar",children:[s.jsx(P,{}),s.jsx(G,{})]}),s.jsx("div",{className:"git-files-layout__main",children:s.jsx(W,{})})]}),a==="log"&&s.jsx("div",{className:"git-log-layout",children:s.jsx(H,{})})]})}export{q as default};