tmex-cli 0.4.3 → 0.4.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.
- package/dist/runtime/server.js +139 -7
- package/package.json +1 -1
- package/resources/fe-dist/assets/{DevicePage-B9rZioAr.js → DevicePage-Di11uzbS.js} +8 -8
- package/resources/fe-dist/assets/{DevicePage-B9rZioAr.js.map → DevicePage-Di11uzbS.js.map} +1 -1
- package/resources/fe-dist/assets/{DevicesPage-Bco831ry.js → DevicesPage-dj7Pel6f.js} +2 -2
- package/resources/fe-dist/assets/{DevicesPage-Bco831ry.js.map → DevicesPage-dj7Pel6f.js.map} +1 -1
- package/resources/fe-dist/assets/{SettingsPage-BRs8Unfx.js → SettingsPage-DwpbDA_e.js} +2 -2
- package/resources/fe-dist/assets/{SettingsPage-BRs8Unfx.js.map → SettingsPage-DwpbDA_e.js.map} +1 -1
- package/resources/fe-dist/assets/{index-BhBqXsZI.js → index-61hq_aNX.js} +3 -3
- package/resources/fe-dist/assets/{index-BhBqXsZI.js.map → index-61hq_aNX.js.map} +1 -1
- package/resources/fe-dist/assets/{select-D70hG6p7.js → select-DI4HQZd4.js} +2 -2
- package/resources/fe-dist/assets/{select-D70hG6p7.js.map → select-DI4HQZd4.js.map} +1 -1
- package/resources/fe-dist/assets/{switch-DsyIGzyC.js → switch-DsfDIUrU.js} +2 -2
- package/resources/fe-dist/assets/{switch-DsyIGzyC.js.map → switch-DsfDIUrU.js.map} +1 -1
- package/resources/fe-dist/assets/{useValueChanged-CBb-JR7o.js → useValueChanged-AVaPYvln.js} +2 -2
- package/resources/fe-dist/assets/{useValueChanged-CBb-JR7o.js.map → useValueChanged-AVaPYvln.js.map} +1 -1
- package/resources/fe-dist/index.html +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ut=Object.defineProperty;var Bt=(e,s,r)=>s in e?Ut(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var We=(e,s,r)=>Bt(e,typeof s!="symbol"?s+"":s,r);import{c as Ue,j as t,D as zt,g as _t,h as dt,X as qt,B as pe,k as X,l as Gt,m as Vt,n as Yt,o as Qt,r as o,p as ve,q as lt,s as ut,v as Ae,w as pt,x as ft,y as ye,z as Jt,A as Wt,C as Xt,F as Zt,E as ue,G as en,H as mt,J as tn,K as gt,L as nn,M as sn,P as on,N as an,O as Me,Q as rn,R as cn,S as dn,T as je,U as ln,V as un,W as pn,Y as fn,Z as Te,_ as ht,$ as mn,a0 as $,a1 as gn,a2 as hn,a3 as xt,a4 as vt,a5 as He,a6 as xn,a7 as vn,a8 as yn,a9 as bn,aa as Pe,ab as Cn,ac as we,ad as Xe,ae as jn,af as wn,ag as Le,ah as In,ai as Rn,aj as Mn,ak as Pn,al as Sn,am as Tn,an as Ke,ao as En,ap as yt,aq as Nn,ar as bt,as as kn,at as On,au as Dn,av as $e,aw as Fn,ax as An,ay as Hn,az as De,aA as Ln,aB as Kn,aC as $n,aD as Un,aE as Ze,aF as Bn,aG as zn,aH as _n,aI as qn,aJ as et,aK as tt,aL as Gn,aM as Vn,u as be,a as Ct,e as Yn,aN as Qn,aO as jt,aP as wt,aQ as Jn,f as ce,aR as nt,aS as Wn,aT as Xn,aU as Zn,aV as es}from"./index-
|
|
1
|
+
var Ut=Object.defineProperty;var Bt=(e,s,r)=>s in e?Ut(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var We=(e,s,r)=>Bt(e,typeof s!="symbol"?s+"":s,r);import{c as Ue,j as t,D as zt,g as _t,h as dt,X as qt,B as pe,k as X,l as Gt,m as Vt,n as Yt,o as Qt,r as o,p as ve,q as lt,s as ut,v as Ae,w as pt,x as ft,y as ye,z as Jt,A as Wt,C as Xt,F as Zt,E as ue,G as en,H as mt,J as tn,K as gt,L as nn,M as sn,P as on,N as an,O as Me,Q as rn,R as cn,S as dn,T as je,U as ln,V as un,W as pn,Y as fn,Z as Te,_ as ht,$ as mn,a0 as $,a1 as gn,a2 as hn,a3 as xt,a4 as vt,a5 as He,a6 as xn,a7 as vn,a8 as yn,a9 as bn,aa as Pe,ab as Cn,ac as we,ad as Xe,ae as jn,af as wn,ag as Le,ah as In,ai as Rn,aj as Mn,ak as Pn,al as Sn,am as Tn,an as Ke,ao as En,ap as yt,aq as Nn,ar as bt,as as kn,at as On,au as Dn,av as $e,aw as Fn,ax as An,ay as Hn,az as De,aA as Ln,aB as Kn,aC as $n,aD as Un,aE as Ze,aF as Bn,aG as zn,aH as _n,aI as qn,aJ as et,aK as tt,aL as Gn,aM as Vn,u as be,a as Ct,e as Yn,aN as Qn,aO as jt,aP as wt,aQ as Jn,f as ce,aR as nt,aS as Wn,aT as Xn,aU as Zn,aV as es}from"./index-61hq_aNX.js";import{h as It,i as ts,j as ns,k as ss,l as os,m as as,n as rs,u as Se,C as Ie,c as Re,a as is,b as cs,o as ds,I as ie,S as st,d as ot,e as at,f as rt,g as he}from"./select-DI4HQZd4.js";import{A as ls,a as us,b as ps,h as fs,T as Rt,c as ms,d as gs,e as hs,f as xs,g as vs}from"./useValueChanged-AVaPYvln.js";/**
|
|
2
2
|
* @license lucide-react v0.564.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -14,4 +14,4 @@ var Ut=Object.defineProperty;var Bt=(e,s,r)=>s in e?Ut(e,s,{enumerable:!0,config
|
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
16
|
*/const ws=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Is=Ue("zap",ws);function Rs({...e}){return t.jsx(zt,{"data-slot":"dialog",...e})}function Ms({...e}){return t.jsx(Yt,{"data-slot":"dialog-portal",...e})}function Ps({className:e,...s}){return t.jsx(Qt,{"data-slot":"dialog-overlay",className:X("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",e),...s})}function Ss({className:e,children:s,showCloseButton:r=!0,...n}){return t.jsxs(Ms,{children:[t.jsx(Ps,{}),t.jsxs(_t,{"data-slot":"dialog-content",className:X("bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n,children:[s,r&&t.jsxs(dt,{"data-slot":"dialog-close",render:t.jsx(pe,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[t.jsx(qt,{}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ts({className:e,...s}){return t.jsx("div",{"data-slot":"dialog-header",className:X("gap-2 flex flex-col",e),...s})}function Es({className:e,showCloseButton:s=!1,children:r,...n}){return t.jsxs("div",{"data-slot":"dialog-footer",className:X("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[r,s&&t.jsx(dt,{render:t.jsx(pe,{variant:"outline"}),children:"Close"})]})}function Ns({className:e,...s}){return t.jsx(Gt,{"data-slot":"dialog-title",className:X("text-base leading-none font-medium",e),...s})}function ks({className:e,...s}){return t.jsx(Vt,{"data-slot":"dialog-description",className:X("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",e),...s})}const Mt=o.createContext(void 0);function Pt(e){const s=o.useContext(Mt);if(s===void 0&&!e)throw new Error(ve(33));return s}const St=o.createContext(void 0);function fe(e){const s=o.useContext(St);if(s===void 0&&!e)throw new Error(ve(36));return s}const Os=o.createContext(void 0);function Ee(e=!0){const s=o.useContext(Os);if(s===void 0&&!e)throw new Error(ve(25));return s}function Ds(e){const{closeOnClick:s,highlighted:r,id:n,nodeId:p,store:i,itemRef:m,itemMetadata:c}=e,{events:x}=i.useState("floatingTreeRoot"),b=Ee(!0),C=b!==void 0;return o.useMemo(()=>({id:n,role:"menuitem",tabIndex:r?0:-1,onMouseMove(y){p&&x.emit("itemhover",{nodeId:p,target:y.currentTarget})},onClick(y){s&&x.emit("close",{domEvent:y,reason:lt})},onMouseUp(y){if(b){const M=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,C&&M&&Math.abs(y.clientX-M.x)<=1&&Math.abs(y.clientY-M.y)<=1)return}m.current&&i.context.allowMouseUpTriggerRef.current&&(!C||y.button===2)&&(!c||c.type==="regular-item")&&m.current.click()}}),[s,r,n,x,p,i,m,b,C,c])}const Fs={type:"regular-item"};function As(e){const{closeOnClick:s,disabled:r=!1,highlighted:n,id:p,store:i,nativeButton:m,itemMetadata:c,nodeId:x}=e,b=o.useRef(null),{getButtonProps:C,buttonRef:y}=ut({disabled:r,focusableWhenDisabled:!0,native:m}),M=Ds({closeOnClick:s,highlighted:n,id:p,nodeId:x,store:i,itemRef:b,itemMetadata:c}),D=o.useCallback(g=>Ae(M,{onMouseEnter(){c.type==="submenu-trigger"&&c.setActive()},onKeyUp(S){S.key===" "&&i.context.typingRef.current&&S.preventBaseUIHandler()}},g,C),[M,C,i,c]),f=pt(b,y);return o.useMemo(()=>({getItemProps:D,itemRef:f}),[D,f])}const Hs=o.forwardRef(function(s,r){const{render:n,className:p,id:i,label:m,nativeButton:c=!1,disabled:x=!1,closeOnClick:b=!0,...C}=s,y=It({label:m}),M=Pt(!0),D=ft(i),{store:f}=fe(),g=f.useState("isActive",y.index),S=f.useState("itemProps"),{getItemProps:w,itemRef:u}=As({closeOnClick:b,disabled:x,highlighted:g,id:D,store:f,nativeButton:c,nodeId:M==null?void 0:M.nodeId,itemMetadata:Fs});return ye("div",s,{state:{disabled:x,highlighted:g},props:[S,C,w],ref:[u,r,y.ref]})}),Ls={...mt,...en},Ks=o.forwardRef(function(s,r){const{render:n,className:p,finalFocus:i,...m}=s,{store:c}=fe(),{side:x,align:b}=Pt(),C=ts()!=null,y=c.useState("open"),M=c.useState("transitionStatus"),D=c.useState("popupProps"),f=c.useState("mounted"),g=c.useState("instantType"),S=c.useState("activeTriggerElement"),w=c.useState("parent"),u=c.useState("lastOpenChangeReason"),N=c.useState("rootId"),B=c.useState("floatingRootContext"),h=c.useState("floatingTreeRoot"),a=c.useState("closeDelay"),I=c.useState("activeTriggerElement"),F=w.type==="context-menu";Jt({open:y,ref:c.context.popupRef,onComplete(){var j,K;y&&((K=(j=c.context).onOpenChangeComplete)==null||K.call(j,!0))}}),o.useEffect(()=>{function j(K){c.setOpen(!1,ue(K.reason,K.domEvent))}return h.events.on("close",j),()=>{h.events.off("close",j)}},[h.events,c]);const A=c.useState("hoverEnabled"),O=c.useState("disabled");Wt(B,{enabled:A&&!O&&!F&&w.type!=="menubar",closeDelay:a});const P={transitionStatus:M,side:x,align:b,open:y,nested:w.type==="menu",instant:g},d=ye("div",s,{state:P,ref:[r,c.context.popupRef],stateAttributesMapping:Ls,props:[D,{onKeyDown(j){C&&tn.has(j.key)&&j.stopPropagation()}},gt(M),m,{"data-rootownerid":N}]});let l=w.type===void 0||F;return(S||w.type==="menubar"&&u!==Xt)&&(l=!0),t.jsx(Zt,{context:B,modal:F,disabled:!f,returnFocus:i===void 0?l:i,initialFocus:w.type!=="menu",restoreFocus:!0,externalTree:w.type!=="menubar"?h:void 0,previousFocusableElement:I,nextFocusableElement:w.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:w.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:d})}),Tt=o.createContext(void 0);function $s(){const e=o.useContext(Tt);if(e===void 0)throw new Error(ve(32));return e}const Us=o.forwardRef(function(s,r){const{keepMounted:n=!1,...p}=s,{store:i}=fe();return i.useState("mounted")||n?t.jsx(Tt.Provider,{value:n,children:t.jsx(nn,{ref:r,...p})}):null}),Bs=o.forwardRef(function(s,r){var ae;const{anchor:n,positionMethod:p="absolute",className:i,render:m,side:c,align:x,sideOffset:b=0,alignOffset:C=0,collisionBoundary:y="clipping-ancestors",collisionPadding:M=5,arrowPadding:D=5,sticky:f=!1,disableAnchorTracking:g=!1,collisionAvoidance:S=sn,...w}=s,{store:u}=fe(),N=$s(),B=Ee(!0),h=u.useState("parent"),a=u.useState("floatingRootContext"),I=u.useState("floatingTreeRoot"),F=u.useState("mounted"),A=u.useState("open"),O=u.useState("modal"),P=u.useState("activeTriggerElement"),d=u.useState("transitionStatus"),l=u.useState("lastOpenChangeReason"),j=u.useState("floatingNodeId"),K=u.useState("floatingParentNodeId");let de=n,T=b,z=C,Z=x,Y=S;h.type==="context-menu"&&(de=n??((ae=h.context)==null?void 0:ae.anchor),Z=Z??"start",!c&&Z!=="center"&&(z=s.alignOffset??2,T=s.sideOffset??-5));let G=c,Q=Z;h.type==="menu"?(G=G??"inline-end",Q=Q??"start",Y=s.collisionAvoidance??on):h.type==="menubar"&&(G=G??"bottom",Q=Q??"start");const _=h.type==="context-menu",k=an({anchor:de,floatingRootContext:a,positionMethod:B?"fixed":p,mounted:F,side:G,sideOffset:T,align:Q,alignOffset:z,arrowPadding:_?0:D,collisionBoundary:y,collisionPadding:M,sticky:f,nodeId:j,keepMounted:N,disableAnchorTracking:g,collisionAvoidance:Y,shiftCrossAxis:_&&!("side"in Y&&Y.side==="flip"),externalTree:I}),se=o.useMemo(()=>{const E={};return A||(E.pointerEvents="none"),{role:"presentation",hidden:!F,style:{...k.positionerStyles,...E}}},[A,F,k.positionerStyles]);o.useEffect(()=>{function E(H){H.open&&(H.parentNodeId===j&&u.set("hoverEnabled",!1),H.nodeId!==j&&H.parentNodeId===u.select("floatingParentNodeId")&&u.setOpen(!1,ue(je)))}return I.events.on("menuopenchange",E),()=>{I.events.off("menuopenchange",E)}},[u,I.events,j]),o.useEffect(()=>{if(u.select("floatingParentNodeId")==null)return;function E(H){if(H.open||H.nodeId!==u.select("floatingParentNodeId"))return;const ge=H.reason??je;u.setOpen(!1,ue(ge))}return I.events.on("menuopenchange",E),()=>{I.events.off("menuopenchange",E)}},[I.events,u]),o.useEffect(()=>{function E(H){!A||H.nodeId!==u.select("floatingParentNodeId")||H.target&&P&&P!==H.target&&u.setOpen(!1,ue(je))}return I.events.on("itemhover",E),()=>{I.events.off("itemhover",E)}},[I.events,A,P,u]),o.useEffect(()=>{const E={open:A,nodeId:j,parentNodeId:K,reason:u.select("lastOpenChangeReason")};I.events.emit("menuopenchange",E)},[I.events,A,u,j,K]);const xe={open:A,side:k.side,align:k.align,anchorHidden:k.anchorHidden,nested:h.type==="menu"},me=o.useMemo(()=>({side:k.side,align:k.align,arrowRef:k.arrowRef,arrowUncentered:k.arrowUncentered,arrowStyles:k.arrowStyles,nodeId:k.context.nodeId}),[k.side,k.align,k.arrowRef,k.arrowUncentered,k.arrowStyles,k.context.nodeId]),le=ye("div",s,{state:xe,stateAttributesMapping:mt,ref:[r,u.useStateSetter("positionerElement")],props:[se,gt(d),w]}),oe=F&&h.type!=="menu"&&(h.type!=="menubar"&&O&&l!==Me||h.type==="menubar"&&h.context.modal);let J=null;return h.type==="menubar"?J=h.context.contentElement:h.type===void 0&&(J=P),t.jsxs(Mt.Provider,{value:me,children:[oe&&t.jsx(rn,{ref:h.type==="context-menu"||h.type==="nested-context-menu"?h.context.internalBackdropRef:null,inert:cn(!A),cutout:J}),t.jsx(dn,{id:j,children:t.jsx(ns,{elementsRef:u.context.itemDomElements,labelsRef:u.context.itemLabels,children:le})})]})}),zs=o.createContext(null);function Et(e){return o.useContext(zs)}const _s={...pn,disabled:$(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:$(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:$(e=>e.allowMouseEnter),stickIfOpen:$(e=>e.stickIfOpen),parent:$(e=>e.parent),rootId:$(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:$(e=>e.activeIndex),isActive:$((e,s)=>e.activeIndex===s),hoverEnabled:$(e=>e.hoverEnabled),instantType:$(e=>e.instantType),lastOpenChangeReason:$(e=>e.openChangeReason),floatingTreeRoot:$(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:$(e=>e.floatingNodeId),floatingParentNodeId:$(e=>e.floatingParentNodeId),itemProps:$(e=>e.itemProps),closeDelay:$(e=>e.closeDelay),keyboardEventRelay:$(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Be extends ln{constructor(r){super({...qs(),...r},{positionerRef:o.createRef(),popupRef:o.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:o.createRef(),beforeContentFocusGuardRef:o.createRef(),onOpenChangeComplete:void 0,triggerElements:new un},_s);We(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",n=>{var p;if((p=this.unsubscribeParentListener)==null||p.call(this),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(r,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:r,eventDetails:n})}static useStore(r,n){const p=fn(()=>new Be(n)).current;return r??p}}function qs(){return{...mn(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ht,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Te,keyboardEventRelay:void 0,closeDelay:0}}const Gs=o.createContext(void 0);function Vs(){return o.useContext(Gs)}const Ys=gn(function(s){const{children:r,open:n,onOpenChange:p,onOpenChangeComplete:i,defaultOpen:m=!1,disabled:c=!1,modal:x,loopFocus:b=!0,orientation:C="vertical",actionsRef:y,closeParentOnEsc:M=!1,handle:D,triggerId:f,defaultTriggerId:g=null,highlightItemOnHover:S=!0}=s,w=Ee(!0),u=fe(!0),N=Et(!0),B=Vs(),h=o.useMemo(()=>B&&u?{type:"menu",store:u.store}:N?{type:"menubar",context:N}:w&&!u?{type:"context-menu",context:w}:{type:void 0},[w,u,N,B]),a=Be.useStore(D==null?void 0:D.store,{open:m,openProp:n,activeTriggerId:g,triggerIdProp:f,parent:h});hn(()=>{n===void 0&&a.state.open===!1&&m===!0&&a.update({open:!0,activeTriggerId:g})}),a.useControlledProp("openProp",n),a.useControlledProp("triggerIdProp",f),a.useContextCallback("onOpenChangeComplete",i);const I=a.useState("floatingTreeRoot"),F=xt(I),A=vt();He(()=>{w&&!u?a.update({parent:{type:"context-menu",context:w},floatingNodeId:F,floatingParentNodeId:A}):u&&a.update({floatingNodeId:F,floatingParentNodeId:A})},[w,u,F,A,a]);const O=a.useState("open"),P=a.useState("activeTriggerElement"),d=a.useState("positionerElement"),l=a.useState("hoverEnabled"),j=a.useState("modal"),K=a.useState("disabled"),de=a.useState("lastOpenChangeReason"),T=a.useState("parent"),z=a.useState("activeIndex"),Z=a.useState("payload"),Y=a.useState("floatingParentNodeId"),G=o.useRef(null),Q=Y!=null;let _;a.useSyncedValues({disabled:c,modal:T.type===void 0?x:void 0,rootId:xn()});const{openMethod:k,triggerProps:se,reset:xe}=vn(O);yn(a);const{forceUnmount:me}=bn(O,a,()=>{a.update({allowMouseEnter:!1,stickIfOpen:!0}),xe()}),le=o.useRef(T.type!=="context-menu"),oe=Pe();o.useEffect(()=>{if(O||(G.current=null),T.type==="context-menu"){if(!O){oe.clear(),le.current=!1;return}oe.start(500,()=>{le.current=!0})}},[oe,O,T.type]),Cn(O&&j&&de!==Me&&k!=="touch",d),He(()=>{!O&&!l&&a.set("hoverEnabled",!0)},[O,l,a]);const J=o.useRef(!0),ae=Pe(),E=we((v,R)=>{var Je;const q=R.reason;if(O===v&&R.trigger===P&&de===q||(R.preventUnmountOnClose=()=>{a.set("preventUnmountingOnClose",!0)},!v&&R.trigger==null&&(R.trigger=P??void 0),p==null||p(v,R),R.isCanceled))return;const Kt={open:v,nativeEvent:R.event,reason:R.reason,nested:Q};_==null||_.emit("openchange",Kt);const re=R.event;if(v===!1&&(re==null?void 0:re.type)==="click"&&re.pointerType==="touch"&&!J.current)return;if(!v&&z!==null){const Oe=a.context.itemDomElements.current[z];queueMicrotask(()=>{Oe==null||Oe.setAttribute("tabindex","-1")})}v&&q===Xe?(J.current=!1,ae.start(300,()=>{J.current=!0})):(J.current=!0,ae.clear());const Ye=(q===jn||q===lt)&&re.detail===0&&(re==null?void 0:re.isTrusted),$t=!v&&(q===wn||q==null),ke={open:v,openChangeReason:q};G.current=R.event??null;const Qe=((Je=R.trigger)==null?void 0:Je.id)??null;(Qe||v)&&(ke.activeTriggerId=Qe,ke.activeTriggerElement=R.trigger??null),a.update(ke),T.type==="menubar"&&(q===Xe||q===Le||q===Me||q===In||q===je)?a.set("instantType","group"):Ye||$t?a.set("instantType",Ye?"click":"dismiss"):a.set("instantType",void 0)}),H=o.useCallback(v=>{const R=ue(v);return R.preventUnmountOnClose=()=>{a.set("preventUnmountingOnClose",!0)},R},[a]),ge=o.useCallback(()=>{a.setOpen(!1,H(Rn))},[a,H]);o.useImperativeHandle(y,()=>({unmount:me,close:ge}),[me,ge]);let ee;T.type==="context-menu"&&(ee=T.context),o.useImperativeHandle(ee==null?void 0:ee.positionerRef,()=>d,[d]),o.useImperativeHandle(ee==null?void 0:ee.actionsRef,()=>({setOpen:E}),[E]);const te=Mn({popupStore:a,onOpenChange:E});_=te.context.events,o.useEffect(()=>{const v=({open:R,eventDetails:q})=>E(R,q);return _.on("setOpen",v),()=>{_==null||_.off("setOpen",v)}},[_,E]);const L=Pn(te,{enabled:!K,bubbles:{escapeKey:M&&T.type==="menu"},outsidePress(){var v;return T.type!=="context-menu"||((v=G.current)==null?void 0:v.type)==="contextmenu"?!0:le.current},externalTree:Q?I:void 0}),U=Sn(te,{role:"menu"}),ne=Tn(),V=o.useCallback(v=>{a.select("activeIndex")!==v&&a.set("activeIndex",v)},[a]),Ne=ss(te,{enabled:!K,listRef:a.context.itemDomElements,activeIndex:z,nested:T.type!==void 0,loopFocus:b,orientation:C,parentOrientation:T.type==="menubar"?T.context.orientation:void 0,rtl:ne==="rtl",disabledIndices:Ke,onNavigate:V,openOnArrowKeyDown:T.type!=="context-menu",externalTree:Q?I:void 0,focusItemOnHover:S}),kt=o.useCallback(v=>{a.context.typingRef.current=v},[a]),Ot=os(te,{listRef:a.context.itemLabels,activeIndex:z,resetMs:En,onMatch:v=>{O&&v!==z&&a.set("activeIndex",v)},onTypingChange:kt}),{getReferenceProps:ze,getFloatingProps:_e,getItemProps:qe,getTriggerProps:Ge}=yt([L,U,Ne,Ot]),Dt=o.useMemo(()=>{const v=Ae(ze(),{onMouseMove(){a.set("allowMouseEnter",!0)}},se);return delete v.role,v},[ze,a,se]),Ft=o.useMemo(()=>{const v=Ge();if(!v)return v;const R=Ae(v,se);return delete R.role,delete R["aria-controls"],R},[Ge,se]),At=o.useMemo(()=>_e({onMouseMove(){a.set("allowMouseEnter",!0),T.type==="menu"&&a.set("hoverEnabled",!1)},onClick(){a.select("hoverEnabled")&&a.set("hoverEnabled",!1)},onKeyDown(v){const R=a.select("keyboardEventRelay");R&&!v.isPropagationStopped()&&R(v)}}),[_e,T.type,a]),Ht=o.useMemo(()=>qe(),[qe]);a.useSyncedValues({floatingRootContext:te,activeTriggerProps:Dt,inactiveTriggerProps:Ft,popupProps:At,itemProps:Ht});const Lt=o.useMemo(()=>({store:a,parent:h}),[a,h]),Ve=t.jsx(St.Provider,{value:Lt,children:typeof r=="function"?r({payload:Z}):r});return T.type===void 0||T.type==="context-menu"?t.jsx(Nn,{externalTree:I,children:Ve}):Ve});function Qs(e={}){const{highlightItemOnHover:s,highlightedIndex:r,onHighlightedIndexChange:n}=bt(),{ref:p,index:i}=It(e),m=r===i,c=o.useRef(null),x=pt(p,c);return{compositeProps:o.useMemo(()=>({tabIndex:m?0:-1,onFocus(){n(i)},onMouseMove(){const C=c.current;if(!s||!C)return;const y=C.hasAttribute("disabled")||C.ariaDisabled==="true";!m&&!y&&C.focus()}}),[m,n,i,s]),compositeRef:x,index:i}}function Js(e){const{render:s,className:r,state:n=Te,props:p=Ke,refs:i=Ke,metadata:m,stateAttributesMapping:c,tag:x="div",...b}=e,{compositeProps:C,compositeRef:y}=Qs({metadata:m});return ye(x,e,{state:n,ref:[...i,y],props:[C,...p,b],stateAttributesMapping:c})}function Nt(e){if(kn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!On(e))return Nt(Dn(e))}function Ws(e){const{enabled:s=!0,mouseDownAction:r,open:n}=e,p=o.useRef(!1);return o.useMemo(()=>s?{onMouseDown:i=>{(r==="open"&&!n||r==="close"&&n)&&(p.current=!0,$e(i.currentTarget).addEventListener("click",()=>{p.current=!1},{once:!0}))},onClick:i=>{p.current&&(p.current=!1,i.preventBaseUIHandler())}}:Te,[s,r,n])}const Ce=2,Xs=Fn(function(s,r){const{render:n,className:p,disabled:i=!1,nativeButton:m=!0,id:c,openOnHover:x,delay:b=100,closeDelay:C=0,handle:y,payload:M,...D}=s,f=fe(!0),g=(y==null?void 0:y.store)??(f==null?void 0:f.store);if(!g)throw new Error(ve(85));const S=ft(c),w=g.useState("isTriggerActive",S),u=g.useState("floatingRootContext"),N=g.useState("isOpenedByTrigger",S),B=o.useRef(null),h=eo(),a=bt(!0),I=An(),F=o.useMemo(()=>I??new ht,[I]),A=xt(F),O=vt(),{registerTrigger:P,isMountedByThisTrigger:d}=Hn(S,B,g,{payload:M,closeDelay:C,parent:h,floatingTreeRoot:F,floatingNodeId:A,floatingParentNodeId:O,keyboardEventRelay:a==null?void 0:a.relayKeyboardEvent}),l=h.type==="menubar",j=g.useState("disabled"),K=i||j||l&&h.context.disabled,{getButtonProps:de,buttonRef:T}=ut({disabled:K,native:m});o.useEffect(()=>{!N&&h.type===void 0&&(g.context.allowMouseUpTriggerRef.current=!1)},[g,N,h.type]);const z=o.useRef(null),Z=Pe(),Y=we(L=>{if(!z.current)return;Z.clear(),g.context.allowMouseUpTriggerRef.current=!1;const U=L.target;if(De(z.current,U)||De(g.select("positionerElement"),U)||U===z.current||U!=null&&Nt(U)===g.select("rootId"))return;const ne=as(z.current);L.clientX>=ne.left-Ce&&L.clientX<=ne.right+Ce&&L.clientY>=ne.top-Ce&&L.clientY<=ne.bottom+Ce||F.events.emit("close",{domEvent:L,reason:Ln})});o.useEffect(()=>{N&&g.select("lastOpenChangeReason")===Me&&$e(z.current).addEventListener("mouseup",Y,{once:!0})},[N,Y,g]);const G=l&&h.context.hasSubmenuOpen,_=Kn(u,{enabled:(x??G)&&!K&&h.type!=="context-menu"&&(!l||G&&!d),handleClose:$n({blockPointerEvents:!l}),mouseOnly:!0,move:!1,restMs:h.type===void 0?b:void 0,delay:{close:C},triggerElementRef:B,externalTree:F,isActiveTrigger:w}),k=Zs(N,g.select("lastOpenChangeReason")),se=rs(u,{enabled:!K&&h.type!=="context-menu",event:N&&l?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:h.type===void 0?k:!1}),xe=Un(u,{enabled:!K&&G}),me=Ws({open:N,enabled:l,mouseDownAction:"open"}),le=yt([se,xe]),oe={disabled:K,open:N},J=g.useState("triggerProps",d),ae=[z,r,T,P,B],E=[le.getReferenceProps(),_??Te,J,{"aria-haspopup":"menu",id:S,onMouseDown:L=>{if(g.select("open"))return;Z.start(200,()=>{g.context.allowMouseUpTriggerRef.current=!0}),$e(L.currentTarget).addEventListener("mouseup",Y,{once:!0})}},l?{role:"menuitem"}:{},me,D,de],H=o.useRef(null),ge=we(L=>{Ze.flushSync(()=>{g.setOpen(!1,ue(Le,L.nativeEvent,L.currentTarget))});const U=Bn(H.current);U==null||U.focus()}),ee=we(L=>{var ne;const U=g.select("positionerElement");if(U&&zn(L,U))(ne=g.context.beforeContentFocusGuardRef.current)==null||ne.focus();else{Ze.flushSync(()=>{g.setOpen(!1,ue(Le,L.nativeEvent,L.currentTarget))});let V=_n(g.context.triggerFocusTargetRef.current||B.current);for(;V!==null&&De(U,V);){const Ne=V;if(V=qn(V),V===Ne)break}V==null||V.focus()}}),te=ye("button",s,{enabled:!l,stateAttributesMapping:et,state:oe,ref:ae,props:E});return l?t.jsx(Js,{tag:"button",render:n,className:p,state:oe,refs:ae,props:E,stateAttributesMapping:et}):N?t.jsxs(o.Fragment,{children:[t.jsx(tt,{ref:H,onFocus:ge},`${S}-pre-focus-guard`),t.jsx(o.Fragment,{children:te},S),t.jsx(tt,{ref:g.context.triggerFocusTargetRef,onFocus:ee},`${S}-post-focus-guard`)]}):t.jsx(o.Fragment,{children:te},S)});function Zs(e,s){const r=Pe(),[n,p]=o.useState(!1);return He(()=>{e&&s==="trigger-hover"?(p(!0),r.start(Gn,()=>{p(!1)})):e||(r.clear(),p(!1))},[e,s,r]),n}function eo(){const e=Ee(!0),s=fe(!0),r=Et();return o.useMemo(()=>r?{type:"menubar",context:r}:e&&!s?{type:"context-menu",context:e}:{type:void 0},[e,s,r])}function to({...e}){return t.jsx(Ys,{"data-slot":"dropdown-menu",...e})}function no({...e}){return t.jsx(Xs,{"data-slot":"dropdown-menu-trigger",...e})}function so({align:e="start",alignOffset:s=0,side:r="bottom",sideOffset:n=4,className:p,...i}){return t.jsx(Us,{children:t.jsx(Bs,{className:"isolate z-50 outline-none",align:e,alignOffset:s,side:r,sideOffset:n,children:t.jsx(Ks,{"data-slot":"dropdown-menu-content",className:X("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",p),...i})})})}function Fe({className:e,inset:s,variant:r="default",...n}){return t.jsx(Hs,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:X("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n})}function oo({className:e,...s}){return t.jsx(Vn,{"data-slot":"dropdown-menu-separator",className:X("bg-border -mx-1 my-1 h-px",e),...s})}function ao({className:e,...s}){return t.jsx("textarea",{"data-slot":"textarea",className:X("border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-2 aria-invalid:ring-2 md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...s})}function W(e){const s=e.trim();return s||void 0}function ro(e){return e?{name:e.name,type:e.type,host:e.host??"",port:e.port??22,username:e.username??"",sshConfigRef:e.sshConfigRef??"",session:e.session??"tmex",authMode:e.type==="local"?"auto":e.authMode,password:"",privateKey:"",privateKeyPassphrase:""}:{name:"",type:"local",host:"",port:22,username:"",sshConfigRef:"",session:"tmex",authMode:"auto",password:"",privateKey:"",privateKeyPassphrase:""}}function io(e){if(e.type==="local")return{name:e.name.trim(),type:"local",session:W(e.session)??"tmex",authMode:"auto"};const s={name:e.name.trim(),type:"ssh",host:W(e.host),port:e.port,username:W(e.username),sshConfigRef:W(e.sshConfigRef),session:W(e.session)??"tmex",authMode:e.authMode};return e.authMode==="password"&&(s.password=e.password),e.authMode==="key"&&(s.privateKey=e.privateKey,s.privateKeyPassphrase=e.privateKeyPassphrase||void 0),s}function co(e){if(e.type==="local")return{name:e.name.trim(),session:W(e.session)??"tmex",authMode:"auto"};const s={name:e.name.trim(),host:W(e.host),port:e.port,username:W(e.username),sshConfigRef:W(e.sshConfigRef),session:W(e.session)??"tmex",authMode:e.authMode};return e.authMode==="password"&&e.password&&(s.password=e.password),e.authMode==="key"&&e.privateKey&&(s.privateKey=e.privateKey,s.privateKeyPassphrase=e.privateKeyPassphrase||void 0),s}async function it(e,s){try{return(await e.json()).error??s}catch{return s}}function go(){const{t:e}=be(),[s,r]=o.useState(!1),[n,p]=o.useState(null),[i,m]=o.useState(null),c=Ct();o.useEffect(()=>{const f=()=>r(!0);return window.addEventListener("tmex:open-add-device",f),()=>window.removeEventListener("tmex:open-add-device",f)},[]);const{data:x,isLoading:b,isError:C}=Yn({queryKey:["devices"],queryFn:async()=>{const f=await fetch("/api/devices");if(!f.ok)throw new Error(e("device.loadFailed"));return f.json()},throwOnError:!1}),y=Qn(f=>f.hydrateDeviceErrors);o.useEffect(()=>{x!=null&&x.devices&&y(x.devices.map(f=>({deviceId:f.id,lastError:f.lastError??null,lastErrorType:f.lastErrorType??null})))},[x,y]);const M=Se({mutationFn:async f=>{if(!(await fetch(`/api/devices/${f}`,{method:"DELETE"})).ok)throw new Error(e("device.deleteFailed"))},onSuccess:()=>{c.invalidateQueries({queryKey:["devices"]}),ce.success(e("common.success"))},onError:f=>{ce.error(f instanceof Error?f.message:e("common.error"))}}),D=(x==null?void 0:x.devices)??[];return t.jsxs("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-3 p-3 pb-[calc(1rem+env(safe-area-inset-bottom))] sm:gap-4 sm:p-5","data-testid":"devices-page",children:[b?t.jsx(Ie,{children:t.jsx(Re,{className:"py-16 text-center text-sm text-muted-foreground",children:e("common.loading")})}):C?t.jsx(Ie,{children:t.jsx(Re,{className:"py-16 text-center text-sm text-destructive",children:e("device.loadFailed")})}):D.length===0?t.jsx(Ie,{children:t.jsxs(Re,{className:"space-y-4 py-14 text-center",children:[t.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl border border-border bg-muted",children:t.jsx(jt,{className:"h-6 w-6 text-muted-foreground"})}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h2",{className:"text-lg font-medium",children:e("device.noDevices")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e("device.addDevice")})]}),t.jsxs(pe,{variant:"default","data-testid":"devices-add-empty",onClick:()=>r(!0),children:[t.jsx(wt,{className:"h-4 w-4"}),e("device.addDevice")]})]})}):t.jsx("div",{className:"grid gap-3 lg:grid-cols-2",children:D.map(f=>t.jsx(lo,{device:f,onEdit:()=>p(f),onDelete:()=>m(f)},f.id))}),s&&t.jsx(ct,{mode:"create",onClose:()=>r(!1)}),n&&t.jsx(ct,{mode:"edit",device:n,onClose:()=>p(null)}),t.jsx(ls,{open:i!==null,onOpenChange:f=>!f&&m(null),children:t.jsxs(us,{children:[t.jsxs(ps,{children:[t.jsx(fs,{className:"bg-destructive/10",children:t.jsx(Rt,{className:"h-5 w-5 text-destructive"})}),t.jsx(ms,{children:e("device.deleteConfirm")}),t.jsx(gs,{children:e("device.deleteDescription",{name:(i==null?void 0:i.name)??""})})]}),t.jsxs(hs,{children:[t.jsx(xs,{children:e("common.cancel")}),t.jsx(vs,{variant:"destructive",disabled:!i||M.isPending,onClick:()=>{i&&(M.mutate(i.id),m(null))},children:e("common.delete")})]})]})})]})}function lo({device:e,onEdit:s,onDelete:r}){const{t:n}=be(),p=e.type==="local"?t.jsx(jt,{className:"h-4 w-4"}):t.jsx(Jn,{className:"h-4 w-4"}),i=e.type==="local"?n("device.typeLocal"):`${e.username??"-"}@${e.host??"-"}:${e.port??22}`,m=Se({mutationFn:async()=>{const c=await fetch(`/api/devices/${e.id}/test-connection`,{method:"POST"});let x=null;try{x=await c.json()}catch{x=null}if(!c.ok){const b=x;throw new Error((b==null?void 0:b.error)??n("common.error"))}return x},onSuccess:c=>{ce.success(c.message??n("common.success"))},onError:c=>{ce.error(c instanceof Error?c.message:n("common.error"))}});return t.jsxs(Ie,{"data-testid":"device-card","data-device-id":e.id,"data-device-name":e.name,className:"overflow-hidden",children:[t.jsxs(is,{className:"space-y-2 pb-2",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[t.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground",children:p}),t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx(cs,{className:"line-clamp-1 text-sm",title:e.name,children:e.name}),t.jsx(ds,{className:"line-clamp-1 text-xs",children:i})]})]}),t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t.jsxs(to,{children:[t.jsx(no,{render:t.jsx(pe,{variant:"ghost",size:"icon-sm","data-testid":`device-card-actions-${e.id}`,"aria-label":n("common.edit"),title:n("common.edit")}),children:t.jsx(bs,{className:"h-4 w-4"})}),t.jsxs(so,{align:"end",children:[t.jsxs(Fe,{"data-testid":`device-card-edit-${e.id}`,onClick:s,children:[t.jsx(js,{className:"h-4 w-4"}),n("common.edit")]}),e.type==="ssh"&&t.jsxs(Fe,{"data-testid":`device-card-test-${e.id}`,onClick:()=>m.mutate(),disabled:m.isPending,children:[t.jsx(Is,{className:"h-4 w-4"}),n("common.test")]}),t.jsx(oo,{}),t.jsxs(Fe,{"data-testid":`device-card-delete-${e.id}`,variant:"destructive",onClick:r,children:[t.jsx(Rt,{className:"h-4 w-4"}),n("common.delete")]})]})]})})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(nt,{variant:"outline",className:"text-[11px] font-normal",children:e.type==="local"?n("device.typeLocal"):n("device.typeSSHBadge")}),e.session&&t.jsx(nt,{variant:"outline",className:"text-[11px] font-normal",children:e.session}),t.jsx(Wn,{deviceId:e.id})]})]}),t.jsxs(Re,{className:"pt-0",children:[t.jsx(Xn,{className:"mb-2"}),t.jsx("div",{className:"flex items-center justify-end",children:t.jsx(Zn,{to:`/devices/${e.id}`,"data-testid":`device-card-connect-${e.id}`,className:es({variant:"default",size:"sm"}),children:n("device.connect")})})]})]})}function ct({mode:e,device:s,onClose:r}){const{t:n}=be(),p=Ct(),[i,m]=o.useState(ro(s)),[c,x]=o.useState(!1),b=e==="edit",C=i.type==="ssh",y=Se({mutationFn:async d=>{const l=await fetch("/api/devices",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!l.ok)throw new Error(await it(l,n("device.createFailed")));return l.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["devices"]}),ce.success(n("common.success")),r()},onError:d=>{ce.error(d instanceof Error?d.message:n("common.error"))}}),M=Se({mutationFn:async d=>{if(!s)throw new Error(n("apiError.deviceNotFound"));const l=await fetch(`/api/devices/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!l.ok)throw new Error(await it(l,n("device.updateFailed")));return l.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["devices"]}),ce.success(n("common.success")),r()},onError:d=>{ce.error(d instanceof Error?d.message:n("common.error"))}}),D=async d=>{d.preventDefault(),x(!0);try{e==="create"?await y.mutateAsync(io(i)):await M.mutateAsync(co(i))}catch{}finally{x(!1)}},f=`${e}-device-name`,g=`${e}-device-type`,S=`${e}-device-host`,w=`${e}-device-port`,u=`${e}-device-username`,N=`${e}-device-session`,B=`${e}-device-auth-mode`,h=`${e}-device-password`,a=`${e}-device-private-key`,I=`${e}-device-private-key-passphrase`,F={local:n("device.typeLocal"),ssh:n("device.typeSSH")},A={password:n("device.authPassword"),key:n("device.authKey"),agent:n("device.authAgent"),configRef:"SSH Config"},O=d=>t.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d}),P=(d,l,j)=>t.jsxs("label",{className:"block text-xs font-medium text-foreground",htmlFor:d,children:[l,j&&t.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]});return t.jsx(Rs,{open:!0,onOpenChange:d=>!d&&r(),children:t.jsxs(Ss,{"data-testid":"device-dialog",className:"w-full max-w-2xl",children:[t.jsxs(Ts,{children:[t.jsx(Ns,{children:n(b?"device.editDevice":"device.addDevice")}),t.jsx(ks,{children:n(b?"device.editDeviceDescription":"device.addDeviceDescription")})]}),t.jsxs("form",{onSubmit:D,className:"space-y-4",children:[t.jsxs("div",{className:"-mr-2 max-h-[min(70vh,720px)] space-y-5 overflow-y-auto pr-2",children:[t.jsxs("section",{className:"space-y-2.5",children:[O(n("device.sectionBasic")),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[P(f,n("device.name"),!0),t.jsx(ie,{id:f,"data-testid":"device-name-input",type:"text",value:i.name,onChange:d=>m(l=>({...l,name:d.target.value})),placeholder:n("device.namePlaceholder"),required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[P(g,n("device.type")),t.jsxs(st,{value:i.type,onValueChange:d=>{if(!d)return;const l=d;m(j=>({...j,type:l,authMode:l==="local"?"auto":j.authMode==="auto"?"password":j.authMode}))},disabled:b,children:[t.jsx(ot,{id:g,"data-testid":"device-type-select",className:"w-full",children:t.jsx(at,{placeholder:n("device.type"),children:d=>F[d]??""})}),t.jsxs(rt,{children:[t.jsx(he,{value:"local",children:n("device.typeLocal")}),t.jsx(he,{value:"ssh",children:n("device.typeSSH")})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[P(N,n("device.session")),t.jsx(ie,{id:N,"data-testid":"device-session-input",type:"text",value:i.session,onChange:d=>m(l=>({...l,session:d.target.value})),placeholder:n("device.sessionPlaceholder")})]})]})]}),C&&t.jsxs(t.Fragment,{children:[t.jsxs("section",{className:"space-y-2.5",children:[O(n("device.sectionConnection")),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[t.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[P(S,n("device.host")),t.jsx(ie,{id:S,type:"text",value:i.host,onChange:d=>m(l=>({...l,host:d.target.value})),placeholder:n("device.hostPlaceholder")})]}),t.jsxs("div",{className:"space-y-1.5",children:[P(w,n("device.port")),t.jsx(ie,{id:w,type:"number",value:i.port,onChange:d=>m(l=>({...l,port:Number.parseInt(d.target.value||"22",10)})),min:1,max:65535})]}),t.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[P(u,n("device.username")),t.jsx(ie,{id:u,type:"text",value:i.username,onChange:d=>m(l=>({...l,username:d.target.value})),placeholder:n("device.usernamePlaceholder")})]}),t.jsxs("div",{className:"space-y-1.5",children:[P(`${e}-device-ssh-config-ref`,"SSH Config"),t.jsx(ie,{id:`${e}-device-ssh-config-ref`,type:"text",value:i.sshConfigRef,onChange:d=>m(l=>({...l,sshConfigRef:d.target.value})),placeholder:"~/.ssh/config"})]})]})]}),t.jsxs("section",{className:"space-y-2.5",children:[O(n("device.sectionAuth")),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[P(B,n("device.authMode")),t.jsxs(st,{value:i.authMode,onValueChange:d=>{d&&m(l=>({...l,authMode:d}))},children:[t.jsx(ot,{id:B,className:"w-full",children:t.jsx(at,{placeholder:n("device.authMode"),children:d=>A[d]??""})}),t.jsxs(rt,{children:[t.jsx(he,{value:"password",children:n("device.authPassword")}),t.jsx(he,{value:"key",children:n("device.authKey")}),t.jsx(he,{value:"agent",children:n("device.authAgent")}),t.jsx(he,{value:"configRef",children:"SSH Config"})]})]})]}),i.authMode==="password"&&t.jsxs("div",{className:"space-y-1.5",children:[P(h,n("device.password")),t.jsx(ie,{id:h,type:"password",value:i.password,onChange:d=>m(l=>({...l,password:d.target.value}))})]}),i.authMode==="key"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[P(a,n("device.privateKey")),t.jsx(ao,{id:a,value:i.privateKey,onChange:d=>m(l=>({...l,privateKey:d.target.value})),className:"h-28 font-mono text-xs",placeholder:n("device.privateKeyPlaceholder")})]}),t.jsxs("div",{className:"space-y-1.5",children:[P(I,n("device.passphrase")),t.jsx(ie,{id:I,type:"password",value:i.privateKeyPassphrase,onChange:d=>m(l=>({...l,privateKeyPassphrase:d.target.value}))})]})]})]})]})]})]}),t.jsxs(Es,{children:[t.jsx(pe,{type:"button",variant:"outline",onClick:r,children:n("common.cancel")}),t.jsx(pe,{type:"submit",variant:"default","data-testid":"device-dialog-save",disabled:c,children:n(c?"common.saving":"common.save")})]})]})]})})}function ho(){const{t:e}=be();return t.jsx(t.Fragment,{children:e("sidebar.manageDevices")})}function xo(){const{t:e}=be(),s=()=>{window.dispatchEvent(new CustomEvent("tmex:open-add-device"))};return t.jsx(pe,{variant:"ghost",size:"icon-sm","data-testid":"devices-add",onClick:s,"aria-label":e("sidebar.addDevice"),title:e("sidebar.addDevice"),children:t.jsx(wt,{className:"h-4 w-4"})})}export{xo as PageActions,ho as PageTitle,go as default};
|
|
17
|
-
//# sourceMappingURL=DevicesPage-
|
|
17
|
+
//# sourceMappingURL=DevicesPage-dj7Pel6f.js.map
|