tide-commander 1.201.0 → 1.202.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.
- package/CHANGELOG.md +16 -0
- package/dist/assets/{AudioPlayer-jjttJ6SM.js → AudioPlayer-B7nGfgjR.js} +1 -1
- package/dist/assets/{BossLogsModal-DF0ar9g6.js → BossLogsModal-B2hKgPKR.js} +1 -1
- package/dist/assets/{BossSpawnModal-rJfm0Ijw.js → BossSpawnModal-smufSfcS.js} +1 -1
- package/dist/assets/ControlsModal-DFwNI_sS.js +1 -0
- package/dist/assets/{DockerLogsModal-ChSWCsD6.js → DockerLogsModal-CgpZgKz5.js} +1 -1
- package/dist/assets/{EmbeddedEditor-ChdfmuIg.js → EmbeddedEditor-B6e6Tjab.js} +1 -1
- package/dist/assets/{FcStdViewer-CdhcfLu8.js → FcStdViewer-Cvp018yY.js} +1 -1
- package/dist/assets/{GcodeViewer-CG5xftum.js → GcodeViewer-BkGC_S8k.js} +1 -1
- package/dist/assets/{GlbViewer-DvmBSNPm.js → GlbViewer-ksrBWqeR.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-yhSITtw7.js → GmailOAuthSetup-CzIkxjus.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-ugg8hhwa.js → GoogleOAuthSetup-DfGNwK7j.js} +1 -1
- package/dist/assets/{IframeModal-Bjo_-SSc.js → IframeModal-BpLhEygR.js} +1 -1
- package/dist/assets/{IntegrationsPanel-JbfEFuTE.js → IntegrationsPanel-Bjemwaaf.js} +2 -2
- package/dist/assets/{LogViewerModal-CGGtQwwn.js → LogViewerModal-BN-2fkaY.js} +1 -1
- package/dist/assets/{MonitoringModal-D7VxK2C8.js → MonitoringModal-DOXLXC2b.js} +1 -1
- package/dist/assets/{PM2LogsModal-C-Ec4p65.js → PM2LogsModal-rbMVcXlW.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-BBZpQw8I.js → RestoreArchivedAreaModal-zP0f1MJs.js} +1 -1
- package/dist/assets/{Scene2DCanvas-Cpzgqdq1.js → Scene2DCanvas-o7560L-a.js} +1 -1
- package/dist/assets/{SceneManager-B9bEzlSi.js → SceneManager-BgDfVg6I.js} +1 -1
- package/dist/assets/{SkillsPanel-crpQci9P.js → SkillsPanel-CjPjIaWc.js} +2 -2
- package/dist/assets/{SlackMultiInstanceSetup-C1qkAM8r.js → SlackMultiInstanceSetup-DD_rPcgV.js} +1 -1
- package/dist/assets/SpawnModal-D8AMFrPu.js +1 -0
- package/dist/assets/{StatisticsModal-B14YGD66.js → StatisticsModal-Cj-JYH7n.js} +1 -1
- package/dist/assets/{StlViewer-D5EtQxO4.js → StlViewer-BTqw22H9.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-_8NWXgEl.js → SubordinateAssignmentModal-BWeToc-Y.js} +1 -1
- package/dist/assets/{ThreeAreaSelector-Bnb65bJt.js → ThreeAreaSelector-BfXBY8Zd.js} +1 -1
- package/dist/assets/{ThreeViewShortcuts-AI4Mj9zr.js → ThreeViewShortcuts-BGgmAwlu.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-aFrbWG0D.js → TriggerManagerPanel-C_jBXs4k.js} +1 -1
- package/dist/assets/{VideoPlayer-BSVjpcQa.js → VideoPlayer-C-ciwgiq.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-CgFXTubk.js → WorkflowEditorPanel-D09rBihK.js} +1 -1
- package/dist/assets/{abnfDiagram-VRR7QNED-LbVlypD7.js → abnfDiagram-VRR7QNED-Hvauvwpv.js} +1 -1
- package/dist/assets/{arc-DDqZ78fN.js → arc-8xGuxuLE.js} +1 -1
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-BLfa7hLc.js → architectureDiagram-ZJ3FMSHR-DckJ-9FC.js} +1 -1
- package/dist/assets/{area-logos-ml30JJUi.js → area-logos-DKkCiybZ.js} +1 -1
- package/dist/assets/{blockDiagram-677ZJIJ3-CHWx5n03.js → blockDiagram-677ZJIJ3-DAJq6nFY.js} +1 -1
- package/dist/assets/{c4Diagram-LMCZKHZV-DvUxK9_Q.js → c4Diagram-LMCZKHZV-PGJGoAsg.js} +1 -1
- package/dist/assets/channel-BhAHX260.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BFtzwIJU.js → chunk-2Q5K7J3B-D1sP2fsh.js} +1 -1
- package/dist/assets/{chunk-32BRIVSS-CPbVoclL.js → chunk-32BRIVSS-RLL4h20T.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-dTYGN5E5.js → chunk-5VM5RSS4-CevkAGFw.js} +1 -1
- package/dist/assets/{chunk-EX3LRPZG-CtqfsWRW.js → chunk-EX3LRPZG-D819msSu.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Bk6bqjv9.js → chunk-JWPE2WC7-CrfN0IY7.js} +1 -1
- package/dist/assets/{chunk-MOJQB5TN-UYfo6GD_.js → chunk-MOJQB5TN-BZ7Xp1xZ.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-C8_6Iuf_.js → chunk-RYQCIY6F-w0k8a4aN.js} +1 -1
- package/dist/assets/{chunk-V7JOEXUC-CGdZK5My.js → chunk-V7JOEXUC-CR2m_ZLP.js} +1 -1
- package/dist/assets/{chunk-VR4S4FIN-C-HH5QTv.js → chunk-VR4S4FIN-BCJR0sNP.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-B2n8y5qo.js → chunk-XXDRQBXY-BhsJv5YE.js} +1 -1
- package/dist/assets/classDiagram-OUVF2IWQ-DbI_Lbd-.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-DbI_Lbd-.js +1 -0
- package/dist/assets/compacting-bar.webp +0 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-AB1HxIBy.js → cose-bilkent-JH36ORCC-BSXhVj_l.js} +1 -1
- package/dist/assets/{cynefin-VYW2F7L2-DTS_6pNv.js → cynefin-VYW2F7L2-D1Tm3Vt0.js} +1 -1
- package/dist/assets/{cynefinDiagram-TSTJHNR4-0oJZvAZy.js → cynefinDiagram-TSTJHNR4-DcvA_MXZ.js} +1 -1
- package/dist/assets/{dagre-VKFMJZFB-mOn_d4U5.js → dagre-VKFMJZFB-6I-LwvhB.js} +1 -1
- package/dist/assets/{diagram-FQU43EPY-DqHifujZ.js → diagram-FQU43EPY-BppVFL1M.js} +1 -1
- package/dist/assets/{diagram-G47NLZAW-BZ7eUs_p.js → diagram-G47NLZAW-BLGUCT6E.js} +1 -1
- package/dist/assets/{diagram-NH7WQ7WH-C3r43VXW.js → diagram-NH7WQ7WH-CEYltb_-.js} +1 -1
- package/dist/assets/{diagram-OA4YK3LP-D2RSBPAX.js → diagram-OA4YK3LP-B1EWuzbE.js} +1 -1
- package/dist/assets/{diagram-WEI45ONY-B9Nkjrlq.js → diagram-WEI45ONY-LDSoBbk8.js} +1 -1
- package/dist/assets/{ebnfDiagram-CCIWWBDH-B1RDvi6g.js → ebnfDiagram-CCIWWBDH-E4wZGnSz.js} +1 -1
- package/dist/assets/{erDiagram-Q63AITRT-B38eKAG5.js → erDiagram-Q63AITRT-Cmuko4DT.js} +1 -1
- package/dist/assets/{flowDiagram-23GEKE2U-C9txCjHm.js → flowDiagram-23GEKE2U-DZ_8svqD.js} +1 -1
- package/dist/assets/{ganttDiagram-NO4QXBWP-BGNoppCl.js → ganttDiagram-NO4QXBWP-BR4hcxxf.js} +1 -1
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-qrryYqaT.js → gitGraphDiagram-IHSO6WYX-DKgytJlK.js} +1 -1
- package/dist/assets/{index-Drtp5UPa.js → index-B-Ykv2WD.js} +1 -1
- package/dist/assets/{index-CKVTIr6G.js → index-BBw8GgfS.js} +1 -1
- package/dist/assets/{index-ClvYehMs.js → index-BNbxKAb4.js} +1 -1
- package/dist/assets/index-Bbsb_wWh.css +1 -0
- package/dist/assets/index-CVEV_ET-.js +2 -0
- package/dist/assets/{index-BXNPTpxx.js → index-CXv8ZS0v.js} +5 -5
- package/dist/assets/{index-B4sdd8Y2.js → index-Ccq9kwRk.js} +1 -1
- package/dist/assets/{index-tE736Avl.js → index-DrxGAsVW.js} +1 -1
- package/dist/assets/index-MEQRanWH.js +2 -0
- package/dist/assets/{index-CYxytlNP.js → index-h-ZJIMFv.js} +3 -3
- package/dist/assets/{infoDiagram-FWYZ7A6U-DilAR8go.js → infoDiagram-FWYZ7A6U-IupeIGNJ.js} +1 -1
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-B0cTGbt1.js → ishikawaDiagram-FXEZZL3T-BgnsuPSR.js} +1 -1
- package/dist/assets/{journeyDiagram-5HDEW3XC-eHbpGFin.js → journeyDiagram-5HDEW3XC-DH2sCeMM.js} +1 -1
- package/dist/assets/{kanban-definition-HUTT4EX6-BaSQRYl7.js → kanban-definition-HUTT4EX6-Wb6HQDBS.js} +1 -1
- package/dist/assets/{linear-BoUClmXF.js → linear-q6sA2iAt.js} +1 -1
- package/dist/assets/main-33HX-Nre.js +341 -0
- package/dist/assets/main-l3t22cX-.css +1 -0
- package/dist/assets/{mermaid.core-CGrC54u1.js → mermaid.core-DE8C8qk_.js} +4 -4
- package/dist/assets/{mindmap-definition-LN4V7U3C-BQWnb1yP.js → mindmap-definition-LN4V7U3C-Bs8A2u-b.js} +1 -1
- package/dist/assets/{pegDiagram-2B236MQR-Bs_4Go2e.js → pegDiagram-2B236MQR-CXEy-5xS.js} +1 -1
- package/dist/assets/{pieDiagram-ENE6RG2P-LCcCZeX5.js → pieDiagram-ENE6RG2P-0KEHZ6Qu.js} +1 -1
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-CdlG1WsA.js → quadrantDiagram-ABIIQ3AL-B4ua4DRe.js} +1 -1
- package/dist/assets/{railroadDiagram-RFXS5EU6-CAcrzOwC.js → railroadDiagram-RFXS5EU6-BmumxmaP.js} +1 -1
- package/dist/assets/{requirementDiagram-TGXJPOKE-zgaCBhns.js → requirementDiagram-TGXJPOKE-BL46wZ-t.js} +1 -1
- package/dist/assets/{sankeyDiagram-HTMAVEWB-Cvn05yAi.js → sankeyDiagram-HTMAVEWB-DF7DCX_x.js} +1 -1
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-C7oW7B56.js → sequenceDiagram-DBY2YBRQ-7ZltWf-f.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-Z61MsHMO.js → sizeCapture-X5ZJPWSS-D-2cB5F9.js} +1 -1
- package/dist/assets/{stateDiagram-2N3HPSRC-CHjZ2LvZ.js → stateDiagram-2N3HPSRC-CIUa3aAc.js} +1 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-B-vNeHDE.js +1 -0
- package/dist/assets/{swimlanes-5IMT3BWC-BOxFXKKq.js → swimlanes-5IMT3BWC-B-cxeKvb.js} +2 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-DMAH0FoM.js +8 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-7Hw_U3c1.js → timeline-definition-FHXFAJF6-O6fJ1p9n.js} +1 -1
- package/dist/assets/{vennDiagram-L72KCM5P-DXOydhCz.js → vennDiagram-L72KCM5P-BiV5ZylZ.js} +1 -1
- package/dist/assets/{wardleyDiagram-EHGQE667-CHEopdXj.js → wardleyDiagram-EHGQE667-E4l00yC2.js} +1 -1
- package/dist/assets/{web-vmnQRY1J.js → web-CUkMR96i.js} +1 -1
- package/dist/assets/{web-BNIDHx-H.js → web-CfYEEkSC.js} +1 -1
- package/dist/assets/{web-DAWG2rda.js → web-DZ5Y-yBU.js} +1 -1
- package/dist/assets/{xychartDiagram-FW5EYKEG-BpNrwdIN.js → xychartDiagram-FW5EYKEG-B922Z30u.js} +1 -1
- package/dist/build-info.json +1 -1
- package/dist/index.html +2 -2
- package/dist/src/packages/server/claude/session-loader.js +128 -0
- package/dist/src/packages/server/grok/session-watcher.js +24 -0
- package/dist/src/packages/server/routes/agents.js +11 -8
- package/dist/src/packages/server/routes/sessions.js +25 -1
- package/dist/src/packages/server/routes/system.js +13 -0
- package/dist/src/packages/server/services/grok-usage-service.js +13 -3
- package/dist/src/packages/server/services/opencode-usage-service.js +49 -0
- package/package.json +1 -1
- package/dist/assets/ControlsModal-D4JLnO36.js +0 -1
- package/dist/assets/SpawnModal-CIuJWY6N.js +0 -1
- package/dist/assets/channel-CxofHie1.js +0 -1
- package/dist/assets/classDiagram-OUVF2IWQ-15eANucY.js +0 -1
- package/dist/assets/classDiagram-v2-EOCWNBFH-15eANucY.js +0 -1
- package/dist/assets/index-BdQoxlnS.js +0 -2
- package/dist/assets/index-BoiyspB0.js +0 -2
- package/dist/assets/index-DV4NCFbu.css +0 -1
- package/dist/assets/main-BdVckSM5.css +0 -1
- package/dist/assets/main-DuaHyH5t.js +0 -341
- package/dist/assets/stateDiagram-v2-6OUMAXLB-ePlfPVZw.js +0 -1
- package/dist/assets/swimlanesDiagram-G3AALYLV-ClgJ2Bw0.js +0 -8
package/dist/assets/{SlackMultiInstanceSetup-C1qkAM8r.js → SlackMultiInstanceSetup-DD_rPcgV.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as h,j as e,c as b,d as m}from"./main-DuaHyH5t.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const C=["public_channel","private_channel","im","mpim"],z={public_channel:"Public channels",private_channel:"Private channels",im:"1:1 DMs",mpim:"Group DMs"};function M(t){const i=new Set;for(const a of(t||"").split(",")){const f=a.trim();C.includes(f)&&i.add(f)}return i}function $(t){return C.filter(i=>t.has(i)).join(",")}const s={container:{display:"flex",gap:16,minHeight:420},list:{width:200,flexShrink:0,background:"var(--surface-1, #181825)",borderRadius:8,border:"1px solid var(--border, #313244)",padding:8,display:"flex",flexDirection:"column",gap:4},listItem:t=>({padding:"8px 10px",borderRadius:6,cursor:"pointer",background:t?"rgba(137,180,250,0.15)":"transparent",border:t?"1px solid rgba(137,180,250,0.3)":"1px solid transparent",color:t?"#cdd6f4":"#a6adc8",fontSize:13}),label:{fontWeight:500},sub:{fontSize:11,color:"#6c7086",marginTop:2},addBtn:{marginTop:8,padding:"8px 10px",borderRadius:6,background:"transparent",color:"#89b4fa",border:"1px dashed rgba(137,180,250,0.4)",cursor:"pointer",fontSize:13},editor:{flex:1,display:"flex",flexDirection:"column",gap:12},field:{display:"flex",flexDirection:"column",gap:4},fieldLabel:{fontSize:12,fontWeight:500,color:"#a6adc8"},fieldDesc:{fontSize:11,color:"#6c7086"},input:{padding:"8px 10px",background:"var(--surface-0, #1e1e2e)",border:"1px solid var(--border, #313244)",borderRadius:6,color:"#cdd6f4",fontSize:13,fontFamily:"inherit"},badge:t=>{const a={socket:"#a6e3a1",polling:"#89b4fa",none:"#6c7086"}[t]??"#6c7086";return{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:500,background:`${a}26`,color:a,border:`1px solid ${a}55`}},rowGap:{display:"flex",gap:12},buttons:{display:"flex",gap:8,marginTop:12},btnPrimary:{padding:"8px 16px",background:"#89b4fa",color:"#1e1e2e",border:"none",borderRadius:6,cursor:"pointer",fontWeight:500,fontSize:13},btnSecondary:{padding:"8px 16px",background:"transparent",color:"#cdd6f4",border:"1px solid var(--border, #313244)",borderRadius:6,cursor:"pointer",fontSize:13},btnDanger:{padding:"8px 16px",background:"transparent",color:"#f38ba8",border:"1px solid rgba(243,139,168,0.4)",borderRadius:6,cursor:"pointer",fontSize:13},alert:t=>({padding:"8px 12px",borderRadius:6,fontSize:12,background:t==="error"?"rgba(243,139,168,0.15)":"rgba(166,227,161,0.15)",color:t==="error"?"#f38ba8":"#a6e3a1",border:`1px solid ${t==="error"?"rgba(243,139,168,0.3)":"rgba(166,227,161,0.3)"}`})},j="/api/slack/instances";async function N(){const t=await b(m(j));if(!t.ok)throw new Error(`HTTP ${t.status}`);return(await t.json()).instances}async function B(t){const i=await b(m(`${j}/${encodeURIComponent(t)}/values`));if(!i.ok)throw new Error(`HTTP ${i.status}`);return(await i.json()).values}async function K(t,i){const a=await b(m(j),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,label:i})});if(!a.ok){const f=await a.json().catch(()=>({}));throw new Error(f.error||`HTTP ${a.status}`)}}async function H(t,i){const a=await b(m(`${j}/${encodeURIComponent(t)}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const f=await a.json().catch(()=>({}));throw new Error(f.error||`HTTP ${a.status}`)}}async function W(t){const i=await b(m(`${j}/${encodeURIComponent(t)}`),{method:"DELETE"});if(!i.ok){const a=await i.json().catch(()=>({}));throw new Error(a.error||`HTTP ${i.status}`)}}const V=({integration:t,onCancel:i})=>{const[a,f]=h.useState([]),[o,v]=h.useState("default"),[l,S]=h.useState(null),[T,_]=h.useState(null),[g,I]=h.useState(""),[D,A]=h.useState(!1),[L,E]=h.useState(!1),[w,x]=h.useState(null),y=h.useCallback(async()=>{try{const n=await N();f(n),!n.some(d=>d.id===o)&&n.length>0&&v(n[0].id)}catch(n){x({kind:"error",message:`Failed to load instances: ${n.message}`})}},[o]),k=h.useCallback(async()=>{if(o){A(!0);try{const n=await B(o);S(n),_(n);const r=a.find(d=>d.id===o);I((r==null?void 0:r.label)??o)}catch(n){x({kind:"error",message:`Failed to load instance: ${n.message}`})}finally{A(!1)}}},[o,a]);h.useEffect(()=>{y()},[y]),h.useEffect(()=>{k()},[k]);const P=async()=>{const n=window.prompt('Instance id (kebab-case, e.g. "personal", "team-bot"):');if(!n)return;const r=window.prompt("Display label:",n)||n;try{await K(n.trim(),r.trim()),await y(),v(n.trim()),x({kind:"success",message:`Created "${n}"`})}catch(d){x({kind:"error",message:d.message})}},O=async()=>{if(o!=="default"&&window.confirm(`Delete Slack instance "${o}"? This disconnects it and removes its config.`))try{await W(o),v("default"),await y(),x({kind:"success",message:"Instance deleted"})}catch(n){x({kind:"error",message:n.message})}},R=async()=>{if(!(!l||!T)){E(!0);try{const n={};Object.keys(l).forEach(p=>{const u=l[p];if(u!==T[p]){if((p==="SLACK_BOT_TOKEN"||p==="SLACK_APP_TOKEN")&&u==="********")return;n[p]=u}});const r=a.find(p=>p.id===o),d=r&&g.trim()&&g.trim()!==r.label;await H(o,{label:d?g.trim():void 0,values:Object.keys(n).length>0?n:void 0}),x({kind:"success",message:"Saved. Slack will reconnect with the new settings."}),await y(),await k()}catch(n){x({kind:"error",message:n.message})}finally{E(!1)}}},c=(n,r)=>{l&&S({...l,[n]:r})};return e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:12,fontSize:12,color:"#a6adc8"},children:"Add multiple Slack connections side-by-side. The default instance maps to your existing bot / token; add more for personal (xoxp-) tokens or additional workspaces."}),w&&e.jsx("div",{style:{...s.alert(w.kind),marginBottom:12},children:w.message}),e.jsxs("div",{style:s.container,children:[e.jsxs("div",{style:s.list,children:[a.map(n=>{var d,p,u;const r=((d=n.config)==null?void 0:d.currentMode)??"none";return e.jsxs("div",{style:s.listItem(n.id===o),onClick:()=>v(n.id),children:[e.jsx("div",{style:s.label,children:n.label}),e.jsxs("div",{style:s.sub,children:[e.jsx("span",{style:s.badge(r),children:r==="none"?"—":r}),(p=n.status)!=null&&p.connected?" • connected":(u=n.status)!=null&&u.error?" • error":" • idle"]})]},n.id)}),e.jsx("button",{type:"button",style:s.addBtn,onClick:P,children:"+ Add Instance"})]}),e.jsxs("div",{style:s.editor,children:[D&&e.jsx("div",{style:{color:"#6c7086",fontSize:13},children:"Loading…"}),!D&&l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Display label"}),e.jsx("input",{type:"text",style:s.input,value:g,onChange:n=>I(n.target.value),disabled:!1}),e.jsxs("span",{style:s.fieldDesc,children:["Shown in the instance list. Id is fixed: ",e.jsx("code",{children:o})]})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.enabled,onChange:n=>c("enabled",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Enabled"})]}),e.jsx("span",{style:s.fieldDesc,children:"Toggle off to disconnect this instance without deleting its config."})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.mirrorOwnMessages,onChange:n=>c("mirrorOwnMessages",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Mirror messages I send too"})]}),e.jsxs("span",{style:s.fieldDesc,children:["Capture your outgoing messages alongside incoming ones (logged as ",e.jsx("code",{children:"direction:outbound"}),"). Recommended for personal (xoxp-) tokens. Triggers do not fire on your own messages — that would loop."]})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.reactOnTrigger,onChange:n=>c("reactOnTrigger",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Auto-react with 👀 on trigger"})]}),e.jsxs("span",{style:s.fieldDesc,children:["When a Slack trigger fires on an incoming message, react with ",e.jsx("code",{children:":eyes:"}),' as an "I saw it, working on it" ack. Turn off for accounts where the reaction is noisy. The server env ',e.jsx("code",{children:"SLACK_REACT_ON_TRIGGER=false"})," still disables it across all instances."]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Slack Token"}),e.jsx("input",{type:"password",style:s.input,placeholder:"xoxb-... or xoxp-...",value:l.SLACK_BOT_TOKEN,onChange:n=>c("SLACK_BOT_TOKEN",n.target.value)}),e.jsxs("span",{style:s.fieldDesc,children:["Bot token (xoxb-) → Socket Mode. User token (xoxp-) → Web API polling (~30-60s lag). Stored encrypted under a per-instance key; leave as ",e.jsx("code",{children:"********"})," to keep the existing token."]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"App Token (Socket Mode only)"}),e.jsx("input",{type:"password",style:s.input,placeholder:"xapp-...",value:l.SLACK_APP_TOKEN,onChange:n=>c("SLACK_APP_TOKEN",n.target.value)}),e.jsx("span",{style:s.fieldDesc,children:"Required for xoxb- only. Leave blank for xoxp- (polling mode)."})]}),e.jsxs("div",{style:s.rowGap,children:[e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Inbound Mode"}),e.jsxs("select",{style:s.input,value:l.authMode,onChange:n=>c("authMode",n.target.value),children:[e.jsx("option",{value:"auto",children:"Auto (from token prefix)"}),e.jsx("option",{value:"socket",children:"Socket Mode (xoxb-)"}),e.jsx("option",{value:"polling",children:"Polling (xoxp-)"})]})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Default Channel"}),e.jsx("input",{type:"text",style:s.input,placeholder:"C0123456789",value:l.defaultChannelId,onChange:n=>c("defaultChannelId",n.target.value)})]})]}),e.jsxs("div",{style:s.rowGap,children:[e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Polling Interval (s)"}),e.jsx("input",{type:"number",style:s.input,min:10,max:600,value:l.pollingIntervalSec,onChange:n=>c("pollingIntervalSec",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Concurrency"}),e.jsx("input",{type:"number",style:s.input,min:1,max:8,value:l.pollingConcurrency,onChange:n=>c("pollingConcurrency",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Backfill Cap (msgs)"}),e.jsx("input",{type:"number",style:s.input,min:1,max:1e3,value:l.pollingBackfillMessageCap,onChange:n=>c("pollingBackfillMessageCap",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Min ms between calls"}),e.jsx("input",{type:"number",style:s.input,min:0,max:1e4,value:l.pollingMinMsBetweenCalls,onChange:n=>c("pollingMinMsBetweenCalls",Number(n.target.value))}),e.jsx("span",{style:{...s.fieldDesc,fontSize:11},children:"Throttle. 1500 ≈ 40 req/min. Set 0 to disable."})]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Channel Types (poll all of these)"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:12,marginTop:4},children:C.map(n=>{const d=M(l.pollingChannelTypes).has(n);return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"checkbox",checked:d,onChange:p=>{const u=new Set(M(l.pollingChannelTypes));p.target.checked?u.add(n):u.delete(n),c("pollingChannelTypes",$(u))}}),e.jsx("span",{children:z[n]})]},n)})}),e.jsx("span",{style:s.fieldDesc,children:"Determines which channel types are polled when the allowlist below is empty. Tick all four for full coverage. Heads-up: hundreds of channels at once can hit Slack's rate limit (~50 req/min) — use the allowlist to narrow down."})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:s.fieldLabel,children:"Channel Allowlist (optional)"}),l.pollingChannelAllowlist&&e.jsx("button",{type:"button",style:{...s.btnSecondary,padding:"4px 10px",fontSize:12},onClick:()=>c("pollingChannelAllowlist",""),title:"Clear the allowlist — fall back to polling all channels per the type checkboxes above.",children:"Include all (clear list)"})]}),e.jsx("textarea",{style:{...s.input,minHeight:60,fontFamily:"monospace",fontSize:12},placeholder:`C0123456789, G0987654321
|
|
1
|
+
import{r as h,j as e,c as b,d as m}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const C=["public_channel","private_channel","im","mpim"],z={public_channel:"Public channels",private_channel:"Private channels",im:"1:1 DMs",mpim:"Group DMs"};function M(t){const i=new Set;for(const a of(t||"").split(",")){const f=a.trim();C.includes(f)&&i.add(f)}return i}function $(t){return C.filter(i=>t.has(i)).join(",")}const s={container:{display:"flex",gap:16,minHeight:420},list:{width:200,flexShrink:0,background:"var(--surface-1, #181825)",borderRadius:8,border:"1px solid var(--border, #313244)",padding:8,display:"flex",flexDirection:"column",gap:4},listItem:t=>({padding:"8px 10px",borderRadius:6,cursor:"pointer",background:t?"rgba(137,180,250,0.15)":"transparent",border:t?"1px solid rgba(137,180,250,0.3)":"1px solid transparent",color:t?"#cdd6f4":"#a6adc8",fontSize:13}),label:{fontWeight:500},sub:{fontSize:11,color:"#6c7086",marginTop:2},addBtn:{marginTop:8,padding:"8px 10px",borderRadius:6,background:"transparent",color:"#89b4fa",border:"1px dashed rgba(137,180,250,0.4)",cursor:"pointer",fontSize:13},editor:{flex:1,display:"flex",flexDirection:"column",gap:12},field:{display:"flex",flexDirection:"column",gap:4},fieldLabel:{fontSize:12,fontWeight:500,color:"#a6adc8"},fieldDesc:{fontSize:11,color:"#6c7086"},input:{padding:"8px 10px",background:"var(--surface-0, #1e1e2e)",border:"1px solid var(--border, #313244)",borderRadius:6,color:"#cdd6f4",fontSize:13,fontFamily:"inherit"},badge:t=>{const a={socket:"#a6e3a1",polling:"#89b4fa",none:"#6c7086"}[t]??"#6c7086";return{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:500,background:`${a}26`,color:a,border:`1px solid ${a}55`}},rowGap:{display:"flex",gap:12},buttons:{display:"flex",gap:8,marginTop:12},btnPrimary:{padding:"8px 16px",background:"#89b4fa",color:"#1e1e2e",border:"none",borderRadius:6,cursor:"pointer",fontWeight:500,fontSize:13},btnSecondary:{padding:"8px 16px",background:"transparent",color:"#cdd6f4",border:"1px solid var(--border, #313244)",borderRadius:6,cursor:"pointer",fontSize:13},btnDanger:{padding:"8px 16px",background:"transparent",color:"#f38ba8",border:"1px solid rgba(243,139,168,0.4)",borderRadius:6,cursor:"pointer",fontSize:13},alert:t=>({padding:"8px 12px",borderRadius:6,fontSize:12,background:t==="error"?"rgba(243,139,168,0.15)":"rgba(166,227,161,0.15)",color:t==="error"?"#f38ba8":"#a6e3a1",border:`1px solid ${t==="error"?"rgba(243,139,168,0.3)":"rgba(166,227,161,0.3)"}`})},j="/api/slack/instances";async function N(){const t=await b(m(j));if(!t.ok)throw new Error(`HTTP ${t.status}`);return(await t.json()).instances}async function B(t){const i=await b(m(`${j}/${encodeURIComponent(t)}/values`));if(!i.ok)throw new Error(`HTTP ${i.status}`);return(await i.json()).values}async function K(t,i){const a=await b(m(j),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,label:i})});if(!a.ok){const f=await a.json().catch(()=>({}));throw new Error(f.error||`HTTP ${a.status}`)}}async function H(t,i){const a=await b(m(`${j}/${encodeURIComponent(t)}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const f=await a.json().catch(()=>({}));throw new Error(f.error||`HTTP ${a.status}`)}}async function W(t){const i=await b(m(`${j}/${encodeURIComponent(t)}`),{method:"DELETE"});if(!i.ok){const a=await i.json().catch(()=>({}));throw new Error(a.error||`HTTP ${i.status}`)}}const V=({integration:t,onCancel:i})=>{const[a,f]=h.useState([]),[o,v]=h.useState("default"),[l,S]=h.useState(null),[T,_]=h.useState(null),[g,I]=h.useState(""),[D,A]=h.useState(!1),[L,E]=h.useState(!1),[w,x]=h.useState(null),y=h.useCallback(async()=>{try{const n=await N();f(n),!n.some(d=>d.id===o)&&n.length>0&&v(n[0].id)}catch(n){x({kind:"error",message:`Failed to load instances: ${n.message}`})}},[o]),k=h.useCallback(async()=>{if(o){A(!0);try{const n=await B(o);S(n),_(n);const r=a.find(d=>d.id===o);I((r==null?void 0:r.label)??o)}catch(n){x({kind:"error",message:`Failed to load instance: ${n.message}`})}finally{A(!1)}}},[o,a]);h.useEffect(()=>{y()},[y]),h.useEffect(()=>{k()},[k]);const P=async()=>{const n=window.prompt('Instance id (kebab-case, e.g. "personal", "team-bot"):');if(!n)return;const r=window.prompt("Display label:",n)||n;try{await K(n.trim(),r.trim()),await y(),v(n.trim()),x({kind:"success",message:`Created "${n}"`})}catch(d){x({kind:"error",message:d.message})}},O=async()=>{if(o!=="default"&&window.confirm(`Delete Slack instance "${o}"? This disconnects it and removes its config.`))try{await W(o),v("default"),await y(),x({kind:"success",message:"Instance deleted"})}catch(n){x({kind:"error",message:n.message})}},R=async()=>{if(!(!l||!T)){E(!0);try{const n={};Object.keys(l).forEach(p=>{const u=l[p];if(u!==T[p]){if((p==="SLACK_BOT_TOKEN"||p==="SLACK_APP_TOKEN")&&u==="********")return;n[p]=u}});const r=a.find(p=>p.id===o),d=r&&g.trim()&&g.trim()!==r.label;await H(o,{label:d?g.trim():void 0,values:Object.keys(n).length>0?n:void 0}),x({kind:"success",message:"Saved. Slack will reconnect with the new settings."}),await y(),await k()}catch(n){x({kind:"error",message:n.message})}finally{E(!1)}}},c=(n,r)=>{l&&S({...l,[n]:r})};return e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:12,fontSize:12,color:"#a6adc8"},children:"Add multiple Slack connections side-by-side. The default instance maps to your existing bot / token; add more for personal (xoxp-) tokens or additional workspaces."}),w&&e.jsx("div",{style:{...s.alert(w.kind),marginBottom:12},children:w.message}),e.jsxs("div",{style:s.container,children:[e.jsxs("div",{style:s.list,children:[a.map(n=>{var d,p,u;const r=((d=n.config)==null?void 0:d.currentMode)??"none";return e.jsxs("div",{style:s.listItem(n.id===o),onClick:()=>v(n.id),children:[e.jsx("div",{style:s.label,children:n.label}),e.jsxs("div",{style:s.sub,children:[e.jsx("span",{style:s.badge(r),children:r==="none"?"—":r}),(p=n.status)!=null&&p.connected?" • connected":(u=n.status)!=null&&u.error?" • error":" • idle"]})]},n.id)}),e.jsx("button",{type:"button",style:s.addBtn,onClick:P,children:"+ Add Instance"})]}),e.jsxs("div",{style:s.editor,children:[D&&e.jsx("div",{style:{color:"#6c7086",fontSize:13},children:"Loading…"}),!D&&l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Display label"}),e.jsx("input",{type:"text",style:s.input,value:g,onChange:n=>I(n.target.value),disabled:!1}),e.jsxs("span",{style:s.fieldDesc,children:["Shown in the instance list. Id is fixed: ",e.jsx("code",{children:o})]})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.enabled,onChange:n=>c("enabled",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Enabled"})]}),e.jsx("span",{style:s.fieldDesc,children:"Toggle off to disconnect this instance without deleting its config."})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.mirrorOwnMessages,onChange:n=>c("mirrorOwnMessages",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Mirror messages I send too"})]}),e.jsxs("span",{style:s.fieldDesc,children:["Capture your outgoing messages alongside incoming ones (logged as ",e.jsx("code",{children:"direction:outbound"}),"). Recommended for personal (xoxp-) tokens. Triggers do not fire on your own messages — that would loop."]})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.reactOnTrigger,onChange:n=>c("reactOnTrigger",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Auto-react with 👀 on trigger"})]}),e.jsxs("span",{style:s.fieldDesc,children:["When a Slack trigger fires on an incoming message, react with ",e.jsx("code",{children:":eyes:"}),' as an "I saw it, working on it" ack. Turn off for accounts where the reaction is noisy. The server env ',e.jsx("code",{children:"SLACK_REACT_ON_TRIGGER=false"})," still disables it across all instances."]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Slack Token"}),e.jsx("input",{type:"password",style:s.input,placeholder:"xoxb-... or xoxp-...",value:l.SLACK_BOT_TOKEN,onChange:n=>c("SLACK_BOT_TOKEN",n.target.value)}),e.jsxs("span",{style:s.fieldDesc,children:["Bot token (xoxb-) → Socket Mode. User token (xoxp-) → Web API polling (~30-60s lag). Stored encrypted under a per-instance key; leave as ",e.jsx("code",{children:"********"})," to keep the existing token."]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"App Token (Socket Mode only)"}),e.jsx("input",{type:"password",style:s.input,placeholder:"xapp-...",value:l.SLACK_APP_TOKEN,onChange:n=>c("SLACK_APP_TOKEN",n.target.value)}),e.jsx("span",{style:s.fieldDesc,children:"Required for xoxb- only. Leave blank for xoxp- (polling mode)."})]}),e.jsxs("div",{style:s.rowGap,children:[e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Inbound Mode"}),e.jsxs("select",{style:s.input,value:l.authMode,onChange:n=>c("authMode",n.target.value),children:[e.jsx("option",{value:"auto",children:"Auto (from token prefix)"}),e.jsx("option",{value:"socket",children:"Socket Mode (xoxb-)"}),e.jsx("option",{value:"polling",children:"Polling (xoxp-)"})]})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Default Channel"}),e.jsx("input",{type:"text",style:s.input,placeholder:"C0123456789",value:l.defaultChannelId,onChange:n=>c("defaultChannelId",n.target.value)})]})]}),e.jsxs("div",{style:s.rowGap,children:[e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Polling Interval (s)"}),e.jsx("input",{type:"number",style:s.input,min:10,max:600,value:l.pollingIntervalSec,onChange:n=>c("pollingIntervalSec",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Concurrency"}),e.jsx("input",{type:"number",style:s.input,min:1,max:8,value:l.pollingConcurrency,onChange:n=>c("pollingConcurrency",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Backfill Cap (msgs)"}),e.jsx("input",{type:"number",style:s.input,min:1,max:1e3,value:l.pollingBackfillMessageCap,onChange:n=>c("pollingBackfillMessageCap",Number(n.target.value))})]}),e.jsxs("div",{style:{...s.field,flex:1},children:[e.jsx("span",{style:s.fieldLabel,children:"Min ms between calls"}),e.jsx("input",{type:"number",style:s.input,min:0,max:1e4,value:l.pollingMinMsBetweenCalls,onChange:n=>c("pollingMinMsBetweenCalls",Number(n.target.value))}),e.jsx("span",{style:{...s.fieldDesc,fontSize:11},children:"Throttle. 1500 ≈ 40 req/min. Set 0 to disable."})]})]}),e.jsxs("div",{style:s.field,children:[e.jsx("span",{style:s.fieldLabel,children:"Channel Types (poll all of these)"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:12,marginTop:4},children:C.map(n=>{const d=M(l.pollingChannelTypes).has(n);return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"checkbox",checked:d,onChange:p=>{const u=new Set(M(l.pollingChannelTypes));p.target.checked?u.add(n):u.delete(n),c("pollingChannelTypes",$(u))}}),e.jsx("span",{children:z[n]})]},n)})}),e.jsx("span",{style:s.fieldDesc,children:"Determines which channel types are polled when the allowlist below is empty. Tick all four for full coverage. Heads-up: hundreds of channels at once can hit Slack's rate limit (~50 req/min) — use the allowlist to narrow down."})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:s.fieldLabel,children:"Channel Allowlist (optional)"}),l.pollingChannelAllowlist&&e.jsx("button",{type:"button",style:{...s.btnSecondary,padding:"4px 10px",fontSize:12},onClick:()=>c("pollingChannelAllowlist",""),title:"Clear the allowlist — fall back to polling all channels per the type checkboxes above.",children:"Include all (clear list)"})]}),e.jsx("textarea",{style:{...s.input,minHeight:60,fontFamily:"monospace",fontSize:12},placeholder:`C0123456789, G0987654321
|
|
2
2
|
C9999999999`,value:l.pollingChannelAllowlist,onChange:n=>c("pollingChannelAllowlist",n.target.value)}),e.jsx("span",{style:s.fieldDesc,children:'Comma- or newline-separated channel IDs. When set, polling restricts to these channels (plus DMs if "Always include DMs" is on). The Channel Types checkboxes above are ignored while an allowlist is active. Leave blank to fall back to polling all channels per the type checkboxes.'})]}),e.jsxs("div",{style:s.field,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.pollingDmsAlways,onChange:n=>c("pollingDmsAlways",n.target.checked)}),e.jsx("span",{style:s.fieldLabel,children:"Always include DMs"})]}),e.jsx("span",{style:s.fieldDesc,children:"When the allowlist is set, still poll all 1:1 DMs (D-prefix). Default on. Turn off for strict allowlist-only mode."})]}),e.jsxs("div",{style:s.buttons,children:[e.jsx("button",{type:"button",style:s.btnPrimary,onClick:R,disabled:L,children:L?"Saving…":"Save & Reconnect"}),e.jsx("button",{type:"button",style:s.btnSecondary,onClick:i,children:"Close"}),o!=="default"&&e.jsx("button",{type:"button",style:{...s.btnDanger,marginLeft:"auto"},onClick:O,children:"Delete Instance"})]})]})]})]})]})};export{V as SlackMultiInstanceSetup,V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as ts,i as ls,k as os,l as cs,B as rs,r as l,m as Te,S as ue,D as is,C as L,n as G,o as se,p as ae,q as he,A as Re,d as we,c as ds,s as k,g as ps,j as e,I as ne,M as ms,t as Fe,H as f,F as us,P as xe,O as hs,G as te,v as ws,w as xs,x as fs,y as js,z as gs}from"./main-33HX-Nre.js";import{D as vs}from"./common-types-CZVd6J8k.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function Oe(p,v){const M=v.filter(S=>!p.has(S));return M.length===0?`${v[Math.floor(Math.random()*v.length)]}-${Date.now()%1e3}`:M[Math.floor(Math.random()*M.length)]}function Ms({isOpen:p,onClose:v,onSpawnStart:M,onSpawnEnd:S,spawnPosition:Ue,spawnAreaId:N,initialSession:t}){const{t:a}=ts(["terminal","common"]),q=ls(),m=os(),fe=cs(),le=fe.length>0?fe:rs,[u,b]=l.useState(""),[y,$]=l.useState(()=>Te(ue.LAST_CWD)),[r,E]=l.useState("scout"),[je,P]=l.useState(!1),[ze,W]=l.useState(!1),[ge,oe]=l.useState(!1),[ve,Ne]=l.useState(""),[A,ce]=l.useState([]),[D,T]=l.useState(null),[Ge,be]=l.useState(!1),[R,Ce]=l.useState(""),[w,qe]=l.useState(""),[B,We]=l.useState(!1),[K,Be]=l.useState("bypass"),[c,I]=l.useState("claude"),[j,C]=l.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[re,ie]=l.useState(new Set),[F,de]=l.useState("claude-opus-4-8[1m]"),[H,pe]=l.useState("xHigh"),[J,ke]=l.useState("gpt-5.6-luna"),[X,Me]=l.useState("minimax/MiniMax-M1-80k"),[O,Se]=l.useState(is),[Y,ye]=l.useState(""),[Ee,Ke]=l.useState(""),[_,He]=l.useState(""),Q=l.useRef(null),Ae=l.useRef(!1),U=l.useCallback(()=>{window.__spawnModalAreaContext=null},[]),x=l.useMemo(()=>q.filter(s=>s.enabled),[q]);l.useEffect(()=>{if(p&&!Ae.current){if(x.length>0){const o=x.filter(i=>vs.includes(i.slug)).map(i=>i.id);o.length>0&&ie(new Set(o))}const n=Te(ue.DEFAULT_AGENT_CLASS);if(n==="random"){const i=[...Object.keys(js),...m.map(h=>h.id)];E(i[Math.floor(Math.random()*i.length)])}else E(n||"scout");if(t&&($(t.cwd),T(t.sessionId),I(t.provider),t.model&&(t.provider==="claude"&&t.model in L?de(t.model):t.provider==="codex"&&t.model in G?ke(t.model):t.provider==="opencode"?Me(t.model):t.provider==="grok"?Se(t.model):t.provider==="pi"&&ye(t.model)),t.effort)){const o=t.effort==="xhigh"?"xHigh":t.effort;t.provider==="codex"?t.effort in se&&C(i=>({...i,reasoningEffort:t.effort})):o in ae&&pe(o)}}Ae.current=p},[p,x,m,t]);const De=l.useMemo(()=>{if(!_.trim())return x;const s=_.toLowerCase();return x.filter(n=>n.name.toLowerCase().includes(s)||n.description.toLowerCase().includes(s)||n.slug.toLowerCase().includes(s))},[x,_]),Je=l.useCallback(s=>{ie(n=>{const o=new Set(n);return o.has(s)?o.delete(s):o.add(s),o})},[]);l.useMemo(()=>x.filter(s=>s.assignedAgentClasses.includes(r)),[x,r]);const Xe=l.useMemo(()=>{var n;const s=m.find(o=>o.id===r);return(n=s==null?void 0:s.defaultSkillIds)!=null&&n.length?q.filter(o=>s.defaultSkillIds.includes(o.id)):[]},[m,r,q]),Ie=l.useMemo(()=>{if(!R.trim())return A;const s=R.toLowerCase();return A.filter(n=>n.sessionId.toLowerCase().includes(s)||n.projectPath.toLowerCase().includes(s)||n.firstMessage&&n.firstMessage.toLowerCase().includes(s))},[A,R]),V=l.useMemo(()=>{if(!w.trim())return m;const s=w.toLowerCase();return m.filter(n=>n.name.toLowerCase().includes(s)||n.description.toLowerCase().includes(s)||n.id.toLowerCase().includes(s))},[m,w]),Z=l.useMemo(()=>{if(!w.trim())return he;const s=w.toLowerCase();return he.filter(n=>{const o=Re[n.id];return n.name.toLowerCase().includes(s)||n.id.toLowerCase().includes(s)||o.description.toLowerCase().includes(s)})},[w]);l.useEffect(()=>{if(!p||!w.trim())return;const s=[...V.map(n=>n.id),...Z.map(n=>n.id)];s.length===1&&s[0]!==r&&E(s[0])},[p,w,V,Z,r]);const d=l.useMemo(()=>m.find(s=>s.id===r),[m,r]),Ye=l.useMemo(()=>{if(d!=null&&d.model)return d.model},[d]),Qe=l.useMemo(()=>{if(d!=null&&d.customModelPath)return we(`/api/custom-models/${d.id}`)},[d]),Ve=d==null?void 0:d.modelScale,Ze=l.useMemo(()=>d?"scout":r,[r,d]),ee=l.useCallback(async s=>{be(!0);try{const n=s?we(`/api/agents/claude-sessions?cwd=${encodeURIComponent(s)}`):we("/api/agents/claude-sessions"),i=await(await ds(n)).json();ce(i.sessions||[])}catch(n){console.error("Failed to fetch sessions:",n),ce([])}finally{be(!1)}},[]);l.useEffect(()=>{p&&!t?ee(y||void 0):p||(ce([]),T(null),Ce(""))},[p,ee,t]),l.useEffect(()=>{if(!p||t)return;const s=setTimeout(()=>{ee(y||void 0),T(null)},300);return()=>clearTimeout(s)},[y,p,ee,t]),l.useEffect(()=>{if(!p||!N)return;const s=k.getState().areas.get(N);if(s!=null&&s.directories&&s.directories.length>0){$(s.directories[0]);return}const n=Array.from(k.getState().agents.values()).filter(g=>{var z;return((z=k.getAreaForAgent(g.id))==null?void 0:z.id)===N&&g.cwd});if(n.length===0)return;const o=new Map;for(const g of n)o.set(g.cwd,(o.get(g.cwd)||0)+1);let i="",h=0;for(const[g,z]of o)z>h&&(i=g,h=z);i&&$(i)},[p,N]),l.useEffect(()=>{if(p){const s=new Set(Array.from(k.getState().agents.values()).map(h=>h.name)),n=Oe(s,le),o=m.find(h=>h.id===r),i=o?`${o.name} ${n}`:n;b(i),Q.current&&(Q.current.focus(),Q.current.select())}},[p,le]),l.useEffect(()=>{if(!p)return;const s=m.find(n=>n.id===r);if(s){const n=m.find(o=>u.startsWith(o.name+" "));if(n){const o=u.substring(n.name.length+1);b(`${s.name} ${o}`)}else b(`${s.name} ${u}`)}else{const n=m.find(o=>u.startsWith(o.name+" "));if(n){const o=u.substring(n.name.length+1);b(o)}}},[r]),l.useEffect(()=>{r==="boss"&&de("claude-opus-4-8[1m]")},[r]);const es=()=>{var i;console.log("[SpawnModal] handleSpawn called"),W(!1);const s=(t==null?void 0:t.cwd)||D&&((i=A.find(h=>h.sessionId===D))==null?void 0:i.projectPath)||y;if(console.log("[SpawnModal] Effective CWD:",s),console.log("[SpawnModal] Agent name:",u),console.log("[SpawnModal] Agent class:",r),console.log("[SpawnModal] Permission mode:",K),console.log("[SpawnModal] Provider:",c),console.log("[SpawnModal] Use Chrome:",B),console.log("[SpawnModal] Session ID:",D||"none"),!s.trim()){console.error("[SpawnModal] Empty CWD, showing error"),W(!0);return}if(!u.trim()){console.log("[SpawnModal] Empty name, regenerating");const h=new Set(Array.from(k.getState().agents.values()).map(g=>g.name));b(Oe(h,le));return}gs(ue.LAST_CWD,s),P(!0),M();const n=Array.from(re),o=Ee.trim()||void 0;console.log("[SpawnModal] Calling store.spawnAgent with:",{name:u.trim(),class:r,cwd:s.trim(),sessionId:D||void 0,useChrome:c==="claude"?B:!1,permissionMode:K,provider:c,codexConfig:c==="codex"?j:void 0,codexModel:c==="codex"?J:void 0,opencodeModel:c==="opencode"?X:void 0,grokModel:c==="grok"?O:void 0,piModel:c==="pi"&&Y||void 0,initialSkillIds:n,model:c==="claude"?F:void 0,customInstructions:o?`${o.length} chars`:void 0,spawnAreaId:N||void 0}),window.__spawnModalAreaContext=N?{areaId:N}:null,k.spawnAgent(u.trim(),r,s.trim(),Ue||void 0,D||void 0,c==="claude"?B:!1,K,n,c,c==="codex"?j:void 0,c==="codex"?J:void 0,c==="claude"?F:void 0,o,c==="claude"||c==="grok"||c==="pi"?H:void 0,c==="opencode"?X:void 0,c==="grok"?O:void 0,c==="pi"&&Y||void 0)},_e=()=>{console.log("[SpawnModal] Agent creation successful"),P(!1),b(""),ie(new Set),U(),S(),v()},Le=()=>{console.error("[SpawnModal] Agent creation failed"),P(!1),W(!0),U(),S()},$e=s=>{console.log("[SpawnModal] Directory not found:",s),P(!1),Ne(s),oe(!0),S()},Pe=()=>{oe(!1),P(!0),M(),k.createDirectoryAndSpawn(ve,u.trim(),r)},me=()=>{oe(!1),Ne(""),U()};l.useEffect(()=>(window.__spawnModalSuccess=_e,window.__spawnModalError=Le,window.__spawnModalDirNotFound=$e,()=>{U(),delete window.__spawnModalSuccess,delete window.__spawnModalError,delete window.__spawnModalDirNotFound}),[u,r,_e,Le,$e,U]);const{handleMouseDown:ss,handleClick:as}=ps(v),ns=s=>{s.key==="Escape"&&v()};return!p&&!ge?null:ge?e.jsx("div",{className:"modal-overlay visible",onClick:me,onKeyDown:s=>{s.key==="Escape"&&me(),s.key==="Enter"&&Pe()},children:e.jsxs("div",{className:"modal confirm-modal",onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:a("terminal:spawn.directoryNotFound")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:a("terminal:spawn.directoryNotExist")}),e.jsx("code",{className:"confirm-modal-path",children:ve}),e.jsx("p",{children:a("terminal:spawn.wouldYouCreate")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:me,children:a("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:Pe,autoFocus:!0,children:a("terminal:spawn.createDirectory")})]})]})}):e.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onMouseDown:ss,onClick:as,onKeyDown:ns,children:e.jsxs("div",{className:"modal spawn-modal",children:[e.jsx("div",{className:"modal-header",children:t?"Restore conversation to new agent":a("terminal:spawn.deployTitle")}),e.jsxs("div",{className:"modal-body spawn-modal-body",children:[t&&e.jsxs("div",{className:"spawn-restore-banner",children:[e.jsx(ne,{name:"history",size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conversation ready to restore"}),e.jsxs("span",{children:[t.provider,t.model?` · ${t.model}`:""," · ",t.sessionId.slice(0,8),"…"]})]}),e.jsx("span",{className:"spawn-restore-banner-hint",children:"Choose the new agent's characteristics below"})]}),e.jsxs("div",{className:"spawn-section",children:[e.jsxs("div",{className:"spawn-section-header",children:[e.jsx("h4",{className:"spawn-section-title",children:a("terminal:spawn.agentClass")}),e.jsx("span",{className:"spawn-section-hint",children:(d==null?void 0:d.name)||r})]}),e.jsxs("div",{className:"spawn-top-section",children:[e.jsxs("div",{className:"spawn-preview-compact",children:[e.jsx(ms,{agentClass:Ze,modelFile:Ye,customModelUrl:Qe,modelScale:Ve,width:110,height:130}),e.jsx("div",{className:"spawn-preview-label",children:(d==null?void 0:d.name)||r})]}),e.jsxs("div",{className:"spawn-class-section",children:[m.length+he.length>6&&e.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:a("terminal:spawn.filterClasses"),value:w,onChange:s=>qe(s.target.value)}),e.jsxs("div",{className:"class-selector-inline",children:[V.map(s=>e.jsxs("button",{className:`class-chip ${r===s.id?"selected":""}`,onClick:()=>E(s.id),title:s.description,children:[e.jsx(Fe,{classId:s.id,size:18,className:"class-chip-icon"}),e.jsx("span",{className:"class-chip-name",children:s.name})]},s.id)),Z.map(s=>{const n=Re[s.id];return e.jsxs("button",{className:`class-chip ${r===s.id?"selected":""}`,onClick:()=>E(s.id),title:n.description,children:[e.jsx(Fe,{classId:s.id,size:18,className:"class-chip-icon"}),e.jsx("span",{className:"class-chip-name",children:s.name})]},s.id)}),w&&V.length===0&&Z.length===0&&e.jsx("div",{className:"class-search-empty",children:a("terminal:spawn.noClassesMatch",{query:w})})]})]})]}),e.jsxs("div",{className:"spawn-form-row",children:[e.jsxs("div",{className:"spawn-field",children:[e.jsx("label",{className:"spawn-label",children:a("common:labels.name")}),e.jsx("input",{ref:Q,type:"text",className:"spawn-input",placeholder:a("terminal:spawn.agentNamePlaceholder"),value:u,onChange:s=>b(s.target.value)})]}),e.jsxs("div",{className:"spawn-field spawn-field-wide",children:[e.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.workingDir"),e.jsx(f,{text:a("terminal:spawn.helpWorkingDir"),title:a("terminal:spawn.workingDir"),position:"top",size:"sm"})]}),e.jsx(us,{value:y,onChange:s=>{$(s),W(!1)},placeholder:a("terminal:spawn.workingDirPlaceholder"),className:`spawn-input ${ze?"error":""}`,directoriesOnly:!0})]})]})]}),e.jsxs("div",{className:"spawn-section",children:[e.jsx("div",{className:"spawn-section-header",children:e.jsx("h4",{className:"spawn-section-title",children:a("terminal:spawn.selectRuntime")})}),e.jsxs("div",{className:"spawn-form-row",children:[e.jsxs("div",{className:"spawn-field",children:[e.jsxs("label",{className:"spawn-label",children:[a("common:labels.runtime"),e.jsx(f,{text:a("terminal:spawn.helpRuntime"),title:a("terminal:spawn.runtimeTitle"),position:"top",size:"sm"})]}),e.jsxs("div",{className:"spawn-select-row",children:[e.jsxs("button",{className:`spawn-select-btn ${c==="claude"?"selected":""}`,onClick:()=>I("claude"),disabled:!!t,title:t?"Runtime is fixed by the restored conversation":a("terminal:spawn.useClaudeCli"),children:[e.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),e.jsx("span",{children:"Claude"})]}),e.jsxs("button",{className:`spawn-select-btn ${c==="codex"?"selected":""}`,onClick:()=>I("codex"),disabled:!!t,title:t?"Runtime is fixed by the restored conversation":a("terminal:spawn.useCodexCli"),children:[e.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),e.jsx("span",{children:"Codex"})]}),e.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${c==="opencode"?"selected":""}`,onClick:()=>I("opencode"),disabled:!!t,title:t?"Runtime is fixed by the restored conversation":"Use OpenCode CLI (multi-provider)",children:[e.jsx("img",{src:"/assets/opencode.svg",alt:"OpenCode",className:"spawn-provider-icon"}),e.jsx("span",{children:"OpenCode"})]}),e.jsxs("button",{className:`spawn-select-btn spawn-select-btn--grok ${c==="grok"?"selected":""}`,onClick:()=>I("grok"),disabled:!!t,title:t?"Runtime is fixed by the restored conversation":"Use Grok CLI (headless)",children:[e.jsx("img",{src:"/assets/grok.png",alt:"Grok",className:"spawn-provider-icon"}),e.jsx("span",{children:"Grok"})]}),e.jsxs("button",{className:`spawn-select-btn spawn-select-btn--pi ${c==="pi"?"selected":""}`,onClick:()=>I("pi"),disabled:!!t,title:t?"Runtime is fixed by the restored conversation":"Use Pi coding agent CLI (multi-provider)",children:[e.jsx("img",{src:"/assets/pi.svg",alt:"Pi",className:"spawn-provider-icon"}),e.jsx("span",{children:"Pi"})]})]})]}),e.jsxs("div",{className:"spawn-field",children:[e.jsxs("label",{className:"spawn-label",children:[a("common:labels.permissions"),e.jsx(f,{text:a("terminal:spawn.helpPermission"),title:a("terminal:spawn.permissionMode"),position:"top",size:"sm"})]}),e.jsx("div",{className:"spawn-select-row",children:Object.keys(xe).map(s=>e.jsxs("button",{className:`spawn-select-btn ${K===s?"selected":""}`,onClick:()=>Be(s),title:xe[s].description,children:[e.jsx("span",{children:e.jsx(ne,{name:s==="bypass"?"bolt":"lock",size:12})}),e.jsx("span",{children:xe[s].label})]},s))})]})]}),e.jsx("div",{className:"spawn-form-row",children:e.jsxs("div",{className:"spawn-field",children:[e.jsxs("label",{className:"spawn-label",children:[a("common:labels.model"),e.jsx(f,{text:a("terminal:spawn.helpModel"),title:a("terminal:spawn.modelTitle"),position:"top",size:"sm"})]}),c==="claude"?e.jsx("div",{className:"spawn-select-row spawn-select-row--wrap",children:Object.keys(L).filter(s=>!L[s].deprecated||F===s).map(s=>e.jsxs("button",{className:`spawn-select-btn ${F===s?"selected":""}`,onClick:()=>de(s),title:L[s].description,children:[e.jsx("span",{children:L[s].icon}),e.jsx("span",{children:L[s].label})]},s))}):c==="codex"?e.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(G).map(s=>e.jsxs("button",{className:`spawn-select-btn ${J===s?"selected":""}`,onClick:()=>ke(s),title:G[s].description,children:[e.jsx("span",{children:G[s].icon}),e.jsx("span",{children:G[s].label})]},s))}):c==="opencode"?e.jsx(hs,{value:X,onChange:Me,inputId:"spawn-opencode-model"}):c==="grok"?e.jsx("div",{className:"spawn-select-row spawn-select-row--wrap",children:Object.keys(te).map(s=>e.jsxs("button",{className:`spawn-select-btn ${O===s?"selected":""}`,onClick:()=>Se(s),title:te[s].description,children:[e.jsx("span",{children:te[s].icon}),e.jsx("span",{children:te[s].label})]},s))}):c==="pi"?e.jsx(ws,{value:Y,onChange:ye,inputId:"spawn-pi-model"}):e.jsx("div",{className:"spawn-inline-hint",children:a("terminal:spawn.chooseCodexModel")}),e.jsx(xs,{provider:c,claudeModel:F,codexModel:J,opencodeModel:X,grokModel:O,piModel:Y})]})}),e.jsxs("div",{className:"spawn-form-row",children:[(c==="claude"||c==="grok"||c==="pi")&&e.jsxs("div",{className:"spawn-field",children:[e.jsx("label",{className:"spawn-label",children:"Effort"}),e.jsxs("div",{className:"spawn-select-row spawn-select-row--effort",children:[e.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${H===void 0?"selected":""}`,onClick:()=>pe(void 0),title:"Use default effort level",children:e.jsx("span",{children:"Default"})}),Object.keys(ae).filter(s=>c!=="grok"||fs(O,s)||H===s).map(s=>e.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${H===s?"selected":""}`,onClick:()=>pe(s),title:ae[s].description,children:e.jsx("span",{children:ae[s].label})},s))]})]}),e.jsxs("div",{className:"spawn-field",children:[e.jsx("label",{className:"spawn-label",children:a("terminal:spawn.browser")}),e.jsxs("label",{className:"spawn-checkbox",children:[e.jsx("input",{type:"checkbox",checked:B,onChange:s=>We(s.target.checked),disabled:c!=="claude"}),e.jsxs("span",{children:[e.jsx(ne,{name:"globe",size:12})," ",a("terminal:spawn.chromeBrowser")]}),e.jsx(f,{text:a(c==="claude"?"terminal:spawn.helpChrome":"terminal:spawn.helpChromeDisabled"),title:a("terminal:spawn.chromeBrowser"),position:"top",size:"sm"})]})]})]}),c==="codex"&&e.jsxs("div",{className:"codex-config-section",children:[e.jsx("div",{className:"codex-config-title",children:a("terminal:spawn.codex.configuration")}),e.jsxs("div",{className:"codex-config-options",children:[e.jsxs("div",{className:"codex-option-group",children:[e.jsxs("label",{className:"spawn-checkbox",children:[e.jsx("input",{type:"checkbox",checked:j.fullAuto!==!1,onChange:s=>C(n=>({...n,fullAuto:s.target.checked}))}),e.jsx("span",{children:a("terminal:spawn.codex.fullAuto")}),e.jsx(f,{text:a("terminal:spawn.helpFullAuto"),title:a("terminal:spawn.fullAutoTitle"),position:"top",size:"sm"})]}),e.jsxs("label",{className:"spawn-checkbox",children:[e.jsx("input",{type:"checkbox",checked:!!j.search,onChange:s=>C(n=>({...n,search:s.target.checked}))}),e.jsx("span",{children:a("terminal:spawn.codex.search")}),e.jsx(f,{text:a("terminal:spawn.helpSearch"),title:a("terminal:spawn.searchTitle"),position:"top",size:"sm"})]})]}),j.fullAuto===!1&&e.jsxs("div",{className:"codex-option-group",children:[e.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.restrictions")}),e.jsxs("select",{className:"spawn-input codex-select",value:j.sandbox||"workspace-write",onChange:s=>C(n=>({...n,sandbox:s.target.value})),children:[e.jsxs("option",{value:"read-only",children:["📖 ",a("terminal:spawn.codex.sandboxReadOnly")]}),e.jsxs("option",{value:"workspace-write",children:["✏️ ",a("terminal:spawn.codex.sandboxWorkspaceWrite")]}),e.jsxs("option",{value:"danger-full-access",children:["⚡ ",a("terminal:spawn.codex.sandboxDangerFullAccess")]})]}),e.jsxs("select",{className:"spawn-input codex-select",value:j.approvalMode||"on-request",onChange:s=>C(n=>({...n,approvalMode:s.target.value})),children:[e.jsxs("option",{value:"untrusted",children:["🔒 ",a("terminal:spawn.codex.approvalsUntrusted")]}),e.jsxs("option",{value:"on-failure",children:["⚠️ ",a("terminal:spawn.codex.approvalsOnFailure")]}),e.jsxs("option",{value:"on-request",children:["🤔 ",a("terminal:spawn.codex.approvalsOnRequest")]}),e.jsxs("option",{value:"never",children:["✅ ",a("terminal:spawn.codex.approvalsNever")]})]})]}),e.jsxs("div",{className:"codex-option-group",children:[e.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.profile")}),e.jsx("input",{type:"text",className:"spawn-input codex-profile-input",placeholder:a("terminal:spawn.codex.profilePlaceholder"),value:j.profile||"",onChange:s=>C(n=>({...n,profile:s.target.value||void 0}))})]}),e.jsxs("div",{className:"codex-option-group",children:[e.jsx("div",{className:"codex-option-header",children:a("terminal:spawn.codex.reasoningEffort")}),e.jsxs("select",{className:"spawn-input codex-select",value:j.reasoningEffort||"",onChange:s=>C(n=>({...n,reasoningEffort:s.target.value||void 0})),children:[e.jsx("option",{value:"",children:a("terminal:spawn.codex.reasoningEffortDefault")}),Object.keys(se).map(s=>e.jsxs("option",{value:s,children:[se[s].icon," ",se[s].label]},s))]})]})]})]})]}),x.length>0&&e.jsxs("div",{className:"spawn-section spawn-skills-section",children:[e.jsxs("div",{className:"spawn-section-header",children:[e.jsxs("h4",{className:"spawn-section-title",children:[a("terminal:spawn.skills"),e.jsx(f,{text:a("terminal:spawn.helpSkills"),title:a("terminal:spawn.skillsTitle"),position:"top",size:"sm"})]}),e.jsxs("span",{className:"spawn-section-hint",children:[re.size," selected · ",a("common:labels.optional")]})]}),x.length>6&&e.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:a("terminal:spawn.filterSkills"),value:_,onChange:s=>He(s.target.value)}),e.jsxs("div",{className:"spawn-skills-inline",children:[De.map(s=>{const n=re.has(s.id);return Xe.some(i=>i.id===s.id)?null:e.jsxs("button",{className:`spawn-skill-chip ${n?"selected":""}`,onClick:()=>Je(s.id),title:s.description,children:[n&&e.jsx("span",{className:"spawn-skill-check",children:e.jsx(ne,{name:"check",size:10})}),e.jsx("span",{children:s.name}),s.builtin&&e.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},s.id)}),_&&De.length===0&&e.jsx("div",{className:"skill-search-empty",children:a("terminal:spawn.noSkillsMatch",{query:_})})]})]}),e.jsxs("details",{className:"spawn-advanced",children:[e.jsx("summary",{children:t?a("terminal:spawn.customInstructions"):`${a("terminal:spawn.customInstructions")} & ${a("terminal:spawn.linkSession")}`}),e.jsxs("div",{className:"spawn-advanced-body",children:[e.jsxs("div",{className:"spawn-custom-instructions-section",children:[e.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.customInstructions")," ",e.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),e.jsx(f,{text:a("terminal:spawn.helpCustomInstructions"),title:a("terminal:spawn.customInstructions"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:a("terminal:spawn.customInstructionsPlaceholder"),value:Ee,onChange:s=>Ke(s.target.value),rows:3})]}),!t&&e.jsxs("div",{className:"spawn-sessions-section",children:[e.jsxs("label",{className:"spawn-label",children:[a("terminal:spawn.linkSession")," ",e.jsxs("span",{className:"spawn-label-hint",children:["(",a("common:labels.optional"),")"]}),e.jsx(f,{text:a("terminal:spawn.helpLinkSession"),title:a("terminal:spawn.linkSessionTitle"),position:"top",size:"sm"})]}),A.length>0&&e.jsx("input",{type:"text",className:"spawn-input session-search-input",placeholder:a("terminal:spawn.searchSessions"),value:R,onChange:s=>Ce(s.target.value)}),e.jsx("div",{className:"sessions-list",children:Ge?e.jsx("div",{className:"sessions-loading",children:a("terminal:spawn.loadingSessions")}):A.length===0?e.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessions")}):Ie.length===0?e.jsx("div",{className:"sessions-empty",children:a("terminal:spawn.noSessionsMatch",{query:R})}):Ie.map(s=>{const n=D===s.sessionId,o=Date.now()-new Date(s.lastModified).getTime(),i=o<6e4?a("common:time.justNow"):o<36e5?a("common:time.minutesAgo",{count:Math.floor(o/6e4)}):o<864e5?a("common:time.hoursAgo",{count:Math.floor(o/36e5)}):a("common:time.daysAgo",{count:Math.floor(o/864e5)});return e.jsxs("div",{className:`session-item ${n?"selected":""}`,onClick:()=>{n?T(null):(T(s.sessionId),$(s.projectPath))},children:[e.jsxs("div",{className:"session-item-header",children:[e.jsx("span",{className:"session-item-path",children:s.projectPath}),e.jsx("span",{className:"session-item-age",children:i})]}),e.jsx("div",{className:"session-item-preview",children:s.firstMessage||a("terminal:spawn.messagesCount",{count:s.messageCount})})]},s.sessionId)})})]})]})]})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:v,children:a("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:es,disabled:je,children:je?t?"Restoring…":a("common:buttons.deploying"):t?"Restore conversation":a("common:buttons2.deploy")})]})]})})}export{Ms as SpawnModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as U,g as R,U as j,a2 as F,a3 as B,j as t,a4 as G,I,a5 as k}from"./main-DuaHyH5t.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const b=["#6ab8c8","#c89a5a","#9a80c0","#5cb88a","#c85a5a","#c87a9a","#c8c87a","#5a8fd4","#d45a5a","#8a6fbf"],P=14,w=720,C=260,p={top:16,right:20,bottom:42,left:64};function W(){const i=new Date;return i.setHours(0,0,0,0),i.getTime()}function $(i){if(!i)return"N/A";try{return new Date(i).toLocaleString()}catch{return"N/A"}}function z(i,s){if(i.length===0||s<=0)return"conic-gradient(rgba(50, 50, 62, 0.95) 0deg 360deg)";let a=0;return`conic-gradient(${i.map((h,l)=>{const c=a,n=h.tokens.total/s*360;return a+=n,`${b[l%b.length]} ${c.toFixed(2)}deg ${a.toFixed(2)}deg`}).join(", ")})`}function E(i){const[,s,a]=i.split("-");return!s||!a?i:`${s}/${a}`}function q(i){const s=(i==null?void 0:i.days)??[];if(s.length===0)return[];const a=new Map;for(const l of s)for(const c of l.agents){const n=a.get(c.agentId)??{agentName:c.agentName,total:0};n.total+=c.tokens.total,a.set(c.agentId,n)}const r={id:"general",name:"General",color:"#f1fa8c",values:s.map(l=>l.totalTokens),total:s.reduce((l,c)=>l+c.totalTokens,0),peak:Math.max(0,...s.map(l=>l.totalTokens)),isTotal:!0},h=[...a.entries()].sort((l,c)=>c[1].total-l[1].total).map(([l,c],n)=>({id:l,name:c.agentName,color:b[n%b.length],values:s.map(u=>{var d;return((d=u.agents.find(x=>x.agentId===l))==null?void 0:d.tokens.total)??0}),total:c.total,peak:Math.max(0,...s.map(u=>{var d;return((d=u.agents.find(x=>x.agentId===l))==null?void 0:d.tokens.total)??0}))}));return[r,...h].filter(l=>l.total>0)}function Y(i){if(i<=0)return 1;const s=10**Math.floor(Math.log10(i)),a=i/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s}function H(i,s,a,r){const h=p.left,l=p.top,c=w-p.left-p.right,n=C-p.top-p.bottom,u=i<=1?h+c/2:h+s/(i-1)*c,d=l+n-a/r*n;return{x:u,y:d}}function X(i,s){return i.map((a,r)=>{const{x:h,y:l}=H(i.length,r,a,s);return`${h.toFixed(2)},${l.toFixed(2)}`}).join(" ")}function J(i,s=28){return i.length<=s?i:`${i.slice(0,s-1)}...`}function K({summary:i}){const[s,a]=j.useState(null),r=i.days,h=q(i),l=Math.max(1,...h.flatMap(e=>e.values)),c=Y(l),n=p.left,u=p.top,d=w-p.left-p.right,x=C-p.top-p.bottom,f=[0,.5,1],M=Math.max(1,Math.ceil(r.length/5)),v=190,y=86,g=s?Math.min(Math.max(s.x+12,8),w-v-8):0,_=s?Math.min(Math.max(s.y-y-10,8),C-y-8):0;return t.jsxs("div",{className:"statistics-line-chart",children:[t.jsxs("svg",{className:"statistics-line-chart__svg",viewBox:`0 0 ${w} ${C}`,role:"img","aria-label":"Daily Claude token usage by agent",preserveAspectRatio:"xMidYMid meet",onMouseLeave:()=>a(null),children:[f.map(e=>{const m=u+x-e*x;return t.jsxs("g",{children:[t.jsx("line",{className:"statistics-line-chart__grid",x1:n,y1:m,x2:n+d,y2:m}),t.jsx("text",{className:"statistics-line-chart__axis-label",x:n-10,y:m+4,textAnchor:"end",children:k(Math.round(c*e))})]},e)}),t.jsx("line",{className:"statistics-line-chart__axis",x1:n,y1:u,x2:n,y2:u+x}),t.jsx("line",{className:"statistics-line-chart__axis",x1:n,y1:u+x,x2:n+d,y2:u+x}),r.map((e,m)=>{if(m!==0&&m!==r.length-1&&m%M!==0)return null;const o=r.length<=1?n+d/2:n+m/(r.length-1)*d;return t.jsx("text",{className:"statistics-line-chart__axis-label",x:o,y:C-14,textAnchor:"middle",children:E(e.date)},e.date)}),h.map(e=>t.jsx("polyline",{className:e.isTotal?"statistics-line-chart__line statistics-line-chart__line--total":"statistics-line-chart__line",points:X(e.values,c),fill:"none",stroke:e.color,strokeWidth:e.isTotal?3:2,strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("title",{children:`${e.name}: ${e.peak.toLocaleString()} peak daily tokens`})},e.id)),h.map(e=>e.values.map((m,o)=>{var L,D,V,A;const{x:N,y:S}=H(r.length,o,m,c),T={id:`${e.id}-${(L=r[o])==null?void 0:L.date}`,date:((D=r[o])==null?void 0:D.date)??"",name:e.name,color:e.color,value:m,total:e.total,peak:e.peak,x:N,y:S};return t.jsxs("g",{children:[t.jsx("circle",{className:"statistics-line-chart__point",cx:N,cy:S,r:e.isTotal?3.4:2.6,fill:e.color}),t.jsx("circle",{className:"statistics-line-chart__point-hit",cx:N,cy:S,r:10,tabIndex:0,role:"button","aria-label":`${e.name} ${(V=r[o])==null?void 0:V.date}: ${m.toLocaleString()} tokens`,onMouseEnter:()=>a(T),onFocus:()=>a(T),onBlur:()=>a(null)})]},`${e.id}-${(A=r[o])==null?void 0:A.date}`)})),s&&t.jsxs("g",{className:"statistics-line-chart__tooltip",children:[t.jsx("line",{className:"statistics-line-chart__hover-line",x1:s.x,y1:u,x2:s.x,y2:u+x}),t.jsx("circle",{className:"statistics-line-chart__hover-point",cx:s.x,cy:s.y,r:5,fill:s.color}),t.jsx("rect",{className:"statistics-line-chart__tooltip-box",x:g,y:_,width:v,height:y,rx:6}),t.jsx("text",{className:"statistics-line-chart__tooltip-title",x:g+10,y:_+18,children:E(s.date)}),t.jsx("text",{className:"statistics-line-chart__tooltip-name",x:g+10,y:_+34,children:J(s.name)}),t.jsxs("text",{className:"statistics-line-chart__tooltip-value",x:g+10,y:_+52,children:["Daily: ",k(s.value)]}),t.jsxs("text",{className:"statistics-line-chart__tooltip-meta",x:g+10,y:_+68,children:["Peak: ",k(s.peak)]}),t.jsxs("text",{className:"statistics-line-chart__tooltip-meta",x:g+100,y:_+68,children:["Total: ",k(s.total)]})]})]}),t.jsx("div",{className:"statistics-line-chart__legend",children:h.map(e=>t.jsxs("div",{className:"statistics-line-chart__legend-item",title:`${e.name}: peak ${e.peak.toLocaleString()} daily tokens, ${e.total.toLocaleString()} period tokens`,children:[t.jsx("span",{className:"statistics-line-chart__legend-swatch",style:{backgroundColor:e.color}}),t.jsx("span",{children:e.name}),t.jsx("strong",{children:k(e.peak)})]},e.id))})]})}function tt({isOpen:i,onClose:s}){const{t:a}=U(["terminal","common"]),{handleMouseDown:r,handleClick:h}=R(s),[l,c]=j.useState(null),[n,u]=j.useState(null),[d,x]=j.useState(!1),[f,M]=j.useState(null),v=j.useMemo(()=>W(),[]),y=j.useCallback(async()=>{x(!0),M(null);try{const o=Date.now(),[N,S]=await Promise.all([F({since:v,until:o}),B({days:P,until:o})]);c(N),u(S)}catch(o){M((o==null?void 0:o.message)||"Error")}finally{x(!1)}},[v]);if(j.useEffect(()=>{i&&y()},[i,y]),!i)return null;const g=(l==null?void 0:l.entries)??[],_=(l==null?void 0:l.totalTokens)??0,e=z(g,_),m=((n==null?void 0:n.days)??[]).some(o=>o.totalTokens>0);return t.jsx(G,{children:t.jsx("div",{className:"modal-overlay visible",onMouseDown:r,onClick:h,children:t.jsxs("div",{className:"modal statistics-modal",children:[t.jsxs("div",{className:"modal-header statistics-modal__header",children:[t.jsxs("div",{className:"statistics-modal__title",children:[t.jsx("span",{className:"statistics-modal__icon",children:t.jsx(I,{name:"dashboard",size:15})}),t.jsx("span",{children:a("terminal:statistics.title",{defaultValue:"Statistics"})})]}),t.jsx("button",{className:"modal-close statistics-modal__close",onClick:s,title:a("common:buttons.close"),children:"×"})]}),t.jsxs("div",{className:"modal-body statistics-modal__body",children:[t.jsxs("section",{className:"statistics-panel",children:[t.jsxs("div",{className:"statistics-panel__header",children:[t.jsxs("div",{children:[t.jsx("h3",{children:a("terminal:statistics.usageByAgent",{defaultValue:"Claude usage today"})}),t.jsx("span",{className:"statistics-panel__subtitle",children:a("terminal:statistics.usageByAgentSubtitle",{defaultValue:"Input + cache creation + cache read + output tokens, deduped by Claude request id"})})]}),t.jsx("button",{type:"button",className:"statistics-panel__refresh",onClick:y,disabled:d,title:a("terminal:statistics.refresh",{defaultValue:"Refresh usage"}),children:t.jsx(I,{name:"refresh",size:14})})]}),d&&!l&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.loading",{defaultValue:"Loading usage..."})}),!d&&f&&t.jsx("div",{className:"statistics-panel__empty statistics-panel__empty--error",children:a("terminal:statistics.error",{defaultValue:"Failed to load usage: {{error}}",error:f})}),!f&&l&&g.length===0&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.empty",{defaultValue:"No Claude token usage found for today."})}),!f&&l&&g.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"statistics-panel__layout",children:[t.jsx("div",{className:"statistics-panel__chart-wrap",children:t.jsx("div",{className:"statistics-panel__pie",style:{background:e},role:"img","aria-label":a("terminal:statistics.pieLabel",{defaultValue:"Claude token usage by agent"}),children:t.jsxs("div",{className:"statistics-panel__pie-hole",children:[t.jsx("strong",{children:k(_)}),t.jsx("span",{children:a("terminal:statistics.total",{defaultValue:"total"})})]})})}),t.jsx("div",{className:"statistics-panel__list",children:g.map((o,N)=>t.jsxs("div",{className:"statistics-panel__row",title:`${o.agentName}: ${o.tokens.total.toLocaleString()} tokens`,children:[t.jsx("span",{className:"statistics-panel__swatch",style:{backgroundColor:b[N%b.length]}}),t.jsxs("div",{className:"statistics-panel__row-main",children:[t.jsx("div",{className:"statistics-panel__row-name",children:o.agentName}),t.jsxs("div",{className:"statistics-panel__row-meta",children:[o.requestCount.toLocaleString()," ",a("terminal:statistics.requests",{defaultValue:"requests"})," / ",o.percent,"%"]})]}),t.jsx("strong",{children:k(o.tokens.total)})]},o.agentId))})]}),t.jsx("div",{className:"statistics-panel__footnote",children:a("terminal:statistics.window",{defaultValue:"Window: {{since}} to {{until}}",since:$(l.since),until:$(l.until)})})]})]}),t.jsxs("section",{className:"statistics-panel",children:[t.jsx("div",{className:"statistics-panel__header",children:t.jsxs("div",{children:[t.jsx("h3",{children:a("terminal:statistics.dailyUsage",{defaultValue:"Daily usage by agent"})}),t.jsx("span",{className:"statistics-panel__subtitle",children:a("terminal:statistics.dailyUsageSubtitle",{defaultValue:"General token usage by day plus one line for each Claude agent."})})]})}),d&&!n&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.loading",{defaultValue:"Loading usage..."})}),!d&&!f&&n&&!m&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.dailyEmpty",{defaultValue:"No Claude token usage found for recent days."})}),!f&&n&&m&&t.jsxs(t.Fragment,{children:[t.jsx(K,{summary:n}),t.jsx("div",{className:"statistics-panel__footnote",children:a("terminal:statistics.window",{defaultValue:"Window: {{since}} to {{until}}",since:$(n.since),until:$(n.until)})})]})]})]})]})})})}export{tt as StatisticsModal};
|
|
1
|
+
import{u as R,g as U,V as j,a3 as F,a4 as B,j as t,a5 as G,I,a6 as k}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const b=["#6ab8c8","#c89a5a","#9a80c0","#5cb88a","#c85a5a","#c87a9a","#c8c87a","#5a8fd4","#d45a5a","#8a6fbf"],P=14,w=720,C=260,p={top:16,right:20,bottom:42,left:64};function W(){const i=new Date;return i.setHours(0,0,0,0),i.getTime()}function $(i){if(!i)return"N/A";try{return new Date(i).toLocaleString()}catch{return"N/A"}}function z(i,s){if(i.length===0||s<=0)return"conic-gradient(rgba(50, 50, 62, 0.95) 0deg 360deg)";let a=0;return`conic-gradient(${i.map((h,l)=>{const c=a,n=h.tokens.total/s*360;return a+=n,`${b[l%b.length]} ${c.toFixed(2)}deg ${a.toFixed(2)}deg`}).join(", ")})`}function E(i){const[,s,a]=i.split("-");return!s||!a?i:`${s}/${a}`}function q(i){const s=(i==null?void 0:i.days)??[];if(s.length===0)return[];const a=new Map;for(const l of s)for(const c of l.agents){const n=a.get(c.agentId)??{agentName:c.agentName,total:0};n.total+=c.tokens.total,a.set(c.agentId,n)}const r={id:"general",name:"General",color:"#f1fa8c",values:s.map(l=>l.totalTokens),total:s.reduce((l,c)=>l+c.totalTokens,0),peak:Math.max(0,...s.map(l=>l.totalTokens)),isTotal:!0},h=[...a.entries()].sort((l,c)=>c[1].total-l[1].total).map(([l,c],n)=>({id:l,name:c.agentName,color:b[n%b.length],values:s.map(u=>{var d;return((d=u.agents.find(x=>x.agentId===l))==null?void 0:d.tokens.total)??0}),total:c.total,peak:Math.max(0,...s.map(u=>{var d;return((d=u.agents.find(x=>x.agentId===l))==null?void 0:d.tokens.total)??0}))}));return[r,...h].filter(l=>l.total>0)}function Y(i){if(i<=0)return 1;const s=10**Math.floor(Math.log10(i)),a=i/s;return(a<=1?1:a<=2?2:a<=5?5:10)*s}function H(i,s,a,r){const h=p.left,l=p.top,c=w-p.left-p.right,n=C-p.top-p.bottom,u=i<=1?h+c/2:h+s/(i-1)*c,d=l+n-a/r*n;return{x:u,y:d}}function X(i,s){return i.map((a,r)=>{const{x:h,y:l}=H(i.length,r,a,s);return`${h.toFixed(2)},${l.toFixed(2)}`}).join(" ")}function J(i,s=28){return i.length<=s?i:`${i.slice(0,s-1)}...`}function K({summary:i}){const[s,a]=j.useState(null),r=i.days,h=q(i),l=Math.max(1,...h.flatMap(e=>e.values)),c=Y(l),n=p.left,u=p.top,d=w-p.left-p.right,x=C-p.top-p.bottom,f=[0,.5,1],M=Math.max(1,Math.ceil(r.length/5)),v=190,y=86,g=s?Math.min(Math.max(s.x+12,8),w-v-8):0,_=s?Math.min(Math.max(s.y-y-10,8),C-y-8):0;return t.jsxs("div",{className:"statistics-line-chart",children:[t.jsxs("svg",{className:"statistics-line-chart__svg",viewBox:`0 0 ${w} ${C}`,role:"img","aria-label":"Daily Claude token usage by agent",preserveAspectRatio:"xMidYMid meet",onMouseLeave:()=>a(null),children:[f.map(e=>{const m=u+x-e*x;return t.jsxs("g",{children:[t.jsx("line",{className:"statistics-line-chart__grid",x1:n,y1:m,x2:n+d,y2:m}),t.jsx("text",{className:"statistics-line-chart__axis-label",x:n-10,y:m+4,textAnchor:"end",children:k(Math.round(c*e))})]},e)}),t.jsx("line",{className:"statistics-line-chart__axis",x1:n,y1:u,x2:n,y2:u+x}),t.jsx("line",{className:"statistics-line-chart__axis",x1:n,y1:u+x,x2:n+d,y2:u+x}),r.map((e,m)=>{if(m!==0&&m!==r.length-1&&m%M!==0)return null;const o=r.length<=1?n+d/2:n+m/(r.length-1)*d;return t.jsx("text",{className:"statistics-line-chart__axis-label",x:o,y:C-14,textAnchor:"middle",children:E(e.date)},e.date)}),h.map(e=>t.jsx("polyline",{className:e.isTotal?"statistics-line-chart__line statistics-line-chart__line--total":"statistics-line-chart__line",points:X(e.values,c),fill:"none",stroke:e.color,strokeWidth:e.isTotal?3:2,strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("title",{children:`${e.name}: ${e.peak.toLocaleString()} peak daily tokens`})},e.id)),h.map(e=>e.values.map((m,o)=>{var L,D,V,A;const{x:N,y:S}=H(r.length,o,m,c),T={id:`${e.id}-${(L=r[o])==null?void 0:L.date}`,date:((D=r[o])==null?void 0:D.date)??"",name:e.name,color:e.color,value:m,total:e.total,peak:e.peak,x:N,y:S};return t.jsxs("g",{children:[t.jsx("circle",{className:"statistics-line-chart__point",cx:N,cy:S,r:e.isTotal?3.4:2.6,fill:e.color}),t.jsx("circle",{className:"statistics-line-chart__point-hit",cx:N,cy:S,r:10,tabIndex:0,role:"button","aria-label":`${e.name} ${(V=r[o])==null?void 0:V.date}: ${m.toLocaleString()} tokens`,onMouseEnter:()=>a(T),onFocus:()=>a(T),onBlur:()=>a(null)})]},`${e.id}-${(A=r[o])==null?void 0:A.date}`)})),s&&t.jsxs("g",{className:"statistics-line-chart__tooltip",children:[t.jsx("line",{className:"statistics-line-chart__hover-line",x1:s.x,y1:u,x2:s.x,y2:u+x}),t.jsx("circle",{className:"statistics-line-chart__hover-point",cx:s.x,cy:s.y,r:5,fill:s.color}),t.jsx("rect",{className:"statistics-line-chart__tooltip-box",x:g,y:_,width:v,height:y,rx:6}),t.jsx("text",{className:"statistics-line-chart__tooltip-title",x:g+10,y:_+18,children:E(s.date)}),t.jsx("text",{className:"statistics-line-chart__tooltip-name",x:g+10,y:_+34,children:J(s.name)}),t.jsxs("text",{className:"statistics-line-chart__tooltip-value",x:g+10,y:_+52,children:["Daily: ",k(s.value)]}),t.jsxs("text",{className:"statistics-line-chart__tooltip-meta",x:g+10,y:_+68,children:["Peak: ",k(s.peak)]}),t.jsxs("text",{className:"statistics-line-chart__tooltip-meta",x:g+100,y:_+68,children:["Total: ",k(s.total)]})]})]}),t.jsx("div",{className:"statistics-line-chart__legend",children:h.map(e=>t.jsxs("div",{className:"statistics-line-chart__legend-item",title:`${e.name}: peak ${e.peak.toLocaleString()} daily tokens, ${e.total.toLocaleString()} period tokens`,children:[t.jsx("span",{className:"statistics-line-chart__legend-swatch",style:{backgroundColor:e.color}}),t.jsx("span",{children:e.name}),t.jsx("strong",{children:k(e.peak)})]},e.id))})]})}function tt({isOpen:i,onClose:s}){const{t:a}=R(["terminal","common"]),{handleMouseDown:r,handleClick:h}=U(s),[l,c]=j.useState(null),[n,u]=j.useState(null),[d,x]=j.useState(!1),[f,M]=j.useState(null),v=j.useMemo(()=>W(),[]),y=j.useCallback(async()=>{x(!0),M(null);try{const o=Date.now(),[N,S]=await Promise.all([F({since:v,until:o}),B({days:P,until:o})]);c(N),u(S)}catch(o){M((o==null?void 0:o.message)||"Error")}finally{x(!1)}},[v]);if(j.useEffect(()=>{i&&y()},[i,y]),!i)return null;const g=(l==null?void 0:l.entries)??[],_=(l==null?void 0:l.totalTokens)??0,e=z(g,_),m=((n==null?void 0:n.days)??[]).some(o=>o.totalTokens>0);return t.jsx(G,{children:t.jsx("div",{className:"modal-overlay visible",onMouseDown:r,onClick:h,children:t.jsxs("div",{className:"modal statistics-modal",children:[t.jsxs("div",{className:"modal-header statistics-modal__header",children:[t.jsxs("div",{className:"statistics-modal__title",children:[t.jsx("span",{className:"statistics-modal__icon",children:t.jsx(I,{name:"dashboard",size:15})}),t.jsx("span",{children:a("terminal:statistics.title",{defaultValue:"Statistics"})})]}),t.jsx("button",{className:"modal-close statistics-modal__close",onClick:s,title:a("common:buttons.close"),children:"×"})]}),t.jsxs("div",{className:"modal-body statistics-modal__body",children:[t.jsxs("section",{className:"statistics-panel",children:[t.jsxs("div",{className:"statistics-panel__header",children:[t.jsxs("div",{children:[t.jsx("h3",{children:a("terminal:statistics.usageByAgent",{defaultValue:"Claude usage today"})}),t.jsx("span",{className:"statistics-panel__subtitle",children:a("terminal:statistics.usageByAgentSubtitle",{defaultValue:"Input + cache creation + cache read + output tokens, deduped by Claude request id"})})]}),t.jsx("button",{type:"button",className:"statistics-panel__refresh",onClick:y,disabled:d,title:a("terminal:statistics.refresh",{defaultValue:"Refresh usage"}),children:t.jsx(I,{name:"refresh",size:14})})]}),d&&!l&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.loading",{defaultValue:"Loading usage..."})}),!d&&f&&t.jsx("div",{className:"statistics-panel__empty statistics-panel__empty--error",children:a("terminal:statistics.error",{defaultValue:"Failed to load usage: {{error}}",error:f})}),!f&&l&&g.length===0&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.empty",{defaultValue:"No Claude token usage found for today."})}),!f&&l&&g.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"statistics-panel__layout",children:[t.jsx("div",{className:"statistics-panel__chart-wrap",children:t.jsx("div",{className:"statistics-panel__pie",style:{background:e},role:"img","aria-label":a("terminal:statistics.pieLabel",{defaultValue:"Claude token usage by agent"}),children:t.jsxs("div",{className:"statistics-panel__pie-hole",children:[t.jsx("strong",{children:k(_)}),t.jsx("span",{children:a("terminal:statistics.total",{defaultValue:"total"})})]})})}),t.jsx("div",{className:"statistics-panel__list",children:g.map((o,N)=>t.jsxs("div",{className:"statistics-panel__row",title:`${o.agentName}: ${o.tokens.total.toLocaleString()} tokens`,children:[t.jsx("span",{className:"statistics-panel__swatch",style:{backgroundColor:b[N%b.length]}}),t.jsxs("div",{className:"statistics-panel__row-main",children:[t.jsx("div",{className:"statistics-panel__row-name",children:o.agentName}),t.jsxs("div",{className:"statistics-panel__row-meta",children:[o.requestCount.toLocaleString()," ",a("terminal:statistics.requests",{defaultValue:"requests"})," / ",o.percent,"%"]})]}),t.jsx("strong",{children:k(o.tokens.total)})]},o.agentId))})]}),t.jsx("div",{className:"statistics-panel__footnote",children:a("terminal:statistics.window",{defaultValue:"Window: {{since}} to {{until}}",since:$(l.since),until:$(l.until)})})]})]}),t.jsxs("section",{className:"statistics-panel",children:[t.jsx("div",{className:"statistics-panel__header",children:t.jsxs("div",{children:[t.jsx("h3",{children:a("terminal:statistics.dailyUsage",{defaultValue:"Daily usage by agent"})}),t.jsx("span",{className:"statistics-panel__subtitle",children:a("terminal:statistics.dailyUsageSubtitle",{defaultValue:"General token usage by day plus one line for each Claude agent."})})]})}),d&&!n&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.loading",{defaultValue:"Loading usage..."})}),!d&&!f&&n&&!m&&t.jsx("div",{className:"statistics-panel__empty",children:a("terminal:statistics.dailyEmpty",{defaultValue:"No Claude token usage found for recent days."})}),!f&&n&&m&&t.jsxs(t.Fragment,{children:[t.jsx(K,{summary:n}),t.jsx("div",{className:"statistics-panel__footnote",children:a("terminal:statistics.window",{defaultValue:"Window: {{since}} to {{until}}",since:$(n.since),until:$(n.until)})})]})]})]})]})})})}export{tt as StatisticsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as Qe,r as e,j as s,c as et}from"./main-DuaHyH5t.js";import{r as tt,F as nt,B as ke,d as Re,f as Ue,g as ve,V as T,s as Te,c as rt,e as st,W as at,H as ot,D as Be,P as ze,h as lt,i as it,j as ct,E as ut,L as dt,k as ft,A as pt,b as ht,a as mt,m as gt}from"./vendor-three-DYBBrXTx.js";import{O as wt}from"./OrbitControls-ANLmgNeR.js";import{g as xt,v as yt,u as bt,a as St,d as De,s as Ct,c as Mt,T as vt,b as Et}from"./ThreeAreaSelector-Bnb65bJt.js";import{T as Rt,a as Ft}from"./ThreeViewShortcuts-AI4Mj9zr.js";import"./vendor-react--Eh9ivFN.js";class jt extends tt{constructor(V){super(V)}load(V,le,ie,a){const _=this,F=new nt(this.manager);F.setPath(this.path),F.setResponseType("arraybuffer"),F.setRequestHeader(this.requestHeader),F.setWithCredentials(this.withCredentials),F.load(V,function(X){try{le(_.parse(X))}catch(d){a?a(d):console.error(d),_.manager.itemError(V)}},ie,a)}parse(V){function le(l){const t=new DataView(l),u=32/8*3+32/8*3*3+16/8,y=t.getUint32(80,!0);if(80+32/8+y*u===t.byteLength)return!0;const j=[115,111,108,105,100];for(let p=0;p<5;p++)if(ie(j,t,p))return!1;return!0}function ie(l,t,u){for(let y=0,A=l.length;y<A;y++)if(l[y]!==t.getUint8(u+y))return!1;return!0}function a(l){const t=new DataView(l),u=t.getUint32(80,!0);let y,A,j,p=!1,P,O,I,G,K;for(let g=0;g<70;g++)t.getUint32(g,!1)==1129270351&&t.getUint8(g+4)==82&&t.getUint8(g+5)==61&&(p=!0,P=new Float32Array(u*3*3),O=t.getUint8(g+6)/255,I=t.getUint8(g+7)/255,G=t.getUint8(g+8)/255,K=t.getUint8(g+9)/255);const C=84,i=50,v=new ke,b=new Float32Array(u*3*3),N=new Float32Array(u*3*3),c=new Re;for(let g=0;g<u;g++){const B=C+g*i,ce=t.getFloat32(B,!0),H=t.getFloat32(B+4,!0),$=t.getFloat32(B+8,!0);if(p){const E=t.getUint16(B+48,!0);(E&32768)===0?(y=(E&31)/31,A=(E>>5&31)/31,j=(E>>10&31)/31):(y=O,A=I,j=G)}for(let E=1;E<=3;E++){const Y=B+E*12,z=g*3*3+(E-1)*3;b[z]=t.getFloat32(Y,!0),b[z+1]=t.getFloat32(Y+4,!0),b[z+2]=t.getFloat32(Y+8,!0),N[z]=ce,N[z+1]=H,N[z+2]=$,p&&(c.setRGB(y,A,j,Ue),P[z]=c.r,P[z+1]=c.g,P[z+2]=c.b)}}return v.setAttribute("position",new ve(b,3)),v.setAttribute("normal",new ve(N,3)),p&&(v.setAttribute("color",new ve(P,3)),v.hasColors=!0,v.alpha=K),v}function _(l){const t=new ke,u=/solid([\s\S]*?)endsolid/g,y=/facet([\s\S]*?)endfacet/g,A=/solid\s(.+)/;let j=0;const p=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,P=new RegExp("vertex"+p+p+p,"g"),O=new RegExp("normal"+p+p+p,"g"),I=[],G=[],K=[],C=new T;let i,v=0,b=0,N=0;for(;(i=u.exec(l))!==null;){b=N;const c=i[0],g=(i=A.exec(c))!==null?i[1]:"";for(K.push(g);(i=y.exec(c))!==null;){let H=0,$=0;const E=i[0];for(;(i=O.exec(E))!==null;)C.x=parseFloat(i[1]),C.y=parseFloat(i[2]),C.z=parseFloat(i[3]),$++;for(;(i=P.exec(E))!==null;)I.push(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])),G.push(C.x,C.y,C.z),H++,N++;$!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+j),H!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+j),j++}const B=b,ce=N-b;t.userData.groupNames=K,t.addGroup(B,ce,v),v++}return t.setAttribute("position",new Te(I,3)),t.setAttribute("normal",new Te(G,3)),t}function F(l){return typeof l!="string"?new TextDecoder().decode(l):l}function X(l){if(typeof l=="string"){const t=new Uint8Array(l.length);for(let u=0;u<l.length;u++)t[u]=l.charCodeAt(u)&255;return t.buffer||t}else return l}const d=X(V);return le(d)?a(d):_(F(V))}}function Ee(L){return Number.isFinite(L)?L>=100?L.toFixed(0):L>=10?L.toFixed(1):L.toFixed(2):"0"}function Bt({url:L,filename:V,filePath:le,onFileSelect:ie}){const{t:a}=Qe("terminal"),_=e.useRef(null),F=e.useRef(null),X=e.useRef(null),d=e.useRef(null),l=e.useRef(null),t=e.useRef(null),u=e.useRef(null),y=e.useRef(null),A=e.useRef(null),j=e.useRef(null),p=e.useRef(null),P=e.useRef(null),O=e.useRef(null),I=e.useRef([]),G=e.useRef(new T),K=e.useRef(1),C=e.useRef(null),[i,v]=e.useState(!0),[b,N]=e.useState(null),[c,g]=e.useState(null),[B,ce]=e.useState(!1),[H]=e.useState(xt),[$,E]=e.useState(H.modelColor),[Y,z]=e.useState(H.backgroundColor),[ue,Oe]=e.useState(H.lightIntensity),[q,Ie]=e.useState(H.modelOpacity),[de,Ge]=e.useState(H.showEdges),[re,He]=e.useState(!1),[Z,$e]=e.useState(0),[J,We]=e.useState(100),[ye,be]=e.useState(!1),[Q,pe]=e.useState(null),[se,he]=e.useState([]),[Se,me]=e.useState(null),Ce=le||yt(L),Xe=bt(Ce,V,"stl");St({enabled:!!c&&Q===null,rendererRef:P,cameraRef:p,controlsRef:O,modelObjectsRef:I,modelCenterRef:G,markerGroupRef:C,renderRef:d,setAreas:he,setSelectedId:me}),e.useEffect(()=>{const n=_.current;if(!n)return;const h=new AbortController;let m=!1,r=null,D=null,W=null,w=null,x=null;v(!0),N(null),g(null);const S=new rt;S.background=new Re(1119258),l.current=S;const f=new st(40,1,.01,1e4);p.current=f,f.up.set(0,0,1);let o;try{o=new at({antialias:!0})}catch{v(!1),N(a("fileViewerModal.webglUnavailable"));return}o.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),P.current=o,o.outputColorSpace=Ue,o.localClippingEnabled=!0,o.domElement.className="stl-viewer-canvas",o.domElement.setAttribute("aria-label",a("fileViewerModal.previewLabel",{filename:V})),n.appendChild(o.domElement);const U=new wt(f,o.domElement);O.current=U,U.enableDamping=!1,U.screenSpacePanning=!0,U.addEventListener("change",()=>o.render(S,f));const ge=new ot(16777215,2502724,2.2);S.add(ge);const ee=new Be(16777215,2.4);ee.position.set(3,4,5),S.add(ee);const ae=new Be(8040191,1.1);ae.position.set(-4,1,-3),S.add(ae),A.current={hemisphere:ge,key:ee,fill:ae},d.current=()=>o.render(S,f),j.current={lower:new ze(new T(0,0,1),1e9),upper:new ze(new T(0,0,-1),1e9)};const fe=()=>{const oe=Math.max(n.clientWidth,1),te=Math.max(n.clientHeight,1);f.aspect=oe/te,f.updateProjectionMatrix(),o.setSize(oe,te,!1),o.render(S,f)},we=new ResizeObserver(fe);return we.observe(n),fe(),(async()=>{var oe,te,Fe,je;try{const ne=await et(L,{signal:h.signal});if(!ne.ok){let R=`Could not load STL (${ne.status})`;try{const M=await ne.json();typeof(M==null?void 0:M.error)=="string"&&(R=M.error)}catch{}throw new Error(R)}const _e=await ne.arrayBuffer();if(m)return;if(r=new jt().parse(_e),!((oe=r.getAttribute("position"))!=null&&oe.count))throw new Error(a("fileViewerModal.emptyStl"));r.computeVertexNormals(),r.computeBoundingBox();const k=((te=r.boundingBox)==null?void 0:te.getSize(new T))??new T(1,1,1);G.current.copy(((Fe=r.boundingBox)==null?void 0:Fe.getCenter(new T))??new T),K.current=Math.max(k.x,k.y,k.z,.001)*.12,r.center(),r.computeBoundingSphere(),D=new lt({color:5818329,vertexColors:!1,metalness:.08,roughness:.62,side:it}),t.current=D;const Le=new ct(r,D);I.current=[Le],S.add(Le),W=new ut(r,28),w=new dt({color:1582123,transparent:!0,opacity:.52});const Ve=new ft(W,w);u.current=w,y.current=Ve,S.add(Ve);const qe=Math.max(k.x,k.y,k.z,.001)*.3;x=new pt(qe),x.position.set(-k.x/2,-k.y/2,-k.z/2),x.renderOrder=5,S.add(x);const Ae=Math.max(((je=r.boundingSphere)==null?void 0:je.radius)??1,.001),Ze=ht.degToRad(f.fov/2),xe=Math.max(Ae/Math.sin(Ze)*1.15,.01),Me=R=>{f.near=Math.max(xe/1e3,1e-4),f.far=Math.max(xe*100,10);const M=R==="x"?new T(1,0,0):R==="y"?new T(0,1,0):R==="z"?new T(0,0,1):new T(1,-1,.82).normalize();f.up.set(0,R==="z"?1:0,R==="z"?0:1),f.position.copy(M.multiplyScalar(xe)),f.updateProjectionMatrix(),U.target.set(0,0,0),U.minDistance=Ae*.05,U.maxDistance=xe*20,U.update(),o.render(S,f)},Pe=()=>Me("iso");X.current=Me,F.current=Pe,Pe();const Je=R=>{if(R.ctrlKey||R.metaKey||R.altKey)return;const M=R.key.toLowerCase(),Ne=M==="x"||M==="1"?"x":M==="y"||M==="2"?"y":M==="z"||M==="3"?"z":M==="i"||M==="4"?"iso":null;Ne&&(R.preventDefault(),Me(Ne))};o.domElement.tabIndex=0,o.domElement.addEventListener("pointerdown",()=>o.domElement.focus()),o.domElement.addEventListener("keydown",Je),g({triangles:Math.floor(r.getAttribute("position").count/3),dimensions:[k.x,k.y,k.z]}),v(!1)}catch(ne){if(h.signal.aborted||m)return;N(ne instanceof Error?ne.message:a("fileViewerModal.renderError")),v(!1)}})(),()=>{m=!0,h.abort(),F.current=null,X.current=null,d.current=null,l.current=null,t.current=null,u.current=null,y.current=null,A.current=null,j.current=null,p.current=null,P.current=null,O.current=null,I.current=[],De(C.current),C.current=null,we.disconnect(),U.dispose(),r==null||r.dispose(),D==null||D.dispose(),W==null||W.dispose(),w==null||w.dispose(),x==null||x.geometry.dispose(),x&&(Array.isArray(x.material)?x.material:[x.material]).forEach(te=>te.dispose()),o.dispose(),o.domElement.remove()}},[L,V,a]),e.useEffect(()=>{var h;l.current&&(l.current.background=new Re(Y)),t.current&&(t.current.color.set($),t.current.transparent=q<100,t.current.opacity=q/100,t.current.depthWrite=q>=100,t.current.needsUpdate=!0);const n=A.current;if(n){const m=ue/100;n.hemisphere.intensity=2.2*m,n.key.intensity=2.4*m,n.fill.intensity=1.1*m}y.current&&(y.current.visible=de),(h=d.current)==null||h.call(d)},[$,Y,ue,q,de,c]),e.useEffect(()=>{Ct({modelColor:$,backgroundColor:Y,lightIntensity:ue,modelOpacity:q,showEdges:de})},[$,Y,ue,q,de]),e.useEffect(()=>{var x,S,f;const n=j.current,h=t.current;if(!n||!h||!c)return;const m=c.dimensions[2],r=-m/2,D=r+m*(Z/100),W=r+m*(J/100);n.lower.constant=-D,n.upper.constant=W;const w=re?[n.lower,n.upper]:[];(((x=h.clippingPlanes)==null?void 0:x.length)??0)!==w.length&&(h.needsUpdate=!0),h.clippingPlanes=w,u.current&&((((S=u.current.clippingPlanes)==null?void 0:S.length)??0)!==w.length&&(u.current.needsUpdate=!0),u.current.clippingPlanes=w),(f=d.current)==null||f.call(d)},[re,Z,J,c]),e.useEffect(()=>{he([]),me(null),pe(null),be(!1)},[L]),e.useEffect(()=>{O.current&&(O.current.enabled=Q===null);const n=P.current,h=p.current;if(!n||!h||!c||!Q)return;const m=n.domElement;let r=null;const D=w=>{r=[w.clientX,w.clientY]},W=w=>{var fe;if(!r||Math.hypot(w.clientX-r[0],w.clientY-r[1])>5)return;const x=m.getBoundingClientRect(),S=new mt((w.clientX-x.left)/x.width*2-1,-((w.clientY-x.top)/x.height)*2+1),f=new gt;f.setFromCamera(S,h);const o=f.intersectObjects(I.current,!1)[0];if(!o)return;const U=o.point.clone().add(G.current),ge=(fe=o.face)==null?void 0:fe.normal.clone().transformDirection(o.object.matrixWorld).toArray(),ee=K.current,ae=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;he(we=>[...we,{id:ae,shape:Q,center:U.toArray(),size:[ee,ee,ee],surfaceNormal:ge}]),me(ae)};return m.addEventListener("pointerdown",D),m.addEventListener("pointerup",W),()=>{m.removeEventListener("pointerdown",D),m.removeEventListener("pointerup",W)}},[Q,c]),e.useEffect(()=>{var m,r;De(C.current),C.current=null;const n=l.current;if(!n||se.length===0){(m=d.current)==null||m.call(d);return}const h=Mt(se,G.current,Se);C.current=h,n.add(h),(r=d.current)==null||r.call(d)},[se,Se,c]);const Ye=e.useCallback(()=>{var n;return(n=F.current)==null?void 0:n.call(F)},[]),Ke=e.useCallback(n=>{var h;return(h=X.current)==null?void 0:h.call(X,n)},[]);return s.jsxs("div",{className:`stl-viewer${Q?" area-placement-active":""}`,ref:_,children:[i&&s.jsx("div",{className:"stl-viewer-status",children:a("fileViewerModal.loading3d")}),b&&s.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:b}),!i&&!b&&s.jsxs("div",{className:"stl-viewer-toolbar",children:[c&&s.jsxs("span",{className:"stl-viewer-info",children:[a("fileViewerModal.triangleCount",{count:c.triangles.toLocaleString()})," ·"," ",c.dimensions.map(Ee).join(" × ")]}),s.jsx(Rt,{onView:Ke}),s.jsx("button",{type:"button",onClick:Ye,title:a("fileViewerModal.resetCamera"),"aria-label":a("fileViewerModal.resetCamera"),children:a("fileViewerModal.resetView")}),s.jsx("button",{type:"button",className:re?"active":void 0,onClick:()=>He(n=>!n),"aria-pressed":re,children:a("fileViewerModal.layers")}),s.jsxs("button",{type:"button",className:ye?"active":void 0,onClick:()=>{be(n=>!n),pe(null)},"aria-expanded":ye,children:[a("fileViewerModal.areas"),se.length>0?` (${se.length})`:""]}),s.jsx("button",{type:"button",className:B?"active":void 0,onClick:()=>ce(n=>!n),"aria-expanded":B,children:a("fileViewerModal.viewerSettings")})]}),!i&&!b&&B&&s.jsx(vt,{modelColor:$,onModelColorChange:E,backgroundColor:Y,onBackgroundColorChange:z,lightIntensity:ue,onLightIntensityChange:Oe,modelOpacity:q,onModelOpacityChange:Ie,showEdges:de,onShowEdgesChange:Ge,recentFiles:Xe,currentFilePath:Ce,onRecentFileSelect:ie}),!i&&!b&&ye&&s.jsx(Et,{areas:se,selectedId:Se,placementShape:Q,filename:V,filePath:Ce,modelExtent:Math.max(...c.dimensions),className:re?"with-layer-control":void 0,onPlacementShapeChange:pe,onSelectedIdChange:me,onAreasChange:he,onClose:()=>{be(!1),pe(null)}}),!i&&!b&&re&&c&&s.jsxs("div",{className:"stl-layer-control",children:[s.jsxs("div",{className:"stl-layer-values",children:[s.jsxs("output",{children:[Math.round(Z),"%"]}),s.jsx("span",{children:"–"}),s.jsxs("output",{children:[Math.round(J),"%"]})]}),s.jsxs("span",{className:"stl-layer-height",children:[Ee(c.dimensions[2]*(J-Z)/100)," / ",Ee(c.dimensions[2])]}),s.jsxs("div",{className:"stl-layer-slider",style:{"--layer-bottom":`${Z}%`,"--layer-top-offset":`${100-J}%`},children:[s.jsx("span",{className:"stl-layer-slider-track","aria-hidden":"true"}),s.jsx("span",{className:"stl-layer-slider-selection","aria-hidden":"true"}),s.jsx("input",{className:"stl-layer-range stl-layer-range-bottom",type:"range",min:"0",max:"100",step:"1",value:Z,onChange:n=>$e(Math.min(Number(n.target.value),J)),"aria-label":a("fileViewerModal.layerBottom"),"aria-orientation":"vertical",title:a("fileViewerModal.layerBottom")}),s.jsx("input",{className:"stl-layer-range stl-layer-range-top",type:"range",min:"0",max:"100",step:"1",value:J,onChange:n=>We(Math.max(Number(n.target.value),Z)),"aria-label":a("fileViewerModal.layerTop"),"aria-orientation":"vertical",title:a("fileViewerModal.layerTop")})]}),s.jsx("span",{children:a("fileViewerModal.layerAxis")})]}),!i&&!b&&s.jsx("div",{className:"stl-viewer-hint",children:a("fileViewerModal.controlsHint")}),!i&&!b&&s.jsx(Ft,{})]})}export{Bt as StlViewer};
|
|
1
|
+
import{u as Qe,r as e,j as s,c as et}from"./main-33HX-Nre.js";import{r as tt,F as nt,B as ke,d as Re,f as Ue,g as ve,V as T,s as Te,c as rt,e as st,W as at,H as ot,D as Be,P as ze,h as lt,i as it,j as ct,E as ut,L as dt,k as ft,A as pt,b as ht,a as mt,m as gt}from"./vendor-three-DYBBrXTx.js";import{O as wt}from"./OrbitControls-ANLmgNeR.js";import{g as xt,v as yt,u as bt,a as St,d as De,s as Ct,c as Mt,T as vt,b as Et}from"./ThreeAreaSelector-BfXBY8Zd.js";import{T as Rt,a as Ft}from"./ThreeViewShortcuts-BGgmAwlu.js";import"./vendor-react--Eh9ivFN.js";class jt extends tt{constructor(V){super(V)}load(V,le,ie,a){const _=this,F=new nt(this.manager);F.setPath(this.path),F.setResponseType("arraybuffer"),F.setRequestHeader(this.requestHeader),F.setWithCredentials(this.withCredentials),F.load(V,function(X){try{le(_.parse(X))}catch(d){a?a(d):console.error(d),_.manager.itemError(V)}},ie,a)}parse(V){function le(l){const t=new DataView(l),u=32/8*3+32/8*3*3+16/8,y=t.getUint32(80,!0);if(80+32/8+y*u===t.byteLength)return!0;const j=[115,111,108,105,100];for(let p=0;p<5;p++)if(ie(j,t,p))return!1;return!0}function ie(l,t,u){for(let y=0,A=l.length;y<A;y++)if(l[y]!==t.getUint8(u+y))return!1;return!0}function a(l){const t=new DataView(l),u=t.getUint32(80,!0);let y,A,j,p=!1,P,O,I,G,K;for(let g=0;g<70;g++)t.getUint32(g,!1)==1129270351&&t.getUint8(g+4)==82&&t.getUint8(g+5)==61&&(p=!0,P=new Float32Array(u*3*3),O=t.getUint8(g+6)/255,I=t.getUint8(g+7)/255,G=t.getUint8(g+8)/255,K=t.getUint8(g+9)/255);const C=84,i=50,v=new ke,b=new Float32Array(u*3*3),N=new Float32Array(u*3*3),c=new Re;for(let g=0;g<u;g++){const B=C+g*i,ce=t.getFloat32(B,!0),H=t.getFloat32(B+4,!0),$=t.getFloat32(B+8,!0);if(p){const E=t.getUint16(B+48,!0);(E&32768)===0?(y=(E&31)/31,A=(E>>5&31)/31,j=(E>>10&31)/31):(y=O,A=I,j=G)}for(let E=1;E<=3;E++){const Y=B+E*12,z=g*3*3+(E-1)*3;b[z]=t.getFloat32(Y,!0),b[z+1]=t.getFloat32(Y+4,!0),b[z+2]=t.getFloat32(Y+8,!0),N[z]=ce,N[z+1]=H,N[z+2]=$,p&&(c.setRGB(y,A,j,Ue),P[z]=c.r,P[z+1]=c.g,P[z+2]=c.b)}}return v.setAttribute("position",new ve(b,3)),v.setAttribute("normal",new ve(N,3)),p&&(v.setAttribute("color",new ve(P,3)),v.hasColors=!0,v.alpha=K),v}function _(l){const t=new ke,u=/solid([\s\S]*?)endsolid/g,y=/facet([\s\S]*?)endfacet/g,A=/solid\s(.+)/;let j=0;const p=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,P=new RegExp("vertex"+p+p+p,"g"),O=new RegExp("normal"+p+p+p,"g"),I=[],G=[],K=[],C=new T;let i,v=0,b=0,N=0;for(;(i=u.exec(l))!==null;){b=N;const c=i[0],g=(i=A.exec(c))!==null?i[1]:"";for(K.push(g);(i=y.exec(c))!==null;){let H=0,$=0;const E=i[0];for(;(i=O.exec(E))!==null;)C.x=parseFloat(i[1]),C.y=parseFloat(i[2]),C.z=parseFloat(i[3]),$++;for(;(i=P.exec(E))!==null;)I.push(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])),G.push(C.x,C.y,C.z),H++,N++;$!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+j),H!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+j),j++}const B=b,ce=N-b;t.userData.groupNames=K,t.addGroup(B,ce,v),v++}return t.setAttribute("position",new Te(I,3)),t.setAttribute("normal",new Te(G,3)),t}function F(l){return typeof l!="string"?new TextDecoder().decode(l):l}function X(l){if(typeof l=="string"){const t=new Uint8Array(l.length);for(let u=0;u<l.length;u++)t[u]=l.charCodeAt(u)&255;return t.buffer||t}else return l}const d=X(V);return le(d)?a(d):_(F(V))}}function Ee(L){return Number.isFinite(L)?L>=100?L.toFixed(0):L>=10?L.toFixed(1):L.toFixed(2):"0"}function Bt({url:L,filename:V,filePath:le,onFileSelect:ie}){const{t:a}=Qe("terminal"),_=e.useRef(null),F=e.useRef(null),X=e.useRef(null),d=e.useRef(null),l=e.useRef(null),t=e.useRef(null),u=e.useRef(null),y=e.useRef(null),A=e.useRef(null),j=e.useRef(null),p=e.useRef(null),P=e.useRef(null),O=e.useRef(null),I=e.useRef([]),G=e.useRef(new T),K=e.useRef(1),C=e.useRef(null),[i,v]=e.useState(!0),[b,N]=e.useState(null),[c,g]=e.useState(null),[B,ce]=e.useState(!1),[H]=e.useState(xt),[$,E]=e.useState(H.modelColor),[Y,z]=e.useState(H.backgroundColor),[ue,Oe]=e.useState(H.lightIntensity),[q,Ie]=e.useState(H.modelOpacity),[de,Ge]=e.useState(H.showEdges),[re,He]=e.useState(!1),[Z,$e]=e.useState(0),[J,We]=e.useState(100),[ye,be]=e.useState(!1),[Q,pe]=e.useState(null),[se,he]=e.useState([]),[Se,me]=e.useState(null),Ce=le||yt(L),Xe=bt(Ce,V,"stl");St({enabled:!!c&&Q===null,rendererRef:P,cameraRef:p,controlsRef:O,modelObjectsRef:I,modelCenterRef:G,markerGroupRef:C,renderRef:d,setAreas:he,setSelectedId:me}),e.useEffect(()=>{const n=_.current;if(!n)return;const h=new AbortController;let m=!1,r=null,D=null,W=null,w=null,x=null;v(!0),N(null),g(null);const S=new rt;S.background=new Re(1119258),l.current=S;const f=new st(40,1,.01,1e4);p.current=f,f.up.set(0,0,1);let o;try{o=new at({antialias:!0})}catch{v(!1),N(a("fileViewerModal.webglUnavailable"));return}o.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),P.current=o,o.outputColorSpace=Ue,o.localClippingEnabled=!0,o.domElement.className="stl-viewer-canvas",o.domElement.setAttribute("aria-label",a("fileViewerModal.previewLabel",{filename:V})),n.appendChild(o.domElement);const U=new wt(f,o.domElement);O.current=U,U.enableDamping=!1,U.screenSpacePanning=!0,U.addEventListener("change",()=>o.render(S,f));const ge=new ot(16777215,2502724,2.2);S.add(ge);const ee=new Be(16777215,2.4);ee.position.set(3,4,5),S.add(ee);const ae=new Be(8040191,1.1);ae.position.set(-4,1,-3),S.add(ae),A.current={hemisphere:ge,key:ee,fill:ae},d.current=()=>o.render(S,f),j.current={lower:new ze(new T(0,0,1),1e9),upper:new ze(new T(0,0,-1),1e9)};const fe=()=>{const oe=Math.max(n.clientWidth,1),te=Math.max(n.clientHeight,1);f.aspect=oe/te,f.updateProjectionMatrix(),o.setSize(oe,te,!1),o.render(S,f)},we=new ResizeObserver(fe);return we.observe(n),fe(),(async()=>{var oe,te,Fe,je;try{const ne=await et(L,{signal:h.signal});if(!ne.ok){let R=`Could not load STL (${ne.status})`;try{const M=await ne.json();typeof(M==null?void 0:M.error)=="string"&&(R=M.error)}catch{}throw new Error(R)}const _e=await ne.arrayBuffer();if(m)return;if(r=new jt().parse(_e),!((oe=r.getAttribute("position"))!=null&&oe.count))throw new Error(a("fileViewerModal.emptyStl"));r.computeVertexNormals(),r.computeBoundingBox();const k=((te=r.boundingBox)==null?void 0:te.getSize(new T))??new T(1,1,1);G.current.copy(((Fe=r.boundingBox)==null?void 0:Fe.getCenter(new T))??new T),K.current=Math.max(k.x,k.y,k.z,.001)*.12,r.center(),r.computeBoundingSphere(),D=new lt({color:5818329,vertexColors:!1,metalness:.08,roughness:.62,side:it}),t.current=D;const Le=new ct(r,D);I.current=[Le],S.add(Le),W=new ut(r,28),w=new dt({color:1582123,transparent:!0,opacity:.52});const Ve=new ft(W,w);u.current=w,y.current=Ve,S.add(Ve);const qe=Math.max(k.x,k.y,k.z,.001)*.3;x=new pt(qe),x.position.set(-k.x/2,-k.y/2,-k.z/2),x.renderOrder=5,S.add(x);const Ae=Math.max(((je=r.boundingSphere)==null?void 0:je.radius)??1,.001),Ze=ht.degToRad(f.fov/2),xe=Math.max(Ae/Math.sin(Ze)*1.15,.01),Me=R=>{f.near=Math.max(xe/1e3,1e-4),f.far=Math.max(xe*100,10);const M=R==="x"?new T(1,0,0):R==="y"?new T(0,1,0):R==="z"?new T(0,0,1):new T(1,-1,.82).normalize();f.up.set(0,R==="z"?1:0,R==="z"?0:1),f.position.copy(M.multiplyScalar(xe)),f.updateProjectionMatrix(),U.target.set(0,0,0),U.minDistance=Ae*.05,U.maxDistance=xe*20,U.update(),o.render(S,f)},Pe=()=>Me("iso");X.current=Me,F.current=Pe,Pe();const Je=R=>{if(R.ctrlKey||R.metaKey||R.altKey)return;const M=R.key.toLowerCase(),Ne=M==="x"||M==="1"?"x":M==="y"||M==="2"?"y":M==="z"||M==="3"?"z":M==="i"||M==="4"?"iso":null;Ne&&(R.preventDefault(),Me(Ne))};o.domElement.tabIndex=0,o.domElement.addEventListener("pointerdown",()=>o.domElement.focus()),o.domElement.addEventListener("keydown",Je),g({triangles:Math.floor(r.getAttribute("position").count/3),dimensions:[k.x,k.y,k.z]}),v(!1)}catch(ne){if(h.signal.aborted||m)return;N(ne instanceof Error?ne.message:a("fileViewerModal.renderError")),v(!1)}})(),()=>{m=!0,h.abort(),F.current=null,X.current=null,d.current=null,l.current=null,t.current=null,u.current=null,y.current=null,A.current=null,j.current=null,p.current=null,P.current=null,O.current=null,I.current=[],De(C.current),C.current=null,we.disconnect(),U.dispose(),r==null||r.dispose(),D==null||D.dispose(),W==null||W.dispose(),w==null||w.dispose(),x==null||x.geometry.dispose(),x&&(Array.isArray(x.material)?x.material:[x.material]).forEach(te=>te.dispose()),o.dispose(),o.domElement.remove()}},[L,V,a]),e.useEffect(()=>{var h;l.current&&(l.current.background=new Re(Y)),t.current&&(t.current.color.set($),t.current.transparent=q<100,t.current.opacity=q/100,t.current.depthWrite=q>=100,t.current.needsUpdate=!0);const n=A.current;if(n){const m=ue/100;n.hemisphere.intensity=2.2*m,n.key.intensity=2.4*m,n.fill.intensity=1.1*m}y.current&&(y.current.visible=de),(h=d.current)==null||h.call(d)},[$,Y,ue,q,de,c]),e.useEffect(()=>{Ct({modelColor:$,backgroundColor:Y,lightIntensity:ue,modelOpacity:q,showEdges:de})},[$,Y,ue,q,de]),e.useEffect(()=>{var x,S,f;const n=j.current,h=t.current;if(!n||!h||!c)return;const m=c.dimensions[2],r=-m/2,D=r+m*(Z/100),W=r+m*(J/100);n.lower.constant=-D,n.upper.constant=W;const w=re?[n.lower,n.upper]:[];(((x=h.clippingPlanes)==null?void 0:x.length)??0)!==w.length&&(h.needsUpdate=!0),h.clippingPlanes=w,u.current&&((((S=u.current.clippingPlanes)==null?void 0:S.length)??0)!==w.length&&(u.current.needsUpdate=!0),u.current.clippingPlanes=w),(f=d.current)==null||f.call(d)},[re,Z,J,c]),e.useEffect(()=>{he([]),me(null),pe(null),be(!1)},[L]),e.useEffect(()=>{O.current&&(O.current.enabled=Q===null);const n=P.current,h=p.current;if(!n||!h||!c||!Q)return;const m=n.domElement;let r=null;const D=w=>{r=[w.clientX,w.clientY]},W=w=>{var fe;if(!r||Math.hypot(w.clientX-r[0],w.clientY-r[1])>5)return;const x=m.getBoundingClientRect(),S=new mt((w.clientX-x.left)/x.width*2-1,-((w.clientY-x.top)/x.height)*2+1),f=new gt;f.setFromCamera(S,h);const o=f.intersectObjects(I.current,!1)[0];if(!o)return;const U=o.point.clone().add(G.current),ge=(fe=o.face)==null?void 0:fe.normal.clone().transformDirection(o.object.matrixWorld).toArray(),ee=K.current,ae=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;he(we=>[...we,{id:ae,shape:Q,center:U.toArray(),size:[ee,ee,ee],surfaceNormal:ge}]),me(ae)};return m.addEventListener("pointerdown",D),m.addEventListener("pointerup",W),()=>{m.removeEventListener("pointerdown",D),m.removeEventListener("pointerup",W)}},[Q,c]),e.useEffect(()=>{var m,r;De(C.current),C.current=null;const n=l.current;if(!n||se.length===0){(m=d.current)==null||m.call(d);return}const h=Mt(se,G.current,Se);C.current=h,n.add(h),(r=d.current)==null||r.call(d)},[se,Se,c]);const Ye=e.useCallback(()=>{var n;return(n=F.current)==null?void 0:n.call(F)},[]),Ke=e.useCallback(n=>{var h;return(h=X.current)==null?void 0:h.call(X,n)},[]);return s.jsxs("div",{className:`stl-viewer${Q?" area-placement-active":""}`,ref:_,children:[i&&s.jsx("div",{className:"stl-viewer-status",children:a("fileViewerModal.loading3d")}),b&&s.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:b}),!i&&!b&&s.jsxs("div",{className:"stl-viewer-toolbar",children:[c&&s.jsxs("span",{className:"stl-viewer-info",children:[a("fileViewerModal.triangleCount",{count:c.triangles.toLocaleString()})," ·"," ",c.dimensions.map(Ee).join(" × ")]}),s.jsx(Rt,{onView:Ke}),s.jsx("button",{type:"button",onClick:Ye,title:a("fileViewerModal.resetCamera"),"aria-label":a("fileViewerModal.resetCamera"),children:a("fileViewerModal.resetView")}),s.jsx("button",{type:"button",className:re?"active":void 0,onClick:()=>He(n=>!n),"aria-pressed":re,children:a("fileViewerModal.layers")}),s.jsxs("button",{type:"button",className:ye?"active":void 0,onClick:()=>{be(n=>!n),pe(null)},"aria-expanded":ye,children:[a("fileViewerModal.areas"),se.length>0?` (${se.length})`:""]}),s.jsx("button",{type:"button",className:B?"active":void 0,onClick:()=>ce(n=>!n),"aria-expanded":B,children:a("fileViewerModal.viewerSettings")})]}),!i&&!b&&B&&s.jsx(vt,{modelColor:$,onModelColorChange:E,backgroundColor:Y,onBackgroundColorChange:z,lightIntensity:ue,onLightIntensityChange:Oe,modelOpacity:q,onModelOpacityChange:Ie,showEdges:de,onShowEdgesChange:Ge,recentFiles:Xe,currentFilePath:Ce,onRecentFileSelect:ie}),!i&&!b&&ye&&s.jsx(Et,{areas:se,selectedId:Se,placementShape:Q,filename:V,filePath:Ce,modelExtent:Math.max(...c.dimensions),className:re?"with-layer-control":void 0,onPlacementShapeChange:pe,onSelectedIdChange:me,onAreasChange:he,onClose:()=>{be(!1),pe(null)}}),!i&&!b&&re&&c&&s.jsxs("div",{className:"stl-layer-control",children:[s.jsxs("div",{className:"stl-layer-values",children:[s.jsxs("output",{children:[Math.round(Z),"%"]}),s.jsx("span",{children:"–"}),s.jsxs("output",{children:[Math.round(J),"%"]})]}),s.jsxs("span",{className:"stl-layer-height",children:[Ee(c.dimensions[2]*(J-Z)/100)," / ",Ee(c.dimensions[2])]}),s.jsxs("div",{className:"stl-layer-slider",style:{"--layer-bottom":`${Z}%`,"--layer-top-offset":`${100-J}%`},children:[s.jsx("span",{className:"stl-layer-slider-track","aria-hidden":"true"}),s.jsx("span",{className:"stl-layer-slider-selection","aria-hidden":"true"}),s.jsx("input",{className:"stl-layer-range stl-layer-range-bottom",type:"range",min:"0",max:"100",step:"1",value:Z,onChange:n=>$e(Math.min(Number(n.target.value),J)),"aria-label":a("fileViewerModal.layerBottom"),"aria-orientation":"vertical",title:a("fileViewerModal.layerBottom")}),s.jsx("input",{className:"stl-layer-range stl-layer-range-top",type:"range",min:"0",max:"100",step:"1",value:J,onChange:n=>We(Math.max(Number(n.target.value),Z)),"aria-label":a("fileViewerModal.layerTop"),"aria-orientation":"vertical",title:a("fileViewerModal.layerTop")})]}),s.jsx("span",{children:a("fileViewerModal.layerAxis")})]}),!i&&!b&&s.jsx("div",{className:"stl-viewer-hint",children:a("fileViewerModal.controlsHint")}),!i&&!b&&s.jsx(Ft,{})]})}export{Bt as StlViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as
|
|
1
|
+
import{u as L,E as J,L as $,r as m,j as s,J as N,t as S,I as g,s as D}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function M({isOpen:l,bossId:r,onClose:o}){var j;const{t:a}=L(["terminal","common"]),f=J(),n=$(r),[i,c]=m.useState(new Set),[u,b]=m.useState(!1),d=Array.from(f.values()).filter(e=>e.class!=="boss"&&(!e.bossId||e.bossId===r));m.useEffect(()=>{l&&n&&c(new Set(n.subordinateIds||[]))},[l,n]);const y=()=>{b(!0),D.assignSubordinates(r,Array.from(i)),setTimeout(()=>{b(!1),o()},300)},A=e=>{const t=new Set(i);t.has(e)?t.delete(e):t.add(e),c(t)},C=()=>{c(new Set(d.map(e=>e.id)))},p=()=>{c(new Set)},w=e=>{e.target===e.currentTarget&&o()},k=e=>{e.key==="Escape"&&o()};if(!l||!n)return null;const E=N.boss,h=((j=n.subordinateIds)==null?void 0:j.length)||0,I=i.size,x=JSON.stringify([...n.subordinateIds||[]].sort())!==JSON.stringify([...i].sort());return s.jsx("div",{className:`modal-overlay ${l?"visible":""}`,onClick:w,onKeyDown:k,children:s.jsxs("div",{className:"modal subordinate-assignment-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",style:{color:E.color},children:s.jsx(S,{agent:n,size:22})}),a("terminal:team.manageTeam"),": ",n.name]}),s.jsxs("div",{className:"modal-body subordinate-assignment-body",children:[s.jsxs("div",{className:"subordinate-assignment-info",children:[s.jsx("p",{children:a("terminal:team.selectAgents")}),s.jsxs("div",{className:"subordinate-assignment-actions",children:[s.jsx("button",{className:"btn btn-small",onClick:C,children:a("common:buttons.selectAll")}),s.jsx("button",{className:"btn btn-small",onClick:p,children:a("common:buttons.clearAll")})]})]}),s.jsx("div",{className:"subordinates-list",children:d.length===0?s.jsx("div",{className:"subordinates-empty",children:a("terminal:team.noAgentsAvailable")}):d.map(e=>{var v;const t=i.has(e.id),T=N[e.class],z=(v=n.subordinateIds)==null?void 0:v.includes(e.id);return s.jsxs("div",{className:`subordinate-item ${t?"selected":""}`,onClick:()=>A(e.id),children:[s.jsx("div",{className:"subordinate-checkbox",children:t?s.jsx(g,{name:"check",size:12}):null}),s.jsx("div",{className:"subordinate-icon",style:{color:T.color},children:s.jsx(S,{agent:e,size:18})}),s.jsxs("div",{className:"subordinate-info",children:[s.jsx("div",{className:"subordinate-name",children:e.name}),s.jsx("div",{className:"subordinate-class",children:e.class})]}),s.jsx("div",{className:`subordinate-status status-${e.status}`,children:e.status}),z&&s.jsx("div",{className:"subordinate-badge",children:a("common:status.current")})]},e.id)})}),s.jsx("div",{className:"subordinate-assignment-summary",children:x?s.jsxs("span",{className:"summary-changed",children:[h," ",s.jsx(g,{name:"arrow-right",size:11})," ",I," ",a("terminal:team.subordinates").toLowerCase()]}):s.jsxs("span",{className:"summary-unchanged",children:[h," ",a("terminal:team.subordinates").toLowerCase()]})})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:o,children:a("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:y,disabled:u||!x,children:a(u?"common:status.saving":"terminal:team.saveTeam")})]})]})})}export{M as SubordinateAssignmentModal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as F,j as e,
|
|
1
|
+
import{u as F,j as e,as as D,S as k,at as R,r as M,au as Y}from"./main-33HX-Nre.js";import{m as G,P as H,j as L,G as A,t as Z,u as O,v as $,i as B,V as z,a as U}from"./vendor-three-DYBBrXTx.js";function re({modelColor:t,onModelColorChange:d,backgroundColor:l,onBackgroundColorChange:o,lightIntensity:u,onLightIntensityChange:p,modelOpacity:n,onModelOpacityChange:j,showEdges:E,onShowEdgesChange:f,preserveModelColors:x,onPreserveModelColorsChange:c,recentFiles:h=[],currentFilePath:b,onRecentFileSelect:m}){const{t:w}=F("terminal");return e.jsxs("div",{className:"three-viewer-settings",role:"group","aria-label":w("fileViewerModal.viewerSettings"),children:[c&&e.jsxs("label",{className:"three-viewer-setting three-viewer-setting-toggle",children:[e.jsx("span",{children:w("fileViewerModal.originalColors")}),e.jsx("input",{type:"checkbox",checked:x,onChange:a=>c(a.target.checked)})]}),e.jsxs("label",{className:"three-viewer-setting",children:[e.jsx("span",{children:w("fileViewerModal.modelColor")}),e.jsx("input",{type:"color",value:t,disabled:x,onChange:a=>d(a.target.value)})]}),e.jsxs("label",{className:"three-viewer-setting",children:[e.jsx("span",{children:w("fileViewerModal.backgroundColor")}),e.jsx("input",{type:"color",value:l,onChange:a=>o(a.target.value)})]}),e.jsxs("label",{className:"three-viewer-setting three-viewer-setting-range",children:[e.jsx("span",{children:w("fileViewerModal.lightIntensity")}),e.jsx("input",{type:"range",min:"0",max:"200",step:"5",value:u,onChange:a=>p(Number(a.target.value))}),e.jsxs("output",{children:[u,"%"]})]}),e.jsxs("label",{className:"three-viewer-setting three-viewer-setting-range",children:[e.jsx("span",{children:w("fileViewerModal.modelOpacity")}),e.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:n,onChange:a=>j(Number(a.target.value))}),e.jsxs("output",{children:[n,"%"]})]}),e.jsxs("label",{className:"three-viewer-setting three-viewer-setting-toggle",children:[e.jsx("span",{children:w("fileViewerModal.showEdges")}),e.jsx("input",{type:"checkbox",checked:E,onChange:a=>f(a.target.checked)})]}),h.length>0&&m&&e.jsxs("div",{className:"three-viewer-recents",children:[e.jsx("span",{className:"three-viewer-recents-title",children:w("fileViewerModal.recentFiles")}),e.jsx("div",{className:"three-viewer-recents-list",children:h.map(a=>e.jsxs("button",{type:"button",className:a.path===b?"active":void 0,onClick:()=>m(a.path),title:a.path,disabled:a.path===b,children:[e.jsx("span",{children:a.filename}),e.jsx("small",{children:a.kind==="fcstd"?"FreeCAD":"STL"})]},a.path))})]})]})}const J={modelColor:"#58c7d9",backgroundColor:"#11141a",lightIntensity:100,modelOpacity:100,showEdges:!0,preserveModelColors:!0};function K(){const t=D(k.THREE_VIEWER_SETTINGS,{});return{...J,...t}}function ne(t){R(k.THREE_VIEWER_SETTINGS,{...K(),...t})}const P="tide-three-viewer-recents-changed",W=8;function _(){return D(k.THREE_VIEWER_RECENT_FILES,[]).filter(t=>t&&typeof t.path=="string"&&(t.kind==="stl"||t.kind==="fcstd"||t.kind==="glb")).slice(0,W)}function Q(t){const d=[t,..._().filter(l=>l.path!==t.path)].slice(0,W);return R(k.THREE_VIEWER_RECENT_FILES,d),window.dispatchEvent(new CustomEvent(P)),d}function ie(t){try{return new URL(t,window.location.origin).searchParams.get("path")||""}catch{return""}}function se(t,d,l){const[o,u]=M.useState(_);return M.useEffect(()=>{t&&u(Q({path:t,filename:d,kind:l,viewedAt:Date.now()}))},[t,d,l]),M.useEffect(()=>{const p=()=>u(_());return window.addEventListener(P,p),window.addEventListener("storage",p),()=>{window.removeEventListener(P,p),window.removeEventListener("storage",p)}},[]),o}function y(t){return Number(t.toFixed(3)).toString()}function q(t,d,l){const o=d||t,u=l.map((n,j)=>{const E=n.center.map(y).join(", "),f=n.objectName?` objeto/componente \`${n.objectName}\`,`:"",x=n.surfaceNormal?` normal superficial [${n.surfaceNormal.map(y).join(", ")}]`:"";return n.shape==="sphere"?`${j+1}. Esfera:${f} centro XYZ [${E}] mm, radio ${y(n.size[0]/2)} mm.${x}`:`${j+1}. Cubo/caja:${f} centro XYZ [${E}] mm, tamaño XYZ [${n.size.map(y).join(", ")}] mm.${x}`}),p=JSON.stringify({file:o,coordinateSystem:"original-model-coordinates",units:"mm",areas:l.map(n=>({shape:n.shape,center:{x:n.center[0],y:n.center[1],z:n.center[2]},...n.objectName?{object:n.objectName}:{},...n.surfaceNormal?{surfaceNormal:{x:n.surfaceNormal[0],y:n.surfaceNormal[1],z:n.surfaceNormal[2]}}:{},...n.shape==="sphere"?{radius:n.size[0]/2}:{size:{x:n.size[0],y:n.size[1],z:n.size[2]}}}))},null,2);return[`Quiero modificar estas áreas del modelo \`${o}\`.`,"Las coordenadas están en el sistema original del archivo y las unidades se interpretan como milímetros.","",...u,"","```json",p,"```"].join(`
|
|
2
2
|
`)}function ae(t,d,l){const o=new A;o.name="tide-area-markers";for(const u of t){const p=u.shape==="sphere"?new Z(Math.max(u.size[0]/2,.001),24,16):new O(...u.size.map(h=>Math.max(h,.001))),n=u.id===l,j=new $({color:n?16763464:3725311,transparent:!0,opacity:n?.22:.13,depthWrite:!1,side:B}),E=new $({color:n?16766815:7398655,transparent:!0,opacity:.95,wireframe:!0,depthTest:!1}),f=new A;f.userData.areaId=u.id,f.position.set(...u.center).sub(d);const x=new L(p,j),c=new L(p,E);x.renderOrder=20,c.renderOrder=21,f.add(x,c),o.add(f)}return o}function oe(t){if(!t)return;t.removeFromParent();const d=new Set,l=new Set;t.traverse(o=>{if(!(o instanceof L))return;d.add(o.geometry),(Array.isArray(o.material)?o.material:[o.material]).forEach(p=>l.add(p))}),d.forEach(o=>o.dispose()),l.forEach(o=>o.dispose())}function ce({enabled:t,rendererRef:d,cameraRef:l,controlsRef:o,modelObjectsRef:u,modelCenterRef:p,markerGroupRef:n,renderRef:j,setAreas:E,setSelectedId:f}){M.useEffect(()=>{const x=d.current,c=l.current;if(!t||!x||!c)return;const h=x.domElement,b=new G,m=new U,w=new H;let a=null;const C=r=>{const s=h.getBoundingClientRect();m.set((r.clientX-s.left)/s.width*2-1,-((r.clientY-s.top)/s.height)*2+1),b.setFromCamera(m,c)},V=r=>{let s=r;for(;s&&typeof s.userData.areaId!="string";)s=s.parent;return s},T=r=>{var N;const s=n.current;if(r.button!==0||!s)return;C(r);const g=V(((N=b.intersectObject(s,!0)[0])==null?void 0:N.object)??null);if(!g)return;const v=g.getWorldPosition(new z);w.setFromNormalAndCoplanarPoint(c.getWorldDirection(new z),v),a={pointerId:r.pointerId,areaId:g.userData.areaId,marker:g,center:v.clone().add(p.current).toArray()},o.current&&(o.current.enabled=!1),h.setPointerCapture(r.pointerId),r.preventDefault(),r.stopImmediatePropagation()},S=r=>{var v,N;if(!a||r.pointerId!==a.pointerId)return;C(r);const s=b.intersectObjects(u.current,!1)[0],g=(s==null?void 0:s.point)??b.ray.intersectPlane(w,new z);g&&(a.marker.position.copy(g),a.center=g.clone().add(p.current).toArray(),s&&(a.objectName=s.object.name||void 0,a.surfaceNormal=(v=s.face)==null?void 0:v.normal.clone().transformDirection(s.object.matrixWorld).toArray()),(N=j.current)==null||N.call(j),r.preventDefault(),r.stopImmediatePropagation())},i=r=>{if(!a||r.pointerId!==a.pointerId)return;const{areaId:s,center:g,objectName:v,surfaceNormal:N}=a;a=null,E(X=>X.map(I=>I.id===s?{...I,center:g,...v?{objectName:v}:{},...N?{surfaceNormal:N}:{}}:I)),f(s),o.current&&(o.current.enabled=!0),h.hasPointerCapture(r.pointerId)&&h.releasePointerCapture(r.pointerId),r.preventDefault(),r.stopImmediatePropagation()};return h.addEventListener("pointerdown",T,!0),h.addEventListener("pointermove",S,!0),h.addEventListener("pointerup",i,!0),h.addEventListener("pointercancel",i,!0),()=>{h.removeEventListener("pointerdown",T,!0),h.removeEventListener("pointermove",S,!0),h.removeEventListener("pointerup",i,!0),h.removeEventListener("pointercancel",i,!0),o.current&&(o.current.enabled=!0)}},[t,l,o,n,p,u,j,d,E,f])}function le({areas:t,selectedId:d,placementShape:l,filename:o,filePath:u,modelExtent:p,className:n,onPlacementShapeChange:j,onSelectedIdChange:E,onAreasChange:f,onClose:x}){const{t:c}=F("terminal"),[h,b]=M.useState(!1),m=t.find(i=>i.id===d)??null,w=Math.max(p/200,.01),a=Math.max(p*1.5,w*2);M.useEffect(()=>{b(!1)},[t]);const C=i=>{m&&f(t.map(r=>r.id===m.id?{...r,...i}:r))},V=(i,r,s)=>{if(!m||!Number.isFinite(s))return;const g=[...m[i]];g[r]=i==="size"?Math.max(s,.001):s,m.shape==="sphere"&&i==="size"&&g.fill(g[r]),C({[i]:g})},T=()=>{m&&(f(t.filter(i=>i.id!==m.id)),E(null))},S=async()=>{t.length!==0&&(await Y(q(o,u,t)),b(!0))};return e.jsxs("aside",{className:`three-area-panel${n?` ${n}`:""}`,children:[e.jsxs("header",{children:[e.jsx("strong",{children:c("fileViewerModal.areaSelection")}),e.jsx("button",{type:"button",onClick:x,"aria-label":c("fileViewerModal.closeAreas"),children:"×"})]}),e.jsx("p",{children:c(l?"fileViewerModal.areaClickHint":"fileViewerModal.areaSelectShape")}),e.jsx("div",{className:"three-area-shapes",role:"group","aria-label":c("fileViewerModal.areaShape"),children:["sphere","box"].map(i=>e.jsxs("button",{type:"button",className:l===i?"active":void 0,onClick:()=>j(l===i?null:i),"aria-pressed":l===i,children:[e.jsx("span",{"aria-hidden":"true",children:i==="sphere"?"●":"◆"}),c(`fileViewerModal.areaShapes.${i}`)]},i))}),t.length>0&&e.jsx("div",{className:"three-area-list",children:t.map((i,r)=>e.jsxs("button",{type:"button",className:i.id===d?"active":void 0,onClick:()=>E(i.id),children:[r+1,". ",c(`fileViewerModal.areaShapes.${i.shape}`),e.jsxs("small",{children:[i.objectName?`${i.objectName} · `:"",i.center.map(y).join(", ")]})]},i.id))}),m&&e.jsxs("div",{className:"three-area-editor",children:[e.jsxs("span",{children:[c("fileViewerModal.areaCenter")," XYZ"]}),e.jsx("div",{className:"three-area-vector",children:m.center.map((i,r)=>e.jsxs("label",{children:["XYZ"[r],e.jsx("input",{type:"number",step:"0.1",value:y(i),onChange:s=>V("center",r,Number(s.target.value))})]},r))}),e.jsx("span",{children:m.shape==="sphere"?c("fileViewerModal.areaDiameter"):`${c("fileViewerModal.areaSize")} XYZ`}),e.jsx("div",{className:"three-area-size-sliders",children:(m.shape==="sphere"?m.size.slice(0,1):m.size).map((i,r)=>e.jsxs("label",{children:[e.jsx("span",{children:m.shape==="sphere"?"Ø":"XYZ"[r]}),e.jsx("input",{type:"range",min:w,max:a,step:w,value:i,onChange:s=>V("size",r,Number(s.target.value))}),e.jsx("input",{type:"number",min:"0.001",step:w,value:y(i),onChange:s=>V("size",r,Number(s.target.value))})]},r))}),e.jsx("button",{type:"button",className:"danger",onClick:T,children:c("fileViewerModal.removeArea")})]}),e.jsxs("footer",{children:[e.jsx("button",{type:"button",onClick:()=>{f([]),E(null)},disabled:t.length===0,children:c("fileViewerModal.clearAreas")}),e.jsx("button",{type:"button",className:"primary",onClick:()=>void S(),disabled:t.length===0,children:c(h?"fileViewerModal.areasCopied":"fileViewerModal.copyAreas")})]})]})}export{re as T,ce as a,le as b,ae as c,oe as d,K as g,ne as s,se as u,ie as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as t,j as e}from"./main-
|
|
1
|
+
import{u as t,j as e}from"./main-33HX-Nre.js";function l({onView:i}){const{t:s}=t("terminal");return e.jsxs("span",{className:"three-view-shortcuts",role:"group","aria-label":s("fileViewerModal.standardViews"),children:[["x","y","z"].map(a=>e.jsx("button",{type:"button",onClick:()=>i(a),title:s("fileViewerModal.axisViewShortcut",{axis:a.toUpperCase(),key:a.toUpperCase()}),"aria-label":s("fileViewerModal.axisView",{axis:a.toUpperCase()}),children:a.toUpperCase()},a)),e.jsx("button",{type:"button",onClick:()=>i("iso"),title:s("fileViewerModal.isoViewShortcut"),"aria-label":s("fileViewerModal.isoView"),children:"ISO"})]})}function n(){const{t:i}=t("terminal");return e.jsxs("div",{className:"three-axis-legend","aria-label":i("fileViewerModal.axisLegend"),children:[e.jsx("span",{className:"axis-x",children:"X"}),e.jsx("span",{className:"axis-y",children:"Y"}),e.jsx("span",{className:"axis-z",children:"Z"})]})}export{l as T,n as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{E as Me,r as o,c as v,d as b,j as e}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const Ie=[{value:"webhook",label:"Webhook"},{value:"bitbucket",label:"Bitbucket"},{value:"cron",label:"Cron"},{value:"slack",label:"Slack"},{value:"email",label:"Email"},{value:"jira",label:"Jira"},{value:"whatsapp",label:"WhatsApp"}],Ae=[{value:"all",label:"All",icon:"◎"},{value:"webhook",label:"Webhook",icon:"🪝"},{value:"bitbucket",label:"Bitbucket",icon:"🪣"},{value:"cron",label:"Cron",icon:"⏰"},{value:"slack",label:"Slack",icon:"💬"},{value:"email",label:"Email",icon:"✉️"},{value:"jira",label:"Jira",icon:"🎫"},{value:"whatsapp",label:"WhatsApp",icon:"📱"}],Be=[{value:"pullrequest:created",label:"PR created"},{value:"pullrequest:updated",label:"PR updated"},{value:"pullrequest:approved",label:"PR approved"},{value:"pullrequest:unapproved",label:"PR unapproved"},{value:"pullrequest:fulfilled",label:"PR merged"},{value:"pullrequest:rejected",label:"PR declined"},{value:"pullrequest:comment_created",label:"PR comment created"}],Re=[{value:"structural",label:"Structural",desc:"Field-based matching (fast, free)"},{value:"llm",label:"LLM",desc:"Semantic matching via LLM (flexible, costs tokens)"},{value:"hybrid",label:"Hybrid",desc:"Structural pre-filter + LLM (recommended)"}],Fe=[{value:"structural",label:"Structural"},{value:"llm",label:"LLM"}];function Ee(w){if(!w)return"";const g=new Date(w);if(Number.isNaN(g.getTime()))return"";const m=j=>String(j).padStart(2,"0");return`${g.getFullYear()}-${m(g.getMonth()+1)}-${m(g.getDate())}T${m(g.getHours())}:${m(g.getMinutes())}`}const O=()=>({name:"",description:"",type:"webhook",agentId:"",promptTemplate:"",enabled:!0,matchMode:"structural",extractionMode:"structural",config:{method:"POST"}});function Pe({isOpen:w,onClose:g}){var Q,X,Z,ee,le,te,se,ae,ne,ie,re,oe,ce,de,pe,ue;const m=Me(),[j,xe]=o.useState([]),[S,A]=o.useState("list"),[n,k]=o.useState(O()),[h,R]=o.useState(!1),[L,D]=o.useState(!1),[P,y]=o.useState(null),[z,he]=o.useState([]),[T,ye]=o.useState(null),[F,be]=o.useState(`{
|
|
2
2
|
|
|
3
3
|
}`),[u,M]=o.useState(null),[N,U]=o.useState(!1),[H,W]=o.useState([]),[I,ge]=o.useState("all"),[_,je]=o.useState([]),f=o.useCallback(async()=>{try{const t=await v(b("/api/triggers"));if(t.ok){const s=await t.json();xe(s)}}catch(t){console.error("Failed to load triggers:",t)}},[]),B=o.useCallback(async t=>{try{const s=await v(b(`/api/triggers/${t}/events?limit=20`));if(s.ok){const a=await s.json();he(a)}}catch(s){console.error("Failed to load trigger history:",s)}},[]),q=o.useCallback(async()=>{try{const t=await v(b("/api/slack/instances"));if(t.ok){const s=await t.json(),a=Array.isArray(s==null?void 0:s.instances)?s.instances:[];je(a.map(p=>({id:p.id,label:p.label||p.id})))}}catch(t){console.error("Failed to load Slack instances:",t)}},[]);o.useEffect(()=>{w&&(f(),q())},[w,f,q]),o.useEffect(()=>{T&&B(T)},[T,B]);const ve=o.useCallback(async()=>{D(!0),y(null);try{const t=h?b(`/api/triggers/${n.id}`):b("/api/triggers"),p=await v(t,{method:h?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!p.ok){const d=await p.json();throw new Error(d.error||"Failed to save trigger")}await f(),A("list"),k(O()),R(!1)}catch(t){y(t instanceof Error?t.message:"Save failed")}finally{D(!1)}},[n,h,f]),me=o.useCallback(async t=>{try{await v(b(`/api/triggers/${t}`),{method:"DELETE"}),await f()}catch(s){console.error("Failed to delete trigger:",s)}},[f]),fe=o.useCallback(async t=>{try{await v(b(`/api/triggers/${t.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!t.enabled})}),await f()}catch(s){console.error("Failed to toggle trigger:",s)}},[f]),ke=o.useCallback(async t=>{try{await v(b(`/api/triggers/${t}/fire`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({variables:{}})}),T===t&&await B(t)}catch(s){console.error("Failed to test fire trigger:",s)}},[T,B]),Ce=o.useCallback(async()=>{if(n.id){U(!0),M(null);try{let t;try{t=JSON.parse(F)}catch{M({structuralMatch:void 0,extractedVariables:{},wouldFire:!1}),y("Invalid JSON payload");return}const s=await v(b(`/api/triggers/${n.id}/test-match`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:t})});if(s.ok){const a=await s.json();M(a),y(null)}else{const a=await s.json();y(a.error||"Test match failed")}}catch(t){y(t instanceof Error?t.message:"Test match failed")}finally{U(!1)}}},[n.id,F]),we=o.useCallback(async t=>{var s;try{const a=await v(b("/api/triggers/validate-cron"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expression:t,timezone:((s=n.config)==null?void 0:s.timezone)||"UTC"})});if(a.ok){const p=await a.json();W(p.valid?p.nextFires:[])}}catch{W([])}},[n]),$=o.useCallback(t=>{t?(k({...t}),R(!0)):(k(O()),R(!1)),M(null),y(null),A("edit")},[]),x=o.useCallback((t,s)=>{k(a=>({...a,[t]:s}))},[]),r=o.useCallback((t,s)=>{k(a=>({...a,config:{...a.config,[t]:s}}))},[]),E=o.useCallback((t,s)=>{k(a=>({...a,llmMatch:{...a.llmMatch||{prompt:""},[t]:s}}))},[]),J=o.useCallback((t,s)=>{k(a=>({...a,llmExtract:{...a.llmExtract||{prompt:"",variables:[]},[t]:s}}))},[]),Se=o.useMemo(()=>Array.from(m.values()).map(t=>({id:t.id,name:t.name,class:t.class})),[m]),Te=o.useMemo(()=>{const t={all:j.length,webhook:0,bitbucket:0,cron:0,slack:0,email:0,jira:0,whatsapp:0};for(const s of j)s.type in t&&(t[s.type]+=1);return t},[j]),G=o.useMemo(()=>I==="all"?j:j.filter(t=>t.type===I),[j,I]),[K,V]=o.useState(null),Y=o.useCallback((t,s)=>{t&&navigator.clipboard.writeText(t).then(()=>{V(s),setTimeout(()=>V(a=>a===s?null:a),1500)},()=>y("Failed to copy to clipboard"))},[]);return w?e.jsx("div",{style:l.overlay,onClick:g,children:e.jsxs("div",{style:l.panel,onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{style:l.header,children:[e.jsx("h2",{style:l.title,children:S==="list"?"Triggers":h?"Edit Trigger":"New Trigger"}),e.jsxs("div",{style:l.headerActions,children:[S==="list"&&e.jsx("button",{style:l.addBtn,onClick:()=>$(),children:"+ New Trigger"}),S==="edit"&&e.jsx("button",{style:l.backBtn,onClick:()=>{A("list"),M(null),y(null)},children:"Back"}),e.jsx("button",{style:l.closeBtn,onClick:g,children:"X"})]})]}),P&&e.jsx("div",{style:l.error,children:P}),S==="list"&&e.jsxs("div",{style:l.content,children:[e.jsx("div",{style:l.tabBar,role:"tablist","aria-label":"Filter triggers by type",children:Ae.map(t=>{const s=Te[t.value],a=I===t.value;return e.jsxs("button",{role:"tab","aria-selected":a,onClick:()=>ge(t.value),style:{...l.tab,...a?l.tabActive:{}},title:`${t.label} (${s})`,children:[e.jsx("span",{style:l.tabIcon,children:t.icon}),e.jsx("span",{style:l.tabLabel,children:t.label}),e.jsx("span",{style:{...l.tabBadge,...a?l.tabBadgeActive:{}},children:s})]},t.value)})}),j.length===0?e.jsx("div",{style:l.empty,children:"No triggers configured. Create one to get started."}):G.length===0?e.jsxs("div",{style:l.empty,children:["No ",I," triggers configured yet."]}):G.map(t=>{var s;return e.jsxs("div",{style:{...l.triggerCard,borderLeftColor:t.status==="error"?"#e74c3c":t.enabled?"#2ecc71":"#95a5a6"},onClick:()=>{ye(t.id),$(t)},children:[e.jsxs("div",{style:l.cardHeader,children:[e.jsxs("div",{style:l.cardTitle,children:[e.jsx("span",{style:l.typeTag,children:t.type}),e.jsx("span",{children:t.name}),t.type==="cron"&&(()=>{const a=t.config||{};return a.runOnce?a.completedAt?e.jsx("span",{style:{...l.matchTag,color:"#a6e3a1"},children:"Once · completed"}):a.missedAt?e.jsx("span",{style:{...l.matchTag,color:"#f38ba8"},children:"Once · missed"}):e.jsx("span",{style:{...l.matchTag,color:"#f9e2af"},children:"Once · pending"}):e.jsx("span",{style:l.matchTag,children:"Recurring"})})(),t.matchMode!=="structural"&&e.jsx("span",{style:l.matchTag,children:t.matchMode})]}),e.jsxs("div",{style:l.cardActions,children:[e.jsx("button",{style:l.smallBtn,onClick:a=>{a.stopPropagation(),fe(t)},children:t.enabled?"Disable":"Enable"}),e.jsx("button",{style:l.smallBtn,onClick:a=>{a.stopPropagation(),ke(t.id)},children:"Test Fire"}),e.jsx("button",{style:{...l.smallBtn,color:"#e74c3c"},onClick:a=>{a.stopPropagation(),me(t.id)},children:"Delete"})]})]}),e.jsxs("div",{style:l.cardMeta,children:[e.jsxs("span",{children:["Agent: ",((s=m.get(t.agentId))==null?void 0:s.name)||t.agentId]}),e.jsxs("span",{children:["Fires: ",t.fireCount]}),t.lastFiredAt&&e.jsxs("span",{children:["Last: ",new Date(t.lastFiredAt).toLocaleString()]}),t.status==="error"&&t.lastError&&e.jsxs("span",{style:{color:"#e74c3c"},children:["Error: ",t.lastError]})]})]},t.id)})]}),S==="edit"&&e.jsx("div",{style:l.content,children:e.jsxs("div",{style:l.form,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Name"}),e.jsx("input",{style:l.input,value:n.name||"",onChange:t=>x("name",t.target.value),placeholder:"My Trigger"})]}),e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Description"}),e.jsx("input",{style:l.input,value:n.description||"",onChange:t=>x("description",t.target.value),placeholder:"Optional description"})]}),e.jsxs("div",{style:l.row,children:[e.jsxs("div",{style:l.field,children:[e.jsx("label",{style:l.label,children:"Type"}),e.jsx("select",{style:l.select,value:n.type||"webhook",onChange:t=>{const s=t.target.value;x("type",s),s==="webhook"?x("config",{method:"POST"}):s==="cron"?x("config",{expression:"0 9 * * MON-FRI",timezone:"UTC"}):s==="bitbucket"?x("config",{workspace:"",repoSlug:"",events:["pullrequest:created","pullrequest:updated"]}):x("config",{}),(n.promptTemplate??"").trim()||(s==="slack"?x("promptTemplate",`Slack message from {{slack.user}} in {{slack.channelName}}:
|
|
4
4
|
{{slack.message}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u,r as a,
|
|
1
|
+
import{u,r as a,a9 as h,j as e}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function y({url:r,downloadUrl:o,filename:s}){const{t:i}=u(["terminal","common"]),[t,l]=a.useState(null),[d,c]=a.useState(!1),m=a.useCallback(()=>{h(o,s)},[o,s]);return d?e.jsxs("div",{className:"video-player-error",children:[e.jsx("div",{children:i("terminal:videoPlayer.unsupported",{defaultValue:"This browser cannot play this video format."})}),e.jsx("button",{type:"button",className:"file-viewer-copy-html-btn",onClick:m,children:i("common:buttons.download")})]}):e.jsxs("div",{className:"video-player",children:[e.jsx("video",{className:"video-player-element",src:r,controls:!0,preload:"metadata",playsInline:!0,onError:()=>c(!0),onLoadedMetadata:n=>l({width:n.currentTarget.videoWidth,height:n.currentTarget.videoHeight})},r),t&&t.width>0&&e.jsxs("div",{className:"video-player-meta",children:[t.width,"×",t.height]})]})}export{y as VideoPlayer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x,c as M,d as P,j as e,
|
|
1
|
+
import{r as x,c as M,d as P,j as e,E as J}from"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const H=[{id:"intake",name:"Intake",type:"action",description:"Gather CC details from the developer via Slack",action:{type:"agent_task",agentId:"",promptTemplate:`A developer has requested a new CC (Control de Cambios). Here is their message:
|
|
2
2
|
{{trigger.slack.message}}
|
|
3
3
|
From: {{trigger.slack.user}} (Slack ID: {{trigger.slack.userId}})
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-BZ7Xp1xZ.js";import{p as f}from"./chunk-JWPE2WC7-CrfN0IY7.js";import{_ as n,l as o}from"./mermaid.core-DE8C8qk_.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-D1Tm3Vt0.js";import"./main-33HX-Nre.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},I={parser:R,db:a,renderer:u,styles:p};export{I as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-
|
|
1
|
+
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-DE8C8qk_.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
|