tmex-cli 0.16.3 → 0.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +5 -13
  2. package/dist/runtime/server.js +277 -50
  3. package/package.json +1 -1
  4. package/resources/fe-dist/assets/{DevicePage-DtByPprm.js → DevicePage-BIjGEtCP.js} +1 -1
  5. package/resources/fe-dist/assets/{DevicesPage-WMW0FcaU.js → DevicesPage-XMtf7VIy.js} +1 -1
  6. package/resources/fe-dist/assets/{FilePage-C3yjgRDh.js → FilePage-C1_JLsEc.js} +1 -1
  7. package/resources/fe-dist/assets/{SettingsPage-CKZEPwEq.js → SettingsPage-BAx39LyM.js} +1 -1
  8. package/resources/fe-dist/assets/{agent-tab-B77EotmX.js → agent-tab-BgvIAv35.js} +1 -1
  9. package/resources/fe-dist/assets/{api-DZDjPn8l.js → api-Dto6Spgl.js} +1 -1
  10. package/resources/fe-dist/assets/{arc-DNrUdLWP.js → arc-BX-Po9p7.js} +1 -1
  11. package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-B5DYf-5o.js → architectureDiagram-3BPJPVTR-BneOtjGd.js} +1 -1
  12. package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-DSgjcUbw.js → blockDiagram-GPEHLZMM-Dcf0shYG.js} +1 -1
  13. package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-DKjqulHT.js → c4Diagram-AAUBKEIU-Cwhji_wO.js} +1 -1
  14. package/resources/fe-dist/assets/{card-DWQzPt-3.js → card-IkOsEv2J.js} +1 -1
  15. package/resources/fe-dist/assets/channel-DD10rSnh.js +1 -0
  16. package/resources/fe-dist/assets/{chunk-2J33WTMH-DHQ_-AlN.js → chunk-2J33WTMH-IFwQoyns.js} +1 -1
  17. package/resources/fe-dist/assets/{chunk-4BX2VUAB-C7sszhBq.js → chunk-4BX2VUAB-BZhwH7K2.js} +1 -1
  18. package/resources/fe-dist/assets/{chunk-55IACEB6-BkPT2okv.js → chunk-55IACEB6-pYNojBsx.js} +1 -1
  19. package/resources/fe-dist/assets/{chunk-727SXJPM-BsD5c54G.js → chunk-727SXJPM-BwBn-X-G.js} +1 -1
  20. package/resources/fe-dist/assets/{chunk-AQP2D5EJ-Dx3mc4xO.js → chunk-AQP2D5EJ-Cv5U78aO.js} +1 -1
  21. package/resources/fe-dist/assets/{chunk-FMBD7UC4-CyZO-UAp.js → chunk-FMBD7UC4-DnaDXP2z.js} +1 -1
  22. package/resources/fe-dist/assets/{chunk-ND2GUHAM-DNxRBeA7.js → chunk-ND2GUHAM-BCRcaTWl.js} +1 -1
  23. package/resources/fe-dist/assets/{chunk-QZHKN3VN-DsPa138W.js → chunk-QZHKN3VN-1sPBtZCH.js} +1 -1
  24. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-CEWAB_yV.js +1 -0
  25. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-CEWAB_yV.js +1 -0
  26. package/resources/fe-dist/assets/{copy-DwXKDgGT.js → copy-CJIriuQt.js} +1 -1
  27. package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-C1d180_v.js → cose-bilkent-S5V4N54A-CY6ERT7s.js} +1 -1
  28. package/resources/fe-dist/assets/{dagre-BM42HDAG-Bv8hvnH7.js → dagre-BM42HDAG-c_oJjVCK.js} +1 -1
  29. package/resources/fe-dist/assets/{diagram-2AECGRRQ-DfbJBHI6.js → diagram-2AECGRRQ-g-DJAnzv.js} +1 -1
  30. package/resources/fe-dist/assets/{diagram-5GNKFQAL-COnOrAiu.js → diagram-5GNKFQAL-0DikWL30.js} +1 -1
  31. package/resources/fe-dist/assets/{diagram-KO2AKTUF-BOtU5EdV.js → diagram-KO2AKTUF-wWVJH7kq.js} +1 -1
  32. package/resources/fe-dist/assets/{diagram-LMA3HP47-B-WcT-Mc.js → diagram-LMA3HP47-UwQ9OpsG.js} +1 -1
  33. package/resources/fe-dist/assets/{diagram-OG6HWLK6-BptGbu0F.js → diagram-OG6HWLK6-ZFNNtnbo.js} +1 -1
  34. package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-H06uoCHU.js → erDiagram-TEJ5UH35-D3na7WWE.js} +1 -1
  35. package/resources/fe-dist/assets/{files-tab-C841Mmn_.js → files-tab-1FVCHULV.js} +1 -1
  36. package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-QOk_IVWN.js → flowDiagram-I6XJVG4X-Dsbf9z99.js} +1 -1
  37. package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-Q7s2jHyi.js → ganttDiagram-6RSMTGT7-CF3CKflH.js} +1 -1
  38. package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-Q7tAtx1u.js → gitGraphDiagram-PVQCEYII-CRpX3WPf.js} +1 -1
  39. package/resources/fe-dist/assets/{index-C2v9tHtI.js → index-C-RSAqjj.js} +1 -1
  40. package/resources/fe-dist/assets/index-C4Fdxowt.css +1 -0
  41. package/resources/fe-dist/assets/{index-Dc3Fwpho.js → index-U4iZ6Kxr.js} +2 -2
  42. package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-B9n7MrtF.js → infoDiagram-5YYISTIA-DMCNm7PZ.js} +1 -1
  43. package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-oZeau8IS.js → ishikawaDiagram-YF4QCWOH-CMe-J41c.js} +1 -1
  44. package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-ClXjUmc1.js → journeyDiagram-JHISSGLW-CxFZDT81.js} +1 -1
  45. package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-Cwn4VzH2.js → kanban-definition-UN3LZRKU-DwBxD_Gg.js} +1 -1
  46. package/resources/fe-dist/assets/{linear-BNOQBDiB.js → linear-CBM17AV1.js} +1 -1
  47. package/resources/fe-dist/assets/{markdown-preview-BsYVAcJ1.js → markdown-preview-CVeuDkuY.js} +3 -3
  48. package/resources/fe-dist/assets/{mermaid.core-C3nmuA6R.js → mermaid.core-CvSv2dqw.js} +5 -5
  49. package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-BKstxajf.js → mindmap-definition-RKZ34NQL-DUu53RHy.js} +1 -1
  50. package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-D_2bHoC9.js → pieDiagram-4H26LBE5-CAbw9YBY.js} +1 -1
  51. package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-D6K_QmUy.js → quadrantDiagram-W4KKPZXB-NmJUURAz.js} +1 -1
  52. package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-B1SWUDkA.js → requirementDiagram-4Y6WPE33-B45iu7jV.js} +1 -1
  53. package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-DPmalO0b.js → sankeyDiagram-5OEKKPKP-af9JvT_p.js} +1 -1
  54. package/resources/fe-dist/assets/{send-J45szXFM.js → send-e_FTy5nC.js} +1 -1
  55. package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-C08DcZug.js → sequenceDiagram-3UESZ5HK-CSpSOeHp.js} +1 -1
  56. package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-K9bVAVhg.js → stateDiagram-AJRCARHV-vM6MSoBd.js} +1 -1
  57. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-8FQLtPkV.js +1 -0
  58. package/resources/fe-dist/assets/{terminal-settings-panel-tZuaqdqz.js → terminal-settings-panel-DU9rOuZd.js} +1 -1
  59. package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-DG0FtOvK.js → timeline-definition-PNZ67QCA-A63tNc2d.js} +1 -1
  60. package/resources/fe-dist/assets/{transfer-toast-D72q4082.js → transfer-toast-CmSO0e95.js} +1 -1
  61. package/resources/fe-dist/assets/{triangle-alert-CagsqsWp.js → triangle-alert-jNMwsJMj.js} +1 -1
  62. package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-CKBEKUkA.js → vennDiagram-CIIHVFJN-BktPK2LC.js} +1 -1
  63. package/resources/fe-dist/assets/{wardley-L42UT6IY-DTlpnptg.js → wardley-L42UT6IY-viU1xsE2.js} +1 -1
  64. package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-CnwEikRb.js → wardleyDiagram-YWT4CUSO-DICOr7Mv.js} +1 -1
  65. package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-uaYRX4Ue.js → xychartDiagram-2RQKCTM6-bjue7pS9.js} +1 -1
  66. package/resources/fe-dist/assets/{zap-DcJ8Gp1I.js → zap-ClXbg92C.js} +1 -1
  67. package/resources/fe-dist/index.html +2 -2
  68. package/resources/fe-dist/assets/channel-CpZANba-.js +0 -1
  69. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BW09ep_0.js +0 -1
  70. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BW09ep_0.js +0 -1
  71. package/resources/fe-dist/assets/index-j9kTGUS5.css +0 -1
  72. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-DTGkSC6X.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-tab-B77EotmX.js","assets/index-C2v9tHtI.js","assets/send-J45szXFM.js","assets/zap-DcJ8Gp1I.js","assets/files-tab-C841Mmn_.js","assets/selection-clipboard-D3gUQQ7L.js","assets/api-DZDjPn8l.js","assets/transfer-toast-D72q4082.js","assets/copy-DwXKDgGT.js","assets/triangle-alert-CagsqsWp.js","assets/SettingsPage-CKZEPwEq.js","assets/card-DWQzPt-3.js","assets/terminal-settings-panel-tZuaqdqz.js","assets/markdown-preview-BsYVAcJ1.js","assets/markdown-preview-Bf_6UH9R.css","assets/DevicesPage-WMW0FcaU.js","assets/DevicePage-DtByPprm.js","assets/FilePage-C3yjgRDh.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-tab-BgvIAv35.js","assets/index-C-RSAqjj.js","assets/send-e_FTy5nC.js","assets/zap-ClXbg92C.js","assets/files-tab-1FVCHULV.js","assets/selection-clipboard-D3gUQQ7L.js","assets/api-Dto6Spgl.js","assets/transfer-toast-CmSO0e95.js","assets/copy-CJIriuQt.js","assets/triangle-alert-jNMwsJMj.js","assets/SettingsPage-BAx39LyM.js","assets/card-IkOsEv2J.js","assets/terminal-settings-panel-DU9rOuZd.js","assets/markdown-preview-CVeuDkuY.js","assets/markdown-preview-Bf_6UH9R.css","assets/DevicesPage-XMtf7VIy.js","assets/DevicePage-BIjGEtCP.js","assets/FilePage-C1_JLsEc.js"])))=>i.map(i=>d[i]);
2
2
  var gD=Object.defineProperty;var cE=e=>{throw TypeError(e)};var yD=(e,t,n)=>t in e?gD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var We=(e,t,n)=>yD(e,typeof t!="symbol"?t+"":t,n),Dg=(e,t,n)=>t.has(e)||cE("Cannot "+n);var ne=(e,t,n)=>(Dg(e,t,"read from private field"),n?n.call(e):t.get(e)),dt=(e,t,n)=>t.has(e)?cE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ge=(e,t,n,a)=>(Dg(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),It=(e,t,n)=>(Dg(e,t,"access private method"),n);var kf=(e,t,n,a)=>({set _(s){Ge(e,t,s,n)},get _(){return ne(e,t,a)}});function vD(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(a,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const bD="modulepreload",xD=function(e){return"/"+e},uE={},Ro=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=c(n.map(f=>{if(f=xD(f),f in uE)return;uE[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":bD,g||(b.as="script"),b.crossOrigin="",b.href=f,h&&b.setAttribute("nonce",h),document.head.appendChild(b),g)return new Promise((x,w)=>{b.addEventListener("load",x),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return s.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function OT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kg={exports:{}},tu={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -311,4 +311,4 @@ ${a}`:a}}const qz=500,nv=new Map,ey=new Map;function IC(e){const t=Date.now(),n=
311
311
  To pick up a draggable item, press the space bar.
312
312
  While dragging, use the arrow keys to move the item.
313
313
  Press space again to drop the item in its new position, or press escape to cancel.
314
- `},k9={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function j9(e){let{announcements:t=k9,container:n,hiddenTextDescribedById:a,screenReaderInstructions:s=D9}=e;const{announce:i,announcement:c}=M9(),u=vd("DndLiveRegion"),[h,f]=y.useState(!1);if(y.useEffect(()=>{f(!0)},[]),N9(y.useMemo(()=>({onDragStart(m){let{active:b}=m;i(t.onDragStart({active:b}))},onDragMove(m){let{active:b,over:x}=m;t.onDragMove&&i(t.onDragMove({active:b,over:x}))},onDragOver(m){let{active:b,over:x}=m;i(t.onDragOver({active:b,over:x}))},onDragEnd(m){let{active:b,over:x}=m;i(t.onDragEnd({active:b,over:x}))},onDragCancel(m){let{active:b,over:x}=m;i(t.onDragCancel({active:b,over:x}))}}),[i,t])),!h)return null;const g=Pe.createElement(Pe.Fragment,null,Pe.createElement(C9,{id:a,value:s.draggable}),Pe.createElement(O9,{id:u,announcement:c}));return n?or.createPortal(g,n):g}var qn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(qn||(qn={}));function qh(){}function Ty(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _9(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Ra=Object.freeze({x:0,y:0});function _2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L2(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return n-a}function L9(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function QR(e){let{left:t,top:n,height:a,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+a},{x:t+s,y:n+a}]}function I2(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ZR(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const p0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=ZR(t,t.left,t.top),i=[];for(const c of a){const{id:u}=c,h=n.get(u);if(h){const f=_2(ZR(h),s);i.push({id:u,data:{droppableContainer:c,value:f}})}}return i.sort(L2)},I9=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=QR(t),i=[];for(const c of a){const{id:u}=c,h=n.get(u);if(h){const f=QR(h),g=s.reduce((b,x,w)=>b+_2(f[w],x),0),m=Number((g/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(L2)};function P9(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=s-a,u=i-n;if(a<s&&n<i){const h=t.width*t.height,f=e.width*e.height,g=c*u,m=g/(h+f-g);return Number(m.toFixed(4))}return 0}const z9=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=[];for(const i of a){const{id:c}=i,u=n.get(c);if(u){const h=P9(u,t);h>0&&s.push({id:c,data:{droppableContainer:i,value:h}})}}return s.sort(L9)};function U9(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function P2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ra}function H9(e){return function(n){for(var a=arguments.length,s=new Array(a>1?a-1:0),i=1;i<a;i++)s[i-1]=arguments[i];return s.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const B9=H9(1);function F9(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function V9(e,t,n){const a=F9(t);if(!a)return e;const{scaleX:s,scaleY:i,x:c,y:u}=a,h=e.left-c-(1-s)*parseFloat(n),f=e.top-u-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=s?e.width/s:e.width,m=i?e.height/i:e.height;return{width:g,height:m,top:f,right:h+g,bottom:f+m,left:h}}const Y9={ignoreTransform:!1};function fc(e,t){t===void 0&&(t=Y9);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:g}=Dr(e).getComputedStyle(e);f&&(n=V9(n,f,g))}const{top:a,left:s,width:i,height:c,bottom:u,right:h}=n;return{top:a,left:s,width:i,height:c,bottom:u,right:h}}function JR(e){return fc(e,{ignoreTransform:!0})}function q9(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $9(e,t){return t===void 0&&(t=Dr(e).getComputedStyle(e)),t.position==="fixed"}function K9(e,t){t===void 0&&(t=Dr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Sm(e,t){const n=[];function a(s){if(t!=null&&n.length>=t||!s)return n;if(f0(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!gd(s)||D2(s)||n.includes(s))return n;const i=Dr(e).getComputedStyle(s);return s!==e&&K9(s,i)&&n.push(s),$9(s,i)?n:a(s.parentNode)}return e?a(e):n}function z2(e){const[t]=Sm(e,1);return t??null}function Cy(e){return!wm||!e?null:uc(e)?e:d0(e)?f0(e)||e===dc(e).scrollingElement?window:gd(e)?e:null:null}function U2(e){return uc(e)?e.scrollX:e.scrollLeft}function H2(e){return uc(e)?e.scrollY:e.scrollTop}function Hv(e){return{x:U2(e),y:H2(e)}}var Qn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Qn||(Qn={}));function B2(e){return!wm||!e?!1:e===document.scrollingElement}function F2(e){const t={x:0,y:0},n=B2(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=a.y,u=e.scrollLeft>=a.x;return{isTop:s,isLeft:i,isBottom:c,isRight:u,maxScroll:a,minScroll:t}}const G9={x:.2,y:.2};function X9(e,t,n,a,s){let{top:i,left:c,right:u,bottom:h}=n;a===void 0&&(a=10),s===void 0&&(s=G9);const{isTop:f,isBottom:g,isLeft:m,isRight:b}=F2(e),x={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!f&&i<=t.top+S.height?(x.y=Qn.Backward,w.y=a*Math.abs((t.top+S.height-i)/S.height)):!g&&h>=t.bottom-S.height&&(x.y=Qn.Forward,w.y=a*Math.abs((t.bottom-S.height-h)/S.height)),!b&&u>=t.right-S.width?(x.x=Qn.Forward,w.x=a*Math.abs((t.right-S.width-u)/S.width)):!m&&c<=t.left+S.width&&(x.x=Qn.Backward,w.x=a*Math.abs((t.left+S.width-c)/S.width)),{direction:x,speed:w}}function W9(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:a,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:s,width:e.clientWidth,height:e.clientHeight}}function V2(e){return e.reduce((t,n)=>Dl(t,Hv(n)),Ra)}function Q9(e){return e.reduce((t,n)=>t+U2(n),0)}function Z9(e){return e.reduce((t,n)=>t+H2(n),0)}function J9(e,t){if(t===void 0&&(t=fc),!e)return;const{top:n,left:a,bottom:s,right:i}=t(e);z2(e)&&(s<=0||i<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const e7=[["x",["left","right"],Q9],["y",["top","bottom"],Z9]];class g0{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=Sm(n),s=V2(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of e7)for(const h of c)Object.defineProperty(this,h,{get:()=>{const f=u(a),g=s[i]-f;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Nu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var s;(s=this.target)==null||s.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function t7(e){const{EventTarget:t}=Dr(e);return e instanceof t?e:dc(e)}function Oy(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var oa;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oa||(oa={}));function eT(e){e.preventDefault()}function n7(e){e.stopPropagation()}var Qt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Qt||(Qt={}));const Y2={start:[Qt.Space,Qt.Enter],cancel:[Qt.Esc],end:[Qt.Space,Qt.Enter,Qt.Tab]},r7=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qt.Right:return{...n,x:n.x+25};case Qt.Left:return{...n,x:n.x-25};case Qt.Down:return{...n,y:n.y+25};case Qt.Up:return{...n,y:n.y-25}}};class y0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Nu(dc(n)),this.windowListeners=new Nu(Dr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oa.Resize,this.handleCancel),this.windowListeners.add(oa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&J9(a),n(Ra)}handleKeyDown(t){if(m0(t)){const{active:n,context:a,options:s}=this.props,{keyboardCodes:i=Y2,coordinateGetter:c=r7,scrollBehavior:u="smooth"}=s,{code:h}=t;if(i.end.includes(h)){this.handleEnd(t);return}if(i.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:f}=a.current,g=f?{x:f.left,y:f.top}:Ra;this.referenceCoordinates||(this.referenceCoordinates=g);const m=c(t,{active:n,context:a.current,currentCoordinates:g});if(m){const b=Yu(m,g),x={x:0,y:0},{scrollableAncestors:w}=a.current;for(const S of w){const R=t.code,{isTop:T,isRight:C,isLeft:M,isBottom:O,maxScroll:D,minScroll:k}=F2(S),A=W9(S),j={x:Math.min(R===Qt.Right?A.right-A.width/2:A.right,Math.max(R===Qt.Right?A.left:A.left+A.width/2,m.x)),y:Math.min(R===Qt.Down?A.bottom-A.height/2:A.bottom,Math.max(R===Qt.Down?A.top:A.top+A.height/2,m.y))},B=R===Qt.Right&&!C||R===Qt.Left&&!M,W=R===Qt.Down&&!O||R===Qt.Up&&!T;if(B&&j.x!==m.x){const K=S.scrollLeft+b.x,I=R===Qt.Right&&K<=D.x||R===Qt.Left&&K>=k.x;if(I&&!b.y){S.scrollTo({left:K,behavior:u});return}I?x.x=S.scrollLeft-K:x.x=R===Qt.Right?S.scrollLeft-D.x:S.scrollLeft-k.x,x.x&&S.scrollBy({left:-x.x,behavior:u});break}else if(W&&j.y!==m.y){const K=S.scrollTop+b.y,I=R===Qt.Down&&K<=D.y||R===Qt.Up&&K>=k.y;if(I&&!b.x){S.scrollTo({top:K,behavior:u});return}I?x.y=S.scrollTop-K:x.y=R===Qt.Down?S.scrollTop-D.y:S.scrollTop-k.y,x.y&&S.scrollBy({top:-x.y,behavior:u});break}}this.handleMove(t,Dl(Yu(m,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}y0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Y2,onActivation:s}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(a.start.includes(c)){const u=i.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function tT(e){return!!(e&&"distance"in e)}function nT(e){return!!(e&&"delay"in e)}class v0{constructor(t,n,a){var s;a===void 0&&(a=t7(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=dc(c),this.documentListeners=new Nu(this.document),this.listeners=new Nu(a),this.windowListeners=new Nu(Dr(c)),this.initialCoordinates=(s=Uv(i))!=null?s:Ra,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(oa.Resize,this.handleCancel),this.windowListeners.add(oa.DragStart,eT),this.windowListeners.add(oa.VisibilityChange,this.handleCancel),this.windowListeners.add(oa.ContextMenu,eT),this.documentListeners.add(oa.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nT(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(tT(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:s}=this.props;s(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(oa.Click,n7,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oa.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:s,props:i}=this,{onMove:c,options:{activationConstraint:u}}=i;if(!s)return;const h=(n=Uv(t))!=null?n:Ra,f=Yu(s,h);if(!a&&u){if(tT(u)){if(u.tolerance!=null&&Oy(f,u.tolerance))return this.handleCancel();if(Oy(f,u.distance))return this.handleStart()}if(nT(u)&&Oy(f,u.tolerance))return this.handleCancel();this.handlePending(u,f);return}t.cancelable&&t.preventDefault(),c(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Qt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const a7={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class q2 extends v0{constructor(t){const{event:n}=t,a=dc(n.target);super(t,a7,a)}}q2.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a==null||a({event:n}),!0)}}];const o7={move:{name:"mousemove"},end:{name:"mouseup"}};var Bv;(function(e){e[e.RightClick=2]="RightClick"})(Bv||(Bv={}));class $2 extends v0{constructor(t){super(t,o7,dc(t.event.target))}}$2.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Bv.RightClick?!1:(a==null||a({event:n}),!0)}}];const My={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class K2 extends v0{constructor(t){super(t,My)}static setup(){return window.addEventListener(My.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(My.move.name,t)};function t(){}}}K2.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:s}=n;return s.length>1?!1:(a==null||a({event:n}),!0)}}];var Au;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Au||(Au={}));var $h;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($h||($h={}));function s7(e){let{acceleration:t,activator:n=Au.Pointer,canScroll:a,draggingRect:s,enabled:i,interval:c=5,order:u=$h.TreeOrder,pointerCoordinates:h,scrollableAncestors:f,scrollableAncestorRects:g,delta:m,threshold:b}=e;const x=l7({delta:m,disabled:!i}),[w,S]=w9(),R=y.useRef({x:0,y:0}),T=y.useRef({x:0,y:0}),C=y.useMemo(()=>{switch(n){case Au.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Au.DraggableRect:return s}},[n,s,h]),M=y.useRef(null),O=y.useCallback(()=>{const k=M.current;if(!k)return;const A=R.current.x*T.current.x,j=R.current.y*T.current.y;k.scrollBy(A,j)},[]),D=y.useMemo(()=>u===$h.TreeOrder?[...f].reverse():f,[u,f]);y.useEffect(()=>{if(!i||!f.length||!C){S();return}for(const k of D){if((a==null?void 0:a(k))===!1)continue;const A=f.indexOf(k),j=g[A];if(!j)continue;const{direction:B,speed:W}=X9(k,j,C,t,b);for(const K of["x","y"])x[K][B[K]]||(W[K]=0,B[K]=0);if(W.x>0||W.y>0){S(),M.current=k,w(O,c),R.current=W,T.current=B;return}}R.current={x:0,y:0},T.current={x:0,y:0},S()},[t,O,a,S,i,c,JSON.stringify(C),JSON.stringify(x),w,f,D,g,JSON.stringify(b)])}const i7={x:{[Qn.Backward]:!1,[Qn.Forward]:!1},y:{[Qn.Backward]:!1,[Qn.Forward]:!1}};function l7(e){let{delta:t,disabled:n}=e;const a=zv(t);return yd(s=>{if(n||!a||!s)return i7;const i={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[Qn.Backward]:s.x[Qn.Backward]||i.x===-1,[Qn.Forward]:s.x[Qn.Forward]||i.x===1},y:{[Qn.Backward]:s.y[Qn.Backward]||i.y===-1,[Qn.Forward]:s.y[Qn.Forward]||i.y===1}}},[n,t,a])}function c7(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return yd(s=>{var i;return t==null?null:(i=a??s)!=null?i:null},[a,t])}function u7(e,t){return y.useMemo(()=>e.reduce((n,a)=>{const{sensor:s}=a,i=s.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,a)}));return[...n,...i]},[]),[e,t])}var qu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qu||(qu={}));var Fv;(function(e){e.Optimized="optimized"})(Fv||(Fv={}));const rT=new Map;function d7(e,t){let{dragging:n,dependencies:a,config:s}=t;const[i,c]=y.useState(null),{frequency:u,measure:h,strategy:f}=s,g=y.useRef(e),m=R(),b=Vu(m),x=y.useCallback(function(T){T===void 0&&(T=[]),!b.current&&c(C=>C===null?T:C.concat(T.filter(M=>!C.includes(M))))},[b]),w=y.useRef(null),S=yd(T=>{if(m&&!n)return rT;if(!T||T===rT||g.current!==e||i!=null){const C=new Map;for(let M of e){if(!M)continue;if(i&&i.length>0&&!i.includes(M.id)&&M.rect.current){C.set(M.id,M.rect.current);continue}const O=M.node.current,D=O?new g0(h(O),O):null;M.rect.current=D,D&&C.set(M.id,D)}return C}return T},[e,i,n,m,h]);return y.useEffect(()=>{g.current=e},[e]),y.useEffect(()=>{m||x()},[n,m]),y.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),y.useEffect(()=>{m||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{x(),w.current=null},u))},[u,m,x,...a]),{droppableRects:S,measureDroppableContainers:x,measuringScheduled:i!=null};function R(){switch(f){case qu.Always:return!1;case qu.BeforeDragging:return n;default:return!n}}}function G2(e,t){return yd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function f7(e,t){return G2(e,t)}function h7(e){let{callback:t,disabled:n}=e;const a=h0(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(a)},[a,n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Em(e){let{callback:t,disabled:n}=e;const a=h0(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(a)},[n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function m7(e){return new g0(fc(e),e)}function aT(e,t,n){t===void 0&&(t=m7);const[a,s]=y.useState(null);function i(){s(h=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=h??n)!=null?f:null}const g=t(e);return JSON.stringify(h)===JSON.stringify(g)?h:g})}const c=h7({callback(h){if(e)for(const f of h){const{type:g,target:m}=f;if(g==="childList"&&m instanceof HTMLElement&&m.contains(e)){i();break}}}}),u=Em({callback:i});return Ya(()=>{i(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),a}function p7(e){const t=G2(e);return P2(e,t)}const oT=[];function g7(e){const t=y.useRef(e),n=yd(a=>e?a&&a!==oT&&e&&t.current&&e.parentNode===t.current.parentNode?a:Sm(e):oT,[e]);return y.useEffect(()=>{t.current=e},[e]),n}function y7(e){const[t,n]=y.useState(null),a=y.useRef(e),s=y.useCallback(i=>{const c=Cy(i.target);c&&n(u=>u?(u.set(c,Hv(c)),new Map(u)):null)},[]);return y.useEffect(()=>{const i=a.current;if(e!==i){c(i);const u=e.map(h=>{const f=Cy(h);return f?(f.addEventListener("scroll",s,{passive:!0}),[f,Hv(f)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),a.current=e}return()=>{c(e),c(i)};function c(u){u.forEach(h=>{const f=Cy(h);f==null||f.removeEventListener("scroll",s)})}},[s,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Dl(i,c),Ra):V2(e):Ra,[e,t])}function sT(e,t){t===void 0&&(t=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},t),y.useEffect(()=>{const a=e!==Ra;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Yu(e,n.current):Ra}function v7(e){y.useEffect(()=>{if(!wm)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function b7(e,t){return y.useMemo(()=>e.reduce((n,a)=>{let{eventName:s,handler:i}=a;return n[s]=c=>{i(c,t)},n},{}),[e,t])}function X2(e){return y.useMemo(()=>e?q9(e):null,[e])}const iT=[];function x7(e,t){t===void 0&&(t=fc);const[n]=e,a=X2(n?Dr(n):null),[s,i]=y.useState(iT);function c(){i(()=>e.length?e.map(h=>B2(h)?a:new g0(t(h),h)):iT)}const u=Em({callback:c});return Ya(()=>{u==null||u.disconnect(),c(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function w7(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return gd(t)?t:e}function S7(e){let{measure:t}=e;const[n,a]=y.useState(null),s=y.useCallback(f=>{for(const{target:g}of f)if(gd(g)){a(m=>{const b=t(g);return m?{...m,width:b.width,height:b.height}:b});break}},[t]),i=Em({callback:s}),c=y.useCallback(f=>{const g=w7(f);i==null||i.disconnect(),g&&(i==null||i.observe(g)),a(g?t(g):null)},[t,i]),[u,h]=Yh(c);return y.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const E7=[{sensor:q2,options:{}},{sensor:y0,options:{}}],R7={current:{}},xh={draggable:{measure:JR},droppable:{measure:JR,strategy:qu.WhileDragging,frequency:Fv.Optimized},dragOverlay:{measure:fc}};class Du extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const T7={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Du,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xh,measureDroppableContainers:qh,windowRect:null,measuringScheduled:!1},C7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qh,draggableNodes:new Map,over:null,measureDroppableContainers:qh},Rm=y.createContext(C7),W2=y.createContext(T7);function O7(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Du}}}function M7(e,t){switch(t.type){case qn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case qn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case qn.DragEnd:case qn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qn.RegisterDroppable:{const{element:n}=t,{id:a}=n,s=new Du(e.droppable.containers);return s.set(a,n),{...e,droppable:{...e.droppable,containers:s}}}case qn.SetDroppableDisabled:{const{id:n,key:a,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||a!==i.key)return e;const c=new Du(e.droppable.containers);return c.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:c}}}case qn.UnregisterDroppable:{const{id:n,key:a}=t,s=e.droppable.containers.get(n);if(!s||a!==s.key)return e;const i=new Du(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function N7(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:s}=y.useContext(Rm),i=zv(a),c=zv(n==null?void 0:n.id);return y.useEffect(()=>{if(!t&&!a&&i&&c!=null){if(!m0(i)||document.activeElement===i.target)return;const u=s.get(c);if(!u)return;const{activatorNode:h,node:f}=u;if(!h.current&&!f.current)return;requestAnimationFrame(()=>{for(const g of[h.current,f.current]){if(!g)continue;const m=R9(g);if(m){m.focus();break}}})}},[a,t,s,c,i]),null}function A7(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...a}),n):n}function D7(e){return y.useMemo(()=>({draggable:{...xh.draggable,...e==null?void 0:e.draggable},droppable:{...xh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...xh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function k7(e){let{activeNode:t,measure:n,initialRect:a,config:s=!0}=e;const i=y.useRef(!1),{x:c,y:u}=typeof s=="boolean"?{x:s,y:s}:s;Ya(()=>{if(!c&&!u||!t){i.current=!1;return}if(i.current||!a)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const g=n(f),m=P2(g,a);if(c||(m.x=0),u||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const b=z2(f);b&&b.scrollBy({top:m.y,left:m.x})}},[t,c,u,a,n])}const Q2=y.createContext({...Ra,scaleX:1,scaleY:1});var os;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(os||(os={}));const b0=y.memo(function(t){var n,a,s,i;let{id:c,accessibility:u,autoScroll:h=!0,children:f,sensors:g=E7,collisionDetection:m=z9,measuring:b,modifiers:x,...w}=t;const S=y.useReducer(M7,void 0,O7),[R,T]=S,[C,M]=A9(),[O,D]=y.useState(os.Uninitialized),k=O===os.Initialized,{draggable:{active:A,nodes:j,translate:B},droppable:{containers:W}}=R,K=A!=null?j.get(A):null,I=y.useRef({initial:null,translated:null}),H=y.useMemo(()=>{var lt;return A!=null?{id:A,data:(lt=K==null?void 0:K.data)!=null?lt:R7,rect:I}:null},[A,K]),F=y.useRef(null),[q,_]=y.useState(null),[L,P]=y.useState(null),V=Vu(w,Object.values(w)),Q=vd("DndDescribedBy",c),z=y.useMemo(()=>W.getEnabled(),[W]),Y=D7(b),{droppableRects:X,measureDroppableContainers:G,measuringScheduled:ce}=d7(z,{dragging:k,dependencies:[B.x,B.y],config:Y.droppable}),oe=c7(j,A),de=y.useMemo(()=>L?Uv(L):null,[L]),ve=tt(),xe=f7(oe,Y.draggable.measure);k7({activeNode:A!=null?j.get(A):null,config:ve.layoutShiftCompensation,initialRect:xe,measure:Y.draggable.measure});const Ne=aT(oe,Y.draggable.measure,xe),_e=aT(oe?oe.parentElement:null),ee=y.useRef({activatorEvent:null,active:null,activeNode:oe,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ue=W.getNodeFor((n=ee.current.over)==null?void 0:n.id),pe=S7({measure:Y.dragOverlay.measure}),ke=(a=pe.nodeRef.current)!=null?a:oe,Te=k?(s=pe.rect)!=null?s:Ne:null,be=!!(pe.nodeRef.current&&pe.rect),we=p7(be?null:Ne),Z=X2(ke?Dr(ke):null),Se=g7(k?ue??oe:null),ge=x7(Se),ze=A7(x,{transform:{x:B.x-we.x,y:B.y-we.y,scaleX:1,scaleY:1},activatorEvent:L,active:H,activeNodeRect:Ne,containerNodeRect:_e,draggingNodeRect:Te,over:ee.current.over,overlayNodeRect:pe.rect,scrollableAncestors:Se,scrollableAncestorRects:ge,windowRect:Z}),He=de?Dl(de,B):null,De=y7(Se),st=sT(De),xt=sT(De,[Ne]),vt=Dl(ze,st),Je=Te?B9(Te,ze):null,Qe=H&&Je?m({active:H,collisionRect:Je,droppableRects:X,droppableContainers:z,pointerCoordinates:He}):null,ft=I2(Qe,"id"),[se,je]=y.useState(null),Ke=be?ze:Dl(ze,xt),Me=U9(Ke,(i=se==null?void 0:se.rect)!=null?i:null,Ne),Ie=y.useRef(null),Fe=y.useCallback((lt,gt)=>{let{sensor:Ye,options:Tt}=gt;if(F.current==null)return;const kt=j.get(F.current);if(!kt)return;const Rt=lt.nativeEvent,on=new Ye({active:F.current,activeNode:kt,event:Rt,options:Tt,context:ee,onAbort(Xe){if(!j.get(Xe))return;const{onDragAbort:$}=V.current,re={id:Xe};$==null||$(re),C({type:"onDragAbort",event:re})},onPending(Xe,Ct,$,re){if(!j.get(Xe))return;const{onDragPending:Ee}=V.current,Le={id:Xe,constraint:Ct,initialCoordinates:$,offset:re};Ee==null||Ee(Le),C({type:"onDragPending",event:Le})},onStart(Xe){const Ct=F.current;if(Ct==null)return;const $=j.get(Ct);if(!$)return;const{onDragStart:re}=V.current,le={activatorEvent:Rt,active:{id:Ct,data:$.data,rect:I}};or.unstable_batchedUpdates(()=>{re==null||re(le),D(os.Initializing),T({type:qn.DragStart,initialCoordinates:Xe,active:Ct}),C({type:"onDragStart",event:le}),_(Ie.current),P(Rt)})},onMove(Xe){T({type:qn.DragMove,coordinates:Xe})},onEnd:Pt(qn.DragEnd),onCancel:Pt(qn.DragCancel)});Ie.current=on;function Pt(Xe){return async function(){const{active:$,collisions:re,over:le,scrollAdjustedTranslate:Ee}=ee.current;let Le=null;if($&&Ee){const{cancelDrop:et}=V.current;Le={activatorEvent:Rt,active:$,collisions:re,delta:Ee,over:le},Xe===qn.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Le))&&(Xe=qn.DragCancel)}F.current=null,or.unstable_batchedUpdates(()=>{T({type:Xe}),D(os.Uninitialized),je(null),_(null),P(null),Ie.current=null;const et=Xe===qn.DragEnd?"onDragEnd":"onDragCancel";if(Le){const Ze=V.current[et];Ze==null||Ze(Le),C({type:et,event:Le})}})}}},[j]),ht=y.useCallback((lt,gt)=>(Ye,Tt)=>{const kt=Ye.nativeEvent,Rt=j.get(Tt);if(F.current!==null||!Rt||kt.dndKit||kt.defaultPrevented)return;const on={active:Rt};lt(Ye,gt.options,on)===!0&&(kt.dndKit={capturedBy:gt.sensor},F.current=Tt,Fe(Ye,gt))},[j,Fe]),Lt=u7(g,ht);v7(g),Ya(()=>{Ne&&O===os.Initializing&&D(os.Initialized)},[Ne,O]),y.useEffect(()=>{const{onDragMove:lt}=V.current,{active:gt,activatorEvent:Ye,collisions:Tt,over:kt}=ee.current;if(!gt||!Ye)return;const Rt={active:gt,activatorEvent:Ye,collisions:Tt,delta:{x:vt.x,y:vt.y},over:kt};or.unstable_batchedUpdates(()=>{lt==null||lt(Rt),C({type:"onDragMove",event:Rt})})},[vt.x,vt.y]),y.useEffect(()=>{const{active:lt,activatorEvent:gt,collisions:Ye,droppableContainers:Tt,scrollAdjustedTranslate:kt}=ee.current;if(!lt||F.current==null||!gt||!kt)return;const{onDragOver:Rt}=V.current,on=Tt.get(ft),Pt=on&&on.rect.current?{id:on.id,rect:on.rect.current,data:on.data,disabled:on.disabled}:null,Xe={active:lt,activatorEvent:gt,collisions:Ye,delta:{x:kt.x,y:kt.y},over:Pt};or.unstable_batchedUpdates(()=>{je(Pt),Rt==null||Rt(Xe),C({type:"onDragOver",event:Xe})})},[ft]),Ya(()=>{ee.current={activatorEvent:L,active:H,activeNode:oe,collisionRect:Je,collisions:Qe,droppableRects:X,draggableNodes:j,draggingNode:ke,draggingNodeRect:Te,droppableContainers:W,over:se,scrollableAncestors:Se,scrollAdjustedTranslate:vt},I.current={initial:Te,translated:Je}},[H,oe,Qe,Je,j,ke,Te,X,W,se,Se,vt]),s7({...ve,delta:B,draggingRect:Je,pointerCoordinates:He,scrollableAncestors:Se,scrollableAncestorRects:ge});const ct=y.useMemo(()=>({active:H,activeNode:oe,activeNodeRect:Ne,activatorEvent:L,collisions:Qe,containerNodeRect:_e,dragOverlay:pe,draggableNodes:j,droppableContainers:W,droppableRects:X,over:se,measureDroppableContainers:G,scrollableAncestors:Se,scrollableAncestorRects:ge,measuringConfiguration:Y,measuringScheduled:ce,windowRect:Z}),[H,oe,Ne,L,Qe,_e,pe,j,W,X,se,G,Se,ge,Y,ce,Z]),pt=y.useMemo(()=>({activatorEvent:L,activators:Lt,active:H,activeNodeRect:Ne,ariaDescribedById:{draggable:Q},dispatch:T,draggableNodes:j,over:se,measureDroppableContainers:G}),[L,Lt,H,Ne,T,Q,j,se,G]);return Pe.createElement(j2.Provider,{value:M},Pe.createElement(Rm.Provider,{value:pt},Pe.createElement(W2.Provider,{value:ct},Pe.createElement(Q2.Provider,{value:Me},f)),Pe.createElement(N7,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Pe.createElement(j9,{...u,hiddenTextDescribedById:Q}));function tt(){const lt=(q==null?void 0:q.autoScrollEnabled)===!1,gt=typeof h=="object"?h.enabled===!1:h===!1,Ye=k&&!lt&&!gt;return typeof h=="object"?{...h,enabled:Ye}:{enabled:Ye}}}),j7=y.createContext(null),lT="button",_7="Draggable";function L7(e){let{id:t,data:n,disabled:a=!1,attributes:s}=e;const i=vd(_7),{activators:c,activatorEvent:u,active:h,activeNodeRect:f,ariaDescribedById:g,draggableNodes:m,over:b}=y.useContext(Rm),{role:x=lT,roleDescription:w="draggable",tabIndex:S=0}=s??{},R=(h==null?void 0:h.id)===t,T=y.useContext(R?Q2:j7),[C,M]=Yh(),[O,D]=Yh(),k=b7(c,t),A=Vu(n);Ya(()=>(m.set(t,{id:t,key:i,node:C,activatorNode:O,data:A}),()=>{const B=m.get(t);B&&B.key===i&&m.delete(t)}),[m,t]);const j=y.useMemo(()=>({role:x,tabIndex:S,"aria-disabled":a,"aria-pressed":R&&x===lT?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[a,x,S,R,w,g.draggable]);return{active:h,activatorEvent:u,activeNodeRect:f,attributes:j,isDragging:R,listeners:a?void 0:k,node:C,over:b,setNodeRef:M,setActivatorNodeRef:D,transform:T}}function I7(){return y.useContext(W2)}const P7="Droppable",z7={timeout:25};function U7(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:s}=e;const i=vd(P7),{active:c,dispatch:u,over:h,measureDroppableContainers:f}=y.useContext(Rm),g=y.useRef({disabled:n}),m=y.useRef(!1),b=y.useRef(null),x=y.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:R}={...z7,...s},T=Vu(S??a),C=y.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(T.current)?T.current:[T.current]),x.current=null},R)},[R]),M=Em({callback:C,disabled:w||!c}),O=y.useCallback((j,B)=>{M&&(B&&(M.unobserve(B),m.current=!1),j&&M.observe(j))},[M]),[D,k]=Yh(O),A=Vu(t);return y.useEffect(()=>{!M||!D.current||(M.disconnect(),m.current=!1,M.observe(D.current))},[D,M]),y.useEffect(()=>(u({type:qn.RegisterDroppable,element:{id:a,key:i,disabled:n,node:D,rect:b,data:A}}),()=>u({type:qn.UnregisterDroppable,key:i,id:a})),[a]),y.useEffect(()=>{n!==g.current.disabled&&(u({type:qn.SetDroppableDisabled,id:a,key:i,disabled:n}),g.current.disabled=n)},[a,i,n,u]),{active:c,rect:b,isOver:(h==null?void 0:h.id)===a,node:D,over:h,setNodeRef:k}}function bd(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function H7(e,t){return e.reduce((n,a,s)=>{const i=t.get(a);return i&&(n[s]=i),n},Array(e.length))}function rh(e){return e!==null&&e>=0}function B7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function F7(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Z2=e=>{let{rects:t,activeIndex:n,overIndex:a,index:s}=e;const i=bd(t,a,n),c=t[s],u=i[s];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},ah={scaleX:1,scaleY:1},x0=e=>{var t;let{activeIndex:n,activeNodeRect:a,index:s,rects:i,overIndex:c}=e;const u=(t=i[n])!=null?t:a;if(!u)return null;if(s===n){const f=i[c];return f?{x:0,y:n<c?f.top+f.height-(u.top+u.height):f.top-u.top,...ah}:null}const h=V7(i,s,n);return s>n&&s<=c?{x:0,y:-u.height-h,...ah}:s<n&&s>=c?{x:0,y:u.height+h,...ah}:{x:0,y:0,...ah}};function V7(e,t,n){const a=e[t],s=e[t-1],i=e[t+1];return a?n<t?s?a.top-(s.top+s.height):i?i.top-(a.top+a.height):0:i?i.top-(a.top+a.height):s?a.top-(s.top+s.height):0:0}const J2="Sortable",eN=Pe.createContext({activeIndex:-1,containerId:J2,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Z2,disabled:{draggable:!1,droppable:!1}});function w0(e){let{children:t,id:n,items:a,strategy:s=Z2,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:h,over:f,measureDroppableContainers:g}=I7(),m=vd(J2,n),b=u.rect!==null,x=y.useMemo(()=>a.map(k=>typeof k=="object"&&"id"in k?k.id:k),[a]),w=c!=null,S=c?x.indexOf(c.id):-1,R=f?x.indexOf(f.id):-1,T=y.useRef(x),C=!B7(x,T.current),M=R!==-1&&S===-1||C,O=F7(i);Ya(()=>{C&&w&&g(x)},[C,x,w,g]),y.useEffect(()=>{T.current=x},[x]);const D=y.useMemo(()=>({activeIndex:S,containerId:m,disabled:O,disableTransforms:M,items:x,overIndex:R,useDragOverlay:b,sortedRects:H7(x,h),strategy:s}),[S,m,O.draggable,O.droppable,M,x,R,h,b,s]);return Pe.createElement(eN.Provider,{value:D},t)}const Y7=e=>{let{id:t,items:n,activeIndex:a,overIndex:s}=e;return bd(n,a,s).indexOf(t)},q7=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:s,items:i,newIndex:c,previousItems:u,previousContainerId:h,transition:f}=e;return!f||!a||u!==i&&s===c?!1:n?!0:c!==s&&t===h},$7={duration:200,easing:"ease"},tN="transform",K7=Ni.Transition.toString({property:tN,duration:0,easing:"linear"}),G7={roleDescription:"sortable"};function X7(e){let{disabled:t,index:n,node:a,rect:s}=e;const[i,c]=y.useState(null),u=y.useRef(n);return Ya(()=>{if(!t&&n!==u.current&&a.current){const h=s.current;if(h){const f=fc(a.current,{ignoreTransform:!0}),g={x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height};(g.x||g.y)&&c(g)}}n!==u.current&&(u.current=n)},[t,n,a,s]),y.useEffect(()=>{i&&c(null)},[i]),i}function S0(e){let{animateLayoutChanges:t=q7,attributes:n,disabled:a,data:s,getNewIndex:i=Y7,id:c,strategy:u,resizeObserverConfig:h,transition:f=$7}=e;const{items:g,containerId:m,activeIndex:b,disabled:x,disableTransforms:w,sortedRects:S,overIndex:R,useDragOverlay:T,strategy:C}=y.useContext(eN),M=W7(a,x),O=g.indexOf(c),D=y.useMemo(()=>({sortable:{containerId:m,index:O,items:g},...s}),[m,s,O,g]),k=y.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:j,isOver:B,setNodeRef:W}=U7({id:c,data:D,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...h}}),{active:K,activatorEvent:I,activeNodeRect:H,attributes:F,setNodeRef:q,listeners:_,isDragging:L,over:P,setActivatorNodeRef:V,transform:Q}=L7({id:c,data:D,attributes:{...G7,...n},disabled:M.draggable}),z=x9(W,q),Y=!!K,X=Y&&!w&&rh(b)&&rh(R),G=!T&&L,ce=G&&X?Q:null,de=X?ce??(u??C)({rects:S,activeNodeRect:H,activeIndex:b,overIndex:R,index:O}):null,ve=rh(b)&&rh(R)?i({id:c,items:g,activeIndex:b,overIndex:R}):O,xe=K==null?void 0:K.id,Ne=y.useRef({activeId:xe,items:g,newIndex:ve,containerId:m}),_e=g!==Ne.current.items,ee=t({active:K,containerId:m,isDragging:L,isSorting:Y,id:c,index:O,items:g,newIndex:Ne.current.newIndex,previousItems:Ne.current.items,previousContainerId:Ne.current.containerId,transition:f,wasDragging:Ne.current.activeId!=null}),ue=X7({disabled:!ee,index:O,node:j,rect:A});return y.useEffect(()=>{Y&&Ne.current.newIndex!==ve&&(Ne.current.newIndex=ve),m!==Ne.current.containerId&&(Ne.current.containerId=m),g!==Ne.current.items&&(Ne.current.items=g)},[Y,ve,m,g]),y.useEffect(()=>{if(xe===Ne.current.activeId)return;if(xe!=null&&Ne.current.activeId==null){Ne.current.activeId=xe;return}const ke=setTimeout(()=>{Ne.current.activeId=xe},50);return()=>clearTimeout(ke)},[xe]),{active:K,activeIndex:b,attributes:F,data:D,rect:A,index:O,newIndex:ve,items:g,isOver:B,isSorting:Y,isDragging:L,listeners:_,node:j,overIndex:R,over:P,setNodeRef:z,setActivatorNodeRef:V,setDroppableNodeRef:W,setDraggableNodeRef:q,transform:ue??de,transition:pe()};function pe(){if(ue||_e&&Ne.current.newIndex===O)return K7;if(!(G&&!m0(I)||!f)&&(Y||ee))return Ni.Transition.toString({...f,property:tN})}}function W7(e,t){var n,a;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(a=e==null?void 0:e.droppable)!=null?a:t.droppable}}function Kh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Q7=[Qt.Down,Qt.Right,Qt.Up,Qt.Left],Z7=(e,t)=>{let{context:{active:n,collisionRect:a,droppableRects:s,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(Q7.includes(e.code)){if(e.preventDefault(),!n||!a)return;const h=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const b=s.get(m.id);if(b)switch(e.code){case Qt.Down:a.top<b.top&&h.push(m);break;case Qt.Up:a.top>b.top&&h.push(m);break;case Qt.Left:a.left>b.left&&h.push(m);break;case Qt.Right:a.left<b.left&&h.push(m);break}});const f=I9({collisionRect:a,droppableRects:s,droppableContainers:h});let g=I2(f,"id");if(g===(c==null?void 0:c.id)&&f.length>1&&(g=f[1].id),g!=null){const m=i.get(n.id),b=i.get(g),x=b?s.get(b.id):null,w=b==null?void 0:b.node.current;if(w&&x&&m&&b){const R=Sm(w).some((k,A)=>u[A]!==k),T=nN(m,b),C=J7(m,b),M=R||!T?{x:0,y:0}:{x:C?a.width-x.width:0,y:C?a.height-x.height:0},O={x:x.left,y:x.top};return M.x&&M.y?O:Yu(O,M)}}}};function nN(e,t){return!Kh(e)||!Kh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function J7(e,t){return!Kh(e)||!Kh(t)||!nN(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function eY(){const e=To.getState().settings;return(e==null?void 0:e.siteName)||"tmex"}function cT(e){const t=e==null?void 0:e.trim();return t&&t.length>0?t:"?"}function aq({paneCustomName:e,paneTitle:t,windowName:n,windowCustomName:a,deviceName:s}){const i=cT(e??a??t??n),c=cT(s);return`${i}@${c}`}function E0(e){var u,h;const t=(u=e.customName)==null?void 0:u.trim(),n=e.panes.find(f=>f.active)??e.panes[0],a=e.name.trim(),s=(h=n==null?void 0:n.title)==null?void 0:h.trim(),i=t||s||a;return{title:i,processName:!!a&&a!==i?a:void 0}}function tY(e){const{title:t,processName:n}=E0(e);return n?`${n}: ${t}`:t}function oq(e){const t=eY();return e!=null&&e.trim()?`[${t}]${e}`:t}function sq(e){return e}function rN(e){return encodeURIComponent(e)}function aN({status:e}){return E.jsx("span",{className:Oe("size-2 shrink-0 rounded-full",e==="running"?"bg-emerald-500 animate-pulse":e==="error"?"bg-destructive":e==="waiting_confirmation"?"bg-amber-500":"bg-muted-foreground/40")})}function nY({paneIds:e}){return mb(n=>e.some(a=>n.ringingPanes[a]))?E.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function rY({paneId:e}){return mb(n=>!!n.ringingPanes[e])?E.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function R0(){return _9(Ty($2,{activationConstraint:{distance:8}}),Ty(K2,{activationConstraint:{delay:250,tolerance:5}}),Ty(y0,{coordinateGetter:Z7}))}function aY(){const{t:e}=yr(),t=qa(),n=ob(),{isMobile:a,setOpenMobile:s}=qr(),{toggleDevice:i}=K8(),c=ri(se=>se.sessions),u=ri(se=>se.activeSessionId),h=Ar(se=>se.setSidebarTab);y.useEffect(()=>{const se=ri.getState();se.ensureInitialized(),se.loadSessions()},[]);const f=Yl("/devices/:deviceId/windows/:windowId/panes/:paneId",t.pathname),g=f==null?void 0:f.params.deviceId,m=f==null?void 0:f.params.windowId,b=f==null?void 0:f.params.paneId,x=rn(se=>se.snapshots),w=rn(se=>se.connectedDevices),S=rn(se=>se.closeWindow),R=rn(se=>se.closePane),T=rn(se=>se.renameWindow),C=To(se=>{var je;return((je=se.settings)==null?void 0:je.language)??"en_US"}),{data:M}=ed({queryKey:["devices"],queryFn:async()=>{const se=await fetch("/api/devices");if(!se.ok)throw new Error("Failed to fetch devices");return se.json()},throwOnError:!1}),O=rn(se=>se.hydrateDeviceErrors);y.useEffect(()=>{M!=null&&M.devices&&O(M.devices.map(se=>({deviceId:se.id,lastError:se.lastError??null,lastErrorType:se.lastErrorType??null})))},[M,O]);const D=y.useCallback((se,je)=>{n(se,{replace:(je==null?void 0:je.replace)??!0}),a&&!(je!=null&&je.keepSidebarOpen)&&s(!1)},[n,a,s]),k=y.useCallback((se,je,Ke,Me)=>{W.current=null,window.dispatchEvent(new CustomEvent("tmex:user-initiated-selection",{detail:{deviceId:se,windowId:je,paneId:Ke}})),D(`/devices/${se}/windows/${je}/panes/${rN(Ke)}`,{keepSidebarOpen:Me==null?void 0:Me.keepSidebarOpen})},[D]),A=y.useCallback(se=>{var je,Ke;if(ri.getState().setActiveSession(se.id),h("agent"),se.deviceId&&se.paneId){const Me=(Ke=(je=rn.getState().snapshots[se.deviceId])==null?void 0:je.session)==null?void 0:Ke.windows,Ie=Me==null?void 0:Me.find(Fe=>Fe.panes.some(ht=>ht.id===se.paneId));Ie&&k(se.deviceId,Ie.id,se.paneId,{keepSidebarOpen:!0})}},[h,k]),j=y.useCallback((se,je,Ke)=>{k(se,je,Ke.id,{keepSidebarOpen:!0}),ri.getState().startDraft(se,Ke.id,Ke.title??null),h("agent")},[k,h]),B=rn(se=>se.selectWindow),W=y.useRef(null);y.useEffect(()=>{var Lt,ct;const se=W.current;if(!se)return;if(Date.now()-se.at>5e3){W.current=null;return}const{deviceId:je,windowId:Ke}=se,Me=x[je],Ie=(Lt=Me==null?void 0:Me.session)==null?void 0:Lt.windows;if(!Ie)return;const Fe=Ie.find(pt=>pt.id===Ke);if(!((ct=Fe==null?void 0:Fe.panes)!=null&&ct.length))return;W.current=null;const ht=Fe.panes.find(pt=>pt.active)??Fe.panes[0];k(je,Ke,ht.id)},[x,k]);const K=y.useCallback((se,je,Ke)=>{B(se,je);const Me=Ke.find(Ie=>Ie.active)??Ke[0];Me?(k(se,je,Me.id),W.current=null):W.current={deviceId:se,windowId:je,at:Date.now()}},[k,B]),I=y.useCallback((se,je)=>{je?se===g&&D("/devices"):D(`/devices/${se}`),i(se,je)},[i,g,D]),H=y.useCallback((se,je)=>{se===g&&je===m&&D("/devices"),S(se,je)},[S,g,m,D]),[F,q]=y.useState(null),_=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.find(ht=>ht.id===je);q({kind:"window",deviceId:se,windowId:je,name:Me?tY(Me):""})},[]),L=y.useCallback((se,je,Ke)=>{var Fe,ht,Lt,ct;const Me=(ht=(Fe=rn.getState().snapshots[se])==null?void 0:Fe.session)==null?void 0:ht.windows,Ie=(ct=(Lt=Me==null?void 0:Me.find(pt=>pt.id===je))==null?void 0:Lt.panes)==null?void 0:ct.find(pt=>pt.id===Ke);q({kind:"pane",deviceId:se,paneId:Ke,name:(Ie==null?void 0:Ie.title)||`Pane ${(Ie==null?void 0:Ie.index)??""}`})},[]),P=y.useCallback(()=>{F&&(F.kind==="window"?H(F.deviceId,F.windowId):R(F.deviceId,F.paneId),q(null))},[F,H,R]),[V,Q]=y.useState(null),[z,Y]=y.useState(""),X=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.find(ht=>ht.id===je);Me&&(Y(Me.customName??E0(Me).title),Q({kind:"window",deviceId:se,windowId:je,hasCustomName:!!Me.customName}))},[]),G=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.flatMap(ht=>ht.panes).find(ht=>ht.id===je);Me&&(Y(Me.customName??Me.title??""),Q({kind:"pane",deviceId:se,paneId:je,hasCustomName:!!Me.customName}))},[]),ce=rn(se=>se.renamePane),oe=y.useCallback(se=>{V&&(V.kind==="window"?T(V.deviceId,V.windowId,se):ce(V.deviceId,V.paneId,se),Q(null))},[V,T,ce]),de=y.useCallback(()=>{const se=z.trim();se&&oe(se)},[oe,z]),ve=y.useCallback(()=>{oe("")},[oe]),xe=y.useCallback(se=>{rn.getState().createWindow(se)},[]),[Ne,_e]=y.useState(null),ee=y.useCallback((se,je)=>{_e({deviceId:se,paneId:je})},[]),[ue,pe]=y.useState(null),[ke,Te]=y.useState(""),[be,we]=y.useState(null),Z=y.useCallback(se=>{Te(se.title),pe(se)},[]),Se=y.useCallback(()=>{if(!ue)return;const se=ke.trim();se&&(ri.getState().renameSession(ue.id,se),pe(null))},[ue,ke]),ge=y.useCallback(se=>{we(se)},[]),ze=y.useCallback(()=>{be&&(ri.getState().deleteSession(be.id),we(null))},[be]),He=Ju(),De=R0(),st=ju({mutationFn:async se=>{const je=await fetch("/api/devices/order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceIds:se})});if(!je.ok)throw new Error("Failed to reorder devices");return je.json()},onMutate:async se=>{await He.cancelQueries({queryKey:["devices"]});const je=He.getQueryData(["devices"]);if(je){const Ke=new Map(je.devices.map(Fe=>[Fe.id,Fe])),Me=se.map((Fe,ht)=>{const Lt=Ke.get(Fe);return Lt?{...Lt,sortOrder:ht}:void 0}).filter(Fe=>Fe!==void 0),Ie=je.devices.filter(Fe=>!se.includes(Fe.id));He.setQueryData(["devices"],{devices:[...Me,...Ie]})}return{previous:je}},onError:(se,je,Ke)=>{Ke!=null&&Ke.previous&&He.setQueryData(["devices"],Ke.previous),dn.error(e("device.reorderFailed"))},onSettled:()=>{He.invalidateQueries({queryKey:["devices"]})}}),xt=(M==null?void 0:M.devices)??[],vt=y.useMemo(()=>[...xt].sort((se,je)=>se.sortOrder-je.sortOrder||se.name.localeCompare(je.name,UT(C),{numeric:!0,sensitivity:"base"})),[xt,C]),Je=y.useCallback(se=>{const{active:je,over:Ke}=se;if(!Ke||je.id===Ke.id)return;const Me=vt.map(ht=>ht.id),Ie=Me.indexOf(String(je.id)),Fe=Me.indexOf(String(Ke.id));Ie<0||Fe<0||st.mutate(bd(Me,Ie,Fe))},[vt,st]),{sessionsByPane:Qe,orphanSessions:ft}=y.useMemo(()=>{const se=new Set(xt.map(Ie=>Ie.id)),je=new Map,Ke=[],Me=Object.values(c).filter(Ie=>!!Ie).sort((Ie,Fe)=>Ie.updatedAt<Fe.updatedAt?1:-1);for(const Ie of Me){if(!Ie.deviceId||!Ie.paneId||!se.has(Ie.deviceId)){Ke.push(Ie);continue}const Fe=`${Ie.deviceId}:${Ie.paneId}`,ht=je.get(Fe);ht?ht.push(Ie):je.set(Fe,[Ie])}return{sessionsByPane:je,orphanSessions:Ke}},[c,xt]);return E.jsxs(zM,{className:"flex flex-col flex-1 min-h-0 pt-0",children:[E.jsx(b0,{sensors:De,collisionDetection:p0,onDragEnd:Je,children:E.jsx(xV,{className:"flex-1 min-h-0",children:E.jsxs("div",{className:"space-y-1.5 pb-2 pt-1 select-none [-webkit-user-select:none] [-webkit-touch-callout:none]",children:[E.jsx(w0,{items:vt.map(se=>se.id),strategy:x0,children:vt.map(se=>{var je,Ke;return E.jsx(oY,{device:se,windows:((Ke=(je=x[se.id])==null?void 0:je.session)==null?void 0:Ke.windows)??null,isConnected:w.has(se.id),isSelected:se.id===g,selectedWindowId:m,selectedPaneId:b,onConnectToggle:()=>I(se.id,w.has(se.id)),onCreateWindow:xe,onCloseWindow:_,onClosePane:L,onRenameWindow:X,onRenamePane:G,onPaneClick:k,onWindowClick:K,onWatchPane:ee,sessionsByPane:Qe,activeSessionId:u,onSelectSession:A,onCreateSessionForPane:j,onRenameSession:Z,onDeleteSession:ge},se.id)})}),vt.length===0&&E.jsx("div",{className:"text-center text-sm text-muted-foreground py-4",children:e("sidebar.noDevices")}),ft.length>0&&E.jsx(lY,{sessions:ft,activeSessionId:u,onSelectSession:A,onRenameSession:Z,onDeleteSession:ge})]})})}),E.jsx(wv,{open:F!==null,onOpenChange:se=>!se&&q(null),children:E.jsxs(Sv,{children:[E.jsxs(Ev,{children:[E.jsx(jR,{className:"bg-destructive/10",children:E.jsx(Ei,{className:"h-5 w-5 text-destructive"})}),E.jsx(Tv,{children:(F==null?void 0:F.kind)==="pane"?e("window.closePaneConfirmTitle"):e("window.closeConfirmTitle")}),E.jsx(Cv,{children:e("window.closeConfirmDesc",{name:(F==null?void 0:F.name)??""})})]}),E.jsxs(Rv,{children:[E.jsx(Mv,{children:e("common.cancel")}),E.jsx(Ov,{variant:"destructive",disabled:!F,onClick:P,children:e("common.close")})]})]})}),E.jsx(Nv,{open:V!==null,onOpenChange:se=>!se&&Q(null),children:E.jsx(Av,{"data-testid":"window-rename-dialog",children:E.jsxs("form",{onSubmit:se=>{se.preventDefault(),de()},children:[E.jsxs(Dv,{children:[E.jsx(kv,{children:e("window.rename")}),E.jsx(t2,{children:e("window.renameDesc")})]}),E.jsx("div",{className:"py-4",children:E.jsx(va,{autoFocus:!0,maxLength:64,value:z,onChange:se=>Y(se.target.value),placeholder:e("window.renamePlaceholder"),"data-testid":"window-rename-input"})}),E.jsxs(_R,{children:[(V==null?void 0:V.hasCustomName)&&E.jsx(Cn,{type:"button",variant:"ghost",onClick:ve,"data-testid":"window-rename-reset",children:e("window.renameReset")}),E.jsx(Cn,{type:"button",variant:"outline",onClick:()=>Q(null),children:e("common.cancel")}),E.jsx(Cn,{type:"submit",disabled:!z.trim(),"data-testid":"window-rename-save",children:e("common.save")})]})]})})}),E.jsx(Nv,{open:ue!==null,onOpenChange:se=>!se&&pe(null),children:E.jsx(Av,{"data-testid":"agent-session-rename-dialog",children:E.jsxs("form",{onSubmit:se=>{se.preventDefault(),Se()},children:[E.jsx(Dv,{children:E.jsx(kv,{children:e("agent.session.renameTitle")})}),E.jsx("div",{className:"py-4",children:E.jsx(va,{autoFocus:!0,maxLength:120,value:ke,onChange:se=>Te(se.target.value),placeholder:e("agent.session.renamePlaceholder"),"data-testid":"agent-session-rename-input"})}),E.jsxs(_R,{children:[E.jsx(Cn,{type:"button",variant:"outline",onClick:()=>pe(null),children:e("agent.session.cancel")}),E.jsx(Cn,{type:"submit",disabled:!ke.trim(),"data-testid":"agent-session-rename-save",children:e("agent.session.save")})]})]})})}),E.jsx(wv,{open:be!==null,onOpenChange:se=>!se&&we(null),children:E.jsxs(Sv,{children:[E.jsxs(Ev,{children:[E.jsx(jR,{className:"bg-destructive/10",children:E.jsx(Ei,{className:"h-5 w-5 text-destructive"})}),E.jsx(Tv,{children:e("agent.session.deleteTitle")}),E.jsx(Cv,{children:e("agent.session.deleteDesc",{title:(be==null?void 0:be.title)??""})})]}),E.jsxs(Rv,{children:[E.jsx(Mv,{children:e("common.cancel")}),E.jsx(Ov,{variant:"destructive",disabled:!be,onClick:ze,"data-testid":"agent-session-delete-confirm",children:e("agent.session.deleteConfirm")})]})]})}),Ne&&E.jsx(d9,{open:!0,onOpenChange:se=>!se&&_e(null),deviceId:Ne.deviceId,paneId:Ne.paneId})]})}function oY({device:e,windows:t,isConnected:n,isSelected:a,selectedWindowId:s,selectedPaneId:i,onConnectToggle:c,onCreateWindow:u,onCloseWindow:h,onClosePane:f,onRenameWindow:g,onRenamePane:m,onPaneClick:b,onWindowClick:x,onWatchPane:w,sessionsByPane:S,activeSessionId:R,onSelectSession:T,onCreateSessionForPane:C,onRenameSession:M,onDeleteSession:O}){const{t:D}=yr(),k=e.type==="local"?FC:S3,{attributes:A,listeners:j,setNodeRef:B,setActivatorNodeRef:W,transform:K,transition:I,isDragging:H}=S0({id:e.id}),F=R0(),q=_=>{const{active:L,over:P}=_;if(!P||L.id===P.id||!t)return;const V=t.map(Y=>Y.id),Q=V.indexOf(String(L.id)),z=V.indexOf(String(P.id));Q<0||z<0||rn.getState().reorderWindows(e.id,bd(V,Q,z))};return E.jsxs("div",{ref:B,style:{transform:Ni.Translate.toString(K),transition:I},"data-testid":`device-item-${e.id}`,className:Oe("group/device rounded-xl border border-border/60 overflow-hidden",a?"bg-chat-surface":n?"bg-muted/40":"bg-muted/20",H&&"opacity-60 shadow-lg"),onClick:n?void 0:c,children:[E.jsxs("div",{className:"relative px-3 py-1.5",children:[a&&E.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-muted-foreground/70"}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("button",{type:"button",ref:W,...A,...j,"aria-label":D("device.dragHandle"),onClick:_=>_.stopPropagation(),className:"touch-none cursor-grab shrink-0 -ml-1 text-muted-foreground/50 hover:text-muted-foreground opacity-100",children:E.jsx(gb,{className:"h-3.5 w-3.5 [@media(any-pointer:coarse)]:h-5 [@media(any-pointer:coarse)]:w-5"})}),E.jsx(k,{className:"h-4 w-4 text-muted-foreground shrink-0"}),E.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),E.jsx(AF,{deviceId:e.id,className:"shrink-0"}),E.jsx("div",{className:Oe("h-2 w-2 rounded-full shrink-0",n?"bg-emerald-500":"bg-gray-400")}),E.jsx(Cn,{variant:"ghost",size:"icon-xs",onClick:_=>{_.stopPropagation(),c()},"data-testid":n?`device-disconnect-${e.id}`:`device-connect-${e.id}`,title:D(n?"device.disconnect":"device.connect"),children:n?E.jsx(U3,{className:"h-3.5 w-3.5 text-orange-500"}):E.jsx(B3,{className:"h-3.5 w-3.5 text-emerald-500"})})]})]}),n&&E.jsxs("div",{className:"p-1.5 space-y-1.5 [@media(any-pointer:coarse)]:space-y-2",children:[!t&&E.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:D("device.connecting")}),(t==null?void 0:t.length)===0&&E.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:D("window.noWindows")}),t&&t.length>0&&E.jsx(b0,{sensors:F,collisionDetection:p0,onDragEnd:q,children:E.jsx(w0,{items:t.map(_=>_.id),strategy:x0,children:t.map(_=>E.jsx(sY,{deviceId:e.id,window:_,isSelected:_.id===s,selectedPaneId:i,onPaneClick:b,onWindowClick:x,onCloseWindow:h,onClosePane:f,onRenameWindow:g,onRenamePane:m,onWatchPane:w,sessionsByPane:S,activeSessionId:R,onSelectSession:T,onCreateSessionForPane:C,onRenameSession:M,onDeleteSession:O},_.id))})}),E.jsxs("button",{type:"button","data-testid":`window-create-${e.id}`,onPointerDown:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),onClick:()=>u(e.id),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors text-muted-foreground hover:text-foreground hover:bg-accent/30 border border-dashed border-border/50 hover:border-border",children:[E.jsx(Zh,{className:"h-3.5 w-3.5 shrink-0"}),E.jsx("span",{className:"text-xs",children:D("window.new")})]})]})]})}function sY({deviceId:e,window:t,isSelected:n,selectedPaneId:a,onPaneClick:s,onWindowClick:i,onCloseWindow:c,onClosePane:u,onRenameWindow:h,onRenamePane:f,onWatchPane:g,sessionsByPane:m,activeSessionId:b,onSelectSession:x,onCreateSessionForPane:w,onRenameSession:S,onDeleteSession:R}){const{t:T}=yr(),{isMobile:C}=qr(),M=t.panes.length>1,O=E0(t),D=t.panes.find(P=>P.active)??t.panes[0],k=D==null?void 0:D.currentPath,A=t.panes.find(P=>P.id===a),j=n&&!!A,{attributes:B,listeners:W,setNodeRef:K,setActivatorNodeRef:I,transform:H,transition:F,isDragging:q}=S0({id:t.id}),_=R0(),L=P=>{const{active:V,over:Q}=P;if(!Q||V.id===Q.id)return;const z=t.panes.map(G=>G.id),Y=z.indexOf(String(V.id)),X=z.indexOf(String(Q.id));Y<0||X<0||rn.getState().reorderPanes(e,t.id,bd(z,Y,X))};return E.jsxs("div",{ref:K,style:{transform:Ni.Translate.toString(H),transition:F},className:Oe("space-y-1",q&&"opacity-60"),children:[E.jsxs("div",{className:"group relative flex items-center gap-1",children:[E.jsx("button",{type:"button",ref:I,...B,...W,"aria-label":T("window.dragHandle"),onClick:P=>P.stopPropagation(),className:Oe("touch-none cursor-grab shrink-0 flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground opacity-100",C?"h-9 w-4":"h-6 w-3.5 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:w-4"),children:E.jsx(gb,{className:Oe(C?"h-4 w-4":"h-3.5 w-3.5")})}),E.jsxs("button",{type:"button",onClick:()=>i(e,t.id,t.panes),"data-testid":`window-item-${t.id}`,className:Oe("flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 rounded-lg text-left transition-colors pr-7 [@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:pr-12",C&&"py-2.5 pr-13",j?"bg-primary/10 text-primary":t.active?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"),children:[E.jsx(nY,{paneIds:t.panes.map(P=>P.id)}),M?E.jsx("span",{className:"flex-1 min-w-0 font-mono text-[10.5px] leading-tight text-muted-foreground",children:T("window.paneCount",{count:t.panes.length})}):E.jsxs("span",{className:"flex-1 min-w-0",children:[E.jsx("span",{className:"font-mono text-[11px] leading-tight font-medium line-clamp-2 [overflow-wrap:break-word]",children:O.title}),O.processName&&E.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:k?`${O.processName}@${k}`:O.processName})]})]}),!M&&E.jsxs(o0,{children:[E.jsx(s0,{"data-testid":`window-menu-${t.id}`,"aria-label":T("window.menu"),title:T("window.menu"),className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity data-popup-open:opacity-100",C?"h-11 w-11 right-0 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-1.5 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-0.5 [@media(any-pointer:coarse)]:rounded-lg",j?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),children:E.jsx(HC,{className:Oe(C?"h-5 w-5":"h-3.5 w-3.5 [@media(any-pointer:coarse)]:h-4.5 [@media(any-pointer:coarse)]:w-4.5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":`window-menu-rename-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>h(e,t.id),children:[E.jsx(Qh,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.rename")]}),E.jsxs(dr,{"data-testid":`window-menu-new-session-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>w(e,t.id,A||t.panes[0]),children:[E.jsx(Zh,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("agent.session.new")]}),k&&E.jsxs(dr,{className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().createWindow(e,void 0,k),children:[E.jsx(BC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.newInCwd")]}),D&&E.jsxs(E.Fragment,{children:[E.jsxs(dr,{"data-testid":`window-menu-split-right-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,D.id,"right",D.currentPath),children:[E.jsx(qC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.splitRight")]}),E.jsxs(dr,{"data-testid":`window-menu-split-down-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,D.id,"down",D.currentPath),children:[E.jsx($C,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.splitDown")]}),E.jsxs(dr,{"data-testid":`window-menu-watch-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>g(e,D.id),children:[E.jsx(VC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("watch.openMonitor")]})]}),E.jsxs(dr,{variant:"destructive","data-testid":`window-menu-close-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>c(e,t.id),children:[E.jsx(Ei,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.close")]})]})]})]}),M&&E.jsx("div",{className:"ml-4 pl-2 border-l border-border/50 space-y-1 [@media(any-pointer:coarse)]:space-y-1.5",children:E.jsx(b0,{sensors:_,collisionDetection:p0,onDragEnd:L,children:E.jsx(w0,{items:t.panes.map(P=>P.id),strategy:x0,children:t.panes.map(P=>E.jsx(iY,{deviceId:e,windowId:t.id,pane:P,isActive:P.id===a,isMobile:C,onPaneClick:s,onClosePane:u,onRenamePane:f,onWatchPane:g,onCreateSessionForPane:w,sessions:m.get(`${e}:${P.id}`),activeSessionId:b,onSelectSession:x,onRenameSession:S,onDeleteSession:R},P.id))})})}),!M&&t.panes[0]&&E.jsx("div",{className:"ml-[36px] pl-2 border-l border-border/50",children:E.jsx(sN,{sessions:m.get(`${e}:${t.panes[0].id}`),activeSessionId:b,onSelectSession:x,onRenameSession:S,onDeleteSession:R})})]})}function iY({deviceId:e,windowId:t,pane:n,isActive:a,isMobile:s,onPaneClick:i,onClosePane:c,onRenamePane:u,onWatchPane:h,onCreateSessionForPane:f,sessions:g,activeSessionId:m,onSelectSession:b,onRenameSession:x,onDeleteSession:w}){const{t:S}=yr(),{attributes:R,listeners:T,setNodeRef:C,setActivatorNodeRef:M,transform:O,transition:D,isDragging:k}=S0({id:n.id});return E.jsxs("div",{ref:C,style:{transform:Ni.Translate.toString(O),transition:D},className:Oe("group relative",k&&"opacity-60"),children:[E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("button",{type:"button",ref:M,...R,...T,"aria-label":S("window.dragHandlePane"),onClick:A=>A.stopPropagation(),className:Oe("touch-none cursor-grab shrink-0 flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground opacity-100",s?"h-9 w-4":"h-6 w-3 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:w-4"),children:E.jsx(gb,{className:Oe(s?"h-4 w-4":"h-3 w-3")})}),E.jsxs("button",{type:"button",onClick:()=>i(e,t,n.id),"data-testid":`pane-item-${n.id}`,className:Oe("flex-1 min-w-0 flex items-center gap-2 px-2 py-1 rounded-lg text-left transition-colors pr-13 [@media(any-pointer:coarse)]:py-2 [@media(any-pointer:coarse)]:pr-21",s&&"py-2.5 pr-24",a?"bg-primary/10 text-primary":n.active?"bg-accent text-accent-foreground":"hover:bg-accent/30 text-muted-foreground"),children:[E.jsx(rY,{paneId:n.id}),E.jsxs("span",{className:"flex-1 min-w-0",children:[E.jsx("span",{className:"font-mono text-[11px] leading-tight font-medium line-clamp-2 [overflow-wrap:break-word]",children:n.customName||n.title||S("window.pane")}),n.currentCommand&&E.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:n.currentPath?`${n.currentCommand}@${n.currentPath}`:n.currentCommand})]})]})]}),E.jsxs(o0,{children:[E.jsx(s0,{"data-testid":`pane-menu-${n.id}`,"aria-label":S("watch.openMonitor"),className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity data-popup-open:opacity-100",s?"h-11 w-11 right-11 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-7 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-10.5 [@media(any-pointer:coarse)]:rounded-lg",a?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),children:E.jsx(HC,{className:Oe(s?"h-5 w-5":"h-3.5 w-3.5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":`pane-menu-rename-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>u(e,n.id),children:[E.jsx(Qh,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.rename")]}),E.jsxs(dr,{"data-testid":`pane-menu-new-session-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>f(e,t,n),children:[E.jsx(Zh,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("agent.session.new")]}),n.currentPath&&E.jsxs(dr,{className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().createWindow(e,void 0,n.currentPath),children:[E.jsx(BC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.newInCwd")]}),E.jsxs(dr,{"data-testid":`pane-split-right-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,n.id,"right",n.currentPath),children:[E.jsx(qC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.splitRight")]}),E.jsxs(dr,{"data-testid":`pane-split-down-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,n.id,"down",n.currentPath),children:[E.jsx($C,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.splitDown")]}),E.jsxs(dr,{"data-testid":`pane-watch-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>h(e,n.id),children:[E.jsx(VC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("watch.openMonitor")]}),E.jsxs(dr,{variant:"destructive","data-testid":`pane-menu-close-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>c(e,t,n.id),children:[E.jsx(Ei,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.closePane")]})]})]}),E.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c(e,t,n.id)},"data-testid":`pane-close-${n.id}`,className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",s?"h-11 w-11 right-0 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-1.5 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-0.5 [@media(any-pointer:coarse)]:rounded-lg",a?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),title:S("window.closePane"),children:E.jsx("span",{className:Oe("leading-none",s?"text-base":"text-xs"),children:"×"})}),E.jsx(sN,{sessions:g,activeSessionId:m,onSelectSession:b,onRenameSession:x,onDeleteSession:w})]})}function oN({session:e,onRenameSession:t,onDeleteSession:n,className:a,enlargeOnTouch:s=!1}){const{t:i}=yr(),{isMobile:c}=qr(),u=s&&c;return E.jsxs(o0,{children:[E.jsx(s0,{render:E.jsx(Cn,{variant:"ghost",size:"icon-sm","data-testid":`agent-session-menu-${e.id}`,"aria-label":i("agent.session.rename"),onClick:h=>h.stopPropagation(),className:Oe("size-5 shrink-0 text-muted-foreground transition-opacity data-popup-open:opacity-100",c?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100",u&&"size-9",a)}),children:E.jsx(y3,{className:Oe("size-3.5",u&&"size-5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":"agent-session-rename",className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",c&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>t(e),children:[E.jsx(Qh,{className:Oe("h-4 w-4",c&&"h-5 w-5")}),i("agent.session.rename")]}),E.jsxs(dr,{variant:"destructive","data-testid":"agent-session-delete",className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",c&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>n(e),children:[E.jsx(KC,{className:Oe("h-4 w-4",c&&"h-5 w-5")}),i("agent.session.delete")]})]})]})}function sN({sessions:e,activeSessionId:t,onSelectSession:n,onRenameSession:a,onDeleteSession:s}){const{isMobile:i}=qr();return E.jsx("div",{className:"mt-1 space-y-0.5 [@media(any-pointer:coarse)]:space-y-1",children:e==null?void 0:e.map(c=>{const u=c.id===t;return E.jsxs("div",{className:"group relative",children:[E.jsxs("button",{type:"button","data-testid":`agent-session-item-${c.id}`,onClick:()=>n(c),className:Oe("w-full flex items-center gap-1.5 px-2 py-1 pr-7 rounded-md text-left transition-colors [@media(any-pointer:coarse)]:min-h-11 [@media(any-pointer:coarse)]:py-2 [@media(any-pointer:coarse)]:pr-12",i&&"min-h-11 py-2 pr-12",u?"bg-primary/10 text-primary":"hover:bg-accent/30 text-muted-foreground"),children:[E.jsx(pb,{className:"size-3 shrink-0 opacity-70"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px]",children:c.title}),E.jsx(aN,{status:c.status})]}),E.jsx("div",{className:"absolute right-0.5 top-1/2 -translate-y-1/2",children:E.jsx(oN,{session:c,onRenameSession:a,onDeleteSession:s,enlargeOnTouch:!0})})]},c.id)})})}function lY({sessions:e,activeSessionId:t,onSelectSession:n,onRenameSession:a,onDeleteSession:s}){const{t:i}=yr(),[c,u]=y.useState(!1),h=To(f=>{var g;return((g=f.settings)==null?void 0:g.language)??"en_US"});return E.jsxs(ZM,{open:c,onOpenChange:u,className:"rounded-xl border border-border/60 bg-muted/20",children:[E.jsxs(JM,{"data-testid":"agent-orphan-sessions-trigger",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left",children:[E.jsx(T3,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),E.jsx("span",{className:"flex-1 truncate text-xs font-medium text-muted-foreground",children:i("agent.orphan.title",{count:e.length})}),E.jsx(UC,{className:Oe("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")})]}),E.jsx(e2,{className:"space-y-0.5 px-1.5 pb-1.5",children:e.map(f=>{const g=f.id===t,m=[f.originPaneTitle,f.originProcessName,f.createdAt?new Date(f.createdAt).toLocaleString(UT(h)):null].filter(b=>!!b);return E.jsxs("div",{className:"group relative",children:[E.jsxs("button",{type:"button","data-testid":`agent-orphan-session-${f.id}`,onClick:()=>n(f),className:Oe("w-full flex flex-col gap-0.5 px-2 py-1.5 pr-7 rounded-lg text-left transition-colors",g?"bg-primary/10 text-primary":"hover:bg-accent/30"),children:[E.jsxs("span",{className:"flex items-center gap-1.5",children:[E.jsx(pb,{className:"size-3 shrink-0 opacity-70"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px]",children:f.title}),E.jsx(aN,{status:f.status})]}),m.length>0&&E.jsx("span",{className:"truncate pl-[18px] text-[10px] text-muted-foreground",children:m.join(" · ")})]}),E.jsx("div",{className:"absolute right-0.5 top-1.5",children:E.jsx(oN,{session:f,onRenameSession:a,onDeleteSession:s})})]},f.id)})})]})}function cY(){const{t:e}=yr(),{isMobile:t,setOpenMobile:n}=qr(),a=To(g=>{var m;return(m=g.settings)==null?void 0:m.siteName}),s=To(g=>g.fetchSettings);y.useEffect(()=>{s()},[s]);const i=a??"tmex",c=Ar(g=>g.theme),u=To(g=>g.updateTheme),h=c==="dark",f=()=>{const g=h?"light":"dark";u(g),document.documentElement.classList.toggle("dark",g==="dark")};return E.jsxs("div",{className:"flex items-center gap-2 px-2",children:[t&&E.jsx("button",{type:"button","data-testid":"mobile-sidebar-close",onClick:()=>n(!1),className:"inline-flex h-8 w-8 ml-[-8px] shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e("nav.closeSidebar"),title:e("nav.closeSidebar"),children:E.jsx(Ei,{className:"h-4 w-4"})}),E.jsxs(Hh,{to:"/",className:"flex flex-1 items-center gap-3 overflow-hidden",children:[E.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-lg border-2 border-black",children:E.jsx("img",{src:"/logo.png",alt:i,className:"h-full w-full object-cover"})}),E.jsx("span",{className:"truncate text-sm font-semibold tracking-tight",children:i})]}),E.jsx(uY,{}),E.jsx("button",{type:"button",onClick:f,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e(h?"settings.themeLight":"settings.themeDark"),title:e(h?"settings.themeLight":"settings.themeDark"),children:h?E.jsx(Q3,{className:"h-4 w-4"}):E.jsx(D3,{className:"h-4 w-4"})}),E.jsx(Hh,{to:"/settings",className:"inline-flex h-8 w-8 mr-[-8px] shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e("sidebar.settings"),title:e("sidebar.settings"),children:E.jsx(q3,{className:"h-4 w-4"})})]})}function uY(){const e=rn(n=>n.wsLatencyMs);if(e===null)return null;const t=e>=200;return E.jsxs("span",{className:`inline-flex h-8 shrink-0 items-center text-xs tabular-nums ${t?"text-orange-400":"text-muted-foreground"}`,children:[e,"ms"]})}const dY=y.lazy(()=>Ro(()=>import("./agent-tab-B77EotmX.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.AgentTab}))),fY=y.lazy(()=>Ro(()=>import("./files-tab-C841Mmn_.js"),__vite__mapDeps([4,5,6,7,8,9])).then(e=>({default:e.FilesTab}))),Ny="rounded-lg data-active:bg-background data-active:text-foreground data-active:border-transparent group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:bg-input/60 dark:data-active:border-transparent text-[13px] transition-colors duration-200 [&_svg:not([class*='size-'])]:size-[15px]",hY=[{title:"nav.manageDevices",url:"/devices",icon:FC}];function mY({...e}){const{t}=yr(),n=Ar(s=>s.sidebarTab),a=Ar(s=>s.setSidebarTab);return E.jsxs(D8,{variant:"inset",...e,children:[E.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),E.jsxs(L8,{className:"gap-5 pt-3 pb-0",children:[E.jsx(cY,{}),E.jsx(fF,{className:"mb-2.5",value:n,onValueChange:s=>a(s),children:E.jsxs(mF,{className:"w-full p-1 rounded-xl border border-border/60 group-data-horizontal/tabs:h-11",children:[E.jsxs(yy,{value:"panes","data-testid":"sidebar-tab-panes",className:Ny,children:[E.jsx(L3,{}),t("sidebar.tab.panes")]}),E.jsxs(yy,{value:"agent","data-testid":"sidebar-tab-agent",className:Ny,children:[E.jsx(pb,{}),t("sidebar.tab.agent")]}),E.jsxs(yy,{value:"files","data-testid":"sidebar-tab-files",className:Ny,children:[E.jsx(b3,{}),t("sidebar.tab.files")]})]})})]}),E.jsxs(P8,{className:"flex min-h-0 flex-col overflow-hidden",children:[n==="panes"&&E.jsx(aY,{}),n==="agent"&&E.jsx(y.Suspense,{fallback:null,children:E.jsx(dY,{})}),n==="files"&&E.jsx(y.Suspense,{fallback:null,children:E.jsx(fY,{})})]}),n==="panes"&&E.jsxs(I8,{children:[E.jsx(OF,{items:hY}),E.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})}let uT=!1;function pY(e,t,n){var s,i,c;let a=n;if(!a){const u=(i=(s=rn.getState().snapshots[e])==null?void 0:s.session)==null?void 0:i.windows;a=(c=u==null?void 0:u.find(h=>h.panes.some(f=>f.id===t)))==null?void 0:c.id}return a?`/devices/${e}/windows/${a}/panes/${rN(t)}`:`/devices/${e}`}function gY(e,t){const n=e.getQueriesData({queryKey:["watch-rules"]});for(const[,a]of n){const s=a==null?void 0:a.find(i=>i.id===t);if(s)return s.name}return null}async function yY(e,t){var a;const n=gY(e,t);if(n)return n;try{const s=await fetch(`/api/watch/rules/${t}`);return s.ok?((a=(await s.json()).rule)==null?void 0:a.name)??null:null}catch{return null}}function vY(e,t,n){if(!(typeof Notification>"u"||Notification.permission!=="granted"))try{const a=new Notification(e,{body:t});a.onclick=()=>{window.focus(),fb(n)}}catch{}}function bY(e,t){e.invalidateQueries({queryKey:["watch-rules"]}),e.invalidateQueries({queryKey:["watch-rule-state",t]})}async function xY(e,t,n,a,s){const c=await yY(e,t)??en.t("watch.toast.triggeredTitle"),u=s.summary||s.matchedText||"",h=u.length>200?`${u.slice(0,200)}…`:u,f=pY(n,a,s.windowId);dn(c,{description:h,action:{label:en.t("watch.toast.openTerminal"),onClick:()=>{fb(f)}}}),vY(c,h,f)}function wY(e){if(uT)return;uT=!0,Jt().onMessage(n=>{if(n.kind!==ej)return;let a;try{a=wa(Yj,n.payload)}catch(i){console.error("[watch] failed to decode WATCH_EVENT:",i);return}let s;try{s=JSON.parse(new TextDecoder().decode(a.payload))}catch(i){console.error("[watch] failed to parse WATCH_EVENT payload:",i);return}switch(bY(e,a.ruleId),a.eventType){case y_:xY(e,a.ruleId,a.deviceId,a.paneId,s);return;case v_:{const i=s;dn.warning(en.t("watch.toast.modelUnavailableTitle"),{description:`${i.message} ${en.t("watch.toast.modelUnavailableHint")}`});return}case b_:{const i=s;dn.error(en.t("watch.toast.ruleErrorTitle"),{description:i.message});return}default:return}})}function SY(){const e=Ju(),t=rn(n=>n.ensureSocketConnected);return y.useEffect(()=>{wY(e),t()},[e,t]),null}let $u=null;function iq(e){$u=e}function lq(e){$u===e&&($u=null)}function EY(){return $u?$u():null}const RY=60,TY=.02;function CY(e){if(Math.abs(e.viewportScale-1)>TY)return 0;const t=Math.round(e.windowInnerHeight-e.viewportHeight-e.viewportOffsetTop);return t>=RY?t:0}function OY(e){const t=e.windowInnerHeight-e.inset,a=e.cursorBottomClientY+e.appliedOffset+e.margin-t,s=e.maxOffset??e.inset;return Math.min(Math.max(0,Math.round(a)),s)}function cq(){if(typeof navigator>"u")return!1;const e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return t||n}function MY(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}const oh={strategy:"none"},NY=8,AY=60,DY='[data-slot="sidebar-inset"]',dT=".terminal-shortcuts-strip",fT="--tmex-kb-shortcut-lift";function kY(e,t){return e.strategy!==t.strategy?!1:e.strategy==="transform"&&t.strategy==="transform"?Math.abs(e.offset-t.offset)<1:e.strategy==="height"&&t.strategy==="height"?Math.abs(e.height-t.height)<1:!0}function jY(e,t){const[n,a]=y.useState(oh);return y.useEffect(()=>{if(!MY())return;const s=window.visualViewport;if(!s)return;let i=null,c=null,u=oh,h=null,f=0;const g=D=>{kY(u,D)||(u=D,a(D))},m=()=>{if((!h||!h.isConnected)&&(h=document.querySelector(DY)),!h)return 0;const D=window.getComputedStyle(h).transform;if(!D||D==="none")return 0;try{return-new DOMMatrix(D).m42}catch{return 0}},b=D=>{f=Math.round(D),document.documentElement.style.setProperty(fT,`${f}px`)},x=D=>{const k=document.querySelector(dT);if(!k){b(0);return}const A=k.getBoundingClientRect().bottom,j=window.innerHeight-D;b(f+(A-j))},w=()=>{const D=document.querySelector(dT);return D?D.offsetHeight:0},S=()=>{if(e)return 0;const D=document.activeElement;return D instanceof Element&&D.closest("[data-virtual-keyboard-avoid]")!==null?CY({windowInnerHeight:window.innerHeight,viewportHeight:s.height,viewportOffsetTop:s.offsetTop,viewportScale:s.scale}):0},R=()=>{const D=S();if(D<=0){b(0),g(oh),M();return}if(t==="resize"){b(0);const k=window.innerHeight-D;k>=AY?g({strategy:"height",height:k}):g({strategy:"transform",offset:D}),M();return}if(t==="follow"){const k=EY();if(k){const A=w(),j=OY({cursorBottomClientY:k.bottom,appliedOffset:m(),windowInnerHeight:window.innerHeight,inset:D,margin:NY+A,maxOffset:D+A});g(j>0?{strategy:"transform",offset:j}:oh),x(D)}else b(0),g({strategy:"transform",offset:D});C();return}b(0),g({strategy:"transform",offset:D}),M()},T=()=>{c=null,R()},C=()=>{c===null&&(c=window.requestAnimationFrame(T))},M=()=>{c!==null&&(window.cancelAnimationFrame(c),c=null)},O=()=>{i===null&&(i=window.requestAnimationFrame(()=>{i=null,R()}))};return R(),s.addEventListener("resize",O),s.addEventListener("scroll",O),window.addEventListener("resize",O),document.addEventListener("focusin",O),document.addEventListener("focusout",O),()=>{s.removeEventListener("resize",O),s.removeEventListener("scroll",O),window.removeEventListener("resize",O),document.removeEventListener("focusin",O),document.removeEventListener("focusout",O),i!==null&&window.cancelAnimationFrame(i),M(),document.documentElement.style.removeProperty(fT)}},[e,t]),n}const iN="NotoSansSymbols2Tmex";function lN(e){return Jg.find(t=>t.id===e)??Jg.find(t=>t.id===_C)??Jg[0]}function _Y(e){return`${lN(e).cssFamily}, ${iN}, monospace`}const hT=new Set;function LY(e){const t=globalThis.document;if(!t||!e.files||hT.has(e.cssFamily))return;const n=t.createElement("style");n.dataset.tmexFont=e.id,n.textContent=`@font-face{font-family:${e.cssFamily};src:url("${e.files.regular}") format("woff2");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:${e.cssFamily};src:url("${e.files.bold}") format("woff2");font-weight:700;font-style:normal;font-display:swap}`,t.head.appendChild(n),hT.add(e.cssFamily)}async function IY(e,t){var s;const n=(s=globalThis.document)==null?void 0:s.fonts;if(!(n!=null&&n.load))return;const a=lN(e);a.isDefault||LY(a);try{await Promise.all([a.cssFamily,iN].flatMap(i=>[n.load(`${t}px ${i}`),n.load(`bold ${t}px ${i}`)]))}catch{}}function PY(){const e=Ar(n=>n.terminalFontId),t=Ar(n=>n.terminalFontSize);y.useEffect(()=>{IY(e,t);const n=globalThis.document;n==null||n.documentElement.style.setProperty("--font-mono",_Y(e))},[e,t])}console.info(`tmex ${sk("0.16.3",!0)}`);function zY(){var e;try{const t=localStorage.getItem("tmex-ui");if(!t){document.documentElement.classList.add("dark");return}const n=JSON.parse(t),a=(e=n==null?void 0:n.state)==null?void 0:e.theme,s=a==="dark"||a===void 0;document.documentElement.classList.toggle("dark",s)}catch{document.documentElement.classList.add("dark")}}zY();const UY=new $D({defaultOptions:{queries:{staleTime:5e3,retry:1}}});function HY(){const{openMobile:e}=qr(),t=Ar(n=>n.theme);return y.useEffect(()=>{const n=e?"--sidebar":"--background";document.body.style.backgroundColor=`var(${n})`,requestAnimationFrame(()=>{var i;const s=getComputedStyle(document.body).backgroundColor;(i=document.querySelector('meta[name="theme-color"]'))==null||i.setAttribute("content",s)})},[e,t]),null}function BY(){const e=Ar(t=>t.theme);return E.jsx(n5,{theme:e,richColors:!0,position:"top-right",closeButton:!0,offset:{top:"calc(16px + env(safe-area-inset-top, 0px))",right:"16px",bottom:"16px",left:"16px"},mobileOffset:{top:"calc(12px + env(safe-area-inset-top, 0px))",right:"12px",bottom:"12px",left:"12px"},toastOptions:{duration:6e3}})}function FY(){return PY(),E.jsxs(G8,{children:[E.jsx(SY,{}),E.jsxs(A8,{children:[E.jsx(HY,{}),E.jsx($8,{}),E.jsx(mY,{}),E.jsx(VY,{})]})]})}function VY(){const{openMobile:e}=qr(),t=Ar(i=>i.keyboardBehaviorMode),n=jY(e,t),a=n.strategy!=="none",s=n.strategy==="transform"?{transform:`translateY(-${n.offset}px)`,transition:t==="follow"?void 0:"transform 0.12s ease-out"}:n.strategy==="height"?{height:`${n.height}px`,transition:"height 0.12s ease-out"}:void 0;return E.jsxs(_8,{className:"h-dvh overflow-hidden md:h-[calc(100dvh-1rem)]",style:s,children:[E.jsx($I,{}),E.jsx("div",{style:{height:a?0:"var(--tmex-safe-area-bottom)",transition:"height 0.12s ease-out"}})]})}function pl({moduleLoader:e}){const[t,n]=y.useState(null),a=RI();y.useEffect(()=>{e().then(n)},[e]);const s=t==null?void 0:t.default,i=t==null?void 0:t.PageTitle,c=t==null?void 0:t.PageActions;return E.jsxs(E.Fragment,{children:[E.jsxs("header",{className:"sticky top-0 z-10 flex h-12 md:h-16 shrink-0 items-center justify-between gap-2 bg-background/95 backdrop-blur-sm","data-testid":"mobile-topbar",children:[E.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-4",children:[E.jsx(j8,{className:"-ml-1 shrink-0","data-testid":"mobile-sidebar-open"}),E.jsx(OH,{orientation:"vertical",className:"mr-2 shrink-0 data-[orientation=vertical]:h-4"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i?E.jsx(i,{...a}):""})]}),E.jsx("div",{className:"flex shrink-0 items-center gap-1 px-4",children:c&&E.jsx(c,{...a})})]}),E.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 !pt-0 p-2 md:p-4",children:E.jsx("div",{className:"bg-muted/50 min-h-0 flex-1 overflow-auto overscroll-auto rounded-xl [-webkit-overflow-scrolling:touch]",children:s?E.jsx(s,{}):null})})]})}const YY=()=>Ro(()=>import("./SettingsPage-CKZEPwEq.js"),__vite__mapDeps([10,11,6,12,5,2,13,1,14,9])),mT=()=>Ro(()=>import("./DevicesPage-WMW0FcaU.js"),__vite__mapDeps([15,11,3])),pT=()=>Ro(()=>import("./DevicePage-DtByPprm.js"),__vite__mapDeps([16,12,5,2,8])),qY=()=>Ro(()=>import("./FilePage-C3yjgRDh.js"),__vite__mapDeps([17,13,1,14,6,7])),$Y=yP([{path:"/",Component:FY,children:[{index:!0,element:E.jsx(pl,{moduleLoader:mT})},{path:"devices",element:E.jsx(pl,{moduleLoader:mT})},{path:"devices/:deviceId",element:E.jsx(pl,{moduleLoader:pT})},{path:"devices/:deviceId/windows/:windowId/panes/:paneId",element:E.jsx(pl,{moduleLoader:pT})},{path:"settings",element:E.jsx(pl,{moduleLoader:YY})},{path:"file/:ref",element:E.jsx(pl,{moduleLoader:qY})}]}]),cN=document.getElementById("root");if(!cN)throw new Error("Root element not found");q5.catch(()=>{}).then(()=>{rL.createRoot(cN).render(E.jsx(y.StrictMode,{children:E.jsxs(GD,{client:UY,children:[E.jsx(VI,{router:$Y}),E.jsx(t4,{}),E.jsx(BY,{})]})}))});export{VC as $,wv as A,Cn as B,Nv as C,o0 as D,y3 as E,Av as F,S3 as G,Dv as H,kv as I,t2 as J,va as K,ub as L,FC as M,vy as N,xy as O,Zh as P,by as Q,wy as R,OH as S,KC as T,ni as U,l9 as V,_R as W,Oe as X,Zt as Y,en as Z,OT as _,Ju as a,eV as a$,_9 as a0,Ty as a1,jv as a2,b0 as a3,p0 as a4,w0 as a5,x0 as a6,bd as a7,Z7 as a8,y0 as a9,rq as aA,K3 as aB,aq as aC,$B as aD,WB as aE,QB as aF,ZB as aG,JB as aH,lq as aI,ZY as aJ,iq as aK,mb as aL,RI as aM,sq as aN,cq as aO,rN as aP,oq as aQ,E4 as aR,CV as aS,TV as aT,qC as aU,$C as aV,d9 as aW,$n as aX,Di as aY,IF as aZ,a2 as a_,K2 as aa,$2 as ab,S0 as ac,gb as ad,Ni as ae,Ar as af,IY as ag,G_ as ah,X_ as ai,_Y as aj,lN as ak,Jg as al,l3 as am,ZM as an,JM as ao,UC as ap,$l as aq,e2 as ar,m3 as as,Ei as at,eq as au,tq as av,ob as aw,WY as ax,ri as ay,nq as az,To as b,pd as b0,ks as b1,jn as b2,qt as b3,Nt as b4,gr as b5,Mt as b6,yv as b7,ur as b8,c2 as b9,XY as bA,Ro as bB,yt as ba,VO as bb,Ci as bc,KF as bd,GF as be,qF as bf,YO as bg,FF as bh,od as bi,LC as bj,BC as bk,$5 as bl,QY as bm,zM as bn,xV as bo,pb as bp,qr as bq,qa as br,Yl as bs,Pe as bt,q3 as bu,o3 as bv,fF as bw,mF as bx,yy as by,Ny as bz,ed as c,rn as d,ju as e,Sv as f,Ev as g,jR as h,Tv as i,E as j,Cv as k,Rv as l,Mv as m,Ov as n,dn as o,s0 as p,i0 as q,y as r,dr as s,UT as t,yr as u,Qh as v,JY as w,Bu as x,AF as y,NU as z};
314
+ `},k9={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function j9(e){let{announcements:t=k9,container:n,hiddenTextDescribedById:a,screenReaderInstructions:s=D9}=e;const{announce:i,announcement:c}=M9(),u=vd("DndLiveRegion"),[h,f]=y.useState(!1);if(y.useEffect(()=>{f(!0)},[]),N9(y.useMemo(()=>({onDragStart(m){let{active:b}=m;i(t.onDragStart({active:b}))},onDragMove(m){let{active:b,over:x}=m;t.onDragMove&&i(t.onDragMove({active:b,over:x}))},onDragOver(m){let{active:b,over:x}=m;i(t.onDragOver({active:b,over:x}))},onDragEnd(m){let{active:b,over:x}=m;i(t.onDragEnd({active:b,over:x}))},onDragCancel(m){let{active:b,over:x}=m;i(t.onDragCancel({active:b,over:x}))}}),[i,t])),!h)return null;const g=Pe.createElement(Pe.Fragment,null,Pe.createElement(C9,{id:a,value:s.draggable}),Pe.createElement(O9,{id:u,announcement:c}));return n?or.createPortal(g,n):g}var qn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(qn||(qn={}));function qh(){}function Ty(e,t){return y.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _9(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Ra=Object.freeze({x:0,y:0});function _2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L2(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return n-a}function L9(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function QR(e){let{left:t,top:n,height:a,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+a},{x:t+s,y:n+a}]}function I2(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ZR(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const p0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=ZR(t,t.left,t.top),i=[];for(const c of a){const{id:u}=c,h=n.get(u);if(h){const f=_2(ZR(h),s);i.push({id:u,data:{droppableContainer:c,value:f}})}}return i.sort(L2)},I9=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=QR(t),i=[];for(const c of a){const{id:u}=c,h=n.get(u);if(h){const f=QR(h),g=s.reduce((b,x,w)=>b+_2(f[w],x),0),m=Number((g/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(L2)};function P9(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=s-a,u=i-n;if(a<s&&n<i){const h=t.width*t.height,f=e.width*e.height,g=c*u,m=g/(h+f-g);return Number(m.toFixed(4))}return 0}const z9=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const s=[];for(const i of a){const{id:c}=i,u=n.get(c);if(u){const h=P9(u,t);h>0&&s.push({id:c,data:{droppableContainer:i,value:h}})}}return s.sort(L9)};function U9(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function P2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ra}function H9(e){return function(n){for(var a=arguments.length,s=new Array(a>1?a-1:0),i=1;i<a;i++)s[i-1]=arguments[i];return s.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const B9=H9(1);function F9(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function V9(e,t,n){const a=F9(t);if(!a)return e;const{scaleX:s,scaleY:i,x:c,y:u}=a,h=e.left-c-(1-s)*parseFloat(n),f=e.top-u-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=s?e.width/s:e.width,m=i?e.height/i:e.height;return{width:g,height:m,top:f,right:h+g,bottom:f+m,left:h}}const Y9={ignoreTransform:!1};function fc(e,t){t===void 0&&(t=Y9);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:g}=Dr(e).getComputedStyle(e);f&&(n=V9(n,f,g))}const{top:a,left:s,width:i,height:c,bottom:u,right:h}=n;return{top:a,left:s,width:i,height:c,bottom:u,right:h}}function JR(e){return fc(e,{ignoreTransform:!0})}function q9(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $9(e,t){return t===void 0&&(t=Dr(e).getComputedStyle(e)),t.position==="fixed"}function K9(e,t){t===void 0&&(t=Dr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Sm(e,t){const n=[];function a(s){if(t!=null&&n.length>=t||!s)return n;if(f0(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!gd(s)||D2(s)||n.includes(s))return n;const i=Dr(e).getComputedStyle(s);return s!==e&&K9(s,i)&&n.push(s),$9(s,i)?n:a(s.parentNode)}return e?a(e):n}function z2(e){const[t]=Sm(e,1);return t??null}function Cy(e){return!wm||!e?null:uc(e)?e:d0(e)?f0(e)||e===dc(e).scrollingElement?window:gd(e)?e:null:null}function U2(e){return uc(e)?e.scrollX:e.scrollLeft}function H2(e){return uc(e)?e.scrollY:e.scrollTop}function Hv(e){return{x:U2(e),y:H2(e)}}var Qn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Qn||(Qn={}));function B2(e){return!wm||!e?!1:e===document.scrollingElement}function F2(e){const t={x:0,y:0},n=B2(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=a.y,u=e.scrollLeft>=a.x;return{isTop:s,isLeft:i,isBottom:c,isRight:u,maxScroll:a,minScroll:t}}const G9={x:.2,y:.2};function X9(e,t,n,a,s){let{top:i,left:c,right:u,bottom:h}=n;a===void 0&&(a=10),s===void 0&&(s=G9);const{isTop:f,isBottom:g,isLeft:m,isRight:b}=F2(e),x={x:0,y:0},w={x:0,y:0},S={height:t.height*s.y,width:t.width*s.x};return!f&&i<=t.top+S.height?(x.y=Qn.Backward,w.y=a*Math.abs((t.top+S.height-i)/S.height)):!g&&h>=t.bottom-S.height&&(x.y=Qn.Forward,w.y=a*Math.abs((t.bottom-S.height-h)/S.height)),!b&&u>=t.right-S.width?(x.x=Qn.Forward,w.x=a*Math.abs((t.right-S.width-u)/S.width)):!m&&c<=t.left+S.width&&(x.x=Qn.Backward,w.x=a*Math.abs((t.left+S.width-c)/S.width)),{direction:x,speed:w}}function W9(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:a,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:s,width:e.clientWidth,height:e.clientHeight}}function V2(e){return e.reduce((t,n)=>Dl(t,Hv(n)),Ra)}function Q9(e){return e.reduce((t,n)=>t+U2(n),0)}function Z9(e){return e.reduce((t,n)=>t+H2(n),0)}function J9(e,t){if(t===void 0&&(t=fc),!e)return;const{top:n,left:a,bottom:s,right:i}=t(e);z2(e)&&(s<=0||i<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const e7=[["x",["left","right"],Q9],["y",["top","bottom"],Z9]];class g0{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=Sm(n),s=V2(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of e7)for(const h of c)Object.defineProperty(this,h,{get:()=>{const f=u(a),g=s[i]-f;return this.rect[h]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Nu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var s;(s=this.target)==null||s.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function t7(e){const{EventTarget:t}=Dr(e);return e instanceof t?e:dc(e)}function Oy(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var oa;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oa||(oa={}));function eT(e){e.preventDefault()}function n7(e){e.stopPropagation()}var Qt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Qt||(Qt={}));const Y2={start:[Qt.Space,Qt.Enter],cancel:[Qt.Esc],end:[Qt.Space,Qt.Enter,Qt.Tab]},r7=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qt.Right:return{...n,x:n.x+25};case Qt.Left:return{...n,x:n.x-25};case Qt.Down:return{...n,y:n.y+25};case Qt.Up:return{...n,y:n.y-25}}};class y0{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Nu(dc(n)),this.windowListeners=new Nu(Dr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oa.Resize,this.handleCancel),this.windowListeners.add(oa.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oa.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&J9(a),n(Ra)}handleKeyDown(t){if(m0(t)){const{active:n,context:a,options:s}=this.props,{keyboardCodes:i=Y2,coordinateGetter:c=r7,scrollBehavior:u="smooth"}=s,{code:h}=t;if(i.end.includes(h)){this.handleEnd(t);return}if(i.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:f}=a.current,g=f?{x:f.left,y:f.top}:Ra;this.referenceCoordinates||(this.referenceCoordinates=g);const m=c(t,{active:n,context:a.current,currentCoordinates:g});if(m){const b=Yu(m,g),x={x:0,y:0},{scrollableAncestors:w}=a.current;for(const S of w){const R=t.code,{isTop:T,isRight:C,isLeft:M,isBottom:O,maxScroll:D,minScroll:k}=F2(S),A=W9(S),j={x:Math.min(R===Qt.Right?A.right-A.width/2:A.right,Math.max(R===Qt.Right?A.left:A.left+A.width/2,m.x)),y:Math.min(R===Qt.Down?A.bottom-A.height/2:A.bottom,Math.max(R===Qt.Down?A.top:A.top+A.height/2,m.y))},B=R===Qt.Right&&!C||R===Qt.Left&&!M,W=R===Qt.Down&&!O||R===Qt.Up&&!T;if(B&&j.x!==m.x){const K=S.scrollLeft+b.x,I=R===Qt.Right&&K<=D.x||R===Qt.Left&&K>=k.x;if(I&&!b.y){S.scrollTo({left:K,behavior:u});return}I?x.x=S.scrollLeft-K:x.x=R===Qt.Right?S.scrollLeft-D.x:S.scrollLeft-k.x,x.x&&S.scrollBy({left:-x.x,behavior:u});break}else if(W&&j.y!==m.y){const K=S.scrollTop+b.y,I=R===Qt.Down&&K<=D.y||R===Qt.Up&&K>=k.y;if(I&&!b.x){S.scrollTo({top:K,behavior:u});return}I?x.y=S.scrollTop-K:x.y=R===Qt.Down?S.scrollTop-D.y:S.scrollTop-k.y,x.y&&S.scrollBy({top:-x.y,behavior:u});break}}this.handleMove(t,Dl(Yu(m,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}y0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Y2,onActivation:s}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(a.start.includes(c)){const u=i.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function tT(e){return!!(e&&"distance"in e)}function nT(e){return!!(e&&"delay"in e)}class v0{constructor(t,n,a){var s;a===void 0&&(a=t7(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=dc(c),this.documentListeners=new Nu(this.document),this.listeners=new Nu(a),this.windowListeners=new Nu(Dr(c)),this.initialCoordinates=(s=Uv(i))!=null?s:Ra,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(oa.Resize,this.handleCancel),this.windowListeners.add(oa.DragStart,eT),this.windowListeners.add(oa.VisibilityChange,this.handleCancel),this.windowListeners.add(oa.ContextMenu,eT),this.documentListeners.add(oa.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nT(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(tT(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:s}=this.props;s(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(oa.Click,n7,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oa.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:s,props:i}=this,{onMove:c,options:{activationConstraint:u}}=i;if(!s)return;const h=(n=Uv(t))!=null?n:Ra,f=Yu(s,h);if(!a&&u){if(tT(u)){if(u.tolerance!=null&&Oy(f,u.tolerance))return this.handleCancel();if(Oy(f,u.distance))return this.handleStart()}if(nT(u)&&Oy(f,u.tolerance))return this.handleCancel();this.handlePending(u,f);return}t.cancelable&&t.preventDefault(),c(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Qt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const a7={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class q2 extends v0{constructor(t){const{event:n}=t,a=dc(n.target);super(t,a7,a)}}q2.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a==null||a({event:n}),!0)}}];const o7={move:{name:"mousemove"},end:{name:"mouseup"}};var Bv;(function(e){e[e.RightClick=2]="RightClick"})(Bv||(Bv={}));class $2 extends v0{constructor(t){super(t,o7,dc(t.event.target))}}$2.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Bv.RightClick?!1:(a==null||a({event:n}),!0)}}];const My={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class K2 extends v0{constructor(t){super(t,My)}static setup(){return window.addEventListener(My.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(My.move.name,t)};function t(){}}}K2.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:s}=n;return s.length>1?!1:(a==null||a({event:n}),!0)}}];var Au;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Au||(Au={}));var $h;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($h||($h={}));function s7(e){let{acceleration:t,activator:n=Au.Pointer,canScroll:a,draggingRect:s,enabled:i,interval:c=5,order:u=$h.TreeOrder,pointerCoordinates:h,scrollableAncestors:f,scrollableAncestorRects:g,delta:m,threshold:b}=e;const x=l7({delta:m,disabled:!i}),[w,S]=w9(),R=y.useRef({x:0,y:0}),T=y.useRef({x:0,y:0}),C=y.useMemo(()=>{switch(n){case Au.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Au.DraggableRect:return s}},[n,s,h]),M=y.useRef(null),O=y.useCallback(()=>{const k=M.current;if(!k)return;const A=R.current.x*T.current.x,j=R.current.y*T.current.y;k.scrollBy(A,j)},[]),D=y.useMemo(()=>u===$h.TreeOrder?[...f].reverse():f,[u,f]);y.useEffect(()=>{if(!i||!f.length||!C){S();return}for(const k of D){if((a==null?void 0:a(k))===!1)continue;const A=f.indexOf(k),j=g[A];if(!j)continue;const{direction:B,speed:W}=X9(k,j,C,t,b);for(const K of["x","y"])x[K][B[K]]||(W[K]=0,B[K]=0);if(W.x>0||W.y>0){S(),M.current=k,w(O,c),R.current=W,T.current=B;return}}R.current={x:0,y:0},T.current={x:0,y:0},S()},[t,O,a,S,i,c,JSON.stringify(C),JSON.stringify(x),w,f,D,g,JSON.stringify(b)])}const i7={x:{[Qn.Backward]:!1,[Qn.Forward]:!1},y:{[Qn.Backward]:!1,[Qn.Forward]:!1}};function l7(e){let{delta:t,disabled:n}=e;const a=zv(t);return yd(s=>{if(n||!a||!s)return i7;const i={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[Qn.Backward]:s.x[Qn.Backward]||i.x===-1,[Qn.Forward]:s.x[Qn.Forward]||i.x===1},y:{[Qn.Backward]:s.y[Qn.Backward]||i.y===-1,[Qn.Forward]:s.y[Qn.Forward]||i.y===1}}},[n,t,a])}function c7(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return yd(s=>{var i;return t==null?null:(i=a??s)!=null?i:null},[a,t])}function u7(e,t){return y.useMemo(()=>e.reduce((n,a)=>{const{sensor:s}=a,i=s.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,a)}));return[...n,...i]},[]),[e,t])}var qu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qu||(qu={}));var Fv;(function(e){e.Optimized="optimized"})(Fv||(Fv={}));const rT=new Map;function d7(e,t){let{dragging:n,dependencies:a,config:s}=t;const[i,c]=y.useState(null),{frequency:u,measure:h,strategy:f}=s,g=y.useRef(e),m=R(),b=Vu(m),x=y.useCallback(function(T){T===void 0&&(T=[]),!b.current&&c(C=>C===null?T:C.concat(T.filter(M=>!C.includes(M))))},[b]),w=y.useRef(null),S=yd(T=>{if(m&&!n)return rT;if(!T||T===rT||g.current!==e||i!=null){const C=new Map;for(let M of e){if(!M)continue;if(i&&i.length>0&&!i.includes(M.id)&&M.rect.current){C.set(M.id,M.rect.current);continue}const O=M.node.current,D=O?new g0(h(O),O):null;M.rect.current=D,D&&C.set(M.id,D)}return C}return T},[e,i,n,m,h]);return y.useEffect(()=>{g.current=e},[e]),y.useEffect(()=>{m||x()},[n,m]),y.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),y.useEffect(()=>{m||typeof u!="number"||w.current!==null||(w.current=setTimeout(()=>{x(),w.current=null},u))},[u,m,x,...a]),{droppableRects:S,measureDroppableContainers:x,measuringScheduled:i!=null};function R(){switch(f){case qu.Always:return!1;case qu.BeforeDragging:return n;default:return!n}}}function G2(e,t){return yd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function f7(e,t){return G2(e,t)}function h7(e){let{callback:t,disabled:n}=e;const a=h0(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(a)},[a,n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Em(e){let{callback:t,disabled:n}=e;const a=h0(t),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(a)},[n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function m7(e){return new g0(fc(e),e)}function aT(e,t,n){t===void 0&&(t=m7);const[a,s]=y.useState(null);function i(){s(h=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=h??n)!=null?f:null}const g=t(e);return JSON.stringify(h)===JSON.stringify(g)?h:g})}const c=h7({callback(h){if(e)for(const f of h){const{type:g,target:m}=f;if(g==="childList"&&m instanceof HTMLElement&&m.contains(e)){i();break}}}}),u=Em({callback:i});return Ya(()=>{i(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),a}function p7(e){const t=G2(e);return P2(e,t)}const oT=[];function g7(e){const t=y.useRef(e),n=yd(a=>e?a&&a!==oT&&e&&t.current&&e.parentNode===t.current.parentNode?a:Sm(e):oT,[e]);return y.useEffect(()=>{t.current=e},[e]),n}function y7(e){const[t,n]=y.useState(null),a=y.useRef(e),s=y.useCallback(i=>{const c=Cy(i.target);c&&n(u=>u?(u.set(c,Hv(c)),new Map(u)):null)},[]);return y.useEffect(()=>{const i=a.current;if(e!==i){c(i);const u=e.map(h=>{const f=Cy(h);return f?(f.addEventListener("scroll",s,{passive:!0}),[f,Hv(f)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),a.current=e}return()=>{c(e),c(i)};function c(u){u.forEach(h=>{const f=Cy(h);f==null||f.removeEventListener("scroll",s)})}},[s,e]),y.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Dl(i,c),Ra):V2(e):Ra,[e,t])}function sT(e,t){t===void 0&&(t=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},t),y.useEffect(()=>{const a=e!==Ra;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Yu(e,n.current):Ra}function v7(e){y.useEffect(()=>{if(!wm)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function b7(e,t){return y.useMemo(()=>e.reduce((n,a)=>{let{eventName:s,handler:i}=a;return n[s]=c=>{i(c,t)},n},{}),[e,t])}function X2(e){return y.useMemo(()=>e?q9(e):null,[e])}const iT=[];function x7(e,t){t===void 0&&(t=fc);const[n]=e,a=X2(n?Dr(n):null),[s,i]=y.useState(iT);function c(){i(()=>e.length?e.map(h=>B2(h)?a:new g0(t(h),h)):iT)}const u=Em({callback:c});return Ya(()=>{u==null||u.disconnect(),c(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function w7(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return gd(t)?t:e}function S7(e){let{measure:t}=e;const[n,a]=y.useState(null),s=y.useCallback(f=>{for(const{target:g}of f)if(gd(g)){a(m=>{const b=t(g);return m?{...m,width:b.width,height:b.height}:b});break}},[t]),i=Em({callback:s}),c=y.useCallback(f=>{const g=w7(f);i==null||i.disconnect(),g&&(i==null||i.observe(g)),a(g?t(g):null)},[t,i]),[u,h]=Yh(c);return y.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const E7=[{sensor:q2,options:{}},{sensor:y0,options:{}}],R7={current:{}},xh={draggable:{measure:JR},droppable:{measure:JR,strategy:qu.WhileDragging,frequency:Fv.Optimized},dragOverlay:{measure:fc}};class Du extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const T7={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Du,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xh,measureDroppableContainers:qh,windowRect:null,measuringScheduled:!1},C7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qh,draggableNodes:new Map,over:null,measureDroppableContainers:qh},Rm=y.createContext(C7),W2=y.createContext(T7);function O7(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Du}}}function M7(e,t){switch(t.type){case qn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case qn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case qn.DragEnd:case qn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case qn.RegisterDroppable:{const{element:n}=t,{id:a}=n,s=new Du(e.droppable.containers);return s.set(a,n),{...e,droppable:{...e.droppable,containers:s}}}case qn.SetDroppableDisabled:{const{id:n,key:a,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||a!==i.key)return e;const c=new Du(e.droppable.containers);return c.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:c}}}case qn.UnregisterDroppable:{const{id:n,key:a}=t,s=e.droppable.containers.get(n);if(!s||a!==s.key)return e;const i=new Du(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function N7(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:s}=y.useContext(Rm),i=zv(a),c=zv(n==null?void 0:n.id);return y.useEffect(()=>{if(!t&&!a&&i&&c!=null){if(!m0(i)||document.activeElement===i.target)return;const u=s.get(c);if(!u)return;const{activatorNode:h,node:f}=u;if(!h.current&&!f.current)return;requestAnimationFrame(()=>{for(const g of[h.current,f.current]){if(!g)continue;const m=R9(g);if(m){m.focus();break}}})}},[a,t,s,c,i]),null}function A7(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...a}),n):n}function D7(e){return y.useMemo(()=>({draggable:{...xh.draggable,...e==null?void 0:e.draggable},droppable:{...xh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...xh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function k7(e){let{activeNode:t,measure:n,initialRect:a,config:s=!0}=e;const i=y.useRef(!1),{x:c,y:u}=typeof s=="boolean"?{x:s,y:s}:s;Ya(()=>{if(!c&&!u||!t){i.current=!1;return}if(i.current||!a)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const g=n(f),m=P2(g,a);if(c||(m.x=0),u||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const b=z2(f);b&&b.scrollBy({top:m.y,left:m.x})}},[t,c,u,a,n])}const Q2=y.createContext({...Ra,scaleX:1,scaleY:1});var os;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(os||(os={}));const b0=y.memo(function(t){var n,a,s,i;let{id:c,accessibility:u,autoScroll:h=!0,children:f,sensors:g=E7,collisionDetection:m=z9,measuring:b,modifiers:x,...w}=t;const S=y.useReducer(M7,void 0,O7),[R,T]=S,[C,M]=A9(),[O,D]=y.useState(os.Uninitialized),k=O===os.Initialized,{draggable:{active:A,nodes:j,translate:B},droppable:{containers:W}}=R,K=A!=null?j.get(A):null,I=y.useRef({initial:null,translated:null}),H=y.useMemo(()=>{var lt;return A!=null?{id:A,data:(lt=K==null?void 0:K.data)!=null?lt:R7,rect:I}:null},[A,K]),F=y.useRef(null),[q,_]=y.useState(null),[L,P]=y.useState(null),V=Vu(w,Object.values(w)),Q=vd("DndDescribedBy",c),z=y.useMemo(()=>W.getEnabled(),[W]),Y=D7(b),{droppableRects:X,measureDroppableContainers:G,measuringScheduled:ce}=d7(z,{dragging:k,dependencies:[B.x,B.y],config:Y.droppable}),oe=c7(j,A),de=y.useMemo(()=>L?Uv(L):null,[L]),ve=tt(),xe=f7(oe,Y.draggable.measure);k7({activeNode:A!=null?j.get(A):null,config:ve.layoutShiftCompensation,initialRect:xe,measure:Y.draggable.measure});const Ne=aT(oe,Y.draggable.measure,xe),_e=aT(oe?oe.parentElement:null),ee=y.useRef({activatorEvent:null,active:null,activeNode:oe,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ue=W.getNodeFor((n=ee.current.over)==null?void 0:n.id),pe=S7({measure:Y.dragOverlay.measure}),ke=(a=pe.nodeRef.current)!=null?a:oe,Te=k?(s=pe.rect)!=null?s:Ne:null,be=!!(pe.nodeRef.current&&pe.rect),we=p7(be?null:Ne),Z=X2(ke?Dr(ke):null),Se=g7(k?ue??oe:null),ge=x7(Se),ze=A7(x,{transform:{x:B.x-we.x,y:B.y-we.y,scaleX:1,scaleY:1},activatorEvent:L,active:H,activeNodeRect:Ne,containerNodeRect:_e,draggingNodeRect:Te,over:ee.current.over,overlayNodeRect:pe.rect,scrollableAncestors:Se,scrollableAncestorRects:ge,windowRect:Z}),He=de?Dl(de,B):null,De=y7(Se),st=sT(De),xt=sT(De,[Ne]),vt=Dl(ze,st),Je=Te?B9(Te,ze):null,Qe=H&&Je?m({active:H,collisionRect:Je,droppableRects:X,droppableContainers:z,pointerCoordinates:He}):null,ft=I2(Qe,"id"),[se,je]=y.useState(null),Ke=be?ze:Dl(ze,xt),Me=U9(Ke,(i=se==null?void 0:se.rect)!=null?i:null,Ne),Ie=y.useRef(null),Fe=y.useCallback((lt,gt)=>{let{sensor:Ye,options:Tt}=gt;if(F.current==null)return;const kt=j.get(F.current);if(!kt)return;const Rt=lt.nativeEvent,on=new Ye({active:F.current,activeNode:kt,event:Rt,options:Tt,context:ee,onAbort(Xe){if(!j.get(Xe))return;const{onDragAbort:$}=V.current,re={id:Xe};$==null||$(re),C({type:"onDragAbort",event:re})},onPending(Xe,Ct,$,re){if(!j.get(Xe))return;const{onDragPending:Ee}=V.current,Le={id:Xe,constraint:Ct,initialCoordinates:$,offset:re};Ee==null||Ee(Le),C({type:"onDragPending",event:Le})},onStart(Xe){const Ct=F.current;if(Ct==null)return;const $=j.get(Ct);if(!$)return;const{onDragStart:re}=V.current,le={activatorEvent:Rt,active:{id:Ct,data:$.data,rect:I}};or.unstable_batchedUpdates(()=>{re==null||re(le),D(os.Initializing),T({type:qn.DragStart,initialCoordinates:Xe,active:Ct}),C({type:"onDragStart",event:le}),_(Ie.current),P(Rt)})},onMove(Xe){T({type:qn.DragMove,coordinates:Xe})},onEnd:Pt(qn.DragEnd),onCancel:Pt(qn.DragCancel)});Ie.current=on;function Pt(Xe){return async function(){const{active:$,collisions:re,over:le,scrollAdjustedTranslate:Ee}=ee.current;let Le=null;if($&&Ee){const{cancelDrop:et}=V.current;Le={activatorEvent:Rt,active:$,collisions:re,delta:Ee,over:le},Xe===qn.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Le))&&(Xe=qn.DragCancel)}F.current=null,or.unstable_batchedUpdates(()=>{T({type:Xe}),D(os.Uninitialized),je(null),_(null),P(null),Ie.current=null;const et=Xe===qn.DragEnd?"onDragEnd":"onDragCancel";if(Le){const Ze=V.current[et];Ze==null||Ze(Le),C({type:et,event:Le})}})}}},[j]),ht=y.useCallback((lt,gt)=>(Ye,Tt)=>{const kt=Ye.nativeEvent,Rt=j.get(Tt);if(F.current!==null||!Rt||kt.dndKit||kt.defaultPrevented)return;const on={active:Rt};lt(Ye,gt.options,on)===!0&&(kt.dndKit={capturedBy:gt.sensor},F.current=Tt,Fe(Ye,gt))},[j,Fe]),Lt=u7(g,ht);v7(g),Ya(()=>{Ne&&O===os.Initializing&&D(os.Initialized)},[Ne,O]),y.useEffect(()=>{const{onDragMove:lt}=V.current,{active:gt,activatorEvent:Ye,collisions:Tt,over:kt}=ee.current;if(!gt||!Ye)return;const Rt={active:gt,activatorEvent:Ye,collisions:Tt,delta:{x:vt.x,y:vt.y},over:kt};or.unstable_batchedUpdates(()=>{lt==null||lt(Rt),C({type:"onDragMove",event:Rt})})},[vt.x,vt.y]),y.useEffect(()=>{const{active:lt,activatorEvent:gt,collisions:Ye,droppableContainers:Tt,scrollAdjustedTranslate:kt}=ee.current;if(!lt||F.current==null||!gt||!kt)return;const{onDragOver:Rt}=V.current,on=Tt.get(ft),Pt=on&&on.rect.current?{id:on.id,rect:on.rect.current,data:on.data,disabled:on.disabled}:null,Xe={active:lt,activatorEvent:gt,collisions:Ye,delta:{x:kt.x,y:kt.y},over:Pt};or.unstable_batchedUpdates(()=>{je(Pt),Rt==null||Rt(Xe),C({type:"onDragOver",event:Xe})})},[ft]),Ya(()=>{ee.current={activatorEvent:L,active:H,activeNode:oe,collisionRect:Je,collisions:Qe,droppableRects:X,draggableNodes:j,draggingNode:ke,draggingNodeRect:Te,droppableContainers:W,over:se,scrollableAncestors:Se,scrollAdjustedTranslate:vt},I.current={initial:Te,translated:Je}},[H,oe,Qe,Je,j,ke,Te,X,W,se,Se,vt]),s7({...ve,delta:B,draggingRect:Je,pointerCoordinates:He,scrollableAncestors:Se,scrollableAncestorRects:ge});const ct=y.useMemo(()=>({active:H,activeNode:oe,activeNodeRect:Ne,activatorEvent:L,collisions:Qe,containerNodeRect:_e,dragOverlay:pe,draggableNodes:j,droppableContainers:W,droppableRects:X,over:se,measureDroppableContainers:G,scrollableAncestors:Se,scrollableAncestorRects:ge,measuringConfiguration:Y,measuringScheduled:ce,windowRect:Z}),[H,oe,Ne,L,Qe,_e,pe,j,W,X,se,G,Se,ge,Y,ce,Z]),pt=y.useMemo(()=>({activatorEvent:L,activators:Lt,active:H,activeNodeRect:Ne,ariaDescribedById:{draggable:Q},dispatch:T,draggableNodes:j,over:se,measureDroppableContainers:G}),[L,Lt,H,Ne,T,Q,j,se,G]);return Pe.createElement(j2.Provider,{value:M},Pe.createElement(Rm.Provider,{value:pt},Pe.createElement(W2.Provider,{value:ct},Pe.createElement(Q2.Provider,{value:Me},f)),Pe.createElement(N7,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Pe.createElement(j9,{...u,hiddenTextDescribedById:Q}));function tt(){const lt=(q==null?void 0:q.autoScrollEnabled)===!1,gt=typeof h=="object"?h.enabled===!1:h===!1,Ye=k&&!lt&&!gt;return typeof h=="object"?{...h,enabled:Ye}:{enabled:Ye}}}),j7=y.createContext(null),lT="button",_7="Draggable";function L7(e){let{id:t,data:n,disabled:a=!1,attributes:s}=e;const i=vd(_7),{activators:c,activatorEvent:u,active:h,activeNodeRect:f,ariaDescribedById:g,draggableNodes:m,over:b}=y.useContext(Rm),{role:x=lT,roleDescription:w="draggable",tabIndex:S=0}=s??{},R=(h==null?void 0:h.id)===t,T=y.useContext(R?Q2:j7),[C,M]=Yh(),[O,D]=Yh(),k=b7(c,t),A=Vu(n);Ya(()=>(m.set(t,{id:t,key:i,node:C,activatorNode:O,data:A}),()=>{const B=m.get(t);B&&B.key===i&&m.delete(t)}),[m,t]);const j=y.useMemo(()=>({role:x,tabIndex:S,"aria-disabled":a,"aria-pressed":R&&x===lT?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[a,x,S,R,w,g.draggable]);return{active:h,activatorEvent:u,activeNodeRect:f,attributes:j,isDragging:R,listeners:a?void 0:k,node:C,over:b,setNodeRef:M,setActivatorNodeRef:D,transform:T}}function I7(){return y.useContext(W2)}const P7="Droppable",z7={timeout:25};function U7(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:s}=e;const i=vd(P7),{active:c,dispatch:u,over:h,measureDroppableContainers:f}=y.useContext(Rm),g=y.useRef({disabled:n}),m=y.useRef(!1),b=y.useRef(null),x=y.useRef(null),{disabled:w,updateMeasurementsFor:S,timeout:R}={...z7,...s},T=Vu(S??a),C=y.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(T.current)?T.current:[T.current]),x.current=null},R)},[R]),M=Em({callback:C,disabled:w||!c}),O=y.useCallback((j,B)=>{M&&(B&&(M.unobserve(B),m.current=!1),j&&M.observe(j))},[M]),[D,k]=Yh(O),A=Vu(t);return y.useEffect(()=>{!M||!D.current||(M.disconnect(),m.current=!1,M.observe(D.current))},[D,M]),y.useEffect(()=>(u({type:qn.RegisterDroppable,element:{id:a,key:i,disabled:n,node:D,rect:b,data:A}}),()=>u({type:qn.UnregisterDroppable,key:i,id:a})),[a]),y.useEffect(()=>{n!==g.current.disabled&&(u({type:qn.SetDroppableDisabled,id:a,key:i,disabled:n}),g.current.disabled=n)},[a,i,n,u]),{active:c,rect:b,isOver:(h==null?void 0:h.id)===a,node:D,over:h,setNodeRef:k}}function bd(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function H7(e,t){return e.reduce((n,a,s)=>{const i=t.get(a);return i&&(n[s]=i),n},Array(e.length))}function rh(e){return e!==null&&e>=0}function B7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function F7(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Z2=e=>{let{rects:t,activeIndex:n,overIndex:a,index:s}=e;const i=bd(t,a,n),c=t[s],u=i[s];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},ah={scaleX:1,scaleY:1},x0=e=>{var t;let{activeIndex:n,activeNodeRect:a,index:s,rects:i,overIndex:c}=e;const u=(t=i[n])!=null?t:a;if(!u)return null;if(s===n){const f=i[c];return f?{x:0,y:n<c?f.top+f.height-(u.top+u.height):f.top-u.top,...ah}:null}const h=V7(i,s,n);return s>n&&s<=c?{x:0,y:-u.height-h,...ah}:s<n&&s>=c?{x:0,y:u.height+h,...ah}:{x:0,y:0,...ah}};function V7(e,t,n){const a=e[t],s=e[t-1],i=e[t+1];return a?n<t?s?a.top-(s.top+s.height):i?i.top-(a.top+a.height):0:i?i.top-(a.top+a.height):s?a.top-(s.top+s.height):0:0}const J2="Sortable",eN=Pe.createContext({activeIndex:-1,containerId:J2,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Z2,disabled:{draggable:!1,droppable:!1}});function w0(e){let{children:t,id:n,items:a,strategy:s=Z2,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:h,over:f,measureDroppableContainers:g}=I7(),m=vd(J2,n),b=u.rect!==null,x=y.useMemo(()=>a.map(k=>typeof k=="object"&&"id"in k?k.id:k),[a]),w=c!=null,S=c?x.indexOf(c.id):-1,R=f?x.indexOf(f.id):-1,T=y.useRef(x),C=!B7(x,T.current),M=R!==-1&&S===-1||C,O=F7(i);Ya(()=>{C&&w&&g(x)},[C,x,w,g]),y.useEffect(()=>{T.current=x},[x]);const D=y.useMemo(()=>({activeIndex:S,containerId:m,disabled:O,disableTransforms:M,items:x,overIndex:R,useDragOverlay:b,sortedRects:H7(x,h),strategy:s}),[S,m,O.draggable,O.droppable,M,x,R,h,b,s]);return Pe.createElement(eN.Provider,{value:D},t)}const Y7=e=>{let{id:t,items:n,activeIndex:a,overIndex:s}=e;return bd(n,a,s).indexOf(t)},q7=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:s,items:i,newIndex:c,previousItems:u,previousContainerId:h,transition:f}=e;return!f||!a||u!==i&&s===c?!1:n?!0:c!==s&&t===h},$7={duration:200,easing:"ease"},tN="transform",K7=Ni.Transition.toString({property:tN,duration:0,easing:"linear"}),G7={roleDescription:"sortable"};function X7(e){let{disabled:t,index:n,node:a,rect:s}=e;const[i,c]=y.useState(null),u=y.useRef(n);return Ya(()=>{if(!t&&n!==u.current&&a.current){const h=s.current;if(h){const f=fc(a.current,{ignoreTransform:!0}),g={x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height};(g.x||g.y)&&c(g)}}n!==u.current&&(u.current=n)},[t,n,a,s]),y.useEffect(()=>{i&&c(null)},[i]),i}function S0(e){let{animateLayoutChanges:t=q7,attributes:n,disabled:a,data:s,getNewIndex:i=Y7,id:c,strategy:u,resizeObserverConfig:h,transition:f=$7}=e;const{items:g,containerId:m,activeIndex:b,disabled:x,disableTransforms:w,sortedRects:S,overIndex:R,useDragOverlay:T,strategy:C}=y.useContext(eN),M=W7(a,x),O=g.indexOf(c),D=y.useMemo(()=>({sortable:{containerId:m,index:O,items:g},...s}),[m,s,O,g]),k=y.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:j,isOver:B,setNodeRef:W}=U7({id:c,data:D,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...h}}),{active:K,activatorEvent:I,activeNodeRect:H,attributes:F,setNodeRef:q,listeners:_,isDragging:L,over:P,setActivatorNodeRef:V,transform:Q}=L7({id:c,data:D,attributes:{...G7,...n},disabled:M.draggable}),z=x9(W,q),Y=!!K,X=Y&&!w&&rh(b)&&rh(R),G=!T&&L,ce=G&&X?Q:null,de=X?ce??(u??C)({rects:S,activeNodeRect:H,activeIndex:b,overIndex:R,index:O}):null,ve=rh(b)&&rh(R)?i({id:c,items:g,activeIndex:b,overIndex:R}):O,xe=K==null?void 0:K.id,Ne=y.useRef({activeId:xe,items:g,newIndex:ve,containerId:m}),_e=g!==Ne.current.items,ee=t({active:K,containerId:m,isDragging:L,isSorting:Y,id:c,index:O,items:g,newIndex:Ne.current.newIndex,previousItems:Ne.current.items,previousContainerId:Ne.current.containerId,transition:f,wasDragging:Ne.current.activeId!=null}),ue=X7({disabled:!ee,index:O,node:j,rect:A});return y.useEffect(()=>{Y&&Ne.current.newIndex!==ve&&(Ne.current.newIndex=ve),m!==Ne.current.containerId&&(Ne.current.containerId=m),g!==Ne.current.items&&(Ne.current.items=g)},[Y,ve,m,g]),y.useEffect(()=>{if(xe===Ne.current.activeId)return;if(xe!=null&&Ne.current.activeId==null){Ne.current.activeId=xe;return}const ke=setTimeout(()=>{Ne.current.activeId=xe},50);return()=>clearTimeout(ke)},[xe]),{active:K,activeIndex:b,attributes:F,data:D,rect:A,index:O,newIndex:ve,items:g,isOver:B,isSorting:Y,isDragging:L,listeners:_,node:j,overIndex:R,over:P,setNodeRef:z,setActivatorNodeRef:V,setDroppableNodeRef:W,setDraggableNodeRef:q,transform:ue??de,transition:pe()};function pe(){if(ue||_e&&Ne.current.newIndex===O)return K7;if(!(G&&!m0(I)||!f)&&(Y||ee))return Ni.Transition.toString({...f,property:tN})}}function W7(e,t){var n,a;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(a=e==null?void 0:e.droppable)!=null?a:t.droppable}}function Kh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Q7=[Qt.Down,Qt.Right,Qt.Up,Qt.Left],Z7=(e,t)=>{let{context:{active:n,collisionRect:a,droppableRects:s,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(Q7.includes(e.code)){if(e.preventDefault(),!n||!a)return;const h=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const b=s.get(m.id);if(b)switch(e.code){case Qt.Down:a.top<b.top&&h.push(m);break;case Qt.Up:a.top>b.top&&h.push(m);break;case Qt.Left:a.left>b.left&&h.push(m);break;case Qt.Right:a.left<b.left&&h.push(m);break}});const f=I9({collisionRect:a,droppableRects:s,droppableContainers:h});let g=I2(f,"id");if(g===(c==null?void 0:c.id)&&f.length>1&&(g=f[1].id),g!=null){const m=i.get(n.id),b=i.get(g),x=b?s.get(b.id):null,w=b==null?void 0:b.node.current;if(w&&x&&m&&b){const R=Sm(w).some((k,A)=>u[A]!==k),T=nN(m,b),C=J7(m,b),M=R||!T?{x:0,y:0}:{x:C?a.width-x.width:0,y:C?a.height-x.height:0},O={x:x.left,y:x.top};return M.x&&M.y?O:Yu(O,M)}}}};function nN(e,t){return!Kh(e)||!Kh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function J7(e,t){return!Kh(e)||!Kh(t)||!nN(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function eY(){const e=To.getState().settings;return(e==null?void 0:e.siteName)||"tmex"}function cT(e){const t=e==null?void 0:e.trim();return t&&t.length>0?t:"?"}function aq({paneCustomName:e,paneTitle:t,windowName:n,windowCustomName:a,deviceName:s}){const i=cT(e??a??t??n),c=cT(s);return`${i}@${c}`}function E0(e){var u,h;const t=(u=e.customName)==null?void 0:u.trim(),n=e.panes.find(f=>f.active)??e.panes[0],a=e.name.trim(),s=(h=n==null?void 0:n.title)==null?void 0:h.trim(),i=t||s||a;return{title:i,processName:!!a&&a!==i?a:void 0}}function tY(e){const{title:t,processName:n}=E0(e);return n?`${n}: ${t}`:t}function oq(e){const t=eY();return e!=null&&e.trim()?`[${t}]${e}`:t}function sq(e){return e}function rN(e){return encodeURIComponent(e)}function aN({status:e}){return E.jsx("span",{className:Oe("size-2 shrink-0 rounded-full",e==="running"?"bg-emerald-500 animate-pulse":e==="error"?"bg-destructive":e==="waiting_confirmation"?"bg-amber-500":"bg-muted-foreground/40")})}function nY({paneIds:e}){return mb(n=>e.some(a=>n.ringingPanes[a]))?E.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function rY({paneId:e}){return mb(n=>!!n.ringingPanes[e])?E.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function R0(){return _9(Ty($2,{activationConstraint:{distance:8}}),Ty(K2,{activationConstraint:{delay:250,tolerance:5}}),Ty(y0,{coordinateGetter:Z7}))}function aY(){const{t:e}=yr(),t=qa(),n=ob(),{isMobile:a,setOpenMobile:s}=qr(),{toggleDevice:i}=K8(),c=ri(se=>se.sessions),u=ri(se=>se.activeSessionId),h=Ar(se=>se.setSidebarTab);y.useEffect(()=>{const se=ri.getState();se.ensureInitialized(),se.loadSessions()},[]);const f=Yl("/devices/:deviceId/windows/:windowId/panes/:paneId",t.pathname),g=f==null?void 0:f.params.deviceId,m=f==null?void 0:f.params.windowId,b=f==null?void 0:f.params.paneId,x=rn(se=>se.snapshots),w=rn(se=>se.connectedDevices),S=rn(se=>se.closeWindow),R=rn(se=>se.closePane),T=rn(se=>se.renameWindow),C=To(se=>{var je;return((je=se.settings)==null?void 0:je.language)??"en_US"}),{data:M}=ed({queryKey:["devices"],queryFn:async()=>{const se=await fetch("/api/devices");if(!se.ok)throw new Error("Failed to fetch devices");return se.json()},throwOnError:!1}),O=rn(se=>se.hydrateDeviceErrors);y.useEffect(()=>{M!=null&&M.devices&&O(M.devices.map(se=>({deviceId:se.id,lastError:se.lastError??null,lastErrorType:se.lastErrorType??null})))},[M,O]);const D=y.useCallback((se,je)=>{n(se,{replace:(je==null?void 0:je.replace)??!0}),a&&!(je!=null&&je.keepSidebarOpen)&&s(!1)},[n,a,s]),k=y.useCallback((se,je,Ke,Me)=>{W.current=null,window.dispatchEvent(new CustomEvent("tmex:user-initiated-selection",{detail:{deviceId:se,windowId:je,paneId:Ke}})),D(`/devices/${se}/windows/${je}/panes/${rN(Ke)}`,{keepSidebarOpen:Me==null?void 0:Me.keepSidebarOpen})},[D]),A=y.useCallback(se=>{var je,Ke;if(ri.getState().setActiveSession(se.id),h("agent"),se.deviceId&&se.paneId){const Me=(Ke=(je=rn.getState().snapshots[se.deviceId])==null?void 0:je.session)==null?void 0:Ke.windows,Ie=Me==null?void 0:Me.find(Fe=>Fe.panes.some(ht=>ht.id===se.paneId));Ie&&k(se.deviceId,Ie.id,se.paneId,{keepSidebarOpen:!0})}},[h,k]),j=y.useCallback((se,je,Ke)=>{k(se,je,Ke.id,{keepSidebarOpen:!0}),ri.getState().startDraft(se,Ke.id,Ke.title??null),h("agent")},[k,h]),B=rn(se=>se.selectWindow),W=y.useRef(null);y.useEffect(()=>{var Lt,ct;const se=W.current;if(!se)return;if(Date.now()-se.at>5e3){W.current=null;return}const{deviceId:je,windowId:Ke}=se,Me=x[je],Ie=(Lt=Me==null?void 0:Me.session)==null?void 0:Lt.windows;if(!Ie)return;const Fe=Ie.find(pt=>pt.id===Ke);if(!((ct=Fe==null?void 0:Fe.panes)!=null&&ct.length))return;W.current=null;const ht=Fe.panes.find(pt=>pt.active)??Fe.panes[0];k(je,Ke,ht.id)},[x,k]);const K=y.useCallback((se,je,Ke)=>{B(se,je);const Me=Ke.find(Ie=>Ie.active)??Ke[0];Me?(k(se,je,Me.id),W.current=null):W.current={deviceId:se,windowId:je,at:Date.now()}},[k,B]),I=y.useCallback((se,je)=>{je?se===g&&D("/devices"):D(`/devices/${se}`),i(se,je)},[i,g,D]),H=y.useCallback((se,je)=>{se===g&&je===m&&D("/devices"),S(se,je)},[S,g,m,D]),[F,q]=y.useState(null),_=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.find(ht=>ht.id===je);q({kind:"window",deviceId:se,windowId:je,name:Me?tY(Me):""})},[]),L=y.useCallback((se,je,Ke)=>{var Fe,ht,Lt,ct;const Me=(ht=(Fe=rn.getState().snapshots[se])==null?void 0:Fe.session)==null?void 0:ht.windows,Ie=(ct=(Lt=Me==null?void 0:Me.find(pt=>pt.id===je))==null?void 0:Lt.panes)==null?void 0:ct.find(pt=>pt.id===Ke);q({kind:"pane",deviceId:se,paneId:Ke,name:(Ie==null?void 0:Ie.title)||`Pane ${(Ie==null?void 0:Ie.index)??""}`})},[]),P=y.useCallback(()=>{F&&(F.kind==="window"?H(F.deviceId,F.windowId):R(F.deviceId,F.paneId),q(null))},[F,H,R]),[V,Q]=y.useState(null),[z,Y]=y.useState(""),X=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.find(ht=>ht.id===je);Me&&(Y(Me.customName??E0(Me).title),Q({kind:"window",deviceId:se,windowId:je,hasCustomName:!!Me.customName}))},[]),G=y.useCallback((se,je)=>{var Ie,Fe;const Ke=(Fe=(Ie=rn.getState().snapshots[se])==null?void 0:Ie.session)==null?void 0:Fe.windows,Me=Ke==null?void 0:Ke.flatMap(ht=>ht.panes).find(ht=>ht.id===je);Me&&(Y(Me.customName??Me.title??""),Q({kind:"pane",deviceId:se,paneId:je,hasCustomName:!!Me.customName}))},[]),ce=rn(se=>se.renamePane),oe=y.useCallback(se=>{V&&(V.kind==="window"?T(V.deviceId,V.windowId,se):ce(V.deviceId,V.paneId,se),Q(null))},[V,T,ce]),de=y.useCallback(()=>{const se=z.trim();se&&oe(se)},[oe,z]),ve=y.useCallback(()=>{oe("")},[oe]),xe=y.useCallback(se=>{rn.getState().createWindow(se)},[]),[Ne,_e]=y.useState(null),ee=y.useCallback((se,je)=>{_e({deviceId:se,paneId:je})},[]),[ue,pe]=y.useState(null),[ke,Te]=y.useState(""),[be,we]=y.useState(null),Z=y.useCallback(se=>{Te(se.title),pe(se)},[]),Se=y.useCallback(()=>{if(!ue)return;const se=ke.trim();se&&(ri.getState().renameSession(ue.id,se),pe(null))},[ue,ke]),ge=y.useCallback(se=>{we(se)},[]),ze=y.useCallback(()=>{be&&(ri.getState().deleteSession(be.id),we(null))},[be]),He=Ju(),De=R0(),st=ju({mutationFn:async se=>{const je=await fetch("/api/devices/order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceIds:se})});if(!je.ok)throw new Error("Failed to reorder devices");return je.json()},onMutate:async se=>{await He.cancelQueries({queryKey:["devices"]});const je=He.getQueryData(["devices"]);if(je){const Ke=new Map(je.devices.map(Fe=>[Fe.id,Fe])),Me=se.map((Fe,ht)=>{const Lt=Ke.get(Fe);return Lt?{...Lt,sortOrder:ht}:void 0}).filter(Fe=>Fe!==void 0),Ie=je.devices.filter(Fe=>!se.includes(Fe.id));He.setQueryData(["devices"],{devices:[...Me,...Ie]})}return{previous:je}},onError:(se,je,Ke)=>{Ke!=null&&Ke.previous&&He.setQueryData(["devices"],Ke.previous),dn.error(e("device.reorderFailed"))},onSettled:()=>{He.invalidateQueries({queryKey:["devices"]})}}),xt=(M==null?void 0:M.devices)??[],vt=y.useMemo(()=>[...xt].sort((se,je)=>se.sortOrder-je.sortOrder||se.name.localeCompare(je.name,UT(C),{numeric:!0,sensitivity:"base"})),[xt,C]),Je=y.useCallback(se=>{const{active:je,over:Ke}=se;if(!Ke||je.id===Ke.id)return;const Me=vt.map(ht=>ht.id),Ie=Me.indexOf(String(je.id)),Fe=Me.indexOf(String(Ke.id));Ie<0||Fe<0||st.mutate(bd(Me,Ie,Fe))},[vt,st]),{sessionsByPane:Qe,orphanSessions:ft}=y.useMemo(()=>{const se=new Set(xt.map(Ie=>Ie.id)),je=new Map,Ke=[],Me=Object.values(c).filter(Ie=>!!Ie).sort((Ie,Fe)=>Ie.updatedAt<Fe.updatedAt?1:-1);for(const Ie of Me){if(!Ie.deviceId||!Ie.paneId||!se.has(Ie.deviceId)){Ke.push(Ie);continue}const Fe=`${Ie.deviceId}:${Ie.paneId}`,ht=je.get(Fe);ht?ht.push(Ie):je.set(Fe,[Ie])}return{sessionsByPane:je,orphanSessions:Ke}},[c,xt]);return E.jsxs(zM,{className:"flex flex-col flex-1 min-h-0 pt-0",children:[E.jsx(b0,{sensors:De,collisionDetection:p0,onDragEnd:Je,children:E.jsx(xV,{className:"flex-1 min-h-0",children:E.jsxs("div",{className:"space-y-1.5 pb-2 pt-1 select-none [-webkit-user-select:none] [-webkit-touch-callout:none]",children:[E.jsx(w0,{items:vt.map(se=>se.id),strategy:x0,children:vt.map(se=>{var je,Ke;return E.jsx(oY,{device:se,windows:((Ke=(je=x[se.id])==null?void 0:je.session)==null?void 0:Ke.windows)??null,isConnected:w.has(se.id),isSelected:se.id===g,selectedWindowId:m,selectedPaneId:b,onConnectToggle:()=>I(se.id,w.has(se.id)),onCreateWindow:xe,onCloseWindow:_,onClosePane:L,onRenameWindow:X,onRenamePane:G,onPaneClick:k,onWindowClick:K,onWatchPane:ee,sessionsByPane:Qe,activeSessionId:u,onSelectSession:A,onCreateSessionForPane:j,onRenameSession:Z,onDeleteSession:ge},se.id)})}),vt.length===0&&E.jsx("div",{className:"text-center text-sm text-muted-foreground py-4",children:e("sidebar.noDevices")}),ft.length>0&&E.jsx(lY,{sessions:ft,activeSessionId:u,onSelectSession:A,onRenameSession:Z,onDeleteSession:ge})]})})}),E.jsx(wv,{open:F!==null,onOpenChange:se=>!se&&q(null),children:E.jsxs(Sv,{children:[E.jsxs(Ev,{children:[E.jsx(jR,{className:"bg-destructive/10",children:E.jsx(Ei,{className:"h-5 w-5 text-destructive"})}),E.jsx(Tv,{children:(F==null?void 0:F.kind)==="pane"?e("window.closePaneConfirmTitle"):e("window.closeConfirmTitle")}),E.jsx(Cv,{children:e("window.closeConfirmDesc",{name:(F==null?void 0:F.name)??""})})]}),E.jsxs(Rv,{children:[E.jsx(Mv,{children:e("common.cancel")}),E.jsx(Ov,{variant:"destructive",disabled:!F,onClick:P,children:e("common.close")})]})]})}),E.jsx(Nv,{open:V!==null,onOpenChange:se=>!se&&Q(null),children:E.jsx(Av,{"data-testid":"window-rename-dialog",children:E.jsxs("form",{onSubmit:se=>{se.preventDefault(),de()},children:[E.jsxs(Dv,{children:[E.jsx(kv,{children:e("window.rename")}),E.jsx(t2,{children:e("window.renameDesc")})]}),E.jsx("div",{className:"py-4",children:E.jsx(va,{autoFocus:!0,maxLength:64,value:z,onChange:se=>Y(se.target.value),placeholder:e("window.renamePlaceholder"),"data-testid":"window-rename-input"})}),E.jsxs(_R,{children:[(V==null?void 0:V.hasCustomName)&&E.jsx(Cn,{type:"button",variant:"ghost",onClick:ve,"data-testid":"window-rename-reset",children:e("window.renameReset")}),E.jsx(Cn,{type:"button",variant:"outline",onClick:()=>Q(null),children:e("common.cancel")}),E.jsx(Cn,{type:"submit",disabled:!z.trim(),"data-testid":"window-rename-save",children:e("common.save")})]})]})})}),E.jsx(Nv,{open:ue!==null,onOpenChange:se=>!se&&pe(null),children:E.jsx(Av,{"data-testid":"agent-session-rename-dialog",children:E.jsxs("form",{onSubmit:se=>{se.preventDefault(),Se()},children:[E.jsx(Dv,{children:E.jsx(kv,{children:e("agent.session.renameTitle")})}),E.jsx("div",{className:"py-4",children:E.jsx(va,{autoFocus:!0,maxLength:120,value:ke,onChange:se=>Te(se.target.value),placeholder:e("agent.session.renamePlaceholder"),"data-testid":"agent-session-rename-input"})}),E.jsxs(_R,{children:[E.jsx(Cn,{type:"button",variant:"outline",onClick:()=>pe(null),children:e("agent.session.cancel")}),E.jsx(Cn,{type:"submit",disabled:!ke.trim(),"data-testid":"agent-session-rename-save",children:e("agent.session.save")})]})]})})}),E.jsx(wv,{open:be!==null,onOpenChange:se=>!se&&we(null),children:E.jsxs(Sv,{children:[E.jsxs(Ev,{children:[E.jsx(jR,{className:"bg-destructive/10",children:E.jsx(Ei,{className:"h-5 w-5 text-destructive"})}),E.jsx(Tv,{children:e("agent.session.deleteTitle")}),E.jsx(Cv,{children:e("agent.session.deleteDesc",{title:(be==null?void 0:be.title)??""})})]}),E.jsxs(Rv,{children:[E.jsx(Mv,{children:e("common.cancel")}),E.jsx(Ov,{variant:"destructive",disabled:!be,onClick:ze,"data-testid":"agent-session-delete-confirm",children:e("agent.session.deleteConfirm")})]})]})}),Ne&&E.jsx(d9,{open:!0,onOpenChange:se=>!se&&_e(null),deviceId:Ne.deviceId,paneId:Ne.paneId})]})}function oY({device:e,windows:t,isConnected:n,isSelected:a,selectedWindowId:s,selectedPaneId:i,onConnectToggle:c,onCreateWindow:u,onCloseWindow:h,onClosePane:f,onRenameWindow:g,onRenamePane:m,onPaneClick:b,onWindowClick:x,onWatchPane:w,sessionsByPane:S,activeSessionId:R,onSelectSession:T,onCreateSessionForPane:C,onRenameSession:M,onDeleteSession:O}){const{t:D}=yr(),k=e.type==="local"?FC:S3,{attributes:A,listeners:j,setNodeRef:B,setActivatorNodeRef:W,transform:K,transition:I,isDragging:H}=S0({id:e.id}),F=R0(),q=_=>{const{active:L,over:P}=_;if(!P||L.id===P.id||!t)return;const V=t.map(Y=>Y.id),Q=V.indexOf(String(L.id)),z=V.indexOf(String(P.id));Q<0||z<0||rn.getState().reorderWindows(e.id,bd(V,Q,z))};return E.jsxs("div",{ref:B,style:{transform:Ni.Translate.toString(K),transition:I},"data-testid":`device-item-${e.id}`,className:Oe("group/device rounded-xl border border-border/60 overflow-hidden",a?"bg-chat-surface":n?"bg-muted/40":"bg-muted/20",H&&"opacity-60 shadow-lg"),onClick:n?void 0:c,children:[E.jsxs("div",{className:"relative px-3 py-1.5",children:[a&&E.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-muted-foreground/70"}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("button",{type:"button",ref:W,...A,...j,"aria-label":D("device.dragHandle"),onClick:_=>_.stopPropagation(),className:"touch-none cursor-grab shrink-0 -ml-1 text-muted-foreground/50 hover:text-muted-foreground opacity-100",children:E.jsx(gb,{className:"h-3.5 w-3.5 [@media(any-pointer:coarse)]:h-5 [@media(any-pointer:coarse)]:w-5"})}),E.jsx(k,{className:"h-4 w-4 text-muted-foreground shrink-0"}),E.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),E.jsx(AF,{deviceId:e.id,className:"shrink-0"}),E.jsx("div",{className:Oe("h-2 w-2 rounded-full shrink-0",n?"bg-emerald-500":"bg-gray-400")}),E.jsx(Cn,{variant:"ghost",size:"icon-xs",onClick:_=>{_.stopPropagation(),c()},"data-testid":n?`device-disconnect-${e.id}`:`device-connect-${e.id}`,title:D(n?"device.disconnect":"device.connect"),children:n?E.jsx(U3,{className:"h-3.5 w-3.5 text-orange-500"}):E.jsx(B3,{className:"h-3.5 w-3.5 text-emerald-500"})})]})]}),n&&E.jsxs("div",{className:"p-1.5 space-y-1.5 [@media(any-pointer:coarse)]:space-y-2",children:[!t&&E.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:D("device.connecting")}),(t==null?void 0:t.length)===0&&E.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:D("window.noWindows")}),t&&t.length>0&&E.jsx(b0,{sensors:F,collisionDetection:p0,onDragEnd:q,children:E.jsx(w0,{items:t.map(_=>_.id),strategy:x0,children:t.map(_=>E.jsx(sY,{deviceId:e.id,window:_,isSelected:_.id===s,selectedPaneId:i,onPaneClick:b,onWindowClick:x,onCloseWindow:h,onClosePane:f,onRenameWindow:g,onRenamePane:m,onWatchPane:w,sessionsByPane:S,activeSessionId:R,onSelectSession:T,onCreateSessionForPane:C,onRenameSession:M,onDeleteSession:O},_.id))})}),E.jsxs("button",{type:"button","data-testid":`window-create-${e.id}`,onPointerDown:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),onClick:()=>u(e.id),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors text-muted-foreground hover:text-foreground hover:bg-accent/30 border border-dashed border-border/50 hover:border-border",children:[E.jsx(Zh,{className:"h-3.5 w-3.5 shrink-0"}),E.jsx("span",{className:"text-xs",children:D("window.new")})]})]})]})}function sY({deviceId:e,window:t,isSelected:n,selectedPaneId:a,onPaneClick:s,onWindowClick:i,onCloseWindow:c,onClosePane:u,onRenameWindow:h,onRenamePane:f,onWatchPane:g,sessionsByPane:m,activeSessionId:b,onSelectSession:x,onCreateSessionForPane:w,onRenameSession:S,onDeleteSession:R}){const{t:T}=yr(),{isMobile:C}=qr(),M=t.panes.length>1,O=E0(t),D=t.panes.find(P=>P.active)??t.panes[0],k=D==null?void 0:D.currentPath,A=t.panes.find(P=>P.id===a),j=n&&!!A,{attributes:B,listeners:W,setNodeRef:K,setActivatorNodeRef:I,transform:H,transition:F,isDragging:q}=S0({id:t.id}),_=R0(),L=P=>{const{active:V,over:Q}=P;if(!Q||V.id===Q.id)return;const z=t.panes.map(G=>G.id),Y=z.indexOf(String(V.id)),X=z.indexOf(String(Q.id));Y<0||X<0||rn.getState().reorderPanes(e,t.id,bd(z,Y,X))};return E.jsxs("div",{ref:K,style:{transform:Ni.Translate.toString(H),transition:F},className:Oe("space-y-1",q&&"opacity-60"),children:[E.jsxs("div",{className:"group relative flex items-center gap-1",children:[E.jsx("button",{type:"button",ref:I,...B,...W,"aria-label":T("window.dragHandle"),onClick:P=>P.stopPropagation(),className:Oe("touch-none cursor-grab shrink-0 flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground opacity-100",C?"h-9 w-4":"h-6 w-3.5 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:w-4"),children:E.jsx(gb,{className:Oe(C?"h-4 w-4":"h-3.5 w-3.5")})}),E.jsxs("button",{type:"button",onClick:()=>i(e,t.id,t.panes),"data-testid":`window-item-${t.id}`,className:Oe("flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 rounded-lg text-left transition-colors pr-7 [@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:pr-12",C&&"py-2.5 pr-13",j?"bg-primary/10 text-primary":t.active?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"),children:[E.jsx(nY,{paneIds:t.panes.map(P=>P.id)}),M?E.jsx("span",{className:"flex-1 min-w-0 font-mono text-[10.5px] leading-tight text-muted-foreground",children:T("window.paneCount",{count:t.panes.length})}):E.jsxs("span",{className:"flex-1 min-w-0",children:[E.jsx("span",{className:"font-mono text-[11px] leading-tight font-medium line-clamp-2 [overflow-wrap:break-word]",children:O.title}),O.processName&&E.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:k?`${O.processName}@${k}`:O.processName})]})]}),!M&&E.jsxs(o0,{children:[E.jsx(s0,{"data-testid":`window-menu-${t.id}`,"aria-label":T("window.menu"),title:T("window.menu"),className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity data-popup-open:opacity-100",C?"h-11 w-11 right-0 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-1.5 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-0.5 [@media(any-pointer:coarse)]:rounded-lg",j?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),children:E.jsx(HC,{className:Oe(C?"h-5 w-5":"h-3.5 w-3.5 [@media(any-pointer:coarse)]:h-4.5 [@media(any-pointer:coarse)]:w-4.5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":`window-menu-rename-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>h(e,t.id),children:[E.jsx(Qh,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.rename")]}),E.jsxs(dr,{"data-testid":`window-menu-new-session-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>w(e,t.id,A||t.panes[0]),children:[E.jsx(Zh,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("agent.session.new")]}),k&&E.jsxs(dr,{className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().createWindow(e,void 0,k),children:[E.jsx(BC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.newInCwd")]}),D&&E.jsxs(E.Fragment,{children:[E.jsxs(dr,{"data-testid":`window-menu-split-right-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,D.id,"right",D.currentPath),children:[E.jsx(qC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.splitRight")]}),E.jsxs(dr,{"data-testid":`window-menu-split-down-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,D.id,"down",D.currentPath),children:[E.jsx($C,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.splitDown")]}),E.jsxs(dr,{"data-testid":`window-menu-watch-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>g(e,D.id),children:[E.jsx(VC,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("watch.openMonitor")]})]}),E.jsxs(dr,{variant:"destructive","data-testid":`window-menu-close-${t.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",C&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>c(e,t.id),children:[E.jsx(Ei,{className:Oe("h-4 w-4",C&&"h-5 w-5")}),T("window.close")]})]})]})]}),M&&E.jsx("div",{className:"ml-4 pl-2 border-l border-border/50 space-y-1 [@media(any-pointer:coarse)]:space-y-1.5",children:E.jsx(b0,{sensors:_,collisionDetection:p0,onDragEnd:L,children:E.jsx(w0,{items:t.panes.map(P=>P.id),strategy:x0,children:t.panes.map(P=>E.jsx(iY,{deviceId:e,windowId:t.id,pane:P,isActive:P.id===a,isMobile:C,onPaneClick:s,onClosePane:u,onRenamePane:f,onWatchPane:g,onCreateSessionForPane:w,sessions:m.get(`${e}:${P.id}`),activeSessionId:b,onSelectSession:x,onRenameSession:S,onDeleteSession:R},P.id))})})}),!M&&t.panes[0]&&E.jsx("div",{className:"ml-[36px] pl-2 border-l border-border/50",children:E.jsx(sN,{sessions:m.get(`${e}:${t.panes[0].id}`),activeSessionId:b,onSelectSession:x,onRenameSession:S,onDeleteSession:R})})]})}function iY({deviceId:e,windowId:t,pane:n,isActive:a,isMobile:s,onPaneClick:i,onClosePane:c,onRenamePane:u,onWatchPane:h,onCreateSessionForPane:f,sessions:g,activeSessionId:m,onSelectSession:b,onRenameSession:x,onDeleteSession:w}){const{t:S}=yr(),{attributes:R,listeners:T,setNodeRef:C,setActivatorNodeRef:M,transform:O,transition:D,isDragging:k}=S0({id:n.id});return E.jsxs("div",{ref:C,style:{transform:Ni.Translate.toString(O),transition:D},className:Oe(k&&"opacity-60"),children:[E.jsxs("div",{className:"group/pane relative flex items-center gap-1",children:[E.jsx("button",{type:"button",ref:M,...R,...T,"aria-label":S("window.dragHandlePane"),onClick:A=>A.stopPropagation(),className:Oe("touch-none cursor-grab shrink-0 flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground opacity-100",s?"h-9 w-4":"h-6 w-3 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:w-4"),children:E.jsx(gb,{className:Oe(s?"h-4 w-4":"h-3 w-3")})}),E.jsxs("button",{type:"button",onClick:()=>i(e,t,n.id),"data-testid":`pane-item-${n.id}`,className:Oe("flex-1 min-w-0 flex items-center gap-2 px-2 py-1 rounded-lg text-left transition-colors pr-13 [@media(any-pointer:coarse)]:py-2 [@media(any-pointer:coarse)]:pr-21",s&&"py-2.5 pr-24",a?"bg-primary/10 text-primary":n.active?"bg-accent text-accent-foreground":"hover:bg-accent/30 text-muted-foreground"),children:[E.jsx(rY,{paneId:n.id}),E.jsxs("span",{className:"flex-1 min-w-0",children:[E.jsx("span",{className:"font-mono text-[11px] leading-tight font-medium line-clamp-2 [overflow-wrap:break-word]",children:n.customName||n.title||S("window.pane")}),n.currentCommand&&E.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:n.currentPath?`${n.currentCommand}@${n.currentPath}`:n.currentCommand})]})]}),E.jsxs(o0,{children:[E.jsx(s0,{"data-testid":`pane-menu-${n.id}`,"aria-label":S("watch.openMonitor"),className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity data-popup-open:opacity-100",s?"h-11 w-11 right-11 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-7 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-10.5 [@media(any-pointer:coarse)]:rounded-lg",a?"opacity-100":"opacity-0 group-hover/pane:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),children:E.jsx(HC,{className:Oe(s?"h-5 w-5":"h-3.5 w-3.5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":`pane-menu-rename-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>u(e,n.id),children:[E.jsx(Qh,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.rename")]}),E.jsxs(dr,{"data-testid":`pane-menu-new-session-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>f(e,t,n),children:[E.jsx(Zh,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("agent.session.new")]}),n.currentPath&&E.jsxs(dr,{className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().createWindow(e,void 0,n.currentPath),children:[E.jsx(BC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.newInCwd")]}),E.jsxs(dr,{"data-testid":`pane-split-right-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,n.id,"right",n.currentPath),children:[E.jsx(qC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.splitRight")]}),E.jsxs(dr,{"data-testid":`pane-split-down-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>rn.getState().splitPane(e,n.id,"down",n.currentPath),children:[E.jsx($C,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.splitDown")]}),E.jsxs(dr,{"data-testid":`pane-watch-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>h(e,n.id),children:[E.jsx(VC,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("watch.openMonitor")]}),E.jsxs(dr,{variant:"destructive","data-testid":`pane-menu-close-${n.id}`,className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",s&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>c(e,t,n.id),children:[E.jsx(Ei,{className:Oe("h-4 w-4",s&&"h-5 w-5")}),S("window.closePane")]})]})]}),E.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c(e,t,n.id)},"data-testid":`pane-close-${n.id}`,className:Oe("absolute top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",s?"h-11 w-11 right-0 rounded-lg bg-background/40 opacity-100":"h-5 w-5 right-1.5 [@media(any-pointer:coarse)]:h-10 [@media(any-pointer:coarse)]:w-10 [@media(any-pointer:coarse)]:right-0.5 [@media(any-pointer:coarse)]:rounded-lg",a?"opacity-100":"opacity-0 group-hover/pane:opacity-100 [@media(any-pointer:coarse)]:opacity-100"),title:S("window.closePane"),children:E.jsx("span",{className:Oe("leading-none",s?"text-base":"text-xs"),children:"×"})})]}),E.jsx(sN,{sessions:g,activeSessionId:m,onSelectSession:b,onRenameSession:x,onDeleteSession:w})]})}function oN({session:e,onRenameSession:t,onDeleteSession:n,className:a,enlargeOnTouch:s=!1}){const{t:i}=yr(),{isMobile:c}=qr(),u=s&&c;return E.jsxs(o0,{children:[E.jsx(s0,{render:E.jsx(Cn,{variant:"ghost",size:"icon-sm","data-testid":`agent-session-menu-${e.id}`,"aria-label":i("agent.session.rename"),onClick:h=>h.stopPropagation(),className:Oe("size-5 shrink-0 text-muted-foreground transition-opacity data-popup-open:opacity-100",c?"opacity-100":"opacity-0 group-hover:opacity-100 [@media(any-pointer:coarse)]:opacity-100",u&&"size-9",a)}),children:E.jsx(y3,{className:Oe("size-3.5",u&&"size-5")})}),E.jsxs(i0,{align:"end",backdrop:!0,className:"w-auto min-w-36 [@media(any-pointer:coarse)]:min-w-48",children:[E.jsxs(dr,{"data-testid":"agent-session-rename",className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",c&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>t(e),children:[E.jsx(Qh,{className:Oe("h-4 w-4",c&&"h-5 w-5")}),i("agent.session.rename")]}),E.jsxs(dr,{variant:"destructive","data-testid":"agent-session-delete",className:Oe("[@media(any-pointer:coarse)]:py-2.5 [@media(any-pointer:coarse)]:px-2",c&&"py-3 px-2.5 text-base gap-2.5"),onClick:()=>n(e),children:[E.jsx(KC,{className:Oe("h-4 w-4",c&&"h-5 w-5")}),i("agent.session.delete")]})]})]})}function sN({sessions:e,activeSessionId:t,onSelectSession:n,onRenameSession:a,onDeleteSession:s}){const{isMobile:i}=qr();return E.jsx("div",{className:"mt-1 space-y-0.5 [@media(any-pointer:coarse)]:space-y-1",children:e==null?void 0:e.map(c=>{const u=c.id===t;return E.jsxs("div",{className:"group relative",children:[E.jsxs("button",{type:"button","data-testid":`agent-session-item-${c.id}`,onClick:()=>n(c),className:Oe("w-full flex items-center gap-1.5 px-2 py-1 pr-7 rounded-md text-left transition-colors [@media(any-pointer:coarse)]:min-h-11 [@media(any-pointer:coarse)]:py-2 [@media(any-pointer:coarse)]:pr-12",i&&"min-h-11 py-2 pr-12",u?"bg-primary/10 text-primary":"hover:bg-accent/30 text-muted-foreground"),children:[E.jsx(pb,{className:"size-3 shrink-0 opacity-70"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px]",children:c.title}),E.jsx(aN,{status:c.status})]}),E.jsx("div",{className:"absolute right-0.5 top-1/2 -translate-y-1/2",children:E.jsx(oN,{session:c,onRenameSession:a,onDeleteSession:s,enlargeOnTouch:!0})})]},c.id)})})}function lY({sessions:e,activeSessionId:t,onSelectSession:n,onRenameSession:a,onDeleteSession:s}){const{t:i}=yr(),[c,u]=y.useState(!1),h=To(f=>{var g;return((g=f.settings)==null?void 0:g.language)??"en_US"});return E.jsxs(ZM,{open:c,onOpenChange:u,className:"rounded-xl border border-border/60 bg-muted/20",children:[E.jsxs(JM,{"data-testid":"agent-orphan-sessions-trigger",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left",children:[E.jsx(T3,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),E.jsx("span",{className:"flex-1 truncate text-xs font-medium text-muted-foreground",children:i("agent.orphan.title",{count:e.length})}),E.jsx(UC,{className:Oe("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")})]}),E.jsx(e2,{className:"space-y-0.5 px-1.5 pb-1.5",children:e.map(f=>{const g=f.id===t,m=[f.originPaneTitle,f.originProcessName,f.createdAt?new Date(f.createdAt).toLocaleString(UT(h)):null].filter(b=>!!b);return E.jsxs("div",{className:"group relative",children:[E.jsxs("button",{type:"button","data-testid":`agent-orphan-session-${f.id}`,onClick:()=>n(f),className:Oe("w-full flex flex-col gap-0.5 px-2 py-1.5 pr-7 rounded-lg text-left transition-colors",g?"bg-primary/10 text-primary":"hover:bg-accent/30"),children:[E.jsxs("span",{className:"flex items-center gap-1.5",children:[E.jsx(pb,{className:"size-3 shrink-0 opacity-70"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px]",children:f.title}),E.jsx(aN,{status:f.status})]}),m.length>0&&E.jsx("span",{className:"truncate pl-[18px] text-[10px] text-muted-foreground",children:m.join(" · ")})]}),E.jsx("div",{className:"absolute right-0.5 top-1.5",children:E.jsx(oN,{session:f,onRenameSession:a,onDeleteSession:s})})]},f.id)})})]})}function cY(){const{t:e}=yr(),{isMobile:t,setOpenMobile:n}=qr(),a=To(g=>{var m;return(m=g.settings)==null?void 0:m.siteName}),s=To(g=>g.fetchSettings);y.useEffect(()=>{s()},[s]);const i=a??"tmex",c=Ar(g=>g.theme),u=To(g=>g.updateTheme),h=c==="dark",f=()=>{const g=h?"light":"dark";u(g),document.documentElement.classList.toggle("dark",g==="dark")};return E.jsxs("div",{className:"flex items-center gap-2 px-2",children:[t&&E.jsx("button",{type:"button","data-testid":"mobile-sidebar-close",onClick:()=>n(!1),className:"inline-flex h-8 w-8 ml-[-8px] shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e("nav.closeSidebar"),title:e("nav.closeSidebar"),children:E.jsx(Ei,{className:"h-4 w-4"})}),E.jsxs(Hh,{to:"/",className:"flex flex-1 items-center gap-3 overflow-hidden",children:[E.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-lg border-2 border-black",children:E.jsx("img",{src:"/logo.png",alt:i,className:"h-full w-full object-cover"})}),E.jsx("span",{className:"truncate text-sm font-semibold tracking-tight",children:i})]}),E.jsx(uY,{}),E.jsx("button",{type:"button",onClick:f,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e(h?"settings.themeLight":"settings.themeDark"),title:e(h?"settings.themeLight":"settings.themeDark"),children:h?E.jsx(Q3,{className:"h-4 w-4"}):E.jsx(D3,{className:"h-4 w-4"})}),E.jsx(Hh,{to:"/settings",className:"inline-flex h-8 w-8 mr-[-8px] shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","aria-label":e("sidebar.settings"),title:e("sidebar.settings"),children:E.jsx(q3,{className:"h-4 w-4"})})]})}function uY(){const e=rn(n=>n.wsLatencyMs);if(e===null)return null;const t=e>=200;return E.jsxs("span",{className:`inline-flex h-8 shrink-0 items-center text-xs tabular-nums ${t?"text-orange-400":"text-muted-foreground"}`,children:[e,"ms"]})}const dY=y.lazy(()=>Ro(()=>import("./agent-tab-BgvIAv35.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.AgentTab}))),fY=y.lazy(()=>Ro(()=>import("./files-tab-1FVCHULV.js"),__vite__mapDeps([4,5,6,7,8,9])).then(e=>({default:e.FilesTab}))),Ny="rounded-lg data-active:bg-background data-active:text-foreground data-active:border-transparent group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:bg-input/60 dark:data-active:border-transparent text-[13px] transition-colors duration-200 [&_svg:not([class*='size-'])]:size-[15px]",hY=[{title:"nav.manageDevices",url:"/devices",icon:FC}];function mY({...e}){const{t}=yr(),n=Ar(s=>s.sidebarTab),a=Ar(s=>s.setSidebarTab);return E.jsxs(D8,{variant:"inset",...e,children:[E.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),E.jsxs(L8,{className:"gap-5 pt-3 pb-0",children:[E.jsx(cY,{}),E.jsx(fF,{className:"mb-2.5",value:n,onValueChange:s=>a(s),children:E.jsxs(mF,{className:"w-full p-1 rounded-xl border border-border/60 group-data-horizontal/tabs:h-11",children:[E.jsxs(yy,{value:"panes","data-testid":"sidebar-tab-panes",className:Ny,children:[E.jsx(L3,{}),t("sidebar.tab.panes")]}),E.jsxs(yy,{value:"agent","data-testid":"sidebar-tab-agent",className:Ny,children:[E.jsx(pb,{}),t("sidebar.tab.agent")]}),E.jsxs(yy,{value:"files","data-testid":"sidebar-tab-files",className:Ny,children:[E.jsx(b3,{}),t("sidebar.tab.files")]})]})})]}),E.jsxs(P8,{className:"flex min-h-0 flex-col overflow-hidden",children:[n==="panes"&&E.jsx(aY,{}),n==="agent"&&E.jsx(y.Suspense,{fallback:null,children:E.jsx(dY,{})}),n==="files"&&E.jsx(y.Suspense,{fallback:null,children:E.jsx(fY,{})})]}),n==="panes"&&E.jsxs(I8,{children:[E.jsx(OF,{items:hY}),E.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})}let uT=!1;function pY(e,t,n){var s,i,c;let a=n;if(!a){const u=(i=(s=rn.getState().snapshots[e])==null?void 0:s.session)==null?void 0:i.windows;a=(c=u==null?void 0:u.find(h=>h.panes.some(f=>f.id===t)))==null?void 0:c.id}return a?`/devices/${e}/windows/${a}/panes/${rN(t)}`:`/devices/${e}`}function gY(e,t){const n=e.getQueriesData({queryKey:["watch-rules"]});for(const[,a]of n){const s=a==null?void 0:a.find(i=>i.id===t);if(s)return s.name}return null}async function yY(e,t){var a;const n=gY(e,t);if(n)return n;try{const s=await fetch(`/api/watch/rules/${t}`);return s.ok?((a=(await s.json()).rule)==null?void 0:a.name)??null:null}catch{return null}}function vY(e,t,n){if(!(typeof Notification>"u"||Notification.permission!=="granted"))try{const a=new Notification(e,{body:t});a.onclick=()=>{window.focus(),fb(n)}}catch{}}function bY(e,t){e.invalidateQueries({queryKey:["watch-rules"]}),e.invalidateQueries({queryKey:["watch-rule-state",t]})}async function xY(e,t,n,a,s){const c=await yY(e,t)??en.t("watch.toast.triggeredTitle"),u=s.summary||s.matchedText||"",h=u.length>200?`${u.slice(0,200)}…`:u,f=pY(n,a,s.windowId);dn(c,{description:h,action:{label:en.t("watch.toast.openTerminal"),onClick:()=>{fb(f)}}}),vY(c,h,f)}function wY(e){if(uT)return;uT=!0,Jt().onMessage(n=>{if(n.kind!==ej)return;let a;try{a=wa(Yj,n.payload)}catch(i){console.error("[watch] failed to decode WATCH_EVENT:",i);return}let s;try{s=JSON.parse(new TextDecoder().decode(a.payload))}catch(i){console.error("[watch] failed to parse WATCH_EVENT payload:",i);return}switch(bY(e,a.ruleId),a.eventType){case y_:xY(e,a.ruleId,a.deviceId,a.paneId,s);return;case v_:{const i=s;dn.warning(en.t("watch.toast.modelUnavailableTitle"),{description:`${i.message} ${en.t("watch.toast.modelUnavailableHint")}`});return}case b_:{const i=s;dn.error(en.t("watch.toast.ruleErrorTitle"),{description:i.message});return}default:return}})}function SY(){const e=Ju(),t=rn(n=>n.ensureSocketConnected);return y.useEffect(()=>{wY(e),t()},[e,t]),null}let $u=null;function iq(e){$u=e}function lq(e){$u===e&&($u=null)}function EY(){return $u?$u():null}const RY=60,TY=.02;function CY(e){if(Math.abs(e.viewportScale-1)>TY)return 0;const t=Math.round(e.windowInnerHeight-e.viewportHeight-e.viewportOffsetTop);return t>=RY?t:0}function OY(e){const t=e.windowInnerHeight-e.inset,a=e.cursorBottomClientY+e.appliedOffset+e.margin-t,s=e.maxOffset??e.inset;return Math.min(Math.max(0,Math.round(a)),s)}function cq(){if(typeof navigator>"u")return!1;const e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return t||n}function MY(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}const oh={strategy:"none"},NY=8,AY=60,DY='[data-slot="sidebar-inset"]',dT=".terminal-shortcuts-strip",fT="--tmex-kb-shortcut-lift";function kY(e,t){return e.strategy!==t.strategy?!1:e.strategy==="transform"&&t.strategy==="transform"?Math.abs(e.offset-t.offset)<1:e.strategy==="height"&&t.strategy==="height"?Math.abs(e.height-t.height)<1:!0}function jY(e,t){const[n,a]=y.useState(oh);return y.useEffect(()=>{if(!MY())return;const s=window.visualViewport;if(!s)return;let i=null,c=null,u=oh,h=null,f=0;const g=D=>{kY(u,D)||(u=D,a(D))},m=()=>{if((!h||!h.isConnected)&&(h=document.querySelector(DY)),!h)return 0;const D=window.getComputedStyle(h).transform;if(!D||D==="none")return 0;try{return-new DOMMatrix(D).m42}catch{return 0}},b=D=>{f=Math.round(D),document.documentElement.style.setProperty(fT,`${f}px`)},x=D=>{const k=document.querySelector(dT);if(!k){b(0);return}const A=k.getBoundingClientRect().bottom,j=window.innerHeight-D;b(f+(A-j))},w=()=>{const D=document.querySelector(dT);return D?D.offsetHeight:0},S=()=>{if(e)return 0;const D=document.activeElement;return D instanceof Element&&D.closest("[data-virtual-keyboard-avoid]")!==null?CY({windowInnerHeight:window.innerHeight,viewportHeight:s.height,viewportOffsetTop:s.offsetTop,viewportScale:s.scale}):0},R=()=>{const D=S();if(D<=0){b(0),g(oh),M();return}if(t==="resize"){b(0);const k=window.innerHeight-D;k>=AY?g({strategy:"height",height:k}):g({strategy:"transform",offset:D}),M();return}if(t==="follow"){const k=EY();if(k){const A=w(),j=OY({cursorBottomClientY:k.bottom,appliedOffset:m(),windowInnerHeight:window.innerHeight,inset:D,margin:NY+A,maxOffset:D+A});g(j>0?{strategy:"transform",offset:j}:oh),x(D)}else b(0),g({strategy:"transform",offset:D});C();return}b(0),g({strategy:"transform",offset:D}),M()},T=()=>{c=null,R()},C=()=>{c===null&&(c=window.requestAnimationFrame(T))},M=()=>{c!==null&&(window.cancelAnimationFrame(c),c=null)},O=()=>{i===null&&(i=window.requestAnimationFrame(()=>{i=null,R()}))};return R(),s.addEventListener("resize",O),s.addEventListener("scroll",O),window.addEventListener("resize",O),document.addEventListener("focusin",O),document.addEventListener("focusout",O),()=>{s.removeEventListener("resize",O),s.removeEventListener("scroll",O),window.removeEventListener("resize",O),document.removeEventListener("focusin",O),document.removeEventListener("focusout",O),i!==null&&window.cancelAnimationFrame(i),M(),document.documentElement.style.removeProperty(fT)}},[e,t]),n}const iN="NotoSansSymbols2Tmex";function lN(e){return Jg.find(t=>t.id===e)??Jg.find(t=>t.id===_C)??Jg[0]}function _Y(e){return`${lN(e).cssFamily}, ${iN}, monospace`}const hT=new Set;function LY(e){const t=globalThis.document;if(!t||!e.files||hT.has(e.cssFamily))return;const n=t.createElement("style");n.dataset.tmexFont=e.id,n.textContent=`@font-face{font-family:${e.cssFamily};src:url("${e.files.regular}") format("woff2");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:${e.cssFamily};src:url("${e.files.bold}") format("woff2");font-weight:700;font-style:normal;font-display:swap}`,t.head.appendChild(n),hT.add(e.cssFamily)}async function IY(e,t){var s;const n=(s=globalThis.document)==null?void 0:s.fonts;if(!(n!=null&&n.load))return;const a=lN(e);a.isDefault||LY(a);try{await Promise.all([a.cssFamily,iN].flatMap(i=>[n.load(`${t}px ${i}`),n.load(`bold ${t}px ${i}`)]))}catch{}}function PY(){const e=Ar(n=>n.terminalFontId),t=Ar(n=>n.terminalFontSize);y.useEffect(()=>{IY(e,t);const n=globalThis.document;n==null||n.documentElement.style.setProperty("--font-mono",_Y(e))},[e,t])}console.info(`tmex ${sk("0.16.5",!0)}`);function zY(){var e;try{const t=localStorage.getItem("tmex-ui");if(!t){document.documentElement.classList.add("dark");return}const n=JSON.parse(t),a=(e=n==null?void 0:n.state)==null?void 0:e.theme,s=a==="dark"||a===void 0;document.documentElement.classList.toggle("dark",s)}catch{document.documentElement.classList.add("dark")}}zY();const UY=new $D({defaultOptions:{queries:{staleTime:5e3,retry:1}}});function HY(){const{openMobile:e}=qr(),t=Ar(n=>n.theme);return y.useEffect(()=>{const n=e?"--sidebar":"--background";document.body.style.backgroundColor=`var(${n})`,requestAnimationFrame(()=>{var i;const s=getComputedStyle(document.body).backgroundColor;(i=document.querySelector('meta[name="theme-color"]'))==null||i.setAttribute("content",s)})},[e,t]),null}function BY(){const e=Ar(t=>t.theme);return E.jsx(n5,{theme:e,richColors:!0,position:"top-right",closeButton:!0,offset:{top:"calc(16px + env(safe-area-inset-top, 0px))",right:"16px",bottom:"16px",left:"16px"},mobileOffset:{top:"calc(12px + env(safe-area-inset-top, 0px))",right:"12px",bottom:"12px",left:"12px"},toastOptions:{duration:6e3}})}function FY(){return PY(),E.jsxs(G8,{children:[E.jsx(SY,{}),E.jsxs(A8,{children:[E.jsx(HY,{}),E.jsx($8,{}),E.jsx(mY,{}),E.jsx(VY,{})]})]})}function VY(){const{openMobile:e}=qr(),t=Ar(i=>i.keyboardBehaviorMode),n=jY(e,t),a=n.strategy!=="none",s=n.strategy==="transform"?{transform:`translateY(-${n.offset}px)`,transition:t==="follow"?void 0:"transform 0.12s ease-out"}:n.strategy==="height"?{height:`${n.height}px`,transition:"height 0.12s ease-out"}:void 0;return E.jsxs(_8,{className:"h-dvh overflow-hidden md:h-[calc(100dvh-1rem)]",style:s,children:[E.jsx($I,{}),E.jsx("div",{style:{height:a?0:"var(--tmex-safe-area-bottom)",transition:"height 0.12s ease-out"}})]})}function pl({moduleLoader:e}){const[t,n]=y.useState(null),a=RI();y.useEffect(()=>{e().then(n)},[e]);const s=t==null?void 0:t.default,i=t==null?void 0:t.PageTitle,c=t==null?void 0:t.PageActions;return E.jsxs(E.Fragment,{children:[E.jsxs("header",{className:"sticky top-0 z-10 flex h-12 md:h-16 shrink-0 items-center justify-between gap-2 bg-background/95 backdrop-blur-sm","data-testid":"mobile-topbar",children:[E.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-4",children:[E.jsx(j8,{className:"-ml-1 shrink-0","data-testid":"mobile-sidebar-open"}),E.jsx(OH,{orientation:"vertical",className:"mr-2 shrink-0 data-[orientation=vertical]:h-4"}),E.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i?E.jsx(i,{...a}):""})]}),E.jsx("div",{className:"flex shrink-0 items-center gap-1 px-4",children:c&&E.jsx(c,{...a})})]}),E.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 !pt-0 p-2 md:p-4",children:E.jsx("div",{className:"bg-muted/50 min-h-0 flex-1 overflow-auto overscroll-auto rounded-xl [-webkit-overflow-scrolling:touch]",children:s?E.jsx(s,{}):null})})]})}const YY=()=>Ro(()=>import("./SettingsPage-BAx39LyM.js"),__vite__mapDeps([10,11,6,12,5,2,13,1,14,9])),mT=()=>Ro(()=>import("./DevicesPage-XMtf7VIy.js"),__vite__mapDeps([15,11,3])),pT=()=>Ro(()=>import("./DevicePage-BIjGEtCP.js"),__vite__mapDeps([16,12,5,2,8])),qY=()=>Ro(()=>import("./FilePage-C1_JLsEc.js"),__vite__mapDeps([17,13,1,14,6,7])),$Y=yP([{path:"/",Component:FY,children:[{index:!0,element:E.jsx(pl,{moduleLoader:mT})},{path:"devices",element:E.jsx(pl,{moduleLoader:mT})},{path:"devices/:deviceId",element:E.jsx(pl,{moduleLoader:pT})},{path:"devices/:deviceId/windows/:windowId/panes/:paneId",element:E.jsx(pl,{moduleLoader:pT})},{path:"settings",element:E.jsx(pl,{moduleLoader:YY})},{path:"file/:ref",element:E.jsx(pl,{moduleLoader:qY})}]}]),cN=document.getElementById("root");if(!cN)throw new Error("Root element not found");q5.catch(()=>{}).then(()=>{rL.createRoot(cN).render(E.jsx(y.StrictMode,{children:E.jsxs(GD,{client:UY,children:[E.jsx(VI,{router:$Y}),E.jsx(t4,{}),E.jsx(BY,{})]})}))});export{VC as $,wv as A,Cn as B,Nv as C,o0 as D,y3 as E,Av as F,S3 as G,Dv as H,kv as I,t2 as J,va as K,ub as L,FC as M,vy as N,xy as O,Zh as P,by as Q,wy as R,OH as S,KC as T,ni as U,l9 as V,_R as W,Oe as X,Zt as Y,en as Z,OT as _,Ju as a,eV as a$,_9 as a0,Ty as a1,jv as a2,b0 as a3,p0 as a4,w0 as a5,x0 as a6,bd as a7,Z7 as a8,y0 as a9,rq as aA,K3 as aB,aq as aC,$B as aD,WB as aE,QB as aF,ZB as aG,JB as aH,lq as aI,ZY as aJ,iq as aK,mb as aL,RI as aM,sq as aN,cq as aO,rN as aP,oq as aQ,E4 as aR,CV as aS,TV as aT,qC as aU,$C as aV,d9 as aW,$n as aX,Di as aY,IF as aZ,a2 as a_,K2 as aa,$2 as ab,S0 as ac,gb as ad,Ni as ae,Ar as af,IY as ag,G_ as ah,X_ as ai,_Y as aj,lN as ak,Jg as al,l3 as am,ZM as an,JM as ao,UC as ap,$l as aq,e2 as ar,m3 as as,Ei as at,eq as au,tq as av,ob as aw,WY as ax,ri as ay,nq as az,To as b,pd as b0,ks as b1,jn as b2,qt as b3,Nt as b4,gr as b5,Mt as b6,yv as b7,ur as b8,c2 as b9,XY as bA,Ro as bB,yt as ba,VO as bb,Ci as bc,KF as bd,GF as be,qF as bf,YO as bg,FF as bh,od as bi,LC as bj,BC as bk,$5 as bl,QY as bm,zM as bn,xV as bo,pb as bp,qr as bq,qa as br,Yl as bs,Pe as bt,q3 as bu,o3 as bv,fF as bw,mF as bx,yy as by,Ny as bz,ed as c,rn as d,ju as e,Sv as f,Ev as g,jR as h,Tv as i,E as j,Cv as k,Rv as l,Mv as m,Ov as n,dn as o,s0 as p,i0 as q,y as r,dr as s,UT as t,yr as u,Qh as v,JY as w,Bu as x,AF as y,NU as z};
@@ -1,2 +1,2 @@
1
- import{_ as a,l as s,I as o,e as i}from"./mermaid.core-C3nmuA6R.js";import{p as g}from"./wardley-L42UT6IY-DTlpnptg.js";import"./index-Dc3Fwpho.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.15.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
1
+ import{_ as a,l as s,I as o,e as i}from"./mermaid.core-CvSv2dqw.js";import{p as g}from"./wardley-L42UT6IY-viU1xsE2.js";import"./index-U4iZ6Kxr.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.15.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
2
2
  `+r);const t=o(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
@@ -1,4 +1,4 @@
1
- import{_ as o,c as ot,N as ut,I as dt,al as yt,z as ft,k as pt,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-C3nmuA6R.js";import"./index-Dc3Fwpho.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],B={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(N){i.length=i.length-2*N,p.length=p.length-N,n.length=n.length-N}o(F,"popStack");function j(){var N;return N=u.pop()||b.lex()||E,typeof N!="number"&&(N instanceof Array&&(u=N,N=u.pop()),N=s.symbols_[N]||N),N}o(j,"lex");for(var A,W,P,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?P=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),P=v[W]&&v[W][A]),typeof P>"u"||!P.length||!P[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
1
+ import{_ as o,c as ot,N as ut,I as dt,al as yt,z as ft,k as pt,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-CvSv2dqw.js";import"./index-U4iZ6Kxr.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],B={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(N){i.length=i.length-2*N,p.length=p.length-N,n.length=n.length-N}o(F,"popStack");function j(){var N;return N=u.pop()||b.lex()||E,typeof N!="number"&&(N instanceof Array&&(u=N,N=u.pop()),N=s.symbols_[N]||N),N}o(j,"lex");for(var A,W,P,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?P=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),P=v[W]&&v[W][A]),typeof P>"u"||!P.length||!P[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
2
2
  `+b.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(P[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(P[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[P[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,P[1],p,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[P[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{g as gt}from"./chunk-FMBD7UC4-CyZO-UAp.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-DNxRBeA7.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as X,e as $t,z as Mt}from"./mermaid.core-C3nmuA6R.js";import{d as it}from"./arc-DNrUdLWP.js";import"./index-Dc3Fwpho.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
1
+ import{g as gt}from"./chunk-FMBD7UC4-DnaDXP2z.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-BCRcaTWl.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as X,e as $t,z as Mt}from"./mermaid.core-CvSv2dqw.js";import{d as it}from"./arc-BX-Po9p7.js";import"./index-U4iZ6Kxr.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{_ as c,l as te,c as W,I as fe,af as ye,ag as be,ah as me,Y as _e,G as K,i as F,t as ke,J as Ee,V as Se,W as le,X as ce}from"./mermaid.core-C3nmuA6R.js";import{g as Ne}from"./chunk-FMBD7UC4-CyZO-UAp.js";import"./index-Dc3Fwpho.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],M=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],U=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:M}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:U,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:M}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:U,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,G={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
1
+ import{_ as c,l as te,c as W,I as fe,af as ye,ag as be,ah as me,Y as _e,G as K,i as F,t as ke,J as Ee,V as Se,W as le,X as ce}from"./mermaid.core-CvSv2dqw.js";import{g as Ne}from"./chunk-FMBD7UC4-DnaDXP2z.js";import"./index-U4iZ6Kxr.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],M=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],U=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:M}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:U,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:M}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:U,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,G={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
2
2
  `+m.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:Y})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],G.$=u[u.length-I],G._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(G._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(G,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(G.$),e.push(G._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`