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