tide-commander 1.199.2 → 1.199.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/assets/{AudioPlayer-XaWiU7f4.js → AudioPlayer-A_DNcPYr.js} +1 -1
  3. package/dist/assets/{BossLogsModal-1tI-leZQ.js → BossLogsModal-7i0Dfzei.js} +1 -1
  4. package/dist/assets/{BossSpawnModal-CRoChH0J.js → BossSpawnModal-fBYj1bCx.js} +1 -1
  5. package/dist/assets/{ControlsModal-Cu7kwhct.js → ControlsModal-CUQiPa2F.js} +1 -1
  6. package/dist/assets/{DockerLogsModal-DFAiOsWH.js → DockerLogsModal--VKfyjl3.js} +1 -1
  7. package/dist/assets/{EmbeddedEditor-hnSknX5L.js → EmbeddedEditor-hNl7brYP.js} +1 -1
  8. package/dist/assets/{FcStdViewer-B_cbRz1w.js → FcStdViewer-B8y6Kf36.js} +1 -1
  9. package/dist/assets/{GcodeViewer-CFgwEZ6g.js → GcodeViewer-COcNJnpt.js} +1 -1
  10. package/dist/assets/{GlbViewer-14WSSXX7.js → GlbViewer-C0Xzz1eH.js} +1 -1
  11. package/dist/assets/{GmailOAuthSetup-waw2142C.js → GmailOAuthSetup-DUIzQ8J7.js} +1 -1
  12. package/dist/assets/{GoogleOAuthSetup-Bo59grtp.js → GoogleOAuthSetup-BTWZ_aJr.js} +1 -1
  13. package/dist/assets/{IframeModal-B3M77grB.js → IframeModal-B6PC5QX4.js} +1 -1
  14. package/dist/assets/{IntegrationsPanel-BLHrC0GX.js → IntegrationsPanel-DgYST-q4.js} +2 -2
  15. package/dist/assets/{LogViewerModal-CitlmDgQ.js → LogViewerModal-DmH5JCwc.js} +1 -1
  16. package/dist/assets/{MonitoringModal-BcKOCSRM.js → MonitoringModal-CSB6I7HA.js} +1 -1
  17. package/dist/assets/{PM2LogsModal-DrHpuMNf.js → PM2LogsModal-jT7I4Nrj.js} +1 -1
  18. package/dist/assets/{RestoreArchivedAreaModal-DcD3vdUJ.js → RestoreArchivedAreaModal-jp5Xsv_D.js} +1 -1
  19. package/dist/assets/{Scene2DCanvas-DKUcFYZW.js → Scene2DCanvas-BJf7xjcI.js} +1 -1
  20. package/dist/assets/{SceneManager-DPojKMM-.js → SceneManager-CjhMmFGP.js} +1 -1
  21. package/dist/assets/{SkillsPanel-CUW0prbh.js → SkillsPanel-CzLEygqp.js} +1 -1
  22. package/dist/assets/{SlackMultiInstanceSetup-YFYeZ94t.js → SlackMultiInstanceSetup-kIMTq331.js} +1 -1
  23. package/dist/assets/{SpawnModal-DPvq-R5b.js → SpawnModal-DeuiK-ft.js} +1 -1
  24. package/dist/assets/{StatisticsModal-Dt-Hof51.js → StatisticsModal-BbFqat0A.js} +1 -1
  25. package/dist/assets/{StlViewer-GyyomEax.js → StlViewer-CykV3bDr.js} +1 -1
  26. package/dist/assets/{SubordinateAssignmentModal-ahzGBjr4.js → SubordinateAssignmentModal-BEhgvADS.js} +1 -1
  27. package/dist/assets/{ThreeAreaSelector-Bj_mL6NG.js → ThreeAreaSelector-61KRvl6V.js} +1 -1
  28. package/dist/assets/{ThreeViewShortcuts-CKtE3yZV.js → ThreeViewShortcuts-BsuRkJQ3.js} +1 -1
  29. package/dist/assets/{TriggerManagerPanel-DtdbOk9B.js → TriggerManagerPanel-BUbAL2Mb.js} +1 -1
  30. package/dist/assets/{VideoPlayer-Crq-MwPS.js → VideoPlayer-Bow0E8JN.js} +1 -1
  31. package/dist/assets/{WorkflowEditorPanel-CitR9Em3.js → WorkflowEditorPanel-D5sSWYl7.js} +1 -1
  32. package/dist/assets/{abnfDiagram-VRR7QNED-QFcuJYPe.js → abnfDiagram-VRR7QNED-C2HvJaIu.js} +1 -1
  33. package/dist/assets/{arc-CLuSzQ4E.js → arc-DIfPSJnG.js} +1 -1
  34. package/dist/assets/{architectureDiagram-ZJ3FMSHR-DlhVck93.js → architectureDiagram-ZJ3FMSHR-JwB01V03.js} +1 -1
  35. package/dist/assets/{area-logos-DYARiYqI.js → area-logos-CzRaMbh2.js} +1 -1
  36. package/dist/assets/{blockDiagram-677ZJIJ3-CJwOmsfj.js → blockDiagram-677ZJIJ3-Zr1rRoej.js} +1 -1
  37. package/dist/assets/{c4Diagram-LMCZKHZV-OsgCNPWJ.js → c4Diagram-LMCZKHZV-D1bI4OAN.js} +1 -1
  38. package/dist/assets/channel-D875PBiW.js +1 -0
  39. package/dist/assets/{chunk-2Q5K7J3B-KG-L7vvm.js → chunk-2Q5K7J3B-IBPe4Q7q.js} +1 -1
  40. package/dist/assets/{chunk-32BRIVSS-BXGbqO9v.js → chunk-32BRIVSS-rQSWhcb_.js} +1 -1
  41. package/dist/assets/{chunk-5VM5RSS4-BWXkm8f0.js → chunk-5VM5RSS4-Dmv7dmVy.js} +1 -1
  42. package/dist/assets/{chunk-EX3LRPZG-7-8ulJ19.js → chunk-EX3LRPZG-TDT_cQou.js} +1 -1
  43. package/dist/assets/{chunk-JWPE2WC7-mkwFN5xu.js → chunk-JWPE2WC7-C0GVNe-V.js} +1 -1
  44. package/dist/assets/{chunk-MOJQB5TN-WEfWznKE.js → chunk-MOJQB5TN-__mP_faY.js} +1 -1
  45. package/dist/assets/{chunk-RYQCIY6F-ByP5odu4.js → chunk-RYQCIY6F-ecSBBPze.js} +1 -1
  46. package/dist/assets/{chunk-V7JOEXUC-yWHmp1L1.js → chunk-V7JOEXUC-BC56iR05.js} +1 -1
  47. package/dist/assets/{chunk-VR4S4FIN-DHbZaHzt.js → chunk-VR4S4FIN-DERvXVps.js} +1 -1
  48. package/dist/assets/{chunk-XXDRQBXY-SNa-Wh3U.js → chunk-XXDRQBXY-BVn84nw2.js} +1 -1
  49. package/dist/assets/classDiagram-OUVF2IWQ-EG57DD_l.js +1 -0
  50. package/dist/assets/classDiagram-v2-EOCWNBFH-EG57DD_l.js +1 -0
  51. package/dist/assets/{cose-bilkent-JH36ORCC-CyxHYUhP.js → cose-bilkent-JH36ORCC-mg3hjIh0.js} +1 -1
  52. package/dist/assets/{cynefin-VYW2F7L2-BvwjSDiQ.js → cynefin-VYW2F7L2-BMZ4knrn.js} +1 -1
  53. package/dist/assets/{cynefinDiagram-TSTJHNR4-C8doInhn.js → cynefinDiagram-TSTJHNR4-CnOuLqXO.js} +1 -1
  54. package/dist/assets/{dagre-VKFMJZFB-BNDcupek.js → dagre-VKFMJZFB-BqmESFSV.js} +1 -1
  55. package/dist/assets/{diagram-FQU43EPY-Bst0bBnQ.js → diagram-FQU43EPY-BO4mTTgt.js} +1 -1
  56. package/dist/assets/{diagram-G47NLZAW-CfEv0aTY.js → diagram-G47NLZAW-txAn-X18.js} +1 -1
  57. package/dist/assets/{diagram-NH7WQ7WH-B7MYvWXL.js → diagram-NH7WQ7WH-BpGKYTxX.js} +1 -1
  58. package/dist/assets/{diagram-OA4YK3LP-BIzII0d2.js → diagram-OA4YK3LP-BWgk4USe.js} +1 -1
  59. package/dist/assets/{diagram-WEI45ONY-D5yd1HWr.js → diagram-WEI45ONY-CgqpLIRx.js} +1 -1
  60. package/dist/assets/{ebnfDiagram-CCIWWBDH-gyhVYUos.js → ebnfDiagram-CCIWWBDH-CJXyC9CG.js} +1 -1
  61. package/dist/assets/{erDiagram-Q63AITRT-Duz-DwfE.js → erDiagram-Q63AITRT-B419ak6F.js} +1 -1
  62. package/dist/assets/{flowDiagram-23GEKE2U-CrnARkmw.js → flowDiagram-23GEKE2U-CaoVLCFn.js} +1 -1
  63. package/dist/assets/{ganttDiagram-NO4QXBWP-D6cBteIN.js → ganttDiagram-NO4QXBWP-DzKf09RL.js} +1 -1
  64. package/dist/assets/{gitGraphDiagram-IHSO6WYX-CMHfr_lR.js → gitGraphDiagram-IHSO6WYX-BcJSGanA.js} +1 -1
  65. package/dist/assets/{index-D5O_0aq9.js → index-BTxaN45Z.js} +1 -1
  66. package/dist/assets/{index-DeqoOoo6.js → index-Bf7yerGj.js} +1 -1
  67. package/dist/assets/{index-fiC5OXgR.js → index-Bhl4oi94.js} +1 -1
  68. package/dist/assets/{index-2427ATYD.js → index-CNMfqZTR.js} +3 -3
  69. package/dist/assets/{index-DJKuwqJG.js → index-D-T-XZwp.js} +2 -2
  70. package/dist/assets/{index-B1vOCcI-.js → index-D4h5z3h7.js} +1 -1
  71. package/dist/assets/{index-D5pIRxFm.js → index-DGC0uvv8.js} +1 -1
  72. package/dist/assets/{index-CbMtvQTH.js → index-DKJGKvx6.js} +1 -1
  73. package/dist/assets/{index-B5wHDczA.js → index-DdXT34nf.js} +1 -1
  74. package/dist/assets/{infoDiagram-FWYZ7A6U-Mvk2Mpp3.js → infoDiagram-FWYZ7A6U-DmSCjl-a.js} +1 -1
  75. package/dist/assets/{ishikawaDiagram-FXEZZL3T-DXsaNDYg.js → ishikawaDiagram-FXEZZL3T-C2aoYMOy.js} +1 -1
  76. package/dist/assets/{journeyDiagram-5HDEW3XC-6QlK8xHN.js → journeyDiagram-5HDEW3XC-C-GVB1KY.js} +1 -1
  77. package/dist/assets/{kanban-definition-HUTT4EX6-D5EeRs07.js → kanban-definition-HUTT4EX6-IWOTfPcO.js} +1 -1
  78. package/dist/assets/{linear-D_aP9MD5.js → linear-BjaKb-fM.js} +1 -1
  79. package/dist/assets/{main-Dk3qq80S.js → main-BTH4eRQ6.js} +97 -97
  80. package/dist/assets/main-Dzc0Sg9A.css +1 -0
  81. package/dist/assets/{mermaid.core-CEculPxD.js → mermaid.core-CAEdJZ_w.js} +4 -4
  82. package/dist/assets/{mindmap-definition-LN4V7U3C-Vjj9vgEN.js → mindmap-definition-LN4V7U3C-BkCFpMNJ.js} +1 -1
  83. package/dist/assets/{pegDiagram-2B236MQR-B-AwbaoO.js → pegDiagram-2B236MQR-BKiRmui-.js} +1 -1
  84. package/dist/assets/{pieDiagram-ENE6RG2P-D5o1UYPK.js → pieDiagram-ENE6RG2P-BP8J15I1.js} +1 -1
  85. package/dist/assets/{quadrantDiagram-ABIIQ3AL-Bl_Rbmz-.js → quadrantDiagram-ABIIQ3AL-BM_bLOrJ.js} +1 -1
  86. package/dist/assets/{railroadDiagram-RFXS5EU6-CW-qy1dp.js → railroadDiagram-RFXS5EU6-BuzJbVwQ.js} +1 -1
  87. package/dist/assets/{requirementDiagram-TGXJPOKE-DGUQpy3K.js → requirementDiagram-TGXJPOKE-BFH7PfsI.js} +1 -1
  88. package/dist/assets/{sankeyDiagram-HTMAVEWB-CUlWZH9G.js → sankeyDiagram-HTMAVEWB-B_LNgbZM.js} +1 -1
  89. package/dist/assets/{sequenceDiagram-DBY2YBRQ-CeDVJrbJ.js → sequenceDiagram-DBY2YBRQ-Dpx20yKk.js} +1 -1
  90. package/dist/assets/{sizeCapture-X5ZJPWSS-BGSL3ofq.js → sizeCapture-X5ZJPWSS-DozwVBxi.js} +1 -1
  91. package/dist/assets/{stateDiagram-2N3HPSRC-9A8tAPIu.js → stateDiagram-2N3HPSRC-Dz7I61Z2.js} +1 -1
  92. package/dist/assets/stateDiagram-v2-6OUMAXLB-BFOToQX1.js +1 -0
  93. package/dist/assets/{swimlanes-5IMT3BWC-CipRR1uk.js → swimlanes-5IMT3BWC-IF3gQbtc.js} +2 -2
  94. package/dist/assets/swimlanesDiagram-G3AALYLV-CF7hL7qo.js +8 -0
  95. package/dist/assets/{timeline-definition-FHXFAJF6-IgrCsFe-.js → timeline-definition-FHXFAJF6-72sDxnmY.js} +1 -1
  96. package/dist/assets/{vennDiagram-L72KCM5P-okSGsDy3.js → vennDiagram-L72KCM5P-nfw568sB.js} +1 -1
  97. package/dist/assets/{wardleyDiagram-EHGQE667-G0RLggUt.js → wardleyDiagram-EHGQE667-DoF1Ii5p.js} +1 -1
  98. package/dist/assets/{web-BPOqvnJL.js → web-C8qAHcxt.js} +1 -1
  99. package/dist/assets/{web-B5BfOO5C.js → web-D97lBSvE.js} +1 -1
  100. package/dist/assets/{web-Q8DwQW0W.js → web-DlKkI5gM.js} +1 -1
  101. package/dist/assets/{xychartDiagram-FW5EYKEG-DtVJEFyI.js → xychartDiagram-FW5EYKEG-gGwkb3hj.js} +1 -1
  102. package/dist/build-info.json +1 -1
  103. package/dist/index.html +2 -2
  104. package/package.json +1 -1
  105. package/dist/assets/channel-cpl_NpAy.js +0 -1
  106. package/dist/assets/classDiagram-OUVF2IWQ-D_lsO4mm.js +0 -1
  107. package/dist/assets/classDiagram-v2-EOCWNBFH-D_lsO4mm.js +0 -1
  108. package/dist/assets/main-B2ZLroL1.css +0 -1
  109. package/dist/assets/stateDiagram-v2-6OUMAXLB-DzVFFq0g.js +0 -1
  110. package/dist/assets/swimlanesDiagram-G3AALYLV-XDQw-C4e.js +0 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.199.3] - 2026-08-19
6
+
7
+ ### Fixed
8
+ - **Clicking a dock chip always opens the agent you aimed at** - the miniature agent roster froze its rendered order for the duration of a press, so a live status or recency update can no longer slide a different agent under your pointer between press and click. The chip under the finger at press time also wins for the delayed synthetic clicks phones dispatch after the roster DOM has already changed.
9
+ - **No more flicker when the terminal snaps to the bottom** - the scroll target is the DOM's actual bottom offset instead of the last virtual row, whose index the virtualizer could revise seconds later when the row remeasured, briefly pulling the viewport up before the bottom writer snapped it back.
10
+ - **Opening a cold conversation no longer flashes blank** - the page is revealed in the same commit that removes its loading overlay, instead of fading in over 90 ms and exposing one empty frame after the overlay disappeared.
11
+
5
12
  ## [1.199.2] - 2026-08-19
6
13
 
7
14
  ### Changed
@@ -1 +1 @@
1
- import{u as te,r as a,c as ae,j as l,I as O}from"./main-Dk3qq80S.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const _=1200;function ne(s,c=_){const r=new Float32Array(c),o=new Float32Array(c);if(s.length===0||c<=0)return{min:r,max:o};const f=s.length/c;for(let u=0;u<c;u++){const y=Math.floor(u*f),v=Math.min(s.length,Math.max(y+1,Math.floor((u+1)*f)));let x=s[y],w=s[y];for(let k=y+1;k<v;k++){const g=s[k];g<x&&(x=g),g>w&&(w=g)}r[u]=x,o[u]=w}return{min:r,max:o}}function re(s){if(s.length===0)return new Float32Array(0);if(s.length===1)return s[0];const c=s[0].length,r=new Float32Array(c);for(const o of s){const f=Math.min(c,o.length);for(let u=0;u<f;u++)r[u]+=o[u]}for(let o=0;o<c;o++)r[o]/=s.length;return r}function K(s){if(!Number.isFinite(s)||s<0)return"0:00";const c=Math.floor(s),r=c%60,o=Math.floor(c/60)%60,f=Math.floor(c/3600),u=f>0?String(o).padStart(2,"0"):String(o);return`${f>0?`${f}:`:""}${u}:${String(r).padStart(2,"0")}`}const oe=[.5,.75,1,1.25,1.5,2],se=160;function ce({url:s,filename:c}){const{t:r}=te(["terminal","common"]),o=a.useRef(null),f=a.useRef(null),u=a.useRef(null),y=a.useRef(0),[v,x]=a.useState(null),[w,k]=a.useState(null),[g,A]=a.useState(!1),[q,$]=a.useState(!1),[p,W]=a.useState(null),[M,C]=a.useState(!1),[S,P]=a.useState(0),[R,E]=a.useState(0),[z,X]=a.useState(1),[B,G]=a.useState(!1),[F,Y]=a.useState(1);a.useEffect(()=>{const e=new AbortController;let t=null,n=null,m=!1;return x(null),k(null),A(!1),$(!1),W(null),u.current=null,ae(s,{signal:e.signal}).then(async i=>{if(!i.ok)throw new Error(`${i.status}`);const h=await i.blob();if(!m)return t=URL.createObjectURL(h),x(t),h.arrayBuffer()}).then(async i=>{if(m||!i)return;const h=window.AudioContext||window.webkitAudioContext;if(!h){A(!0);return}n=new h;const d=await n.decodeAudioData(i);if(m)return;const j=[];for(let b=0;b<d.numberOfChannels;b++)j.push(d.getChannelData(b));u.current=ne(re(j),_),$(!0),W({duration:d.duration,sampleRate:d.sampleRate,channels:d.numberOfChannels}),E(b=>b>0?b:d.duration)}).catch(i=>{e.signal.aborted||m||(t?A(!0):k(i instanceof Error?i.message:String(i)))}).finally(()=>{n==null||n.close().catch(()=>{})}),()=>{m=!0,e.abort(),t&&URL.revokeObjectURL(t)}},[s]);const N=a.useCallback(()=>{const e=f.current,t=u.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const m=Math.min(window.devicePixelRatio||1,2),i=e.clientWidth,h=e.clientHeight;if(i===0||h===0)return;(e.width!==Math.round(i*m)||e.height!==Math.round(h*m))&&(e.width=Math.round(i*m),e.height=Math.round(h*m)),n.save(),n.scale(m,m),n.clearRect(0,0,i,h);const d=h/2;if(n.strokeStyle="rgba(255, 255, 255, 0.14)",n.beginPath(),n.moveTo(0,d),n.lineTo(i,d),n.stroke(),t){const j=t.min.length,U=(R>0?S/R:0)*i;for(let T=0;T<i;T++){const I=Math.min(j-1,Math.floor(T/i*j)),Z=d-t.max[I]*d,ee=d-t.min[I]*d;n.strokeStyle=T<=U?"#4ad9ff":"rgba(120, 200, 255, 0.32)",n.beginPath(),n.moveTo(T+.5,Math.min(Z,d-.5)),n.lineTo(T+.5,Math.max(ee,d+.5)),n.stroke()}n.strokeStyle="#ffffff",n.beginPath(),n.moveTo(U,0),n.lineTo(U,h),n.stroke()}n.restore()},[S,R]);a.useEffect(()=>{N()},[N,p]),a.useEffect(()=>{const e=f.current;if(!e||typeof ResizeObserver>"u")return;const t=new ResizeObserver(()=>N());return t.observe(e),()=>t.disconnect()},[N]),a.useEffect(()=>{if(!M)return;const e=()=>{const t=o.current;t&&P(t.currentTime),y.current=window.requestAnimationFrame(e)};return y.current=window.requestAnimationFrame(e),()=>window.cancelAnimationFrame(y.current)},[M]),a.useEffect(()=>{const e=o.current;e&&(e.playbackRate=F)},[F,v]);const V=a.useCallback(()=>{const e=o.current;e&&(e.paused?e.play().catch(()=>C(!1)):e.pause())},[]),D=a.useCallback(e=>{const t=o.current;!t||!Number.isFinite(t.duration)||(t.currentTime=Math.max(0,Math.min(1,e))*t.duration,P(t.currentTime))},[]),L=a.useCallback(e=>{const t=e.currentTarget.getBoundingClientRect();t.width!==0&&D((e.clientX-t.left)/t.width)},[D]),J=a.useCallback(e=>{e.buttons===1&&L(e)},[L]),Q=a.useCallback(e=>{const t=o.current;t&&(e.key===" "?(e.preventDefault(),V()):e.key==="ArrowRight"?(e.preventDefault(),t.currentTime=Math.min(t.duration||0,t.currentTime+5),P(t.currentTime)):e.key==="ArrowLeft"&&(e.preventDefault(),t.currentTime=Math.max(0,t.currentTime-5),P(t.currentTime)))},[V]),H=a.useMemo(()=>{const e=[];return p&&(e.push(`${(p.sampleRate/1e3).toFixed(1)} kHz`),e.push(p.channels===1?r("terminal:audioPlayer.mono",{defaultValue:"mono"}):p.channels===2?r("terminal:audioPlayer.stereo",{defaultValue:"stereo"}):`${p.channels} ch`)),e.join(" · ")},[p,r]);return w?l.jsxs("div",{className:"audio-player-error",children:[r("terminal:audioPlayer.loadError",{defaultValue:"Could not load audio"})," — ",w]}):l.jsxs("div",{className:"audio-player",tabIndex:0,onKeyDown:Q,role:"group","aria-label":c,children:[l.jsxs("div",{className:"audio-player-waveform",style:{height:se},children:[l.jsx("canvas",{ref:f,className:"audio-player-canvas",onPointerDown:L,onPointerMove:J}),!q&&!g&&l.jsx("div",{className:"audio-player-waveform-status",children:r("terminal:audioPlayer.decoding",{defaultValue:"Reading waveform…"})}),g&&l.jsx("div",{className:"audio-player-waveform-status",children:r("terminal:audioPlayer.noWaveform",{defaultValue:"Waveform unavailable for this format"})})]}),l.jsxs("div",{className:"audio-player-controls",children:[l.jsx("button",{type:"button",className:"audio-player-play",onClick:V,disabled:!v,title:M?r("common:buttons.pause",{defaultValue:"Pause"}):r("common:buttons.play",{defaultValue:"Play"}),children:l.jsx(O,{name:M?"pause":"play",size:16})}),l.jsxs("span",{className:"audio-player-time",children:[K(S)," / ",K(R)]}),l.jsx("input",{type:"range",className:"audio-player-seek",min:0,max:1,step:.001,value:R>0?S/R:0,onChange:e=>D(Number(e.target.value)),"aria-label":r("terminal:audioPlayer.seek",{defaultValue:"Seek"})}),l.jsx("button",{type:"button",className:`audio-player-toggle${B?" active":""}`,onClick:()=>G(e=>!e),title:r("terminal:audioPlayer.loop",{defaultValue:"Loop"}),children:l.jsx(O,{name:"refresh",size:13})}),l.jsx("select",{className:"audio-player-rate",value:F,onChange:e=>Y(Number(e.target.value)),"aria-label":r("terminal:audioPlayer.speed",{defaultValue:"Playback speed"}),children:oe.map(e=>l.jsxs("option",{value:e,children:[e,"×"]},e))}),l.jsxs("div",{className:"audio-player-volume",children:[l.jsx(O,{name:z===0?"speaker-off":"speaker-on",size:13}),l.jsx("input",{type:"range",min:0,max:1,step:.01,value:z,onChange:e=>{const t=Number(e.target.value);X(t),o.current&&(o.current.volume=t)},"aria-label":r("terminal:audioPlayer.volume",{defaultValue:"Volume"})})]}),H&&l.jsx("span",{className:"audio-player-meta",children:H})]}),v&&l.jsx("audio",{ref:o,src:v,loop:B,preload:"auto",onPlay:()=>C(!0),onPause:()=>C(!1),onEnded:()=>C(!1),onTimeUpdate:e=>P(e.currentTarget.currentTime),onLoadedMetadata:e=>{const t=e.currentTarget.duration;Number.isFinite(t)&&t>0?E(t):p&&E(p.duration)}})]})}export{ce as AudioPlayer};
1
+ import{u as te,r as a,c as ae,j as l,I as O}from"./main-BTH4eRQ6.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const _=1200;function ne(s,c=_){const r=new Float32Array(c),o=new Float32Array(c);if(s.length===0||c<=0)return{min:r,max:o};const f=s.length/c;for(let u=0;u<c;u++){const y=Math.floor(u*f),v=Math.min(s.length,Math.max(y+1,Math.floor((u+1)*f)));let x=s[y],w=s[y];for(let k=y+1;k<v;k++){const g=s[k];g<x&&(x=g),g>w&&(w=g)}r[u]=x,o[u]=w}return{min:r,max:o}}function re(s){if(s.length===0)return new Float32Array(0);if(s.length===1)return s[0];const c=s[0].length,r=new Float32Array(c);for(const o of s){const f=Math.min(c,o.length);for(let u=0;u<f;u++)r[u]+=o[u]}for(let o=0;o<c;o++)r[o]/=s.length;return r}function K(s){if(!Number.isFinite(s)||s<0)return"0:00";const c=Math.floor(s),r=c%60,o=Math.floor(c/60)%60,f=Math.floor(c/3600),u=f>0?String(o).padStart(2,"0"):String(o);return`${f>0?`${f}:`:""}${u}:${String(r).padStart(2,"0")}`}const oe=[.5,.75,1,1.25,1.5,2],se=160;function ce({url:s,filename:c}){const{t:r}=te(["terminal","common"]),o=a.useRef(null),f=a.useRef(null),u=a.useRef(null),y=a.useRef(0),[v,x]=a.useState(null),[w,k]=a.useState(null),[g,A]=a.useState(!1),[q,$]=a.useState(!1),[p,W]=a.useState(null),[M,C]=a.useState(!1),[S,P]=a.useState(0),[R,E]=a.useState(0),[z,X]=a.useState(1),[B,G]=a.useState(!1),[F,Y]=a.useState(1);a.useEffect(()=>{const e=new AbortController;let t=null,n=null,m=!1;return x(null),k(null),A(!1),$(!1),W(null),u.current=null,ae(s,{signal:e.signal}).then(async i=>{if(!i.ok)throw new Error(`${i.status}`);const h=await i.blob();if(!m)return t=URL.createObjectURL(h),x(t),h.arrayBuffer()}).then(async i=>{if(m||!i)return;const h=window.AudioContext||window.webkitAudioContext;if(!h){A(!0);return}n=new h;const d=await n.decodeAudioData(i);if(m)return;const j=[];for(let b=0;b<d.numberOfChannels;b++)j.push(d.getChannelData(b));u.current=ne(re(j),_),$(!0),W({duration:d.duration,sampleRate:d.sampleRate,channels:d.numberOfChannels}),E(b=>b>0?b:d.duration)}).catch(i=>{e.signal.aborted||m||(t?A(!0):k(i instanceof Error?i.message:String(i)))}).finally(()=>{n==null||n.close().catch(()=>{})}),()=>{m=!0,e.abort(),t&&URL.revokeObjectURL(t)}},[s]);const N=a.useCallback(()=>{const e=f.current,t=u.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const m=Math.min(window.devicePixelRatio||1,2),i=e.clientWidth,h=e.clientHeight;if(i===0||h===0)return;(e.width!==Math.round(i*m)||e.height!==Math.round(h*m))&&(e.width=Math.round(i*m),e.height=Math.round(h*m)),n.save(),n.scale(m,m),n.clearRect(0,0,i,h);const d=h/2;if(n.strokeStyle="rgba(255, 255, 255, 0.14)",n.beginPath(),n.moveTo(0,d),n.lineTo(i,d),n.stroke(),t){const j=t.min.length,U=(R>0?S/R:0)*i;for(let T=0;T<i;T++){const I=Math.min(j-1,Math.floor(T/i*j)),Z=d-t.max[I]*d,ee=d-t.min[I]*d;n.strokeStyle=T<=U?"#4ad9ff":"rgba(120, 200, 255, 0.32)",n.beginPath(),n.moveTo(T+.5,Math.min(Z,d-.5)),n.lineTo(T+.5,Math.max(ee,d+.5)),n.stroke()}n.strokeStyle="#ffffff",n.beginPath(),n.moveTo(U,0),n.lineTo(U,h),n.stroke()}n.restore()},[S,R]);a.useEffect(()=>{N()},[N,p]),a.useEffect(()=>{const e=f.current;if(!e||typeof ResizeObserver>"u")return;const t=new ResizeObserver(()=>N());return t.observe(e),()=>t.disconnect()},[N]),a.useEffect(()=>{if(!M)return;const e=()=>{const t=o.current;t&&P(t.currentTime),y.current=window.requestAnimationFrame(e)};return y.current=window.requestAnimationFrame(e),()=>window.cancelAnimationFrame(y.current)},[M]),a.useEffect(()=>{const e=o.current;e&&(e.playbackRate=F)},[F,v]);const V=a.useCallback(()=>{const e=o.current;e&&(e.paused?e.play().catch(()=>C(!1)):e.pause())},[]),D=a.useCallback(e=>{const t=o.current;!t||!Number.isFinite(t.duration)||(t.currentTime=Math.max(0,Math.min(1,e))*t.duration,P(t.currentTime))},[]),L=a.useCallback(e=>{const t=e.currentTarget.getBoundingClientRect();t.width!==0&&D((e.clientX-t.left)/t.width)},[D]),J=a.useCallback(e=>{e.buttons===1&&L(e)},[L]),Q=a.useCallback(e=>{const t=o.current;t&&(e.key===" "?(e.preventDefault(),V()):e.key==="ArrowRight"?(e.preventDefault(),t.currentTime=Math.min(t.duration||0,t.currentTime+5),P(t.currentTime)):e.key==="ArrowLeft"&&(e.preventDefault(),t.currentTime=Math.max(0,t.currentTime-5),P(t.currentTime)))},[V]),H=a.useMemo(()=>{const e=[];return p&&(e.push(`${(p.sampleRate/1e3).toFixed(1)} kHz`),e.push(p.channels===1?r("terminal:audioPlayer.mono",{defaultValue:"mono"}):p.channels===2?r("terminal:audioPlayer.stereo",{defaultValue:"stereo"}):`${p.channels} ch`)),e.join(" · ")},[p,r]);return w?l.jsxs("div",{className:"audio-player-error",children:[r("terminal:audioPlayer.loadError",{defaultValue:"Could not load audio"})," — ",w]}):l.jsxs("div",{className:"audio-player",tabIndex:0,onKeyDown:Q,role:"group","aria-label":c,children:[l.jsxs("div",{className:"audio-player-waveform",style:{height:se},children:[l.jsx("canvas",{ref:f,className:"audio-player-canvas",onPointerDown:L,onPointerMove:J}),!q&&!g&&l.jsx("div",{className:"audio-player-waveform-status",children:r("terminal:audioPlayer.decoding",{defaultValue:"Reading waveform…"})}),g&&l.jsx("div",{className:"audio-player-waveform-status",children:r("terminal:audioPlayer.noWaveform",{defaultValue:"Waveform unavailable for this format"})})]}),l.jsxs("div",{className:"audio-player-controls",children:[l.jsx("button",{type:"button",className:"audio-player-play",onClick:V,disabled:!v,title:M?r("common:buttons.pause",{defaultValue:"Pause"}):r("common:buttons.play",{defaultValue:"Play"}),children:l.jsx(O,{name:M?"pause":"play",size:16})}),l.jsxs("span",{className:"audio-player-time",children:[K(S)," / ",K(R)]}),l.jsx("input",{type:"range",className:"audio-player-seek",min:0,max:1,step:.001,value:R>0?S/R:0,onChange:e=>D(Number(e.target.value)),"aria-label":r("terminal:audioPlayer.seek",{defaultValue:"Seek"})}),l.jsx("button",{type:"button",className:`audio-player-toggle${B?" active":""}`,onClick:()=>G(e=>!e),title:r("terminal:audioPlayer.loop",{defaultValue:"Loop"}),children:l.jsx(O,{name:"refresh",size:13})}),l.jsx("select",{className:"audio-player-rate",value:F,onChange:e=>Y(Number(e.target.value)),"aria-label":r("terminal:audioPlayer.speed",{defaultValue:"Playback speed"}),children:oe.map(e=>l.jsxs("option",{value:e,children:[e,"×"]},e))}),l.jsxs("div",{className:"audio-player-volume",children:[l.jsx(O,{name:z===0?"speaker-off":"speaker-on",size:13}),l.jsx("input",{type:"range",min:0,max:1,step:.01,value:z,onChange:e=>{const t=Number(e.target.value);X(t),o.current&&(o.current.volume=t)},"aria-label":r("terminal:audioPlayer.volume",{defaultValue:"Volume"})})]}),H&&l.jsx("span",{className:"audio-player-meta",children:H})]}),v&&l.jsx("audio",{ref:o,src:v,loop:B,preload:"auto",onPlay:()=>C(!0),onPause:()=>C(!1),onEnded:()=>C(!1),onTimeUpdate:e=>P(e.currentTarget.currentTime),onLoadedMetadata:e=>{const t=e.currentTarget.duration;Number.isFinite(t)&&t>0?E(t):p&&E(p.duration)}})]})}export{ce as AudioPlayer};
@@ -1 +1 @@
1
- import{u as M,e as N,f as v,r as m,s as u,j as r}from"./main-Dk3qq80S.js";import{L as B}from"./LogViewerModal-CitlmDgQ.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function C(s){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let o=0;o<s.length;o++)a=s.charCodeAt(o)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:s,isOpen:n,onClose:a}){const{t:o}=M(["terminal","common"]),b=N(),f=v(),l=b.get(s.id)||[],[i,d]=m.useState(null),c=s.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(s.id),()=>{s.id&&u.stopBossLogStreaming(s.id)}),[n,s.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(t=>e.add(t.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(t=>t.subordinateName===i):l).map((t,j)=>({text:t.chunk,lineNumber:j+1,sourceLabel:t.subordinateName,sourceColor:C(t.subordinateName),isError:t.isError})),[l,i]),x=g.some(e=>{var t;return(t=e.pm2)==null?void 0:t.enabled}),L=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:o("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,S=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[o("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(B,{isOpen:n,onClose:a,title:`${s.name} - ${o("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${o("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(s.id),emptyMessage:x?l.length===0?o("terminal:logs.waitingForLogs"):o("terminal:logs.noMatchingLogs"):o("terminal:logs.noPM2Subordinates"),extraToolbar:L,extraFooter:S,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
1
+ import{u as M,e as N,f as v,r as m,s as u,j as r}from"./main-BTH4eRQ6.js";import{L as B}from"./LogViewerModal-DmH5JCwc.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function C(s){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let o=0;o<s.length;o++)a=s.charCodeAt(o)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:s,isOpen:n,onClose:a}){const{t:o}=M(["terminal","common"]),b=N(),f=v(),l=b.get(s.id)||[],[i,d]=m.useState(null),c=s.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(s.id),()=>{s.id&&u.stopBossLogStreaming(s.id)}),[n,s.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(t=>e.add(t.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(t=>t.subordinateName===i):l).map((t,j)=>({text:t.chunk,lineNumber:j+1,sourceLabel:t.subordinateName,sourceColor:C(t.subordinateName),isError:t.isError})),[l,i]),x=g.some(e=>{var t;return(t=e.pm2)==null?void 0:t.enabled}),L=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:o("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,S=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[o("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(B,{isOpen:n,onClose:a,title:`${s.name} - ${o("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${o("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(s.id),emptyMessage:x?l.length===0?o("terminal:logs.waitingForLogs"):o("terminal:logs.noMatchingLogs"):o("terminal:logs.noPM2Subordinates"),extraToolbar:L,extraFooter:S,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
@@ -1 +1 @@
1
- import{u as De,z as Be,k as Oe,i as Pe,r as t,m as re,S as q,E as P,d as Re,s as S,C as W,A as de,J as C,j as s,n as A,M as Te,F as Fe,I as R,P as K,o as E,p as T,D as Ue,w as J,y as ze}from"./main-Dk3qq80S.js";import{D as Ge}from"./common-types-CZVd6J8k.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function pe(p){const w=C.filter($=>!p.has(`Boss ${$}`));return w.length===0?`Boss ${C[Math.floor(Math.random()*C.length)]}-${Date.now()%1e3}`:`Boss ${w[Math.floor(Math.random()*w.length)]}`}function He({isOpen:p,onClose:w,onSpawnStart:$,onSpawnEnd:F,spawnPosition:ue,spawnAreaId:N}){const{t:n}=De(["terminal","common"]),H=Be(),o=Oe(),L=Pe(),[u,m]=t.useState(""),[I,U]=t.useState(()=>re(q.LAST_CWD)),[d,_]=t.useState("boss"),[X,V]=t.useState(!1),[me,D]=t.useState(!1),[Y,he]=t.useState(!0),[Q,we]=t.useState("bypass"),[c,k]=t.useState("claude"),[f,g]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[Z,xe]=t.useState("claude-opus-4-8[1m]"),[ee,fe]=t.useState("gpt-5.6-luna"),[M,B]=t.useState(new Set),[se,z]=t.useState(new Set),[h,be]=t.useState(""),[v,je]=t.useState(""),[ae,Ne]=t.useState(""),O=t.useRef(null),G=t.useRef(!1),ne=t.useRef(!1),b=t.useMemo(()=>L.filter(e=>e.enabled),[L]),le=t.useMemo(()=>{if(!v.trim())return b;const e=v.toLowerCase();return b.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[b,v]),ge=t.useMemo(()=>{var a;const e=o.find(l=>l.id===d);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?L.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,d,L]);t.useEffect(()=>{if(p&&!ne.current){if(b.length>0){const l=b.filter(i=>Ge.includes(i.slug)).map(i=>i.id);l.length>0&&z(new Set(l))}if(re(q.DEFAULT_AGENT_CLASS)==="random"){const i=[...Object.keys(P).filter(j=>j!=="boss"),...o.map(j=>j.id)];i.length>0&&_(i[Math.floor(Math.random()*i.length)])}}ne.current=p},[p,b,o]);const ve=t.useCallback(e=>{z(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),r=t.useMemo(()=>o.find(e=>e.id===d),[o,d]),Se=t.useMemo(()=>{if(r!=null&&r.model)return r.model},[r]),Ce=t.useMemo(()=>{if(r!=null&&r.customModelPath)return Re(`/api/custom-models/${r.id}`)},[r]),ke=r==null?void 0:r.modelScale,Me=t.useMemo(()=>r?"scout":d==="boss"?"architect":d,[d,r]);t.useEffect(()=>{if(!p||!N)return;const e=S.getState().areas.get(N);if(e!=null&&e.directories&&e.directories.length>0){U(e.directories[0]);return}const a=Array.from(S.getState().agents.values()).filter(x=>{var y;return((y=S.getAreaForAgent(x.id))==null?void 0:y.id)===N&&x.cwd});if(a.length===0)return;const l=new Map;for(const x of a)l.set(x.cwd,(l.get(x.cwd)||0)+1);let i="",j=0;for(const[x,y]of l)y>j&&(i=x,j=y);i&&U(i)},[p,N]);const te=t.useMemo(()=>Array.from(H.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),[H]),ie=t.useMemo(()=>{if(!h.trim())return o;const e=h.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,h]),ce=t.useMemo(()=>{if(!h.trim())return W;const e=h.toLowerCase();return W.filter(a=>{const l=de[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[h]),oe=t.useMemo(()=>{if(!h.trim())return!0;const e=h.toLowerCase(),a=P.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[h]);t.useEffect(()=>{if(p&&!G.current){G.current=!0;const e=new Set(Array.from(S.getState().agents.values()).map(l=>l.name)),a=o.find(l=>l.id===d);if(a){const l=C.filter(i=>!e.has(`${a.name} ${i}`));if(l.length===0){const i=C[Math.floor(Math.random()*C.length)];m(`${a.name} ${i}-${Date.now()%1e3}`)}else m(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else m(pe(e));B(new Set),O.current&&(O.current.focus(),O.current.select())}else p||(G.current=!1)},[p]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===d);if(e)if(u.startsWith("Boss ")){const a=u.substring(5);m(`${e.name} ${a}`)}else{const a=o.find(l=>u.startsWith(l.name+" "));if(a){const l=u.substring(a.name.length+1);m(`${e.name} ${l}`)}else m(`${e.name} ${u}`)}else{const a=o.find(l=>u.startsWith(l.name+" "));if(a){const l=u.substring(a.name.length+1);m(`Boss ${l}`)}else u.startsWith("Boss ")||m(`Boss ${u}`)}},[d]);const ye=()=>{if(D(!1),!I.trim()){D(!0);return}if(!u.trim()){const l=new Set(Array.from(S.getState().agents.values()).map(i=>i.name));m(pe(l));return}ze(q.LAST_CWD,I),$(),window.__spawnModalAreaContext=N?{areaId:N}:null;const e=ae.trim()||void 0,a=Array.from(se);S.spawnBossAgent(u.trim(),d,I.trim(),ue||void 0,Array.from(M),c==="claude"?Y:!1,Q,c,c==="codex"?f:void 0,c==="codex"?ee:void 0,c==="claude"?Z:void 0,e,a),m(""),B(new Set),z(new Set),F(),w()},Ae=()=>{V(!1),m(""),B(new Set),F(),w()},Ee=()=>{V(!1),D(!0),F()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Ae,window.__bossSpawnModalError=Ee,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[u]);const $e=e=>{e.target===e.currentTarget&&w()},Le=e=>{e.key==="Escape"&&w()},Ie=e=>{const a=new Set(M);a.has(e)?a.delete(e):a.add(e),B(a)};if(!p)return null;const _e=P.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:$e,onKeyDown:Le,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(A,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Te,{agentClass:Me,modelFile:Se,customModelUrl:Ce,modelScale:ke,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+W.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:h,onChange:e=>be(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[ie.map(e=>s.jsxs("button",{className:`class-chip ${d===e.id?"selected":""}`,onClick:()=>_(e.id),title:e.description,children:[s.jsx(A,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),oe&&s.jsxs("button",{className:`class-chip ${d==="boss"?"selected":""}`,onClick:()=>_("boss"),title:_e.description,children:[s.jsx(A,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),ce.map(e=>{const a=de[e.id];return a?s.jsxs("button",{className:`class-chip ${d===e.id?"selected":""}`,onClick:()=>_(e.id),title:a.description,children:[s.jsx(A,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),h&&ie.length===0&&!oe&&ce.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:h})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:O,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:u,onChange:e=>m(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Fe,{value:I,onChange:e=>{U(e),D(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:me,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${c==="claude"?"selected":""}`,onClick:()=>k("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${c==="codex"?"selected":""}`,onClick:()=>k("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${c==="opencode"?"selected":""}`,onClick:()=>k("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:s.jsx(R,{name:"status-pending",size:14,weight:"fill",color:"#4ade80"})}),s.jsx("span",{children:"OpenCode"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--grok ${c==="grok"?"selected":""}`,onClick:()=>k("grok"),title:"Use Grok CLI (headless)",children:[s.jsx("img",{src:"/assets/grok.png",alt:"Grok",className:"spawn-provider-icon"}),s.jsx("span",{children:"Grok"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--pi ${c==="pi"?"selected":""}`,onClick:()=>k("pi"),title:"Use Pi coding agent CLI (multi-provider)",children:[s.jsx("img",{src:"/assets/pi.svg",alt:"Pi",className:"spawn-provider-icon"}),s.jsx("span",{children:"Pi"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Q===e?"selected":""}`,onClick:()=>we(e),title:K[e].description,children:[s.jsx("span",{children:s.jsx(R,{name:e==="bypass"?"bolt":"lock",size:14})}),s.jsx("span",{children:K[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),c==="claude"?s.jsx("div",{className:"spawn-select-row spawn-select-row--wrap",children:Object.keys(E).filter(e=>!E[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Z===e?"selected":""}`,onClick:()=>xe(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):c==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(T).map(e=>s.jsxs("button",{className:`spawn-select-btn ${ee===e?"selected":""}`,onClick:()=>fe(e),title:T[e].description,children:[s.jsx("span",{children:T[e].icon}),s.jsx("span",{children:T[e].label})]},e))}):c==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):c==="grok"?s.jsx("div",{className:"spawn-inline-hint",children:Ue}):c==="pi"?s.jsx("div",{className:"spawn-inline-hint",children:"pi default (configure via agent edit)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:Y,onChange:e=>he(e.target.checked),disabled:c!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),c==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:f.fullAuto!==!1,onChange:e=>g(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!f.search,onChange:e=>g(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.sandbox||"workspace-write",onChange:e=>g(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:f.approvalMode||"on-request",onChange:e=>g(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:f.profile||"",onChange:e=>g(a=>({...a,profile:e.target.value||void 0}))}),s.jsxs("select",{className:"spawn-input",value:f.reasoningEffort||"",onChange:e=>g(a=>({...a,reasoningEffort:e.target.value||void 0})),children:[s.jsx("option",{value:"",children:n("terminal:spawn.codex.reasoningEffortDefault")}),Object.keys(J).map(e=>s.jsxs("option",{value:e,children:[J[e].icon," ",n("terminal:spawn.codex.reasoningEffort"),": ",J[e].label]},e))]})]})]})}),b.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),b.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:v,onChange:e=>je(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[le.map(e=>{const a=se.has(e.id);return ge.some(i=>i.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>ve(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:s.jsx(R,{name:"check",size:12})}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),v&&le.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:v})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:ae,onChange:e=>Ne(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:te.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):te.map(e=>{const a=M.has(e.id),l=P[e.class],i=o.find(x=>x.id===e.class),j=l||i||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Ie(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:s.jsx(R,{name:"check",size:12})}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:j.color},children:s.jsx(A,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),M.size>0&&s.jsxs("div",{className:"subordinates-count",children:[M.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:w,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:ye,disabled:X,children:n(X?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{He as BossSpawnModal};
1
+ import{u as De,z as Be,k as Oe,i as Pe,r as t,m as re,S as q,E as P,d as Re,s as S,C as W,A as de,J as C,j as s,n as A,M as Te,F as Fe,I as R,P as K,o as E,p as T,D as Ue,w as J,y as ze}from"./main-BTH4eRQ6.js";import{D as Ge}from"./common-types-CZVd6J8k.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function pe(p){const w=C.filter($=>!p.has(`Boss ${$}`));return w.length===0?`Boss ${C[Math.floor(Math.random()*C.length)]}-${Date.now()%1e3}`:`Boss ${w[Math.floor(Math.random()*w.length)]}`}function He({isOpen:p,onClose:w,onSpawnStart:$,onSpawnEnd:F,spawnPosition:ue,spawnAreaId:N}){const{t:n}=De(["terminal","common"]),H=Be(),o=Oe(),L=Pe(),[u,m]=t.useState(""),[I,U]=t.useState(()=>re(q.LAST_CWD)),[d,_]=t.useState("boss"),[X,V]=t.useState(!1),[me,D]=t.useState(!1),[Y,he]=t.useState(!0),[Q,we]=t.useState("bypass"),[c,k]=t.useState("claude"),[f,g]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[Z,xe]=t.useState("claude-opus-4-8[1m]"),[ee,fe]=t.useState("gpt-5.6-luna"),[M,B]=t.useState(new Set),[se,z]=t.useState(new Set),[h,be]=t.useState(""),[v,je]=t.useState(""),[ae,Ne]=t.useState(""),O=t.useRef(null),G=t.useRef(!1),ne=t.useRef(!1),b=t.useMemo(()=>L.filter(e=>e.enabled),[L]),le=t.useMemo(()=>{if(!v.trim())return b;const e=v.toLowerCase();return b.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[b,v]),ge=t.useMemo(()=>{var a;const e=o.find(l=>l.id===d);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?L.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,d,L]);t.useEffect(()=>{if(p&&!ne.current){if(b.length>0){const l=b.filter(i=>Ge.includes(i.slug)).map(i=>i.id);l.length>0&&z(new Set(l))}if(re(q.DEFAULT_AGENT_CLASS)==="random"){const i=[...Object.keys(P).filter(j=>j!=="boss"),...o.map(j=>j.id)];i.length>0&&_(i[Math.floor(Math.random()*i.length)])}}ne.current=p},[p,b,o]);const ve=t.useCallback(e=>{z(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),r=t.useMemo(()=>o.find(e=>e.id===d),[o,d]),Se=t.useMemo(()=>{if(r!=null&&r.model)return r.model},[r]),Ce=t.useMemo(()=>{if(r!=null&&r.customModelPath)return Re(`/api/custom-models/${r.id}`)},[r]),ke=r==null?void 0:r.modelScale,Me=t.useMemo(()=>r?"scout":d==="boss"?"architect":d,[d,r]);t.useEffect(()=>{if(!p||!N)return;const e=S.getState().areas.get(N);if(e!=null&&e.directories&&e.directories.length>0){U(e.directories[0]);return}const a=Array.from(S.getState().agents.values()).filter(x=>{var y;return((y=S.getAreaForAgent(x.id))==null?void 0:y.id)===N&&x.cwd});if(a.length===0)return;const l=new Map;for(const x of a)l.set(x.cwd,(l.get(x.cwd)||0)+1);let i="",j=0;for(const[x,y]of l)y>j&&(i=x,j=y);i&&U(i)},[p,N]);const te=t.useMemo(()=>Array.from(H.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),[H]),ie=t.useMemo(()=>{if(!h.trim())return o;const e=h.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,h]),ce=t.useMemo(()=>{if(!h.trim())return W;const e=h.toLowerCase();return W.filter(a=>{const l=de[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[h]),oe=t.useMemo(()=>{if(!h.trim())return!0;const e=h.toLowerCase(),a=P.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[h]);t.useEffect(()=>{if(p&&!G.current){G.current=!0;const e=new Set(Array.from(S.getState().agents.values()).map(l=>l.name)),a=o.find(l=>l.id===d);if(a){const l=C.filter(i=>!e.has(`${a.name} ${i}`));if(l.length===0){const i=C[Math.floor(Math.random()*C.length)];m(`${a.name} ${i}-${Date.now()%1e3}`)}else m(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else m(pe(e));B(new Set),O.current&&(O.current.focus(),O.current.select())}else p||(G.current=!1)},[p]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===d);if(e)if(u.startsWith("Boss ")){const a=u.substring(5);m(`${e.name} ${a}`)}else{const a=o.find(l=>u.startsWith(l.name+" "));if(a){const l=u.substring(a.name.length+1);m(`${e.name} ${l}`)}else m(`${e.name} ${u}`)}else{const a=o.find(l=>u.startsWith(l.name+" "));if(a){const l=u.substring(a.name.length+1);m(`Boss ${l}`)}else u.startsWith("Boss ")||m(`Boss ${u}`)}},[d]);const ye=()=>{if(D(!1),!I.trim()){D(!0);return}if(!u.trim()){const l=new Set(Array.from(S.getState().agents.values()).map(i=>i.name));m(pe(l));return}ze(q.LAST_CWD,I),$(),window.__spawnModalAreaContext=N?{areaId:N}:null;const e=ae.trim()||void 0,a=Array.from(se);S.spawnBossAgent(u.trim(),d,I.trim(),ue||void 0,Array.from(M),c==="claude"?Y:!1,Q,c,c==="codex"?f:void 0,c==="codex"?ee:void 0,c==="claude"?Z:void 0,e,a),m(""),B(new Set),z(new Set),F(),w()},Ae=()=>{V(!1),m(""),B(new Set),F(),w()},Ee=()=>{V(!1),D(!0),F()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Ae,window.__bossSpawnModalError=Ee,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[u]);const $e=e=>{e.target===e.currentTarget&&w()},Le=e=>{e.key==="Escape"&&w()},Ie=e=>{const a=new Set(M);a.has(e)?a.delete(e):a.add(e),B(a)};if(!p)return null;const _e=P.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:$e,onKeyDown:Le,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(A,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Te,{agentClass:Me,modelFile:Se,customModelUrl:Ce,modelScale:ke,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+W.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:h,onChange:e=>be(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[ie.map(e=>s.jsxs("button",{className:`class-chip ${d===e.id?"selected":""}`,onClick:()=>_(e.id),title:e.description,children:[s.jsx(A,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),oe&&s.jsxs("button",{className:`class-chip ${d==="boss"?"selected":""}`,onClick:()=>_("boss"),title:_e.description,children:[s.jsx(A,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),ce.map(e=>{const a=de[e.id];return a?s.jsxs("button",{className:`class-chip ${d===e.id?"selected":""}`,onClick:()=>_(e.id),title:a.description,children:[s.jsx(A,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),h&&ie.length===0&&!oe&&ce.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:h})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:O,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:u,onChange:e=>m(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Fe,{value:I,onChange:e=>{U(e),D(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:me,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${c==="claude"?"selected":""}`,onClick:()=>k("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${c==="codex"?"selected":""}`,onClick:()=>k("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${c==="opencode"?"selected":""}`,onClick:()=>k("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:s.jsx(R,{name:"status-pending",size:14,weight:"fill",color:"#4ade80"})}),s.jsx("span",{children:"OpenCode"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--grok ${c==="grok"?"selected":""}`,onClick:()=>k("grok"),title:"Use Grok CLI (headless)",children:[s.jsx("img",{src:"/assets/grok.png",alt:"Grok",className:"spawn-provider-icon"}),s.jsx("span",{children:"Grok"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--pi ${c==="pi"?"selected":""}`,onClick:()=>k("pi"),title:"Use Pi coding agent CLI (multi-provider)",children:[s.jsx("img",{src:"/assets/pi.svg",alt:"Pi",className:"spawn-provider-icon"}),s.jsx("span",{children:"Pi"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(K).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Q===e?"selected":""}`,onClick:()=>we(e),title:K[e].description,children:[s.jsx("span",{children:s.jsx(R,{name:e==="bypass"?"bolt":"lock",size:14})}),s.jsx("span",{children:K[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),c==="claude"?s.jsx("div",{className:"spawn-select-row spawn-select-row--wrap",children:Object.keys(E).filter(e=>!E[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${Z===e?"selected":""}`,onClick:()=>xe(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):c==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(T).map(e=>s.jsxs("button",{className:`spawn-select-btn ${ee===e?"selected":""}`,onClick:()=>fe(e),title:T[e].description,children:[s.jsx("span",{children:T[e].icon}),s.jsx("span",{children:T[e].label})]},e))}):c==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):c==="grok"?s.jsx("div",{className:"spawn-inline-hint",children:Ue}):c==="pi"?s.jsx("div",{className:"spawn-inline-hint",children:"pi default (configure via agent edit)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:Y,onChange:e=>he(e.target.checked),disabled:c!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),c==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:f.fullAuto!==!1,onChange:e=>g(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!f.search,onChange:e=>g(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.sandbox||"workspace-write",onChange:e=>g(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:f.approvalMode||"on-request",onChange:e=>g(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:f.profile||"",onChange:e=>g(a=>({...a,profile:e.target.value||void 0}))}),s.jsxs("select",{className:"spawn-input",value:f.reasoningEffort||"",onChange:e=>g(a=>({...a,reasoningEffort:e.target.value||void 0})),children:[s.jsx("option",{value:"",children:n("terminal:spawn.codex.reasoningEffortDefault")}),Object.keys(J).map(e=>s.jsxs("option",{value:e,children:[J[e].icon," ",n("terminal:spawn.codex.reasoningEffort"),": ",J[e].label]},e))]})]})]})}),b.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),b.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:v,onChange:e=>je(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[le.map(e=>{const a=se.has(e.id);return ge.some(i=>i.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>ve(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:s.jsx(R,{name:"check",size:12})}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),v&&le.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:v})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:ae,onChange:e=>Ne(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:te.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):te.map(e=>{const a=M.has(e.id),l=P[e.class],i=o.find(x=>x.id===e.class),j=l||i||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Ie(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:s.jsx(R,{name:"check",size:12})}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:j.color},children:s.jsx(A,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),M.size>0&&s.jsxs("div",{className:"subordinates-count",children:[M.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:w,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:ye,disabled:X,children:n(X?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{He as BossSpawnModal};
@@ -1 +1 @@
1
- import{u as K,Q,z as J,R as W,T as ee,r as u,U as se,g as te,V as D,W as A,X as ae,j as e,Y as ne,Z as re,s as g,_ as R,$ as V}from"./main-Dk3qq80S.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const G={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},le={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},U={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},oe={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function pe({isOpen:s,onClose:r}){const{t:a}=K(["terminal","common"]),l=Q(),o=J(),h=W(),N=ee(),[x,C]=u.useState("keyboard"),[b,v]=u.useState(""),[p,j]=u.useState("all"),[m,f]=u.useState(!1),[c,d]=u.useState(null),[k,w]=u.useState(null),Y=se.useRef(null),{handleMouseDown:X,handleClick:Z}=te(r);if(u.useEffect(()=>{if(!s||m)return;const t=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),r())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,r,m]),u.useEffect(()=>{s||(v(""),f(!1),d(null))},[s]),u.useEffect(()=>{if(!s||!m)return;const t=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),f(!1),d(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let i=n.key;n.code.startsWith("Key")&&n.code.length===4?i=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?i=n.code.charAt(5):n.code==="Space"&&(i="Space"),d({key:i,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,m]),!s)return null;const F=l.filter(t=>{const n=a(`terminal:controls.shortcuts.${t.id}.name`,{defaultValue:t.name}),i=a(`terminal:controls.shortcuts.${t.id}.description`,{defaultValue:t.description});if(m&&c){const z=S=>S===" "||S==="Space"?"Space":S.length===1?S.toLowerCase():S,B=z(t.key),L=z(c.key);if(!(L.length===1&&/^[a-zA-Z]$/.test(B)?`Key${B.toUpperCase()}`==`Key${L.toUpperCase()}`:B===L))return!1;const M=t.modifiers,T=c.modifiers;return(M.ctrl||!1)===(T.ctrl||!1)&&(M.alt||!1)===(T.alt||!1)&&(M.shift||!1)===(T.shift||!1)&&(M.meta||!1)===(T.meta||!1)}if(!b)return!0;const y=b.toLowerCase();return n.toLowerCase().includes(y)||i.toLowerCase().includes(y)||D(t).toLowerCase().includes(y)}),E=Array.from(o.values()).map(t=>t).filter(t=>t.shortcut&&t.shortcut.trim().length>0).filter(t=>{const n=A(t.shortcut).toLowerCase();if(m&&c){const y={key:c.key,code:c.key.length===1&&/^[a-zA-Z]$/.test(c.key)?`Key${c.key.toUpperCase()}`:c.key.length===1&&/^[0-9]$/.test(c.key)?`Digit${c.key}`:c.key==="Space"?"Space":c.key,ctrlKey:!!c.modifiers.ctrl,altKey:!!c.modifiers.alt,shiftKey:!!c.modifiers.shift,metaKey:!!c.modifiers.meta};return ae(y,t.shortcut)}if(!b)return!0;const i=b.toLowerCase();return t.name.toLowerCase().includes(i)||n.toLowerCase().includes(i)}),P=F.reduce((t,n)=>(t[n.context]||(t[n.context]=[]),t[n.context].push(n),t),{}),_=(t,n)=>{g.updateShortcut(t,n)},$=()=>{w(x)},I=()=>{k==="keyboard"?g.resetShortcuts():(k==="mouse"||k==="trackpad")&&g.resetMouseControls()},q=k==="keyboard"?"terminal:controls.confirmResetKeyboard":k==="mouse"?"terminal:controls.confirmResetMouse":"terminal:controls.confirmResetTrackpad",O=["global","commander","toolbox"],H=h.bindings.reduce((t,n)=>(U.camera.includes(n.action)?t.camera.push(n):U.interaction.includes(n.action)&&t.interaction.push(n),t),{camera:[],interaction:[]});return e.jsxs("div",{className:"shortcuts-modal-overlay",onMouseDown:X,onClick:Z,children:[e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:a("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:r,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${x==="keyboard"?"active":""}`,onClick:()=>C("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),a("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${x==="mouse"?"active":""}`,onClick:()=>C("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),a("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${x==="trackpad"?"active":""}`,onClick:()=>C("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a("terminal:controls.trackpad")]})]}),x==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[m?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[D({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>d(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:a("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:Y,type:"text",placeholder:a("terminal:controls.searchShortcuts"),value:b,onChange:t=>v(t.target.value),autoFocus:!0}),b&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${m?"active":""}`,onClick:()=>{f(!m),d(null),v("")},title:a(m?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${p==="all"?"active":""}`,onClick:()=>j("all"),children:[a("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:F.length})]}),O.map(t=>{var i;const n=((i=P[t])==null?void 0:i.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${p===t?"active":""}`,onClick:()=>j(t),children:[a(G[t]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},t)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[O.map(t=>{const n=P[t]||[];return n.length===0||p!=="all"&&p!==t?null:e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a(G[t])}),e.jsx("span",{className:"shortcuts-context-description",children:a(le[t])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:a(`terminal:controls.shortcuts.${i.id}.name`,{defaultValue:i.name})}),e.jsx("span",{className:"shortcut-item-description",children:a(`terminal:controls.shortcuts.${i.id}.description`,{defaultValue:i.description})})]}),e.jsx(ne,{shortcut:i,onUpdate:y=>_(i.id,y)})]},i.id))})]},t)}),F.length===0&&E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:m?c?e.jsx("p",{children:a("terminal:controls.noShortcutBoundTo",{keys:D({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:a("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:a("terminal:controls.noShortcutsFound",{query:b})})}),E.length>0&&(p==="all"||p==="global")&&e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:"Agent Terminal Shortcuts"}),e.jsx("span",{className:"shortcuts-context-description",children:"Per-agent global shortcuts that open the guake terminal"})]}),e.jsx("div",{className:"shortcuts-grid",children:E.map(t=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:t.name}),e.jsx("span",{className:"shortcut-item-description",children:"Open terminal for this agent"})]}),e.jsx("div",{className:"key-capture-container",children:e.jsx("button",{className:"key-capture-input disabled",disabled:!0,children:e.jsx("span",{className:"key-capture-value",children:A(t.shortcut)})})})]},t.id))})]})]})]}),x==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(H).map(([t,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:a(oe[t])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsx(ce,{binding:i},i.id))})]},t))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustCameraSpeed")})]}),e.jsx(ie,{sensitivity:h.sensitivity})]})]})]}),x==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(de,{config:N})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:a(x==="keyboard"?m?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":x==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]}),e.jsx(re,{isOpen:k!==null,title:a("common:buttons.resetToDefaults"),message:a(q),confirmLabel:a("common:buttons.reset"),cancelLabel:a("common:buttons.cancel"),variant:"danger",onConfirm:I,onClose:()=>w(null)})]})}function ce({binding:s}){const{t:r}=K(["terminal"]),a=W(),[l,o]=u.useState(!1),[h,N]=u.useState(null);u.useEffect(()=>{if(!l)return;const j=d=>{d.preventDefault(),d.stopPropagation();const w={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[d.button];w&&N({button:w,modifiers:{ctrl:d.ctrlKey,alt:d.altKey,shift:d.shiftKey,meta:d.metaKey}})},m=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),o(!1),N(null))},f=()=>{h&&R(a.bindings,h,s.id).length===0&&g.updateMouseBinding(s.id,{button:h.button,modifiers:h.modifiers}),o(!1),N(null)},c=setTimeout(()=>{document.addEventListener("mousedown",j,!0),document.addEventListener("keydown",m,!0),document.addEventListener("click",f,!0)},100);return()=>{clearTimeout(c),document.removeEventListener("mousedown",j,!0),document.removeEventListener("keydown",m,!0),document.removeEventListener("click",f,!0)}},[l,h,s.id,a.bindings]);const x=h?R(a.bindings,h,s.id):[],C=r(`terminal:controls.mouseBindings.${s.id}.name`,{defaultValue:s.name}),b=r(`terminal:controls.mouseBindings.${s.id}.description`,{defaultValue:s.description}),v=j=>r(`terminal:controls.mouseButtons.${j}`,{defaultValue:j}),p=h?V({...s,...h},v):V(s,v);return e.jsxs("div",{className:`shortcut-item ${s.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:C}),e.jsx("span",{className:"shortcut-item-description",children:b})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${l?"capturing":""} ${x.length>0?"conflict":""}`,onClick:()=>o(!0),children:l?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:p}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:r("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:p})}),x.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[r("terminal:controls.conflicts"),": ",x.map(j=>r(`terminal:controls.mouseBindings.${j.id}.name`,{defaultValue:j.name})).join(", ")]})]})]})}function ie({sensitivity:s}){const{t:r}=K(["terminal"]),a=u.useCallback((l,o)=>{g.updateCameraSensitivity({[l]:o})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.panSpeed,onChange:l=>a("panSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.orbitSpeed,onChange:l=>a("orbitSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.zoomSpeed,onChange:l=>a("zoomSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.smoothing,onChange:l=>a("smoothing",parseFloat(l.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:s.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanX,onChange:l=>a("invertPanX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanY,onChange:l=>a("invertPanY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitX,onChange:l=>a("invertOrbitX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitY,onChange:l=>a("invertOrbitY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitY")})]})]})]})}function de({config:s}){const{t:r}=K(["terminal"]),a=u.useCallback((o,h)=>{g.updateTrackpadConfig({[o]:h})},[]),l=u.useCallback((o,h)=>{g.updateTrackpadConfig({sensitivity:{[o]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:o=>a("enabled",o.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:r("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.pinchToZoom,onChange:o=>a("pinchToZoom",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.twoFingerPan,onChange:o=>a("twoFingerPan",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.shiftTwoFingerOrbit,onChange:o=>a("shiftTwoFingerOrbit",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.zoom,onChange:o=>l("zoom",parseFloat(o.target.value)),disabled:!s.enabled||!s.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.pan,onChange:o=>l("pan",parseFloat(o.target.value)),disabled:!s.enabled||!s.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.orbit,onChange:o=>l("orbit",parseFloat(o.target.value)),disabled:!s.enabled||!s.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{pe as ControlsModal};
1
+ import{u as K,Q,z as J,R as W,T as ee,r as u,U as se,g as te,V as D,W as A,X as ae,j as e,Y as ne,Z as re,s as g,_ as R,$ as V}from"./main-BTH4eRQ6.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const G={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},le={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},U={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},oe={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function pe({isOpen:s,onClose:r}){const{t:a}=K(["terminal","common"]),l=Q(),o=J(),h=W(),N=ee(),[x,C]=u.useState("keyboard"),[b,v]=u.useState(""),[p,j]=u.useState("all"),[m,f]=u.useState(!1),[c,d]=u.useState(null),[k,w]=u.useState(null),Y=se.useRef(null),{handleMouseDown:X,handleClick:Z}=te(r);if(u.useEffect(()=>{if(!s||m)return;const t=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),r())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,r,m]),u.useEffect(()=>{s||(v(""),f(!1),d(null))},[s]),u.useEffect(()=>{if(!s||!m)return;const t=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),f(!1),d(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let i=n.key;n.code.startsWith("Key")&&n.code.length===4?i=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?i=n.code.charAt(5):n.code==="Space"&&(i="Space"),d({key:i,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,m]),!s)return null;const F=l.filter(t=>{const n=a(`terminal:controls.shortcuts.${t.id}.name`,{defaultValue:t.name}),i=a(`terminal:controls.shortcuts.${t.id}.description`,{defaultValue:t.description});if(m&&c){const z=S=>S===" "||S==="Space"?"Space":S.length===1?S.toLowerCase():S,B=z(t.key),L=z(c.key);if(!(L.length===1&&/^[a-zA-Z]$/.test(B)?`Key${B.toUpperCase()}`==`Key${L.toUpperCase()}`:B===L))return!1;const M=t.modifiers,T=c.modifiers;return(M.ctrl||!1)===(T.ctrl||!1)&&(M.alt||!1)===(T.alt||!1)&&(M.shift||!1)===(T.shift||!1)&&(M.meta||!1)===(T.meta||!1)}if(!b)return!0;const y=b.toLowerCase();return n.toLowerCase().includes(y)||i.toLowerCase().includes(y)||D(t).toLowerCase().includes(y)}),E=Array.from(o.values()).map(t=>t).filter(t=>t.shortcut&&t.shortcut.trim().length>0).filter(t=>{const n=A(t.shortcut).toLowerCase();if(m&&c){const y={key:c.key,code:c.key.length===1&&/^[a-zA-Z]$/.test(c.key)?`Key${c.key.toUpperCase()}`:c.key.length===1&&/^[0-9]$/.test(c.key)?`Digit${c.key}`:c.key==="Space"?"Space":c.key,ctrlKey:!!c.modifiers.ctrl,altKey:!!c.modifiers.alt,shiftKey:!!c.modifiers.shift,metaKey:!!c.modifiers.meta};return ae(y,t.shortcut)}if(!b)return!0;const i=b.toLowerCase();return t.name.toLowerCase().includes(i)||n.toLowerCase().includes(i)}),P=F.reduce((t,n)=>(t[n.context]||(t[n.context]=[]),t[n.context].push(n),t),{}),_=(t,n)=>{g.updateShortcut(t,n)},$=()=>{w(x)},I=()=>{k==="keyboard"?g.resetShortcuts():(k==="mouse"||k==="trackpad")&&g.resetMouseControls()},q=k==="keyboard"?"terminal:controls.confirmResetKeyboard":k==="mouse"?"terminal:controls.confirmResetMouse":"terminal:controls.confirmResetTrackpad",O=["global","commander","toolbox"],H=h.bindings.reduce((t,n)=>(U.camera.includes(n.action)?t.camera.push(n):U.interaction.includes(n.action)&&t.interaction.push(n),t),{camera:[],interaction:[]});return e.jsxs("div",{className:"shortcuts-modal-overlay",onMouseDown:X,onClick:Z,children:[e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:a("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:r,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${x==="keyboard"?"active":""}`,onClick:()=>C("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),a("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${x==="mouse"?"active":""}`,onClick:()=>C("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),a("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${x==="trackpad"?"active":""}`,onClick:()=>C("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a("terminal:controls.trackpad")]})]}),x==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[m?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[D({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>d(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:a("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:Y,type:"text",placeholder:a("terminal:controls.searchShortcuts"),value:b,onChange:t=>v(t.target.value),autoFocus:!0}),b&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${m?"active":""}`,onClick:()=>{f(!m),d(null),v("")},title:a(m?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${p==="all"?"active":""}`,onClick:()=>j("all"),children:[a("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:F.length})]}),O.map(t=>{var i;const n=((i=P[t])==null?void 0:i.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${p===t?"active":""}`,onClick:()=>j(t),children:[a(G[t]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},t)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[O.map(t=>{const n=P[t]||[];return n.length===0||p!=="all"&&p!==t?null:e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a(G[t])}),e.jsx("span",{className:"shortcuts-context-description",children:a(le[t])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:a(`terminal:controls.shortcuts.${i.id}.name`,{defaultValue:i.name})}),e.jsx("span",{className:"shortcut-item-description",children:a(`terminal:controls.shortcuts.${i.id}.description`,{defaultValue:i.description})})]}),e.jsx(ne,{shortcut:i,onUpdate:y=>_(i.id,y)})]},i.id))})]},t)}),F.length===0&&E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:m?c?e.jsx("p",{children:a("terminal:controls.noShortcutBoundTo",{keys:D({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:a("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:a("terminal:controls.noShortcutsFound",{query:b})})}),E.length>0&&(p==="all"||p==="global")&&e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:"Agent Terminal Shortcuts"}),e.jsx("span",{className:"shortcuts-context-description",children:"Per-agent global shortcuts that open the guake terminal"})]}),e.jsx("div",{className:"shortcuts-grid",children:E.map(t=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:t.name}),e.jsx("span",{className:"shortcut-item-description",children:"Open terminal for this agent"})]}),e.jsx("div",{className:"key-capture-container",children:e.jsx("button",{className:"key-capture-input disabled",disabled:!0,children:e.jsx("span",{className:"key-capture-value",children:A(t.shortcut)})})})]},t.id))})]})]})]}),x==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(H).map(([t,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:a(oe[t])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsx(ce,{binding:i},i.id))})]},t))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustCameraSpeed")})]}),e.jsx(ie,{sensitivity:h.sensitivity})]})]})]}),x==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:$,children:a("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(de,{config:N})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:a(x==="keyboard"?m?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":x==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]}),e.jsx(re,{isOpen:k!==null,title:a("common:buttons.resetToDefaults"),message:a(q),confirmLabel:a("common:buttons.reset"),cancelLabel:a("common:buttons.cancel"),variant:"danger",onConfirm:I,onClose:()=>w(null)})]})}function ce({binding:s}){const{t:r}=K(["terminal"]),a=W(),[l,o]=u.useState(!1),[h,N]=u.useState(null);u.useEffect(()=>{if(!l)return;const j=d=>{d.preventDefault(),d.stopPropagation();const w={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[d.button];w&&N({button:w,modifiers:{ctrl:d.ctrlKey,alt:d.altKey,shift:d.shiftKey,meta:d.metaKey}})},m=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),o(!1),N(null))},f=()=>{h&&R(a.bindings,h,s.id).length===0&&g.updateMouseBinding(s.id,{button:h.button,modifiers:h.modifiers}),o(!1),N(null)},c=setTimeout(()=>{document.addEventListener("mousedown",j,!0),document.addEventListener("keydown",m,!0),document.addEventListener("click",f,!0)},100);return()=>{clearTimeout(c),document.removeEventListener("mousedown",j,!0),document.removeEventListener("keydown",m,!0),document.removeEventListener("click",f,!0)}},[l,h,s.id,a.bindings]);const x=h?R(a.bindings,h,s.id):[],C=r(`terminal:controls.mouseBindings.${s.id}.name`,{defaultValue:s.name}),b=r(`terminal:controls.mouseBindings.${s.id}.description`,{defaultValue:s.description}),v=j=>r(`terminal:controls.mouseButtons.${j}`,{defaultValue:j}),p=h?V({...s,...h},v):V(s,v);return e.jsxs("div",{className:`shortcut-item ${s.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:C}),e.jsx("span",{className:"shortcut-item-description",children:b})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${l?"capturing":""} ${x.length>0?"conflict":""}`,onClick:()=>o(!0),children:l?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:p}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:r("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:p})}),x.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[r("terminal:controls.conflicts"),": ",x.map(j=>r(`terminal:controls.mouseBindings.${j.id}.name`,{defaultValue:j.name})).join(", ")]})]})]})}function ie({sensitivity:s}){const{t:r}=K(["terminal"]),a=u.useCallback((l,o)=>{g.updateCameraSensitivity({[l]:o})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.panSpeed,onChange:l=>a("panSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.orbitSpeed,onChange:l=>a("orbitSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.zoomSpeed,onChange:l=>a("zoomSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.smoothing,onChange:l=>a("smoothing",parseFloat(l.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:s.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanX,onChange:l=>a("invertPanX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanY,onChange:l=>a("invertPanY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitX,onChange:l=>a("invertOrbitX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitY,onChange:l=>a("invertOrbitY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitY")})]})]})]})}function de({config:s}){const{t:r}=K(["terminal"]),a=u.useCallback((o,h)=>{g.updateTrackpadConfig({[o]:h})},[]),l=u.useCallback((o,h)=>{g.updateTrackpadConfig({sensitivity:{[o]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:o=>a("enabled",o.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:r("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.pinchToZoom,onChange:o=>a("pinchToZoom",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.twoFingerPan,onChange:o=>a("twoFingerPan",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.shiftTwoFingerOrbit,onChange:o=>a("shiftTwoFingerOrbit",o.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.zoom,onChange:o=>l("zoom",parseFloat(o.target.value)),disabled:!s.enabled||!s.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.pan,onChange:o=>l("pan",parseFloat(o.target.value)),disabled:!s.enabled||!s.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.orbit,onChange:o=>l("orbit",parseFloat(o.target.value)),disabled:!s.enabled||!s.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{pe as ControlsModal};
@@ -1,2 +1,2 @@
1
- import{u as f,a as u,b as S,r as n,s as o,j as x}from"./main-Dk3qq80S.js";import{L as k}from"./LogViewerModal-CitlmDgQ.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function I({building:e,isOpen:t,onClose:i,onMinimize:m}){var a;const{t:c}=f(["terminal"]),g=u(),d=S(),r=g.get(e.id)||"",l=d.has(e.id);n.useEffect(()=>{var s;return t&&((s=e.docker)!=null&&s.enabled)&&o.startLogStreaming(e.id,200),()=>{e.id&&o.stopLogStreaming(e.id)}},[t,e.id,(a=e.docker)==null?void 0:a.enabled]);const L=n.useMemo(()=>r.split(`
1
+ import{u as f,a as u,b as S,r as n,s as o,j as x}from"./main-BTH4eRQ6.js";import{L as k}from"./LogViewerModal-DmH5JCwc.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function I({building:e,isOpen:t,onClose:i,onMinimize:m}){var a;const{t:c}=f(["terminal"]),g=u(),d=S(),r=g.get(e.id)||"",l=d.has(e.id);n.useEffect(()=>{var s;return t&&((s=e.docker)!=null&&s.enabled)&&o.startLogStreaming(e.id,200),()=>{e.id&&o.stopLogStreaming(e.id)}},[t,e.id,(a=e.docker)==null?void 0:a.enabled]);const L=n.useMemo(()=>r.split(`
2
2
  `).map((s,p)=>({text:s,lineNumber:p+1})),[r]);return x.jsx(k,{isOpen:t,onClose:i,onMinimize:m,title:`${e.name} - ${c("terminal:logs.dockerLogs")}`,icon:"🐳",lines:L,isStreaming:l,onClear:()=>o.clearStreamingLogs(e.id)})}export{I as DockerLogsModal};
@@ -1,4 +1,4 @@
1
- import{r as ot,j as Tt}from"./main-Dk3qq80S.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";let Hs=[],gQ=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,O=0;e<t.length;e++)(e%2?gQ:Hs).push(O=O+t[e])})();function bX(t){if(t<768)return!1;for(let e=0,O=Hs.length;;){let i=e+O>>1;if(t<Hs[i])O=i;else if(t>=gQ[i])e=i+1;else return!0;if(e==O)return!1}}function Ju(t){return t>=127462&&t<=127487}const ef=8205;function yX(t,e,O=!0,i=!0){return(O?mQ:kX)(t,e,i)}function mQ(t,e,O){if(e==t.length)return e;e&&PQ(t.charCodeAt(e))&&SQ(t.charCodeAt(e-1))&&e--;let i=Zo(t,e);for(e+=tf(i);e<t.length;){let n=Zo(t,e);if(i==ef||n==ef||O&&bX(n))e+=tf(n),i=n;else if(Ju(n)){let r=0,a=e-2;for(;a>=0&&Ju(Zo(t,a));)r++,a-=2;if(r%2==0)break;e+=2}else break}return e}function kX(t,e,O){for(;e>0;){let i=mQ(t,e-2,O);if(i<e)return i;e--}return 0}function Zo(t,e){let O=t.charCodeAt(e);if(!SQ(O)||e+1==t.length)return O;let i=t.charCodeAt(e+1);return PQ(i)?(O-55296<<10)+(i-56320)+65536:O}function PQ(t){return t>=56320&&t<57344}function SQ(t){return t>=55296&&t<56320}function tf(t){return t<65536?1:2}class Oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,O,i){[e,O]=zi(this,e,O);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(O,this.length,n,1),qt.from(n,this.length-(O-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,O=this.length){[e,O]=zi(this,e,O);let i=[];return this.decompose(e,O,i,0),qt.from(i,O-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let O=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new mn(this),r=new mn(e);for(let a=O,o=O;;){if(n.next(a),r.next(a),a=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new mn(this,e)}iterRange(e,O=this.length){return new XQ(this,e,O)}iterLines(e,O){let i;if(e==null)i=this.iter();else{O==null&&(O=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,O==this.lines+1?this.length:O<=1?0:this.line(O-1).to))}return new bQ(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Oe.empty:e.length<=32?new ge(e):qt.from(ge.split(e,[]))}}class ge extends Oe{constructor(e,O=wX(e)){super(),this.text=e,this.length=O}get lines(){return this.text.length}get children(){return null}lineInner(e,O,i,n){for(let r=0;;r++){let a=this.text[r],o=n+a.length;if((O?i:o)>=e)return new TX(n,o,i,a);n=o+1,i++}}decompose(e,O,i,n){let r=e<=0&&O>=this.length?this:new ge(Of(this.text,e,O),Math.min(O,this.length)-Math.max(0,e));if(n&1){let a=i.pop(),o=Nr(r.text,a.text.slice(),0,r.length);if(o.length<=32)i.push(new ge(o,a.length+r.length));else{let s=o.length>>1;i.push(new ge(o.slice(0,s)),new ge(o.slice(s)))}}else i.push(r)}replace(e,O,i){if(!(i instanceof ge))return super.replace(e,O,i);[e,O]=zi(this,e,O);let n=Nr(this.text,Nr(i.text,Of(this.text,0,e)),O),r=this.length+i.length-(O-e);return n.length<=32?new ge(n,r):qt.from(ge.split(n,[]),r)}sliceString(e,O=this.length,i=`
1
+ import{r as ot,j as Tt}from"./main-BTH4eRQ6.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";let Hs=[],gQ=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,O=0;e<t.length;e++)(e%2?gQ:Hs).push(O=O+t[e])})();function bX(t){if(t<768)return!1;for(let e=0,O=Hs.length;;){let i=e+O>>1;if(t<Hs[i])O=i;else if(t>=gQ[i])e=i+1;else return!0;if(e==O)return!1}}function Ju(t){return t>=127462&&t<=127487}const ef=8205;function yX(t,e,O=!0,i=!0){return(O?mQ:kX)(t,e,i)}function mQ(t,e,O){if(e==t.length)return e;e&&PQ(t.charCodeAt(e))&&SQ(t.charCodeAt(e-1))&&e--;let i=Zo(t,e);for(e+=tf(i);e<t.length;){let n=Zo(t,e);if(i==ef||n==ef||O&&bX(n))e+=tf(n),i=n;else if(Ju(n)){let r=0,a=e-2;for(;a>=0&&Ju(Zo(t,a));)r++,a-=2;if(r%2==0)break;e+=2}else break}return e}function kX(t,e,O){for(;e>0;){let i=mQ(t,e-2,O);if(i<e)return i;e--}return 0}function Zo(t,e){let O=t.charCodeAt(e);if(!SQ(O)||e+1==t.length)return O;let i=t.charCodeAt(e+1);return PQ(i)?(O-55296<<10)+(i-56320)+65536:O}function PQ(t){return t>=56320&&t<57344}function SQ(t){return t>=55296&&t<56320}function tf(t){return t<65536?1:2}class Oe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,O,i){[e,O]=zi(this,e,O);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(O,this.length,n,1),qt.from(n,this.length-(O-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,O=this.length){[e,O]=zi(this,e,O);let i=[];return this.decompose(e,O,i,0),qt.from(i,O-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let O=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new mn(this),r=new mn(e);for(let a=O,o=O;;){if(n.next(a),r.next(a),a=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new mn(this,e)}iterRange(e,O=this.length){return new XQ(this,e,O)}iterLines(e,O){let i;if(e==null)i=this.iter();else{O==null&&(O=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,O==this.lines+1?this.length:O<=1?0:this.line(O-1).to))}return new bQ(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Oe.empty:e.length<=32?new ge(e):qt.from(ge.split(e,[]))}}class ge extends Oe{constructor(e,O=wX(e)){super(),this.text=e,this.length=O}get lines(){return this.text.length}get children(){return null}lineInner(e,O,i,n){for(let r=0;;r++){let a=this.text[r],o=n+a.length;if((O?i:o)>=e)return new TX(n,o,i,a);n=o+1,i++}}decompose(e,O,i,n){let r=e<=0&&O>=this.length?this:new ge(Of(this.text,e,O),Math.min(O,this.length)-Math.max(0,e));if(n&1){let a=i.pop(),o=Nr(r.text,a.text.slice(),0,r.length);if(o.length<=32)i.push(new ge(o,a.length+r.length));else{let s=o.length>>1;i.push(new ge(o.slice(0,s)),new ge(o.slice(s)))}}else i.push(r)}replace(e,O,i){if(!(i instanceof ge))return super.replace(e,O,i);[e,O]=zi(this,e,O);let n=Nr(this.text,Nr(i.text,Of(this.text,0,e)),O),r=this.length+i.length-(O-e);return n.length<=32?new ge(n,r):qt.from(ge.split(n,[]),r)}sliceString(e,O=this.length,i=`
2
2
  `){[e,O]=zi(this,e,O);let n="";for(let r=0,a=0;r<=O&&a<this.text.length;a++){let o=this.text[a],s=r+o.length;r>e&&a&&(n+=i),e<s&&O>r&&(n+=o.slice(Math.max(0,e-r),O-r)),r=s+1}return n}flatten(e){for(let O of this.text)e.push(O)}scanIdentical(){return 0}static split(e,O){let i=[],n=-1;for(let r of e)i.push(r),n+=r.length+1,i.length==32&&(O.push(new ge(i,n)),i=[],n=-1);return n>-1&&O.push(new ge(i,n)),O}}class qt extends Oe{constructor(e,O){super(),this.children=e,this.length=O,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,O,i,n){for(let r=0;;r++){let a=this.children[r],o=n+a.length,s=i+a.lines-1;if((O?s:o)>=e)return a.lineInner(e,O,i,n);n=o+1,i=s+1}}decompose(e,O,i,n){for(let r=0,a=0;a<=O&&r<this.children.length;r++){let o=this.children[r],s=a+o.length;if(e<=s&&O>=a){let l=n&((a<=e?1:0)|(s>=O?2:0));a>=e&&s<=O&&!l?i.push(o):o.decompose(e-a,O-a,i,l)}a=s+1}}replace(e,O,i){if([e,O]=zi(this,e,O),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let a=this.children[n],o=r+a.length;if(e>=r&&O<=o){let s=a.replace(e-r,O-r,i),l=this.lines-a.lines+s.lines;if(s.lines<l>>4&&s.lines>l>>6){let c=this.children.slice();return c[n]=s,new qt(c,this.length-(O-e)+i.length)}return super.replace(r,o,s)}r=o+1}return super.replace(e,O,i)}sliceString(e,O=this.length,i=`
3
3
  `){[e,O]=zi(this,e,O);let n="";for(let r=0,a=0;r<this.children.length&&a<=O;r++){let o=this.children[r],s=a+o.length;a>e&&r&&(n+=i),e<s&&O>a&&(n+=o.sliceString(e-a,O-a,i)),a=s+1}return n}flatten(e){for(let O of this.children)O.flatten(e)}scanIdentical(e,O){if(!(e instanceof qt))return 0;let i=0,[n,r,a,o]=O>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=O,r+=O){if(n==a||r==o)return i;let s=this.children[n],l=e.children[r];if(s!=l)return i+s.scanIdentical(l,O);i+=s.length+1}}static from(e,O=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let $ of e)$.flatten(d);return new ge(d,O)}let n=Math.max(32,i>>5),r=n<<1,a=n>>1,o=[],s=0,l=-1,c=[];function u(d){let $;if(d.lines>r&&d instanceof qt)for(let Q of d.children)u(Q);else d.lines>a&&(s>a||!s)?(f(),o.push(d)):d instanceof ge&&s&&($=c[c.length-1])instanceof ge&&d.lines+$.lines<=32?(s+=d.lines,l+=d.length+1,c[c.length-1]=new ge($.text.concat(d.text),$.length+1+d.length)):(s+d.lines>n&&f(),s+=d.lines,l+=d.length+1,c.push(d))}function f(){s!=0&&(o.push(c.length==1?c[0]:qt.from(c,l)),l=-1,s=c.length=0)}for(let d of e)u(d);return f(),o.length==1?o[0]:new qt(o,O)}}Oe.empty=new ge([""],0);function wX(t){let e=-1;for(let O of t)e+=O.length+1;return e}function Nr(t,e,O=0,i=1e9){for(let n=0,r=0,a=!0;r<t.length&&n<=i;r++){let o=t[r],s=n+o.length;s>=O&&(s>i&&(o=o.slice(0,i-n)),n<O&&(o=o.slice(O-n)),a?(e[e.length-1]+=o,a=!1):e.push(o)),n=s+1}return e}function Of(t,e,O){return Nr(t,[""],e,O)}class mn{constructor(e,O=1){this.dir=O,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[O>0?1:(e instanceof ge?e.text.length:e.children.length)<<1]}nextInner(e,O){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],a=r>>1,o=n instanceof ge?n.text.length:n.children.length;if(a==(O>0?o:0)){if(i==0)return this.done=!0,this.value="",this;O>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(O>0?0:1)){if(this.offsets[i]+=O,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(n instanceof ge){let s=n.text[a+(O<0?-1:0)];if(this.offsets[i]+=O,s.length>Math.max(0,e))return this.value=e==0?s:O>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{let s=n.children[a+(O<0?-1:0)];e>s.length?(e-=s.length,this.offsets[i]+=O):(O<0&&this.offsets[i]--,this.nodes.push(s),this.offsets.push(O>0?1:(s instanceof ge?s.text.length:s.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class XQ{constructor(e,O,i){this.value="",this.done=!1,this.cursor=new mn(e,O>i?-1:1),this.pos=O>i?e.length:0,this.from=Math.min(O,i),this.to=Math.max(O,i)}nextInner(e,O){if(O<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,O<0?this.pos-this.to:this.from-this.pos);let i=O<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*O,this.value=n.length<=i?n:O<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bQ{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:O,lineBreak:i,value:n}=this.inner.next(e);return O&&this.afterBreak?(this.value="",this.afterBreak=!1):O?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Oe.prototype[Symbol.iterator]=function(){return this.iter()},mn.prototype[Symbol.iterator]=XQ.prototype[Symbol.iterator]=bQ.prototype[Symbol.iterator]=function(){return this});let TX=class{constructor(e,O,i,n){this.from=e,this.to=O,this.number=i,this.text=n}get length(){return this.to-this.from}};function zi(t,e,O){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,O))]}function we(t,e,O=!0,i=!0){return yX(t,e,O,i)}function xX(t){return t>=56320&&t<57344}function vX(t){return t>=55296&&t<56320}function ci(t,e){let O=t.charCodeAt(e);if(!vX(O)||e+1==t.length)return O;let i=t.charCodeAt(e+1);return xX(i)?(O-55296<<10)+(i-56320)+65536:O}function yQ(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function er(t){return t<65536?1:2}const Ks=/\r\n?|\n/;var ze=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(ze||(ze={}));class Gt{constructor(e){this.sections=e}get length(){let e=0;for(let O=0;O<this.sections.length;O+=2)e+=this.sections[O];return e}get newLength(){let e=0;for(let O=0;O<this.sections.length;O+=2){let i=this.sections[O+1];e+=i<0?this.sections[O]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let O=0,i=0,n=0;O<this.sections.length;){let r=this.sections[O++],a=this.sections[O++];a<0?(e(i,n,r),n+=r):n+=a,i+=r}}iterChangedRanges(e,O=!1){Js(this,e,O)}get invertedDesc(){let e=[];for(let O=0;O<this.sections.length;){let i=this.sections[O++],n=this.sections[O++];n<0?e.push(i,n):e.push(n,i)}return new Gt(e)}composeDesc(e){return this.empty?e:e.empty?this:kQ(this,e)}mapDesc(e,O=!1){return e.empty?this:el(this,e,O)}mapPos(e,O=-1,i=ze.Simple){let n=0,r=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],l=n+o;if(s<0){if(l>e)return r+(e-n);r+=o}else{if(i!=ze.Simple&&l>=e&&(i==ze.TrackDel&&n<e&&l>e||i==ze.TrackBefore&&n<e||i==ze.TrackAfter&&l>e))return null;if(l>e||l==e&&O<0&&!o)return e==n||O<0?r:r+s;r+=s}n=l}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return r}touchesRange(e,O=e){for(let i=0,n=0;i<this.sections.length&&n<=O;){let r=this.sections[i++],a=this.sections[i++],o=n+r;if(a>=0&&n<=O&&o>=e)return n<e&&o>O?"cover":!0;n=o}return!1}toString(){let e="";for(let O=0;O<this.sections.length;){let i=this.sections[O++],n=this.sections[O++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(O=>typeof O!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Gt(e)}static create(e){return new Gt(e)}}class Xe extends Gt{constructor(e,O){super(e),this.inserted=O}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Js(this,(O,i,n,r,a)=>e=e.replace(n,n+(i-O),a),!1),e}mapDesc(e,O=!1){return el(this,e,O,!0)}invert(e){let O=this.sections.slice(),i=[];for(let n=0,r=0;n<O.length;n+=2){let a=O[n],o=O[n+1];if(o>=0){O[n]=o,O[n+1]=a;let s=n>>1;for(;i.length<s;)i.push(Oe.empty);i.push(a?e.slice(r,r+a):Oe.empty)}r+=a}return new Xe(O,i)}compose(e){return this.empty?e:e.empty?this:kQ(this,e,!0)}map(e,O=!1){return e.empty?this:el(this,e,O,!0)}iterChanges(e,O=!1){Js(this,e,O)}get desc(){return Gt.create(this.sections)}filter(e){let O=[],i=[],n=[],r=new Yn(this);e:for(let a=0,o=0;;){let s=a==e.length?1e9:e[a++];for(;o<s||o==s&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,s-o);Re(n,c,-1);let u=r.ins==-1?-1:r.off==0?r.ins:0;Re(O,c,u),u>0&&PO(i,O,r.text),r.forward(c),o+=c}let l=e[a++];for(;o<l;){if(r.done)break e;let c=Math.min(r.len,l-o);Re(O,c,-1),Re(n,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),o+=c}}return{changes:new Xe(O,i),filtered:Gt.create(n)}}toJSON(){let e=[];for(let O=0;O<this.sections.length;O+=2){let i=this.sections[O],n=this.sections[O+1];n<0?e.push(i):n==0?e.push([i]):e.push([i].concat(this.inserted[O>>1].toJSON()))}return e}static of(e,O,i){let n=[],r=[],a=0,o=null;function s(c=!1){if(!c&&!n.length)return;a<O&&Re(n,O-a,-1);let u=new Xe(n,r);o=o?o.compose(u.map(o)):u,n=[],r=[],a=0}function l(c){if(Array.isArray(c))for(let u of c)l(u);else if(c instanceof Xe){if(c.length!=O)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${O})`);s(),o=o?o.compose(c.map(o)):c}else{let{from:u,to:f=u,insert:d}=c;if(u>f||u<0||f>O)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${O})`);let $=d?typeof d=="string"?Oe.of(d.split(i||Ks)):d:Oe.empty,Q=$.length;if(u==f&&Q==0)return;u<a&&s(),u>a&&Re(n,u-a,-1),Re(n,f-u,Q),PO(r,n,$),a=f}}return l(e),s(!o),o}static empty(e){return new Xe(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let O=[],i=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r=="number")O.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((a,o)=>o&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)O.push(r[0],0);else{for(;i.length<n;)i.push(Oe.empty);i[n]=Oe.of(r.slice(1)),O.push(r[0],i[n].length)}}}return new Xe(O,i)}static createSet(e,O){return new Xe(e,O)}}function Re(t,e,O,i=!1){if(e==0&&O<=0)return;let n=t.length-2;n>=0&&O<=0&&O==t[n+1]?t[n]+=e:n>=0&&e==0&&t[n]==0?t[n+1]+=O:i?(t[n]+=e,t[n+1]+=O):t.push(e,O)}function PO(t,e,O){if(O.length==0)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(O);else{for(;t.length<i;)t.push(Oe.empty);t.push(O)}}function Js(t,e,O){let i=t.inserted;for(let n=0,r=0,a=0;a<t.sections.length;){let o=t.sections[a++],s=t.sections[a++];if(s<0)n+=o,r+=o;else{let l=n,c=r,u=Oe.empty;for(;l+=o,c+=s,s&&i&&(u=u.append(i[a-2>>1])),!(O||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],s=t.sections[a++];e(n,l,r,c,u),n=l,r=c}}}function el(t,e,O,i=!1){let n=[],r=i?[]:null,a=new Yn(t),o=new Yn(e);for(let s=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let l=Math.min(a.len,o.len);Re(n,l,-1),a.forward(l),o.forward(l)}else if(o.ins>=0&&(a.ins<0||s==a.i||a.off==0&&(o.len<a.len||o.len==a.len&&!O))){let l=o.len;for(Re(n,o.ins,-1);l;){let c=Math.min(a.len,l);a.ins>=0&&s<a.i&&a.len<=c&&(Re(n,0,a.ins),r&&PO(r,n,a.text),s=a.i),a.forward(c),l-=c}o.next()}else if(a.ins>=0){let l=0,c=a.len;for(;c;)if(o.ins==-1){let u=Math.min(c,o.len);l+=u,c-=u,o.forward(u)}else if(o.ins==0&&o.len<c)c-=o.len,o.next();else break;Re(n,l,s<a.i?a.ins:0),r&&s<a.i&&PO(r,n,a.text),s=a.i,a.forward(a.len-c)}else{if(a.done&&o.done)return r?Xe.createSet(n,r):Gt.create(n);throw new Error("Mismatched change set lengths")}}}function kQ(t,e,O=!1){let i=[],n=O?[]:null,r=new Yn(t),a=new Yn(e);for(let o=!1;;){if(r.done&&a.done)return n?Xe.createSet(i,n):Gt.create(i);if(r.ins==0)Re(i,r.len,0,o),r.next();else if(a.len==0&&!a.done)Re(i,0,a.ins,o),n&&PO(n,i,a.text),a.next();else{if(r.done||a.done)throw new Error("Mismatched change set lengths");{let s=Math.min(r.len2,a.len),l=i.length;if(r.ins==-1){let c=a.ins==-1?-1:a.off?0:a.ins;Re(i,s,c,o),n&&c&&PO(n,i,a.text)}else a.ins==-1?(Re(i,r.off?0:r.len,s,o),n&&PO(n,i,r.textBit(s))):(Re(i,r.off?0:r.len,a.off?0:a.ins,o),n&&!a.off&&PO(n,i,a.text));o=(r.ins>s||a.ins>=0&&a.len>s)&&(o||i.length>l),r.forward2(s),a.forward(s)}}}}class Yn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,O=this.i-2>>1;return O>=e.length?Oe.empty:e[O]}textBit(e){let{inserted:O}=this.set,i=this.i-2>>1;return i>=O.length&&!e?Oe.empty:O[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class DO{constructor(e,O,i){this.from=e,this.to=O,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,O=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,O):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new DO(i,n,this.flags)}extend(e,O=e,i=0){if(e<=this.anchor&&O>=this.anchor)return y.range(e,O,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(O-this.anchor)?e:O;return y.range(this.anchor,n,void 0,void 0,i)}eq(e,O=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!O||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,O,i){return new DO(e,O,i)}}class y{constructor(e,O){this.ranges=e,this.mainIndex=O}map(e,O=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,O)),this.mainIndex)}eq(e,O=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],O))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,O=!0){return y.create([e].concat(this.ranges),O?0:this.mainIndex+1)}replaceRange(e,O=this.mainIndex){let i=this.ranges.slice();return i[O]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(O=>DO.fromJSON(O)),e.main)}static single(e,O=e){return new y([y.range(e,O)],0)}static create(e,O=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<e.length;n++){let r=e[n];if(r.empty?r.from<=i:r.from<i)return y.normalized(e.slice(),O);i=r.to}return new y(e,O)}static cursor(e,O=0,i,n){return DO.create(e,e,(O==0?0:O<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,O,i,n,r){let a=(i??16777215)<<6|(n==null?7:Math.min(6,n));return!r&&e!=O&&(r=O<e?1:-1),O<e?DO.create(O,e,48|a):DO.create(e,O,(r?r<0?8:16:0)|a)}static normalized(e,O=0){let i=e[O];e.sort((n,r)=>n.from-r.from),O=e.indexOf(i);for(let n=1;n<e.length;n++){let r=e[n],a=e[n-1];if(r.empty?r.from<=a.to:r.from<a.to){let o=a.from,s=Math.max(r.to,a.to);n<=O&&O--,e.splice(--n,2,r.anchor>r.head?y.range(s,o):y.range(o,s))}}return new y(e,O)}}function wQ(t,e){for(let O of t.ranges)if(O.to>e)throw new RangeError("Selection points outside of document")}let xc=0;class E{constructor(e,O,i,n,r){this.combine=e,this.compareInput=O,this.compare=i,this.isStatic=n,this.id=xc++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new E(e.combine||(O=>O),e.compareInput||((O,i)=>O===i),e.compare||(e.combine?(O,i)=>O===i:vc),!!e.static,e.enables)}of(e){return new Br([],this,0,e)}compute(e,O){if(this.isStatic)throw new Error("Can't compute a static facet");return new Br(e,this,1,O)}computeN(e,O){if(this.isStatic)throw new Error("Can't compute a static facet");return new Br(e,this,2,O)}from(e,O){return O||(O=i=>i),this.compute([e],i=>O(i.field(e)))}}function vc(t,e){return t==e||t.length==e.length&&t.every((O,i)=>O===e[i])}class Br{constructor(e,O,i,n){this.dependencies=e,this.facet=O,this.type=i,this.value=n,this.id=xc++}dynamicSlot(e){var O;let i=this.value,n=this.facet.compareInput,r=this.id,a=e[r]>>1,o=this.type==2,s=!1,l=!1,c=[];for(let u of this.dependencies)u=="doc"?s=!0:u=="selection"?l=!0:(((O=e[u.id])!==null&&O!==void 0?O:1)&1)==0&&c.push(e[u.id]);return{create(u){return u.values[a]=i(u),1},update(u,f){if(s&&f.docChanged||l&&(f.docChanged||f.selection)||tl(u,c)){let d=i(u);if(o?!nf(d,u.values[a],n):!n(d,u.values[a]))return u.values[a]=d,1}return 0},reconfigure:(u,f)=>{let d,$=f.config.address[r];if($!=null){let Q=ua(f,$);if(this.dependencies.every(p=>p instanceof E?f.facet(p)===u.facet(p):p instanceof rt?f.field(p,!1)==u.field(p,!1):!0)||(o?nf(d=i(u),Q,n):n(d=i(u),Q)))return u.values[a]=Q,0}else d=i(u);return u.values[a]=d,1}}}}function nf(t,e,O){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!O(t[i],e[i]))return!1;return!0}function tl(t,e){let O=!1;for(let i of e)Pn(t,i)&1&&(O=!0);return O}function _X(t,e,O){let i=O.map(s=>t[s.id]),n=O.map(s=>s.type),r=i.filter(s=>!(s&1)),a=t[e.id]>>1;function o(s){let l=[];for(let c=0;c<i.length;c++){let u=ua(s,i[c]);if(n[c]==2)for(let f of u)l.push(f);else l.push(u)}return e.combine(l)}return{create(s){for(let l of i)Pn(s,l);return s.values[a]=o(s),1},update(s,l){if(!tl(s,r))return 0;let c=o(s);return e.compare(c,s.values[a])?0:(s.values[a]=c,1)},reconfigure(s,l){let c=tl(s,i),u=l.config.facets[e.id],f=l.facet(e);if(u&&!c&&vc(O,u))return s.values[a]=f,0;let d=o(s);return e.compare(d,f)?(s.values[a]=f,0):(s.values[a]=d,1)}}}const Qr=E.define({static:!0});class rt{constructor(e,O,i,n,r){this.id=e,this.createF=O,this.updateF=i,this.compareF=n,this.spec=r,this.provides=void 0}static define(e){let O=new rt(xc++,e.create,e.update,e.compare||((i,n)=>i===n),e);return e.provide&&(O.provides=e.provide(O)),O}create(e){let O=e.facet(Qr).find(i=>i.field==this);return((O==null?void 0:O.create)||this.createF)(e)}slot(e){let O=e[this.id]>>1;return{create:i=>(i.values[O]=this.create(i),1),update:(i,n)=>{let r=i.values[O],a=this.updateF(r,n);return this.compareF(r,a)?0:(i.values[O]=a,1)},reconfigure:(i,n)=>{let r=i.facet(Qr),a=n.facet(Qr),o;return(o=r.find(s=>s.field==this))&&o!=a.find(s=>s.field==this)?(i.values[O]=o.create(i),1):n.config.address[this.id]!=null?(i.values[O]=n.field(this),0):(i.values[O]=this.create(i),1)}}}init(e){return[this,Qr.of({field:this,create:e})]}get extension(){return this}}const GO={lowest:4,low:3,default:2,high:1,highest:0};function Ji(t){return e=>new TQ(e,t)}const ui={highest:Ji(GO.highest),high:Ji(GO.high),default:Ji(GO.default),low:Ji(GO.low),lowest:Ji(GO.lowest)};class TQ{constructor(e,O){this.inner=e,this.prec=O}}class Ba{of(e){return new Ol(this,e)}reconfigure(e){return Ba.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ol{constructor(e,O){this.compartment=e,this.inner=O}}class ca{constructor(e,O,i,n,r,a){for(this.base=e,this.compartments=O,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let O=this.address[e.id];return O==null?e.default:this.staticValues[O>>1]}static resolve(e,O,i){let n=[],r=Object.create(null),a=new Map;for(let f of YX(e,O,a))f instanceof rt?n.push(f):(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let o=Object.create(null),s=[],l=[];for(let f of n)o[f.id]=l.length<<1,l.push(d=>f.slot(d));let c=i==null?void 0:i.config.facets;for(let f in r){let d=r[f],$=d[0].facet,Q=c&&c[f]||[];if(d.every(p=>p.type==0))if(o[$.id]=s.length<<1|1,vc(Q,d))s.push(i.facet($));else{let p=$.combine(d.map(m=>m.value));s.push(i&&$.compare(p,i.facet($))?i.facet($):p)}else{for(let p of d)p.type==0?(o[p.id]=s.length<<1|1,s.push(p.value)):(o[p.id]=l.length<<1,l.push(m=>p.dynamicSlot(m)));o[$.id]=l.length<<1,l.push(p=>_X(p,$,d))}}let u=l.map(f=>f(o));return new ca(e,a,u,o,s,r)}}function YX(t,e,O){let i=[[],[],[],[],[]],n=new Map;function r(a,o){let s=n.get(a);if(s!=null){if(s<=o)return;let l=i[s].indexOf(a);l>-1&&i[s].splice(l,1),a instanceof Ol&&O.delete(a.compartment)}if(n.set(a,o),Array.isArray(a))for(let l of a)r(l,o);else if(a instanceof Ol){if(O.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let l=e.get(a.compartment)||a.inner;O.set(a.compartment,l),r(l,o)}else if(a instanceof TQ)r(a.inner,a.prec);else if(a instanceof rt)i[o].push(a),a.provides&&r(a.provides,o);else if(a instanceof Br)i[o].push(a),a.facet.extensions&&r(a.facet.extensions,GO.default);else{let l=a.extension;if(!l)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(l,o)}}return r(t,GO.default),i.reduce((a,o)=>a.concat(o))}function Pn(t,e){if(e&1)return 2;let O=e>>1,i=t.status[O];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[O]=4;let n=t.computeSlot(t,t.config.dynamicSlots[O]);return t.status[O]=2|n}function ua(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const xQ=E.define(),il=E.define({combine:t=>t.some(e=>e),static:!0}),vQ=E.define({combine:t=>t.length?t[0]:void 0,static:!0}),_Q=E.define(),YQ=E.define(),RQ=E.define(),ZQ=E.define({combine:t=>t.length?t[0]:!1});class uO{constructor(e,O){this.type=e,this.value=O}static define(){return new RX}}class RX{of(e){return new uO(this,e)}}class ZX{constructor(e){this.map=e}of(e){return new ie(this,e)}}class ie{constructor(e,O){this.type=e,this.value=O}map(e){let O=this.type.map(this.value,e);return O===void 0?void 0:O==this.value?this:new ie(this.type,O)}is(e){return this.type==e}static define(e={}){return new ZX(e.map||(O=>O))}static mapEffects(e,O){if(!e.length)return e;let i=[];for(let n of e){let r=n.map(O);r&&i.push(r)}return i}}ie.reconfigure=ie.define();ie.appendConfig=ie.define();class Pe{constructor(e,O,i,n,r,a){this.startState=e,this.changes=O,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=a,this._doc=null,this._state=null,i&&wQ(i,O.newLength),r.some(o=>o.type==Pe.time)||(this.annotations=r.concat(Pe.time.of(Date.now())))}static create(e,O,i,n,r,a){return new Pe(e,O,i,n,r,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let O of this.annotations)if(O.type==e)return O.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let O=this.annotation(Pe.userEvent);return!!(O&&(O==e||O.length>e.length&&O.slice(0,e.length)==e&&O[e.length]=="."))}}Pe.time=uO.define();Pe.userEvent=uO.define();Pe.addToHistory=uO.define();Pe.remote=uO.define();function zX(t,e){let O=[];for(let i=0,n=0;;){let r,a;if(i<t.length&&(n==e.length||e[n]>=t[i]))r=t[i++],a=t[i++];else if(n<e.length)r=e[n++],a=e[n++];else return O;!O.length||O[O.length-1]<r?O.push(r,a):O[O.length-1]<a&&(O[O.length-1]=a)}}function zQ(t,e,O){var i;let n,r,a;return O?(n=e.changes,r=Xe.empty(e.changes.length),a=t.changes.compose(e.changes)):(n=e.changes.map(t.changes),r=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(n)),{changes:a,selection:e.selection?e.selection.map(r):(i=t.selection)===null||i===void 0?void 0:i.map(n),effects:ie.mapEffects(t.effects,n).concat(ie.mapEffects(e.effects,r)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function nl(t,e,O){let i=e.selection,n=Ti(e.annotations);return e.userEvent&&(n=n.concat(Pe.userEvent.of(e.userEvent))),{changes:e.changes instanceof Xe?e.changes:Xe.of(e.changes||[],O,t.facet(vQ)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:Ti(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function qQ(t,e,O){let i=nl(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(O=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(O=!1);let a=!!e[r].sequential;i=zQ(i,nl(t,e[r],a?i.changes.newLength:t.doc.length),a)}let n=Pe.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return UX(O?qX(n):n)}function qX(t){let e=t.startState,O=!0;for(let n of e.facet(_Q)){let r=n(t);if(r===!1){O=!1;break}Array.isArray(r)&&(O=O===!0?r:zX(O,r))}if(O!==!0){let n,r;if(O===!1)r=t.changes.invertedDesc,n=Xe.empty(e.doc.length);else{let a=t.changes.filter(O);n=a.changes,r=a.filtered.mapDesc(a.changes).invertedDesc}t=Pe.create(e,n,t.selection&&t.selection.map(r),ie.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let i=e.facet(YQ);for(let n=i.length-1;n>=0;n--){let r=i[n](t);r instanceof Pe?t=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Pe?t=r[0]:t=qQ(e,Ti(r),!1)}return t}function UX(t){let e=t.startState,O=e.facet(RQ),i=t;for(let n=O.length-1;n>=0;n--){let r=O[n](t);r&&Object.keys(r).length&&(i=zQ(i,nl(e,r,t.changes.newLength),!0))}return i==t?t:Pe.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const VX=[];function Ti(t){return t==null?VX:Array.isArray(t)?t:[t]}var de=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(de||(de={}));const WX=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let rl;try{rl=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function jX(t){if(rl)return rl.test(t);for(let e=0;e<t.length;e++){let O=t[e];if(/\w/.test(O)||O>"€"&&(O.toUpperCase()!=O.toLowerCase()||WX.test(O)))return!0}return!1}function EX(t){return e=>{if(!/\S/.test(e))return de.Space;if(jX(e))return de.Word;for(let O=0;O<t.length;O++)if(e.indexOf(t[O])>-1)return de.Word;return de.Other}}class re{constructor(e,O,i,n,r,a){this.config=e,this.doc=O,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=r,a&&(a._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Pn(this,o<<1);this.computeSlot=null}field(e,O=!0){let i=this.config.address[e.id];if(i==null){if(O)throw new RangeError("Field is not present in this state");return}return Pn(this,i),ua(this,i)}update(...e){return qQ(this,e,!0)}applyTransaction(e){let O=this.config,{base:i,compartments:n}=O;for(let o of e.effects)o.is(Ba.reconfigure)?(O&&(n=new Map,O.compartments.forEach((s,l)=>n.set(l,s)),O=null),n.set(o.value.compartment,o.value.extension)):o.is(ie.reconfigure)?(O=null,i=o.value):o.is(ie.appendConfig)&&(O=null,i=Ti(i).concat(o.value));let r;O?r=e.startState.values.slice():(O=ca.resolve(i,n,this),r=new re(O,this.doc,this.selection,O.dynamicSlots.map(()=>null),(s,l)=>l.reconfigure(s,this),null).values);let a=e.startState.facet(il)?e.newSelection:e.newSelection.asSingle();new re(O,e.newDoc,a,r,(o,s)=>s.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(O=>({changes:{from:O.from,to:O.to,insert:e},range:y.cursor(O.from+e.length)}))}changeByRange(e){let O=this.selection,i=e(O.ranges[0]),n=this.changes(i.changes),r=[i.range],a=Ti(i.effects);for(let o=1;o<O.ranges.length;o++){let s=e(O.ranges[o]),l=this.changes(s.changes),c=l.map(n);for(let f=0;f<o;f++)r[f]=r[f].map(c);let u=n.mapDesc(l,!0);r.push(s.range.map(u)),n=n.compose(c),a=ie.mapEffects(a,c).concat(ie.mapEffects(Ti(s.effects),u))}return{changes:n,selection:y.create(r,O.mainIndex),effects:a}}changes(e=[]){return e instanceof Xe?e:Xe.of(e,this.doc.length,this.facet(re.lineSeparator))}toText(e){return Oe.of(e.split(this.facet(re.lineSeparator)||Ks))}sliceDoc(e=0,O=this.doc.length){return this.doc.sliceString(e,O,this.lineBreak)}facet(e){let O=this.config.address[e.id];return O==null?e.default:(Pn(this,O),ua(this,O))}toJSON(e){let O={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof rt&&this.config.address[n.id]!=null&&(O[i]=n.spec.toJSON(this.field(e[i]),this))}return O}static fromJSON(e,O={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let a=i[r],o=e[r];n.push(a.init(s=>a.spec.fromJSON(o,s)))}}return re.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:O.extensions?n.concat([O.extensions]):n})}static create(e={}){let O=ca.resolve(e.extensions||[],new Map),i=e.doc instanceof Oe?e.doc:Oe.of((e.doc||"").split(O.staticFacet(re.lineSeparator)||Ks)),n=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return wQ(n,i.length),O.staticFacet(il)||(n=n.asSingle()),new re(O,i,n,O.dynamicSlots.map(()=>null),(r,a)=>a.create(r),null)}get tabSize(){return this.facet(re.tabSize)}get lineBreak(){return this.facet(re.lineSeparator)||`
@@ -1 +1 @@
1
- import{u as Xe,r as e,j as g,c as Je}from"./main-Dk3qq80S.js";import{V as R,c as Qe,d as ne,e as Ze,W as qe,f as Pe,H as et,D as Oe,G as tt,B as rt,g as he,h as nt,i as st,j as ot,L as at,E as it,k as ct,l as lt,A as ut,b as dt,a as ft,m as mt}from"./vendor-three-DYBBrXTx.js";import{O as pt}from"./OrbitControls-ANLmgNeR.js";import{g as ht,v as gt,u as wt,a as yt,d as ke,s as Mt,c as xt,T as bt,b as St}from"./ThreeAreaSelector-Bj_mL6NG.js";import{T as Ct,a as Et}from"./ThreeViewShortcuts-CKtE3yZV.js";import"./vendor-react--Eh9ivFN.js";function Rt(y){return Number.isFinite(y)?y>=100?y.toFixed(0):y>=10?y.toFixed(1):y.toFixed(2):"0"}function At({url:y,filename:Y,filePath:Ae,onFileSelect:Fe}){const{t:m}=Xe("terminal"),ge=e.useRef(null),k=e.useRef(null),A=e.useRef(null),w=e.useRef(null),F=e.useRef(null),se=e.useRef([]),oe=e.useRef([]),ae=e.useRef(null),_=e.useRef(null),X=e.useRef(null),T=e.useRef(null),J=e.useRef([]),Q=e.useRef(new R),we=e.useRef(1),v=e.useRef(null),[j,L]=e.useState(!0),[ye,ie]=e.useState(null),[S,D]=e.useState(null),[M,Me]=e.useState(null),[ce,Te]=e.useState(!1),[V]=e.useState(ht),[z,De]=e.useState(V.modelColor),[I,ze]=e.useState(V.backgroundColor),[B,Ie]=e.useState(V.lightIntensity),[N,Be]=e.useState(V.modelOpacity),[G,Ne]=e.useState(V.showEdges),[W,xe]=e.useState(V.preserveModelColors),[le,ue]=e.useState(!1),[C,Z]=e.useState(null),[P,q]=e.useState([]),[de,ee]=e.useState(null),fe=Ae||gt(y),Ge=wt(fe,Y,"fcstd");yt({enabled:!!M&&C===null,rendererRef:X,cameraRef:_,controlsRef:T,modelObjectsRef:J,modelCenterRef:Q,markerGroupRef:v,renderRef:w,setAreas:q,setSelectedId:ee}),e.useEffect(()=>{const n=ge.current;if(!n)return;const d=new AbortController,t=new Worker(new URL("/assets/fcstd.worker-bs9ZyQJN.js",import.meta.url),{type:"module"});let l=!1;const b=[],O=[];let a=null;L(!0),ie(null),D(null),Me(null);const u=new Qe;u.background=new ne(1119258),F.current=u;const i=new Ze(40,1,.01,1e5);_.current=i,i.up.set(0,0,1);let s;try{s=new qe({antialias:!0})}catch{t.terminate(),L(!1),D(m("fileViewerModal.webglUnavailable"));return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),X.current=s,s.outputColorSpace=Pe,s.domElement.className="stl-viewer-canvas",s.domElement.setAttribute("aria-label",m("fileViewerModal.fcstdPreviewLabel",{filename:Y})),n.appendChild(s.domElement);const f=new pt(i,s.domElement);T.current=f,f.enableDamping=!1,f.screenSpacePanning=!0,f.addEventListener("change",()=>s.render(u,i));const te=new et(16777215,2502724,2.2);u.add(te);const U=new Oe(16777215,2.5);U.position.set(3,-4,6),u.add(U);const E=new Oe(8040191,1.1);E.position.set(-4,3,1),u.add(E),ae.current={hemisphere:te,key:U,fill:E},w.current=()=>s.render(u,i);const H=()=>{const p=Math.max(n.clientWidth,1),c=Math.max(n.clientHeight,1);i.aspect=p/c,i.updateProjectionMatrix(),s.setSize(p,c,!1),s.render(u,i)},$=new ResizeObserver(H);return $.observe(n),H(),t.onmessage=p=>{if(l)return;const c=p.data;if(c.type==="progress"){ie({current:c.current,total:c.total});return}if(c.type==="error"){const r=c.message==="NO_BREP_GEOMETRY"?"fileViewerModal.noBrepGeometry":c.message==="BREP_IMPORT_FAILED"?"fileViewerModal.brepImportFailed":"fileViewerModal.fcstdRenderError";D(m(r)),L(!1);return}const K=new tt,$e=c.meshes.reduce((r,o)=>r+o.indices.length/3,0)<=25e4;let Se=0;for(const r of c.meshes){const o=new rt;o.setAttribute("position",new he(r.positions,3)),r.normals?o.setAttribute("normal",new he(r.normals,3)):o.computeVertexNormals(),o.setIndex(new he(r.indices,1)),b.push(o);const x=new nt({color:new ne().setRGB(r.color[0],r.color[1],r.color[2],Pe),metalness:.05,roughness:.68,side:st,transparent:r.opacity<1,opacity:r.opacity,depthWrite:r.opacity>=1});x.userData.originalColor=x.color.clone(),x.userData.originalOpacity=r.opacity,O.push(x),se.current.push(x);const pe=new ot(o,x);if(pe.name=r.name,J.current.push(pe),K.add(pe),$e){const je=new at({color:1582123,transparent:!0,opacity:.48}),Le=new it(o,28);b.push(Le),O.push(je);const Ve=new ct(Le,je);oe.current.push(Ve),K.add(Ve)}Se+=r.indices.length/3}u.add(K);const Ce=new lt().setFromObject(K),h=Ce.getSize(new R),Ee=Ce.getCenter(new R);Q.current.copy(Ee),we.current=Math.max(h.x,h.y,h.z,.001)*.12,K.position.sub(Ee);const Ke=Math.max(h.x,h.y,h.z,.001)*.3;a=new ut(Ke),a.position.set(-h.x/2,-h.y/2,-h.z/2),a.renderOrder=5,u.add(a);const Re=Math.max(h.length()/2,.001),Ye=dt.degToRad(i.fov/2),re=Math.max(Re/Math.sin(Ye)*1.18,.01),me=r=>{i.near=Math.max(re/1e3,1e-4),i.far=Math.max(re*100,10);const o=r==="x"?new R(1,0,0):r==="y"?new R(0,1,0):r==="z"?new R(0,0,1):new R(1,-1,.78).normalize();i.up.set(0,r==="z"?1:0,r==="z"?0:1),i.position.copy(o.multiplyScalar(re)),i.updateProjectionMatrix(),f.target.set(0,0,0),f.minDistance=Re*.05,f.maxDistance=re*20,f.update(),s.render(u,i)},ve=()=>me("iso");A.current=me,k.current=ve,ve();const _e=r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;const o=r.key.toLowerCase(),x=o==="x"||o==="1"?"x":o==="y"||o==="2"?"y":o==="z"||o==="3"?"z":o==="i"||o==="4"?"iso":null;x&&(r.preventDefault(),me(x))};s.domElement.tabIndex=0,s.domElement.addEventListener("pointerdown",()=>s.domElement.focus()),s.domElement.addEventListener("keydown",_e),Me({objects:c.objectCount,triangles:Math.floor(Se),dimensions:[h.x,h.y,h.z]}),L(!1),ie(null)},t.onerror=()=>{l||(D(m("fileViewerModal.fcstdRenderError")),L(!1))},(async()=>{try{const p=await Je(y,{signal:d.signal});if(!p.ok)throw new Error(`HTTP ${p.status}`);const c=await p.arrayBuffer();l||t.postMessage(c,[c])}catch{if(l||d.signal.aborted)return;D(m("fileViewerModal.fcstdLoadError")),L(!1)}})(),()=>{l=!0,d.abort(),t.terminate(),k.current=null,A.current=null,w.current=null,F.current=null,se.current=[],oe.current=[],ae.current=null,_.current=null,X.current=null,T.current=null,J.current=[],ke(v.current),v.current=null,$.disconnect(),f.dispose(),b.forEach(p=>p.dispose()),O.forEach(p=>p.dispose()),a==null||a.geometry.dispose(),a&&(Array.isArray(a.material)?a.material:[a.material]).forEach(c=>c.dispose()),s.dispose(),s.domElement.remove()}},[y,Y,m]),e.useEffect(()=>{var d;F.current&&(F.current.background=new ne(I));for(const t of se.current){const l=t.userData.originalColor;W&&l instanceof ne?t.color.copy(l):t.color.set(z);const b=typeof t.userData.originalOpacity=="number"?t.userData.originalOpacity:1;t.opacity=b*(N/100),t.transparent=t.opacity<1,t.depthWrite=t.opacity>=1,t.needsUpdate=!0}const n=ae.current;if(n){const t=B/100;n.hemisphere.intensity=2.2*t,n.key.intensity=2.5*t,n.fill.intensity=1.1*t}oe.current.forEach(t=>{t.visible=G}),(d=w.current)==null||d.call(w)},[z,I,B,N,G,W,M]),e.useEffect(()=>{Mt({modelColor:z,backgroundColor:I,lightIntensity:B,modelOpacity:N,showEdges:G,preserveModelColors:W})},[z,I,B,N,G,W]),e.useEffect(()=>{q([]),ee(null),Z(null),ue(!1)},[y]),e.useEffect(()=>{T.current&&(T.current.enabled=C===null);const n=X.current,d=_.current;if(!n||!d||!M||!C)return;const t=n.domElement;let l=null;const b=a=>{l=[a.clientX,a.clientY]},O=a=>{var $;if(!l||Math.hypot(a.clientX-l[0],a.clientY-l[1])>5)return;const u=t.getBoundingClientRect(),i=new ft((a.clientX-u.left)/u.width*2-1,-((a.clientY-u.top)/u.height)*2+1),s=new mt;s.setFromCamera(i,d);const f=s.intersectObjects(J.current,!1)[0];if(!f)return;const te=f.point.clone().add(Q.current),U=($=f.face)==null?void 0:$.normal.clone().transformDirection(f.object.matrixWorld).toArray(),E=we.current,H=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;q(be=>[...be,{id:H,shape:C,center:te.toArray(),size:[E,E,E],objectName:f.object.name||void 0,surfaceNormal:U}]),ee(H)};return t.addEventListener("pointerdown",b),t.addEventListener("pointerup",O),()=>{t.removeEventListener("pointerdown",b),t.removeEventListener("pointerup",O)}},[C,M]),e.useEffect(()=>{var t,l;ke(v.current),v.current=null;const n=F.current;if(!n||P.length===0){(t=w.current)==null||t.call(w);return}const d=xt(P,Q.current,de);v.current=d,n.add(d),(l=w.current)==null||l.call(w)},[P,de,M]);const We=e.useCallback(()=>{var n;return(n=k.current)==null?void 0:n.call(k)},[]),Ue=e.useCallback(n=>{var d;return(d=A.current)==null?void 0:d.call(A,n)},[]),He=ye?m("fileViewerModal.processingFcstd",ye):m("fileViewerModal.loadingFcstd");return g.jsxs("div",{className:`stl-viewer fcstd-viewer${C?" area-placement-active":""}`,ref:ge,children:[j&&g.jsx("div",{className:"stl-viewer-status",children:He}),S&&g.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:S}),!j&&!S&&g.jsxs("div",{className:"stl-viewer-toolbar",children:[M&&g.jsxs("span",{className:"stl-viewer-info",children:[m("fileViewerModal.fcstdStats",{objects:M.objects.toLocaleString(),triangles:M.triangles.toLocaleString()})," · ",M.dimensions.map(Rt).join(" × ")]}),g.jsx(Ct,{onView:Ue}),g.jsx("button",{type:"button",onClick:We,title:m("fileViewerModal.resetCamera"),children:m("fileViewerModal.resetView")}),g.jsxs("button",{type:"button",className:le?"active":void 0,onClick:()=>{ue(n=>!n),Z(null)},"aria-expanded":le,children:[m("fileViewerModal.areas"),P.length>0?` (${P.length})`:""]}),g.jsx("button",{type:"button",className:ce?"active":void 0,onClick:()=>Te(n=>!n),"aria-expanded":ce,children:m("fileViewerModal.viewerSettings")})]}),!j&&!S&&ce&&g.jsx(bt,{modelColor:z,onModelColorChange:n=>{De(n),xe(!1)},backgroundColor:I,onBackgroundColorChange:ze,lightIntensity:B,onLightIntensityChange:Ie,modelOpacity:N,onModelOpacityChange:Be,showEdges:G,onShowEdgesChange:Ne,preserveModelColors:W,onPreserveModelColorsChange:xe,recentFiles:Ge,currentFilePath:fe,onRecentFileSelect:Fe}),!j&&!S&&le&&g.jsx(St,{areas:P,selectedId:de,placementShape:C,filename:Y,filePath:fe,modelExtent:Math.max(...M.dimensions),onPlacementShapeChange:Z,onSelectedIdChange:ee,onAreasChange:q,onClose:()=>{ue(!1),Z(null)}}),!j&&!S&&g.jsx("div",{className:"stl-viewer-hint",children:m("fileViewerModal.controlsHint")}),!j&&!S&&g.jsx(Et,{})]})}export{At as FcStdViewer};
1
+ import{u as Xe,r as e,j as g,c as Je}from"./main-BTH4eRQ6.js";import{V as R,c as Qe,d as ne,e as Ze,W as qe,f as Pe,H as et,D as Oe,G as tt,B as rt,g as he,h as nt,i as st,j as ot,L as at,E as it,k as ct,l as lt,A as ut,b as dt,a as ft,m as mt}from"./vendor-three-DYBBrXTx.js";import{O as pt}from"./OrbitControls-ANLmgNeR.js";import{g as ht,v as gt,u as wt,a as yt,d as ke,s as Mt,c as xt,T as bt,b as St}from"./ThreeAreaSelector-61KRvl6V.js";import{T as Ct,a as Et}from"./ThreeViewShortcuts-BsuRkJQ3.js";import"./vendor-react--Eh9ivFN.js";function Rt(y){return Number.isFinite(y)?y>=100?y.toFixed(0):y>=10?y.toFixed(1):y.toFixed(2):"0"}function At({url:y,filename:Y,filePath:Ae,onFileSelect:Fe}){const{t:m}=Xe("terminal"),ge=e.useRef(null),k=e.useRef(null),A=e.useRef(null),w=e.useRef(null),F=e.useRef(null),se=e.useRef([]),oe=e.useRef([]),ae=e.useRef(null),_=e.useRef(null),X=e.useRef(null),T=e.useRef(null),J=e.useRef([]),Q=e.useRef(new R),we=e.useRef(1),v=e.useRef(null),[j,L]=e.useState(!0),[ye,ie]=e.useState(null),[S,D]=e.useState(null),[M,Me]=e.useState(null),[ce,Te]=e.useState(!1),[V]=e.useState(ht),[z,De]=e.useState(V.modelColor),[I,ze]=e.useState(V.backgroundColor),[B,Ie]=e.useState(V.lightIntensity),[N,Be]=e.useState(V.modelOpacity),[G,Ne]=e.useState(V.showEdges),[W,xe]=e.useState(V.preserveModelColors),[le,ue]=e.useState(!1),[C,Z]=e.useState(null),[P,q]=e.useState([]),[de,ee]=e.useState(null),fe=Ae||gt(y),Ge=wt(fe,Y,"fcstd");yt({enabled:!!M&&C===null,rendererRef:X,cameraRef:_,controlsRef:T,modelObjectsRef:J,modelCenterRef:Q,markerGroupRef:v,renderRef:w,setAreas:q,setSelectedId:ee}),e.useEffect(()=>{const n=ge.current;if(!n)return;const d=new AbortController,t=new Worker(new URL("/assets/fcstd.worker-bs9ZyQJN.js",import.meta.url),{type:"module"});let l=!1;const b=[],O=[];let a=null;L(!0),ie(null),D(null),Me(null);const u=new Qe;u.background=new ne(1119258),F.current=u;const i=new Ze(40,1,.01,1e5);_.current=i,i.up.set(0,0,1);let s;try{s=new qe({antialias:!0})}catch{t.terminate(),L(!1),D(m("fileViewerModal.webglUnavailable"));return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),X.current=s,s.outputColorSpace=Pe,s.domElement.className="stl-viewer-canvas",s.domElement.setAttribute("aria-label",m("fileViewerModal.fcstdPreviewLabel",{filename:Y})),n.appendChild(s.domElement);const f=new pt(i,s.domElement);T.current=f,f.enableDamping=!1,f.screenSpacePanning=!0,f.addEventListener("change",()=>s.render(u,i));const te=new et(16777215,2502724,2.2);u.add(te);const U=new Oe(16777215,2.5);U.position.set(3,-4,6),u.add(U);const E=new Oe(8040191,1.1);E.position.set(-4,3,1),u.add(E),ae.current={hemisphere:te,key:U,fill:E},w.current=()=>s.render(u,i);const H=()=>{const p=Math.max(n.clientWidth,1),c=Math.max(n.clientHeight,1);i.aspect=p/c,i.updateProjectionMatrix(),s.setSize(p,c,!1),s.render(u,i)},$=new ResizeObserver(H);return $.observe(n),H(),t.onmessage=p=>{if(l)return;const c=p.data;if(c.type==="progress"){ie({current:c.current,total:c.total});return}if(c.type==="error"){const r=c.message==="NO_BREP_GEOMETRY"?"fileViewerModal.noBrepGeometry":c.message==="BREP_IMPORT_FAILED"?"fileViewerModal.brepImportFailed":"fileViewerModal.fcstdRenderError";D(m(r)),L(!1);return}const K=new tt,$e=c.meshes.reduce((r,o)=>r+o.indices.length/3,0)<=25e4;let Se=0;for(const r of c.meshes){const o=new rt;o.setAttribute("position",new he(r.positions,3)),r.normals?o.setAttribute("normal",new he(r.normals,3)):o.computeVertexNormals(),o.setIndex(new he(r.indices,1)),b.push(o);const x=new nt({color:new ne().setRGB(r.color[0],r.color[1],r.color[2],Pe),metalness:.05,roughness:.68,side:st,transparent:r.opacity<1,opacity:r.opacity,depthWrite:r.opacity>=1});x.userData.originalColor=x.color.clone(),x.userData.originalOpacity=r.opacity,O.push(x),se.current.push(x);const pe=new ot(o,x);if(pe.name=r.name,J.current.push(pe),K.add(pe),$e){const je=new at({color:1582123,transparent:!0,opacity:.48}),Le=new it(o,28);b.push(Le),O.push(je);const Ve=new ct(Le,je);oe.current.push(Ve),K.add(Ve)}Se+=r.indices.length/3}u.add(K);const Ce=new lt().setFromObject(K),h=Ce.getSize(new R),Ee=Ce.getCenter(new R);Q.current.copy(Ee),we.current=Math.max(h.x,h.y,h.z,.001)*.12,K.position.sub(Ee);const Ke=Math.max(h.x,h.y,h.z,.001)*.3;a=new ut(Ke),a.position.set(-h.x/2,-h.y/2,-h.z/2),a.renderOrder=5,u.add(a);const Re=Math.max(h.length()/2,.001),Ye=dt.degToRad(i.fov/2),re=Math.max(Re/Math.sin(Ye)*1.18,.01),me=r=>{i.near=Math.max(re/1e3,1e-4),i.far=Math.max(re*100,10);const o=r==="x"?new R(1,0,0):r==="y"?new R(0,1,0):r==="z"?new R(0,0,1):new R(1,-1,.78).normalize();i.up.set(0,r==="z"?1:0,r==="z"?0:1),i.position.copy(o.multiplyScalar(re)),i.updateProjectionMatrix(),f.target.set(0,0,0),f.minDistance=Re*.05,f.maxDistance=re*20,f.update(),s.render(u,i)},ve=()=>me("iso");A.current=me,k.current=ve,ve();const _e=r=>{if(r.ctrlKey||r.metaKey||r.altKey)return;const o=r.key.toLowerCase(),x=o==="x"||o==="1"?"x":o==="y"||o==="2"?"y":o==="z"||o==="3"?"z":o==="i"||o==="4"?"iso":null;x&&(r.preventDefault(),me(x))};s.domElement.tabIndex=0,s.domElement.addEventListener("pointerdown",()=>s.domElement.focus()),s.domElement.addEventListener("keydown",_e),Me({objects:c.objectCount,triangles:Math.floor(Se),dimensions:[h.x,h.y,h.z]}),L(!1),ie(null)},t.onerror=()=>{l||(D(m("fileViewerModal.fcstdRenderError")),L(!1))},(async()=>{try{const p=await Je(y,{signal:d.signal});if(!p.ok)throw new Error(`HTTP ${p.status}`);const c=await p.arrayBuffer();l||t.postMessage(c,[c])}catch{if(l||d.signal.aborted)return;D(m("fileViewerModal.fcstdLoadError")),L(!1)}})(),()=>{l=!0,d.abort(),t.terminate(),k.current=null,A.current=null,w.current=null,F.current=null,se.current=[],oe.current=[],ae.current=null,_.current=null,X.current=null,T.current=null,J.current=[],ke(v.current),v.current=null,$.disconnect(),f.dispose(),b.forEach(p=>p.dispose()),O.forEach(p=>p.dispose()),a==null||a.geometry.dispose(),a&&(Array.isArray(a.material)?a.material:[a.material]).forEach(c=>c.dispose()),s.dispose(),s.domElement.remove()}},[y,Y,m]),e.useEffect(()=>{var d;F.current&&(F.current.background=new ne(I));for(const t of se.current){const l=t.userData.originalColor;W&&l instanceof ne?t.color.copy(l):t.color.set(z);const b=typeof t.userData.originalOpacity=="number"?t.userData.originalOpacity:1;t.opacity=b*(N/100),t.transparent=t.opacity<1,t.depthWrite=t.opacity>=1,t.needsUpdate=!0}const n=ae.current;if(n){const t=B/100;n.hemisphere.intensity=2.2*t,n.key.intensity=2.5*t,n.fill.intensity=1.1*t}oe.current.forEach(t=>{t.visible=G}),(d=w.current)==null||d.call(w)},[z,I,B,N,G,W,M]),e.useEffect(()=>{Mt({modelColor:z,backgroundColor:I,lightIntensity:B,modelOpacity:N,showEdges:G,preserveModelColors:W})},[z,I,B,N,G,W]),e.useEffect(()=>{q([]),ee(null),Z(null),ue(!1)},[y]),e.useEffect(()=>{T.current&&(T.current.enabled=C===null);const n=X.current,d=_.current;if(!n||!d||!M||!C)return;const t=n.domElement;let l=null;const b=a=>{l=[a.clientX,a.clientY]},O=a=>{var $;if(!l||Math.hypot(a.clientX-l[0],a.clientY-l[1])>5)return;const u=t.getBoundingClientRect(),i=new ft((a.clientX-u.left)/u.width*2-1,-((a.clientY-u.top)/u.height)*2+1),s=new mt;s.setFromCamera(i,d);const f=s.intersectObjects(J.current,!1)[0];if(!f)return;const te=f.point.clone().add(Q.current),U=($=f.face)==null?void 0:$.normal.clone().transformDirection(f.object.matrixWorld).toArray(),E=we.current,H=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;q(be=>[...be,{id:H,shape:C,center:te.toArray(),size:[E,E,E],objectName:f.object.name||void 0,surfaceNormal:U}]),ee(H)};return t.addEventListener("pointerdown",b),t.addEventListener("pointerup",O),()=>{t.removeEventListener("pointerdown",b),t.removeEventListener("pointerup",O)}},[C,M]),e.useEffect(()=>{var t,l;ke(v.current),v.current=null;const n=F.current;if(!n||P.length===0){(t=w.current)==null||t.call(w);return}const d=xt(P,Q.current,de);v.current=d,n.add(d),(l=w.current)==null||l.call(w)},[P,de,M]);const We=e.useCallback(()=>{var n;return(n=k.current)==null?void 0:n.call(k)},[]),Ue=e.useCallback(n=>{var d;return(d=A.current)==null?void 0:d.call(A,n)},[]),He=ye?m("fileViewerModal.processingFcstd",ye):m("fileViewerModal.loadingFcstd");return g.jsxs("div",{className:`stl-viewer fcstd-viewer${C?" area-placement-active":""}`,ref:ge,children:[j&&g.jsx("div",{className:"stl-viewer-status",children:He}),S&&g.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:S}),!j&&!S&&g.jsxs("div",{className:"stl-viewer-toolbar",children:[M&&g.jsxs("span",{className:"stl-viewer-info",children:[m("fileViewerModal.fcstdStats",{objects:M.objects.toLocaleString(),triangles:M.triangles.toLocaleString()})," · ",M.dimensions.map(Rt).join(" × ")]}),g.jsx(Ct,{onView:Ue}),g.jsx("button",{type:"button",onClick:We,title:m("fileViewerModal.resetCamera"),children:m("fileViewerModal.resetView")}),g.jsxs("button",{type:"button",className:le?"active":void 0,onClick:()=>{ue(n=>!n),Z(null)},"aria-expanded":le,children:[m("fileViewerModal.areas"),P.length>0?` (${P.length})`:""]}),g.jsx("button",{type:"button",className:ce?"active":void 0,onClick:()=>Te(n=>!n),"aria-expanded":ce,children:m("fileViewerModal.viewerSettings")})]}),!j&&!S&&ce&&g.jsx(bt,{modelColor:z,onModelColorChange:n=>{De(n),xe(!1)},backgroundColor:I,onBackgroundColorChange:ze,lightIntensity:B,onLightIntensityChange:Ie,modelOpacity:N,onModelOpacityChange:Be,showEdges:G,onShowEdgesChange:Ne,preserveModelColors:W,onPreserveModelColorsChange:xe,recentFiles:Ge,currentFilePath:fe,onRecentFileSelect:Fe}),!j&&!S&&le&&g.jsx(St,{areas:P,selectedId:de,placementShape:C,filename:Y,filePath:fe,modelExtent:Math.max(...M.dimensions),onPlacementShapeChange:Z,onSelectedIdChange:ee,onAreasChange:q,onClose:()=>{ue(!1),Z(null)}}),!j&&!S&&g.jsx("div",{className:"stl-viewer-hint",children:m("fileViewerModal.controlsHint")}),!j&&!S&&g.jsx(Et,{})]})}export{At as FcStdViewer};
@@ -1 +1 @@
1
- import{u as he,r as o,c as xe,j as e}from"./main-Dk3qq80S.js";import{c as fe,d as pe,e as we,W as je,f as ge,L as ye,G as ve,B as Me,g as be,k as Ve,V as M,q as Se,A as Le,b as Ee}from"./vendor-three-DYBBrXTx.js";import{O as Ce}from"./OrbitControls-ANLmgNeR.js";import{T as ze,a as Ne}from"./ThreeViewShortcuts-CKtE3yZV.js";import"./vendor-react--Eh9ivFN.js";const G={external:16739159,perimeter:16754984,infill:4434175,solid:14249215,support:6476936,skirt:11450308,other:4708048,travel:6516867};function ae(u){if(!Number.isFinite(u))return"—";const j=Math.max(0,Math.round(u)),t=Math.floor(j/3600),b=Math.floor(j%3600/60),x=j%60;return t>0?`${t} h ${b} min ${x} s`:`${b} min ${x} s`}function se(u){return u>=1e3?`${(u/1e3).toFixed(2)} m`:`${u.toFixed(1)} mm`}function $e({url:u,filename:j}){const{t}=he("terminal"),b=o.useRef(null),x=o.useRef([]),z=o.useRef([]),V=o.useRef(null),S=o.useRef(null),[W,$]=o.useState(!0),[O,U]=o.useState(null),[i,I]=o.useState(null),[ne,le]=o.useState([]),[g,Z]=o.useState(0),[f,q]=o.useState(0),[N,oe]=o.useState(!1),[B,de]=o.useState(!0);o.useEffect(()=>{const a=b.current;if(!a)return;const c=new AbortController,w=new Worker(new URL("/assets/gcode.worker-DayjyJb4.js",import.meta.url),{type:"module"});let L=!1,r=null,m=null,E=null,h=null;const Q=[],X=[];$(!0),U(null),I(null),x.current=[],z.current=[];const C=s=>{L||(U(s),$(!1))},ce=(s,F)=>{if(L||s.length===0){L||C(t("fileViewerModal.emptyGcode"));return}h=new fe,h.background=new pe(1053723);const d=new we(42,1,.01,1e5);d.up.set(0,0,1);try{r=new je({antialias:!0,logarithmicDepthBuffer:!0})}catch{C(t("fileViewerModal.webglUnavailable"));return}r.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),r.outputColorSpace=ge,r.domElement.className="stl-viewer-canvas",r.domElement.setAttribute("aria-label",t("fileViewerModal.gcodePreviewLabel",{filename:j})),r.domElement.tabIndex=0,a.appendChild(r.domElement),m=new Ce(d,r.domElement),m.screenSpacePanning=!0,m.addEventListener("change",()=>r==null?void 0:r.render(h,d)),V.current=()=>r==null?void 0:r.render(h,d);const Y=new Map;Object.keys(G).forEach(n=>{const l=new ye({color:G[n],transparent:n==="travel",opacity:n==="travel"?.3:.94,depthWrite:n!=="travel"});Y.set(n,l),X.push(l)});for(const n of s){const l=new ve;for(const[v,D]of Object.entries(n.paths)){if(!(D!=null&&D.length))continue;const H=new Me;H.setAttribute("position",new be(D,3));const K=new Ve(H,Y.get(v));K.userData.pathKind=v,v==="travel"&&z.current.push(K),l.add(K),Q.push(H)}h.add(l),x.current.push(l)}const T=new M(...F.bounds.min),ee=new M(...F.bounds.max),R=T.clone().add(ee).multiplyScalar(.5),y=ee.clone().sub(T),te=Math.max(y.length()/2,1),me=Math.max(Math.ceil(Math.max(y.x,y.y)/10)*10,10),P=new Se(me,10,4937320,2568253);P.rotation.x=Math.PI/2,P.position.set(R.x,R.y,T.z-.01),h.add(P);const ie=new Le(Math.max(y.x,y.y,y.z,1)*.22);ie.position.copy(T),h.add(ie);const k=Math.max(te/Math.sin(Ee.degToRad(d.fov/2))*1.18,5),A=n=>{const l=n==="x"?new M(1,0,0):n==="y"?new M(0,1,0):n==="z"?new M(0,0,1):new M(1,-1,.9).normalize();d.up.set(0,n==="z"?1:0,n==="z"?0:1),d.near=Math.max(k/5e3,.001),d.far=k*100,d.position.copy(R).add(l.multiplyScalar(k)),d.updateProjectionMatrix(),m.target.copy(R),m.minDistance=te*.03,m.maxDistance=k*20,m.update(),r.render(h,d)};S.current=A;const ue=n=>{if(n.ctrlKey||n.metaKey||n.altKey)return;const l=n.key.toLowerCase(),v=l==="x"||l==="1"?"x":l==="y"||l==="2"?"y":l==="z"||l==="3"?"z":l==="i"||l==="4"?"iso":null;v&&(n.preventDefault(),A(v))};r.domElement.addEventListener("pointerdown",()=>r==null?void 0:r.domElement.focus()),r.domElement.addEventListener("keydown",ue);const re=()=>{if(!r)return;const n=Math.max(a.clientWidth,1),l=Math.max(a.clientHeight,1);d.aspect=n/l,d.updateProjectionMatrix(),r.setSize(n,l,!1),r.render(h,d)};E=new ResizeObserver(re),E.observe(a),re(),A("iso"),I(F),le(s.map(n=>n.z)),Z(0),q(s.length-1),$(!1)};return w.onmessage=s=>{s.data.type==="error"?C(s.data.message):ce(s.data.layers,s.data.stats)},w.onerror=()=>C(t("fileViewerModal.gcodeLoadError")),xe(u,{signal:c.signal}).then(s=>{if(!s.ok)throw new Error(`Could not load G-code (${s.status})`);return s.arrayBuffer()}).then(s=>{L||w.postMessage(s,[s])}).catch(s=>{c.signal.aborted||C(s instanceof Error?s.message:t("fileViewerModal.gcodeLoadError"))}),()=>{L=!0,c.abort(),w.terminate(),E==null||E.disconnect(),m==null||m.dispose(),Q.forEach(s=>s.dispose()),X.forEach(s=>s.dispose()),r==null||r.dispose(),r==null||r.domElement.remove(),x.current=[],z.current=[],V.current=null,S.current=null}},[u,j,t]),o.useEffect(()=>{var a;x.current.forEach((c,w)=>{c.visible=w>=g&&w<=f}),z.current.forEach(c=>{c.visible=N}),(a=V.current)==null||a.call(V)},[g,f,N,i]);const J=o.useCallback(a=>{var c;return(c=S.current)==null?void 0:c.call(S,a)},[]),p=Math.max(((i==null?void 0:i.layers)??1)-1,0),_=Math.min(f,p);return e.jsxs("div",{className:"stl-viewer gcode-viewer",ref:b,children:[W&&e.jsx("div",{className:"stl-viewer-status",children:t("fileViewerModal.loadingGcode")}),O&&e.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:O}),!W&&!O&&i&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"stl-viewer-toolbar gcode-viewer-toolbar",children:[e.jsx("span",{className:"stl-viewer-info",children:t("fileViewerModal.gcodeLayerSummary",{current:_+1,total:i.layers,z:(ne[_]??0).toFixed(2)})}),e.jsx(ze,{onView:J}),e.jsx("button",{type:"button",onClick:()=>J("iso"),children:t("fileViewerModal.resetView")}),e.jsx("button",{type:"button",className:N?"active":void 0,onClick:()=>oe(a=>!a),"aria-pressed":N,children:t("fileViewerModal.showTravel")}),e.jsx("button",{type:"button",className:B?"active":void 0,onClick:()=>de(a=>!a),"aria-expanded":B,children:t("fileViewerModal.printStats")})]}),e.jsxs("div",{className:"gcode-layer-control",children:[e.jsx("span",{children:t("fileViewerModal.layerRange",{bottom:g+1,top:f+1})}),e.jsxs("div",{className:"gcode-layer-slider",style:{"--gcode-bottom":`${p?g/p*100:0}%`,"--gcode-top":`${p?f/p*100:100}%`},children:[e.jsx("span",{className:"gcode-layer-track","aria-hidden":"true"}),e.jsx("span",{className:"gcode-layer-selection","aria-hidden":"true"}),e.jsx("input",{type:"range",min:"0",max:p,value:g,onChange:a=>Z(Math.min(Number(a.target.value),f)),"aria-label":t("fileViewerModal.layerBottom")}),e.jsx("input",{type:"range",min:"0",max:p,value:f,onChange:a=>q(Math.max(Number(a.target.value),g)),"aria-label":t("fileViewerModal.layerTop")})]})]}),B&&e.jsxs("aside",{className:"gcode-stats",children:[e.jsx("h3",{children:t("fileViewerModal.printStats")}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printTime")}),e.jsx("dd",{children:ae(i.estimatedTimeSeconds)})]}),i.firstLayerTimeSeconds!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.firstLayerTime")}),e.jsx("dd",{children:ae(i.firstLayerTimeSeconds)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.filament")}),e.jsxs("dd",{children:[se(i.filamentMm),i.filamentGrams!==void 0?` · ${i.filamentGrams.toFixed(2)} g`:""]})]}),i.filamentCm3!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.filamentVolume")}),e.jsxs("dd",{children:[i.filamentCm3.toFixed(2)," cm³"]})]}),i.material&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.material")}),e.jsx("dd",{children:i.material})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.layerCount")}),e.jsx("dd",{children:i.layers.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printSize")}),e.jsxs("dd",{children:[i.bounds.max.map((a,c)=>(a-i.bounds.min[c]).toFixed(1)).join(" × ")," mm"]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.toolpathDistance")}),e.jsx("dd",{children:se(i.printDistanceMm)})]}),i.nominalLayerHeight!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.layerHeight")}),e.jsxs("dd",{children:[i.nominalLayerHeight," mm"]})]}),i.nozzleDiameter!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.nozzle")}),e.jsxs("dd",{children:[i.nozzleDiameter," mm"]})]}),i.infill&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.infill")}),e.jsx("dd",{children:i.infill})]}),i.filamentCost!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.cost")}),e.jsx("dd",{children:i.filamentCost.toFixed(2)})]}),i.printer&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printer")}),e.jsx("dd",{title:i.printer,children:i.printer})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.slicer")}),e.jsx("dd",{title:i.slicer,children:i.slicer})]})]}),e.jsx("div",{className:"gcode-legend",children:Object.keys(G).filter(a=>a!=="travel").map(a=>e.jsxs("span",{children:[e.jsx("i",{style:{backgroundColor:`#${G[a].toString(16).padStart(6,"0")}`}}),t(`fileViewerModal.gcodePath.${a}`)]},a))})]}),e.jsx("div",{className:"stl-viewer-hint",children:t("fileViewerModal.controlsHint")}),e.jsx(Ne,{})]})]})}export{$e as GcodeViewer};
1
+ import{u as he,r as o,c as xe,j as e}from"./main-BTH4eRQ6.js";import{c as fe,d as pe,e as we,W as je,f as ge,L as ye,G as ve,B as Me,g as be,k as Ve,V as M,q as Se,A as Le,b as Ee}from"./vendor-three-DYBBrXTx.js";import{O as Ce}from"./OrbitControls-ANLmgNeR.js";import{T as ze,a as Ne}from"./ThreeViewShortcuts-BsuRkJQ3.js";import"./vendor-react--Eh9ivFN.js";const G={external:16739159,perimeter:16754984,infill:4434175,solid:14249215,support:6476936,skirt:11450308,other:4708048,travel:6516867};function ae(u){if(!Number.isFinite(u))return"—";const j=Math.max(0,Math.round(u)),t=Math.floor(j/3600),b=Math.floor(j%3600/60),x=j%60;return t>0?`${t} h ${b} min ${x} s`:`${b} min ${x} s`}function se(u){return u>=1e3?`${(u/1e3).toFixed(2)} m`:`${u.toFixed(1)} mm`}function $e({url:u,filename:j}){const{t}=he("terminal"),b=o.useRef(null),x=o.useRef([]),z=o.useRef([]),V=o.useRef(null),S=o.useRef(null),[W,$]=o.useState(!0),[O,U]=o.useState(null),[i,I]=o.useState(null),[ne,le]=o.useState([]),[g,Z]=o.useState(0),[f,q]=o.useState(0),[N,oe]=o.useState(!1),[B,de]=o.useState(!0);o.useEffect(()=>{const a=b.current;if(!a)return;const c=new AbortController,w=new Worker(new URL("/assets/gcode.worker-DayjyJb4.js",import.meta.url),{type:"module"});let L=!1,r=null,m=null,E=null,h=null;const Q=[],X=[];$(!0),U(null),I(null),x.current=[],z.current=[];const C=s=>{L||(U(s),$(!1))},ce=(s,F)=>{if(L||s.length===0){L||C(t("fileViewerModal.emptyGcode"));return}h=new fe,h.background=new pe(1053723);const d=new we(42,1,.01,1e5);d.up.set(0,0,1);try{r=new je({antialias:!0,logarithmicDepthBuffer:!0})}catch{C(t("fileViewerModal.webglUnavailable"));return}r.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),r.outputColorSpace=ge,r.domElement.className="stl-viewer-canvas",r.domElement.setAttribute("aria-label",t("fileViewerModal.gcodePreviewLabel",{filename:j})),r.domElement.tabIndex=0,a.appendChild(r.domElement),m=new Ce(d,r.domElement),m.screenSpacePanning=!0,m.addEventListener("change",()=>r==null?void 0:r.render(h,d)),V.current=()=>r==null?void 0:r.render(h,d);const Y=new Map;Object.keys(G).forEach(n=>{const l=new ye({color:G[n],transparent:n==="travel",opacity:n==="travel"?.3:.94,depthWrite:n!=="travel"});Y.set(n,l),X.push(l)});for(const n of s){const l=new ve;for(const[v,D]of Object.entries(n.paths)){if(!(D!=null&&D.length))continue;const H=new Me;H.setAttribute("position",new be(D,3));const K=new Ve(H,Y.get(v));K.userData.pathKind=v,v==="travel"&&z.current.push(K),l.add(K),Q.push(H)}h.add(l),x.current.push(l)}const T=new M(...F.bounds.min),ee=new M(...F.bounds.max),R=T.clone().add(ee).multiplyScalar(.5),y=ee.clone().sub(T),te=Math.max(y.length()/2,1),me=Math.max(Math.ceil(Math.max(y.x,y.y)/10)*10,10),P=new Se(me,10,4937320,2568253);P.rotation.x=Math.PI/2,P.position.set(R.x,R.y,T.z-.01),h.add(P);const ie=new Le(Math.max(y.x,y.y,y.z,1)*.22);ie.position.copy(T),h.add(ie);const k=Math.max(te/Math.sin(Ee.degToRad(d.fov/2))*1.18,5),A=n=>{const l=n==="x"?new M(1,0,0):n==="y"?new M(0,1,0):n==="z"?new M(0,0,1):new M(1,-1,.9).normalize();d.up.set(0,n==="z"?1:0,n==="z"?0:1),d.near=Math.max(k/5e3,.001),d.far=k*100,d.position.copy(R).add(l.multiplyScalar(k)),d.updateProjectionMatrix(),m.target.copy(R),m.minDistance=te*.03,m.maxDistance=k*20,m.update(),r.render(h,d)};S.current=A;const ue=n=>{if(n.ctrlKey||n.metaKey||n.altKey)return;const l=n.key.toLowerCase(),v=l==="x"||l==="1"?"x":l==="y"||l==="2"?"y":l==="z"||l==="3"?"z":l==="i"||l==="4"?"iso":null;v&&(n.preventDefault(),A(v))};r.domElement.addEventListener("pointerdown",()=>r==null?void 0:r.domElement.focus()),r.domElement.addEventListener("keydown",ue);const re=()=>{if(!r)return;const n=Math.max(a.clientWidth,1),l=Math.max(a.clientHeight,1);d.aspect=n/l,d.updateProjectionMatrix(),r.setSize(n,l,!1),r.render(h,d)};E=new ResizeObserver(re),E.observe(a),re(),A("iso"),I(F),le(s.map(n=>n.z)),Z(0),q(s.length-1),$(!1)};return w.onmessage=s=>{s.data.type==="error"?C(s.data.message):ce(s.data.layers,s.data.stats)},w.onerror=()=>C(t("fileViewerModal.gcodeLoadError")),xe(u,{signal:c.signal}).then(s=>{if(!s.ok)throw new Error(`Could not load G-code (${s.status})`);return s.arrayBuffer()}).then(s=>{L||w.postMessage(s,[s])}).catch(s=>{c.signal.aborted||C(s instanceof Error?s.message:t("fileViewerModal.gcodeLoadError"))}),()=>{L=!0,c.abort(),w.terminate(),E==null||E.disconnect(),m==null||m.dispose(),Q.forEach(s=>s.dispose()),X.forEach(s=>s.dispose()),r==null||r.dispose(),r==null||r.domElement.remove(),x.current=[],z.current=[],V.current=null,S.current=null}},[u,j,t]),o.useEffect(()=>{var a;x.current.forEach((c,w)=>{c.visible=w>=g&&w<=f}),z.current.forEach(c=>{c.visible=N}),(a=V.current)==null||a.call(V)},[g,f,N,i]);const J=o.useCallback(a=>{var c;return(c=S.current)==null?void 0:c.call(S,a)},[]),p=Math.max(((i==null?void 0:i.layers)??1)-1,0),_=Math.min(f,p);return e.jsxs("div",{className:"stl-viewer gcode-viewer",ref:b,children:[W&&e.jsx("div",{className:"stl-viewer-status",children:t("fileViewerModal.loadingGcode")}),O&&e.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:O}),!W&&!O&&i&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"stl-viewer-toolbar gcode-viewer-toolbar",children:[e.jsx("span",{className:"stl-viewer-info",children:t("fileViewerModal.gcodeLayerSummary",{current:_+1,total:i.layers,z:(ne[_]??0).toFixed(2)})}),e.jsx(ze,{onView:J}),e.jsx("button",{type:"button",onClick:()=>J("iso"),children:t("fileViewerModal.resetView")}),e.jsx("button",{type:"button",className:N?"active":void 0,onClick:()=>oe(a=>!a),"aria-pressed":N,children:t("fileViewerModal.showTravel")}),e.jsx("button",{type:"button",className:B?"active":void 0,onClick:()=>de(a=>!a),"aria-expanded":B,children:t("fileViewerModal.printStats")})]}),e.jsxs("div",{className:"gcode-layer-control",children:[e.jsx("span",{children:t("fileViewerModal.layerRange",{bottom:g+1,top:f+1})}),e.jsxs("div",{className:"gcode-layer-slider",style:{"--gcode-bottom":`${p?g/p*100:0}%`,"--gcode-top":`${p?f/p*100:100}%`},children:[e.jsx("span",{className:"gcode-layer-track","aria-hidden":"true"}),e.jsx("span",{className:"gcode-layer-selection","aria-hidden":"true"}),e.jsx("input",{type:"range",min:"0",max:p,value:g,onChange:a=>Z(Math.min(Number(a.target.value),f)),"aria-label":t("fileViewerModal.layerBottom")}),e.jsx("input",{type:"range",min:"0",max:p,value:f,onChange:a=>q(Math.max(Number(a.target.value),g)),"aria-label":t("fileViewerModal.layerTop")})]})]}),B&&e.jsxs("aside",{className:"gcode-stats",children:[e.jsx("h3",{children:t("fileViewerModal.printStats")}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printTime")}),e.jsx("dd",{children:ae(i.estimatedTimeSeconds)})]}),i.firstLayerTimeSeconds!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.firstLayerTime")}),e.jsx("dd",{children:ae(i.firstLayerTimeSeconds)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.filament")}),e.jsxs("dd",{children:[se(i.filamentMm),i.filamentGrams!==void 0?` · ${i.filamentGrams.toFixed(2)} g`:""]})]}),i.filamentCm3!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.filamentVolume")}),e.jsxs("dd",{children:[i.filamentCm3.toFixed(2)," cm³"]})]}),i.material&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.material")}),e.jsx("dd",{children:i.material})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.layerCount")}),e.jsx("dd",{children:i.layers.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printSize")}),e.jsxs("dd",{children:[i.bounds.max.map((a,c)=>(a-i.bounds.min[c]).toFixed(1)).join(" × ")," mm"]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.toolpathDistance")}),e.jsx("dd",{children:se(i.printDistanceMm)})]}),i.nominalLayerHeight!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.layerHeight")}),e.jsxs("dd",{children:[i.nominalLayerHeight," mm"]})]}),i.nozzleDiameter!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.nozzle")}),e.jsxs("dd",{children:[i.nozzleDiameter," mm"]})]}),i.infill&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.infill")}),e.jsx("dd",{children:i.infill})]}),i.filamentCost!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.cost")}),e.jsx("dd",{children:i.filamentCost.toFixed(2)})]}),i.printer&&e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.printer")}),e.jsx("dd",{title:i.printer,children:i.printer})]}),e.jsxs("div",{children:[e.jsx("dt",{children:t("fileViewerModal.slicer")}),e.jsx("dd",{title:i.slicer,children:i.slicer})]})]}),e.jsx("div",{className:"gcode-legend",children:Object.keys(G).filter(a=>a!=="travel").map(a=>e.jsxs("span",{children:[e.jsx("i",{style:{backgroundColor:`#${G[a].toString(16).padStart(6,"0")}`}}),t(`fileViewerModal.gcodePath.${a}`)]},a))})]}),e.jsx("div",{className:"stl-viewer-hint",children:t("fileViewerModal.controlsHint")}),e.jsx(Ne,{})]})]})}export{$e as GcodeViewer};
@@ -1 +1 @@
1
- import{u as Ne,r as e,c as $e,N as We,d as Ue,a7 as Be,j as p}from"./main-Dk3qq80S.js";import{V as A,c as He,d as fe,e as Ke,W as Xe,f as Ye,n as qe,H as Je,D as Re,o as Qe,j as Le,l as Ze,E as _e,L as et,k as tt,A as nt,b as rt,a as st,m as ot,p as at}from"./vendor-three-DYBBrXTx.js";import{O as it}from"./OrbitControls-ANLmgNeR.js";import{g as lt,v as ct,u as ut,a as dt,d as je,s as ft,c as pt,T as ht,b as mt}from"./ThreeAreaSelector-Bj_mL6NG.js";import{T as gt,a as wt}from"./ThreeViewShortcuts-CKtE3yZV.js";import"./vendor-react--Eh9ivFN.js";function ke(a){return"color"in a&&a.color instanceof fe}function yt(a){return Number.isFinite(a)?a>=100?a.toFixed(0):a>=10?a.toFixed(1):a.toFixed(2):"0"}function bt(a,O){const I=a.replace(/\\/g,"/"),ee=I.lastIndexOf("/"),h=ee>=0?I.slice(0,ee+1):"",G=O.split(/[?#]/,1)[0];let M=G;try{M=decodeURIComponent(G)}catch{}if(M.startsWith("/"))return M;const L=`${h}${M}`.split("/"),c=[];for(const x of L)!x||x==="."||(x===".."?c.pop():c.push(x));return`${I.startsWith("/")?"/":""}${c.join("/")}`}function Rt({url:a,filename:O,filePath:I,onFileSelect:ee}){const{t:h}=Ne("terminal"),G=e.useRef(null),M=e.useRef(null),L=e.useRef(null),c=e.useRef(null),x=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),N=e.useRef(null),$=e.useRef([]),re=e.useRef(new A),ye=e.useRef(1),P=e.useRef(null),se=e.useRef([]),oe=e.useRef([]),pe=e.useRef(null),[be,T]=e.useState(!0),[he,W]=e.useState(null),[C,Me]=e.useState(null),[xe,Ae]=e.useState(!1),[V]=e.useState(lt),[U,Oe]=e.useState(V.modelColor),[B,Pe]=e.useState(V.backgroundColor),[H,Te]=e.useState(V.lightIntensity),[K,Ve]=e.useState(V.modelOpacity),[X,De]=e.useState(V.showEdges),[Y,Ce]=e.useState(V.preserveModelColors),[Se,me]=e.useState(!1),[j,ae]=e.useState(null),[D,ie]=e.useState([]),[ge,le]=e.useState(null),q=I||ct(a),ze=ut(q,O,"glb");dt({enabled:!!C&&j===null,rendererRef:ne,cameraRef:te,controlsRef:N,modelObjectsRef:$,modelCenterRef:re,markerGroupRef:P,renderRef:c,setAreas:ie,setSelectedId:le}),e.useEffect(()=>{const n=G.current;if(!n)return;const d=new AbortController;let t=!1,m=null,u=null;const J=[],S=[];T(!0),W(null),Me(null),se.current=[],oe.current=[],$.current=[];const g=new He;g.background=new fe(1119258),x.current=g;const i=new Ke(40,1,.01,1e5);i.up.set(0,1,0),te.current=i;let s;try{s=new Xe({antialias:!0})}catch{T(!1),W(h("fileViewerModal.webglUnavailable"));return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),s.outputColorSpace=Ye,s.toneMapping=qe,s.toneMappingExposure=1.05,s.domElement.className="stl-viewer-canvas",s.domElement.setAttribute("aria-label",h("fileViewerModal.glbPreviewLabel",{filename:O})),ne.current=s,n.appendChild(s.domElement);const w=new it(i,s.domElement);w.screenSpacePanning=!0,w.addEventListener("change",()=>s.render(g,i)),N.current=w;const ce=new Je(16777215,2502724,2.1),Q=new Re(16777215,2.3);Q.position.set(3,-4,6);const k=new Re(8040191,.9);k.position.set(-4,3,1),g.add(ce,Q,k),pe.current={hemisphere:ce,key:Q,fill:k},c.current=()=>s.render(g,i);const Z=()=>{const r=Math.max(n.clientWidth,1),y=Math.max(n.clientHeight,1);i.aspect=r/y,i.updateProjectionMatrix(),s.setSize(r,y,!1),s.render(g,i)},_=new ResizeObserver(Z);_.observe(n),Z();const we=r=>{if(t)return;m=r;const y=[],E=new Set;let v=0;if(r.traverse(o=>{var F;if(!(o instanceof Le))return;y.push(o),$.current.push(o);const l=o.geometry;v+=l.index?l.index.count/3:(((F=l.getAttribute("position"))==null?void 0:F.count)??0)/3,(Array.isArray(o.material)?o.material:[o.material]).forEach(b=>{E.has(b)||(E.add(b),b.userData.originalOpacity=b.opacity,b.userData.originalTransparent=b.transparent,b.userData.originalDepthWrite=b.depthWrite,ke(b)&&(b.userData.originalColor=b.color.clone()))})}),y.length===0){W(h("fileViewerModal.emptyGlb")),T(!1);return}se.current=[...E],g.add(r);const R=new Ze().setFromObject(r),f=R.getSize(new A),Ee=R.getCenter(new A);if(re.current.copy(Ee),ye.current=Math.max(f.x,f.y,f.z,.001)*.12,r.position.sub(Ee),v<=25e4)for(const o of y){const l=new _e(o.geometry,28),z=new et({color:1516076,transparent:!0,opacity:.5}),F=new tt(l,z);F.visible=!1,o.add(F),J.push(l),S.push(z),oe.current.push(F)}const Ge=Math.max(f.x,f.y,f.z,.001)*.3;u=new nt(Ge),u.position.set(-f.x/2,-f.y/2,-f.z/2),g.add(u);const ve=Math.max(f.length()/2,.001),ue=Math.max(ve/Math.sin(rt.degToRad(i.fov/2))*1.18,.01),de=o=>{const l=o==="x"?new A(1,0,0):o==="y"?new A(0,1,0):o==="z"?new A(0,0,1):new A(1,.8,1).normalize();i.up.set(0,o==="y"?0:1,o==="y"?-1:0),i.near=Math.max(ue/1e3,1e-4),i.far=Math.max(ue*100,10),i.position.copy(l.multiplyScalar(ue)),i.updateProjectionMatrix(),w.target.set(0,0,0),w.minDistance=ve*.05,w.maxDistance=ue*20,w.update(),s.render(g,i)};L.current=de,M.current=()=>de("iso"),de("iso"),s.domElement.tabIndex=0,s.domElement.addEventListener("pointerdown",()=>s.domElement.focus()),s.domElement.addEventListener("keydown",o=>{if(o.ctrlKey||o.metaKey||o.altKey)return;const l=o.key.toLowerCase(),z=l==="x"||l==="1"?"x":l==="y"||l==="2"?"y":l==="z"||l==="3"?"z":l==="i"||l==="4"?"iso":null;z&&(o.preventDefault(),de(z))}),Me({objects:y.length,triangles:Math.floor(v),dimensions:[f.x,f.y,f.z]}),T(!1)};return $e(a,{signal:d.signal}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.arrayBuffer()}).then(r=>{if(t)return;const y=new Qe,E=We(),v=a.includes("/git-original-binary")?"/api/files/git-original-binary":"/api/files/binary";y.setURLModifier(R=>{if(/^(?:blob:|data:|https?:)/i.test(R))return R;const f=bt(q,R);return Ue(`${v}?path=${encodeURIComponent(f)}${E?`&token=${encodeURIComponent(E)}`:""}`)}),new Be(y).parse(r,"",R=>we(R.scene),()=>{t||(W(h("fileViewerModal.glbLoadError")),T(!1))})}).catch(()=>{!t&&!d.signal.aborted&&(W(h("fileViewerModal.glbLoadError")),T(!1))}),()=>{t=!0,d.abort(),je(P.current),P.current=null,_.disconnect(),w.dispose(),m==null||m.traverse(r=>{if(!(r instanceof Le))return;r.geometry.dispose(),(Array.isArray(r.material)?r.material:[r.material]).forEach(E=>{for(const v of Object.values(E))v instanceof at&&v.dispose();E.dispose()})}),J.forEach(r=>r.dispose()),S.forEach(r=>r.dispose()),u==null||u.geometry.dispose(),u&&(Array.isArray(u.material)?u.material:[u.material]).forEach(r=>r.dispose()),s.dispose(),s.domElement.remove(),x.current=null,te.current=null,ne.current=null,N.current=null,c.current=null,$.current=[],se.current=[],oe.current=[],pe.current=null,M.current=null,L.current=null}},[a,O,q,h]),e.useEffect(()=>{var d;x.current&&(x.current.background=new fe(B));for(const t of se.current){if(ke(t)){const u=t.userData.originalColor;Y&&u instanceof fe?t.color.copy(u):t.color.set(U)}const m=typeof t.userData.originalOpacity=="number"?t.userData.originalOpacity:1;t.opacity=m*K/100,t.transparent=t.userData.originalTransparent===!0||t.opacity<1,t.depthWrite=t.userData.originalDepthWrite!==!1&&t.opacity>=1,t.needsUpdate=!0}oe.current.forEach(t=>{t.visible=X});const n=pe.current;if(n){const t=H/100;n.hemisphere.intensity=2.1*t,n.key.intensity=2.3*t,n.fill.intensity=.9*t}(d=c.current)==null||d.call(c)},[U,B,H,K,X,Y,C]),e.useEffect(()=>{ft({modelColor:U,backgroundColor:B,lightIntensity:H,modelOpacity:K,showEdges:X,preserveModelColors:Y})},[U,B,H,K,X,Y]),e.useEffect(()=>{ie([]),le(null),ae(null),me(!1)},[a]),e.useEffect(()=>{N.current&&(N.current.enabled=j===null);const n=ne.current,d=te.current;if(!n||!d||!C||!j)return;const t=n.domElement;let m=null;const u=S=>{m=[S.clientX,S.clientY]},J=S=>{var _;if(!m||Math.hypot(S.clientX-m[0],S.clientY-m[1])>5)return;const g=t.getBoundingClientRect(),i=new st((S.clientX-g.left)/g.width*2-1,-((S.clientY-g.top)/g.height)*2+1),s=new ot;s.setFromCamera(i,d);const w=s.intersectObjects($.current,!1)[0];if(!w)return;const ce=w.point.clone().add(re.current).toArray(),Q=(_=w.face)==null?void 0:_.normal.clone().transformDirection(w.object.matrixWorld).toArray(),k=ye.current,Z=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;ie(we=>[...we,{id:Z,shape:j,center:ce,size:[k,k,k],objectName:w.object.name||void 0,surfaceNormal:Q}]),le(Z)};return t.addEventListener("pointerdown",u),t.addEventListener("pointerup",J),()=>{t.removeEventListener("pointerdown",u),t.removeEventListener("pointerup",J)}},[j,C]),e.useEffect(()=>{var t,m;je(P.current),P.current=null;const n=x.current;if(!n||D.length===0){(t=c.current)==null||t.call(c);return}const d=pt(D,re.current,ge);P.current=d,n.add(d),(m=c.current)==null||m.call(c)},[D,ge,C]);const Fe=e.useCallback(()=>{var n;return(n=M.current)==null?void 0:n.call(M)},[]),Ie=e.useCallback(n=>{var d;return(d=L.current)==null?void 0:d.call(L,n)},[]);return p.jsxs("div",{className:`stl-viewer glb-viewer${j?" area-placement-active":""}`,ref:G,children:[be&&p.jsx("div",{className:"stl-viewer-status",children:h("fileViewerModal.loadingGlb")}),he&&p.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:he}),!be&&!he&&C&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"stl-viewer-toolbar",children:[p.jsxs("span",{className:"stl-viewer-info",children:[h("fileViewerModal.glbStats",{objects:C.objects.toLocaleString(),triangles:C.triangles.toLocaleString()})," · ",C.dimensions.map(yt).join(" × ")]}),p.jsx(gt,{onView:Ie}),p.jsx("button",{type:"button",onClick:Fe,children:h("fileViewerModal.resetView")}),p.jsxs("button",{type:"button",className:Se?"active":void 0,onClick:()=>{me(n=>!n),ae(null)},children:[h("fileViewerModal.areas"),D.length?` (${D.length})`:""]}),p.jsx("button",{type:"button",className:xe?"active":void 0,onClick:()=>Ae(n=>!n),children:h("fileViewerModal.viewerSettings")})]}),xe&&p.jsx(ht,{modelColor:U,onModelColorChange:n=>{Oe(n),Ce(!1)},backgroundColor:B,onBackgroundColorChange:Pe,lightIntensity:H,onLightIntensityChange:Te,modelOpacity:K,onModelOpacityChange:Ve,showEdges:X,onShowEdgesChange:De,preserveModelColors:Y,onPreserveModelColorsChange:Ce,recentFiles:ze,currentFilePath:q,onRecentFileSelect:ee}),Se&&p.jsx(mt,{areas:D,selectedId:ge,placementShape:j,filename:O,filePath:q,modelExtent:Math.max(...C.dimensions),onPlacementShapeChange:ae,onSelectedIdChange:le,onAreasChange:ie,onClose:()=>{me(!1),ae(null)}}),p.jsx("div",{className:"stl-viewer-hint",children:h("fileViewerModal.controlsHint")}),p.jsx(wt,{})]})]})}export{Rt as GlbViewer,bt as resolveGlbResourcePath};
1
+ import{u as Ne,r as e,c as $e,N as We,d as Ue,a7 as Be,j as p}from"./main-BTH4eRQ6.js";import{V as A,c as He,d as fe,e as Ke,W as Xe,f as Ye,n as qe,H as Je,D as Re,o as Qe,j as Le,l as Ze,E as _e,L as et,k as tt,A as nt,b as rt,a as st,m as ot,p as at}from"./vendor-three-DYBBrXTx.js";import{O as it}from"./OrbitControls-ANLmgNeR.js";import{g as lt,v as ct,u as ut,a as dt,d as je,s as ft,c as pt,T as ht,b as mt}from"./ThreeAreaSelector-61KRvl6V.js";import{T as gt,a as wt}from"./ThreeViewShortcuts-BsuRkJQ3.js";import"./vendor-react--Eh9ivFN.js";function ke(a){return"color"in a&&a.color instanceof fe}function yt(a){return Number.isFinite(a)?a>=100?a.toFixed(0):a>=10?a.toFixed(1):a.toFixed(2):"0"}function bt(a,O){const I=a.replace(/\\/g,"/"),ee=I.lastIndexOf("/"),h=ee>=0?I.slice(0,ee+1):"",G=O.split(/[?#]/,1)[0];let M=G;try{M=decodeURIComponent(G)}catch{}if(M.startsWith("/"))return M;const L=`${h}${M}`.split("/"),c=[];for(const x of L)!x||x==="."||(x===".."?c.pop():c.push(x));return`${I.startsWith("/")?"/":""}${c.join("/")}`}function Rt({url:a,filename:O,filePath:I,onFileSelect:ee}){const{t:h}=Ne("terminal"),G=e.useRef(null),M=e.useRef(null),L=e.useRef(null),c=e.useRef(null),x=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),N=e.useRef(null),$=e.useRef([]),re=e.useRef(new A),ye=e.useRef(1),P=e.useRef(null),se=e.useRef([]),oe=e.useRef([]),pe=e.useRef(null),[be,T]=e.useState(!0),[he,W]=e.useState(null),[C,Me]=e.useState(null),[xe,Ae]=e.useState(!1),[V]=e.useState(lt),[U,Oe]=e.useState(V.modelColor),[B,Pe]=e.useState(V.backgroundColor),[H,Te]=e.useState(V.lightIntensity),[K,Ve]=e.useState(V.modelOpacity),[X,De]=e.useState(V.showEdges),[Y,Ce]=e.useState(V.preserveModelColors),[Se,me]=e.useState(!1),[j,ae]=e.useState(null),[D,ie]=e.useState([]),[ge,le]=e.useState(null),q=I||ct(a),ze=ut(q,O,"glb");dt({enabled:!!C&&j===null,rendererRef:ne,cameraRef:te,controlsRef:N,modelObjectsRef:$,modelCenterRef:re,markerGroupRef:P,renderRef:c,setAreas:ie,setSelectedId:le}),e.useEffect(()=>{const n=G.current;if(!n)return;const d=new AbortController;let t=!1,m=null,u=null;const J=[],S=[];T(!0),W(null),Me(null),se.current=[],oe.current=[],$.current=[];const g=new He;g.background=new fe(1119258),x.current=g;const i=new Ke(40,1,.01,1e5);i.up.set(0,1,0),te.current=i;let s;try{s=new Xe({antialias:!0})}catch{T(!1),W(h("fileViewerModal.webglUnavailable"));return}s.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),s.outputColorSpace=Ye,s.toneMapping=qe,s.toneMappingExposure=1.05,s.domElement.className="stl-viewer-canvas",s.domElement.setAttribute("aria-label",h("fileViewerModal.glbPreviewLabel",{filename:O})),ne.current=s,n.appendChild(s.domElement);const w=new it(i,s.domElement);w.screenSpacePanning=!0,w.addEventListener("change",()=>s.render(g,i)),N.current=w;const ce=new Je(16777215,2502724,2.1),Q=new Re(16777215,2.3);Q.position.set(3,-4,6);const k=new Re(8040191,.9);k.position.set(-4,3,1),g.add(ce,Q,k),pe.current={hemisphere:ce,key:Q,fill:k},c.current=()=>s.render(g,i);const Z=()=>{const r=Math.max(n.clientWidth,1),y=Math.max(n.clientHeight,1);i.aspect=r/y,i.updateProjectionMatrix(),s.setSize(r,y,!1),s.render(g,i)},_=new ResizeObserver(Z);_.observe(n),Z();const we=r=>{if(t)return;m=r;const y=[],E=new Set;let v=0;if(r.traverse(o=>{var F;if(!(o instanceof Le))return;y.push(o),$.current.push(o);const l=o.geometry;v+=l.index?l.index.count/3:(((F=l.getAttribute("position"))==null?void 0:F.count)??0)/3,(Array.isArray(o.material)?o.material:[o.material]).forEach(b=>{E.has(b)||(E.add(b),b.userData.originalOpacity=b.opacity,b.userData.originalTransparent=b.transparent,b.userData.originalDepthWrite=b.depthWrite,ke(b)&&(b.userData.originalColor=b.color.clone()))})}),y.length===0){W(h("fileViewerModal.emptyGlb")),T(!1);return}se.current=[...E],g.add(r);const R=new Ze().setFromObject(r),f=R.getSize(new A),Ee=R.getCenter(new A);if(re.current.copy(Ee),ye.current=Math.max(f.x,f.y,f.z,.001)*.12,r.position.sub(Ee),v<=25e4)for(const o of y){const l=new _e(o.geometry,28),z=new et({color:1516076,transparent:!0,opacity:.5}),F=new tt(l,z);F.visible=!1,o.add(F),J.push(l),S.push(z),oe.current.push(F)}const Ge=Math.max(f.x,f.y,f.z,.001)*.3;u=new nt(Ge),u.position.set(-f.x/2,-f.y/2,-f.z/2),g.add(u);const ve=Math.max(f.length()/2,.001),ue=Math.max(ve/Math.sin(rt.degToRad(i.fov/2))*1.18,.01),de=o=>{const l=o==="x"?new A(1,0,0):o==="y"?new A(0,1,0):o==="z"?new A(0,0,1):new A(1,.8,1).normalize();i.up.set(0,o==="y"?0:1,o==="y"?-1:0),i.near=Math.max(ue/1e3,1e-4),i.far=Math.max(ue*100,10),i.position.copy(l.multiplyScalar(ue)),i.updateProjectionMatrix(),w.target.set(0,0,0),w.minDistance=ve*.05,w.maxDistance=ue*20,w.update(),s.render(g,i)};L.current=de,M.current=()=>de("iso"),de("iso"),s.domElement.tabIndex=0,s.domElement.addEventListener("pointerdown",()=>s.domElement.focus()),s.domElement.addEventListener("keydown",o=>{if(o.ctrlKey||o.metaKey||o.altKey)return;const l=o.key.toLowerCase(),z=l==="x"||l==="1"?"x":l==="y"||l==="2"?"y":l==="z"||l==="3"?"z":l==="i"||l==="4"?"iso":null;z&&(o.preventDefault(),de(z))}),Me({objects:y.length,triangles:Math.floor(v),dimensions:[f.x,f.y,f.z]}),T(!1)};return $e(a,{signal:d.signal}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.arrayBuffer()}).then(r=>{if(t)return;const y=new Qe,E=We(),v=a.includes("/git-original-binary")?"/api/files/git-original-binary":"/api/files/binary";y.setURLModifier(R=>{if(/^(?:blob:|data:|https?:)/i.test(R))return R;const f=bt(q,R);return Ue(`${v}?path=${encodeURIComponent(f)}${E?`&token=${encodeURIComponent(E)}`:""}`)}),new Be(y).parse(r,"",R=>we(R.scene),()=>{t||(W(h("fileViewerModal.glbLoadError")),T(!1))})}).catch(()=>{!t&&!d.signal.aborted&&(W(h("fileViewerModal.glbLoadError")),T(!1))}),()=>{t=!0,d.abort(),je(P.current),P.current=null,_.disconnect(),w.dispose(),m==null||m.traverse(r=>{if(!(r instanceof Le))return;r.geometry.dispose(),(Array.isArray(r.material)?r.material:[r.material]).forEach(E=>{for(const v of Object.values(E))v instanceof at&&v.dispose();E.dispose()})}),J.forEach(r=>r.dispose()),S.forEach(r=>r.dispose()),u==null||u.geometry.dispose(),u&&(Array.isArray(u.material)?u.material:[u.material]).forEach(r=>r.dispose()),s.dispose(),s.domElement.remove(),x.current=null,te.current=null,ne.current=null,N.current=null,c.current=null,$.current=[],se.current=[],oe.current=[],pe.current=null,M.current=null,L.current=null}},[a,O,q,h]),e.useEffect(()=>{var d;x.current&&(x.current.background=new fe(B));for(const t of se.current){if(ke(t)){const u=t.userData.originalColor;Y&&u instanceof fe?t.color.copy(u):t.color.set(U)}const m=typeof t.userData.originalOpacity=="number"?t.userData.originalOpacity:1;t.opacity=m*K/100,t.transparent=t.userData.originalTransparent===!0||t.opacity<1,t.depthWrite=t.userData.originalDepthWrite!==!1&&t.opacity>=1,t.needsUpdate=!0}oe.current.forEach(t=>{t.visible=X});const n=pe.current;if(n){const t=H/100;n.hemisphere.intensity=2.1*t,n.key.intensity=2.3*t,n.fill.intensity=.9*t}(d=c.current)==null||d.call(c)},[U,B,H,K,X,Y,C]),e.useEffect(()=>{ft({modelColor:U,backgroundColor:B,lightIntensity:H,modelOpacity:K,showEdges:X,preserveModelColors:Y})},[U,B,H,K,X,Y]),e.useEffect(()=>{ie([]),le(null),ae(null),me(!1)},[a]),e.useEffect(()=>{N.current&&(N.current.enabled=j===null);const n=ne.current,d=te.current;if(!n||!d||!C||!j)return;const t=n.domElement;let m=null;const u=S=>{m=[S.clientX,S.clientY]},J=S=>{var _;if(!m||Math.hypot(S.clientX-m[0],S.clientY-m[1])>5)return;const g=t.getBoundingClientRect(),i=new st((S.clientX-g.left)/g.width*2-1,-((S.clientY-g.top)/g.height)*2+1),s=new ot;s.setFromCamera(i,d);const w=s.intersectObjects($.current,!1)[0];if(!w)return;const ce=w.point.clone().add(re.current).toArray(),Q=(_=w.face)==null?void 0:_.normal.clone().transformDirection(w.object.matrixWorld).toArray(),k=ye.current,Z=`area-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;ie(we=>[...we,{id:Z,shape:j,center:ce,size:[k,k,k],objectName:w.object.name||void 0,surfaceNormal:Q}]),le(Z)};return t.addEventListener("pointerdown",u),t.addEventListener("pointerup",J),()=>{t.removeEventListener("pointerdown",u),t.removeEventListener("pointerup",J)}},[j,C]),e.useEffect(()=>{var t,m;je(P.current),P.current=null;const n=x.current;if(!n||D.length===0){(t=c.current)==null||t.call(c);return}const d=pt(D,re.current,ge);P.current=d,n.add(d),(m=c.current)==null||m.call(c)},[D,ge,C]);const Fe=e.useCallback(()=>{var n;return(n=M.current)==null?void 0:n.call(M)},[]),Ie=e.useCallback(n=>{var d;return(d=L.current)==null?void 0:d.call(L,n)},[]);return p.jsxs("div",{className:`stl-viewer glb-viewer${j?" area-placement-active":""}`,ref:G,children:[be&&p.jsx("div",{className:"stl-viewer-status",children:h("fileViewerModal.loadingGlb")}),he&&p.jsx("div",{className:"stl-viewer-status stl-viewer-error",children:he}),!be&&!he&&C&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"stl-viewer-toolbar",children:[p.jsxs("span",{className:"stl-viewer-info",children:[h("fileViewerModal.glbStats",{objects:C.objects.toLocaleString(),triangles:C.triangles.toLocaleString()})," · ",C.dimensions.map(yt).join(" × ")]}),p.jsx(gt,{onView:Ie}),p.jsx("button",{type:"button",onClick:Fe,children:h("fileViewerModal.resetView")}),p.jsxs("button",{type:"button",className:Se?"active":void 0,onClick:()=>{me(n=>!n),ae(null)},children:[h("fileViewerModal.areas"),D.length?` (${D.length})`:""]}),p.jsx("button",{type:"button",className:xe?"active":void 0,onClick:()=>Ae(n=>!n),children:h("fileViewerModal.viewerSettings")})]}),xe&&p.jsx(ht,{modelColor:U,onModelColorChange:n=>{Oe(n),Ce(!1)},backgroundColor:B,onBackgroundColorChange:Pe,lightIntensity:H,onLightIntensityChange:Te,modelOpacity:K,onModelOpacityChange:Ve,showEdges:X,onShowEdgesChange:De,preserveModelColors:Y,onPreserveModelColorsChange:Ce,recentFiles:ze,currentFilePath:q,onRecentFileSelect:ee}),Se&&p.jsx(mt,{areas:D,selectedId:ge,placementShape:j,filename:O,filePath:q,modelExtent:Math.max(...C.dimensions),onPlacementShapeChange:ae,onSelectedIdChange:le,onAreasChange:ie,onClose:()=>{me(!1),ae(null)}}),p.jsx("div",{className:"stl-viewer-hint",children:h("fileViewerModal.controlsHint")}),p.jsx(wt,{})]})]})}export{Rt as GlbViewer,bt as resolveGlbResourcePath};