tmex-cli 0.4.5 → 0.5.1
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 +340 -36
- package/package.json +1 -1
- package/resources/fe-dist/assets/DevicePage-CQuQ0yeD.js +36 -0
- package/resources/fe-dist/assets/DevicePage-CQuQ0yeD.js.map +1 -0
- package/resources/fe-dist/assets/{DevicesPage-dj7Pel6f.js → DevicesPage-_g8yXgKX.js} +2 -2
- package/resources/fe-dist/assets/{DevicesPage-dj7Pel6f.js.map → DevicesPage-_g8yXgKX.js.map} +1 -1
- package/resources/fe-dist/assets/{SettingsPage-DwpbDA_e.js → SettingsPage-Bi8Kez5a.js} +2 -2
- package/resources/fe-dist/assets/{SettingsPage-DwpbDA_e.js.map → SettingsPage-Bi8Kez5a.js.map} +1 -1
- package/resources/fe-dist/assets/{index-61hq_aNX.js → index-kXpemMRY.js} +8 -8
- package/resources/fe-dist/assets/index-kXpemMRY.js.map +1 -0
- package/resources/fe-dist/assets/index-otkzncJS.css +1 -0
- package/resources/fe-dist/assets/{select-DI4HQZd4.js → select-v4N0NzCz.js} +2 -2
- package/resources/fe-dist/assets/{select-DI4HQZd4.js.map → select-v4N0NzCz.js.map} +1 -1
- package/resources/fe-dist/assets/{switch-DsfDIUrU.js → switch-BJu9baQM.js} +2 -2
- package/resources/fe-dist/assets/{switch-DsfDIUrU.js.map → switch-BJu9baQM.js.map} +1 -1
- package/resources/fe-dist/assets/{useValueChanged-AVaPYvln.js → useValueChanged-D47LrxaP.js} +2 -2
- package/resources/fe-dist/assets/{useValueChanged-AVaPYvln.js.map → useValueChanged-D47LrxaP.js.map} +1 -1
- package/resources/fe-dist/index.html +2 -2
- package/resources/fe-dist/assets/DevicePage-Di11uzbS.js +0 -26
- package/resources/fe-dist/assets/DevicePage-Di11uzbS.js.map +0 -1
- package/resources/fe-dist/assets/index-40zyi_9K.css +0 -1
- package/resources/fe-dist/assets/index-61hq_aNX.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsPage-Bi8Kez5a.js","assets/select-v4N0NzCz.js","assets/useValueChanged-D47LrxaP.js","assets/switch-BJu9baQM.js","assets/DevicesPage-_g8yXgKX.js","assets/DevicePage-CQuQ0yeD.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var LT=Object.defineProperty;var $b=t=>{throw TypeError(t)};var zT=(t,n,a)=>n in t?LT(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var Le=(t,n,a)=>zT(t,typeof n!="symbol"?n+"":n,a),Qh=(t,n,a)=>n.has(t)||$b("Cannot "+a);var q=(t,n,a)=>(Qh(t,n,"read from private field"),a?a.call(t):n.get(t)),Ge=(t,n,a)=>n.has(t)?$b("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,a),Me=(t,n,a,i)=>(Qh(t,n,"write to private field"),i?i.call(t,a):n.set(t,a),a),Et=(t,n,a)=>(Qh(t,n,"access private method"),a);var Lu=(t,n,a,i)=>({set _(s){Me(t,n,s,a)},get _(){return q(t,n,i)}});function UT(t,n){for(var a=0;a<n.length;a++){const i=n[a];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in t)){const l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(t,s,l.get?l:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function a(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=a(s);fetch(s.href,l)}})();const HT="modulepreload",jT=function(t){return"/"+t},Zb={},Ep=function(n,a,i){let s=Promise.resolve();if(a&&a.length>0){let u=function(h){return Promise.all(h.map(y=>Promise.resolve(y).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=u(a.map(h=>{if(h=jT(h),h in Zb)return;Zb[h]=!0;const y=h.endsWith(".css"),p=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":HT,y||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((v,S)=>{b.addEventListener("load",v),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return s.then(u=>{for(const f of u||[])f.status==="rejected"&&l(f.reason);return n().catch(l)})};function Nw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Wh={exports:{}},Tl={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -67,22 +67,22 @@ Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}
|
|
|
67
67
|
*
|
|
68
68
|
* This source code is licensed under the MIT license found in the
|
|
69
69
|
* LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/var fS;function dA(){if(fS)return dm;fS=1;var t=uc();function n(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var a=typeof Object.is=="function"?Object.is:n,i=t.useState,s=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue;function f(p,b){var v=b(),S=i({inst:{value:v,getSnapshot:b}}),E=S[0].inst,R=S[1];return l(function(){E.value=v,E.getSnapshot=b,m(E)&&R({inst:E})},[p,v,b]),s(function(){return m(E)&&R({inst:E}),p(function(){m(E)&&R({inst:E})})},[p]),u(v),v}function m(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!a(p,v)}catch{return!0}}function h(p,b){return b()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return dm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,dm}var dS;function Ox(){return dS||(dS=1,fm.exports=dA()),fm.exports}var Fp=Ox();const hA=(t,n)=>bo(n)?n:eA(n)&&bo(n.defaultValue)?n.defaultValue:Array.isArray(t)?t[t.length-1]:t,mA={t:hA,ready:!1},pA=()=>()=>{},gc=(t,n={})=>{var K,re,I;const{i18n:a}=n,{i18n:i,defaultNS:s}=x.useContext(uA)||{},l=a||i||lA();l&&!l.reportNamespaces&&(l.reportNamespaces=new fA),l||Rx(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=x.useMemo(()=>{var A;return{...oA(),...(A=l==null?void 0:l.options)==null?void 0:A.react,...n}},[l,n]),{useSuspense:f,keyPrefix:m}=u,h=s||((K=l==null?void 0:l.options)==null?void 0:K.defaultNS),y=bo(h)?[h]:h||["translation"],p=x.useMemo(()=>y,y);(I=(re=l==null?void 0:l.reportNamespaces)==null?void 0:re.addUsedNamespaces)==null||I.call(re,p);const b=x.useRef(0),v=x.useCallback(A=>{if(!l)return pA;const{bindI18n:j,bindI18nStore:W}=u,X=()=>{b.current+=1,A()};return j&&l.on(j,X),W&&l.store.on(W,X),()=>{j&&j.split(" ").forEach(D=>l.off(D,X)),W&&W.split(" ").forEach(D=>l.store.off(D,X))}},[l,u]),S=x.useRef(),E=x.useCallback(()=>{if(!l)return mA;const A=!!(l.isInitialized||l.initializedStoreOnce)&&p.every(z=>JM(z,l,u)),j=n.lng||l.language,W=b.current,X=S.current;if(X&&X.ready===A&&X.lng===j&&X.keyPrefix===m&&X.revision===W)return X;const F={t:l.getFixedT(j,u.nsMode==="fallback"?p:p[0],m),ready:A,lng:j,keyPrefix:m,revision:W};return S.current=F,F},[l,p,m,u,n.lng]),[R,T]=x.useState(0),{t:N,ready:_}=Fp.useSyncExternalStore(v,E,E);x.useEffect(()=>{if(l&&!_&&!f){const A=()=>T(j=>j+1);n.lng?uS(l,n.lng,p,A):tp(l,p,A)}},[l,n.lng,p,_,f,R]);const M=l||{},P=x.useRef(null),H=x.useRef(),O=A=>{const j=Object.getOwnPropertyDescriptors(A);j.__original&&delete j.__original;const W=Object.create(Object.getPrototypeOf(A),j);if(!Object.prototype.hasOwnProperty.call(W,"__original"))try{Object.defineProperty(W,"__original",{value:A,writable:!1,enumerable:!1,configurable:!1})}catch{}return W},L=x.useMemo(()=>{const A=M,j=A==null?void 0:A.language;let W=A;A&&(P.current&&P.current.__original===A?H.current!==j?(W=O(A),P.current=W,H.current=j):W=P.current:(W=O(A),P.current=W,H.current=j));const X=[N,W,_];return X.t=N,X.i18n=W,X.ready=_,X},[N,M,_,M.resolvedLanguage,M.language,M.languages]);if(l&&f&&!_)throw new Promise(A=>{const j=()=>A();n.lng?uS(l,n.lng,p,j):tp(l,p,j)});return L},gA={en_US:{translation:{common:{loading:"Loading...",save:"Save",saving:"Saving...",cancel:"Cancel",add:"Add",delete:"Delete",edit:"Edit",confirm:"Confirm",close:"Close",expand:"Expand",collapse:"Collapse",refresh:"Refresh",test:"Test",send:"Send",success:"Success",error:"Error",warning:"Warning",info:"Info",yes:"Yes",no:"No",enabled:"Enabled",disabled:"Disabled",pending:"Pending",authorized:"Authorized",unknown:"Unknown",empty:"Empty",none:"None",default:"Default",optional:"Optional",required:"Required",pwaInstallTitle:"Install as app",pwaInstallHintIOSSafari:'iOS Safari does not show an automatic install prompt. Tap Share, then "Add to Home Screen".',pwaInstallHintIOSChrome:'iOS Chrome does not show an automatic install prompt. Tap Share, then "Add to Home Screen".'},nav:{manageDevices:"Manage Devices",settings:"Settings",sidebarExpand:"Expand Sidebar",sidebarCollapse:"Collapse Sidebar",openSidebar:"Open Sidebar",closeSidebar:"Close Sidebar",jumpToLatest:"Jump to Latest",switchToEditor:"Switch to Editor Input",switchToDirect:"Switch to Direct Input",refreshPage:"Refresh Page",refreshPageConfirm:"Are you sure you want to refresh the page? Unsaved content will be lost."},device:{title:"Device Management",devices:"Devices",addDevice:"Add Device",addDeviceDescription:"Fill in device details and choose a connection method",addFirstDevice:"Add First Device",editDevice:"Edit Device",editDeviceDescription:"Update device configuration",sectionBasic:"Basic Info",sectionConnection:"Connection",sectionAuth:"Authentication",noDevices:"No Devices",noDevicesDescription:"Add a local or SSH device to get started",name:"Device Name",namePlaceholder:"e.g., My Server",type:"Type",typeLocal:"Local Device",typeSSH:"SSH Remote Device",typeSSHBadge:"SSH",host:"Host",hostPlaceholder:"example.com",port:"Port",username:"Username",usernamePlaceholder:"root",session:"Tmux Session Name",sessionPlaceholder:"tmex",sessionHint:'Leave empty to use default "tmex"',authMode:"Authentication Mode",authPassword:"Password",authKey:"Private Key",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"Password",privateKey:"Private Key",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"Private Key Passphrase (Optional)",passphrase:"Passphrase",connect:"Connect",connected:"Connected",disconnect:"Disconnect",disconnected:"Disconnected",connecting:"Connecting...",deleteConfirm:"Delete this device?",deleteDescription:'Device "{{name}}" will be permanently removed. This action cannot be undone.',deleteSuccess:"Device deleted",createSuccess:"Device created",updateSuccess:"Device updated",deleteFailed:"Failed to delete device",createFailed:"Failed to create device",updateFailed:"Failed to update device",loadFailed:"Failed to load devices",localDevice:"Local Device",subtitle:"{{username}}@{{host}}:{{port}}",modify:"Modify Device",delete:"Delete"},terminal:{initializing:"Initializing terminal...",connecting:"Connecting to device...",initFailed:"Terminal initialization failed",inputPlaceholder:"Type command here...",clear:"Clear",deviceError:"Device Error",deviceErrorWithType:"[{{type}}] Device Error",noDeviceSelected:"No device selected",windowClosed:"Current window has been closed, please select a window from the sidebar.",paneClosed:"Current pane has been closed, please select a pane from the sidebar.",bellNotification:"Terminal Bell Notification",bellDescription:"Window {{window}} · Pane {{pane}}",bellFallback:"Received tmux bell",paneTitle:"Pane {{index}}",activePane:"Current Pane",activeWindow:"Current Window",editorPlaceholder:"Enter commands here...",editorClear:"Clear",editorSendWithEnter:"Send with Enter",editorSendLineByLine:"Send Line by Line",editorSend:"Send",sendShortcut:"Send {{key}}",inputModeDirect:"Direct Input",inputModeEditor:"Editor",newWindow:"New Window",closeWindow:"Close Window",closePane:"Close Pane"},settings:{title:"System Settings",siteSettings:"Site Settings",siteName:"Site Name",siteNamePlaceholder:"tmex",siteUrl:"Site URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"Bell Throttle (seconds)",notificationThrottle:"Notification Throttle (seconds)",enableBrowserBellToast:"Enable Browser Bell Toast",enableBrowserNotificationToast:"Enable Browser Notification Toast",enableTelegramBellPush:"Enable Telegram Bell Push",enableTelegramNotificationPush:"Enable Telegram Notification Push",sshReconnectRetries:"SSH Reconnect Retries",sshReconnectDelay:"SSH Reconnect Delay (seconds)",language:"Language",languagePlaceholder:"Select language",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"Theme",themeLight:"Light",themeDark:"Dark",siteTab:"Site",notificationsTab:"Notifications",refreshToApply:"Refresh to apply language change",saveSettings:"Save Settings",settingsSaved:"Settings saved",saveFailed:"Failed to save settings",loadFailed:"Failed to load settings",restartGateway:"Restart Gateway",restartScheduled:"Gateway restart scheduled",restartConfirm:"Are you sure you want to restart Gateway? This will interrupt all active connections.",restartFailed:"Failed to restart gateway",sshReconnectMaxRetries:"SSH Reconnect Retries"},telegram:{title:"Telegram Bot Management",botName:"Bot Name",botNamePlaceholder:"e.g., ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"Add Bot",enableBot:"Enable Bot",allowAuthRequests:"Allow Authorization Requests",pendingChats:"Pending Authorization",chats:"Authorized Chats",authorizedChats:"Authorized",noPendingChats:"No pending chats",noAuthorizedChats:"No authorized chats",approve:"Approve",authorize:"Authorize",reject:"Reject",revokeAuth:"Revoke Authorization",testMessage:"Test Message",sendTestMessage:"Send Test Message",deleteBot:"Delete Bot",tokenOptional:"Token (leave empty to keep unchanged)",tokenPlaceholder:"Enter new token",botCreated:"Bot created",botUpdated:"Bot updated",botDeleted:"Bot deleted",authApproved:"Authorization approved",chatRemoved:"Chat removed",testMessageSent:"Test message sent",createFailed:"Failed to create bot",updateFailed:"Failed to update bot",deleteFailed:"Failed to delete bot",approveFailed:"Failed to approve authorization",removeFailed:"Failed to remove chat",testMessageFailed:"Failed to send test message",loadBotsFailed:"Failed to load bot list",loadChatsFailed:"Failed to load chat list",noBots:"No bots yet, add one first.",expand:"Expand",collapse:"Collapse",authCount:"{{authorized}} authorized / {{pending}} pending (max 8)",chatId:"Chat ID",applyTime:"Application Time",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}: Connection error on device "{{deviceName}}" ({{host}}) [{{category}}]
|
|
70
|
+
*/var fS;function dA(){if(fS)return dm;fS=1;var t=uc();function n(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var a=typeof Object.is=="function"?Object.is:n,i=t.useState,s=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue;function f(p,b){var v=b(),S=i({inst:{value:v,getSnapshot:b}}),E=S[0].inst,R=S[1];return l(function(){E.value=v,E.getSnapshot=b,m(E)&&R({inst:E})},[p,v,b]),s(function(){return m(E)&&R({inst:E}),p(function(){m(E)&&R({inst:E})})},[p]),u(v),v}function m(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!a(p,v)}catch{return!0}}function h(p,b){return b()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return dm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,dm}var dS;function Ox(){return dS||(dS=1,fm.exports=dA()),fm.exports}var Fp=Ox();const hA=(t,n)=>bo(n)?n:eA(n)&&bo(n.defaultValue)?n.defaultValue:Array.isArray(t)?t[t.length-1]:t,mA={t:hA,ready:!1},pA=()=>()=>{},gc=(t,n={})=>{var K,re,I;const{i18n:a}=n,{i18n:i,defaultNS:s}=x.useContext(uA)||{},l=a||i||lA();l&&!l.reportNamespaces&&(l.reportNamespaces=new fA),l||Rx(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=x.useMemo(()=>{var A;return{...oA(),...(A=l==null?void 0:l.options)==null?void 0:A.react,...n}},[l,n]),{useSuspense:f,keyPrefix:m}=u,h=s||((K=l==null?void 0:l.options)==null?void 0:K.defaultNS),y=bo(h)?[h]:h||["translation"],p=x.useMemo(()=>y,y);(I=(re=l==null?void 0:l.reportNamespaces)==null?void 0:re.addUsedNamespaces)==null||I.call(re,p);const b=x.useRef(0),v=x.useCallback(A=>{if(!l)return pA;const{bindI18n:j,bindI18nStore:W}=u,X=()=>{b.current+=1,A()};return j&&l.on(j,X),W&&l.store.on(W,X),()=>{j&&j.split(" ").forEach(D=>l.off(D,X)),W&&W.split(" ").forEach(D=>l.store.off(D,X))}},[l,u]),S=x.useRef(),E=x.useCallback(()=>{if(!l)return mA;const A=!!(l.isInitialized||l.initializedStoreOnce)&&p.every(z=>JM(z,l,u)),j=n.lng||l.language,W=b.current,X=S.current;if(X&&X.ready===A&&X.lng===j&&X.keyPrefix===m&&X.revision===W)return X;const F={t:l.getFixedT(j,u.nsMode==="fallback"?p:p[0],m),ready:A,lng:j,keyPrefix:m,revision:W};return S.current=F,F},[l,p,m,u,n.lng]),[R,T]=x.useState(0),{t:N,ready:_}=Fp.useSyncExternalStore(v,E,E);x.useEffect(()=>{if(l&&!_&&!f){const A=()=>T(j=>j+1);n.lng?uS(l,n.lng,p,A):tp(l,p,A)}},[l,n.lng,p,_,f,R]);const M=l||{},P=x.useRef(null),H=x.useRef(),O=A=>{const j=Object.getOwnPropertyDescriptors(A);j.__original&&delete j.__original;const W=Object.create(Object.getPrototypeOf(A),j);if(!Object.prototype.hasOwnProperty.call(W,"__original"))try{Object.defineProperty(W,"__original",{value:A,writable:!1,enumerable:!1,configurable:!1})}catch{}return W},L=x.useMemo(()=>{const A=M,j=A==null?void 0:A.language;let W=A;A&&(P.current&&P.current.__original===A?H.current!==j?(W=O(A),P.current=W,H.current=j):W=P.current:(W=O(A),P.current=W,H.current=j));const X=[N,W,_];return X.t=N,X.i18n=W,X.ready=_,X},[N,M,_,M.resolvedLanguage,M.language,M.languages]);if(l&&f&&!_)throw new Promise(A=>{const j=()=>A();n.lng?uS(l,n.lng,p,j):tp(l,p,j)});return L},gA={en_US:{translation:{common:{loading:"Loading...",save:"Save",saving:"Saving...",cancel:"Cancel",add:"Add",delete:"Delete",edit:"Edit",confirm:"Confirm",close:"Close",expand:"Expand",collapse:"Collapse",refresh:"Refresh",test:"Test",send:"Send",success:"Success",error:"Error",warning:"Warning",info:"Info",yes:"Yes",no:"No",enabled:"Enabled",disabled:"Disabled",pending:"Pending",authorized:"Authorized",unknown:"Unknown",empty:"Empty",none:"None",default:"Default",optional:"Optional",required:"Required",pwaInstallTitle:"Install as app",pwaInstallHintIOSSafari:'iOS Safari does not show an automatic install prompt. Tap Share, then "Add to Home Screen".',pwaInstallHintIOSChrome:'iOS Chrome does not show an automatic install prompt. Tap Share, then "Add to Home Screen".'},nav:{manageDevices:"Manage Devices",settings:"Settings",sidebarExpand:"Expand Sidebar",sidebarCollapse:"Collapse Sidebar",openSidebar:"Open Sidebar",closeSidebar:"Close Sidebar",jumpToLatest:"Jump to Latest",switchToEditor:"Switch to Editor Input",switchToDirect:"Switch to Direct Input",refreshPage:"Refresh Page",refreshPageConfirm:"Are you sure you want to refresh the page? Unsaved content will be lost."},device:{title:"Device Management",devices:"Devices",addDevice:"Add Device",addDeviceDescription:"Fill in device details and choose a connection method",addFirstDevice:"Add First Device",editDevice:"Edit Device",editDeviceDescription:"Update device configuration",sectionBasic:"Basic Info",sectionConnection:"Connection",sectionAuth:"Authentication",noDevices:"No Devices",noDevicesDescription:"Add a local or SSH device to get started",name:"Device Name",namePlaceholder:"e.g., My Server",type:"Type",typeLocal:"Local Device",typeSSH:"SSH Remote Device",typeSSHBadge:"SSH",host:"Host",hostPlaceholder:"example.com",port:"Port",username:"Username",usernamePlaceholder:"root",session:"Tmux Session Name",sessionPlaceholder:"tmex",sessionHint:'Leave empty to use default "tmex"',authMode:"Authentication Mode",authPassword:"Password",authKey:"Private Key",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"Password",privateKey:"Private Key",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"Private Key Passphrase (Optional)",passphrase:"Passphrase",connect:"Connect",connected:"Connected",disconnect:"Disconnect",disconnected:"Disconnected",connecting:"Connecting...",deleteConfirm:"Delete this device?",deleteDescription:'Device "{{name}}" will be permanently removed. This action cannot be undone.',deleteSuccess:"Device deleted",createSuccess:"Device created",updateSuccess:"Device updated",deleteFailed:"Failed to delete device",createFailed:"Failed to create device",updateFailed:"Failed to update device",loadFailed:"Failed to load devices",localDevice:"Local Device",subtitle:"{{username}}@{{host}}:{{port}}",modify:"Modify Device",delete:"Delete"},terminal:{initializing:"Initializing terminal...",connecting:"Connecting to device...",initFailed:"Terminal initialization failed",inputPlaceholder:"Type command here...",clear:"Clear",deviceError:"Device Error",deviceErrorWithType:"[{{type}}] Device Error",noDeviceSelected:"No device selected",windowClosed:"Current window has been closed, please select a window from the sidebar.",paneClosed:"Current pane has been closed, please select a pane from the sidebar.",bellNotification:"Terminal Bell Notification",bellDescription:"Window {{window}} · Pane {{pane}}",bellFallback:"Received tmux bell",paneTitle:"Pane {{index}}",activePane:"Current Pane",activeWindow:"Current Window",editorPlaceholder:"Enter commands here...",editorClear:"Clear",editorSendWithEnter:"Send with Enter",editorSendLineByLine:"Send Line by Line",editorSend:"Send",sendShortcut:"Send {{key}}",inputModeDirect:"Direct Input",inputModeEditor:"Editor",newWindow:"New Window",closeWindow:"Close Window",closePane:"Close Pane",copy:"Copy",paste:"Paste",copied:"Copied to clipboard",copyFailed:"Copy failed",pasteFailed:"Could not read clipboard, check browser permissions",clearSelection:"Dismiss selection"},settings:{title:"System Settings",siteSettings:"Site Settings",siteName:"Site Name",siteNamePlaceholder:"tmex",siteUrl:"Site URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"Bell Throttle (seconds)",notificationThrottle:"Notification Throttle (seconds)",enableBrowserBellToast:"Enable Browser Bell Toast",enableBrowserNotificationToast:"Enable Browser Notification Toast",enableTelegramBellPush:"Enable Telegram Bell Push",enableTelegramNotificationPush:"Enable Telegram Notification Push",sshReconnectRetries:"SSH Reconnect Retries",sshReconnectDelay:"SSH Reconnect Delay (seconds)",language:"Language",languagePlaceholder:"Select language",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"Theme",themeLight:"Light",themeDark:"Dark",siteTab:"Site",notificationsTab:"Notifications",refreshToApply:"Refresh to apply language change",saveSettings:"Save Settings",settingsSaved:"Settings saved",saveFailed:"Failed to save settings",loadFailed:"Failed to load settings",restartGateway:"Restart Gateway",restartScheduled:"Gateway restart scheduled",restartConfirm:"Are you sure you want to restart Gateway? This will interrupt all active connections.",restartFailed:"Failed to restart gateway",sshReconnectMaxRetries:"SSH Reconnect Retries"},telegram:{title:"Telegram Bot Management",botName:"Bot Name",botNamePlaceholder:"e.g., ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"Add Bot",enableBot:"Enable Bot",allowAuthRequests:"Allow Authorization Requests",pendingChats:"Pending Authorization",chats:"Authorized Chats",authorizedChats:"Authorized",noPendingChats:"No pending chats",noAuthorizedChats:"No authorized chats",approve:"Approve",authorize:"Authorize",reject:"Reject",revokeAuth:"Revoke Authorization",testMessage:"Test Message",sendTestMessage:"Send Test Message",deleteBot:"Delete Bot",tokenOptional:"Token (leave empty to keep unchanged)",tokenPlaceholder:"Enter new token",botCreated:"Bot created",botUpdated:"Bot updated",botDeleted:"Bot deleted",authApproved:"Authorization approved",chatRemoved:"Chat removed",testMessageSent:"Test message sent",createFailed:"Failed to create bot",updateFailed:"Failed to update bot",deleteFailed:"Failed to delete bot",approveFailed:"Failed to approve authorization",removeFailed:"Failed to remove chat",testMessageFailed:"Failed to send test message",loadBotsFailed:"Failed to load bot list",loadChatsFailed:"Failed to load chat list",noBots:"No bots yet, add one first.",expand:"Expand",collapse:"Collapse",authCount:"{{authorized}} authorized / {{pending}} pending (max 8)",chatId:"Chat ID",applyTime:"Application Time",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}: Connection error on device "{{deviceName}}" ({{host}}) [{{category}}]
|
|
71
71
|
{{error}}`,authSuccess:"✅ Authorized. You will now receive notifications.",authPending:"⏳ Authorization request received. Please approve in tmex settings.",authFailed:"❌ Authorization request failed. Please contact administrator.",testMessageTemplate:`🧪 Test Message
|
|
72
72
|
Site: {{siteName}}
|
|
73
73
|
Time: {{time}}`,approveMessageTemplate:`✅ Authorized via tmex.
|
|
74
74
|
Bot: {{botName}}
|
|
75
|
-
Time: {{time}}`,botNotFound:"Bot not found or unavailable",botNotRunning:"Bot is not running or unavailable"},webhook:{title:"Webhooks",url:"Webhook URL",secret:"Secret",secretPlaceholder:"Used to sign payloads (HMAC-SHA256)",enabled:"Enabled",eventMask:"Events",add:"Add Webhook",empty:"No webhooks yet.",createFailed:"Failed to create webhook",deleteFailed:"Failed to delete webhook",loadFailed:"Failed to load webhooks"},sshError:{sshConfigRefNotSupported:"SSH Config reference is not supported in this version. Please use host + username with Agent/Key/Password authentication.",configRefNotSupported:"SSH Config reference is not supported in this version. Please use host + username with Agent/Key/Password authentication.",agentUnavailable:"SSH Agent unavailable: SSH_AUTH_SOCK not detected. Please check agent environment.",agentNoIdentity:"SSH Agent has no available keys. Please run ssh-add first.",agentNoIdentities:"SSH Agent has no available keys. Please run ssh-add first.",authFailed:"Authentication failed: incorrect username, password, or key. Please check device configuration.",authFailedGeneric:"Authentication failed: incorrect username, password, or key. Please check device configuration.",networkUnreachable:"Network unreachable: Please check routing, firewall, or VPN configuration.",connectionRefused:"Connection refused: Unable to connect to target host. Please check host address and port.",timeout:"Connection timeout: Unable to connect to device. Please check network or firewall settings.",connectionTimeout:"Connection timeout: Unable to connect to device. Please check network or firewall settings.",hostNotFound:"Host not found: Unable to resolve hostname. Please check DNS or hostname configuration.",handshakeFailed:"Handshake failed: Unable to establish secure connection. Possibly incompatible key exchange algorithm.",tmuxUnavailable:"Remote tmux unavailable or failed to start. Please ensure tmux is installed and available in the remote shell PATH.",connectionClosed:"Connection closed, attempting to reconnect",unknown:"Connection failed: {{message}}",reconnecting:"Connection interrupted, reconnecting in {{delay}} seconds ({{attempt}}/{{maxRetries}})",reconnectFailed:"Auto-reconnect failed, please retry manually",reconnected:"Device reconnected automatically"},deviceStatus:{reconnecting:"Reconnecting {{delay}}s",offline:"Offline",errorBadge:{authFailed:"Auth failed",agentUnavailable:"Agent unavailable",agentNoIdentity:"Agent has no keys",configRefNotSupported:"SSH Config unsupported",networkUnreachable:"Network unreachable",connectionRefused:"Refused",timeout:"Timeout",hostNotFound:"Host not found",handshakeFailed:"Handshake failed",tmuxUnavailable:"Tmux unavailable",connectionClosed:"Disconnected",unknown:"Connection error"}},websocket:{error:"WebSocket connection error",checkGateway:"Please check Gateway status",upgradeFailed:"Upgrade failed",invalidMessage:"Invalid message format"},wsError:{checkGateway:"Please check Gateway status"},apiError:{siteNameRequired:"Site name cannot be empty",siteUrlInvalid:"Site URL must start with http:// or https://",bellThrottleInvalid:"Bell throttle seconds must be between 0-300",sshRetriesInvalid:"SSH reconnect retries must be between 0-20",sshDelayInvalid:"SSH reconnect delay must be between 1-300 seconds",languageInvalid:"Language must be one of the supported locales",botNameRequired:"Bot name cannot be empty",botTokenRequired:"Bot token cannot be empty",missingFields:"Missing required fields",sshRequiresHost:"SSH device requires host or sshConfigRef",invalidRequest:"Invalid request",deviceNotFound:"Device not found",botNotFound:"Bot not found",chatNotFound:"Chat not found",urlAndSecretRequired:"URL and secret are required",notFound:"Not found"},notification:{clickToJump:"Click to jump to corresponding pane",eventType:{terminal_bell:"🔔 Terminal Bell",terminal_notification:"🔔 Terminal Notification",tmux_window_close:"🪟 Window Closed",tmux_pane_close:"📱 Pane Closed",device_tmux_missing:"⚠️ Tmux Missing",device_disconnect:"🔌 Device Disconnected",session_created:"🆕 Session Created",session_closed:"🚪 Session Closed"},site:"Site",device:"Device",window:"Window",pane:"Pane",time:"Time",directLink:"Direct Link",message:"Message",telegramBell:{title:"🔔 Bell from {{siteName}}: {{terminalTopbarLabel}}",viewLink:"Click to view",terminalTopbarLabel:"Window {{window}} · Pane {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"No windows",noDevices:"No devices",addDeviceLink:"Add Device",openSettingsLink:"Open Settings",openSettings:"Open Settings",manageDevices:"Manage Devices",settings:"Settings",currentWindow:"Current Window",currentPane:"Current Pane",newWindow:"Create Window",closeWindow:"Close Window",closePane:"Close Pane",addDevice:"Add Device"},window:{noWindows:"No windows",new:"New Window"},validation:{deviceNameRequired:"Device name is required",hostRequired:"Host is required for SSH devices"}}},zh_CN:{translation:{common:{loading:"加载中...",save:"保存",saving:"保存中...",cancel:"取消",add:"添加",delete:"删除",edit:"修改",confirm:"确认",close:"关闭",expand:"展开",collapse:"收起",refresh:"刷新",test:"测试",send:"发送",success:"成功",error:"错误",warning:"警告",info:"信息",yes:"是",no:"否",enabled:"已启用",disabled:"已禁用",pending:"待授权",authorized:"已授权",unknown:"未知",empty:"空",none:"无",default:"默认",optional:"可选",required:"必填",pwaInstallTitle:"安装为应用",pwaInstallHintIOSSafari:"iOS Safari 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」。",pwaInstallHintIOSChrome:"iOS Chrome 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」"},nav:{manageDevices:"管理设备",settings:"设置",sidebarExpand:"展开侧边栏",sidebarCollapse:"收起侧边栏",openSidebar:"打开侧边栏",closeSidebar:"关闭侧边栏",jumpToLatest:"跳转到最新",switchToEditor:"切换到编辑器输入",switchToDirect:"切换到直接输入",refreshPage:"刷新页面",refreshPageConfirm:"确定要刷新页面吗?未保存的内容将会丢失。"},device:{title:"设备管理",devices:"设备",addDevice:"添加设备",addDeviceDescription:"填写设备信息并选择连接方式",addFirstDevice:"添加第一个设备",editDevice:"修改设备",editDeviceDescription:"更新设备配置",sectionBasic:"基本信息",sectionConnection:"连接信息",sectionAuth:"认证信息",noDevices:"暂无设备",noDevicesDescription:"添加本地或 SSH 设备开始使用",name:"设备名称",namePlaceholder:"例如:我的服务器",type:"类型",typeLocal:"本地设备",typeSSH:"SSH 远程设备",typeSSHBadge:"SSH",host:"主机",hostPlaceholder:"example.com",port:"端口",username:"用户名",usernamePlaceholder:"root",session:"Tmux 会话名称",sessionPlaceholder:"tmex",sessionHint:'留空将使用默认值 "tmex"',authMode:"认证方式",authPassword:"密码",authKey:"私钥",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"密码",privateKey:"私钥",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"私钥密码(可选)",passphrase:"私钥密码(可选)",connect:"连接",connected:"已连接",disconnect:"断开",disconnected:"已断开",connecting:"连接中...",deleteConfirm:"删除此设备?",deleteDescription:'设备 "{{name}}" 将被永久移除,此操作无法撤销。',deleteSuccess:"设备已删除",createSuccess:"设备已创建",updateSuccess:"设备已更新",deleteFailed:"删除设备失败",createFailed:"创建设备失败",updateFailed:"更新设备失败",loadFailed:"加载设备列表失败",localDevice:"本地设备",subtitle:"{{username}}@{{host}}:{{port}}",modify:"修改设备",delete:"删除"},terminal:{initializing:"初始化终端...",connecting:"连接设备...",initFailed:"终端初始化失败",inputPlaceholder:"在此输入命令...",clear:"清空",deviceError:"设备错误",deviceErrorWithType:"[{{type}}] 设备错误",noDeviceSelected:"未选择设备",windowClosed:"当前窗口已关闭,请在侧边栏重新选择窗口。",paneClosed:"当前 Pane 已关闭,请在侧边栏重新选择 Pane。",bellNotification:"终端 Bell 提醒",bellDescription:"窗口 {{window}} · Pane {{pane}}",bellFallback:"收到 tmux bell",paneTitle:"Pane {{index}}",activePane:"当前 pane",activeWindow:"当前窗口",editorPlaceholder:"在此输入命令...",editorClear:"清空",editorSendWithEnter:"发送附带回车",editorSendLineByLine:"逐行发送",editorSend:"发送",sendShortcut:"发送 {{key}}",inputModeDirect:"直接输入",inputModeEditor:"编辑器",newWindow:"新建窗口",closeWindow:"关闭窗口",closePane:"关闭 pane"},settings:{title:"系统设置",siteSettings:"站点设置",siteName:"站点名称",siteNamePlaceholder:"tmex",siteUrl:"站点访问 URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"Bell 频控(秒)",notificationThrottle:"通知频控(秒)",enableBrowserBellToast:"开启浏览器 Bell Toast",enableBrowserNotificationToast:"开启浏览器通知 Toast",enableTelegramBellPush:"开启 Telegram Bell 推送",enableTelegramNotificationPush:"开启 Telegram 通知推送",sshReconnectRetries:"SSH 重连次数",sshReconnectDelay:"SSH 重连等待(秒)",language:"语言",languagePlaceholder:"选择语言",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"主题",themeLight:"浅色",themeDark:"深色",siteTab:"站点",notificationsTab:"通知",refreshToApply:"刷新后生效",saveSettings:"保存设置",settingsSaved:"站点设置已保存",saveFailed:"保存设置失败",loadFailed:"加载设置失败",restartGateway:"重启 Gateway",restartScheduled:"Gateway 重启请求已发送",restartConfirm:"确定要重启 Gateway 吗?这将中断所有活动连接。",restartFailed:"重启请求失败",sshReconnectMaxRetries:"SSH 重连次数"},telegram:{title:"Telegram Bot 管理",botName:"Bot 名称",botNamePlaceholder:"如:ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"新增 Bot",enableBot:"启用 Bot",allowAuthRequests:"允许申请授权",pendingChats:"待授权",chats:"已授权",authorizedChats:"已授权",noPendingChats:"暂无待授权 chat",noAuthorizedChats:"暂无已授权 chat",approve:"批准",authorize:"授权",reject:"拒绝",revokeAuth:"撤销授权",testMessage:"测试消息",sendTestMessage:"发送测试消息",deleteBot:"删除 Bot",tokenOptional:"Token(留空不改)",tokenPlaceholder:"输入新 token",botCreated:"Bot 已创建",botUpdated:"Bot 已更新",botDeleted:"Bot 已删除",authApproved:"授权已批准",chatRemoved:"chat 已移除",testMessageSent:"测试消息已发送",createFailed:"新增 Bot 失败",updateFailed:"更新 Bot 失败",deleteFailed:"删除 Bot 失败",approveFailed:"批准授权失败",removeFailed:"删除 chat 失败",testMessageFailed:"发送测试消息失败",loadBotsFailed:"加载 Bot 列表失败",loadChatsFailed:"加载 chat 列表失败",noBots:"暂无 Bot,先添加一个。",expand:"展开",collapse:"收起",authCount:"已授权 {{authorized}} / 待授权 {{pending}}(总上限 8)",chatId:"chatId",applyTime:"申请时间",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}:设备「{{deviceName}}」({{host}}) 连接异常 [{{category}}]
|
|
75
|
+
Time: {{time}}`,botNotFound:"Bot not found or unavailable",botNotRunning:"Bot is not running or unavailable"},webhook:{title:"Webhooks",url:"Webhook URL",secret:"Secret",secretPlaceholder:"Used to sign payloads (HMAC-SHA256)",enabled:"Enabled",eventMask:"Events",add:"Add Webhook",empty:"No webhooks yet.",createFailed:"Failed to create webhook",deleteFailed:"Failed to delete webhook",loadFailed:"Failed to load webhooks"},sshError:{sshConfigRefNotSupported:"SSH Config reference is not supported in this version. Please use host + username with Agent/Key/Password authentication.",configRefNotSupported:"SSH Config reference is not supported in this version. Please use host + username with Agent/Key/Password authentication.",agentUnavailable:"SSH Agent unavailable: SSH_AUTH_SOCK not detected. Please check agent environment.",agentNoIdentity:"SSH Agent has no available keys. Please run ssh-add first.",agentNoIdentities:"SSH Agent has no available keys. Please run ssh-add first.",authFailed:"Authentication failed: incorrect username, password, or key. Please check device configuration.",authFailedGeneric:"Authentication failed: incorrect username, password, or key. Please check device configuration.",networkUnreachable:"Network unreachable: Please check routing, firewall, or VPN configuration.",connectionRefused:"Connection refused: Unable to connect to target host. Please check host address and port.",timeout:"Connection timeout: Unable to connect to device. Please check network or firewall settings.",connectionTimeout:"Connection timeout: Unable to connect to device. Please check network or firewall settings.",hostNotFound:"Host not found: Unable to resolve hostname. Please check DNS or hostname configuration.",handshakeFailed:"Handshake failed: Unable to establish secure connection. Possibly incompatible key exchange algorithm.",tmuxUnavailable:"Remote tmux unavailable or failed to start. Please ensure tmux is installed and available in the remote shell PATH.",connectionClosed:"Connection closed, attempting to reconnect",unknown:"Connection failed: {{message}}",reconnecting:"Connection interrupted, reconnecting in {{delay}} seconds ({{attempt}}/{{maxRetries}})",reconnectFailed:"Auto-reconnect failed, please retry manually",reconnected:"Device reconnected automatically"},deviceStatus:{reconnecting:"Reconnecting {{delay}}s",offline:"Offline",errorBadge:{authFailed:"Auth failed",agentUnavailable:"Agent unavailable",agentNoIdentity:"Agent has no keys",configRefNotSupported:"SSH Config unsupported",networkUnreachable:"Network unreachable",connectionRefused:"Refused",timeout:"Timeout",hostNotFound:"Host not found",handshakeFailed:"Handshake failed",tmuxUnavailable:"Tmux unavailable",connectionClosed:"Disconnected",unknown:"Connection error"}},websocket:{error:"WebSocket connection error",checkGateway:"Please check Gateway status",upgradeFailed:"Upgrade failed",invalidMessage:"Invalid message format"},wsError:{checkGateway:"Please check Gateway status"},apiError:{siteNameRequired:"Site name cannot be empty",siteUrlInvalid:"Site URL must start with http:// or https://",bellThrottleInvalid:"Bell throttle seconds must be between 0-300",sshRetriesInvalid:"SSH reconnect retries must be between 0-20",sshDelayInvalid:"SSH reconnect delay must be between 1-300 seconds",languageInvalid:"Language must be one of the supported locales",botNameRequired:"Bot name cannot be empty",botTokenRequired:"Bot token cannot be empty",missingFields:"Missing required fields",sshRequiresHost:"SSH device requires host or sshConfigRef",invalidRequest:"Invalid request",deviceNotFound:"Device not found",botNotFound:"Bot not found",chatNotFound:"Chat not found",urlAndSecretRequired:"URL and secret are required",notFound:"Not found"},notification:{clickToJump:"Click to jump to corresponding pane",eventType:{terminal_bell:"🔔 Terminal Bell",terminal_notification:"🔔 Terminal Notification",tmux_window_close:"🪟 Window Closed",tmux_pane_close:"📱 Pane Closed",device_tmux_missing:"⚠️ Tmux Missing",device_disconnect:"🔌 Device Disconnected",session_created:"🆕 Session Created",session_closed:"🚪 Session Closed"},site:"Site",device:"Device",window:"Window",pane:"Pane",time:"Time",directLink:"Direct Link",message:"Message",telegramBell:{title:"🔔 Bell from {{siteName}}: {{terminalTopbarLabel}}",viewLink:"Click to view",terminalTopbarLabel:"Window {{window}} · Pane {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"No windows",noDevices:"No devices",addDeviceLink:"Add Device",openSettingsLink:"Open Settings",openSettings:"Open Settings",manageDevices:"Manage Devices",settings:"Settings",currentWindow:"Current Window",currentPane:"Current Pane",newWindow:"Create Window",closeWindow:"Close Window",closePane:"Close Pane",addDevice:"Add Device"},window:{noWindows:"No windows",new:"New Window"},validation:{deviceNameRequired:"Device name is required",hostRequired:"Host is required for SSH devices"}}},zh_CN:{translation:{common:{loading:"加载中...",save:"保存",saving:"保存中...",cancel:"取消",add:"添加",delete:"删除",edit:"修改",confirm:"确认",close:"关闭",expand:"展开",collapse:"收起",refresh:"刷新",test:"测试",send:"发送",success:"成功",error:"错误",warning:"警告",info:"信息",yes:"是",no:"否",enabled:"已启用",disabled:"已禁用",pending:"待授权",authorized:"已授权",unknown:"未知",empty:"空",none:"无",default:"默认",optional:"可选",required:"必填",pwaInstallTitle:"安装为应用",pwaInstallHintIOSSafari:"iOS Safari 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」。",pwaInstallHintIOSChrome:"iOS Chrome 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」"},nav:{manageDevices:"管理设备",settings:"设置",sidebarExpand:"展开侧边栏",sidebarCollapse:"收起侧边栏",openSidebar:"打开侧边栏",closeSidebar:"关闭侧边栏",jumpToLatest:"跳转到最新",switchToEditor:"切换到编辑器输入",switchToDirect:"切换到直接输入",refreshPage:"刷新页面",refreshPageConfirm:"确定要刷新页面吗?未保存的内容将会丢失。"},device:{title:"设备管理",devices:"设备",addDevice:"添加设备",addDeviceDescription:"填写设备信息并选择连接方式",addFirstDevice:"添加第一个设备",editDevice:"修改设备",editDeviceDescription:"更新设备配置",sectionBasic:"基本信息",sectionConnection:"连接信息",sectionAuth:"认证信息",noDevices:"暂无设备",noDevicesDescription:"添加本地或 SSH 设备开始使用",name:"设备名称",namePlaceholder:"例如:我的服务器",type:"类型",typeLocal:"本地设备",typeSSH:"SSH 远程设备",typeSSHBadge:"SSH",host:"主机",hostPlaceholder:"example.com",port:"端口",username:"用户名",usernamePlaceholder:"root",session:"Tmux 会话名称",sessionPlaceholder:"tmex",sessionHint:'留空将使用默认值 "tmex"',authMode:"认证方式",authPassword:"密码",authKey:"私钥",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"密码",privateKey:"私钥",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"私钥密码(可选)",passphrase:"私钥密码(可选)",connect:"连接",connected:"已连接",disconnect:"断开",disconnected:"已断开",connecting:"连接中...",deleteConfirm:"删除此设备?",deleteDescription:'设备 "{{name}}" 将被永久移除,此操作无法撤销。',deleteSuccess:"设备已删除",createSuccess:"设备已创建",updateSuccess:"设备已更新",deleteFailed:"删除设备失败",createFailed:"创建设备失败",updateFailed:"更新设备失败",loadFailed:"加载设备列表失败",localDevice:"本地设备",subtitle:"{{username}}@{{host}}:{{port}}",modify:"修改设备",delete:"删除"},terminal:{initializing:"初始化终端...",connecting:"连接设备...",initFailed:"终端初始化失败",inputPlaceholder:"在此输入命令...",clear:"清空",deviceError:"设备错误",deviceErrorWithType:"[{{type}}] 设备错误",noDeviceSelected:"未选择设备",windowClosed:"当前窗口已关闭,请在侧边栏重新选择窗口。",paneClosed:"当前 Pane 已关闭,请在侧边栏重新选择 Pane。",bellNotification:"终端 Bell 提醒",bellDescription:"窗口 {{window}} · Pane {{pane}}",bellFallback:"收到 tmux bell",paneTitle:"Pane {{index}}",activePane:"当前 pane",activeWindow:"当前窗口",editorPlaceholder:"在此输入命令...",editorClear:"清空",editorSendWithEnter:"发送附带回车",editorSendLineByLine:"逐行发送",editorSend:"发送",sendShortcut:"发送 {{key}}",inputModeDirect:"直接输入",inputModeEditor:"编辑器",newWindow:"新建窗口",closeWindow:"关闭窗口",closePane:"关闭 pane",copy:"复制",paste:"粘贴",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteFailed:"无法读取剪贴板,请检查浏览器权限",clearSelection:"取消选择"},settings:{title:"系统设置",siteSettings:"站点设置",siteName:"站点名称",siteNamePlaceholder:"tmex",siteUrl:"站点访问 URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"Bell 频控(秒)",notificationThrottle:"通知频控(秒)",enableBrowserBellToast:"开启浏览器 Bell Toast",enableBrowserNotificationToast:"开启浏览器通知 Toast",enableTelegramBellPush:"开启 Telegram Bell 推送",enableTelegramNotificationPush:"开启 Telegram 通知推送",sshReconnectRetries:"SSH 重连次数",sshReconnectDelay:"SSH 重连等待(秒)",language:"语言",languagePlaceholder:"选择语言",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"主题",themeLight:"浅色",themeDark:"深色",siteTab:"站点",notificationsTab:"通知",refreshToApply:"刷新后生效",saveSettings:"保存设置",settingsSaved:"站点设置已保存",saveFailed:"保存设置失败",loadFailed:"加载设置失败",restartGateway:"重启 Gateway",restartScheduled:"Gateway 重启请求已发送",restartConfirm:"确定要重启 Gateway 吗?这将中断所有活动连接。",restartFailed:"重启请求失败",sshReconnectMaxRetries:"SSH 重连次数"},telegram:{title:"Telegram Bot 管理",botName:"Bot 名称",botNamePlaceholder:"如:ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"新增 Bot",enableBot:"启用 Bot",allowAuthRequests:"允许申请授权",pendingChats:"待授权",chats:"已授权",authorizedChats:"已授权",noPendingChats:"暂无待授权 chat",noAuthorizedChats:"暂无已授权 chat",approve:"批准",authorize:"授权",reject:"拒绝",revokeAuth:"撤销授权",testMessage:"测试消息",sendTestMessage:"发送测试消息",deleteBot:"删除 Bot",tokenOptional:"Token(留空不改)",tokenPlaceholder:"输入新 token",botCreated:"Bot 已创建",botUpdated:"Bot 已更新",botDeleted:"Bot 已删除",authApproved:"授权已批准",chatRemoved:"chat 已移除",testMessageSent:"测试消息已发送",createFailed:"新增 Bot 失败",updateFailed:"更新 Bot 失败",deleteFailed:"删除 Bot 失败",approveFailed:"批准授权失败",removeFailed:"删除 chat 失败",testMessageFailed:"发送测试消息失败",loadBotsFailed:"加载 Bot 列表失败",loadChatsFailed:"加载 chat 列表失败",noBots:"暂无 Bot,先添加一个。",expand:"展开",collapse:"收起",authCount:"已授权 {{authorized}} / 待授权 {{pending}}(总上限 8)",chatId:"chatId",applyTime:"申请时间",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}:设备「{{deviceName}}」({{host}}) 连接异常 [{{category}}]
|
|
76
76
|
{{error}}`,authSuccess:"✅ 已授权,可接收通知。",authPending:"⏳ 已收到授权申请,请在 tmex 设置页审批。",authFailed:"❌ 授权申请失败,请联系管理员。",testMessageTemplate:`🧪 测试消息
|
|
77
77
|
站点:{{siteName}}
|
|
78
78
|
时间:{{time}}`,approveMessageTemplate:`✅ 已通过 tmex 授权。
|
|
79
79
|
Bot:{{botName}}
|
|
80
|
-
时间:{{time}}`,botNotFound:"Bot 未启动或不可用",botNotRunning:"Bot 未启动或不可用"},webhook:{title:"Webhooks",url:"Webhook 地址",secret:"密钥",secretPlaceholder:"用于签名(HMAC-SHA256)",enabled:"启用",eventMask:"事件",add:"添加 Webhook",empty:"暂无 Webhook。",createFailed:"创建 Webhook 失败",deleteFailed:"删除 Webhook 失败",loadFailed:"加载 Webhook 失败"},sshError:{sshConfigRefNotSupported:"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证",configRefNotSupported:"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证",agentUnavailable:"SSH Agent 不可用:未检测到 SSH_AUTH_SOCK,请检查 agent 环境",agentNoIdentity:"SSH Agent 未加载可用密钥,请先执行 ssh-add",agentNoIdentities:"SSH Agent 未加载可用密钥,请先执行 ssh-add",authFailed:"认证失败:用户名、密码或密钥不正确,请检查设备配置",authFailedGeneric:"认证失败:用户名、密码或密钥不正确,请检查设备配置",networkUnreachable:"网络不可达:请检查路由、防火墙或 VPN 配置",connectionRefused:"连接被拒绝:无法连接到目标主机,请检查主机地址和端口是否正确",timeout:"连接超时:无法连接到设备,请检查网络或防火墙设置",connectionTimeout:"连接超时:无法连接到设备,请检查网络或防火墙设置",hostNotFound:"主机未找到:无法解析主机地址,请检查 DNS 或主机名是否正确",handshakeFailed:"握手失败:无法建立安全连接,可能是密钥交换算法不兼容",tmuxUnavailable:"远端 tmux 不可用或启动失败,请检查远端是否已安装 tmux,且远端 shell PATH 可找到 tmux",connectionClosed:"连接已断开,尝试重连中",unknown:"连接失败:{{message}}",reconnecting:"连接中断,{{delay}} 秒后自动重连({{attempt}}/{{maxRetries}})",reconnectFailed:"自动重连失败,请手动重试",reconnected:"设备已自动重连"},deviceStatus:{reconnecting:"重连中 {{delay}}s",offline:"离线",errorBadge:{authFailed:"认证失败",agentUnavailable:"Agent 不可用",agentNoIdentity:"Agent 无密钥",configRefNotSupported:"不支持 SSH Config",networkUnreachable:"网络不可达",connectionRefused:"连接被拒",timeout:"连接超时",hostNotFound:"主机未找到",handshakeFailed:"握手失败",tmuxUnavailable:"tmux 不可用",connectionClosed:"连接已断开",unknown:"连接异常"}},websocket:{error:"WebSocket 连接错误",checkGateway:"请检查 Gateway 状态",upgradeFailed:"Upgrade failed",invalidMessage:"Invalid message format"},wsError:{checkGateway:"请检查 Gateway 状态"},apiError:{siteNameRequired:"站点名称不能为空",siteUrlInvalid:"站点 URL 必须以 http:// 或 https:// 开头",bellThrottleInvalid:"Bell 频控秒数需在 0-300 之间",sshRetriesInvalid:"SSH 重连次数需在 0-20 之间",sshDelayInvalid:"SSH 重连等待时间需在 1-300 秒之间",languageInvalid:"语言必须是受支持的区域设置之一",botNameRequired:"Bot 名称不能为空",botTokenRequired:"Bot token 不能为空",missingFields:"缺少必填字段",sshRequiresHost:"SSH 设备需要 host 或 sshConfigRef",invalidRequest:"请求无效",deviceNotFound:"Device not found",botNotFound:"Bot 不存在",chatNotFound:"Chat 不存在",urlAndSecretRequired:"URL and secret required",notFound:"Not found"},notification:{clickToJump:"点击跳转到对应 Pane",eventType:{terminal_bell:"🔔 终端 Bell",terminal_notification:"🔔 终端通知",tmux_window_close:"🪟 窗口关闭",tmux_pane_close:"📱 Pane 关闭",device_tmux_missing:"⚠️ Tmux 不可用",device_disconnect:"🔌 设备断开",session_created:"🆕 会话创建",session_closed:"🚪 会话关闭"},site:"站点",device:"设备",window:"窗口",pane:"Pane",time:"时间",directLink:"直达",message:"信息",telegramBell:{title:"🔔 来自 {{siteName}} 的 Bell:{{terminalTopbarLabel}}",viewLink:"点击查看",terminalTopbarLabel:"窗口 {{window}} · Pane {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"暂无窗口",noDevices:"暂无设备",addDeviceLink:"添加设备",openSettingsLink:"打开设置",openSettings:"打开设置",manageDevices:"管理设备",settings:"设置",currentWindow:"当前窗口",currentPane:"当前 pane",newWindow:"新建窗口",closeWindow:"关闭窗口",closePane:"关闭 pane",addDevice:"添加设备"},window:{noWindows:"暂无窗口",new:"新建窗口"},validation:{deviceNameRequired:"设备名称为必填项",hostRequired:"SSH 设备需要填写主机地址"}}},ja_JP:{translation:{common:{loading:"読み込み中...",save:"保存",saving:"保存中...",cancel:"キャンセル",add:"追加",delete:"削除",edit:"編集",confirm:"確認",close:"閉じる",expand:"展開",collapse:"折りたたむ",refresh:"更新",test:"テスト",send:"送信",success:"成功",error:"エラー",warning:"警告",info:"情報",yes:"はい",no:"いいえ",enabled:"有効",disabled:"無効",pending:"保留中",authorized:"承認済み",unknown:"不明",empty:"空",none:"なし",default:"デフォルト",optional:"任意",required:"必須",pwaInstallTitle:"アプリとしてインストール",pwaInstallHintIOSSafari:"iOS Safari では自動的にインストールプロンプトが表示されません。共有ボタンをタップし、「ホーム画面に追加」を選択してください。",pwaInstallHintIOSChrome:"iOS Chrome では自動的にインストールプロンプトが表示されません。共有ボタンをタップし、「ホーム画面に追加」を選択してください。"},nav:{manageDevices:"デバイス管理",settings:"設定",sidebarExpand:"サイドバーを展開",sidebarCollapse:"サイドバーを折りたたむ",openSidebar:"サイドバーを開く",closeSidebar:"サイドバーを閉じる",jumpToLatest:"最新にジャンプ",switchToEditor:"エディタ入力に切り替え",switchToDirect:"直接入力に切り替え",refreshPage:"ページを更新",refreshPageConfirm:"ページを更新してもよろしいですか?保存されていない内容は失われます。"},device:{title:"デバイス管理",devices:"デバイス",addDevice:"デバイスを追加",addDeviceDescription:"デバイス情報を入力し、接続方法を選択してください",addFirstDevice:"最初のデバイスを追加",editDevice:"デバイスを編集",editDeviceDescription:"デバイス設定を更新",sectionBasic:"基本情報",sectionConnection:"接続情報",sectionAuth:"認証情報",noDevices:"デバイスがありません",noDevicesDescription:"ローカルまたは SSH デバイスを追加して開始",name:"デバイス名",namePlaceholder:"例:My Server",type:"タイプ",typeLocal:"ローカルデバイス",typeSSH:"SSH リモートデバイス",typeSSHBadge:"SSH",host:"ホスト",hostPlaceholder:"example.com",port:"ポート",username:"ユーザー名",usernamePlaceholder:"root",session:"Tmux セッション名",sessionPlaceholder:"tmex",sessionHint:"空の場合、デフォルトの「tmex」が使用されます",authMode:"認証モード",authPassword:"パスワード",authKey:"秘密鍵",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"パスワード",privateKey:"秘密鍵",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"秘密鍵のパスフレーズ(任意)",passphrase:"パスフレーズ",connect:"接続",connected:"接続済み",disconnect:"切断",disconnected:"切断済み",connecting:"接続中...",deleteConfirm:"このデバイスを削除しますか?",deleteDescription:"デバイス「{{name}}」は完全に削除されます。この操作は取り消せません。",deleteSuccess:"デバイスを削除しました",createSuccess:"デバイスを作成しました",updateSuccess:"デバイスを更新しました",deleteFailed:"デバイスの削除に失敗しました",createFailed:"デバイスの作成に失敗しました",updateFailed:"デバイスの更新に失敗しました",loadFailed:"デバイス一覧の読み込みに失敗しました",localDevice:"ローカルデバイス",subtitle:"{{username}}@{{host}}:{{port}}",modify:"デバイスを変更",delete:"削除"},terminal:{initializing:"ターミナルを初期化中...",connecting:"デバイスに接続中...",initFailed:"ターミナルの初期化に失敗しました",inputPlaceholder:"ここにコマンドを入力...",clear:"クリア",deviceError:"デバイスエラー",deviceErrorWithType:"[{{type}}] デバイスエラー",noDeviceSelected:"デバイスが選択されていません",windowClosed:"現在のウィンドウは閉じられました。サイドバーからウィンドウを選択してください。",paneClosed:"現在のペインは閉じられました。サイドバーからペインを選択してください。",bellNotification:"ターミナルベル通知",bellDescription:"ウィンドウ {{window}} · ペイン {{pane}}",bellFallback:"tmux ベルを受信",paneTitle:"ペイン {{index}}",activePane:"現在のペイン",activeWindow:"現在のウィンドウ",editorPlaceholder:"ここにコマンドを入力...",editorClear:"クリア",editorSendWithEnter:"Enter で送信",editorSendLineByLine:"1行ずつ送信",editorSend:"送信",sendShortcut:"{{key}} を送信",inputModeDirect:"直接入力",inputModeEditor:"エディタ",newWindow:"新規ウィンドウ",closeWindow:"ウィンドウを閉じる",closePane:"ペインを閉じる"},settings:{title:"システム設定",siteSettings:"サイト設定",siteName:"サイト名",siteNamePlaceholder:"tmex",siteUrl:"サイト URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"ベル制限(秒)",notificationThrottle:"通知制限(秒)",enableBrowserBellToast:"ブラウザベル Toast を有効にする",enableBrowserNotificationToast:"ブラウザ通知 Toast を有効にする",enableTelegramBellPush:"Telegram ベルプッシュを有効にする",enableTelegramNotificationPush:"Telegram 通知プッシュを有効にする",sshReconnectRetries:"SSH 再接続試行回数",sshReconnectDelay:"SSH 再接続待機(秒)",language:"言語",languagePlaceholder:"言語を選択",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"テーマ",themeLight:"ライト",themeDark:"ダーク",siteTab:"サイト",notificationsTab:"通知",refreshToApply:"言語変更を適用するには更新してください",saveSettings:"設定を保存",settingsSaved:"設定を保存しました",saveFailed:"設定の保存に失敗しました",loadFailed:"設定の読み込みに失敗しました",restartGateway:"Gateway を再起動",restartScheduled:"Gateway の再起動が予定されました",restartConfirm:"Gateway を再起動してもよろしいですか?すべてのアクティブ接続が中断されます。",restartFailed:"Gateway の再起動に失敗しました",sshReconnectMaxRetries:"SSH 再接続試行回数"},telegram:{title:"Telegram Bot 管理",botName:"Bot 名",botNamePlaceholder:"例:ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"Bot を追加",enableBot:"Bot を有効にする",allowAuthRequests:"認証リクエストを許可",pendingChats:"承認待ち",chats:"承認済み",authorizedChats:"承認済み",noPendingChats:"承認待ちのチャットはありません",noAuthorizedChats:"承認済みのチャットはありません",approve:"承認",authorize:"認証",reject:"拒否",revokeAuth:"認証を取り消す",testMessage:"テストメッセージ",sendTestMessage:"テストメッセージを送信",deleteBot:"Bot を削除",tokenOptional:"Token(変更しない場合は空)",tokenPlaceholder:"新しい token を入力",botCreated:"Bot を作成しました",botUpdated:"Bot を更新しました",botDeleted:"Bot を削除しました",authApproved:"認証が承認されました",chatRemoved:"チャットを削除しました",testMessageSent:"テストメッセージを送信しました",createFailed:"Bot の作成に失敗しました",updateFailed:"Bot の更新に失敗しました",deleteFailed:"Bot の削除に失敗しました",approveFailed:"認証の承認に失敗しました",removeFailed:"チャットの削除に失敗しました",testMessageFailed:"テストメッセージの送信に失敗しました",loadBotsFailed:"Bot 一覧の読み込みに失敗しました",loadChatsFailed:"チャット一覧の読み込みに失敗しました",noBots:"Bot がありません。まず追加してください。",expand:"展開",collapse:"折りたたむ",authCount:"承認済み {{authorized}} / 承認待ち {{pending}}(最大 8)",chatId:"Chat ID",applyTime:"申請時間",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}:デバイス「{{deviceName}}」({{host}}) で接続エラー [{{category}}]
|
|
80
|
+
时间:{{time}}`,botNotFound:"Bot 未启动或不可用",botNotRunning:"Bot 未启动或不可用"},webhook:{title:"Webhooks",url:"Webhook 地址",secret:"密钥",secretPlaceholder:"用于签名(HMAC-SHA256)",enabled:"启用",eventMask:"事件",add:"添加 Webhook",empty:"暂无 Webhook。",createFailed:"创建 Webhook 失败",deleteFailed:"删除 Webhook 失败",loadFailed:"加载 Webhook 失败"},sshError:{sshConfigRefNotSupported:"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证",configRefNotSupported:"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证",agentUnavailable:"SSH Agent 不可用:未检测到 SSH_AUTH_SOCK,请检查 agent 环境",agentNoIdentity:"SSH Agent 未加载可用密钥,请先执行 ssh-add",agentNoIdentities:"SSH Agent 未加载可用密钥,请先执行 ssh-add",authFailed:"认证失败:用户名、密码或密钥不正确,请检查设备配置",authFailedGeneric:"认证失败:用户名、密码或密钥不正确,请检查设备配置",networkUnreachable:"网络不可达:请检查路由、防火墙或 VPN 配置",connectionRefused:"连接被拒绝:无法连接到目标主机,请检查主机地址和端口是否正确",timeout:"连接超时:无法连接到设备,请检查网络或防火墙设置",connectionTimeout:"连接超时:无法连接到设备,请检查网络或防火墙设置",hostNotFound:"主机未找到:无法解析主机地址,请检查 DNS 或主机名是否正确",handshakeFailed:"握手失败:无法建立安全连接,可能是密钥交换算法不兼容",tmuxUnavailable:"远端 tmux 不可用或启动失败,请检查远端是否已安装 tmux,且远端 shell PATH 可找到 tmux",connectionClosed:"连接已断开,尝试重连中",unknown:"连接失败:{{message}}",reconnecting:"连接中断,{{delay}} 秒后自动重连({{attempt}}/{{maxRetries}})",reconnectFailed:"自动重连失败,请手动重试",reconnected:"设备已自动重连"},deviceStatus:{reconnecting:"重连中 {{delay}}s",offline:"离线",errorBadge:{authFailed:"认证失败",agentUnavailable:"Agent 不可用",agentNoIdentity:"Agent 无密钥",configRefNotSupported:"不支持 SSH Config",networkUnreachable:"网络不可达",connectionRefused:"连接被拒",timeout:"连接超时",hostNotFound:"主机未找到",handshakeFailed:"握手失败",tmuxUnavailable:"tmux 不可用",connectionClosed:"连接已断开",unknown:"连接异常"}},websocket:{error:"WebSocket 连接错误",checkGateway:"请检查 Gateway 状态",upgradeFailed:"Upgrade failed",invalidMessage:"Invalid message format"},wsError:{checkGateway:"请检查 Gateway 状态"},apiError:{siteNameRequired:"站点名称不能为空",siteUrlInvalid:"站点 URL 必须以 http:// 或 https:// 开头",bellThrottleInvalid:"Bell 频控秒数需在 0-300 之间",sshRetriesInvalid:"SSH 重连次数需在 0-20 之间",sshDelayInvalid:"SSH 重连等待时间需在 1-300 秒之间",languageInvalid:"语言必须是受支持的区域设置之一",botNameRequired:"Bot 名称不能为空",botTokenRequired:"Bot token 不能为空",missingFields:"缺少必填字段",sshRequiresHost:"SSH 设备需要 host 或 sshConfigRef",invalidRequest:"请求无效",deviceNotFound:"Device not found",botNotFound:"Bot 不存在",chatNotFound:"Chat 不存在",urlAndSecretRequired:"URL and secret required",notFound:"Not found"},notification:{clickToJump:"点击跳转到对应 Pane",eventType:{terminal_bell:"🔔 终端 Bell",terminal_notification:"🔔 终端通知",tmux_window_close:"🪟 窗口关闭",tmux_pane_close:"📱 Pane 关闭",device_tmux_missing:"⚠️ Tmux 不可用",device_disconnect:"🔌 设备断开",session_created:"🆕 会话创建",session_closed:"🚪 会话关闭"},site:"站点",device:"设备",window:"窗口",pane:"Pane",time:"时间",directLink:"直达",message:"信息",telegramBell:{title:"🔔 来自 {{siteName}} 的 Bell:{{terminalTopbarLabel}}",viewLink:"点击查看",terminalTopbarLabel:"窗口 {{window}} · Pane {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"暂无窗口",noDevices:"暂无设备",addDeviceLink:"添加设备",openSettingsLink:"打开设置",openSettings:"打开设置",manageDevices:"管理设备",settings:"设置",currentWindow:"当前窗口",currentPane:"当前 pane",newWindow:"新建窗口",closeWindow:"关闭窗口",closePane:"关闭 pane",addDevice:"添加设备"},window:{noWindows:"暂无窗口",new:"新建窗口"},validation:{deviceNameRequired:"设备名称为必填项",hostRequired:"SSH 设备需要填写主机地址"}}},ja_JP:{translation:{common:{loading:"読み込み中...",save:"保存",saving:"保存中...",cancel:"キャンセル",add:"追加",delete:"削除",edit:"編集",confirm:"確認",close:"閉じる",expand:"展開",collapse:"折りたたむ",refresh:"更新",test:"テスト",send:"送信",success:"成功",error:"エラー",warning:"警告",info:"情報",yes:"はい",no:"いいえ",enabled:"有効",disabled:"無効",pending:"保留中",authorized:"承認済み",unknown:"不明",empty:"空",none:"なし",default:"デフォルト",optional:"任意",required:"必須",pwaInstallTitle:"アプリとしてインストール",pwaInstallHintIOSSafari:"iOS Safari では自動的にインストールプロンプトが表示されません。共有ボタンをタップし、「ホーム画面に追加」を選択してください。",pwaInstallHintIOSChrome:"iOS Chrome では自動的にインストールプロンプトが表示されません。共有ボタンをタップし、「ホーム画面に追加」を選択してください。"},nav:{manageDevices:"デバイス管理",settings:"設定",sidebarExpand:"サイドバーを展開",sidebarCollapse:"サイドバーを折りたたむ",openSidebar:"サイドバーを開く",closeSidebar:"サイドバーを閉じる",jumpToLatest:"最新にジャンプ",switchToEditor:"エディタ入力に切り替え",switchToDirect:"直接入力に切り替え",refreshPage:"ページを更新",refreshPageConfirm:"ページを更新してもよろしいですか?保存されていない内容は失われます。"},device:{title:"デバイス管理",devices:"デバイス",addDevice:"デバイスを追加",addDeviceDescription:"デバイス情報を入力し、接続方法を選択してください",addFirstDevice:"最初のデバイスを追加",editDevice:"デバイスを編集",editDeviceDescription:"デバイス設定を更新",sectionBasic:"基本情報",sectionConnection:"接続情報",sectionAuth:"認証情報",noDevices:"デバイスがありません",noDevicesDescription:"ローカルまたは SSH デバイスを追加して開始",name:"デバイス名",namePlaceholder:"例:My Server",type:"タイプ",typeLocal:"ローカルデバイス",typeSSH:"SSH リモートデバイス",typeSSHBadge:"SSH",host:"ホスト",hostPlaceholder:"example.com",port:"ポート",username:"ユーザー名",usernamePlaceholder:"root",session:"Tmux セッション名",sessionPlaceholder:"tmex",sessionHint:"空の場合、デフォルトの「tmex」が使用されます",authMode:"認証モード",authPassword:"パスワード",authKey:"秘密鍵",authAgent:"SSH Agent",authConfigRef:"SSH Config",password:"パスワード",privateKey:"秘密鍵",privateKeyPlaceholder:"-----BEGIN OPENSSH PRIVATE KEY-----",privateKeyPassphrase:"秘密鍵のパスフレーズ(任意)",passphrase:"パスフレーズ",connect:"接続",connected:"接続済み",disconnect:"切断",disconnected:"切断済み",connecting:"接続中...",deleteConfirm:"このデバイスを削除しますか?",deleteDescription:"デバイス「{{name}}」は完全に削除されます。この操作は取り消せません。",deleteSuccess:"デバイスを削除しました",createSuccess:"デバイスを作成しました",updateSuccess:"デバイスを更新しました",deleteFailed:"デバイスの削除に失敗しました",createFailed:"デバイスの作成に失敗しました",updateFailed:"デバイスの更新に失敗しました",loadFailed:"デバイス一覧の読み込みに失敗しました",localDevice:"ローカルデバイス",subtitle:"{{username}}@{{host}}:{{port}}",modify:"デバイスを変更",delete:"削除"},terminal:{initializing:"ターミナルを初期化中...",connecting:"デバイスに接続中...",initFailed:"ターミナルの初期化に失敗しました",inputPlaceholder:"ここにコマンドを入力...",clear:"クリア",deviceError:"デバイスエラー",deviceErrorWithType:"[{{type}}] デバイスエラー",noDeviceSelected:"デバイスが選択されていません",windowClosed:"現在のウィンドウは閉じられました。サイドバーからウィンドウを選択してください。",paneClosed:"現在のペインは閉じられました。サイドバーからペインを選択してください。",bellNotification:"ターミナルベル通知",bellDescription:"ウィンドウ {{window}} · ペイン {{pane}}",bellFallback:"tmux ベルを受信",paneTitle:"ペイン {{index}}",activePane:"現在のペイン",activeWindow:"現在のウィンドウ",editorPlaceholder:"ここにコマンドを入力...",editorClear:"クリア",editorSendWithEnter:"Enter で送信",editorSendLineByLine:"1行ずつ送信",editorSend:"送信",sendShortcut:"{{key}} を送信",inputModeDirect:"直接入力",inputModeEditor:"エディタ",newWindow:"新規ウィンドウ",closeWindow:"ウィンドウを閉じる",closePane:"ペインを閉じる",copy:"コピー",paste:"貼り付け",copied:"クリップボードにコピーしました",copyFailed:"コピーに失敗しました",pasteFailed:"クリップボードを読み取れません。ブラウザの権限を確認してください",clearSelection:"選択を解除"},settings:{title:"システム設定",siteSettings:"サイト設定",siteName:"サイト名",siteNamePlaceholder:"tmex",siteUrl:"サイト URL",siteUrlPlaceholder:"http://localhost:3000",bellThrottle:"ベル制限(秒)",notificationThrottle:"通知制限(秒)",enableBrowserBellToast:"ブラウザベル Toast を有効にする",enableBrowserNotificationToast:"ブラウザ通知 Toast を有効にする",enableTelegramBellPush:"Telegram ベルプッシュを有効にする",enableTelegramNotificationPush:"Telegram 通知プッシュを有効にする",sshReconnectRetries:"SSH 再接続試行回数",sshReconnectDelay:"SSH 再接続待機(秒)",language:"言語",languagePlaceholder:"言語を選択",language_en_US:"English",language_zh_CN:"简体中文",language_ja_JP:"日本語",theme:"テーマ",themeLight:"ライト",themeDark:"ダーク",siteTab:"サイト",notificationsTab:"通知",refreshToApply:"言語変更を適用するには更新してください",saveSettings:"設定を保存",settingsSaved:"設定を保存しました",saveFailed:"設定の保存に失敗しました",loadFailed:"設定の読み込みに失敗しました",restartGateway:"Gateway を再起動",restartScheduled:"Gateway の再起動が予定されました",restartConfirm:"Gateway を再起動してもよろしいですか?すべてのアクティブ接続が中断されます。",restartFailed:"Gateway の再起動に失敗しました",sshReconnectMaxRetries:"SSH 再接続試行回数"},telegram:{title:"Telegram Bot 管理",botName:"Bot 名",botNamePlaceholder:"例:ops-bot",botToken:"Bot Token",botTokenPlaceholder:"123456:AA...",addBot:"Bot を追加",enableBot:"Bot を有効にする",allowAuthRequests:"認証リクエストを許可",pendingChats:"承認待ち",chats:"承認済み",authorizedChats:"承認済み",noPendingChats:"承認待ちのチャットはありません",noAuthorizedChats:"承認済みのチャットはありません",approve:"承認",authorize:"認証",reject:"拒否",revokeAuth:"認証を取り消す",testMessage:"テストメッセージ",sendTestMessage:"テストメッセージを送信",deleteBot:"Bot を削除",tokenOptional:"Token(変更しない場合は空)",tokenPlaceholder:"新しい token を入力",botCreated:"Bot を作成しました",botUpdated:"Bot を更新しました",botDeleted:"Bot を削除しました",authApproved:"認証が承認されました",chatRemoved:"チャットを削除しました",testMessageSent:"テストメッセージを送信しました",createFailed:"Bot の作成に失敗しました",updateFailed:"Bot の更新に失敗しました",deleteFailed:"Bot の削除に失敗しました",approveFailed:"認証の承認に失敗しました",removeFailed:"チャットの削除に失敗しました",testMessageFailed:"テストメッセージの送信に失敗しました",loadBotsFailed:"Bot 一覧の読み込みに失敗しました",loadChatsFailed:"チャット一覧の読み込みに失敗しました",noBots:"Bot がありません。まず追加してください。",expand:"展開",collapse:"折りたたむ",authCount:"承認済み {{authorized}} / 承認待ち {{pending}}(最大 8)",chatId:"Chat ID",applyTime:"申請時間",gatewayOnline:"🟢 Gateway online @ {{siteName}}",deviceConnectionError:`🔴 {{siteName}}:デバイス「{{deviceName}}」({{host}}) で接続エラー [{{category}}]
|
|
81
81
|
{{error}}`,authSuccess:"✅ 承認されました。通知を受信できます。",authPending:"⏳ 認証リクエストを受信しました。tmex 設定ページで承認してください。",authFailed:"❌ 認証リクエストに失敗しました。管理者に連絡してください。",testMessageTemplate:`🧪 テストメッセージ
|
|
82
82
|
サイト:{{siteName}}
|
|
83
83
|
時間:{{time}}`,approveMessageTemplate:`✅ tmex で承認されました。
|
|
84
84
|
Bot:{{botName}}
|
|
85
|
-
時間:{{time}}`,botNotFound:"Bot が見つからないか利用できません",botNotRunning:"Bot が起動していないか利用できません"},webhook:{title:"Webhooks",url:"Webhook URL",secret:"シークレット",secretPlaceholder:"署名に使用(HMAC-SHA256)",enabled:"有効",eventMask:"イベント",add:"Webhook を追加",empty:"Webhook がありません。",createFailed:"Webhook の作成に失敗しました",deleteFailed:"Webhook の削除に失敗しました",loadFailed:"Webhook の読み込みに失敗しました"},sshError:{sshConfigRefNotSupported:"このバージョンでは SSH Config 参照はサポートされていません。host + username を使用し、Agent/秘密鍵/パスワード認証を選択してください。",configRefNotSupported:"このバージョンでは SSH Config 参照はサポートされていません。host + username を使用し、Agent/秘密鍵/パスワード認証を選択してください。",agentUnavailable:"SSH Agent が利用できません:SSH_AUTH_SOCK が検出されません。agent 環境を確認してください。",agentNoIdentity:"SSH Agent に利用可能な鍵がありません。ssh-add を実行してください。",agentNoIdentities:"SSH Agent に利用可能な鍵がありません。ssh-add を実行してください。",authFailed:"認証に失敗しました:ユーザー名、パスワード、または鍵が正しくありません。デバイス設定を確認してください。",authFailedGeneric:"認証に失敗しました:ユーザー名、パスワード、または鍵が正しくありません。デバイス設定を確認してください。",networkUnreachable:"ネットワークに到達できません:ルーティング、ファイアウォール、または VPN 設定を確認してください。",connectionRefused:"接続が拒否されました:ターゲットホストに接続できません。ホストアドレスとポートを確認してください。",timeout:"接続タイムアウト:デバイスに接続できません。ネットワークまたはファイアウォール設定を確認してください。",connectionTimeout:"接続タイムアウト:デバイスに接続できません。ネットワークまたはファイアウォール設定を確認してください。",hostNotFound:"ホストが見つかりません:ホスト名を解決できません。DNS またはホスト名設定を確認してください。",handshakeFailed:"ハンドシェイクに失敗しました:安全な接続を確立できません。キー交換アルゴリズムが互換性がない可能性があります。",tmuxUnavailable:"リモート tmux が利用できないか起動に失敗しました。tmux がインストールされ、リモート shell の PATH から参照できることを確認してください。",connectionClosed:"接続が切断されました。再接続を試みています",unknown:"接続に失敗しました:{{message}}",reconnecting:"接続が中断されました。{{delay}} 秒後に再接続します({{attempt}}/{{maxRetries}})",reconnectFailed:"自動再接続に失敗しました。手動で再試行してください",reconnected:"デバイスが自動的に再接続されました"},deviceStatus:{reconnecting:"再接続中 {{delay}}s",offline:"オフライン",errorBadge:{authFailed:"認証失敗",agentUnavailable:"Agent 利用不可",agentNoIdentity:"Agent に鍵なし",configRefNotSupported:"SSH Config 非対応",networkUnreachable:"ネットワーク不可達",connectionRefused:"接続拒否",timeout:"タイムアウト",hostNotFound:"ホスト未検出",handshakeFailed:"ハンドシェイク失敗",tmuxUnavailable:"tmux 利用不可",connectionClosed:"切断",unknown:"接続エラー"}},websocket:{error:"WebSocket 接続エラー",checkGateway:"Gateway 状態を確認してください",upgradeFailed:"アップグレードに失敗しました",invalidMessage:"無効なメッセージ形式"},wsError:{checkGateway:"Gateway 状態を確認してください"},apiError:{siteNameRequired:"サイト名は空にできません",siteUrlInvalid:"サイト URL は http:// または https:// で始まる必要があります",bellThrottleInvalid:"ベル制限秒数は 0-300 の間である必要があります",sshRetriesInvalid:"SSH 再接続試行回数は 0-20 の間である必要があります",sshDelayInvalid:"SSH 再接続待機時間は 1-300 秒の間である必要があります",languageInvalid:"言語はサポートされているロケールのいずれかである必要があります",botNameRequired:"Bot 名は空にできません",botTokenRequired:"Bot token は空にできません",missingFields:"必須フィールドがありません",sshRequiresHost:"SSH デバイスには host または sshConfigRef が必要です",invalidRequest:"無効なリクエスト",deviceNotFound:"デバイスが見つかりません",botNotFound:"Bot が見つかりません",chatNotFound:"チャットが見つかりません",urlAndSecretRequired:"URL とシークレットが必要です",notFound:"見つかりません"},notification:{clickToJump:"対応するペインにジャンプ",eventType:{terminal_bell:"🔔 ターミナルベル",terminal_notification:"🔔 ターミナル通知",tmux_window_close:"🪟 ウィンドウ閉じる",tmux_pane_close:"📱 ペイン閉じる",device_tmux_missing:"⚠️ Tmux がありません",device_disconnect:"🔌 デバイス切断",session_created:"🆕 セッション作成",session_closed:"🚪 セッション閉じる"},site:"サイト",device:"デバイス",window:"ウィンドウ",pane:"ペイン",time:"時間",directLink:"直接リンク",message:"メッセージ",telegramBell:{title:"🔔 {{siteName}} からのベル:{{terminalTopbarLabel}}",viewLink:"表示",terminalTopbarLabel:"ウィンドウ {{window}} · ペイン {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"ウィンドウがありません",noDevices:"デバイスがありません",addDeviceLink:"デバイスを追加",openSettingsLink:"設定を開く",openSettings:"設定を開く",manageDevices:"デバイス管理",settings:"設定",currentWindow:"現在のウィンドウ",currentPane:"現在のペイン",newWindow:"ウィンドウを作成",closeWindow:"ウィンドウを閉じる",closePane:"ペインを閉じる",addDevice:"デバイスを追加"},window:{noWindows:"ウィンドウがありません",new:"新規ウィンドウ"},validation:{deviceNameRequired:"デバイス名は必須です",hostRequired:"SSH デバイスにはホストアドレスが必要です"}}}},Yp="en_US",cH={locales:[{code:"en_US",name:"English",nativeName:"English",flag:"🇺🇸",isDefault:!0},{code:"zh_CN",name:"简体中文",nativeName:"简体中文",flag:"🇨🇳",isDefault:!1},{code:"ja_JP",name:"日本語",nativeName:"日本語",flag:"🇯🇵",isDefault:!1}]};function yA(t){return t.replace("_","-")}var hm={},eo={},to={},hS;function vA(){if(hS)return to;hS=1,Object.defineProperty(to,"__esModule",{value:!0}),to.BinaryReader=to.BinaryWriter=void 0;class t{constructor(i=1024){Le(this,"buffer");Le(this,"view");Le(this,"offset",0);this.buffer=new Uint8Array(i),this.view=new DataView(this.buffer.buffer)}ensureCapacity(i){const s=this.offset+i;if(s<=this.buffer.length)return;let l=this.buffer.length;for(;l<s;)l*=2;const u=new Uint8Array(l);u.set(this.buffer),this.buffer=u,this.view=new DataView(this.buffer.buffer)}writeUint8(i){this.ensureCapacity(1),this.view.setUint8(this.offset,i),this.offset+=1}writeUint16(i){this.ensureCapacity(2),this.view.setUint16(this.offset,i,!0),this.offset+=2}writeUint32(i){this.ensureCapacity(4),this.view.setUint32(this.offset,i,!0),this.offset+=4}writeUint64(i){this.ensureCapacity(8),this.view.setBigUint64(this.offset,i,!0),this.offset+=8}writeUint128(i){this.ensureCapacity(16);const s=i&BigInt("0xFFFFFFFFFFFFFFFF"),l=i>>BigInt(64);this.writeUint64(s),this.writeUint64(l)}writeInt8(i){this.ensureCapacity(1),this.view.setInt8(this.offset,i),this.offset+=1}writeInt16(i){this.ensureCapacity(2),this.view.setInt16(this.offset,i,!0),this.offset+=2}writeInt32(i){this.ensureCapacity(4),this.view.setInt32(this.offset,i,!0),this.offset+=4}writeInt64(i){this.ensureCapacity(8),this.view.setBigInt64(this.offset,i,!0),this.offset+=8}writeInt128(i){this.ensureCapacity(16);const s=i&BigInt("0xFFFFFFFFFFFFFFFF"),l=i>>BigInt(64);this.writeInt64(s),this.writeInt64(l)}writeFloat32(i){this.ensureCapacity(4),this.view.setFloat32(this.offset,i,!0),this.offset+=4}writeFloat64(i){this.ensureCapacity(8),this.view.setFloat64(this.offset,i,!0),this.offset+=8}writeBool(i){this.writeUint8(i?1:0)}writeString(i){const s=new TextEncoder().encode(i);this.writeUint32(s.length),this.ensureCapacity(s.length),this.buffer.set(s,this.offset),this.offset+=s.length}getBuffer(){return this.buffer.slice(0,this.offset)}}to.BinaryWriter=t;class n{constructor(i){Le(this,"buffer");Le(this,"view");Le(this,"offset",0);this.buffer=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength)}readUint8(){const i=this.view.getUint8(this.offset);return this.offset+=1,i}readUint16(){const i=this.view.getUint16(this.offset,!0);return this.offset+=2,i}readUint32(){const i=this.view.getUint32(this.offset,!0);return this.offset+=4,i}readUint64(){const i=this.view.getBigUint64(this.offset,!0);return this.offset+=8,i}readUint128(){const i=this.readUint64();return this.readUint64()<<BigInt(64)|i}readInt8(){const i=this.view.getInt8(this.offset);return this.offset+=1,i}readInt16(){const i=this.view.getInt16(this.offset,!0);return this.offset+=2,i}readInt32(){const i=this.view.getInt32(this.offset,!0);return this.offset+=4,i}readInt64(){const i=this.view.getBigInt64(this.offset,!0);return this.offset+=8,i}readInt128(){const i=this.readUint64();return this.readInt64()<<BigInt(64)|i}readFloat32(){const i=this.view.getFloat32(this.offset,!0);return this.offset+=4,i}readFloat64(){const i=this.view.getFloat64(this.offset,!0);return this.offset+=8,i}readBool(){return!!this.readUint8()}readString(){const i=this.readUint32(),s=this.buffer.slice(this.offset,this.offset+i);return this.offset+=i,new TextDecoder().decode(s)}getOffset(){return this.offset}}return to.BinaryReader=n,to}var mm={},mS;function bA(){return mS||(mS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.registry=t.TypeRegistry=void 0;class n{constructor(){Le(this,"handlers",new Map)}register(i,s){this.handlers.set(i,s)}getHandler(i){const s=this.handlers.get(i);if(!s)throw new Error(`No handler registered for type: ${i}`);return s}}t.TypeRegistry=n,t.registry=new n,t.registry.register("u8",{write:(a,i)=>{if(i<0||i>255||!Number.isInteger(i))throw new Error("Value out of range for u8");a.writeUint8(i)},read:a=>a.readUint8()}),t.registry.register("u16",{write:(a,i)=>{if(i<0||i>65535||!Number.isInteger(i))throw new Error("Value out of range for u16");a.writeUint16(i)},read:a=>a.readUint16()}),t.registry.register("u32",{write:(a,i)=>{if(i<0||i>4294967295||!Number.isInteger(i))throw new Error("Value out of range for u32");a.writeUint32(i)},read:a=>a.readUint32()}),t.registry.register("u64",{write:(a,i)=>{if(i<0n||i>18446744073709551615n)throw new Error("Value out of range for u64");a.writeUint64(i)},read:a=>a.readUint64()}),t.registry.register("u128",{write:(a,i)=>{if(i<0n||i>340282366920938463463374607431768211455n)throw new Error("Value out of range for u128");a.writeUint128(i)},read:a=>a.readUint128()}),t.registry.register("i8",{write:(a,i)=>{if(i<-128||i>127||!Number.isInteger(i))throw new Error("Value out of range for i8");a.writeInt8(i)},read:a=>a.readInt8()}),t.registry.register("i16",{write:(a,i)=>{if(i<-32768||i>32767||!Number.isInteger(i))throw new Error("Value out of range for i16");a.writeInt16(i)},read:a=>a.readInt16()}),t.registry.register("i32",{write:(a,i)=>{if(i<-2147483648||i>2147483647||!Number.isInteger(i))throw new Error("Value out of range for i32");a.writeInt32(i)},read:a=>a.readInt32()}),t.registry.register("i64",{write:(a,i)=>{if(i<-9223372036854775808n||i>9223372036854775807n)throw new Error("Value out of range for i64");a.writeInt64(i)},read:a=>a.readInt64()}),t.registry.register("i128",{write:(a,i)=>{if(i<-170141183460469231731687303715884105728n||i>170141183460469231731687303715884105727n)throw new Error("Value out of range for i128");a.writeInt128(i)},read:a=>a.readInt128()}),t.registry.register("f32",{write:(a,i)=>a.writeFloat32(i),read:a=>a.readFloat32()}),t.registry.register("f64",{write:(a,i)=>{if(Number.isNaN(i))throw new Error("For portability reasons we do not allow serializing NaN values.");a.writeFloat64(i)},read:a=>a.readFloat64()}),t.registry.register("bool",{write:(a,i)=>a.writeBool(i),read:a=>a.readBool()}),t.registry.register("string",{write:(a,i)=>a.writeString(i),read:a=>a.readString()}),t.registry.register("unit",{write:()=>{},read:()=>({})}),t.registry.register("struct",{write:(a,i,s)=>{if(s)for(const[l,u]of Object.entries(s))t.registry.getHandler(u.type).write(a,i[l],u.options)},read:(a,i)=>{if(!i)return{};const s={};for(const[l,u]of Object.entries(i)){const f=t.registry.getHandler(u.type);s[l]=f.read(a,u.options)}return s}}),t.registry.register("vec",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u}=s,f=(ArrayBuffer.isView(i),i.length);a.writeUint32(f);const m=t.registry.getHandler(l);if(ArrayBuffer.isView(i))for(let h=0;h<f;h++)m.write(a,i[h],u);else for(const h of i)m.write(a,h,u)},read:(a,i)=>{if(!i)return[];const{elementType:s,elementOptions:l}=i,u=a.readUint32(),f=t.registry.getHandler(s),m=Array.from({length:u},()=>f.read(a,l));switch(s){case"u8":return new Uint8Array(m);case"u16":return new Uint16Array(m);case"u32":return new Uint32Array(m);case"i8":return new Int8Array(m);case"i16":return new Int16Array(m);case"i32":return new Int32Array(m);case"i64":return new BigInt64Array(m);case"f32":return new Float32Array(m);case"f64":return new Float64Array(m);default:return m}}}),t.registry.register("set",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u}=s,f=Array.from(i).sort();a.writeUint32(f.length);const m=t.registry.getHandler(l);for(const h of f)m.write(a,h,u)},read:(a,i)=>{if(!i)return new Set;const{elementType:s,elementOptions:l}=i,u=a.readUint32(),f=t.registry.getHandler(s),m=Array.from({length:u},()=>f.read(a,l));return new Set(m)}}),t.registry.register("map",{write:(a,i,s)=>{if(!s)return;const{keyType:l,keyOptions:u,valueType:f,valueOptions:m}=s,h=Array.from(i.entries()).sort();a.writeUint32(h.length);const y=t.registry.getHandler(l),p=t.registry.getHandler(f);for(const[b,v]of h)y.write(a,b,u),p.write(a,v,m)},read:(a,i)=>{if(!i)return new Map;const{keyType:s,keyOptions:l,valueType:u,valueOptions:f}=i,m=a.readUint32(),h=t.registry.getHandler(s),y=t.registry.getHandler(u),p=Array.from({length:m},()=>{const b=h.read(a,l),v=y.read(a,f);return[b,v]});return new Map(p)}}),t.registry.register("option",{write:(a,i,s)=>{if(!s)return;const{valueType:l,valueOptions:u}=s,f=i!==null;a.writeUint8(f?1:0),f&&t.registry.getHandler(l).write(a,i,u)},read:(a,i)=>{if(!i)return null;const{valueType:s,valueOptions:l}=i;return a.readUint8()===1?t.registry.getHandler(s).read(a,l):null}}),t.registry.register("enum",{write:(a,i,s)=>{if(!s)return;const l=Object.keys(i)[0],u=i[l],f=s.variants.find(m=>m.name===l);if(!f)throw new Error(`Unknown enum variant: ${l}`);a.writeUint8(f.index),f.type!=="unit"&&t.registry.getHandler(f.type).write(a,u,f.options)},read:(a,i)=>{if(!i)return{};const s=a.readUint8(),l=i.variants.find(m=>m.index===s);if(!l)throw new Error(`Unknown enum variant index: ${s}`);if(l.type==="unit")return{[l.name]:{}};const f=t.registry.getHandler(l.type).read(a,l.options);return{[l.name]:f}}}),t.registry.register("tuple",{write:(a,i,s)=>{if(s){if(i.length!==s.length)throw new Error(`Tuple length mismatch: expected ${s.length}, got ${i.length}`);for(let l=0;l<s.length;l++){const u=s[l];if(!u)throw new Error(`Missing type information for tuple element at index ${l}`);t.registry.getHandler(u.type).write(a,i[l],u.options)}}},read:(a,i)=>{if(!i)return[];const s=[];for(const l of i){const u=t.registry.getHandler(l.type);s.push(u.read(a,l.options))}return s}}),t.registry.register("array",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u,length:f}=s;if(i.length!==f)throw new Error(`Array length mismatch: expected ${f}, got ${i.length}`);const m=t.registry.getHandler(l);for(const h of i)m.write(a,h,u)},read:(a,i)=>{if(!i)return[];const{elementType:s,elementOptions:l,length:u}=i,f=t.registry.getHandler(s);return Array.from({length:u},()=>f.read(a,l))}}),t.registry.register("bytes",{write:(a,i,s)=>{const l=i.length;if((s==null?void 0:s.length)!=null){if(l!==s.length)throw new Error(`Bytes length mismatch: expected ${s.length}, got ${l}`);for(let u=0;u<l;u++)a.writeUint8(i[u])}else{a.writeUint32(l);for(let u=0;u<l;u++)a.writeUint8(i[u])}},read:(a,i)=>{const s=(i==null?void 0:i.length)!=null?i.length:a.readUint32(),l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=a.readUint8();return l}}),t.registry.register("nativeEnum",{write:(a,i,s)=>{if(!s)return;const{valueToIndexMap:l}=s,u=i,f=l.get(u);if(f===void 0)throw new Error(`Invalid enum value: ${String(i)}`);a.writeUint8(f)},read:(a,i)=>{if(!i)return null;const{indexToValueMap:s}=i,l=a.readUint8(),u=s.get(l);if(u===void 0)throw new Error(`Invalid enum index: ${l}`);return u}})})(mm)),mm}var pS;function SA(){if(pS)return eo;pS=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.b=eo.Schema=void 0;const t=vA(),n=bA();class a{constructor(s,l,u){Le(this,"type");Le(this,"options");Le(this,"registry");this.type=s,this.options=l,this.registry=u}serialize(s){const l=new t.BinaryWriter;return this.registry.getHandler(this.type).write(l,s,this.options),l.getBuffer()}deserialize(s){const l=new t.BinaryReader(s);return this.registry.getHandler(this.type).read(l,this.options)}}return eo.Schema=a,eo.b={u8:()=>new a("u8",null,n.registry),u16:()=>new a("u16",null,n.registry),u32:()=>new a("u32",null,n.registry),u64:()=>new a("u64",null,n.registry),u128:()=>new a("u128",null,n.registry),i8:()=>new a("i8",null,n.registry),i16:()=>new a("i16",null,n.registry),i32:()=>new a("i32",null,n.registry),i64:()=>new a("i64",null,n.registry),i128:()=>new a("i128",null,n.registry),f32:()=>new a("f32",null,n.registry),f64:()=>new a("f64",null,n.registry),bool:()=>new a("bool",null,n.registry),string:()=>new a("string",null,n.registry),unit:()=>new a("unit",null,n.registry),vec:i=>new a("vec",{elementType:i.type,elementOptions:i.options},n.registry),hashSet:i=>new a("set",{elementType:i.type,elementOptions:i.options},n.registry),hashMap:(i,s)=>new a("map",{keyType:i.type,keyOptions:i.options,valueType:s.type,valueOptions:s.options},n.registry),option:i=>new a("option",{valueType:i.type,valueOptions:i.options},n.registry),array:(i,s)=>new a("array",{elementType:i.type,elementOptions:i.options,length:s},n.registry),bytes:i=>new a("bytes",i!=null?{length:i}:{},n.registry),enum:i=>{const s=Object.entries(i).map(([l,u],f)=>({index:f,name:l,type:u.type,options:u.options}));return new a("enum",{variants:s},n.registry)},struct:i=>{const s=Object.fromEntries(Object.entries(i).map(([l,u])=>[l,{type:u.type,options:u.options}]));return new a("struct",s,n.registry)},tuple:(...i)=>{const s=i.map(l=>({type:l.type,options:l.options}));return new a("tuple",s,n.registry)},nativeEnum:i=>{const s=Object.entries(i).filter(([y])=>typeof y=="string"&&Number.isNaN(Number(y))),l=s.map(([y,p])=>p),u=l.some(y=>typeof y=="string"),f=l.some(y=>typeof y=="number");if(u&&f)throw new Error("Mixed string/numeric enums are not supported");const m=new Map,h=new Map;if(s.forEach(([y,p],b)=>{m.set(p,b),h.set(b,p)}),s.length>255)throw new Error("Borsh only supports enums with up to 255 variants");return new a("nativeEnum",{enumObj:i,valueToIndexMap:m,indexToValueMap:h},n.registry)}},eo}var gS;function wA(){return gS||(gS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Schema=t.b=void 0;var n=SA();Object.defineProperty(t,"b",{enumerable:!0,get:function(){return n.b}}),Object.defineProperty(t,"Schema",{enumerable:!0,get:function(){return n.Schema}})})(hm)),hm}var J=wA();const xA=1,EA=2,RA=3,TA=4,CA=5,OA=257,MA=258,AA=259,DA=260,NA=261,_A=513,kA=514,LA=515,zA=516,UA=517,HA=519,jA=520,BA=769,PA=770,IA=771,FA=772,YA=773,VA=774,qA=1025,GA=1026,XA=1281,KA=1001,oa=1002,QA=1003,Mx=1004,nf=1005,WA=1101,$A=1102,ZA=1201,JA=1202,eD=1301,tD=1302,nD=1401,rD={[KA]:"Unsupported protocol version",[oa]:"Invalid frame format",[QA]:"Unknown message kind",[Mx]:"Failed to decode payload",[nf]:"Frame exceeds maximum size",[WA]:"Device not found",[$A]:"Failed to connect device",[ZA]:"Tmux target not found",[JA]:"Tmux not ready",[eD]:"Select conflict",[tD]:"Select token mismatch",[nD]:"Internal server error"};function aD(t){return rD[t]??`Unknown error code: ${t}`}class mr extends Error{constructor(n,a=!1,i){super(i??aD(n)),this.code=n,this.retryable=a,this.name="WsBorshError"}}const Ax=J.b.struct({magic:J.b.bytes(2),version:J.b.u16(),kind:J.b.u16(),flags:J.b.u16(),seq:J.b.u32(),payload:J.b.bytes()}),iD=J.b.option(J.b.u32()),Ts=J.b.option(J.b.u16()),tr=J.b.option(J.b.string()),oD=J.b.struct({clientImpl:J.b.string(),clientVersion:J.b.string(),maxFrameBytes:J.b.u32(),supportsCompression:J.b.bool(),supportsDiffSnapshot:J.b.bool()}),sD=J.b.struct({serverImpl:J.b.string(),serverVersion:J.b.string(),selectedVersion:J.b.u16(),maxFrameBytes:J.b.u32(),heartbeatIntervalMs:J.b.u32(),capabilities:J.b.vec(J.b.string())}),lD=J.b.struct({nonce:J.b.u32(),timeMs:J.b.u64()});J.b.struct({refSeq:iD,code:J.b.u16(),message:J.b.string(),retryable:J.b.bool()});const cD=J.b.struct({deviceId:J.b.string()}),uD=J.b.struct({deviceId:J.b.string()}),fD=J.b.struct({deviceId:J.b.string()}),dD=J.b.struct({deviceId:J.b.string()}),hD=J.b.struct({deviceId:J.b.string(),eventType:J.b.u8(),errorType:tr,message:tr,rawMessage:tr}),mD=J.b.struct({deviceId:J.b.string(),windowId:tr,paneId:tr,selectToken:J.b.bytes(16),wantHistory:J.b.bool(),cols:Ts,rows:Ts}),pD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string()}),gD=J.b.struct({deviceId:J.b.string(),name:tr}),yD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string()}),vD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string()});J.b.struct({deviceId:J.b.string(),windowId:J.b.string(),name:J.b.string()});const bD=J.b.struct({deviceId:J.b.string(),eventType:J.b.u8(),eventData:J.b.bytes()}),SD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes(),isComposing:J.b.bool()}),wD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes(),isComposing:J.b.bool()}),Dx=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),cols:J.b.u16(),rows:J.b.u16()}),xD=Dx,ED=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes()}),RD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16),encoding:J.b.u8(),alternateScreen:J.b.bool(),data:J.b.bytes()}),TD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16)}),CD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16)}),Nx=J.b.struct({chunkStreamId:J.b.u32(),originalKind:J.b.u16(),originalSeq:J.b.u32(),totalChunks:J.b.u16(),chunkIndex:J.b.u16(),data:J.b.bytes()}),OD=J.b.struct({id:J.b.string(),windowId:J.b.string(),index:J.b.u16(),title:tr,active:J.b.bool(),width:J.b.u16(),height:J.b.u16()}),MD=J.b.struct({id:J.b.string(),name:J.b.string(),index:J.b.u16(),active:J.b.bool(),panes:J.b.vec(OD)}),AD=J.b.struct({id:J.b.string(),name:J.b.string(),windows:J.b.vec(MD)}),DD=J.b.struct({deviceId:J.b.string(),session:J.b.option(AD)});J.b.struct({deviceId:J.b.string(),baseRevision:J.b.u32(),revision:J.b.u32(),diffFormat:J.b.u8(),diffBytes:J.b.bytes()});const ND=J.b.struct({windowId:J.b.string()}),_D=J.b.struct({windowId:J.b.string()}),kD=J.b.struct({windowId:J.b.string(),name:J.b.string()}),LD=J.b.struct({windowId:J.b.string()}),zD=J.b.struct({paneId:J.b.string(),windowId:J.b.string()}),UD=J.b.struct({paneId:J.b.string()}),HD=J.b.struct({windowId:J.b.string(),paneId:J.b.string()}),jD=J.b.struct({windowId:J.b.string(),layout:J.b.string()}),BD=J.b.struct({windowId:tr,paneId:tr,windowIndex:Ts,paneIndex:Ts,paneUrl:tr}),PD=J.b.struct({source:J.b.u8(),title:tr,body:J.b.string(),windowId:tr,paneId:tr,windowIndex:Ts,paneIndex:Ts,paneUrl:tr}),Zl=new Uint8Array([84,88]),ID=1;function rf(t,n,a,i=0,s=ID){const l={magic:Zl,version:s,kind:t,flags:i,seq:a,payload:n};return Ax.serialize(l)}function yr(t,n){return t.serialize(n)}function FD(t){if(t.length<12)throw new mr(oa,!1,"Envelope too small");if(t[0]!==Zl[0]||t[1]!==Zl[1])throw new mr(oa,!1,"Invalid magic bytes");try{return Ax.deserialize(t)}catch(n){throw new mr(oa,!1,n instanceof Error?n.message:"Failed to decode envelope")}}function ro(t,n){try{return t.deserialize(n)}catch(a){throw new mr(Mx,!1,a instanceof Error?a.message:"Failed to decode payload")}}function YD(t,n){const a=Nx.serialize(t);return rf(1281,a,n)}function VD(t){return Nx.deserialize(t)}function qD(t){return t.length>=2&&t[0]===Zl[0]&&t[1]===Zl[1]}const GD=5e3,yS=100,rp=1e3;class XD{constructor(){Le(this,"streams",new Map);Le(this,"lastCleanup",Date.now())}addChunk(n){if(this.cleanup(),n.totalChunks>rp)throw new mr(oa,!1,`Too many chunks: ${n.totalChunks} > ${rp}`);if(n.chunkIndex>=n.totalChunks)throw new mr(oa,!1,`Chunk index out of bounds: ${n.chunkIndex} >= ${n.totalChunks}`);let a=this.streams.get(n.chunkStreamId);if(!a){if(this.streams.size>=yS&&(this.cleanup(!0),this.streams.size>=yS))throw new mr(oa,!1,"Too many concurrent chunk streams");a={chunks:new Map,totalChunks:n.totalChunks,createdAt:Date.now(),originalKind:n.originalKind,originalSeq:n.originalSeq},this.streams.set(n.chunkStreamId,a)}if(a.totalChunks!==n.totalChunks)throw this.streams.delete(n.chunkStreamId),new mr(oa,!1,"Chunk total count mismatch");if(a.chunks.has(n.chunkIndex))throw new mr(oa,!1,`Duplicate chunk index: ${n.chunkIndex}`);return a.chunks.set(n.chunkIndex,n),a.chunks.size===a.totalChunks?this.reassemble(n.chunkStreamId,a):null}reassemble(n,a){const i=[];let s=0;for(let f=0;f<a.totalChunks;f++){const m=a.chunks.get(f);if(!m)throw this.streams.delete(n),new mr(oa,!1,`Missing chunk index: ${f}`);i.push(m.data),s+=m.data.length}const l=new Uint8Array(s);let u=0;for(const f of i)l.set(f,u),u+=f.length;return this.streams.delete(n),{kind:a.originalKind,seq:a.originalSeq,payload:l}}cleanup(n=!1){const a=Date.now();if(!n&&a-this.lastCleanup<5e3)return;this.lastCleanup=a;const i=a-GD;for(const[s,l]of this.streams)l.createdAt<i&&this.streams.delete(s)}getActiveStreamCount(){return this.streams.size}clear(){this.streams.clear()}}function KD(t,n,a,i){const{maxFrameBytes:s,chunkStreamId:l}=i,u=16,f=18,m=s-u;if(m<=0)throw new mr(nf,!1,`maxFrameBytes too small: ${s}`);if(t.length<=m)return{chunks:[],totalChunks:0};const h=s-u-f;if(h<=0)throw new mr(nf,!1,`maxFrameBytes too small for chunking: ${s}`);const y=Math.ceil(t.length/h);if(y>rp)throw new mr(nf,!1,`Too many chunks: ${y}`);const p=[];for(let b=0;b<y;b++){const v=b*h,S=Math.min(v+h,t.length);p.push({chunkStreamId:l,originalKind:n,originalSeq:a,totalChunks:y,chunkIndex:b,data:t.slice(v,S)})}return{chunks:p,totalChunks:y}}let pm=1;function QD(){const t=pm;return pm=pm%4294967295+1,t}const WD={1:"osc9",2:"osc777",3:"osc1337"};function $D(t){const n=hD.deserialize(t),a={1:"tmux-missing",2:"disconnected",3:"error",4:"reconnected"};return{deviceId:n.deviceId,type:a[n.eventType]??"error",errorType:n.errorType??void 0,message:n.message??void 0,rawMessage:n.rawMessage??void 0}}function ZD(t){const n=bD.deserialize(t),i={1:"window-add",2:"window-close",3:"window-renamed",4:"window-active",5:"pane-add",6:"pane-close",7:"pane-active",8:"layout-change",9:"bell",10:"output",11:"notification"}[n.eventType];if(!i)throw new Error(`Unknown tmux event type: ${n.eventType}`);return{deviceId:n.deviceId,type:i,data:JD(i,n.eventData)}}function JD(t,n){if(n.length===0)return{};try{switch(t){case"window-add":return ND.deserialize(n);case"window-close":return _D.deserialize(n);case"window-renamed":return kD.deserialize(n);case"window-active":return LD.deserialize(n);case"pane-add":return zD.deserialize(n);case"pane-close":return UD.deserialize(n);case"pane-active":return HD.deserialize(n);case"layout-change":return jD.deserialize(n);case"bell":{const a=BD.deserialize(n);return{windowId:a.windowId??void 0,paneId:a.paneId??void 0,windowIndex:a.windowIndex??void 0,paneIndex:a.paneIndex??void 0,paneUrl:a.paneUrl??void 0}}case"notification":{const a=PD.deserialize(n);return{source:WD[a.source]??"osc9",title:a.title??void 0,body:a.body,windowId:a.windowId??void 0,paneId:a.paneId??void 0,windowIndex:a.windowIndex??void 0,paneIndex:a.paneIndex??void 0,paneUrl:a.paneUrl??void 0}}default:return{}}}catch{return{}}}function eN(t){const n=DD.deserialize(t);return{deviceId:n.deviceId,session:n.session?tN(n.session):null}}function tN(t){return{id:t.id,name:t.name,windows:t.windows.map(nN)}}function nN(t){return{id:t.id,name:t.name,index:t.index,active:t.active,panes:t.panes.map(rN)}}function rN(t){return{id:t.id,windowId:t.windowId,index:t.index,title:t.title??void 0,active:t.active,width:t.width,height:t.height}}function aN(){const t=navigator.language;return t.startsWith("zh")?"zh_CN":t.startsWith("ja")?"ja_JP":Yp}An.use(cA).init({resources:gA,lng:aN(),fallbackLng:Yp,interpolation:{escapeValue:!1},returnNull:!1});const iN=`${typeof window<"u"&&window.location.protocol==="https:"?"wss:":"ws:"}//${typeof window<"u"?window.location.host:""}/ws`,oN={clientImpl:"tmex-fe",clientVersion:"0.1.0",maxFrameBytes:1048576,reconnectDelayMs:1e3,maxReconnectAttempts:5,heartbeatIntervalMs:15e3};class sN{constructor(n={}){Le(this,"ws",null);Le(this,"options");Le(this,"state","IDLE");Le(this,"seq",0);Le(this,"chunkReassembler",new XD);Le(this,"reconnectAttempts",0);Le(this,"reconnectTimer",null);Le(this,"heartbeatTimer",null);Le(this,"messageHandlers",new Set);Le(this,"stateChangeHandlers",new Set);Le(this,"errorHandlers",new Set);Le(this,"pendingMessages",[]);Le(this,"maxPendingMessages",100);this.options={...oN,...n}}setState(n){if(this.state!==n){console.log(`[borsh-client] State: ${this.state} -> ${n}`),this.state=n;for(const a of this.stateChangeHandlers)try{a(n)}catch(i){console.error("[borsh-client] State change handler error:",i)}n==="READY"&&this.flushPendingMessages()}}getState(){return this.state}isReady(){return this.state==="READY"}onMessage(n){return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}onStateChange(n){return this.stateChangeHandlers.add(n),()=>this.stateChangeHandlers.delete(n)}onError(n){return this.errorHandlers.add(n),()=>this.errorHandlers.delete(n)}connect(){var n,a;if(!(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN||((a=this.ws)==null?void 0:a.readyState)===WebSocket.CONNECTING)){this.setState("WS_CONNECTING");try{this.ws=new WebSocket(iN),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.sendHello()},this.ws.onmessage=i=>{this.handleMessage(i.data)},this.ws.onclose=()=>{this.handleClose()},this.ws.onerror=()=>{this.handleError(new Error("WebSocket error"))}}catch(i){this.handleError(i instanceof Error?i:new Error(String(i)))}}}disconnect(){this.setState("CLOSED"),this.clearTimers(),this.ws&&(this.ws.close(),this.ws=null)}handleMessage(n){if(typeof n=="string")return;const a=new Uint8Array(n);if(!qD(a)){console.warn("[borsh-client] Received message without magic, ignoring");return}try{const i=FD(a);if(i.kind===XA){const s=VD(i.payload),l=this.chunkReassembler.addChunk(s);l&&this.dispatchMessage({kind:l.kind,seq:l.seq,payload:l.payload});return}if(i.kind===EA){this.handleHelloS2C(i.payload);return}if(i.kind===TA)return;this.dispatchMessage({kind:i.kind,seq:i.seq,payload:i.payload})}catch(i){console.error("[borsh-client] Failed to decode message:",i)}}dispatchMessage(n){for(const a of this.messageHandlers)try{a(n)}catch(i){console.error("[borsh-client] Message handler error:",i)}}handleHelloS2C(n){try{const a=ro(sD,n);console.log("[borsh-client] HELLO_S2C received:",a),this.setState("READY"),this.startHeartbeat(),this.reconnectAttempts=0}catch(a){console.error("[borsh-client] Failed to decode HELLO_S2C:",a),this.handleError(new Error("HELLO negotiation failed"))}}handleClose(){this.stopHeartbeat(),this.state!=="CLOSED"&&(this.reconnectAttempts<this.options.maxReconnectAttempts?this.scheduleReconnect():(this.setState("CLOSED"),this.handleError(new Error("Max reconnection attempts reached"))))}handleError(n){console.error("[borsh-client] Error:",n);for(const a of this.errorHandlers)try{a(n)}catch(i){console.error("[borsh-client] Error handler error:",i)}}sendHello(){const n={clientImpl:this.options.clientImpl,clientVersion:this.options.clientVersion,maxFrameBytes:this.options.maxFrameBytes,supportsCompression:!1,supportsDiffSnapshot:!1},a=yr(oD,n),i=this.nextSeq(),s=rf(xA,a,i);this.sendRaw(s),this.setState("HELLO_NEGOTIATING")}send(n,a){if(!this.isReady())return this.pendingMessages.length<this.maxPendingMessages&&this.pendingMessages.push({kind:n,payload:a}),!1;const i=this.nextSeq(),s=KD(a,n,i,{maxFrameBytes:this.options.maxFrameBytes,chunkStreamId:QD()});if(s.totalChunks===0){const l=rf(n,a,i);this.sendRaw(l)}else for(const l of s.chunks){const u=YD(l,this.nextSeq());this.sendRaw(u)}return!0}sendRaw(n){var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(n)}flushPendingMessages(){for(;this.pendingMessages.length>0;){const n=this.pendingMessages.shift();n&&this.send(n.kind,n.payload)}}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.sendPing()},this.options.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}sendPing(){if(!this.isReady())return;const n={nonce:Math.floor(Math.random()*4294967295),timeMs:BigInt(Date.now())},a=yr(lD,n),i=this.nextSeq(),s=rf(RA,a,i);this.sendRaw(s)}scheduleReconnect(){if(this.reconnectTimer)return;this.reconnectAttempts++,this.setState("RECONNECT_BACKOFF");const n=Math.min(this.options.reconnectDelayMs*2**(this.reconnectAttempts-1),3e4);console.log(`[borsh-client] Reconnecting in ${n}ms (attempt ${this.reconnectAttempts})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat()}nextSeq(){return this.seq=(this.seq+1)%4294967295,this.seq}}let gm=null;function dr(){return gm||(gm=new sN),gm}class lN{constructor(n={}){Le(this,"transactions",new Map);Le(this,"outputGates",new Map);Le(this,"deferredResets",new Set);Le(this,"deferredHistories",new Map);Le(this,"deferredFlushes",new Map);Le(this,"deferredOutputs",new Map);Le(this,"callbacks");Le(this,"ackTimeoutMs",1500);Le(this,"liveResumeTimeoutMs",2e3);Le(this,"timers",new Map);this.callbacks=n}setCallbacks(n){this.callbacks=n;for(const a of this.transactions.keys())this.replayDeferred(a);for(const a of this.deferredResets)this.replayDeferred(a);for(const a of this.deferredHistories.keys())this.replayDeferred(a);for(const a of this.deferredFlushes.keys())this.replayDeferred(a);for(const a of this.deferredOutputs.keys())this.replayDeferred(a)}getTransaction(n){return this.transactions.get(n)}getState(n){var a;return((a=this.transactions.get(n))==null?void 0:a.state)??"STABLE"}isStable(n){return this.getState(n)==="STABLE"}isBuffering(n){var a;return((a=this.outputGates.get(n))==null?void 0:a.state)==="BUFFERING"}dispatch(n){switch(n.type){case"SELECT_START":this.handleSelectStart(n);break;case"SWITCH_ACK":this.handleSwitchAck(n);break;case"HISTORY":this.handleHistory(n);break;case"LIVE_RESUME":this.handleLiveResume(n);break;case"OUTPUT":this.handleOutput(n);break;case"SELECT_FAILED":this.handleSelectFailed(n);break}}handleSelectStart(n){const{deviceId:a,windowId:i,paneId:s,selectToken:l,wantHistory:u}=n;this.cancelTransaction(a),this.clearDeferred(a);const f={state:"SELECTING",deviceId:a,windowId:i,paneId:s,selectToken:new Uint8Array(l),wantHistory:u,startedAt:Date.now()};this.transactions.set(a,f),this.startOutputBuffering(a),this.setTimer(a,()=>{this.handleTimeout(a,"ack")},this.ackTimeoutMs)}handleSwitchAck(n){const{deviceId:a,selectToken:i}=n,s=this.transactions.get(a);!s||!this.validateToken(s.selectToken,i)||s.state==="SELECTING"&&(this.clearTimer(a),s.state="ACKED",this.callbacks.onResetTerminal?this.callbacks.onResetTerminal(a):this.deferredResets.add(a),this.setTimer(a,()=>{this.handleTimeout(a,"live")},this.liveResumeTimeoutMs))}handleHistory(n){const{deviceId:a,selectToken:i,data:s}=n,l=this.transactions.get(a);!l||!this.validateToken(l.selectToken,i)||l.state==="ACKED"&&(l.state="HISTORY_APPLIED",this.callbacks.onApplyHistory?this.callbacks.onApplyHistory(a,s,n.alternateScreen):this.deferredHistories.set(a,{data:s,alternateScreen:n.alternateScreen}),this.setTimer(a,()=>{this.handleTimeout(a,"live")},this.liveResumeTimeoutMs))}handleLiveResume(n){const{deviceId:a,selectToken:i}=n,s=this.transactions.get(a);if(!s||!this.validateToken(s.selectToken,i)||s.state!=="ACKED"&&s.state!=="HISTORY_APPLIED")return;this.clearTimer(a),s.state="LIVE";const l=this.stopOutputBuffering(a);this.completeTransaction(a),this.callbacks.onFlushBuffer?this.callbacks.onFlushBuffer(a,l):l.length>0&&this.deferredFlushes.set(a,l),this.replayDeferred(a)}handleOutput(n){const{deviceId:a,paneId:i,data:s}=n,l=this.transactions.get(a);if(l&&l.paneId!==i)return;if(this.isBuffering(a)){this.bufferOutput(a,s);return}if(this.callbacks.onOutput){this.callbacks.onOutput(a,i,s);return}const u=this.deferredOutputs.get(a)??[];u.push({paneId:i,data:new Uint8Array(s)}),this.deferredOutputs.set(a,u)}handleSelectFailed(n){const{deviceId:a}=n;this.failTransaction(a)}handleTimeout(n,a){console.warn(`[select-sm] Timeout at ${a} for ${n}`),this.failTransaction(n)}completeTransaction(n){const a=this.transactions.get(n);a&&(a.state="STABLE",this.transactions.delete(n))}failTransaction(n){var i,s;const a=this.transactions.get(n);a&&(a.state="SELECT_FAILED",this.stopOutputBuffering(n),(s=(i=this.callbacks).onSelectFailed)==null||s.call(i,n),this.transactions.delete(n),this.clearTimer(n),this.clearDeferred(n))}cancelTransaction(n){this.transactions.get(n)&&(this.stopOutputBuffering(n),this.transactions.delete(n),this.clearTimer(n),this.clearDeferred(n))}startOutputBuffering(n){this.outputGates.set(n,{state:"BUFFERING",buffer:[]})}stopOutputBuffering(n){const a=this.outputGates.get(n);if(!a)return[];const i=[...a.buffer];return this.outputGates.delete(n),i}bufferOutput(n,a){const i=this.outputGates.get(n);i&&(i.buffer.length>=1e3&&i.buffer.shift(),i.buffer.push(new Uint8Array(a)))}validateToken(n,a){if(n.length!==a.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==a[i])return!1;return!0}replayDeferred(n){var l,u;this.deferredResets.has(n)&&(this.deferredResets.delete(n),(u=(l=this.callbacks).onResetTerminal)==null||u.call(l,n));const a=this.deferredHistories.get(n);a!==void 0&&this.callbacks.onApplyHistory&&(this.callbacks.onApplyHistory(n,a.data,a.alternateScreen),this.deferredHistories.delete(n));const i=this.deferredFlushes.get(n);i&&this.callbacks.onFlushBuffer&&(this.callbacks.onFlushBuffer(n,i),this.deferredFlushes.delete(n));const s=this.deferredOutputs.get(n);if(s&&this.callbacks.onOutput){for(const f of s)this.callbacks.onOutput(n,f.paneId,f.data);this.deferredOutputs.delete(n)}}clearDeferred(n){this.deferredResets.delete(n),this.deferredHistories.delete(n),this.deferredFlushes.delete(n),this.deferredOutputs.delete(n)}setTimer(n,a,i){this.clearTimer(n);const s=setTimeout(a,i);this.timers.set(n,s)}clearTimer(n){const a=this.timers.get(n);a&&(clearTimeout(a),this.timers.delete(n))}cleanup(n){this.cancelTransaction(n),this.outputGates.delete(n),this.clearDeferred(n)}cleanupAll(){for(const n of this.transactions.keys())this.cleanup(n);this.transactions.clear(),this.outputGates.clear(),this.deferredResets.clear(),this.deferredHistories.clear(),this.deferredFlushes.clear(),this.deferredOutputs.clear();for(const n of this.timers.values())clearTimeout(n);this.timers.clear()}}let Nl=null;function Jl(t){return Nl?(t&&Nl.setCallbacks(t),Nl):(Nl=new lN(t),Nl)}function cN(){return crypto.getRandomValues(new Uint8Array(16))}function _x(t){const n=yr(cD,{deviceId:t});return{kind:OA,payload:n}}function uN(t){const n=yr(fD,{deviceId:t});return{kind:AA,payload:n}}function fN(t){const n=yr(mD,{deviceId:t.deviceId,windowId:t.windowId??null,paneId:t.paneId??null,selectToken:t.selectToken,wantHistory:t.wantHistory,cols:t.cols??null,rows:t.rows??null});return{kind:_A,payload:n}}function dN(t,n){const a=yr(pD,{deviceId:t,windowId:n});return{kind:kA,payload:a}}function hN(t,n){const a=yr(gD,{deviceId:t,name:n??null});return{kind:LA,payload:a}}function mN(t,n){const a=yr(yD,{deviceId:t,windowId:n});return{kind:zA,payload:a}}function pN(t,n){const a=yr(vD,{deviceId:t,paneId:n});return{kind:UA,payload:a}}function gN(t,n,a,i=!1){const s=new TextEncoder,l=yr(SD,{deviceId:t,paneId:n,encoding:2,data:s.encode(a),isComposing:i});return{kind:BA,payload:l}}function yN(t,n,a){const i=new TextEncoder,s=yr(wD,{deviceId:t,paneId:n,encoding:2,data:i.encode(a),isComposing:!1});return{kind:PA,payload:s}}function vN(t,n,a,i){const s=yr(Dx,{deviceId:t,paneId:n,cols:a,rows:i});return{kind:IA,payload:s}}function bN(t,n,a,i){const s=yr(xD,{deviceId:t,paneId:n,cols:a,rows:i});return{kind:FA,payload:s}}const vS=t=>{let n;const a=new Set,i=(h,y)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const b=n;n=y??(typeof p!="object"||p===null)?p:Object.assign({},n,p),a.forEach(v=>v(n,b))}},s=()=>n,f={setState:i,getState:s,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=n=t(i,s,f);return f},SN=(t=>t?vS(t):vS),wN=t=>t;function xN(t,n=wN){const a=Se.useSyncExternalStore(t.subscribe,Se.useCallback(()=>n(t.getState()),[t,n]),Se.useCallback(()=>n(t.getInitialState()),[t,n]));return Se.useDebugValue(a),a}const bS=t=>{const n=SN(t),a=i=>xN(n,i);return Object.assign(a,n),a},Vp=(t=>t?bS(t):bS),ym={siteName:"tmex",siteUrl:typeof window<"u"?window.location.origin:"http://localhost:9663",bellThrottleSeconds:6,notificationThrottleSeconds:3,enableBrowserBellToast:!0,enableBrowserNotificationToast:!0,enableTelegramBellPush:!0,enableTelegramNotificationPush:!0,sshReconnectMaxRetries:2,sshReconnectDelaySeconds:10,language:Yp,updatedAt:new Date(0).toISOString()};async function SS(){const t=await fetch("/api/settings/site");if(!t.ok)throw new Error("Failed to load site settings");return(await t.json()).settings}const ec=Vp((t,n)=>({settings:null,loading:!1,fetchSettings:async()=>{const a=n().settings;if(a)return a;t({loading:!0});try{const i=await SS();return t({settings:i,loading:!1}),An.changeLanguage(i.language),i}catch(i){return console.error("[site] failed to fetch settings:",i),t({settings:ym,loading:!1}),An.changeLanguage(ym.language),ym}},refreshSettings:async()=>{t({loading:!0});try{const a=await SS();return t({settings:a,loading:!1}),An.changeLanguage(a.language),a}catch(a){throw console.error("[site] failed to refresh settings:",a),t({loading:!1}),a}}}));function EN(t){const n=typeof t.windowIndex=="number"?`Window ${t.windowIndex}`:typeof t.windowId=="string"&&t.windowId?`Window ${t.windowId}`:"",a=typeof t.paneIndex=="number"?`Pane ${t.paneIndex}`:typeof t.paneId=="string"&&t.paneId?`Pane ${t.paneId}`:"";return[n,a].filter(Boolean).join(" · ")}function RN(t){const n=typeof t.title=="string"&&t.title?t.title:"Terminal Notification",a=EN(t),i=typeof t.body=="string"&&t.body?t.body:typeof t.source=="string"&&t.source?`From ${t.source}`:"Terminal notification";return{title:n,description:a?`${a}
|
|
85
|
+
時間:{{time}}`,botNotFound:"Bot が見つからないか利用できません",botNotRunning:"Bot が起動していないか利用できません"},webhook:{title:"Webhooks",url:"Webhook URL",secret:"シークレット",secretPlaceholder:"署名に使用(HMAC-SHA256)",enabled:"有効",eventMask:"イベント",add:"Webhook を追加",empty:"Webhook がありません。",createFailed:"Webhook の作成に失敗しました",deleteFailed:"Webhook の削除に失敗しました",loadFailed:"Webhook の読み込みに失敗しました"},sshError:{sshConfigRefNotSupported:"このバージョンでは SSH Config 参照はサポートされていません。host + username を使用し、Agent/秘密鍵/パスワード認証を選択してください。",configRefNotSupported:"このバージョンでは SSH Config 参照はサポートされていません。host + username を使用し、Agent/秘密鍵/パスワード認証を選択してください。",agentUnavailable:"SSH Agent が利用できません:SSH_AUTH_SOCK が検出されません。agent 環境を確認してください。",agentNoIdentity:"SSH Agent に利用可能な鍵がありません。ssh-add を実行してください。",agentNoIdentities:"SSH Agent に利用可能な鍵がありません。ssh-add を実行してください。",authFailed:"認証に失敗しました:ユーザー名、パスワード、または鍵が正しくありません。デバイス設定を確認してください。",authFailedGeneric:"認証に失敗しました:ユーザー名、パスワード、または鍵が正しくありません。デバイス設定を確認してください。",networkUnreachable:"ネットワークに到達できません:ルーティング、ファイアウォール、または VPN 設定を確認してください。",connectionRefused:"接続が拒否されました:ターゲットホストに接続できません。ホストアドレスとポートを確認してください。",timeout:"接続タイムアウト:デバイスに接続できません。ネットワークまたはファイアウォール設定を確認してください。",connectionTimeout:"接続タイムアウト:デバイスに接続できません。ネットワークまたはファイアウォール設定を確認してください。",hostNotFound:"ホストが見つかりません:ホスト名を解決できません。DNS またはホスト名設定を確認してください。",handshakeFailed:"ハンドシェイクに失敗しました:安全な接続を確立できません。キー交換アルゴリズムが互換性がない可能性があります。",tmuxUnavailable:"リモート tmux が利用できないか起動に失敗しました。tmux がインストールされ、リモート shell の PATH から参照できることを確認してください。",connectionClosed:"接続が切断されました。再接続を試みています",unknown:"接続に失敗しました:{{message}}",reconnecting:"接続が中断されました。{{delay}} 秒後に再接続します({{attempt}}/{{maxRetries}})",reconnectFailed:"自動再接続に失敗しました。手動で再試行してください",reconnected:"デバイスが自動的に再接続されました"},deviceStatus:{reconnecting:"再接続中 {{delay}}s",offline:"オフライン",errorBadge:{authFailed:"認証失敗",agentUnavailable:"Agent 利用不可",agentNoIdentity:"Agent に鍵なし",configRefNotSupported:"SSH Config 非対応",networkUnreachable:"ネットワーク不可達",connectionRefused:"接続拒否",timeout:"タイムアウト",hostNotFound:"ホスト未検出",handshakeFailed:"ハンドシェイク失敗",tmuxUnavailable:"tmux 利用不可",connectionClosed:"切断",unknown:"接続エラー"}},websocket:{error:"WebSocket 接続エラー",checkGateway:"Gateway 状態を確認してください",upgradeFailed:"アップグレードに失敗しました",invalidMessage:"無効なメッセージ形式"},wsError:{checkGateway:"Gateway 状態を確認してください"},apiError:{siteNameRequired:"サイト名は空にできません",siteUrlInvalid:"サイト URL は http:// または https:// で始まる必要があります",bellThrottleInvalid:"ベル制限秒数は 0-300 の間である必要があります",sshRetriesInvalid:"SSH 再接続試行回数は 0-20 の間である必要があります",sshDelayInvalid:"SSH 再接続待機時間は 1-300 秒の間である必要があります",languageInvalid:"言語はサポートされているロケールのいずれかである必要があります",botNameRequired:"Bot 名は空にできません",botTokenRequired:"Bot token は空にできません",missingFields:"必須フィールドがありません",sshRequiresHost:"SSH デバイスには host または sshConfigRef が必要です",invalidRequest:"無効なリクエスト",deviceNotFound:"デバイスが見つかりません",botNotFound:"Bot が見つかりません",chatNotFound:"チャットが見つかりません",urlAndSecretRequired:"URL とシークレットが必要です",notFound:"見つかりません"},notification:{clickToJump:"対応するペインにジャンプ",eventType:{terminal_bell:"🔔 ターミナルベル",terminal_notification:"🔔 ターミナル通知",tmux_window_close:"🪟 ウィンドウ閉じる",tmux_pane_close:"📱 ペイン閉じる",device_tmux_missing:"⚠️ Tmux がありません",device_disconnect:"🔌 デバイス切断",session_created:"🆕 セッション作成",session_closed:"🚪 セッション閉じる"},site:"サイト",device:"デバイス",window:"ウィンドウ",pane:"ペイン",time:"時間",directLink:"直接リンク",message:"メッセージ",telegramBell:{title:"🔔 {{siteName}} からのベル:{{terminalTopbarLabel}}",viewLink:"表示",terminalTopbarLabel:"ウィンドウ {{window}} · ペイン {{pane}} @ {{device}}"},telegramNotification:{}},sidebar:{noWindows:"ウィンドウがありません",noDevices:"デバイスがありません",addDeviceLink:"デバイスを追加",openSettingsLink:"設定を開く",openSettings:"設定を開く",manageDevices:"デバイス管理",settings:"設定",currentWindow:"現在のウィンドウ",currentPane:"現在のペイン",newWindow:"ウィンドウを作成",closeWindow:"ウィンドウを閉じる",closePane:"ペインを閉じる",addDevice:"デバイスを追加"},window:{noWindows:"ウィンドウがありません",new:"新規ウィンドウ"},validation:{deviceNameRequired:"デバイス名は必須です",hostRequired:"SSH デバイスにはホストアドレスが必要です"}}}},Yp="en_US",cH={locales:[{code:"en_US",name:"English",nativeName:"English",flag:"🇺🇸",isDefault:!0},{code:"zh_CN",name:"简体中文",nativeName:"简体中文",flag:"🇨🇳",isDefault:!1},{code:"ja_JP",name:"日本語",nativeName:"日本語",flag:"🇯🇵",isDefault:!1}]};function yA(t){return t.replace("_","-")}var hm={},eo={},to={},hS;function vA(){if(hS)return to;hS=1,Object.defineProperty(to,"__esModule",{value:!0}),to.BinaryReader=to.BinaryWriter=void 0;class t{constructor(i=1024){Le(this,"buffer");Le(this,"view");Le(this,"offset",0);this.buffer=new Uint8Array(i),this.view=new DataView(this.buffer.buffer)}ensureCapacity(i){const s=this.offset+i;if(s<=this.buffer.length)return;let l=this.buffer.length;for(;l<s;)l*=2;const u=new Uint8Array(l);u.set(this.buffer),this.buffer=u,this.view=new DataView(this.buffer.buffer)}writeUint8(i){this.ensureCapacity(1),this.view.setUint8(this.offset,i),this.offset+=1}writeUint16(i){this.ensureCapacity(2),this.view.setUint16(this.offset,i,!0),this.offset+=2}writeUint32(i){this.ensureCapacity(4),this.view.setUint32(this.offset,i,!0),this.offset+=4}writeUint64(i){this.ensureCapacity(8),this.view.setBigUint64(this.offset,i,!0),this.offset+=8}writeUint128(i){this.ensureCapacity(16);const s=i&BigInt("0xFFFFFFFFFFFFFFFF"),l=i>>BigInt(64);this.writeUint64(s),this.writeUint64(l)}writeInt8(i){this.ensureCapacity(1),this.view.setInt8(this.offset,i),this.offset+=1}writeInt16(i){this.ensureCapacity(2),this.view.setInt16(this.offset,i,!0),this.offset+=2}writeInt32(i){this.ensureCapacity(4),this.view.setInt32(this.offset,i,!0),this.offset+=4}writeInt64(i){this.ensureCapacity(8),this.view.setBigInt64(this.offset,i,!0),this.offset+=8}writeInt128(i){this.ensureCapacity(16);const s=i&BigInt("0xFFFFFFFFFFFFFFFF"),l=i>>BigInt(64);this.writeInt64(s),this.writeInt64(l)}writeFloat32(i){this.ensureCapacity(4),this.view.setFloat32(this.offset,i,!0),this.offset+=4}writeFloat64(i){this.ensureCapacity(8),this.view.setFloat64(this.offset,i,!0),this.offset+=8}writeBool(i){this.writeUint8(i?1:0)}writeString(i){const s=new TextEncoder().encode(i);this.writeUint32(s.length),this.ensureCapacity(s.length),this.buffer.set(s,this.offset),this.offset+=s.length}getBuffer(){return this.buffer.slice(0,this.offset)}}to.BinaryWriter=t;class n{constructor(i){Le(this,"buffer");Le(this,"view");Le(this,"offset",0);this.buffer=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength)}readUint8(){const i=this.view.getUint8(this.offset);return this.offset+=1,i}readUint16(){const i=this.view.getUint16(this.offset,!0);return this.offset+=2,i}readUint32(){const i=this.view.getUint32(this.offset,!0);return this.offset+=4,i}readUint64(){const i=this.view.getBigUint64(this.offset,!0);return this.offset+=8,i}readUint128(){const i=this.readUint64();return this.readUint64()<<BigInt(64)|i}readInt8(){const i=this.view.getInt8(this.offset);return this.offset+=1,i}readInt16(){const i=this.view.getInt16(this.offset,!0);return this.offset+=2,i}readInt32(){const i=this.view.getInt32(this.offset,!0);return this.offset+=4,i}readInt64(){const i=this.view.getBigInt64(this.offset,!0);return this.offset+=8,i}readInt128(){const i=this.readUint64();return this.readInt64()<<BigInt(64)|i}readFloat32(){const i=this.view.getFloat32(this.offset,!0);return this.offset+=4,i}readFloat64(){const i=this.view.getFloat64(this.offset,!0);return this.offset+=8,i}readBool(){return!!this.readUint8()}readString(){const i=this.readUint32(),s=this.buffer.slice(this.offset,this.offset+i);return this.offset+=i,new TextDecoder().decode(s)}getOffset(){return this.offset}}return to.BinaryReader=n,to}var mm={},mS;function bA(){return mS||(mS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.registry=t.TypeRegistry=void 0;class n{constructor(){Le(this,"handlers",new Map)}register(i,s){this.handlers.set(i,s)}getHandler(i){const s=this.handlers.get(i);if(!s)throw new Error(`No handler registered for type: ${i}`);return s}}t.TypeRegistry=n,t.registry=new n,t.registry.register("u8",{write:(a,i)=>{if(i<0||i>255||!Number.isInteger(i))throw new Error("Value out of range for u8");a.writeUint8(i)},read:a=>a.readUint8()}),t.registry.register("u16",{write:(a,i)=>{if(i<0||i>65535||!Number.isInteger(i))throw new Error("Value out of range for u16");a.writeUint16(i)},read:a=>a.readUint16()}),t.registry.register("u32",{write:(a,i)=>{if(i<0||i>4294967295||!Number.isInteger(i))throw new Error("Value out of range for u32");a.writeUint32(i)},read:a=>a.readUint32()}),t.registry.register("u64",{write:(a,i)=>{if(i<0n||i>18446744073709551615n)throw new Error("Value out of range for u64");a.writeUint64(i)},read:a=>a.readUint64()}),t.registry.register("u128",{write:(a,i)=>{if(i<0n||i>340282366920938463463374607431768211455n)throw new Error("Value out of range for u128");a.writeUint128(i)},read:a=>a.readUint128()}),t.registry.register("i8",{write:(a,i)=>{if(i<-128||i>127||!Number.isInteger(i))throw new Error("Value out of range for i8");a.writeInt8(i)},read:a=>a.readInt8()}),t.registry.register("i16",{write:(a,i)=>{if(i<-32768||i>32767||!Number.isInteger(i))throw new Error("Value out of range for i16");a.writeInt16(i)},read:a=>a.readInt16()}),t.registry.register("i32",{write:(a,i)=>{if(i<-2147483648||i>2147483647||!Number.isInteger(i))throw new Error("Value out of range for i32");a.writeInt32(i)},read:a=>a.readInt32()}),t.registry.register("i64",{write:(a,i)=>{if(i<-9223372036854775808n||i>9223372036854775807n)throw new Error("Value out of range for i64");a.writeInt64(i)},read:a=>a.readInt64()}),t.registry.register("i128",{write:(a,i)=>{if(i<-170141183460469231731687303715884105728n||i>170141183460469231731687303715884105727n)throw new Error("Value out of range for i128");a.writeInt128(i)},read:a=>a.readInt128()}),t.registry.register("f32",{write:(a,i)=>a.writeFloat32(i),read:a=>a.readFloat32()}),t.registry.register("f64",{write:(a,i)=>{if(Number.isNaN(i))throw new Error("For portability reasons we do not allow serializing NaN values.");a.writeFloat64(i)},read:a=>a.readFloat64()}),t.registry.register("bool",{write:(a,i)=>a.writeBool(i),read:a=>a.readBool()}),t.registry.register("string",{write:(a,i)=>a.writeString(i),read:a=>a.readString()}),t.registry.register("unit",{write:()=>{},read:()=>({})}),t.registry.register("struct",{write:(a,i,s)=>{if(s)for(const[l,u]of Object.entries(s))t.registry.getHandler(u.type).write(a,i[l],u.options)},read:(a,i)=>{if(!i)return{};const s={};for(const[l,u]of Object.entries(i)){const f=t.registry.getHandler(u.type);s[l]=f.read(a,u.options)}return s}}),t.registry.register("vec",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u}=s,f=(ArrayBuffer.isView(i),i.length);a.writeUint32(f);const m=t.registry.getHandler(l);if(ArrayBuffer.isView(i))for(let h=0;h<f;h++)m.write(a,i[h],u);else for(const h of i)m.write(a,h,u)},read:(a,i)=>{if(!i)return[];const{elementType:s,elementOptions:l}=i,u=a.readUint32(),f=t.registry.getHandler(s),m=Array.from({length:u},()=>f.read(a,l));switch(s){case"u8":return new Uint8Array(m);case"u16":return new Uint16Array(m);case"u32":return new Uint32Array(m);case"i8":return new Int8Array(m);case"i16":return new Int16Array(m);case"i32":return new Int32Array(m);case"i64":return new BigInt64Array(m);case"f32":return new Float32Array(m);case"f64":return new Float64Array(m);default:return m}}}),t.registry.register("set",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u}=s,f=Array.from(i).sort();a.writeUint32(f.length);const m=t.registry.getHandler(l);for(const h of f)m.write(a,h,u)},read:(a,i)=>{if(!i)return new Set;const{elementType:s,elementOptions:l}=i,u=a.readUint32(),f=t.registry.getHandler(s),m=Array.from({length:u},()=>f.read(a,l));return new Set(m)}}),t.registry.register("map",{write:(a,i,s)=>{if(!s)return;const{keyType:l,keyOptions:u,valueType:f,valueOptions:m}=s,h=Array.from(i.entries()).sort();a.writeUint32(h.length);const y=t.registry.getHandler(l),p=t.registry.getHandler(f);for(const[b,v]of h)y.write(a,b,u),p.write(a,v,m)},read:(a,i)=>{if(!i)return new Map;const{keyType:s,keyOptions:l,valueType:u,valueOptions:f}=i,m=a.readUint32(),h=t.registry.getHandler(s),y=t.registry.getHandler(u),p=Array.from({length:m},()=>{const b=h.read(a,l),v=y.read(a,f);return[b,v]});return new Map(p)}}),t.registry.register("option",{write:(a,i,s)=>{if(!s)return;const{valueType:l,valueOptions:u}=s,f=i!==null;a.writeUint8(f?1:0),f&&t.registry.getHandler(l).write(a,i,u)},read:(a,i)=>{if(!i)return null;const{valueType:s,valueOptions:l}=i;return a.readUint8()===1?t.registry.getHandler(s).read(a,l):null}}),t.registry.register("enum",{write:(a,i,s)=>{if(!s)return;const l=Object.keys(i)[0],u=i[l],f=s.variants.find(m=>m.name===l);if(!f)throw new Error(`Unknown enum variant: ${l}`);a.writeUint8(f.index),f.type!=="unit"&&t.registry.getHandler(f.type).write(a,u,f.options)},read:(a,i)=>{if(!i)return{};const s=a.readUint8(),l=i.variants.find(m=>m.index===s);if(!l)throw new Error(`Unknown enum variant index: ${s}`);if(l.type==="unit")return{[l.name]:{}};const f=t.registry.getHandler(l.type).read(a,l.options);return{[l.name]:f}}}),t.registry.register("tuple",{write:(a,i,s)=>{if(s){if(i.length!==s.length)throw new Error(`Tuple length mismatch: expected ${s.length}, got ${i.length}`);for(let l=0;l<s.length;l++){const u=s[l];if(!u)throw new Error(`Missing type information for tuple element at index ${l}`);t.registry.getHandler(u.type).write(a,i[l],u.options)}}},read:(a,i)=>{if(!i)return[];const s=[];for(const l of i){const u=t.registry.getHandler(l.type);s.push(u.read(a,l.options))}return s}}),t.registry.register("array",{write:(a,i,s)=>{if(!s)return;const{elementType:l,elementOptions:u,length:f}=s;if(i.length!==f)throw new Error(`Array length mismatch: expected ${f}, got ${i.length}`);const m=t.registry.getHandler(l);for(const h of i)m.write(a,h,u)},read:(a,i)=>{if(!i)return[];const{elementType:s,elementOptions:l,length:u}=i,f=t.registry.getHandler(s);return Array.from({length:u},()=>f.read(a,l))}}),t.registry.register("bytes",{write:(a,i,s)=>{const l=i.length;if((s==null?void 0:s.length)!=null){if(l!==s.length)throw new Error(`Bytes length mismatch: expected ${s.length}, got ${l}`);for(let u=0;u<l;u++)a.writeUint8(i[u])}else{a.writeUint32(l);for(let u=0;u<l;u++)a.writeUint8(i[u])}},read:(a,i)=>{const s=(i==null?void 0:i.length)!=null?i.length:a.readUint32(),l=new Uint8Array(s);for(let u=0;u<s;u++)l[u]=a.readUint8();return l}}),t.registry.register("nativeEnum",{write:(a,i,s)=>{if(!s)return;const{valueToIndexMap:l}=s,u=i,f=l.get(u);if(f===void 0)throw new Error(`Invalid enum value: ${String(i)}`);a.writeUint8(f)},read:(a,i)=>{if(!i)return null;const{indexToValueMap:s}=i,l=a.readUint8(),u=s.get(l);if(u===void 0)throw new Error(`Invalid enum index: ${l}`);return u}})})(mm)),mm}var pS;function SA(){if(pS)return eo;pS=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.b=eo.Schema=void 0;const t=vA(),n=bA();class a{constructor(s,l,u){Le(this,"type");Le(this,"options");Le(this,"registry");this.type=s,this.options=l,this.registry=u}serialize(s){const l=new t.BinaryWriter;return this.registry.getHandler(this.type).write(l,s,this.options),l.getBuffer()}deserialize(s){const l=new t.BinaryReader(s);return this.registry.getHandler(this.type).read(l,this.options)}}return eo.Schema=a,eo.b={u8:()=>new a("u8",null,n.registry),u16:()=>new a("u16",null,n.registry),u32:()=>new a("u32",null,n.registry),u64:()=>new a("u64",null,n.registry),u128:()=>new a("u128",null,n.registry),i8:()=>new a("i8",null,n.registry),i16:()=>new a("i16",null,n.registry),i32:()=>new a("i32",null,n.registry),i64:()=>new a("i64",null,n.registry),i128:()=>new a("i128",null,n.registry),f32:()=>new a("f32",null,n.registry),f64:()=>new a("f64",null,n.registry),bool:()=>new a("bool",null,n.registry),string:()=>new a("string",null,n.registry),unit:()=>new a("unit",null,n.registry),vec:i=>new a("vec",{elementType:i.type,elementOptions:i.options},n.registry),hashSet:i=>new a("set",{elementType:i.type,elementOptions:i.options},n.registry),hashMap:(i,s)=>new a("map",{keyType:i.type,keyOptions:i.options,valueType:s.type,valueOptions:s.options},n.registry),option:i=>new a("option",{valueType:i.type,valueOptions:i.options},n.registry),array:(i,s)=>new a("array",{elementType:i.type,elementOptions:i.options,length:s},n.registry),bytes:i=>new a("bytes",i!=null?{length:i}:{},n.registry),enum:i=>{const s=Object.entries(i).map(([l,u],f)=>({index:f,name:l,type:u.type,options:u.options}));return new a("enum",{variants:s},n.registry)},struct:i=>{const s=Object.fromEntries(Object.entries(i).map(([l,u])=>[l,{type:u.type,options:u.options}]));return new a("struct",s,n.registry)},tuple:(...i)=>{const s=i.map(l=>({type:l.type,options:l.options}));return new a("tuple",s,n.registry)},nativeEnum:i=>{const s=Object.entries(i).filter(([y])=>typeof y=="string"&&Number.isNaN(Number(y))),l=s.map(([y,p])=>p),u=l.some(y=>typeof y=="string"),f=l.some(y=>typeof y=="number");if(u&&f)throw new Error("Mixed string/numeric enums are not supported");const m=new Map,h=new Map;if(s.forEach(([y,p],b)=>{m.set(p,b),h.set(b,p)}),s.length>255)throw new Error("Borsh only supports enums with up to 255 variants");return new a("nativeEnum",{enumObj:i,valueToIndexMap:m,indexToValueMap:h},n.registry)}},eo}var gS;function wA(){return gS||(gS=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Schema=t.b=void 0;var n=SA();Object.defineProperty(t,"b",{enumerable:!0,get:function(){return n.b}}),Object.defineProperty(t,"Schema",{enumerable:!0,get:function(){return n.Schema}})})(hm)),hm}var J=wA();const xA=1,EA=2,RA=3,TA=4,CA=5,OA=257,MA=258,AA=259,DA=260,NA=261,_A=513,kA=514,LA=515,zA=516,UA=517,HA=519,jA=520,BA=769,PA=770,IA=771,FA=772,YA=773,VA=774,qA=1025,GA=1026,XA=1281,KA=1001,oa=1002,QA=1003,Mx=1004,nf=1005,WA=1101,$A=1102,ZA=1201,JA=1202,eD=1301,tD=1302,nD=1401,rD={[KA]:"Unsupported protocol version",[oa]:"Invalid frame format",[QA]:"Unknown message kind",[Mx]:"Failed to decode payload",[nf]:"Frame exceeds maximum size",[WA]:"Device not found",[$A]:"Failed to connect device",[ZA]:"Tmux target not found",[JA]:"Tmux not ready",[eD]:"Select conflict",[tD]:"Select token mismatch",[nD]:"Internal server error"};function aD(t){return rD[t]??`Unknown error code: ${t}`}class mr extends Error{constructor(n,a=!1,i){super(i??aD(n)),this.code=n,this.retryable=a,this.name="WsBorshError"}}const Ax=J.b.struct({magic:J.b.bytes(2),version:J.b.u16(),kind:J.b.u16(),flags:J.b.u16(),seq:J.b.u32(),payload:J.b.bytes()}),iD=J.b.option(J.b.u32()),Ts=J.b.option(J.b.u16()),tr=J.b.option(J.b.string()),oD=J.b.struct({clientImpl:J.b.string(),clientVersion:J.b.string(),maxFrameBytes:J.b.u32(),supportsCompression:J.b.bool(),supportsDiffSnapshot:J.b.bool()}),sD=J.b.struct({serverImpl:J.b.string(),serverVersion:J.b.string(),selectedVersion:J.b.u16(),maxFrameBytes:J.b.u32(),heartbeatIntervalMs:J.b.u32(),capabilities:J.b.vec(J.b.string())}),lD=J.b.struct({nonce:J.b.u32(),timeMs:J.b.u64()});J.b.struct({refSeq:iD,code:J.b.u16(),message:J.b.string(),retryable:J.b.bool()});const cD=J.b.struct({deviceId:J.b.string()}),uD=J.b.struct({deviceId:J.b.string()}),fD=J.b.struct({deviceId:J.b.string()}),dD=J.b.struct({deviceId:J.b.string()}),hD=J.b.struct({deviceId:J.b.string(),eventType:J.b.u8(),errorType:tr,message:tr,rawMessage:tr}),mD=J.b.struct({deviceId:J.b.string(),windowId:tr,paneId:tr,selectToken:J.b.bytes(16),wantHistory:J.b.bool(),cols:Ts,rows:Ts}),pD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string()}),gD=J.b.struct({deviceId:J.b.string(),name:tr}),yD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string()}),vD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string()});J.b.struct({deviceId:J.b.string(),windowId:J.b.string(),name:J.b.string()});const bD=J.b.struct({deviceId:J.b.string(),eventType:J.b.u8(),eventData:J.b.bytes()}),SD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes(),isComposing:J.b.bool()}),wD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes(),isComposing:J.b.bool()}),Dx=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),cols:J.b.u16(),rows:J.b.u16()}),xD=Dx,ED=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),encoding:J.b.u8(),data:J.b.bytes()}),RD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16),encoding:J.b.u8(),alternateScreen:J.b.bool(),data:J.b.bytes()}),TD=J.b.struct({deviceId:J.b.string(),windowId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16)}),CD=J.b.struct({deviceId:J.b.string(),paneId:J.b.string(),selectToken:J.b.bytes(16)}),Nx=J.b.struct({chunkStreamId:J.b.u32(),originalKind:J.b.u16(),originalSeq:J.b.u32(),totalChunks:J.b.u16(),chunkIndex:J.b.u16(),data:J.b.bytes()}),OD=J.b.struct({id:J.b.string(),windowId:J.b.string(),index:J.b.u16(),title:tr,active:J.b.bool(),width:J.b.u16(),height:J.b.u16()}),MD=J.b.struct({id:J.b.string(),name:J.b.string(),index:J.b.u16(),active:J.b.bool(),panes:J.b.vec(OD)}),AD=J.b.struct({id:J.b.string(),name:J.b.string(),windows:J.b.vec(MD)}),DD=J.b.struct({deviceId:J.b.string(),session:J.b.option(AD)});J.b.struct({deviceId:J.b.string(),baseRevision:J.b.u32(),revision:J.b.u32(),diffFormat:J.b.u8(),diffBytes:J.b.bytes()});const ND=J.b.struct({windowId:J.b.string()}),_D=J.b.struct({windowId:J.b.string()}),kD=J.b.struct({windowId:J.b.string(),name:J.b.string()}),LD=J.b.struct({windowId:J.b.string()}),zD=J.b.struct({paneId:J.b.string(),windowId:J.b.string()}),UD=J.b.struct({paneId:J.b.string()}),HD=J.b.struct({windowId:J.b.string(),paneId:J.b.string()}),jD=J.b.struct({windowId:J.b.string(),layout:J.b.string()}),BD=J.b.struct({windowId:tr,paneId:tr,windowIndex:Ts,paneIndex:Ts,paneUrl:tr}),PD=J.b.struct({source:J.b.u8(),title:tr,body:J.b.string(),windowId:tr,paneId:tr,windowIndex:Ts,paneIndex:Ts,paneUrl:tr}),Zl=new Uint8Array([84,88]),ID=1;function rf(t,n,a,i=0,s=ID){const l={magic:Zl,version:s,kind:t,flags:i,seq:a,payload:n};return Ax.serialize(l)}function yr(t,n){return t.serialize(n)}function FD(t){if(t.length<12)throw new mr(oa,!1,"Envelope too small");if(t[0]!==Zl[0]||t[1]!==Zl[1])throw new mr(oa,!1,"Invalid magic bytes");try{return Ax.deserialize(t)}catch(n){throw new mr(oa,!1,n instanceof Error?n.message:"Failed to decode envelope")}}function ro(t,n){try{return t.deserialize(n)}catch(a){throw new mr(Mx,!1,a instanceof Error?a.message:"Failed to decode payload")}}function YD(t,n){const a=Nx.serialize(t);return rf(1281,a,n)}function VD(t){return Nx.deserialize(t)}function qD(t){return t.length>=2&&t[0]===Zl[0]&&t[1]===Zl[1]}const GD=5e3,yS=100,rp=1e3;class XD{constructor(){Le(this,"streams",new Map);Le(this,"lastCleanup",Date.now())}addChunk(n){if(this.cleanup(),n.totalChunks>rp)throw new mr(oa,!1,`Too many chunks: ${n.totalChunks} > ${rp}`);if(n.chunkIndex>=n.totalChunks)throw new mr(oa,!1,`Chunk index out of bounds: ${n.chunkIndex} >= ${n.totalChunks}`);let a=this.streams.get(n.chunkStreamId);if(!a){if(this.streams.size>=yS&&(this.cleanup(!0),this.streams.size>=yS))throw new mr(oa,!1,"Too many concurrent chunk streams");a={chunks:new Map,totalChunks:n.totalChunks,createdAt:Date.now(),originalKind:n.originalKind,originalSeq:n.originalSeq},this.streams.set(n.chunkStreamId,a)}if(a.totalChunks!==n.totalChunks)throw this.streams.delete(n.chunkStreamId),new mr(oa,!1,"Chunk total count mismatch");if(a.chunks.has(n.chunkIndex))throw new mr(oa,!1,`Duplicate chunk index: ${n.chunkIndex}`);return a.chunks.set(n.chunkIndex,n),a.chunks.size===a.totalChunks?this.reassemble(n.chunkStreamId,a):null}reassemble(n,a){const i=[];let s=0;for(let f=0;f<a.totalChunks;f++){const m=a.chunks.get(f);if(!m)throw this.streams.delete(n),new mr(oa,!1,`Missing chunk index: ${f}`);i.push(m.data),s+=m.data.length}const l=new Uint8Array(s);let u=0;for(const f of i)l.set(f,u),u+=f.length;return this.streams.delete(n),{kind:a.originalKind,seq:a.originalSeq,payload:l}}cleanup(n=!1){const a=Date.now();if(!n&&a-this.lastCleanup<5e3)return;this.lastCleanup=a;const i=a-GD;for(const[s,l]of this.streams)l.createdAt<i&&this.streams.delete(s)}getActiveStreamCount(){return this.streams.size}clear(){this.streams.clear()}}function KD(t,n,a,i){const{maxFrameBytes:s,chunkStreamId:l}=i,u=16,f=18,m=s-u;if(m<=0)throw new mr(nf,!1,`maxFrameBytes too small: ${s}`);if(t.length<=m)return{chunks:[],totalChunks:0};const h=s-u-f;if(h<=0)throw new mr(nf,!1,`maxFrameBytes too small for chunking: ${s}`);const y=Math.ceil(t.length/h);if(y>rp)throw new mr(nf,!1,`Too many chunks: ${y}`);const p=[];for(let b=0;b<y;b++){const v=b*h,S=Math.min(v+h,t.length);p.push({chunkStreamId:l,originalKind:n,originalSeq:a,totalChunks:y,chunkIndex:b,data:t.slice(v,S)})}return{chunks:p,totalChunks:y}}let pm=1;function QD(){const t=pm;return pm=pm%4294967295+1,t}const WD={1:"osc9",2:"osc777",3:"osc1337",4:"osc99"};function $D(t){const n=hD.deserialize(t),a={1:"tmux-missing",2:"disconnected",3:"error",4:"reconnected"};return{deviceId:n.deviceId,type:a[n.eventType]??"error",errorType:n.errorType??void 0,message:n.message??void 0,rawMessage:n.rawMessage??void 0}}function ZD(t){const n=bD.deserialize(t),i={1:"window-add",2:"window-close",3:"window-renamed",4:"window-active",5:"pane-add",6:"pane-close",7:"pane-active",8:"layout-change",9:"bell",10:"output",11:"notification"}[n.eventType];if(!i)throw new Error(`Unknown tmux event type: ${n.eventType}`);return{deviceId:n.deviceId,type:i,data:JD(i,n.eventData)}}function JD(t,n){if(n.length===0)return{};try{switch(t){case"window-add":return ND.deserialize(n);case"window-close":return _D.deserialize(n);case"window-renamed":return kD.deserialize(n);case"window-active":return LD.deserialize(n);case"pane-add":return zD.deserialize(n);case"pane-close":return UD.deserialize(n);case"pane-active":return HD.deserialize(n);case"layout-change":return jD.deserialize(n);case"bell":{const a=BD.deserialize(n);return{windowId:a.windowId??void 0,paneId:a.paneId??void 0,windowIndex:a.windowIndex??void 0,paneIndex:a.paneIndex??void 0,paneUrl:a.paneUrl??void 0}}case"notification":{const a=PD.deserialize(n);return{source:WD[a.source]??"osc9",title:a.title??void 0,body:a.body,windowId:a.windowId??void 0,paneId:a.paneId??void 0,windowIndex:a.windowIndex??void 0,paneIndex:a.paneIndex??void 0,paneUrl:a.paneUrl??void 0}}default:return{}}}catch{return{}}}function eN(t){const n=DD.deserialize(t);return{deviceId:n.deviceId,session:n.session?tN(n.session):null}}function tN(t){return{id:t.id,name:t.name,windows:t.windows.map(nN)}}function nN(t){return{id:t.id,name:t.name,index:t.index,active:t.active,panes:t.panes.map(rN)}}function rN(t){return{id:t.id,windowId:t.windowId,index:t.index,title:t.title??void 0,active:t.active,width:t.width,height:t.height}}function aN(){const t=navigator.language;return t.startsWith("zh")?"zh_CN":t.startsWith("ja")?"ja_JP":Yp}An.use(cA).init({resources:gA,lng:aN(),fallbackLng:Yp,interpolation:{escapeValue:!1},returnNull:!1});const iN=`${typeof window<"u"&&window.location.protocol==="https:"?"wss:":"ws:"}//${typeof window<"u"?window.location.host:""}/ws`,oN={clientImpl:"tmex-fe",clientVersion:"0.1.0",maxFrameBytes:1048576,reconnectDelayMs:1e3,maxReconnectAttempts:5,heartbeatIntervalMs:15e3};class sN{constructor(n={}){Le(this,"ws",null);Le(this,"options");Le(this,"state","IDLE");Le(this,"seq",0);Le(this,"chunkReassembler",new XD);Le(this,"reconnectAttempts",0);Le(this,"reconnectTimer",null);Le(this,"heartbeatTimer",null);Le(this,"messageHandlers",new Set);Le(this,"stateChangeHandlers",new Set);Le(this,"errorHandlers",new Set);Le(this,"pendingMessages",[]);Le(this,"maxPendingMessages",100);this.options={...oN,...n}}setState(n){if(this.state!==n){console.log(`[borsh-client] State: ${this.state} -> ${n}`),this.state=n;for(const a of this.stateChangeHandlers)try{a(n)}catch(i){console.error("[borsh-client] State change handler error:",i)}n==="READY"&&this.flushPendingMessages()}}getState(){return this.state}isReady(){return this.state==="READY"}onMessage(n){return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}onStateChange(n){return this.stateChangeHandlers.add(n),()=>this.stateChangeHandlers.delete(n)}onError(n){return this.errorHandlers.add(n),()=>this.errorHandlers.delete(n)}connect(){var n,a;if(!(((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN||((a=this.ws)==null?void 0:a.readyState)===WebSocket.CONNECTING)){this.setState("WS_CONNECTING");try{this.ws=new WebSocket(iN),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.sendHello()},this.ws.onmessage=i=>{this.handleMessage(i.data)},this.ws.onclose=()=>{this.handleClose()},this.ws.onerror=()=>{this.handleError(new Error("WebSocket error"))}}catch(i){this.handleError(i instanceof Error?i:new Error(String(i)))}}}disconnect(){this.setState("CLOSED"),this.clearTimers(),this.ws&&(this.ws.close(),this.ws=null)}handleMessage(n){if(typeof n=="string")return;const a=new Uint8Array(n);if(!qD(a)){console.warn("[borsh-client] Received message without magic, ignoring");return}try{const i=FD(a);if(i.kind===XA){const s=VD(i.payload),l=this.chunkReassembler.addChunk(s);l&&this.dispatchMessage({kind:l.kind,seq:l.seq,payload:l.payload});return}if(i.kind===EA){this.handleHelloS2C(i.payload);return}if(i.kind===TA)return;this.dispatchMessage({kind:i.kind,seq:i.seq,payload:i.payload})}catch(i){console.error("[borsh-client] Failed to decode message:",i)}}dispatchMessage(n){for(const a of this.messageHandlers)try{a(n)}catch(i){console.error("[borsh-client] Message handler error:",i)}}handleHelloS2C(n){try{const a=ro(sD,n);console.log("[borsh-client] HELLO_S2C received:",a),this.setState("READY"),this.startHeartbeat(),this.reconnectAttempts=0}catch(a){console.error("[borsh-client] Failed to decode HELLO_S2C:",a),this.handleError(new Error("HELLO negotiation failed"))}}handleClose(){this.stopHeartbeat(),this.state!=="CLOSED"&&(this.reconnectAttempts<this.options.maxReconnectAttempts?this.scheduleReconnect():(this.setState("CLOSED"),this.handleError(new Error("Max reconnection attempts reached"))))}handleError(n){console.error("[borsh-client] Error:",n);for(const a of this.errorHandlers)try{a(n)}catch(i){console.error("[borsh-client] Error handler error:",i)}}sendHello(){const n={clientImpl:this.options.clientImpl,clientVersion:this.options.clientVersion,maxFrameBytes:this.options.maxFrameBytes,supportsCompression:!1,supportsDiffSnapshot:!1},a=yr(oD,n),i=this.nextSeq(),s=rf(xA,a,i);this.sendRaw(s),this.setState("HELLO_NEGOTIATING")}send(n,a){if(!this.isReady())return this.pendingMessages.length<this.maxPendingMessages&&this.pendingMessages.push({kind:n,payload:a}),!1;const i=this.nextSeq(),s=KD(a,n,i,{maxFrameBytes:this.options.maxFrameBytes,chunkStreamId:QD()});if(s.totalChunks===0){const l=rf(n,a,i);this.sendRaw(l)}else for(const l of s.chunks){const u=YD(l,this.nextSeq());this.sendRaw(u)}return!0}sendRaw(n){var a;((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.ws.send(n)}flushPendingMessages(){for(;this.pendingMessages.length>0;){const n=this.pendingMessages.shift();n&&this.send(n.kind,n.payload)}}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.sendPing()},this.options.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}sendPing(){if(!this.isReady())return;const n={nonce:Math.floor(Math.random()*4294967295),timeMs:BigInt(Date.now())},a=yr(lD,n),i=this.nextSeq(),s=rf(RA,a,i);this.sendRaw(s)}scheduleReconnect(){if(this.reconnectTimer)return;this.reconnectAttempts++,this.setState("RECONNECT_BACKOFF");const n=Math.min(this.options.reconnectDelayMs*2**(this.reconnectAttempts-1),3e4);console.log(`[borsh-client] Reconnecting in ${n}ms (attempt ${this.reconnectAttempts})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopHeartbeat()}nextSeq(){return this.seq=(this.seq+1)%4294967295,this.seq}}let gm=null;function dr(){return gm||(gm=new sN),gm}class lN{constructor(n={}){Le(this,"transactions",new Map);Le(this,"outputGates",new Map);Le(this,"deferredResets",new Set);Le(this,"deferredHistories",new Map);Le(this,"deferredFlushes",new Map);Le(this,"deferredOutputs",new Map);Le(this,"callbacks");Le(this,"ackTimeoutMs",1500);Le(this,"liveResumeTimeoutMs",2e3);Le(this,"timers",new Map);this.callbacks=n}setCallbacks(n){this.callbacks=n;for(const a of this.transactions.keys())this.replayDeferred(a);for(const a of this.deferredResets)this.replayDeferred(a);for(const a of this.deferredHistories.keys())this.replayDeferred(a);for(const a of this.deferredFlushes.keys())this.replayDeferred(a);for(const a of this.deferredOutputs.keys())this.replayDeferred(a)}getTransaction(n){return this.transactions.get(n)}getState(n){var a;return((a=this.transactions.get(n))==null?void 0:a.state)??"STABLE"}isStable(n){return this.getState(n)==="STABLE"}isBuffering(n){var a;return((a=this.outputGates.get(n))==null?void 0:a.state)==="BUFFERING"}dispatch(n){switch(n.type){case"SELECT_START":this.handleSelectStart(n);break;case"SWITCH_ACK":this.handleSwitchAck(n);break;case"HISTORY":this.handleHistory(n);break;case"LIVE_RESUME":this.handleLiveResume(n);break;case"OUTPUT":this.handleOutput(n);break;case"SELECT_FAILED":this.handleSelectFailed(n);break}}handleSelectStart(n){const{deviceId:a,windowId:i,paneId:s,selectToken:l,wantHistory:u}=n;this.cancelTransaction(a),this.clearDeferred(a);const f={state:"SELECTING",deviceId:a,windowId:i,paneId:s,selectToken:new Uint8Array(l),wantHistory:u,startedAt:Date.now()};this.transactions.set(a,f),this.startOutputBuffering(a),this.setTimer(a,()=>{this.handleTimeout(a,"ack")},this.ackTimeoutMs)}handleSwitchAck(n){const{deviceId:a,selectToken:i}=n,s=this.transactions.get(a);!s||!this.validateToken(s.selectToken,i)||s.state==="SELECTING"&&(this.clearTimer(a),s.state="ACKED",this.callbacks.onResetTerminal?this.callbacks.onResetTerminal(a):this.deferredResets.add(a),this.setTimer(a,()=>{this.handleTimeout(a,"live")},this.liveResumeTimeoutMs))}handleHistory(n){const{deviceId:a,selectToken:i,data:s}=n,l=this.transactions.get(a);!l||!this.validateToken(l.selectToken,i)||l.state==="ACKED"&&(l.state="HISTORY_APPLIED",this.callbacks.onApplyHistory?this.callbacks.onApplyHistory(a,s,n.alternateScreen):this.deferredHistories.set(a,{data:s,alternateScreen:n.alternateScreen}),this.setTimer(a,()=>{this.handleTimeout(a,"live")},this.liveResumeTimeoutMs))}handleLiveResume(n){const{deviceId:a,selectToken:i}=n,s=this.transactions.get(a);if(!s||!this.validateToken(s.selectToken,i)||s.state!=="ACKED"&&s.state!=="HISTORY_APPLIED")return;this.clearTimer(a),s.state="LIVE";const l=this.stopOutputBuffering(a);this.completeTransaction(a),this.callbacks.onFlushBuffer?this.callbacks.onFlushBuffer(a,l):l.length>0&&this.deferredFlushes.set(a,l),this.replayDeferred(a)}handleOutput(n){const{deviceId:a,paneId:i,data:s}=n,l=this.transactions.get(a);if(l&&l.paneId!==i)return;if(this.isBuffering(a)){this.bufferOutput(a,s);return}if(this.callbacks.onOutput){this.callbacks.onOutput(a,i,s);return}const u=this.deferredOutputs.get(a)??[];u.push({paneId:i,data:new Uint8Array(s)}),this.deferredOutputs.set(a,u)}handleSelectFailed(n){const{deviceId:a}=n;this.failTransaction(a)}handleTimeout(n,a){console.warn(`[select-sm] Timeout at ${a} for ${n}`),this.failTransaction(n)}completeTransaction(n){const a=this.transactions.get(n);a&&(a.state="STABLE",this.transactions.delete(n))}failTransaction(n){var i,s;const a=this.transactions.get(n);a&&(a.state="SELECT_FAILED",this.stopOutputBuffering(n),(s=(i=this.callbacks).onSelectFailed)==null||s.call(i,n),this.transactions.delete(n),this.clearTimer(n),this.clearDeferred(n))}cancelTransaction(n){this.transactions.get(n)&&(this.stopOutputBuffering(n),this.transactions.delete(n),this.clearTimer(n),this.clearDeferred(n))}startOutputBuffering(n){this.outputGates.set(n,{state:"BUFFERING",buffer:[]})}stopOutputBuffering(n){const a=this.outputGates.get(n);if(!a)return[];const i=[...a.buffer];return this.outputGates.delete(n),i}bufferOutput(n,a){const i=this.outputGates.get(n);i&&(i.buffer.length>=1e3&&i.buffer.shift(),i.buffer.push(new Uint8Array(a)))}validateToken(n,a){if(n.length!==a.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==a[i])return!1;return!0}replayDeferred(n){var l,u;this.deferredResets.has(n)&&(this.deferredResets.delete(n),(u=(l=this.callbacks).onResetTerminal)==null||u.call(l,n));const a=this.deferredHistories.get(n);a!==void 0&&this.callbacks.onApplyHistory&&(this.callbacks.onApplyHistory(n,a.data,a.alternateScreen),this.deferredHistories.delete(n));const i=this.deferredFlushes.get(n);i&&this.callbacks.onFlushBuffer&&(this.callbacks.onFlushBuffer(n,i),this.deferredFlushes.delete(n));const s=this.deferredOutputs.get(n);if(s&&this.callbacks.onOutput){for(const f of s)this.callbacks.onOutput(n,f.paneId,f.data);this.deferredOutputs.delete(n)}}clearDeferred(n){this.deferredResets.delete(n),this.deferredHistories.delete(n),this.deferredFlushes.delete(n),this.deferredOutputs.delete(n)}setTimer(n,a,i){this.clearTimer(n);const s=setTimeout(a,i);this.timers.set(n,s)}clearTimer(n){const a=this.timers.get(n);a&&(clearTimeout(a),this.timers.delete(n))}cleanup(n){this.cancelTransaction(n),this.outputGates.delete(n),this.clearDeferred(n)}cleanupAll(){for(const n of this.transactions.keys())this.cleanup(n);this.transactions.clear(),this.outputGates.clear(),this.deferredResets.clear(),this.deferredHistories.clear(),this.deferredFlushes.clear(),this.deferredOutputs.clear();for(const n of this.timers.values())clearTimeout(n);this.timers.clear()}}let Nl=null;function Jl(t){return Nl?(t&&Nl.setCallbacks(t),Nl):(Nl=new lN(t),Nl)}function cN(){return crypto.getRandomValues(new Uint8Array(16))}function _x(t){const n=yr(cD,{deviceId:t});return{kind:OA,payload:n}}function uN(t){const n=yr(fD,{deviceId:t});return{kind:AA,payload:n}}function fN(t){const n=yr(mD,{deviceId:t.deviceId,windowId:t.windowId??null,paneId:t.paneId??null,selectToken:t.selectToken,wantHistory:t.wantHistory,cols:t.cols??null,rows:t.rows??null});return{kind:_A,payload:n}}function dN(t,n){const a=yr(pD,{deviceId:t,windowId:n});return{kind:kA,payload:a}}function hN(t,n){const a=yr(gD,{deviceId:t,name:n??null});return{kind:LA,payload:a}}function mN(t,n){const a=yr(yD,{deviceId:t,windowId:n});return{kind:zA,payload:a}}function pN(t,n){const a=yr(vD,{deviceId:t,paneId:n});return{kind:UA,payload:a}}function gN(t,n,a,i=!1){const s=new TextEncoder,l=yr(SD,{deviceId:t,paneId:n,encoding:2,data:s.encode(a),isComposing:i});return{kind:BA,payload:l}}function yN(t,n,a){const i=new TextEncoder,s=yr(wD,{deviceId:t,paneId:n,encoding:2,data:i.encode(a),isComposing:!1});return{kind:PA,payload:s}}function vN(t,n,a,i){const s=yr(Dx,{deviceId:t,paneId:n,cols:a,rows:i});return{kind:IA,payload:s}}function bN(t,n,a,i){const s=yr(xD,{deviceId:t,paneId:n,cols:a,rows:i});return{kind:FA,payload:s}}const vS=t=>{let n;const a=new Set,i=(h,y)=>{const p=typeof h=="function"?h(n):h;if(!Object.is(p,n)){const b=n;n=y??(typeof p!="object"||p===null)?p:Object.assign({},n,p),a.forEach(v=>v(n,b))}},s=()=>n,f={setState:i,getState:s,getInitialState:()=>m,subscribe:h=>(a.add(h),()=>a.delete(h))},m=n=t(i,s,f);return f},SN=(t=>t?vS(t):vS),wN=t=>t;function xN(t,n=wN){const a=Se.useSyncExternalStore(t.subscribe,Se.useCallback(()=>n(t.getState()),[t,n]),Se.useCallback(()=>n(t.getInitialState()),[t,n]));return Se.useDebugValue(a),a}const bS=t=>{const n=SN(t),a=i=>xN(n,i);return Object.assign(a,n),a},Vp=(t=>t?bS(t):bS),ym={siteName:"tmex",siteUrl:typeof window<"u"?window.location.origin:"http://localhost:9663",bellThrottleSeconds:6,notificationThrottleSeconds:3,enableBrowserBellToast:!0,enableBrowserNotificationToast:!0,enableTelegramBellPush:!0,enableTelegramNotificationPush:!0,sshReconnectMaxRetries:2,sshReconnectDelaySeconds:10,language:Yp,updatedAt:new Date(0).toISOString()};async function SS(){const t=await fetch("/api/settings/site");if(!t.ok)throw new Error("Failed to load site settings");return(await t.json()).settings}const ec=Vp((t,n)=>({settings:null,loading:!1,fetchSettings:async()=>{const a=n().settings;if(a)return a;t({loading:!0});try{const i=await SS();return t({settings:i,loading:!1}),An.changeLanguage(i.language),i}catch(i){return console.error("[site] failed to fetch settings:",i),t({settings:ym,loading:!1}),An.changeLanguage(ym.language),ym}},refreshSettings:async()=>{t({loading:!0});try{const a=await SS();return t({settings:a,loading:!1}),An.changeLanguage(a.language),a}catch(a){throw console.error("[site] failed to refresh settings:",a),t({loading:!1}),a}}}));function EN(t){const n=typeof t.windowIndex=="number"?`Window ${t.windowIndex}`:typeof t.windowId=="string"&&t.windowId?`Window ${t.windowId}`:"",a=typeof t.paneIndex=="number"?`Pane ${t.paneIndex}`:typeof t.paneId=="string"&&t.paneId?`Pane ${t.paneId}`:"";return[n,a].filter(Boolean).join(" · ")}function RN(t){const n=typeof t.title=="string"&&t.title?t.title:"Terminal Notification",a=EN(t),i=typeof t.body=="string"&&t.body?t.body:typeof t.source=="string"&&t.source?`From ${t.source}`:"Terminal notification";return{title:n,description:a?`${a}
|
|
86
86
|
${i}`:i}}const TN=500,wS=new Map,vm=new Map;function kx(t){const n=Date.now(),a=wS.get(t);return a!==void 0&&n-a<TN?!0:(wS.set(t,n),!1)}let xS=!1;function bm(t,n){if(typeof t!="number"||typeof n!="number")return null;const a=Math.max(2,Math.floor(t)),i=Math.max(2,Math.floor(n));return{cols:a,rows:i}}function CN(t,n){if(xS)return;xS=!0;const a=dr(),i=s=>{const l=n().selectedPanes[s];!l||Jl().getTransaction(s)||n().selectPane(s,l.windowId,l.paneId)};a.onStateChange(s=>{t({socketReady:s==="READY"})}),a.onMessage(s=>{const l=Jl();switch(s.kind){case MA:{const u=ro(uD,s.payload);t(f=>({deviceConnected:{...f.deviceConnected,[u.deviceId]:!0},deviceErrors:{...f.deviceErrors,[u.deviceId]:void 0},deviceReconnecting:{...f.deviceReconnecting,[u.deviceId]:void 0}})),i(u.deviceId);return}case DA:{const u=ro(dD,s.payload);l.cleanup(u.deviceId),t(f=>({deviceConnected:{...f.deviceConnected,[u.deviceId]:!1}}));return}case NA:{const u=$D(s.payload);ON(t,u),u.type==="reconnected"&&i(u.deviceId);return}case jA:{const u=eN(s.payload);t(f=>({snapshots:{...f.snapshots,[u.deviceId]:u}}));return}case HA:{const u=ZD(s.payload);MN(t,u);return}case qA:{const u=ro(TD,s.payload);l.dispatch({type:"SWITCH_ACK",deviceId:u.deviceId,selectToken:u.selectToken});return}case VA:{const u=ro(RD,s.payload),f=new TextDecoder().decode(u.data);l.dispatch({type:"HISTORY",deviceId:u.deviceId,selectToken:u.selectToken,data:f,alternateScreen:u.alternateScreen});return}case GA:{const u=ro(CD,s.payload);l.dispatch({type:"LIVE_RESUME",deviceId:u.deviceId,selectToken:u.selectToken});return}case YA:{const u=ro(ED,s.payload);l.dispatch({type:"OUTPUT",deviceId:u.deviceId,paneId:u.paneId,data:u.data});return}case CA:return}}),a.onError(s=>{console.error("[tmux] borsh ws error:",s),t({socketReady:!1}),uf.error("WebSocket Connection Error",{description:"Please check Gateway status"})}),a.onStateChange(s=>{if(s!=="READY")return;const l=n().connectedDevices;for(const u of l){if(kx(u))continue;const f=_x(u);a.send(f.kind,f.payload)}})}function ON(t,n){if(n.type==="error"){const a=n.message??"Device Error",i=n.errorType??"unknown";if(i==="reconnecting"){t(s=>({deviceReconnecting:{...s.deviceReconnecting,[n.deviceId]:{message:a,at:Date.now()}}}));return}t(s=>{const l=s.deviceErrors[n.deviceId];return(!l||l.type!==i)&&uf.error(a),{deviceErrors:{...s.deviceErrors,[n.deviceId]:{message:a,type:i,rawMessage:n.rawMessage,at:Date.now()}},deviceReconnecting:{...s.deviceReconnecting,[n.deviceId]:void 0}}});return}if(n.type==="disconnected"){Jl().cleanup(n.deviceId),t(a=>({deviceConnected:{...a.deviceConnected,[n.deviceId]:!1}}));return}n.type==="reconnected"&&t(a=>({deviceConnected:{...a.deviceConnected,[n.deviceId]:!0},deviceErrors:{...a.deviceErrors,[n.deviceId]:void 0},deviceReconnecting:{...a.deviceReconnecting,[n.deviceId]:void 0}}))}function MN(t,n){if(n.type==="bell"){console.log("[tmex] bell",n.data);const a=ec.getState().settings;if((a==null?void 0:a.enableBrowserBellToast)===!1)return;const i=n.data??{},s="Terminal Bell",l=[typeof i.windowIndex=="number"?`Window ${i.windowIndex}`:void 0,typeof i.paneIndex=="number"?`Pane ${i.paneIndex}`:void 0].filter(Boolean).join(" · "),u=typeof i.paneUrl=="string"?i.paneUrl:void 0;uf(s,{description:l||"Received tmux bell",action:u?{label:"Open",onClick:()=>{window.location.href=u}}:void 0})}if(n.type==="notification"){console.log("[tmex] notification",n.data);const a=ec.getState().settings;if((a==null?void 0:a.enableBrowserNotificationToast)===!1)return;const i=n.data??{},{title:s,description:l}=RN(i),u=typeof i.paneUrl=="string"?i.paneUrl:void 0;uf(s,{description:l,action:u?{label:"Open",onClick:()=>{window.location.href=u}}:void 0})}if(n.type==="pane-active"){const a=n.data;a!=null&&a.windowId&&(a!=null&&a.paneId)&&t(i=>({activePaneFromEvent:{...i.activePaneFromEvent,[n.deviceId]:{windowId:a.windowId,paneId:a.paneId}}}))}}const Lr=Vp((t,n)=>({socketReady:!1,snapshots:{},connectedDevices:new Set,deviceConnected:{},deviceErrors:{},deviceReconnecting:{},selectedPanes:{},activePaneFromEvent:{},pendingCreateWindowAt:{},ensureSocketConnected(){CN(t,n),dr().connect()},connectDevice(a){if(!a||(t(s=>{const l=new Set(s.connectedDevices);return l.add(a),{connectedDevices:l}}),n().ensureSocketConnected(),kx(a)))return;const i=_x(a);dr().send(i.kind,i.payload)},disconnectDevice(a){if(!a)return;t(s=>{const l=new Set(s.connectedDevices);return l.delete(a),{connectedDevices:l}}),Jl().cleanup(a);const i=uN(a);dr().send(i.kind,i.payload)},clearDeviceError(a){t(i=>({deviceErrors:{...i.deviceErrors,[a]:void 0},deviceReconnecting:{...i.deviceReconnecting,[a]:void 0}}))},hydrateDeviceErrors(a){t(i=>{const s={...i.deviceErrors};for(const l of a)s[l.deviceId]||!l.lastError||!l.lastErrorType||(s[l.deviceId]={message:l.lastError,type:l.lastErrorType,at:0});return{deviceErrors:s}})},selectPane(a,i,s,l){if(!a||!i||!s)return;t(y=>({selectedPanes:{...y.selectedPanes,[a]:{windowId:i,paneId:s}}}));const u=cN(),f=!0;Jl().dispatch({type:"SELECT_START",deviceId:a,windowId:i,paneId:s,selectToken:u,wantHistory:f});const m=bm(l==null?void 0:l.cols,l==null?void 0:l.rows)??vm.get(a)??null,h=fN({deviceId:a,windowId:i,paneId:s,selectToken:u,wantHistory:f,cols:m==null?void 0:m.cols,rows:m==null?void 0:m.rows});dr().send(h.kind,h.payload)},selectWindow(a,i){if(!a||!i)return;const s=dN(a,i);dr().send(s.kind,s.payload)},sendInput(a,i,s,l=!1){if(!a||!i)return;const u=gN(a,i,s,l);dr().send(u.kind,u.payload)},resizePane(a,i,s,l){if(!a||!i)return;const u=bm(s,l);u&&vm.set(a,{...u,at:Date.now()});const f=vN(a,i,s,l);dr().send(f.kind,f.payload)},syncPaneSize(a,i,s,l){if(!a||!i)return;const u=bm(s,l);u&&vm.set(a,{...u,at:Date.now()});const f=bN(a,i,s,l);dr().send(f.kind,f.payload)},paste(a,i,s){if(!a||!i)return;const l=yN(a,i,s);dr().send(l.kind,l.payload)},createWindow(a,i){if(!a)return;const s=hN(a,i);dr().send(s.kind,s.payload),t(l=>({pendingCreateWindowAt:{...l.pendingCreateWindowAt,[a]:Date.now()}}))},clearPendingCreateWindow(a){a&&t(i=>{if(i.pendingCreateWindowAt[a]===void 0)return i;const s={...i.pendingCreateWindowAt};return delete s[a],{pendingCreateWindowAt:s}})},closeWindow(a,i){if(!a||!i)return;const s=mN(a,i);dr().send(s.kind,s.payload)},closePane(a,i){if(!a||!i)return;const s=pN(a,i);dr().send(s.kind,s.payload)}})),ES="tmex:connectedDevices",Lx=x.createContext(null);function AN(){const t=x.useContext(Lx);if(!t)throw new Error("useGlobalDevice must be used within GlobalDeviceProvider");return t}function DN({children:t}){const n=Ya(),[a,i]=x.useState(()=>{try{const p=localStorage.getItem(ES);if(p){const b=JSON.parse(p);return new Set(b)}}catch{}return new Set}),s=Lr(p=>p.connectDevice),l=Lr(p=>p.disconnectDevice),u=Lr(p=>p.connectedDevices);x.useEffect(()=>{try{localStorage.setItem(ES,JSON.stringify([...a]))}catch{}},[a]),x.useEffect(()=>{const p=n.pathname.match(/^\/devices\/([^/]+)/),b=p==null?void 0:p[1];b&&!u.has(b)&&s(b)},[n.pathname,u,s]);const f=x.useCallback(p=>{i(b=>{const v=new Set(b);return v.add(p),v}),u.has(p)||s(p)},[u,s]),m=x.useCallback(p=>{i(b=>{const v=new Set(b);return v.delete(p),v}),u.has(p)&&l(p)},[u,l]),h=x.useCallback((p,b)=>{b?m(p):f(p)},[f,m]),y=x.useMemo(()=>({persistedDevices:a,connectDevice:f,disconnectDevice:m,toggleDevice:h}),[a,f,m,h]);return V.jsx(Lx.Provider,{value:y,children:t})}/**
|
|
87
87
|
* @license lucide-react v0.564.0 - ISC
|
|
88
88
|
*
|
|
@@ -210,6 +210,6 @@ ${i}`:i}}const TN=500,wS=new Map,vm=new Map;function kx(t){const n=Date.now(),a=
|
|
|
210
210
|
${u.right}px ${u.bottom}px,
|
|
211
211
|
${u.right}px ${u.top}px,
|
|
212
212
|
${u.left}px ${u.top}px
|
|
213
|
-
)`}return V.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),l4=x.forwardRef(function(n,a){const{keepMounted:i=!1,...s}=n,{store:l}=Ro(),u=l.useState("mounted"),f=l.useState("modal"),m=l.useState("open");return u||i?V.jsx(l1.Provider,{value:i,children:V.jsxs(l3,{ref:a,...s,children:[u&&f===!0&&V.jsx(s4,{ref:l.context.internalBackdropRef,inert:o4(!m)}),n.children]})}):null});function p1(t){const n=x.useRef(!0);n.current&&(n.current=!1,t())}let lw={},cw={},uw="";function c4(t){if(typeof document>"u")return!1;const n=qt(t);return wn(n).innerWidth-n.documentElement.clientWidth>0}function u4(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=qt(t),i=a.documentElement,s=a.body,l=ki(i)?i:s,u=l.style.overflowY,f=i.style.scrollbarGutter;i.style.scrollbarGutter="stable",l.style.overflowY="scroll";const m=l.offsetWidth;l.style.overflowY="hidden";const h=l.offsetWidth;return l.style.overflowY=u,i.style.scrollbarGutter=f,m===h}function f4(t){const n=qt(t),a=n.documentElement,i=n.body,s=ki(a)?a:i,l={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,l)}}function d4(t){var b;const n=qt(t),a=n.documentElement,i=n.body,s=wn(a);let l=0,u=0,f=!1;const m=sn.create();if(eg&&(((b=s.visualViewport)==null?void 0:b.scale)??1)!==1)return()=>{};function h(){const v=s.getComputedStyle(a),S=s.getComputedStyle(i),T=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=a.scrollTop,u=a.scrollLeft,lw={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},uw=a.style.scrollBehavior,cw={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const N=a.scrollHeight>a.clientHeight,_=a.scrollWidth>a.clientWidth,M=v.overflowY==="scroll"||S.overflowY==="scroll",P=v.overflowX==="scroll"||S.overflowX==="scroll",H=Math.max(0,s.innerWidth-i.clientWidth),O=Math.max(0,s.innerHeight-i.clientHeight),L=parseFloat(S.marginTop)+parseFloat(S.marginBottom),K=parseFloat(S.marginLeft)+parseFloat(S.marginRight),re=ki(a)?a:i;if(f=u4(t),f){a.style.scrollbarGutter=T,re.style.overflowY="hidden",re.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(N||M)&&(a.style.overflowY="scroll"),(_||P)&&(a.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:L||O?`calc(100dvh - ${L+O}px)`:"100dvh",width:K||H?`calc(100vw - ${K+H}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),i.scrollTop=l,i.scrollLeft=u,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,lw),Object.assign(i.style,cw),f||(a.scrollTop=l,a.scrollLeft=u,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=uw)}function p(){y(),m.request(h)}return h(),s.addEventListener("resize",p),()=>{m.cancel(),y(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",p)}}class h4{constructor(){Le(this,"lockCount",0);Le(this,"restore",null);Le(this,"timeoutLock",da.create());Le(this,"timeoutUnlock",da.create());Le(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Le(this,"unlock",()=>{var n;this.lockCount===0&&this.restore&&((n=this.restore)==null||n.call(this),this.restore=null)})}acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),this.release}lock(n){if(this.lockCount===0||this.restore!==null)return;const i=qt(n).documentElement,s=wn(i).getComputedStyle(i).overflowY;if(s==="hidden"||s==="clip"){this.restore=Fx;return}const l=mE||!c4(n);this.restore=l?f4(n):d4(n)}}const m4=new h4;function p4(t=!0,n=null){$e(()=>{if(t)return m4.acquire(n)},[t,n])}function g4(t){const n=x.useRef(""),a=x.useCallback(s=>{s.defaultPrevented||(n.current=s.pointerType,t(s,s.pointerType))},[t]);return{onClick:x.useCallback(s=>{if(s.detail===0){t(s,"keyboard");return}"pointerType"in s?t(s,s.pointerType):t(s,n.current),n.current=""},[t]),onPointerDown:a}}function y4(t){const[n,a]=x.useState(null),i=Ye((f,m)=>{t||a(m||(mE?"touch":""))}),s=x.useCallback(()=>{a(null)},[]),{onClick:l,onPointerDown:u}=g4(i);return x.useMemo(()=>({openMethod:n,reset:s,triggerProps:{onClick:l,onPointerDown:u}}),[n,s,l,u])}function v4(t){const{store:n,parentContext:a,actionsRef:i}=t,s=n.useState("open"),l=n.useState("disablePointerDismissal"),u=n.useState("modal"),f=n.useState("popupElement"),{openMethod:m,triggerProps:h,reset:y}=y4(s);t1(n);const{forceUnmount:p}=n1(s,n,()=>{y()}),b=Ye(re=>{const I=Qt(re);return I.preventUnmountOnClose=()=>{n.set("preventUnmountingOnClose",!0)},I}),v=x.useCallback(()=>{n.setOpen(!1,b(qx))},[n,b]);x.useImperativeHandle(i,()=>({unmount:p,close:v}),[p,v]);const S=i1({popupStore:n,onOpenChange:n.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[E,R]=x.useState(0),T=E===0,N=Kz(S),_=WE(S,{outsidePressEvent(){return n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(re){if(!n.context.outsidePressEnabledRef.current||"button"in re&&re.button!==0||"touches"in re&&re.touches.length!==1)return!1;const I=er(re);if(T&&!l){const A=I;return u&&(n.context.internalBackdropRef.current||n.context.backdropRef.current)?n.context.internalBackdropRef.current===A||n.context.backdropRef.current===A||Tt(A,f)&&!(A!=null&&A.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:T});p4(s&&u===!0,f);const{getReferenceProps:M,getFloatingProps:P,getTriggerProps:H}=s1([N,_]);n.useContextCallback("onNestedDialogOpen",re=>{R(re+1)}),n.useContextCallback("onNestedDialogClose",()=>{R(0)}),x.useEffect(()=>(a!=null&&a.onNestedDialogOpen&&s&&a.onNestedDialogOpen(E),a!=null&&a.onNestedDialogClose&&!s&&a.onNestedDialogClose(),()=>{a!=null&&a.onNestedDialogClose&&s&&a.onNestedDialogClose()}),[s,a,E]);const O=x.useMemo(()=>M(h),[M,h]),L=x.useMemo(()=>H(h),[H,h]),K=x.useMemo(()=>P(),[P]);n.useSyncedValues({openMethod:m,activeTriggerProps:O,inactiveTriggerProps:L,popupProps:K,floatingRootContext:S,nestedOpenDialogCount:E})}const b4={...a1,modal:ht(t=>t.modal),nested:ht(t=>t.nested),nestedOpenDialogCount:ht(t=>t.nestedOpenDialogCount),disablePointerDismissal:ht(t=>t.disablePointerDismissal),openMethod:ht(t=>t.openMethod),descriptionElementId:ht(t=>t.descriptionElementId),titleElementId:ht(t=>t.titleElementId),viewportElement:ht(t=>t.viewportElement),role:ht(t=>t.role)};class S4 extends sg{constructor(a){super(w4(a),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new If,onOpenChange:void 0,onOpenChangeComplete:void 0},b4);Le(this,"setOpen",(a,i)=>{var f,m,h,y;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(m=(f=this.context).onOpenChange)==null||m.call(f,a,i),i.isCanceled)return;const s={open:a,nativeEvent:i.event,reason:i.reason,nested:this.state.nested};(h=this.state.floatingRootContext.context.events)==null||h.emit("openchange",s);const l={open:a},u=((y=i.trigger)==null?void 0:y.id)??null;(u||a)&&(l.activeTriggerId=u,l.activeTriggerElement=i.trigger??null),this.update(l)})}}function w4(t={}){return{...r1(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function x4(t){const{children:n,open:a,defaultOpen:i=!1,onOpenChange:s,onOpenChangeComplete:l,disablePointerDismissal:u=!1,modal:f=!0,actionsRef:m,handle:h,triggerId:y,defaultTriggerId:p=null}=t,b=Ro(!0),v=!!b,S=Sr(()=>(h==null?void 0:h.store)??new S4({open:i,openProp:a,activeTriggerId:p,triggerIdProp:y,modal:f,disablePointerDismissal:u,nested:v})).current;p1(()=>{a===void 0&&S.state.open===!1&&i===!0&&S.update({open:!0,activeTriggerId:p})}),S.useControlledProp("openProp",a),S.useControlledProp("triggerIdProp",y),S.useSyncedValues({disablePointerDismissal:u,nested:v,modal:f}),S.useContextCallback("onOpenChange",s),S.useContextCallback("onOpenChangeComplete",l);const E=S.useState("payload");v4({store:S,actionsRef:m,parentContext:b==null?void 0:b.store.context});const R=x.useMemo(()=>({store:S}),[S]);return V.jsx(_E.Provider,{value:R,children:typeof n=="function"?n({payload:E}):n})}const E4=x.forwardRef(function(n,a){const{render:i,className:s,id:l,...u}=n,{store:f}=Ro(),m=yc(l);return f.useSyncedValueWithCleanup("titleElementId",m),dn("h2",n,{ref:a,props:[{id:m},u]})});function R4({...t}){return V.jsx(x4,{"data-slot":"sheet",...t})}function T4({...t}){return V.jsx(l4,{"data-slot":"sheet-portal",...t})}function C4({className:t,...n}){return V.jsx($L,{"data-slot":"sheet-overlay",className:st("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...n})}function O4({className:t,children:n,side:a="right",showCloseButton:i=!0,...s}){return V.jsxs(T4,{children:[V.jsx(C4,{}),V.jsxs(i4,{"data-slot":"sheet-content","data-side":a,className:st("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...s,children:[n,i&&V.jsxs(ZL,{"data-slot":"sheet-close",render:V.jsx(Jp,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[V.jsx(Hx,{}),V.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function M4({className:t,...n}){return V.jsx("div",{"data-slot":"sheet-header",className:st("gap-0.5 p-4 flex flex-col",t),...n})}function A4({className:t,...n}){return V.jsx(E4,{"data-slot":"sheet-title",className:st("text-foreground text-base font-medium",t),...n})}function D4({className:t,...n}){return V.jsx(JL,{"data-slot":"sheet-description",className:st("text-muted-foreground text-sm",t),...n})}const g1=x.createContext(void 0);function xc(t){const n=x.useContext(g1);if(n===void 0&&!t)throw new Error(Br(72));return n}const N4={...a1,disabled:ht(t=>t.disabled),instantType:ht(t=>t.instantType),isInstantPhase:ht(t=>t.isInstantPhase),trackCursorAxis:ht(t=>t.trackCursorAxis),disableHoverablePopup:ht(t=>t.disableHoverablePopup),lastOpenChangeReason:ht(t=>t.openChangeReason),closeDelay:ht(t=>t.closeDelay),hasViewport:ht(t=>t.hasViewport)};class ug extends sg{constructor(a){super({..._4(),...a},{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new If},N4);Le(this,"setOpen",(a,i)=>{var h,y;const s=i.reason,l=s===Wr,u=a&&s===af,f=!a&&(s===nc||s===Gp);if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(y=(h=this.context).onOpenChange)==null||y.call(h,a,i),i.isCanceled)return;const m=()=>{var v;const p={open:a,openChangeReason:s};u?p.instantType="focus":f?p.instantType="dismiss":s===Wr&&(p.instantType=void 0);const b=((v=i.trigger)==null?void 0:v.id)??null;(b||a)&&(p.activeTriggerId=b,p.activeTriggerElement=i.trigger??null),this.update(p)};l?Ni.flushSync(m):m()})}static useStore(a,i){const s=Sr(()=>new ug(i)).current,l=a??s,u=i1({popupStore:l,onOpenChange:l.setOpen});return l.state.floatingRootContext=u,l}}function _4(){return{...r1(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const k4=JE(function(n){const{disabled:a=!1,defaultOpen:i=!1,open:s,disableHoverablePopup:l=!1,trackCursorAxis:u="none",actionsRef:f,onOpenChange:m,onOpenChangeComplete:h,handle:y,triggerId:p,defaultTriggerId:b=null,children:v}=n,S=ug.useStore(y==null?void 0:y.store,{open:i,openProp:s,activeTriggerId:b,triggerIdProp:p});p1(()=>{s===void 0&&S.state.open===!1&&i===!0&&S.update({open:!0,activeTriggerId:b})}),S.useControlledProp("openProp",s),S.useControlledProp("triggerIdProp",p),S.useContextCallback("onOpenChange",m),S.useContextCallback("onOpenChangeComplete",h);const E=S.useState("open"),R=!a&&E,T=S.useState("activeTriggerId"),N=S.useState("payload");S.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:l}),$e(()=>{E&&a&&S.setOpen(!1,Qt(L_))},[E,a,S]),S.useSyncedValue("disabled",a),t1(S);const{forceUnmount:_,transitionStatus:M}=n1(R,S),P=S.useState("isInstantPhase"),H=S.useState("instantType"),O=S.useState("lastOpenChangeReason"),L=x.useRef(null);$e(()=>{M==="ending"&&O===kf||M!=="ending"&&P?(H!=="delay"&&(L.current=H),S.set("instantType","delay")):L.current!==null&&(S.set("instantType",L.current),L.current=null)},[M,P,O,H,S]),$e(()=>{R&&T==null&&S.set("payload",void 0)},[S,T,R]);const K=x.useCallback(()=>{S.setOpen(!1,L4(S,qx))},[S]);x.useImperativeHandle(f,()=>({unmount:_,close:K}),[_,K]);const re=S.useState("floatingRootContext"),I=WE(re,{enabled:!a,referencePress:!0}),A=p3(re,{enabled:!a&&u!=="none",axis:u==="none"?void 0:u}),{getReferenceProps:j,getFloatingProps:W,getTriggerProps:X}=s1([I,A]),D=x.useMemo(()=>j(),[j]),F=x.useMemo(()=>X(),[X]),z=x.useMemo(()=>W(),[W]);return S.useSyncedValues({activeTriggerProps:D,inactiveTriggerProps:F,popupProps:z}),V.jsx(g1.Provider,{value:S,children:typeof v=="function"?v({payload:N}):v})});function L4(t,n){const a=Qt(n);return a.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},a}const z4=x.createContext(void 0);function U4(){return x.useContext(z4)}let H4=(function(t){return t[t.popupOpen=Ef.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const j4=600,B4=Tz(function(n,a){const{className:i,render:s,handle:l,payload:u,disabled:f,delay:m,closeDelay:h,id:y,...p}=n,b=xc(!0),v=(l==null?void 0:l.store)??b;if(!v)throw new Error(Br(82));const S=yc(y),E=v.useState("isTriggerActive",S),R=v.useState("isOpenedByTrigger",S),T=v.useState("floatingRootContext"),N=x.useRef(null),_=m??j4,M=h??0,{registerTrigger:P,isMountedByThisTrigger:H}=zz(S,N,v,{payload:u,closeDelay:M}),O=U4(),{delayRef:L,isInstantPhase:K,hasProvider:re}=r3(T,{open:R});v.useSyncedValue("isInstantPhase",K);const I=v.useState("disabled"),A=f??I,j=v.useState("trackCursorAxis"),W=v.useState("disableHoverablePopup"),X=Gz(T,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!W&&j!=="both"?Wz():null,restMs(){const le=O==null?void 0:O.delay,k=typeof L.current=="object"?L.current.open:void 0;let Q=_;return re&&(k!==0?Q=m??le??_:Q=0),Q},delay(){const le=typeof L.current=="object"?L.current.close:void 0;let k=M;return h==null&&re&&(k=le),{close:k}},triggerElementRef:N,isActiveTrigger:E}),D=Bz(T,{enabled:!A}).reference,F={open:R},z=v.useState("triggerProps",H);return dn("button",n,{state:F,ref:[a,P,N],props:[X,D,z,{id:S,[H4.triggerDisabled]:A?"":void 0},p],stateAttributesMapping:QL})}),y1=x.createContext(void 0);function P4(){const t=x.useContext(y1);if(t===void 0)throw new Error(Br(70));return t}const I4=x.forwardRef(function(n,a){const{children:i,container:s,className:l,render:u,...f}=n,{portalNode:m,portalSubtree:h}=IE({container:s,ref:a,componentProps:n,elementProps:f});return!h&&!m?null:V.jsxs(x.Fragment,{children:[h,m&&Ni.createPortal(i,m)]})}),F4=x.forwardRef(function(n,a){const{keepMounted:i=!1,...s}=n;return xc().useState("mounted")||i?V.jsx(y1.Provider,{value:i,children:V.jsx(I4,{ref:a,...s})}):null}),v1=x.createContext(void 0);function b1(){const t=x.useContext(v1);if(t===void 0)throw new Error(Br(71));return t}const Y4=x.createContext(void 0);function fg(){const t=x.useContext(Y4);return(t==null?void 0:t.direction)??"ltr"}const V4=t=>({name:"arrow",options:t,async fn(n){var ie,le;const{x:a,y:i,placement:s,rects:l,platform:u,elements:f,middlewareData:m}=n,{element:h,padding:y=0,offsetParent:p="real"}=Fa(t,n)||{};if(h==null)return{};const b=SE(y),v={x:a,y:i},S=ag(s),E=rg(S),R=await u.getDimensions(h),T=S==="y",N=T?"top":"left",_=T?"bottom":"right",M=T?"clientHeight":"clientWidth",P=l.reference[E]+l.reference[S]-v[S]-l.floating[E],H=v[S]-l.reference[S],O=p==="real"?await((ie=u.getOffsetParent)==null?void 0:ie.call(u,h)):f.floating;let L=f.floating[M]||l.floating[E];(!L||!await((le=u.isElement)==null?void 0:le.call(u,O)))&&(L=f.floating[M]||l.floating[E]);const K=P/2-H/2,re=L/2-R[E]/2-1,I=Math.min(b[N],re),A=Math.min(b[_],re),j=I,W=L-R[E]-A,X=L/2-R[E]/2+K,D=hp(j,X,W),F=!m.arrow&&Li(s)!=null&&X!==D&&l.reference[E]/2-(X<j?I:A)-R[E]/2<0,z=F?X<j?X-j:X-W:0;return{[S]:v[S]+z,data:{[S]:D,centerOffset:X-D-z,...F&&{alignmentOffset:z}},reset:F}}}),q4=(t,n)=>({...V4(t),options:[t,n]}),G4={name:"hide",async fn(t){var f;const{width:n,height:a,x:i,y:s}=t.rects.reference,l=n===0&&a===0&&i===0&&s===0;return{data:{referenceHidden:((f=(await nz().fn(t)).data)==null?void 0:f.referenceHidden)||l}}}},lf={sideX:"left",sideY:"top"},X4={name:"adaptiveOrigin",async fn(t){var N,_;const{x:n,y:a,rects:{floating:i},elements:{floating:s},platform:l,strategy:u,placement:f}=t,m=wn(s),h=m.getComputedStyle(s);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:n,y:a,data:lf};const p=await((N=l.getOffsetParent)==null?void 0:N.call(l,s));let b={width:0,height:0};if(u==="fixed"&&(m!=null&&m.visualViewport))b={width:m.visualViewport.width,height:m.visualViewport.height};else if(p===m){const M=qt(s);b={width:M.documentElement.clientWidth,height:M.documentElement.clientHeight}}else await((_=l.isElement)==null?void 0:_.call(l,p))&&(b=await l.getDimensions(p));const v=nr(f);let S=n,E=a;v==="left"&&(S=b.width-(n+i.width)),v==="top"&&(E=b.height-(a+i.height));const R=v==="left"?"right":lf.sideX,T=v==="top"?"bottom":lf.sideY;return{x:S,y:E,data:{sideX:R,sideY:T}}}};function S1(t,n,a){const i=t==="inline-start"||t==="inline-end";return{top:"top",right:i?a?"inline-start":"inline-end":"right",bottom:"bottom",left:i?a?"inline-end":"inline-start":"left"}[n]}function fw(t,n,a){const{rects:i,placement:s}=t;return{side:S1(n,nr(s),a),align:Li(s)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function K4(t){var rr,Yn;const{anchor:n,positionMethod:a="absolute",side:i="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,collisionBoundary:f,collisionPadding:m=5,sticky:h=!1,arrowPadding:y=5,disableAnchorTracking:p=!1,keepMounted:b=!1,floatingRootContext:v,mounted:S,collisionAvoidance:E,shiftCrossAxis:R=!1,nodeId:T,adaptiveOrigin:N,lazyFlip:_=!1,externalTree:M}=t,[P,H]=x.useState(null);!S&&P!==null&&H(null);const O=E.side||"flip",L=E.align||"flip",K=E.fallbackAxisSide||"end",re=typeof n=="function"?n:void 0,I=Ye(re),A=re?I:n,j=la(n),X=fg()==="rtl",D=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"}[i],F=l==="center"?D:`${D}-${l}`;let z=m;const ie=1,le=i==="bottom"?ie:0,k=i==="top"?ie:0,Q=i==="right"?ie:0,$=i==="left"?ie:0;typeof z=="number"?z={top:z+le,right:z+$,bottom:z+k,left:z+Q}:z&&(z={top:(z.top||0)+le,right:(z.right||0)+$,bottom:(z.bottom||0)+k,left:(z.left||0)+Q});const ce={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:z},fe=x.useRef(null),pe=la(s),ye=la(u),Qe=[$3(nt=>{const yt=fw(nt,i,X),Xe=typeof pe.current=="function"?pe.current(yt):pe.current,vt=typeof ye.current=="function"?ye.current(yt):ye.current;return{mainAxis:Xe,crossAxis:vt,alignmentAxis:vt}},[typeof s!="function"?s:0,typeof u!="function"?u:0,X,i])],Je=L==="none"&&O!=="shift",se=!Je&&(h||R||O==="shift"),ge=O==="none"?null:ez({...ce,padding:{top:z.top+ie,right:z.right+ie,bottom:z.bottom+ie,left:z.left+ie},mainAxis:!R&&O==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:K}),ve=Je?null:Z3(nt=>{const yt=qt(nt.elements.floating).documentElement;return{...ce,rootBoundary:R?{x:0,y:0,width:yt.clientWidth,height:yt.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:se,limiter:h||R?void 0:J3(Xe=>{if(!fe.current)return{};const{width:vt,height:Yt}=fe.current.getBoundingClientRect(),je=zr(nr(Xe.placement)),Nt=je==="y"?vt:Yt,Gt=je==="y"?z.left+z.right:z.top+z.bottom;return{offset:Nt/2+Gt/2}})}},[ce,h,R,z,L]);O==="shift"||L==="shift"||l==="center"?Qe.push(ve,ge):Qe.push(ge,ve),Qe.push(tz({...ce,apply({elements:{floating:nt},rects:{reference:yt},availableWidth:Xe,availableHeight:vt}){const Yt=nt.style;Yt.setProperty("--available-width",`${Xe}px`),Yt.setProperty("--available-height",`${vt}px`),Yt.setProperty("--anchor-width",`${yt.width}px`),Yt.setProperty("--anchor-height",`${yt.height}px`)}}),q4(()=>({element:fe.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(nt){var Re,Ae,Ke;const{elements:yt,middlewareData:Xe,placement:vt,rects:Yt,y:je}=nt,Nt=nr(vt),Gt=zr(Nt),jt=fe.current,Pn=((Re=Xe.arrow)==null?void 0:Re.x)||0,Bt=((Ae=Xe.arrow)==null?void 0:Ae.y)||0,Tn=(jt==null?void 0:jt.clientWidth)||0,Pr=(jt==null?void 0:jt.clientHeight)||0,U=Pn+Tn/2,G=Bt+Pr/2,ne=Math.abs(((Ke=Xe.shift)==null?void 0:Ke.y)||0),me=Yt.reference.height/2,be=typeof s=="function"?s(fw(nt,i,X)):s,ze=ne>be,Ne={top:`${U}px calc(100% + ${be}px)`,bottom:`${U}px ${-be}px`,left:`calc(100% + ${be}px) ${G}px`,right:`${-be}px ${G}px`}[Nt],xe=`${U}px ${Yt.reference.y+me-je}px`;return yt.floating.style.setProperty("--transform-origin",se&&Gt==="y"&&ze?xe:Ne),{}}},G4,N),$e(()=>{!S&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[S,v]);const He=x.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:Ee,elements:Ce,x:Te,y:Pe,middlewareData:tt,update:Fe,placement:mt,context:lt,isPositioned:Ve,floatingStyles:zt}=jz({rootContext:v,placement:F,middleware:Qe,strategy:a,whileElementsMounted:b?void 0:(...nt)=>ew(...nt,He),nodeId:T,externalTree:M}),{sideX:Wt,sideY:ln}=tt.adaptiveOrigin||lf,it=Ve?a:"fixed",Ct=x.useMemo(()=>{const nt=N?{position:it,[Wt]:Te,[ln]:Pe}:{position:it,...zt};return Ve||(nt.opacity=0),nt},[N,it,Wt,Te,ln,Pe,zt,Ve]),At=x.useRef(null);$e(()=>{if(!S)return;const nt=j.current,yt=typeof nt=="function"?nt():nt,vt=(dw(yt)?yt.current:yt)||null||null;vt!==At.current&&(Ee.setPositionReference(vt),At.current=vt)},[S,Ee,A,j]),x.useEffect(()=>{if(!S)return;const nt=j.current;typeof nt!="function"&&dw(nt)&&nt.current!==At.current&&(Ee.setPositionReference(nt.current),At.current=nt.current)},[S,Ee,A,j]),x.useEffect(()=>{if(b&&S&&Ce.domReference&&Ce.floating)return ew(Ce.domReference,Ce.floating,Fe,He)},[b,S,Ce,Fe,He]);const hn=nr(mt),mn=S1(i,hn,X),Bn=Li(mt)||"center",Dt=!!((rr=tt.hide)!=null&&rr.referenceHidden);$e(()=>{_&&S&&Ve&&H(hn)},[_,S,Ve,hn]);const xn=x.useMemo(()=>{var nt,yt;return{position:"absolute",top:(nt=tt.arrow)==null?void 0:nt.y,left:(yt=tt.arrow)==null?void 0:yt.x}},[tt.arrow]),$t=((Yn=tt.arrow)==null?void 0:Yn.centerOffset)!==0;return x.useMemo(()=>({positionerStyles:Ct,arrowStyles:xn,arrowRef:fe,arrowUncentered:$t,side:mn,align:Bn,physicalSide:hn,anchorHidden:Dt,refs:Ee,context:lt,isPositioned:Ve,update:Fe}),[Ct,xn,fe,$t,mn,Bn,hn,Dt,Ee,lt,Ve,Fe])}function dw(t){return t!=null&&"current"in t}function w1(t){return t==="starting"?w_:gr}const Q4=x.forwardRef(function(n,a){const{render:i,className:s,anchor:l,positionMethod:u="absolute",side:f="top",align:m="center",sideOffset:h=0,alignOffset:y=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:R=E_,...T}=n,N=xc(),_=P4(),M=N.useState("open"),P=N.useState("mounted"),H=N.useState("trackCursorAxis"),O=N.useState("disableHoverablePopup"),L=N.useState("floatingRootContext"),K=N.useState("instantType"),re=N.useState("transitionStatus"),I=N.useState("hasViewport"),A=K4({anchor:l,positionMethod:u,floatingRootContext:L,mounted:P,side:f,sideOffset:h,align:m,alignOffset:y,collisionBoundary:p,collisionPadding:b,sticky:S,arrowPadding:v,disableAnchorTracking:E,keepMounted:_,collisionAvoidance:R,adaptiveOrigin:I?X4:void 0}),j=x.useMemo(()=>{const F={};return(!M||H==="both"||O)&&(F.pointerEvents="none"),{role:"presentation",hidden:!P,style:{...A.positionerStyles,...F}}},[M,H,O,P,A.positionerStyles]),W=x.useMemo(()=>({open:M,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:H!=="none"?"tracking-cursor":K}),[M,A.side,A.align,A.anchorHidden,H,K]),X=x.useMemo(()=>({...W,arrowRef:A.arrowRef,arrowStyles:A.arrowStyles,arrowUncentered:A.arrowUncentered}),[W,A.arrowRef,A.arrowStyles,A.arrowUncentered]),D=dn("div",n,{state:W,props:[j,w1(re),T],ref:[a,N.useStateSetter("positionerElement")],stateAttributesMapping:wc});return V.jsx(v1.Provider,{value:X,children:D})}),W4={...wc,...vc},$4=x.forwardRef(function(n,a){const{className:i,render:s,...l}=n,u=xc(),{side:f,align:m}=b1(),h=u.useState("open"),y=u.useState("instantType"),p=u.useState("transitionStatus"),b=u.useState("popupProps"),v=u.useState("floatingRootContext");Bf({open:h,ref:u.context.popupRef,onComplete(){var N,_;h&&((_=(N=u.context).onOpenChangeComplete)==null||_.call(N,!0))}});const S=u.useState("disabled"),E=u.useState("closeDelay");return Yz(v,{enabled:!S,closeDelay:E}),dn("div",n,{state:{open:h,side:f,align:m,instant:y,transitionStatus:p},ref:[a,u.context.popupRef,u.useStateSetter("popupElement")],props:[b,w1(p),l],stateAttributesMapping:W4})}),Z4=x.forwardRef(function(n,a){const{className:i,render:s,...l}=n,f=xc().useState("instantType"),{open:m,arrowRef:h,side:y,align:p,arrowUncentered:b,arrowStyles:v}=b1();return dn("div",n,{state:{open:m,side:y,align:p,uncentered:b,instant:f},ref:[a,h],props:[{style:v,"aria-hidden":!0},l],stateAttributesMapping:wc})});function J4({...t}){return V.jsx(k4,{"data-slot":"tooltip",...t})}function eU({...t}){return V.jsx(B4,{"data-slot":"tooltip-trigger",...t})}function tU({className:t,side:n="top",sideOffset:a=4,align:i="center",alignOffset:s=0,children:l,...u}){return V.jsx(F4,{children:V.jsx(Q4,{align:i,alignOffset:s,side:n,sideOffset:a,className:"isolate z-50",children:V.jsxs($4,{"data-slot":"tooltip-content",className:st("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-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 rounded-md px-3 py-1.5 text-xs data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",t),...u,children:[l,V.jsx(Z4,{className:"size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const nU="sidebar_state",rU=3600*24*7,aU="16rem",iU="18rem",oU="3rem",sU="b",x1=x.createContext(null);function Us(){const t=x.useContext(x1);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function lU({defaultOpen:t=!0,open:n,onOpenChange:a,className:i,style:s,children:l,...u}){const f=hk(),[m,h]=x.useState(!1),[y,p]=x.useState(t),b=n??y,v=x.useCallback(T=>{const N=typeof T=="function"?T(b):T;a?a(N):p(N),document.cookie=`${nU}=${N}; path=/; max-age=${rU}`},[a,b]),S=x.useCallback(()=>f?h(T=>!T):v(T=>!T),[f,v,h]);x.useEffect(()=>{const T=N=>{N.key===sU&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),S())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[S]);const E=b?"expanded":"collapsed",R=x.useMemo(()=>({state:E,open:b,setOpen:v,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:S}),[E,b,v,f,m,h,S]);return V.jsx(x1.Provider,{value:R,children:V.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":aU,"--sidebar-width-icon":oU,...s},className:st("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",i),...u,children:l})})}function cU({side:t="left",variant:n="sidebar",collapsible:a="offcanvas",className:i,children:s,dir:l,...u}){const{isMobile:f,state:m,openMobile:h,setOpenMobile:y}=Us();return a==="none"?V.jsx("div",{"data-slot":"sidebar",className:st("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...u,children:s}):f?V.jsx(R4,{open:h,onOpenChange:y,...u,children:V.jsxs(O4,{dir:l,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true","data-testid":"mobile-sidebar-sheet",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":iU},side:t,children:[V.jsxs(M4,{className:"sr-only",children:[V.jsx(A4,{children:"Sidebar"}),V.jsx(D4,{children:"Displays the mobile sidebar."})]}),V.jsx("div",{className:"flex h-full w-full flex-col","data-testid":"sidebar",style:{paddingBottom:"var(--tmex-safe-area-bottom)"},children:s})]})}):V.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?a:"","data-variant":n,"data-side":t,"data-slot":"sidebar",children:[V.jsx("div",{"data-slot":"sidebar-gap",className:st("transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",n==="floating"||n==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),V.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:st("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",n==="floating"||n==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...u,children:V.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner","data-testid":"sidebar",className:"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col",style:{paddingBottom:"var(--tmex-safe-area-bottom)"},children:s})})]})}function uU({className:t,onClick:n,...a}){const{toggleSidebar:i}=Us();return V.jsxs(Jp,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:st(t),onClick:s=>{n==null||n(s),i()},...a,children:[V.jsx(GN,{}),V.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function fU({className:t,...n}){return V.jsx("main",{"data-slot":"sidebar-inset",className:st("bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col",t),...n})}function dU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:st("gap-2 p-2 flex flex-col",t),...n})}function hU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:st("gap-2 p-2 flex flex-col",t),...n})}function mU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:st("no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...n})}function E1({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:st("p-2 relative flex w-full min-w-0 flex-col",t),...n})}function pU({className:t,render:n,...a}){return bc({defaultTagName:"div",props:Eo({className:st("text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",t)},a),render:n,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function gU({className:t,...n}){return V.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:st("gap-0 flex w-full min-w-0 flex-col",t),...n})}function yU({className:t,...n}){return V.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:st("group/menu-item relative",t),...n})}const vU=$p("ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function bU({render:t,isActive:n=!1,variant:a="default",size:i="default",tooltip:s,className:l,...u}){const{isMobile:f,state:m}=Us(),h=bc({defaultTagName:"button",props:Eo({className:st(vU({variant:a,size:i}),l)},u),render:s?eU:t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:i,active:n}});return s?(typeof s=="string"&&(s={children:s}),V.jsxs(J4,{children:[h,V.jsx(tU,{side:"right",align:"center",hidden:m!=="collapsed"||f,...s})]})):h}function SU({className:t,render:n,showOnHover:a=!1,...i}){return bc({defaultTagName:"button",props:Eo({className:st("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0",a&&"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",t)},i),render:n,state:{slot:"sidebar-menu-action",sidebar:"menu-action"}})}function wU({className:t,...n}){return V.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:st("border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col",t),...n})}function xU({className:t,...n}){return V.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:st("group/menu-sub-item relative",t),...n})}function EU({render:t,size:n="md",isActive:a=!1,className:i,...s}){return bc({defaultTagName:"a",props:Eo({className:st("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",i)},s),render:t,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:n,active:a}})}function Of({children:t,onClick:n,...a}){const{isMobile:i,setOpenMobile:s}=Us(),l=u=>{i&&s(!1),n==null||n(u)};return V.jsx(Ip,{...a,onClick:l,children:t})}function RU({items:t}){const{t:n}=gc();return V.jsx(E1,{children:V.jsx(gU,{children:t.map(a=>{var i,s;return V.jsxs(uk,{defaultOpen:a.isActive,render:V.jsx(yU,{}),children:[V.jsx(Of,{to:a.url,children:V.jsxs(bU,{tooltip:n(a.title),children:[V.jsx(a.icon,{}),V.jsx("span",{children:n(a.title)})]})}),(i=a.items)!=null&&i.length?V.jsxs(V.Fragment,{children:[V.jsxs(fk,{render:V.jsx(SU,{className:"data-[state=open]:rotate-90"}),children:[V.jsx(HN,{}),V.jsx("span",{className:"sr-only",children:"Toggle"})]}),V.jsx(dk,{children:V.jsx(wU,{children:(s=a.items)==null?void 0:s.map(l=>V.jsx(xU,{children:V.jsx(Of,{to:l.url,children:V.jsx(EU,{children:V.jsx("span",{children:n(l.title)})})})},l.title))})})]}):null]},a.title)})})})}const TU=$p("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Sp({className:t,variant:n="default",render:a,...i}){return bc({defaultTagName:"span",props:Eo({className:st(TU({className:t,variant:n}))},i),render:a,state:{slot:"badge",variant:n}})}const CU={auth_failed:"authFailed",agent_unavailable:"agentUnavailable",agent_no_identity:"agentNoIdentity",ssh_config_ref_not_supported:"configRefNotSupported",network_unreachable:"networkUnreachable",connection_refused:"connectionRefused",timeout:"timeout",host_not_found:"hostNotFound",handshake_failed:"handshakeFailed",tmux_unavailable:"tmuxUnavailable",connection_closed:"connectionClosed"};function OU({deviceId:t,className:n}){const{t:a}=gc(),i=Lr(l=>l.deviceReconnecting[t]),s=Lr(l=>l.deviceErrors[t]);if(i)return V.jsxs(Sp,{variant:"outline",title:i.message,className:st("h-5 gap-1 border-amber-400/40 bg-amber-500/10 px-1.5 text-[10px] font-normal text-amber-700 dark:text-amber-300",n),children:[V.jsx(e_,{className:"h-3 w-3 animate-spin"}),V.jsx("span",{className:"truncate max-w-[120px]",children:i.message})]});if(s){const l=CU[s.type]??"unknown",u=a(`deviceStatus.errorBadge.${l}`),f=[u,s.message,s.rawMessage].filter(Boolean).join(`
|
|
214
|
-
`);return V.jsxs(Sp,{variant:"outline",title:f,className:st("h-5 gap-1 border-red-400/40 bg-red-500/10 px-1.5 text-[10px] font-normal text-red-700 dark:text-red-300",n),children:[V.jsx(BN,{className:"h-3 w-3"}),V.jsx("span",{className:"truncate max-w-[120px]",children:u})]})}return null}const R1=x.createContext(void 0);function Ff(){const t=x.useContext(R1);if(t===void 0)throw new Error(Br(53));return t}let Mf=(function(t){return t.scrollAreaCornerHeight="--scroll-area-corner-height",t.scrollAreaCornerWidth="--scroll-area-corner-width",t})({});const $u=500,hw=16;function Ur(t,n,a){if(!t)return 0;const i=getComputedStyle(t),s=a==="x"?"Inline":"Block";return a==="x"&&n==="margin"?parseFloat(i[`${n}InlineStart`])*2:parseFloat(i[`${n}${s}Start`])+parseFloat(i[`${n}${s}End`])}let MU=(function(t){return t.orientation="data-orientation",t.hovering="data-hovering",t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({});const Zu="base-ui-disable-scrollbar",T1={className:Zu,getElement(t){return V.jsx("style",{nonce:t,href:Zu,precedence:"base-ui:low",children:`.${Zu}{scrollbar-width:none}.${Zu}::-webkit-scrollbar{display:none}`})}};let os=(function(t){return t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({});const dg={hasOverflowX:t=>t?{[os.hasOverflowX]:""}:null,hasOverflowY:t=>t?{[os.hasOverflowY]:""}:null,overflowXStart:t=>t?{[os.overflowXStart]:""}:null,overflowXEnd:t=>t?{[os.overflowXEnd]:""}:null,overflowYStart:t=>t?{[os.overflowYStart]:""}:null,overflowYEnd:t=>t?{[os.overflowYEnd]:""}:null,cornerHidden:()=>null},AU=x.createContext(void 0),DU={disableStyleElements:!1};function NU(){return x.useContext(AU)??DU}const _U={x:0,y:0},mw={width:0,height:0},kU={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},LU={x:!1,y:!1,corner:!1},zU=x.forwardRef(function(n,a){const{render:i,className:s,overflowEdgeThreshold:l,...u}=n,f=UU(l),m=yc(),h=Ia(),y=Ia(),{nonce:p,disableStyleElements:b}=NU(),[v,S]=x.useState(!1),[E,R]=x.useState(!1),[T,N]=x.useState(!1),[_,M]=x.useState(!1),[P,H]=x.useState(mw),[O,L]=x.useState(mw),[K,re]=x.useState(kU),[I,A]=x.useState(LU),j=x.useRef(null),W=x.useRef(null),X=x.useRef(null),D=x.useRef(null),F=x.useRef(null),z=x.useRef(null),ie=x.useRef(null),le=x.useRef(!1),k=x.useRef(0),Q=x.useRef(0),$=x.useRef(0),ce=x.useRef(0),fe=x.useRef("vertical"),pe=x.useRef(_U),ye=Ye(Ce=>{const Te=Ce.x-pe.current.x,Pe=Ce.y-pe.current.y;pe.current=Ce,Pe!==0&&(N(!0),h.start($u,()=>{N(!1)})),Te!==0&&(R(!0),y.start($u,()=>{R(!1)}))}),Oe=Ye(Ce=>{Ce.button===0&&(le.current=!0,k.current=Ce.clientY,Q.current=Ce.clientX,fe.current=Ce.currentTarget.getAttribute(MU.orientation),W.current&&($.current=W.current.scrollTop,ce.current=W.current.scrollLeft),F.current&&fe.current==="vertical"&&F.current.setPointerCapture(Ce.pointerId),z.current&&fe.current==="horizontal"&&z.current.setPointerCapture(Ce.pointerId))}),we=Ye(Ce=>{if(!le.current)return;const Te=Ce.clientY-k.current,Pe=Ce.clientX-Q.current;if(W.current){const tt=W.current.scrollHeight,Fe=W.current.clientHeight,mt=W.current.scrollWidth,lt=W.current.clientWidth;if(F.current&&X.current&&fe.current==="vertical"){const Ve=Ur(X.current,"padding","y"),zt=Ur(F.current,"margin","y"),Wt=F.current.offsetHeight,ln=X.current.offsetHeight-Wt-Ve-zt,it=Te/ln;W.current.scrollTop=$.current+it*(tt-Fe),Ce.preventDefault(),N(!0),h.start($u,()=>{N(!1)})}if(z.current&&D.current&&fe.current==="horizontal"){const Ve=Ur(D.current,"padding","x"),zt=Ur(z.current,"margin","x"),Wt=z.current.offsetWidth,ln=D.current.offsetWidth-Wt-Ve-zt,it=Pe/ln;W.current.scrollLeft=ce.current+it*(mt-lt),Ce.preventDefault(),R(!0),y.start($u,()=>{R(!1)})}}}),Qe=Ye(Ce=>{le.current=!1,F.current&&fe.current==="vertical"&&F.current.releasePointerCapture(Ce.pointerId),z.current&&fe.current==="horizontal"&&z.current.releasePointerCapture(Ce.pointerId)});function Je(Ce){M(Ce.pointerType==="touch")}function se(Ce){if(Je(Ce),Ce.pointerType!=="touch"){const Te=Tt(j.current,Ce.target);S(Te)}}const ge=x.useMemo(()=>({scrolling:E||T,hasOverflowX:!I.x,hasOverflowY:!I.y,overflowXStart:K.xStart,overflowXEnd:K.xEnd,overflowYStart:K.yStart,overflowYEnd:K.yEnd,cornerHidden:I.corner}),[E,T,I.x,I.y,I.corner,K]),ve={role:"presentation",onPointerEnter:se,onPointerMove:se,onPointerDown:Je,onPointerLeave(){S(!1)},style:{position:"relative",[Mf.scrollAreaCornerHeight]:`${P.height}px`,[Mf.scrollAreaCornerWidth]:`${P.width}px`}},He=dn("div",n,{state:ge,ref:[a,j],props:[ve,u],stateAttributesMapping:dg}),Ee=x.useMemo(()=>({handlePointerDown:Oe,handlePointerMove:we,handlePointerUp:Qe,handleScroll:ye,cornerSize:P,setCornerSize:H,thumbSize:O,setThumbSize:L,touchModality:_,cornerRef:ie,scrollingX:E,setScrollingX:R,scrollingY:T,setScrollingY:N,hovering:v,setHovering:S,viewportRef:W,rootRef:j,scrollbarYRef:X,scrollbarXRef:D,thumbYRef:F,thumbXRef:z,rootId:m,hiddenState:I,setHiddenState:A,overflowEdges:K,setOverflowEdges:re,viewportState:ge,overflowEdgeThreshold:f}),[Oe,we,Qe,ye,P,O,_,E,R,T,N,v,S,m,I,K,ge,f]);return V.jsxs(R1.Provider,{value:Ee,children:[!b&&T1.getElement(p),He]})});function UU(t){if(typeof t=="number"){const n=Math.max(0,t);return{xStart:n,xEnd:n,yStart:n,yEnd:n}}return{xStart:Math.max(0,(t==null?void 0:t.xStart)||0),xEnd:Math.max(0,(t==null?void 0:t.xEnd)||0),yStart:Math.max(0,(t==null?void 0:t.yStart)||0),yEnd:Math.max(0,(t==null?void 0:t.yEnd)||0)}}const HU=x.createContext(void 0);function ls(t,n=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(t,a))}function jU(t,n){if(typeof IntersectionObserver>"u")return()=>{};const a=new IntersectionObserver(i=>{i.forEach(s=>{s.intersectionRatio>0&&(n(),a.disconnect())})});return a.observe(t),()=>{a.disconnect()}}let Oi=(function(t){return t.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",t.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",t.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",t.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",t})({});const pw=1;function gw(t,n){if(n<=0)return 0;const a=ls(t,0,n),i=a,s=n-a,l=i<=pw,u=s<=pw;return l&&u?i<=s?0:n:l?0:u?n:a}let yw=!1;function BU(){yw||eg||(typeof CSS<"u"&&"registerProperty"in CSS&&[Oi.scrollAreaOverflowXStart,Oi.scrollAreaOverflowXEnd,Oi.scrollAreaOverflowYStart,Oi.scrollAreaOverflowYEnd].forEach(t=>{try{CSS.registerProperty({name:t,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),yw=!0)}const PU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{viewportRef:u,scrollbarYRef:f,scrollbarXRef:m,thumbYRef:h,thumbXRef:y,cornerRef:p,cornerSize:b,setCornerSize:v,setThumbSize:S,rootId:E,setHiddenState:R,hiddenState:T,handleScroll:N,setHovering:_,setOverflowEdges:M,overflowEdges:P,overflowEdgeThreshold:H,scrollingX:O,scrollingY:L}=Ff(),K=fg(),re=x.useRef(!0),I=Ia(),A=Ia(),j=Ye(()=>{const ie=u.current,le=f.current,k=m.current,Q=h.current,$=y.current,ce=p.current;if(!ie)return;const fe=ie.scrollHeight,pe=ie.scrollWidth,ye=ie.clientHeight,Oe=ie.clientWidth,we=ie.scrollTop,Qe=ie.scrollLeft;if(fe===0||pe===0)return;const Je=ye>=fe,se=Oe>=pe,ge=Oe/pe,ve=ye/fe,He=Math.max(0,pe-Oe),Ee=Math.max(0,fe-ye);let Ce=0,Te=0;if(!se){let Xe=0;K==="rtl"?Xe=ls(-Qe,0,He):Xe=ls(Qe,0,He),Ce=gw(Xe,He),Te=He-Ce}const Pe=Je?0:ls(we,0,Ee),tt=Je?0:gw(Pe,Ee),Fe=Je?0:Ee-tt,mt=se?0:Oe,lt=Je?0:ye;let Ve=0,zt=0;!se&&!Je&&(Ve=(le==null?void 0:le.offsetWidth)||0,zt=(k==null?void 0:k.offsetHeight)||0);const Wt=b.width===0&&b.height===0,ln=Wt?Ve:0,it=Wt?zt:0,Ct=Ur(k,"padding","x"),At=Ur(le,"padding","y"),hn=Ur($,"margin","x"),mn=Ur(Q,"margin","y"),Bn=mt-Ct-hn,Dt=lt-At-mn,xn=k?Math.min(k.offsetWidth-ln,Bn):Bn,$t=le?Math.min(le.offsetHeight-it,Dt):Dt,rr=Math.max(hw,xn*ge),Yn=Math.max(hw,$t*ve);if(S(Xe=>Xe.height===Yn&&Xe.width===rr?Xe:{width:rr,height:Yn}),le&&Q){const Xe=le.offsetHeight-Yn-At-mn,vt=fe-ye,Yt=vt===0?0:we/vt,je=Math.min(Xe,Math.max(0,Yt*Xe));Q.style.transform=`translate3d(0,${je}px,0)`}if(k&&$){const Xe=k.offsetWidth-rr-Ct-hn,vt=pe-Oe,Yt=vt===0?0:Qe/vt,je=K==="rtl"?ls(Yt*Xe,-Xe,0):ls(Yt*Xe,0,Xe);$.style.transform=`translate3d(${je}px,0,0)`}const nt=[[Oi.scrollAreaOverflowXStart,Ce],[Oi.scrollAreaOverflowXEnd,Te],[Oi.scrollAreaOverflowYStart,tt],[Oi.scrollAreaOverflowYEnd,Fe]];for(const[Xe,vt]of nt)ie.style.setProperty(Xe,`${vt}px`);ce&&(se||Je?v({width:0,height:0}):!se&&!Je&&v({width:Ve,height:zt})),R(Xe=>{const vt=Je||se;return Xe.y===Je&&Xe.x===se&&Xe.corner===vt?Xe:{y:Je,x:se,corner:vt}});const yt={xStart:!se&&Ce>H.xStart,xEnd:!se&&Te>H.xEnd,yStart:!Je&&tt>H.yStart,yEnd:!Je&&Fe>H.yEnd};M(Xe=>Xe.xStart===yt.xStart&&Xe.xEnd===yt.xEnd&&Xe.yStart===yt.yStart&&Xe.yEnd===yt.yEnd?Xe:yt)});$e(()=>{if(!u.current)return;BU();let ie=!1;return jU(u.current,()=>{if(!ie){ie=!0;return}j()})},[j,u]),$e(()=>{queueMicrotask(j)},[j,T,K]),$e(()=>{var ie;(ie=u.current)!=null&&ie.matches(":hover")&&_(!0)},[u,_]),x.useEffect(()=>{const ie=u.current;if(typeof ResizeObserver>"u"||!ie)return;let le=!1;const k=new ResizeObserver(()=>{if(!le){le=!0;return}j()});return k.observe(ie),A.start(0,()=>{const Q=ie.getAnimations({subtree:!0});Q.length!==0&&Promise.allSettled(Q.map($=>$.finished)).then(j).catch(()=>{})}),()=>{k.disconnect(),A.clear()}},[j,u,A]);function W(){re.current=!1}const X={role:"presentation",...E&&{"data-id":`${E}-viewport`},...(!T.x||!T.y)&&{tabIndex:0},className:T1.className,style:{overflow:"scroll"},onScroll(){u.current&&(j(),re.current||N({x:u.current.scrollLeft,y:u.current.scrollTop}),I.start(100,()=>{re.current=!0}))},onWheel:W,onTouchMove:W,onPointerMove:W,onPointerEnter:W,onKeyDown:W},D=x.useMemo(()=>({scrolling:O||L,hasOverflowX:!T.x,hasOverflowY:!T.y,overflowXStart:P.xStart,overflowXEnd:P.xEnd,overflowYStart:P.yStart,overflowYEnd:P.yEnd,cornerHidden:T.corner}),[O,L,T.x,T.y,T.corner,P]),F=dn("div",n,{ref:[a,u],state:D,props:[X,l],stateAttributesMapping:dg}),z=x.useMemo(()=>({computeThumbPosition:j}),[j]);return V.jsx(HU.Provider,{value:z,children:F})}),C1=x.createContext(void 0);function IU(){const t=x.useContext(C1);if(t===void 0)throw new Error(Br(54));return t}let Af=(function(t){return t.scrollAreaThumbHeight="--scroll-area-thumb-height",t.scrollAreaThumbWidth="--scroll-area-thumb-width",t})({});const FU=x.forwardRef(function(n,a){const{render:i,className:s,orientation:l="vertical",keepMounted:u=!1,...f}=n,{hovering:m,scrollingX:h,scrollingY:y,hiddenState:p,overflowEdges:b,scrollbarYRef:v,scrollbarXRef:S,viewportRef:E,thumbYRef:R,thumbXRef:T,handlePointerDown:N,handlePointerUp:_,rootId:M,thumbSize:P}=Ff(),H={hovering:m,scrolling:{horizontal:h,vertical:y}[l],orientation:l,hasOverflowX:!p.x,hasOverflowY:!p.y,overflowXStart:b.xStart,overflowXEnd:b.xEnd,overflowYStart:b.yStart,overflowYEnd:b.yEnd,cornerHidden:p.corner},O=fg();x.useEffect(()=>{const j=E.current,W=l==="vertical"?v.current:S.current;if(!W)return;function X(D){if(!(!j||!W||D.ctrlKey)){if(D.preventDefault(),l==="vertical"){if(j.scrollTop===0&&D.deltaY<0)return}else if(j.scrollLeft===0&&D.deltaX<0)return;if(l==="vertical"){if(j.scrollTop===j.scrollHeight-j.clientHeight&&D.deltaY>0)return}else if(j.scrollLeft===j.scrollWidth-j.clientWidth&&D.deltaX>0)return;l==="vertical"?j.scrollTop+=D.deltaY:j.scrollLeft+=D.deltaX}}return W.addEventListener("wheel",X,{passive:!1}),()=>{W.removeEventListener("wheel",X)}},[l,S,v,E]);const L={...M&&{"data-id":`${M}-scrollbar`},onPointerDown(j){if(j.button===0&&j.currentTarget===j.target&&E.current){if(R.current&&v.current&&l==="vertical"){const W=Ur(R.current,"margin","y"),X=Ur(v.current,"padding","y"),D=R.current.offsetHeight,F=v.current.getBoundingClientRect(),z=j.clientY-F.top-D/2-X+W/2,ie=E.current.scrollHeight,le=E.current.clientHeight,k=v.current.offsetHeight-D-X-W,$=z/k*(ie-le);E.current.scrollTop=$}if(T.current&&S.current&&l==="horizontal"){const W=Ur(T.current,"margin","x"),X=Ur(S.current,"padding","x"),D=T.current.offsetWidth,F=S.current.getBoundingClientRect(),z=j.clientX-F.left-D/2-X+W/2,ie=E.current.scrollWidth,le=E.current.clientWidth,k=S.current.offsetWidth-D-X-W,Q=z/k;let $;O==="rtl"?($=(1-Q)*(ie-le),E.current.scrollLeft<=0&&($=-$)):$=Q*(ie-le),E.current.scrollLeft=$}N(j)}},onPointerUp:_,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...l==="vertical"&&{top:0,bottom:`var(${Mf.scrollAreaCornerHeight})`,insetInlineEnd:0,[Af.scrollAreaThumbHeight]:`${P.height}px`},...l==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Mf.scrollAreaCornerWidth})`,bottom:0,[Af.scrollAreaThumbWidth]:`${P.width}px`}}},K=dn("div",n,{ref:[a,l==="vertical"?v:S],state:H,props:[L,f],stateAttributesMapping:dg}),re=x.useMemo(()=>({orientation:l}),[l]),I=l==="vertical"?p.y:p.x;return u||!I?V.jsx(C1.Provider,{value:re,children:K}):null}),YU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{thumbYRef:u,thumbXRef:f,handlePointerDown:m,handlePointerMove:h,handlePointerUp:y,setScrollingX:p,setScrollingY:b}=Ff(),{orientation:v}=IU();return dn("div",n,{ref:[a,v==="vertical"?u:f],state:{orientation:v},props:[{onPointerDown:m,onPointerMove:h,onPointerUp(R){v==="vertical"&&b(!1),v==="horizontal"&&p(!1),y(R)},style:{...v==="vertical"&&{height:`var(${Af.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${Af.scrollAreaThumbWidth})`}}},l]})}),VU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{cornerRef:u,cornerSize:f,hiddenState:m}=Ff(),h=dn("div",n,{ref:[a,u],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:f.width,height:f.height}},l]});return m.corner?null:h});function qU({className:t,children:n,...a}){return V.jsxs(zU,{"data-slot":"scroll-area",className:st("relative",t),...a,children:[V.jsx(PU,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:n}),V.jsx(GU,{}),V.jsx(VU,{})]})}function GU({className:t,orientation:n="vertical",...a}){return V.jsx(FU,{"data-slot":"scroll-area-scrollbar","data-orientation":n,orientation:n,className:st("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none","[@media(any-pointer:coarse)]:hidden",t),...a,children:V.jsx(YU,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function DH(t){return t}function XU(t){return encodeURIComponent(t)}function KU(){const{t}=gc(),n=Ya(),a=mx(),{isMobile:i,setOpenMobile:s}=Us(),{toggleDevice:l}=AN(),u=Ql("/devices/:deviceId/windows/:windowId/panes/:paneId",n.pathname),f=u==null?void 0:u.params.deviceId,m=u==null?void 0:u.params.windowId,h=u==null?void 0:u.params.paneId,y=Lr(I=>I.snapshots),p=Lr(I=>I.connectedDevices),b=Lr(I=>I.closeWindow),v=Lr(I=>I.closePane),S=ec(I=>{var A;return((A=I.settings)==null?void 0:A.language)??"en_US"}),{data:E}=TC({queryKey:["devices"],queryFn:async()=>{const I=await fetch("/api/devices");if(!I.ok)throw new Error("Failed to fetch devices");return I.json()},throwOnError:!1}),R=Lr(I=>I.hydrateDeviceErrors);x.useEffect(()=>{E!=null&&E.devices&&R(E.devices.map(I=>({deviceId:I.id,lastError:I.lastError??null,lastErrorType:I.lastErrorType??null})))},[E,R]);const T=x.useCallback((I,A)=>{a(I,{replace:(A==null?void 0:A.replace)??!0}),i&&s(!1)},[a,i,s]),N=x.useCallback((I,A,j)=>{M.current=null,window.dispatchEvent(new CustomEvent("tmex:user-initiated-selection",{detail:{deviceId:I,windowId:A,paneId:j}})),T(`/devices/${I}/windows/${A}/panes/${XU(j)}`)},[T]),_=Lr(I=>I.selectWindow),M=x.useRef(null);x.useEffect(()=>{var z,ie;const I=M.current;if(!I)return;if(Date.now()-I.at>5e3){M.current=null;return}const{deviceId:A,windowId:j}=I,W=y[A],X=(z=W==null?void 0:W.session)==null?void 0:z.windows;if(!X)return;const D=X.find(le=>le.id===j);if(!((ie=D==null?void 0:D.panes)!=null&&ie.length))return;M.current=null;const F=D.panes.find(le=>le.active)??D.panes[0];N(A,j,F.id)},[y,N]);const P=x.useCallback((I,A,j)=>{_(I,A);const W=j.find(X=>X.active)??j[0];W?(N(I,A,W.id),M.current=null):M.current={deviceId:I,windowId:A,at:Date.now()}},[N,_]),H=x.useCallback((I,A)=>{A?I===f&&T("/devices"):T(`/devices/${I}`),l(I,A)},[l,f,T]),O=x.useCallback((I,A)=>{I===f&&A===m&&T("/devices"),b(I,A)},[b,f,m,T]),L=x.useCallback(I=>{Lr.getState().createWindow(I)},[]),K=(E==null?void 0:E.devices)??[],re=x.useMemo(()=>[...K].sort((I,A)=>I.name.localeCompare(A.name,yA(S),{numeric:!0,sensitivity:"base"})),[K,S]);return V.jsxs(E1,{className:"flex flex-col flex-1 min-h-0",children:[V.jsx(pU,{children:t("device.devices")}),V.jsx(qU,{className:"flex-1 min-h-0",children:V.jsxs("div",{className:"space-y-1.5 py-2",children:[re.map(I=>{var A,j;return V.jsx(QU,{device:I,windows:((j=(A=y[I.id])==null?void 0:A.session)==null?void 0:j.windows)??null,isConnected:p.has(I.id),selectedWindowId:m,selectedPaneId:h,onConnectToggle:()=>H(I.id,p.has(I.id)),onCreateWindow:L,onCloseWindow:O,onClosePane:v,onPaneClick:N,onWindowClick:P},I.id)}),re.length===0&&V.jsx("div",{className:"text-center text-sm text-muted-foreground py-4",children:t("sidebar.noDevices")})]})})]})}function QU({device:t,windows:n,isConnected:a,selectedWindowId:i,selectedPaneId:s,onConnectToggle:l,onCreateWindow:u,onCloseWindow:f,onClosePane:m,onPaneClick:h,onWindowClick:y}){const{t:p}=gc(),b=t.type==="local"?Ux:IN;return V.jsxs("div",{"data-testid":`device-item-${t.id}`,className:st("rounded-lg border overflow-hidden text-select-none",a?"bg-card/50":"bg-muted/20"),onClick:a?void 0:l,children:[V.jsx("div",{className:"px-3 py-1 bg-muted/30 border-b",children:V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(b,{className:"ml-1 h-4 w-4 text-muted-foreground shrink-0"}),V.jsx("span",{className:"flex-1 truncate text-xs font-medium text-select-none",children:t.name}),V.jsx(OU,{deviceId:t.id,className:"shrink-0"}),V.jsx("div",{className:st("h-2 w-2 rounded-full shrink-0",a?"bg-emerald-500":"bg-gray-400")}),V.jsx(Jp,{variant:"ghost",size:"icon-xs",onClick:v=>{v.stopPropagation(),l()},"data-testid":a?`device-disconnect-${t.id}`:`device-connect-${t.id}`,title:p(a?"device.disconnect":"device.connect"),children:a?V.jsx(WN,{className:"h-3.5 w-3.5 text-orange-500"}):V.jsx(ZN,{className:"h-3.5 w-3.5 text-emerald-500"})})]})}),a&&V.jsxs("div",{className:"p-1 space-y-0.5",children:[!n&&V.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:p("device.connecting")}),(n==null?void 0:n.length)===0&&V.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:p("window.noWindows")}),n==null?void 0:n.map(v=>V.jsx(WU,{deviceId:t.id,window:v,isSelected:v.id===i,selectedPaneId:s,onPaneClick:h,onWindowClick:y,onCloseWindow:f,onClosePane:m},v.id)),V.jsxs("button",{type:"button","data-testid":`window-create-${t.id}`,onPointerDown:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),onClick:()=>u(t.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:[V.jsx(KN,{className:"h-3.5 w-3.5 shrink-0"}),V.jsx("span",{className:"text-xs",children:p("window.new")})]})]})]})}function WU({deviceId:t,window:n,isSelected:a,selectedPaneId:i,onPaneClick:s,onWindowClick:l,onCloseWindow:u,onClosePane:f}){const m=n.panes.length>1,h=n.panes.find(p=>p.id===i),y=a&&!!h;return V.jsxs("div",{className:"space-y-0.5",children:[V.jsxs("div",{className:"group relative",children:[V.jsxs("button",{type:"button",onClick:()=>l(t,n.id,n.panes),"data-testid":`window-item-${n.id}`,className:st("w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors pr-7",y?"bg-primary/15 text-primary border border-primary/30":"hover:bg-accent/50 text-foreground border border-transparent"),children:[V.jsx(Sp,{variant:y?"default":"outline",className:"h-5 text-[10px] px-1.5 shrink-0",children:n.index}),V.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:n.name}),n.active&&V.jsx("span",{className:st("h-1.5 w-1.5 rounded-full shrink-0",y?"bg-foreground/80":"bg-foreground/50")})]}),V.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),u(t,n.id)},className:st("absolute right-1.5 top-1/2 -translate-y-1/2 h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",y?"opacity-100":"opacity-0 group-hover:opacity-100"),title:"Close window",children:V.jsx("span",{className:"text-xs leading-none",children:"×"})})]}),m&&V.jsx("div",{className:"ml-4 pl-2 border-l border-border/50 space-y-0.5",children:n.panes.map(p=>{const b=p.id===i;return V.jsxs("div",{className:"group relative",children:[V.jsxs("button",{type:"button",onClick:()=>s(t,n.id,p.id),"data-testid":`pane-item-${p.id}`,className:st("w-full flex items-center gap-2 px-2 py-1 rounded-md text-left transition-colors pr-7",b?"bg-primary/10 text-primary border border-primary/20":"hover:bg-accent/30 text-muted-foreground border border-transparent"),children:[V.jsx("span",{className:"text-[10px] font-mono opacity-60 w-4",children:p.index}),V.jsx("span",{className:"flex-1 truncate text-xs",children:p.title||`Pane ${p.index}`}),p.active&&V.jsx("span",{className:st("h-1 w-1 rounded-full shrink-0",b?"bg-foreground/80":"bg-foreground/50")})]}),V.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),f(t,n.id,p.id,n.panes.length)},className:st("absolute right-1.5 top-1/2 -translate-y-1/2 h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",b?"opacity-100":"opacity-0 group-hover:opacity-100"),title:"Close pane",children:V.jsx("span",{className:"text-xs leading-none",children:"×"})})]},p.id)})})]})}function $U(t,n){let a;try{a=t()}catch{return}return{getItem:s=>{var l;const u=m=>m===null?null:JSON.parse(m,void 0),f=(l=a.getItem(s))!=null?l:null;return f instanceof Promise?f.then(u):u(f)},setItem:(s,l)=>a.setItem(s,JSON.stringify(l,void 0)),removeItem:s=>a.removeItem(s)}}const wp=t=>n=>{try{const a=t(n);return a instanceof Promise?a:{then(i){return wp(i)(a)},catch(i){return this}}}catch(a){return{then(i){return this},catch(i){return wp(i)(a)}}}},ZU=(t,n)=>(a,i,s)=>{let l={storage:$U(()=>window.localStorage),partialize:R=>R,version:0,merge:(R,T)=>({...T,...R}),...n},u=!1,f=0;const m=new Set,h=new Set;let y=l.storage;if(!y)return t((...R)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),a(...R)},i,s);const p=()=>{const R=l.partialize({...i()});return y.setItem(l.name,{state:R,version:l.version})},b=s.setState;s.setState=(R,T)=>(b(R,T),p());const v=t((...R)=>(a(...R),p()),i,s);s.getInitialState=()=>v;let S;const E=()=>{var R,T;if(!y)return;const N=++f;u=!1,m.forEach(M=>{var P;return M((P=i())!=null?P:v)});const _=((T=l.onRehydrateStorage)==null?void 0:T.call(l,(R=i())!=null?R:v))||void 0;return wp(y.getItem.bind(y))(l.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==l.version){if(l.migrate){const P=l.migrate(M.state,M.version);return P instanceof Promise?P.then(H=>[!0,H]):[!0,P]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var P;if(N!==f)return;const[H,O]=M;if(S=l.merge(O,(P=i())!=null?P:v),a(S,!0),H)return p()}).then(()=>{N===f&&(_==null||_(S,void 0),S=i(),u=!0,h.forEach(M=>M(S)))}).catch(M=>{N===f&&(_==null||_(void 0,M))})};return s.persist={setOptions:R=>{l={...l,...R},R.storage&&(y=R.storage)},clearStorage:()=>{y==null||y.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>E(),hasHydrated:()=>u,onHydrate:R=>(m.add(R),()=>{m.delete(R)}),onFinishHydration:R=>(h.add(R),()=>{h.delete(R)})},l.skipHydration||E(),S||v},JU=ZU,vw=Vp()(JU(t=>({sidebarCollapsed:!1,inputMode:"direct",editorSendWithEnter:!0,theme:"dark",editorHistory:[],editorDrafts:{},setSidebarCollapsed:n=>t({sidebarCollapsed:n}),setInputMode:n=>t({inputMode:n}),setEditorSendWithEnter:n=>t({editorSendWithEnter:n}),setTheme:n=>t({theme:n}),addEditorHistory:n=>t(a=>({editorHistory:[n,...a.editorHistory.slice(0,49)]})),setEditorDraft:(n,a)=>t(i=>({editorDrafts:{...i.editorDrafts,[n]:a}})),removeEditorDraft:n=>t(a=>{if(!(n in a.editorDrafts))return a;const i={...a.editorDrafts};return delete i[n],{editorDrafts:i}})}),{name:"tmex-ui",partialize:t=>({sidebarCollapsed:t.sidebarCollapsed,inputMode:t.inputMode,editorSendWithEnter:t.editorSendWithEnter,theme:t.theme,editorHistory:t.editorHistory,editorDrafts:t.editorDrafts})}));function eH(){const{t}=gc(),{isMobile:n,setOpenMobile:a}=Us(),i=ec(y=>{var p;return(p=y.settings)==null?void 0:p.siteName}),s=ec(y=>y.fetchSettings);x.useEffect(()=>{s()},[s]);const l=i??"tmex",u=vw(y=>y.theme),f=vw(y=>y.setTheme),m=u==="dark",h=()=>{const y=m?"light":"dark";f(y),document.documentElement.classList.toggle("dark",y==="dark")};return V.jsxs("div",{className:"flex items-center gap-2 px-2",children:[V.jsxs(Of,{to:"/",className:"flex flex-1 items-center gap-3 overflow-hidden",children:[V.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-lg border-2 border-black",children:V.jsx("img",{src:"/logo.png",alt:l,className:"h-full w-full object-cover"})}),V.jsx("span",{className:"truncate text-sm font-semibold tracking-tight",children:l})]}),V.jsx("button",{type:"button",onClick:h,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":t(m?"settings.themeLight":"settings.themeDark"),title:t(m?"settings.themeLight":"settings.themeDark"),children:m?V.jsx(a_,{className:"h-4 w-4"}):V.jsx(VN,{className:"h-4 w-4"})}),V.jsx(Of,{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":t("sidebar.settings"),title:t("sidebar.settings"),children:V.jsx(n_,{className:"h-4 w-4"})}),n&&V.jsx("button",{type:"button","data-testid":"mobile-sidebar-close",onClick:()=>a(!1),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":t("nav.closeSidebar"),title:t("nav.closeSidebar"),children:V.jsx(Hx,{className:"h-4 w-4"})})]})}const tH=[{title:"nav.manageDevices",url:"/devices",icon:Ux}];function nH({...t}){return V.jsxs(cU,{variant:"inset",...t,children:[V.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),V.jsx(dU,{className:"py-3",children:V.jsx(eH,{})}),V.jsx(mU,{className:"flex flex-col",children:V.jsx(KU,{})}),V.jsxs(hU,{children:[V.jsx(RU,{items:tH}),V.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})}function rH(){var t;try{const n=localStorage.getItem("tmex-ui");if(!n){document.documentElement.classList.add("dark");return}const a=JSON.parse(n),i=(t=a==null?void 0:a.state)==null?void 0:t.theme,s=i==="dark"||i===void 0;document.documentElement.classList.toggle("dark",s)}catch{document.documentElement.classList.add("dark")}}rH();const aH=new uC({defaultOptions:{queries:{staleTime:5e3,retry:1}}});function iH(){return V.jsx(DN,{children:V.jsxs(lU,{children:[V.jsx(nH,{}),V.jsxs(fU,{className:"h-dvh overflow-hidden",children:[V.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),V.jsx(w2,{}),V.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})})}function Ll({moduleLoader:t}){const[n,a]=x.useState(null),i=JO();x.useEffect(()=>{t().then(a)},[t]);const s=n==null?void 0:n.default,l=n==null?void 0:n.PageTitle,u=n==null?void 0:n.PageActions;return V.jsxs(V.Fragment,{children:[V.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:[V.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-4",children:[V.jsx(uU,{className:"-ml-1 shrink-0","data-testid":"mobile-sidebar-open"}),V.jsx(YL,{orientation:"vertical",className:"mr-2 shrink-0 data-[orientation=vertical]:h-4"}),V.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:l?V.jsx(l,{...i}):""})]}),V.jsx("div",{className:"flex shrink-0 items-center gap-1 px-4",children:u&&V.jsx(u,{...i})})]}),V.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 !pt-0 p-2 md:p-4 mb-2",children:V.jsx("div",{className:"bg-muted/50 min-h-0 flex-1 overflow-auto overscroll-auto rounded-xl [-webkit-overflow-scrolling:touch]",children:s?V.jsx(s,{}):null})})]})}const oH=()=>Ep(()=>import("./SettingsPage-DwpbDA_e.js"),__vite__mapDeps([0,1,2,3])),bw=()=>Ep(()=>import("./DevicesPage-dj7Pel6f.js"),__vite__mapDeps([4,1,2])),Sw=()=>Ep(()=>import("./DevicePage-Di11uzbS.js"),__vite__mapDeps([5,2,3])),sH=G2([{path:"/",Component:iH,children:[{index:!0,element:V.jsx(Ll,{moduleLoader:bw})},{path:"devices",element:V.jsx(Ll,{moduleLoader:bw})},{path:"devices/:deviceId",element:V.jsx(Ll,{moduleLoader:Sw})},{path:"devices/:deviceId/windows/:windowId/panes/:paneId",element:V.jsx(Ll,{moduleLoader:Sw})},{path:"settings",element:V.jsx(Ll,{moduleLoader:oH})}]}]),O1=document.getElementById("root");if(!O1)throw new Error("Root element not found");NC.createRoot(O1).render(V.jsx(x.StrictMode,{children:V.jsxs(hC,{client:aH,children:[V.jsx(v2,{router:sH}),V.jsx(NM,{richColors:!0,position:"top-right",closeButton:!0,offset:{top:"calc(16px + var(--tmex-safe-area-top))",right:"16px",bottom:"16px",left:"16px"},mobileOffset:{top:"calc(12px + var(--tmex-safe-area-top))",right:"12px",bottom:"12px",left:"12px"},toastOptions:{duration:6e3}})]})}));export{r1 as $,Yz as A,Jp as B,Yx as C,x4 as D,Qt as E,h3 as F,vc as G,wc as H,cH as I,r4 as J,w1 as K,l3 as L,hH as M,K4 as N,Wr as O,E_ as P,s4 as Q,o4 as R,OH as S,yH as T,sg as U,If as V,a1 as W,Hx as X,Sr as Y,gr as Z,t3 as _,dC as a,Jn as a$,ht as a0,JE as a1,p1 as a2,CH as a3,Ls as a4,$e as a5,As as a6,y4 as a7,t1 as a8,n1 as a9,gH as aA,Gz as aB,Wz as aC,Bz as aD,Ni as aE,RH as aF,Vl as aG,EH as aH,AE as aI,TH as aJ,Rf as aK,dH as aL,FL as aM,Lr as aN,Ux as aO,KN as aP,IN as aQ,Sp as aR,OU as aS,YL as aT,Ip as aU,rL as aV,cc as aW,zm as aX,ql as aY,sC as aZ,zn as a_,Ia as aa,p4 as ab,Ye as ac,af as ad,nc as ae,Gp as af,Vx as ag,pH as ah,qx as ai,i1 as aj,WE as ak,Kz as al,fg as am,uH as an,fH as ao,s1 as ap,MH as aq,nk as ar,bn as as,Ba as at,Pa as au,qt as av,Tz as aw,zs as ax,zz as ay,Tt as az,ec as b,zw as b0,wH as b1,uL as b2,xH as b3,bH as b4,SH as b5,qu as b6,Ua as b7,A_ as b8,kf as b9,mx as bA,DH as bB,XU as bC,Fx as bD,kt as bE,Ro as bF,v4 as bG,_E as bH,S4 as bI,Xp as ba,rc as bb,mL as bc,tg as bd,dp as be,la as bf,HS as bg,Tm as bh,er as bi,dL as bj,hL as bk,Xx as bl,e1 as bm,Hz as bn,AH as bo,HE as bp,_z as bq,QL as br,NU as bs,ls as bt,wn as bu,eg as bv,T1 as bw,vH as bx,Jl as by,JO as bz,br as c,vw as d,TC as e,uf as f,i4 as g,ZL as h,An as i,V as j,st as k,E4 as l,JL as m,l4 as n,$L as o,Br as p,mH as q,x as r,Wp as s,yA as t,gc as u,Eo as v,tc as w,yc as x,dn as y,Bf as z};
|
|
215
|
-
//# sourceMappingURL=index-
|
|
213
|
+
)`}return V.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),l4=x.forwardRef(function(n,a){const{keepMounted:i=!1,...s}=n,{store:l}=Ro(),u=l.useState("mounted"),f=l.useState("modal"),m=l.useState("open");return u||i?V.jsx(l1.Provider,{value:i,children:V.jsxs(l3,{ref:a,...s,children:[u&&f===!0&&V.jsx(s4,{ref:l.context.internalBackdropRef,inert:o4(!m)}),n.children]})}):null});function p1(t){const n=x.useRef(!0);n.current&&(n.current=!1,t())}let lw={},cw={},uw="";function c4(t){if(typeof document>"u")return!1;const n=qt(t);return wn(n).innerWidth-n.documentElement.clientWidth>0}function u4(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=qt(t),i=a.documentElement,s=a.body,l=ki(i)?i:s,u=l.style.overflowY,f=i.style.scrollbarGutter;i.style.scrollbarGutter="stable",l.style.overflowY="scroll";const m=l.offsetWidth;l.style.overflowY="hidden";const h=l.offsetWidth;return l.style.overflowY=u,i.style.scrollbarGutter=f,m===h}function f4(t){const n=qt(t),a=n.documentElement,i=n.body,s=ki(a)?a:i,l={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,l)}}function d4(t){var b;const n=qt(t),a=n.documentElement,i=n.body,s=wn(a);let l=0,u=0,f=!1;const m=sn.create();if(eg&&(((b=s.visualViewport)==null?void 0:b.scale)??1)!==1)return()=>{};function h(){const v=s.getComputedStyle(a),S=s.getComputedStyle(i),T=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=a.scrollTop,u=a.scrollLeft,lw={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},uw=a.style.scrollBehavior,cw={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const N=a.scrollHeight>a.clientHeight,_=a.scrollWidth>a.clientWidth,M=v.overflowY==="scroll"||S.overflowY==="scroll",P=v.overflowX==="scroll"||S.overflowX==="scroll",H=Math.max(0,s.innerWidth-i.clientWidth),O=Math.max(0,s.innerHeight-i.clientHeight),L=parseFloat(S.marginTop)+parseFloat(S.marginBottom),K=parseFloat(S.marginLeft)+parseFloat(S.marginRight),re=ki(a)?a:i;if(f=u4(t),f){a.style.scrollbarGutter=T,re.style.overflowY="hidden",re.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:T,overflowY:"hidden",overflowX:"hidden"}),(N||M)&&(a.style.overflowY="scroll"),(_||P)&&(a.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:L||O?`calc(100dvh - ${L+O}px)`:"100dvh",width:K||H?`calc(100vw - ${K+H}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),i.scrollTop=l,i.scrollLeft=u,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function y(){Object.assign(a.style,lw),Object.assign(i.style,cw),f||(a.scrollTop=l,a.scrollLeft=u,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=uw)}function p(){y(),m.request(h)}return h(),s.addEventListener("resize",p),()=>{m.cancel(),y(),typeof s.removeEventListener=="function"&&s.removeEventListener("resize",p)}}class h4{constructor(){Le(this,"lockCount",0);Le(this,"restore",null);Le(this,"timeoutLock",da.create());Le(this,"timeoutUnlock",da.create());Le(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Le(this,"unlock",()=>{var n;this.lockCount===0&&this.restore&&((n=this.restore)==null||n.call(this),this.restore=null)})}acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),this.release}lock(n){if(this.lockCount===0||this.restore!==null)return;const i=qt(n).documentElement,s=wn(i).getComputedStyle(i).overflowY;if(s==="hidden"||s==="clip"){this.restore=Fx;return}const l=mE||!c4(n);this.restore=l?f4(n):d4(n)}}const m4=new h4;function p4(t=!0,n=null){$e(()=>{if(t)return m4.acquire(n)},[t,n])}function g4(t){const n=x.useRef(""),a=x.useCallback(s=>{s.defaultPrevented||(n.current=s.pointerType,t(s,s.pointerType))},[t]);return{onClick:x.useCallback(s=>{if(s.detail===0){t(s,"keyboard");return}"pointerType"in s?t(s,s.pointerType):t(s,n.current),n.current=""},[t]),onPointerDown:a}}function y4(t){const[n,a]=x.useState(null),i=Ye((f,m)=>{t||a(m||(mE?"touch":""))}),s=x.useCallback(()=>{a(null)},[]),{onClick:l,onPointerDown:u}=g4(i);return x.useMemo(()=>({openMethod:n,reset:s,triggerProps:{onClick:l,onPointerDown:u}}),[n,s,l,u])}function v4(t){const{store:n,parentContext:a,actionsRef:i}=t,s=n.useState("open"),l=n.useState("disablePointerDismissal"),u=n.useState("modal"),f=n.useState("popupElement"),{openMethod:m,triggerProps:h,reset:y}=y4(s);t1(n);const{forceUnmount:p}=n1(s,n,()=>{y()}),b=Ye(re=>{const I=Qt(re);return I.preventUnmountOnClose=()=>{n.set("preventUnmountingOnClose",!0)},I}),v=x.useCallback(()=>{n.setOpen(!1,b(qx))},[n,b]);x.useImperativeHandle(i,()=>({unmount:p,close:v}),[p,v]);const S=i1({popupStore:n,onOpenChange:n.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[E,R]=x.useState(0),T=E===0,N=Kz(S),_=WE(S,{outsidePressEvent(){return n.context.internalBackdropRef.current||n.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(re){if(!n.context.outsidePressEnabledRef.current||"button"in re&&re.button!==0||"touches"in re&&re.touches.length!==1)return!1;const I=er(re);if(T&&!l){const A=I;return u&&(n.context.internalBackdropRef.current||n.context.backdropRef.current)?n.context.internalBackdropRef.current===A||n.context.backdropRef.current===A||Tt(A,f)&&!(A!=null&&A.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:T});p4(s&&u===!0,f);const{getReferenceProps:M,getFloatingProps:P,getTriggerProps:H}=s1([N,_]);n.useContextCallback("onNestedDialogOpen",re=>{R(re+1)}),n.useContextCallback("onNestedDialogClose",()=>{R(0)}),x.useEffect(()=>(a!=null&&a.onNestedDialogOpen&&s&&a.onNestedDialogOpen(E),a!=null&&a.onNestedDialogClose&&!s&&a.onNestedDialogClose(),()=>{a!=null&&a.onNestedDialogClose&&s&&a.onNestedDialogClose()}),[s,a,E]);const O=x.useMemo(()=>M(h),[M,h]),L=x.useMemo(()=>H(h),[H,h]),K=x.useMemo(()=>P(),[P]);n.useSyncedValues({openMethod:m,activeTriggerProps:O,inactiveTriggerProps:L,popupProps:K,floatingRootContext:S,nestedOpenDialogCount:E})}const b4={...a1,modal:ht(t=>t.modal),nested:ht(t=>t.nested),nestedOpenDialogCount:ht(t=>t.nestedOpenDialogCount),disablePointerDismissal:ht(t=>t.disablePointerDismissal),openMethod:ht(t=>t.openMethod),descriptionElementId:ht(t=>t.descriptionElementId),titleElementId:ht(t=>t.titleElementId),viewportElement:ht(t=>t.viewportElement),role:ht(t=>t.role)};class S4 extends sg{constructor(a){super(w4(a),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new If,onOpenChange:void 0,onOpenChangeComplete:void 0},b4);Le(this,"setOpen",(a,i)=>{var f,m,h,y;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(m=(f=this.context).onOpenChange)==null||m.call(f,a,i),i.isCanceled)return;const s={open:a,nativeEvent:i.event,reason:i.reason,nested:this.state.nested};(h=this.state.floatingRootContext.context.events)==null||h.emit("openchange",s);const l={open:a},u=((y=i.trigger)==null?void 0:y.id)??null;(u||a)&&(l.activeTriggerId=u,l.activeTriggerElement=i.trigger??null),this.update(l)})}}function w4(t={}){return{...r1(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function x4(t){const{children:n,open:a,defaultOpen:i=!1,onOpenChange:s,onOpenChangeComplete:l,disablePointerDismissal:u=!1,modal:f=!0,actionsRef:m,handle:h,triggerId:y,defaultTriggerId:p=null}=t,b=Ro(!0),v=!!b,S=Sr(()=>(h==null?void 0:h.store)??new S4({open:i,openProp:a,activeTriggerId:p,triggerIdProp:y,modal:f,disablePointerDismissal:u,nested:v})).current;p1(()=>{a===void 0&&S.state.open===!1&&i===!0&&S.update({open:!0,activeTriggerId:p})}),S.useControlledProp("openProp",a),S.useControlledProp("triggerIdProp",y),S.useSyncedValues({disablePointerDismissal:u,nested:v,modal:f}),S.useContextCallback("onOpenChange",s),S.useContextCallback("onOpenChangeComplete",l);const E=S.useState("payload");v4({store:S,actionsRef:m,parentContext:b==null?void 0:b.store.context});const R=x.useMemo(()=>({store:S}),[S]);return V.jsx(_E.Provider,{value:R,children:typeof n=="function"?n({payload:E}):n})}const E4=x.forwardRef(function(n,a){const{render:i,className:s,id:l,...u}=n,{store:f}=Ro(),m=yc(l);return f.useSyncedValueWithCleanup("titleElementId",m),dn("h2",n,{ref:a,props:[{id:m},u]})});function R4({...t}){return V.jsx(x4,{"data-slot":"sheet",...t})}function T4({...t}){return V.jsx(l4,{"data-slot":"sheet-portal",...t})}function C4({className:t,...n}){return V.jsx($L,{"data-slot":"sheet-overlay",className:st("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...n})}function O4({className:t,children:n,side:a="right",showCloseButton:i=!0,...s}){return V.jsxs(T4,{children:[V.jsx(C4,{}),V.jsxs(i4,{"data-slot":"sheet-content","data-side":a,className:st("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...s,children:[n,i&&V.jsxs(ZL,{"data-slot":"sheet-close",render:V.jsx(Jp,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[V.jsx(Hx,{}),V.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function M4({className:t,...n}){return V.jsx("div",{"data-slot":"sheet-header",className:st("gap-0.5 p-4 flex flex-col",t),...n})}function A4({className:t,...n}){return V.jsx(E4,{"data-slot":"sheet-title",className:st("text-foreground text-base font-medium",t),...n})}function D4({className:t,...n}){return V.jsx(JL,{"data-slot":"sheet-description",className:st("text-muted-foreground text-sm",t),...n})}const g1=x.createContext(void 0);function xc(t){const n=x.useContext(g1);if(n===void 0&&!t)throw new Error(Br(72));return n}const N4={...a1,disabled:ht(t=>t.disabled),instantType:ht(t=>t.instantType),isInstantPhase:ht(t=>t.isInstantPhase),trackCursorAxis:ht(t=>t.trackCursorAxis),disableHoverablePopup:ht(t=>t.disableHoverablePopup),lastOpenChangeReason:ht(t=>t.openChangeReason),closeDelay:ht(t=>t.closeDelay),hasViewport:ht(t=>t.hasViewport)};class ug extends sg{constructor(a){super({..._4(),...a},{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new If},N4);Le(this,"setOpen",(a,i)=>{var h,y;const s=i.reason,l=s===Wr,u=a&&s===af,f=!a&&(s===nc||s===Gp);if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(y=(h=this.context).onOpenChange)==null||y.call(h,a,i),i.isCanceled)return;const m=()=>{var v;const p={open:a,openChangeReason:s};u?p.instantType="focus":f?p.instantType="dismiss":s===Wr&&(p.instantType=void 0);const b=((v=i.trigger)==null?void 0:v.id)??null;(b||a)&&(p.activeTriggerId=b,p.activeTriggerElement=i.trigger??null),this.update(p)};l?Ni.flushSync(m):m()})}static useStore(a,i){const s=Sr(()=>new ug(i)).current,l=a??s,u=i1({popupStore:l,onOpenChange:l.setOpen});return l.state.floatingRootContext=u,l}}function _4(){return{...r1(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const k4=JE(function(n){const{disabled:a=!1,defaultOpen:i=!1,open:s,disableHoverablePopup:l=!1,trackCursorAxis:u="none",actionsRef:f,onOpenChange:m,onOpenChangeComplete:h,handle:y,triggerId:p,defaultTriggerId:b=null,children:v}=n,S=ug.useStore(y==null?void 0:y.store,{open:i,openProp:s,activeTriggerId:b,triggerIdProp:p});p1(()=>{s===void 0&&S.state.open===!1&&i===!0&&S.update({open:!0,activeTriggerId:b})}),S.useControlledProp("openProp",s),S.useControlledProp("triggerIdProp",p),S.useContextCallback("onOpenChange",m),S.useContextCallback("onOpenChangeComplete",h);const E=S.useState("open"),R=!a&&E,T=S.useState("activeTriggerId"),N=S.useState("payload");S.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:l}),$e(()=>{E&&a&&S.setOpen(!1,Qt(L_))},[E,a,S]),S.useSyncedValue("disabled",a),t1(S);const{forceUnmount:_,transitionStatus:M}=n1(R,S),P=S.useState("isInstantPhase"),H=S.useState("instantType"),O=S.useState("lastOpenChangeReason"),L=x.useRef(null);$e(()=>{M==="ending"&&O===kf||M!=="ending"&&P?(H!=="delay"&&(L.current=H),S.set("instantType","delay")):L.current!==null&&(S.set("instantType",L.current),L.current=null)},[M,P,O,H,S]),$e(()=>{R&&T==null&&S.set("payload",void 0)},[S,T,R]);const K=x.useCallback(()=>{S.setOpen(!1,L4(S,qx))},[S]);x.useImperativeHandle(f,()=>({unmount:_,close:K}),[_,K]);const re=S.useState("floatingRootContext"),I=WE(re,{enabled:!a,referencePress:!0}),A=p3(re,{enabled:!a&&u!=="none",axis:u==="none"?void 0:u}),{getReferenceProps:j,getFloatingProps:W,getTriggerProps:X}=s1([I,A]),D=x.useMemo(()=>j(),[j]),F=x.useMemo(()=>X(),[X]),z=x.useMemo(()=>W(),[W]);return S.useSyncedValues({activeTriggerProps:D,inactiveTriggerProps:F,popupProps:z}),V.jsx(g1.Provider,{value:S,children:typeof v=="function"?v({payload:N}):v})});function L4(t,n){const a=Qt(n);return a.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},a}const z4=x.createContext(void 0);function U4(){return x.useContext(z4)}let H4=(function(t){return t[t.popupOpen=Ef.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const j4=600,B4=Tz(function(n,a){const{className:i,render:s,handle:l,payload:u,disabled:f,delay:m,closeDelay:h,id:y,...p}=n,b=xc(!0),v=(l==null?void 0:l.store)??b;if(!v)throw new Error(Br(82));const S=yc(y),E=v.useState("isTriggerActive",S),R=v.useState("isOpenedByTrigger",S),T=v.useState("floatingRootContext"),N=x.useRef(null),_=m??j4,M=h??0,{registerTrigger:P,isMountedByThisTrigger:H}=zz(S,N,v,{payload:u,closeDelay:M}),O=U4(),{delayRef:L,isInstantPhase:K,hasProvider:re}=r3(T,{open:R});v.useSyncedValue("isInstantPhase",K);const I=v.useState("disabled"),A=f??I,j=v.useState("trackCursorAxis"),W=v.useState("disableHoverablePopup"),X=Gz(T,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!W&&j!=="both"?Wz():null,restMs(){const le=O==null?void 0:O.delay,k=typeof L.current=="object"?L.current.open:void 0;let Q=_;return re&&(k!==0?Q=m??le??_:Q=0),Q},delay(){const le=typeof L.current=="object"?L.current.close:void 0;let k=M;return h==null&&re&&(k=le),{close:k}},triggerElementRef:N,isActiveTrigger:E}),D=Bz(T,{enabled:!A}).reference,F={open:R},z=v.useState("triggerProps",H);return dn("button",n,{state:F,ref:[a,P,N],props:[X,D,z,{id:S,[H4.triggerDisabled]:A?"":void 0},p],stateAttributesMapping:QL})}),y1=x.createContext(void 0);function P4(){const t=x.useContext(y1);if(t===void 0)throw new Error(Br(70));return t}const I4=x.forwardRef(function(n,a){const{children:i,container:s,className:l,render:u,...f}=n,{portalNode:m,portalSubtree:h}=IE({container:s,ref:a,componentProps:n,elementProps:f});return!h&&!m?null:V.jsxs(x.Fragment,{children:[h,m&&Ni.createPortal(i,m)]})}),F4=x.forwardRef(function(n,a){const{keepMounted:i=!1,...s}=n;return xc().useState("mounted")||i?V.jsx(y1.Provider,{value:i,children:V.jsx(I4,{ref:a,...s})}):null}),v1=x.createContext(void 0);function b1(){const t=x.useContext(v1);if(t===void 0)throw new Error(Br(71));return t}const Y4=x.createContext(void 0);function fg(){const t=x.useContext(Y4);return(t==null?void 0:t.direction)??"ltr"}const V4=t=>({name:"arrow",options:t,async fn(n){var ie,le;const{x:a,y:i,placement:s,rects:l,platform:u,elements:f,middlewareData:m}=n,{element:h,padding:y=0,offsetParent:p="real"}=Fa(t,n)||{};if(h==null)return{};const b=SE(y),v={x:a,y:i},S=ag(s),E=rg(S),R=await u.getDimensions(h),T=S==="y",N=T?"top":"left",_=T?"bottom":"right",M=T?"clientHeight":"clientWidth",P=l.reference[E]+l.reference[S]-v[S]-l.floating[E],H=v[S]-l.reference[S],O=p==="real"?await((ie=u.getOffsetParent)==null?void 0:ie.call(u,h)):f.floating;let L=f.floating[M]||l.floating[E];(!L||!await((le=u.isElement)==null?void 0:le.call(u,O)))&&(L=f.floating[M]||l.floating[E]);const K=P/2-H/2,re=L/2-R[E]/2-1,I=Math.min(b[N],re),A=Math.min(b[_],re),j=I,W=L-R[E]-A,X=L/2-R[E]/2+K,D=hp(j,X,W),F=!m.arrow&&Li(s)!=null&&X!==D&&l.reference[E]/2-(X<j?I:A)-R[E]/2<0,z=F?X<j?X-j:X-W:0;return{[S]:v[S]+z,data:{[S]:D,centerOffset:X-D-z,...F&&{alignmentOffset:z}},reset:F}}}),q4=(t,n)=>({...V4(t),options:[t,n]}),G4={name:"hide",async fn(t){var f;const{width:n,height:a,x:i,y:s}=t.rects.reference,l=n===0&&a===0&&i===0&&s===0;return{data:{referenceHidden:((f=(await nz().fn(t)).data)==null?void 0:f.referenceHidden)||l}}}},lf={sideX:"left",sideY:"top"},X4={name:"adaptiveOrigin",async fn(t){var N,_;const{x:n,y:a,rects:{floating:i},elements:{floating:s},platform:l,strategy:u,placement:f}=t,m=wn(s),h=m.getComputedStyle(s);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:n,y:a,data:lf};const p=await((N=l.getOffsetParent)==null?void 0:N.call(l,s));let b={width:0,height:0};if(u==="fixed"&&(m!=null&&m.visualViewport))b={width:m.visualViewport.width,height:m.visualViewport.height};else if(p===m){const M=qt(s);b={width:M.documentElement.clientWidth,height:M.documentElement.clientHeight}}else await((_=l.isElement)==null?void 0:_.call(l,p))&&(b=await l.getDimensions(p));const v=nr(f);let S=n,E=a;v==="left"&&(S=b.width-(n+i.width)),v==="top"&&(E=b.height-(a+i.height));const R=v==="left"?"right":lf.sideX,T=v==="top"?"bottom":lf.sideY;return{x:S,y:E,data:{sideX:R,sideY:T}}}};function S1(t,n,a){const i=t==="inline-start"||t==="inline-end";return{top:"top",right:i?a?"inline-start":"inline-end":"right",bottom:"bottom",left:i?a?"inline-end":"inline-start":"left"}[n]}function fw(t,n,a){const{rects:i,placement:s}=t;return{side:S1(n,nr(s),a),align:Li(s)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function K4(t){var rr,Yn;const{anchor:n,positionMethod:a="absolute",side:i="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,collisionBoundary:f,collisionPadding:m=5,sticky:h=!1,arrowPadding:y=5,disableAnchorTracking:p=!1,keepMounted:b=!1,floatingRootContext:v,mounted:S,collisionAvoidance:E,shiftCrossAxis:R=!1,nodeId:T,adaptiveOrigin:N,lazyFlip:_=!1,externalTree:M}=t,[P,H]=x.useState(null);!S&&P!==null&&H(null);const O=E.side||"flip",L=E.align||"flip",K=E.fallbackAxisSide||"end",re=typeof n=="function"?n:void 0,I=Ye(re),A=re?I:n,j=la(n),X=fg()==="rtl",D=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"}[i],F=l==="center"?D:`${D}-${l}`;let z=m;const ie=1,le=i==="bottom"?ie:0,k=i==="top"?ie:0,Q=i==="right"?ie:0,$=i==="left"?ie:0;typeof z=="number"?z={top:z+le,right:z+$,bottom:z+k,left:z+Q}:z&&(z={top:(z.top||0)+le,right:(z.right||0)+$,bottom:(z.bottom||0)+k,left:(z.left||0)+Q});const ce={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:z},fe=x.useRef(null),pe=la(s),ye=la(u),Qe=[$3(nt=>{const yt=fw(nt,i,X),Xe=typeof pe.current=="function"?pe.current(yt):pe.current,vt=typeof ye.current=="function"?ye.current(yt):ye.current;return{mainAxis:Xe,crossAxis:vt,alignmentAxis:vt}},[typeof s!="function"?s:0,typeof u!="function"?u:0,X,i])],Je=L==="none"&&O!=="shift",se=!Je&&(h||R||O==="shift"),ge=O==="none"?null:ez({...ce,padding:{top:z.top+ie,right:z.right+ie,bottom:z.bottom+ie,left:z.left+ie},mainAxis:!R&&O==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:K}),ve=Je?null:Z3(nt=>{const yt=qt(nt.elements.floating).documentElement;return{...ce,rootBoundary:R?{x:0,y:0,width:yt.clientWidth,height:yt.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:se,limiter:h||R?void 0:J3(Xe=>{if(!fe.current)return{};const{width:vt,height:Yt}=fe.current.getBoundingClientRect(),je=zr(nr(Xe.placement)),Nt=je==="y"?vt:Yt,Gt=je==="y"?z.left+z.right:z.top+z.bottom;return{offset:Nt/2+Gt/2}})}},[ce,h,R,z,L]);O==="shift"||L==="shift"||l==="center"?Qe.push(ve,ge):Qe.push(ge,ve),Qe.push(tz({...ce,apply({elements:{floating:nt},rects:{reference:yt},availableWidth:Xe,availableHeight:vt}){const Yt=nt.style;Yt.setProperty("--available-width",`${Xe}px`),Yt.setProperty("--available-height",`${vt}px`),Yt.setProperty("--anchor-width",`${yt.width}px`),Yt.setProperty("--anchor-height",`${yt.height}px`)}}),q4(()=>({element:fe.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(nt){var Re,Ae,Ke;const{elements:yt,middlewareData:Xe,placement:vt,rects:Yt,y:je}=nt,Nt=nr(vt),Gt=zr(Nt),jt=fe.current,Pn=((Re=Xe.arrow)==null?void 0:Re.x)||0,Bt=((Ae=Xe.arrow)==null?void 0:Ae.y)||0,Tn=(jt==null?void 0:jt.clientWidth)||0,Pr=(jt==null?void 0:jt.clientHeight)||0,U=Pn+Tn/2,G=Bt+Pr/2,ne=Math.abs(((Ke=Xe.shift)==null?void 0:Ke.y)||0),me=Yt.reference.height/2,be=typeof s=="function"?s(fw(nt,i,X)):s,ze=ne>be,Ne={top:`${U}px calc(100% + ${be}px)`,bottom:`${U}px ${-be}px`,left:`calc(100% + ${be}px) ${G}px`,right:`${-be}px ${G}px`}[Nt],xe=`${U}px ${Yt.reference.y+me-je}px`;return yt.floating.style.setProperty("--transform-origin",se&&Gt==="y"&&ze?xe:Ne),{}}},G4,N),$e(()=>{!S&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[S,v]);const He=x.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:Ee,elements:Ce,x:Te,y:Pe,middlewareData:tt,update:Fe,placement:mt,context:lt,isPositioned:Ve,floatingStyles:zt}=jz({rootContext:v,placement:F,middleware:Qe,strategy:a,whileElementsMounted:b?void 0:(...nt)=>ew(...nt,He),nodeId:T,externalTree:M}),{sideX:Wt,sideY:ln}=tt.adaptiveOrigin||lf,it=Ve?a:"fixed",Ct=x.useMemo(()=>{const nt=N?{position:it,[Wt]:Te,[ln]:Pe}:{position:it,...zt};return Ve||(nt.opacity=0),nt},[N,it,Wt,Te,ln,Pe,zt,Ve]),At=x.useRef(null);$e(()=>{if(!S)return;const nt=j.current,yt=typeof nt=="function"?nt():nt,vt=(dw(yt)?yt.current:yt)||null||null;vt!==At.current&&(Ee.setPositionReference(vt),At.current=vt)},[S,Ee,A,j]),x.useEffect(()=>{if(!S)return;const nt=j.current;typeof nt!="function"&&dw(nt)&&nt.current!==At.current&&(Ee.setPositionReference(nt.current),At.current=nt.current)},[S,Ee,A,j]),x.useEffect(()=>{if(b&&S&&Ce.domReference&&Ce.floating)return ew(Ce.domReference,Ce.floating,Fe,He)},[b,S,Ce,Fe,He]);const hn=nr(mt),mn=S1(i,hn,X),Bn=Li(mt)||"center",Dt=!!((rr=tt.hide)!=null&&rr.referenceHidden);$e(()=>{_&&S&&Ve&&H(hn)},[_,S,Ve,hn]);const xn=x.useMemo(()=>{var nt,yt;return{position:"absolute",top:(nt=tt.arrow)==null?void 0:nt.y,left:(yt=tt.arrow)==null?void 0:yt.x}},[tt.arrow]),$t=((Yn=tt.arrow)==null?void 0:Yn.centerOffset)!==0;return x.useMemo(()=>({positionerStyles:Ct,arrowStyles:xn,arrowRef:fe,arrowUncentered:$t,side:mn,align:Bn,physicalSide:hn,anchorHidden:Dt,refs:Ee,context:lt,isPositioned:Ve,update:Fe}),[Ct,xn,fe,$t,mn,Bn,hn,Dt,Ee,lt,Ve,Fe])}function dw(t){return t!=null&&"current"in t}function w1(t){return t==="starting"?w_:gr}const Q4=x.forwardRef(function(n,a){const{render:i,className:s,anchor:l,positionMethod:u="absolute",side:f="top",align:m="center",sideOffset:h=0,alignOffset:y=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:R=E_,...T}=n,N=xc(),_=P4(),M=N.useState("open"),P=N.useState("mounted"),H=N.useState("trackCursorAxis"),O=N.useState("disableHoverablePopup"),L=N.useState("floatingRootContext"),K=N.useState("instantType"),re=N.useState("transitionStatus"),I=N.useState("hasViewport"),A=K4({anchor:l,positionMethod:u,floatingRootContext:L,mounted:P,side:f,sideOffset:h,align:m,alignOffset:y,collisionBoundary:p,collisionPadding:b,sticky:S,arrowPadding:v,disableAnchorTracking:E,keepMounted:_,collisionAvoidance:R,adaptiveOrigin:I?X4:void 0}),j=x.useMemo(()=>{const F={};return(!M||H==="both"||O)&&(F.pointerEvents="none"),{role:"presentation",hidden:!P,style:{...A.positionerStyles,...F}}},[M,H,O,P,A.positionerStyles]),W=x.useMemo(()=>({open:M,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:H!=="none"?"tracking-cursor":K}),[M,A.side,A.align,A.anchorHidden,H,K]),X=x.useMemo(()=>({...W,arrowRef:A.arrowRef,arrowStyles:A.arrowStyles,arrowUncentered:A.arrowUncentered}),[W,A.arrowRef,A.arrowStyles,A.arrowUncentered]),D=dn("div",n,{state:W,props:[j,w1(re),T],ref:[a,N.useStateSetter("positionerElement")],stateAttributesMapping:wc});return V.jsx(v1.Provider,{value:X,children:D})}),W4={...wc,...vc},$4=x.forwardRef(function(n,a){const{className:i,render:s,...l}=n,u=xc(),{side:f,align:m}=b1(),h=u.useState("open"),y=u.useState("instantType"),p=u.useState("transitionStatus"),b=u.useState("popupProps"),v=u.useState("floatingRootContext");Bf({open:h,ref:u.context.popupRef,onComplete(){var N,_;h&&((_=(N=u.context).onOpenChangeComplete)==null||_.call(N,!0))}});const S=u.useState("disabled"),E=u.useState("closeDelay");return Yz(v,{enabled:!S,closeDelay:E}),dn("div",n,{state:{open:h,side:f,align:m,instant:y,transitionStatus:p},ref:[a,u.context.popupRef,u.useStateSetter("popupElement")],props:[b,w1(p),l],stateAttributesMapping:W4})}),Z4=x.forwardRef(function(n,a){const{className:i,render:s,...l}=n,f=xc().useState("instantType"),{open:m,arrowRef:h,side:y,align:p,arrowUncentered:b,arrowStyles:v}=b1();return dn("div",n,{state:{open:m,side:y,align:p,uncentered:b,instant:f},ref:[a,h],props:[{style:v,"aria-hidden":!0},l],stateAttributesMapping:wc})});function J4({...t}){return V.jsx(k4,{"data-slot":"tooltip",...t})}function eU({...t}){return V.jsx(B4,{"data-slot":"tooltip-trigger",...t})}function tU({className:t,side:n="top",sideOffset:a=4,align:i="center",alignOffset:s=0,children:l,...u}){return V.jsx(F4,{children:V.jsx(Q4,{align:i,alignOffset:s,side:n,sideOffset:a,className:"isolate z-50",children:V.jsxs($4,{"data-slot":"tooltip-content",className:st("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-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 rounded-md px-3 py-1.5 text-xs data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",t),...u,children:[l,V.jsx(Z4,{className:"size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const nU="sidebar_state",rU=3600*24*7,aU="16rem",iU="18rem",oU="3rem",sU="b",x1=x.createContext(null);function Us(){const t=x.useContext(x1);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function lU({defaultOpen:t=!0,open:n,onOpenChange:a,className:i,style:s,children:l,...u}){const f=hk(),[m,h]=x.useState(!1),[y,p]=x.useState(t),b=n??y,v=x.useCallback(T=>{const N=typeof T=="function"?T(b):T;a?a(N):p(N),document.cookie=`${nU}=${N}; path=/; max-age=${rU}`},[a,b]),S=x.useCallback(()=>f?h(T=>!T):v(T=>!T),[f,v,h]);x.useEffect(()=>{const T=N=>{N.defaultPrevented||N.target instanceof HTMLElement&&N.target.closest(".xterm")||N.key===sU&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),S())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[S]);const E=b?"expanded":"collapsed",R=x.useMemo(()=>({state:E,open:b,setOpen:v,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:S}),[E,b,v,f,m,h,S]);return V.jsx(x1.Provider,{value:R,children:V.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":aU,"--sidebar-width-icon":oU,...s},className:st("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",i),...u,children:l})})}function cU({side:t="left",variant:n="sidebar",collapsible:a="offcanvas",className:i,children:s,dir:l,...u}){const{isMobile:f,state:m,openMobile:h,setOpenMobile:y}=Us();return a==="none"?V.jsx("div",{"data-slot":"sidebar",className:st("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...u,children:s}):f?V.jsx(R4,{open:h,onOpenChange:y,...u,children:V.jsxs(O4,{dir:l,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true","data-testid":"mobile-sidebar-sheet",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":iU},side:t,children:[V.jsxs(M4,{className:"sr-only",children:[V.jsx(A4,{children:"Sidebar"}),V.jsx(D4,{children:"Displays the mobile sidebar."})]}),V.jsx("div",{className:"flex h-full w-full flex-col","data-testid":"sidebar",style:{paddingBottom:"var(--tmex-safe-area-bottom)"},children:s})]})}):V.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?a:"","data-variant":n,"data-side":t,"data-slot":"sidebar",children:[V.jsx("div",{"data-slot":"sidebar-gap",className:st("transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",n==="floating"||n==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),V.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:st("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",n==="floating"||n==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...u,children:V.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner","data-testid":"sidebar",className:"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col",style:{paddingBottom:"var(--tmex-safe-area-bottom)"},children:s})})]})}function uU({className:t,onClick:n,...a}){const{toggleSidebar:i}=Us();return V.jsxs(Jp,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:st(t),onClick:s=>{n==null||n(s),i()},...a,children:[V.jsx(GN,{}),V.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function fU({className:t,...n}){return V.jsx("main",{"data-slot":"sidebar-inset",className:st("bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col",t),...n})}function dU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:st("gap-2 p-2 flex flex-col",t),...n})}function hU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:st("gap-2 p-2 flex flex-col",t),...n})}function mU({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:st("no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...n})}function E1({className:t,...n}){return V.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:st("p-2 relative flex w-full min-w-0 flex-col",t),...n})}function pU({className:t,render:n,...a}){return bc({defaultTagName:"div",props:Eo({className:st("text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",t)},a),render:n,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function gU({className:t,...n}){return V.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:st("gap-0 flex w-full min-w-0 flex-col",t),...n})}function yU({className:t,...n}){return V.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:st("group/menu-item relative",t),...n})}const vU=$p("ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function bU({render:t,isActive:n=!1,variant:a="default",size:i="default",tooltip:s,className:l,...u}){const{isMobile:f,state:m}=Us(),h=bc({defaultTagName:"button",props:Eo({className:st(vU({variant:a,size:i}),l)},u),render:s?eU:t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:i,active:n}});return s?(typeof s=="string"&&(s={children:s}),V.jsxs(J4,{children:[h,V.jsx(tU,{side:"right",align:"center",hidden:m!=="collapsed"||f,...s})]})):h}function SU({className:t,render:n,showOnHover:a=!1,...i}){return bc({defaultTagName:"button",props:Eo({className:st("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0",a&&"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",t)},i),render:n,state:{slot:"sidebar-menu-action",sidebar:"menu-action"}})}function wU({className:t,...n}){return V.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:st("border-sidebar-border mx-3.5 translate-x-px gap-1 border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col",t),...n})}function xU({className:t,...n}){return V.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:st("group/menu-sub-item relative",t),...n})}function EU({render:t,size:n="md",isActive:a=!1,className:i,...s}){return bc({defaultTagName:"a",props:Eo({className:st("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",i)},s),render:t,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:n,active:a}})}function Of({children:t,onClick:n,...a}){const{isMobile:i,setOpenMobile:s}=Us(),l=u=>{i&&s(!1),n==null||n(u)};return V.jsx(Ip,{...a,onClick:l,children:t})}function RU({items:t}){const{t:n}=gc();return V.jsx(E1,{children:V.jsx(gU,{children:t.map(a=>{var i,s;return V.jsxs(uk,{defaultOpen:a.isActive,render:V.jsx(yU,{}),children:[V.jsx(Of,{to:a.url,children:V.jsxs(bU,{tooltip:n(a.title),children:[V.jsx(a.icon,{}),V.jsx("span",{children:n(a.title)})]})}),(i=a.items)!=null&&i.length?V.jsxs(V.Fragment,{children:[V.jsxs(fk,{render:V.jsx(SU,{className:"data-[state=open]:rotate-90"}),children:[V.jsx(HN,{}),V.jsx("span",{className:"sr-only",children:"Toggle"})]}),V.jsx(dk,{children:V.jsx(wU,{children:(s=a.items)==null?void 0:s.map(l=>V.jsx(xU,{children:V.jsx(Of,{to:l.url,children:V.jsx(EU,{children:V.jsx("span",{children:n(l.title)})})})},l.title))})})]}):null]},a.title)})})})}const TU=$p("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Sp({className:t,variant:n="default",render:a,...i}){return bc({defaultTagName:"span",props:Eo({className:st(TU({className:t,variant:n}))},i),render:a,state:{slot:"badge",variant:n}})}const CU={auth_failed:"authFailed",agent_unavailable:"agentUnavailable",agent_no_identity:"agentNoIdentity",ssh_config_ref_not_supported:"configRefNotSupported",network_unreachable:"networkUnreachable",connection_refused:"connectionRefused",timeout:"timeout",host_not_found:"hostNotFound",handshake_failed:"handshakeFailed",tmux_unavailable:"tmuxUnavailable",connection_closed:"connectionClosed"};function OU({deviceId:t,className:n}){const{t:a}=gc(),i=Lr(l=>l.deviceReconnecting[t]),s=Lr(l=>l.deviceErrors[t]);if(i)return V.jsxs(Sp,{variant:"outline",title:i.message,className:st("h-5 gap-1 border-amber-400/40 bg-amber-500/10 px-1.5 text-[10px] font-normal text-amber-700 dark:text-amber-300",n),children:[V.jsx(e_,{className:"h-3 w-3 animate-spin"}),V.jsx("span",{className:"truncate max-w-[120px]",children:i.message})]});if(s){const l=CU[s.type]??"unknown",u=a(`deviceStatus.errorBadge.${l}`),f=[u,s.message,s.rawMessage].filter(Boolean).join(`
|
|
214
|
+
`);return V.jsxs(Sp,{variant:"outline",title:f,className:st("h-5 gap-1 border-red-400/40 bg-red-500/10 px-1.5 text-[10px] font-normal text-red-700 dark:text-red-300",n),children:[V.jsx(BN,{className:"h-3 w-3"}),V.jsx("span",{className:"truncate max-w-[120px]",children:u})]})}return null}const R1=x.createContext(void 0);function Ff(){const t=x.useContext(R1);if(t===void 0)throw new Error(Br(53));return t}let Mf=(function(t){return t.scrollAreaCornerHeight="--scroll-area-corner-height",t.scrollAreaCornerWidth="--scroll-area-corner-width",t})({});const $u=500,hw=16;function Ur(t,n,a){if(!t)return 0;const i=getComputedStyle(t),s=a==="x"?"Inline":"Block";return a==="x"&&n==="margin"?parseFloat(i[`${n}InlineStart`])*2:parseFloat(i[`${n}${s}Start`])+parseFloat(i[`${n}${s}End`])}let MU=(function(t){return t.orientation="data-orientation",t.hovering="data-hovering",t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({});const Zu="base-ui-disable-scrollbar",T1={className:Zu,getElement(t){return V.jsx("style",{nonce:t,href:Zu,precedence:"base-ui:low",children:`.${Zu}{scrollbar-width:none}.${Zu}::-webkit-scrollbar{display:none}`})}};let os=(function(t){return t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({});const dg={hasOverflowX:t=>t?{[os.hasOverflowX]:""}:null,hasOverflowY:t=>t?{[os.hasOverflowY]:""}:null,overflowXStart:t=>t?{[os.overflowXStart]:""}:null,overflowXEnd:t=>t?{[os.overflowXEnd]:""}:null,overflowYStart:t=>t?{[os.overflowYStart]:""}:null,overflowYEnd:t=>t?{[os.overflowYEnd]:""}:null,cornerHidden:()=>null},AU=x.createContext(void 0),DU={disableStyleElements:!1};function NU(){return x.useContext(AU)??DU}const _U={x:0,y:0},mw={width:0,height:0},kU={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},LU={x:!1,y:!1,corner:!1},zU=x.forwardRef(function(n,a){const{render:i,className:s,overflowEdgeThreshold:l,...u}=n,f=UU(l),m=yc(),h=Ia(),y=Ia(),{nonce:p,disableStyleElements:b}=NU(),[v,S]=x.useState(!1),[E,R]=x.useState(!1),[T,N]=x.useState(!1),[_,M]=x.useState(!1),[P,H]=x.useState(mw),[O,L]=x.useState(mw),[K,re]=x.useState(kU),[I,A]=x.useState(LU),j=x.useRef(null),W=x.useRef(null),X=x.useRef(null),D=x.useRef(null),F=x.useRef(null),z=x.useRef(null),ie=x.useRef(null),le=x.useRef(!1),k=x.useRef(0),Q=x.useRef(0),$=x.useRef(0),ce=x.useRef(0),fe=x.useRef("vertical"),pe=x.useRef(_U),ye=Ye(Ce=>{const Te=Ce.x-pe.current.x,Pe=Ce.y-pe.current.y;pe.current=Ce,Pe!==0&&(N(!0),h.start($u,()=>{N(!1)})),Te!==0&&(R(!0),y.start($u,()=>{R(!1)}))}),Oe=Ye(Ce=>{Ce.button===0&&(le.current=!0,k.current=Ce.clientY,Q.current=Ce.clientX,fe.current=Ce.currentTarget.getAttribute(MU.orientation),W.current&&($.current=W.current.scrollTop,ce.current=W.current.scrollLeft),F.current&&fe.current==="vertical"&&F.current.setPointerCapture(Ce.pointerId),z.current&&fe.current==="horizontal"&&z.current.setPointerCapture(Ce.pointerId))}),we=Ye(Ce=>{if(!le.current)return;const Te=Ce.clientY-k.current,Pe=Ce.clientX-Q.current;if(W.current){const tt=W.current.scrollHeight,Fe=W.current.clientHeight,mt=W.current.scrollWidth,lt=W.current.clientWidth;if(F.current&&X.current&&fe.current==="vertical"){const Ve=Ur(X.current,"padding","y"),zt=Ur(F.current,"margin","y"),Wt=F.current.offsetHeight,ln=X.current.offsetHeight-Wt-Ve-zt,it=Te/ln;W.current.scrollTop=$.current+it*(tt-Fe),Ce.preventDefault(),N(!0),h.start($u,()=>{N(!1)})}if(z.current&&D.current&&fe.current==="horizontal"){const Ve=Ur(D.current,"padding","x"),zt=Ur(z.current,"margin","x"),Wt=z.current.offsetWidth,ln=D.current.offsetWidth-Wt-Ve-zt,it=Pe/ln;W.current.scrollLeft=ce.current+it*(mt-lt),Ce.preventDefault(),R(!0),y.start($u,()=>{R(!1)})}}}),Qe=Ye(Ce=>{le.current=!1,F.current&&fe.current==="vertical"&&F.current.releasePointerCapture(Ce.pointerId),z.current&&fe.current==="horizontal"&&z.current.releasePointerCapture(Ce.pointerId)});function Je(Ce){M(Ce.pointerType==="touch")}function se(Ce){if(Je(Ce),Ce.pointerType!=="touch"){const Te=Tt(j.current,Ce.target);S(Te)}}const ge=x.useMemo(()=>({scrolling:E||T,hasOverflowX:!I.x,hasOverflowY:!I.y,overflowXStart:K.xStart,overflowXEnd:K.xEnd,overflowYStart:K.yStart,overflowYEnd:K.yEnd,cornerHidden:I.corner}),[E,T,I.x,I.y,I.corner,K]),ve={role:"presentation",onPointerEnter:se,onPointerMove:se,onPointerDown:Je,onPointerLeave(){S(!1)},style:{position:"relative",[Mf.scrollAreaCornerHeight]:`${P.height}px`,[Mf.scrollAreaCornerWidth]:`${P.width}px`}},He=dn("div",n,{state:ge,ref:[a,j],props:[ve,u],stateAttributesMapping:dg}),Ee=x.useMemo(()=>({handlePointerDown:Oe,handlePointerMove:we,handlePointerUp:Qe,handleScroll:ye,cornerSize:P,setCornerSize:H,thumbSize:O,setThumbSize:L,touchModality:_,cornerRef:ie,scrollingX:E,setScrollingX:R,scrollingY:T,setScrollingY:N,hovering:v,setHovering:S,viewportRef:W,rootRef:j,scrollbarYRef:X,scrollbarXRef:D,thumbYRef:F,thumbXRef:z,rootId:m,hiddenState:I,setHiddenState:A,overflowEdges:K,setOverflowEdges:re,viewportState:ge,overflowEdgeThreshold:f}),[Oe,we,Qe,ye,P,O,_,E,R,T,N,v,S,m,I,K,ge,f]);return V.jsxs(R1.Provider,{value:Ee,children:[!b&&T1.getElement(p),He]})});function UU(t){if(typeof t=="number"){const n=Math.max(0,t);return{xStart:n,xEnd:n,yStart:n,yEnd:n}}return{xStart:Math.max(0,(t==null?void 0:t.xStart)||0),xEnd:Math.max(0,(t==null?void 0:t.xEnd)||0),yStart:Math.max(0,(t==null?void 0:t.yStart)||0),yEnd:Math.max(0,(t==null?void 0:t.yEnd)||0)}}const HU=x.createContext(void 0);function ls(t,n=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(t,a))}function jU(t,n){if(typeof IntersectionObserver>"u")return()=>{};const a=new IntersectionObserver(i=>{i.forEach(s=>{s.intersectionRatio>0&&(n(),a.disconnect())})});return a.observe(t),()=>{a.disconnect()}}let Oi=(function(t){return t.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",t.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",t.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",t.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",t})({});const pw=1;function gw(t,n){if(n<=0)return 0;const a=ls(t,0,n),i=a,s=n-a,l=i<=pw,u=s<=pw;return l&&u?i<=s?0:n:l?0:u?n:a}let yw=!1;function BU(){yw||eg||(typeof CSS<"u"&&"registerProperty"in CSS&&[Oi.scrollAreaOverflowXStart,Oi.scrollAreaOverflowXEnd,Oi.scrollAreaOverflowYStart,Oi.scrollAreaOverflowYEnd].forEach(t=>{try{CSS.registerProperty({name:t,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),yw=!0)}const PU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{viewportRef:u,scrollbarYRef:f,scrollbarXRef:m,thumbYRef:h,thumbXRef:y,cornerRef:p,cornerSize:b,setCornerSize:v,setThumbSize:S,rootId:E,setHiddenState:R,hiddenState:T,handleScroll:N,setHovering:_,setOverflowEdges:M,overflowEdges:P,overflowEdgeThreshold:H,scrollingX:O,scrollingY:L}=Ff(),K=fg(),re=x.useRef(!0),I=Ia(),A=Ia(),j=Ye(()=>{const ie=u.current,le=f.current,k=m.current,Q=h.current,$=y.current,ce=p.current;if(!ie)return;const fe=ie.scrollHeight,pe=ie.scrollWidth,ye=ie.clientHeight,Oe=ie.clientWidth,we=ie.scrollTop,Qe=ie.scrollLeft;if(fe===0||pe===0)return;const Je=ye>=fe,se=Oe>=pe,ge=Oe/pe,ve=ye/fe,He=Math.max(0,pe-Oe),Ee=Math.max(0,fe-ye);let Ce=0,Te=0;if(!se){let Xe=0;K==="rtl"?Xe=ls(-Qe,0,He):Xe=ls(Qe,0,He),Ce=gw(Xe,He),Te=He-Ce}const Pe=Je?0:ls(we,0,Ee),tt=Je?0:gw(Pe,Ee),Fe=Je?0:Ee-tt,mt=se?0:Oe,lt=Je?0:ye;let Ve=0,zt=0;!se&&!Je&&(Ve=(le==null?void 0:le.offsetWidth)||0,zt=(k==null?void 0:k.offsetHeight)||0);const Wt=b.width===0&&b.height===0,ln=Wt?Ve:0,it=Wt?zt:0,Ct=Ur(k,"padding","x"),At=Ur(le,"padding","y"),hn=Ur($,"margin","x"),mn=Ur(Q,"margin","y"),Bn=mt-Ct-hn,Dt=lt-At-mn,xn=k?Math.min(k.offsetWidth-ln,Bn):Bn,$t=le?Math.min(le.offsetHeight-it,Dt):Dt,rr=Math.max(hw,xn*ge),Yn=Math.max(hw,$t*ve);if(S(Xe=>Xe.height===Yn&&Xe.width===rr?Xe:{width:rr,height:Yn}),le&&Q){const Xe=le.offsetHeight-Yn-At-mn,vt=fe-ye,Yt=vt===0?0:we/vt,je=Math.min(Xe,Math.max(0,Yt*Xe));Q.style.transform=`translate3d(0,${je}px,0)`}if(k&&$){const Xe=k.offsetWidth-rr-Ct-hn,vt=pe-Oe,Yt=vt===0?0:Qe/vt,je=K==="rtl"?ls(Yt*Xe,-Xe,0):ls(Yt*Xe,0,Xe);$.style.transform=`translate3d(${je}px,0,0)`}const nt=[[Oi.scrollAreaOverflowXStart,Ce],[Oi.scrollAreaOverflowXEnd,Te],[Oi.scrollAreaOverflowYStart,tt],[Oi.scrollAreaOverflowYEnd,Fe]];for(const[Xe,vt]of nt)ie.style.setProperty(Xe,`${vt}px`);ce&&(se||Je?v({width:0,height:0}):!se&&!Je&&v({width:Ve,height:zt})),R(Xe=>{const vt=Je||se;return Xe.y===Je&&Xe.x===se&&Xe.corner===vt?Xe:{y:Je,x:se,corner:vt}});const yt={xStart:!se&&Ce>H.xStart,xEnd:!se&&Te>H.xEnd,yStart:!Je&&tt>H.yStart,yEnd:!Je&&Fe>H.yEnd};M(Xe=>Xe.xStart===yt.xStart&&Xe.xEnd===yt.xEnd&&Xe.yStart===yt.yStart&&Xe.yEnd===yt.yEnd?Xe:yt)});$e(()=>{if(!u.current)return;BU();let ie=!1;return jU(u.current,()=>{if(!ie){ie=!0;return}j()})},[j,u]),$e(()=>{queueMicrotask(j)},[j,T,K]),$e(()=>{var ie;(ie=u.current)!=null&&ie.matches(":hover")&&_(!0)},[u,_]),x.useEffect(()=>{const ie=u.current;if(typeof ResizeObserver>"u"||!ie)return;let le=!1;const k=new ResizeObserver(()=>{if(!le){le=!0;return}j()});return k.observe(ie),A.start(0,()=>{const Q=ie.getAnimations({subtree:!0});Q.length!==0&&Promise.allSettled(Q.map($=>$.finished)).then(j).catch(()=>{})}),()=>{k.disconnect(),A.clear()}},[j,u,A]);function W(){re.current=!1}const X={role:"presentation",...E&&{"data-id":`${E}-viewport`},...(!T.x||!T.y)&&{tabIndex:0},className:T1.className,style:{overflow:"scroll"},onScroll(){u.current&&(j(),re.current||N({x:u.current.scrollLeft,y:u.current.scrollTop}),I.start(100,()=>{re.current=!0}))},onWheel:W,onTouchMove:W,onPointerMove:W,onPointerEnter:W,onKeyDown:W},D=x.useMemo(()=>({scrolling:O||L,hasOverflowX:!T.x,hasOverflowY:!T.y,overflowXStart:P.xStart,overflowXEnd:P.xEnd,overflowYStart:P.yStart,overflowYEnd:P.yEnd,cornerHidden:T.corner}),[O,L,T.x,T.y,T.corner,P]),F=dn("div",n,{ref:[a,u],state:D,props:[X,l],stateAttributesMapping:dg}),z=x.useMemo(()=>({computeThumbPosition:j}),[j]);return V.jsx(HU.Provider,{value:z,children:F})}),C1=x.createContext(void 0);function IU(){const t=x.useContext(C1);if(t===void 0)throw new Error(Br(54));return t}let Af=(function(t){return t.scrollAreaThumbHeight="--scroll-area-thumb-height",t.scrollAreaThumbWidth="--scroll-area-thumb-width",t})({});const FU=x.forwardRef(function(n,a){const{render:i,className:s,orientation:l="vertical",keepMounted:u=!1,...f}=n,{hovering:m,scrollingX:h,scrollingY:y,hiddenState:p,overflowEdges:b,scrollbarYRef:v,scrollbarXRef:S,viewportRef:E,thumbYRef:R,thumbXRef:T,handlePointerDown:N,handlePointerUp:_,rootId:M,thumbSize:P}=Ff(),H={hovering:m,scrolling:{horizontal:h,vertical:y}[l],orientation:l,hasOverflowX:!p.x,hasOverflowY:!p.y,overflowXStart:b.xStart,overflowXEnd:b.xEnd,overflowYStart:b.yStart,overflowYEnd:b.yEnd,cornerHidden:p.corner},O=fg();x.useEffect(()=>{const j=E.current,W=l==="vertical"?v.current:S.current;if(!W)return;function X(D){if(!(!j||!W||D.ctrlKey)){if(D.preventDefault(),l==="vertical"){if(j.scrollTop===0&&D.deltaY<0)return}else if(j.scrollLeft===0&&D.deltaX<0)return;if(l==="vertical"){if(j.scrollTop===j.scrollHeight-j.clientHeight&&D.deltaY>0)return}else if(j.scrollLeft===j.scrollWidth-j.clientWidth&&D.deltaX>0)return;l==="vertical"?j.scrollTop+=D.deltaY:j.scrollLeft+=D.deltaX}}return W.addEventListener("wheel",X,{passive:!1}),()=>{W.removeEventListener("wheel",X)}},[l,S,v,E]);const L={...M&&{"data-id":`${M}-scrollbar`},onPointerDown(j){if(j.button===0&&j.currentTarget===j.target&&E.current){if(R.current&&v.current&&l==="vertical"){const W=Ur(R.current,"margin","y"),X=Ur(v.current,"padding","y"),D=R.current.offsetHeight,F=v.current.getBoundingClientRect(),z=j.clientY-F.top-D/2-X+W/2,ie=E.current.scrollHeight,le=E.current.clientHeight,k=v.current.offsetHeight-D-X-W,$=z/k*(ie-le);E.current.scrollTop=$}if(T.current&&S.current&&l==="horizontal"){const W=Ur(T.current,"margin","x"),X=Ur(S.current,"padding","x"),D=T.current.offsetWidth,F=S.current.getBoundingClientRect(),z=j.clientX-F.left-D/2-X+W/2,ie=E.current.scrollWidth,le=E.current.clientWidth,k=S.current.offsetWidth-D-X-W,Q=z/k;let $;O==="rtl"?($=(1-Q)*(ie-le),E.current.scrollLeft<=0&&($=-$)):$=Q*(ie-le),E.current.scrollLeft=$}N(j)}},onPointerUp:_,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...l==="vertical"&&{top:0,bottom:`var(${Mf.scrollAreaCornerHeight})`,insetInlineEnd:0,[Af.scrollAreaThumbHeight]:`${P.height}px`},...l==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Mf.scrollAreaCornerWidth})`,bottom:0,[Af.scrollAreaThumbWidth]:`${P.width}px`}}},K=dn("div",n,{ref:[a,l==="vertical"?v:S],state:H,props:[L,f],stateAttributesMapping:dg}),re=x.useMemo(()=>({orientation:l}),[l]),I=l==="vertical"?p.y:p.x;return u||!I?V.jsx(C1.Provider,{value:re,children:K}):null}),YU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{thumbYRef:u,thumbXRef:f,handlePointerDown:m,handlePointerMove:h,handlePointerUp:y,setScrollingX:p,setScrollingY:b}=Ff(),{orientation:v}=IU();return dn("div",n,{ref:[a,v==="vertical"?u:f],state:{orientation:v},props:[{onPointerDown:m,onPointerMove:h,onPointerUp(R){v==="vertical"&&b(!1),v==="horizontal"&&p(!1),y(R)},style:{...v==="vertical"&&{height:`var(${Af.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${Af.scrollAreaThumbWidth})`}}},l]})}),VU=x.forwardRef(function(n,a){const{render:i,className:s,...l}=n,{cornerRef:u,cornerSize:f,hiddenState:m}=Ff(),h=dn("div",n,{ref:[a,u],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:f.width,height:f.height}},l]});return m.corner?null:h});function qU({className:t,children:n,...a}){return V.jsxs(zU,{"data-slot":"scroll-area",className:st("relative",t),...a,children:[V.jsx(PU,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:n}),V.jsx(GU,{}),V.jsx(VU,{})]})}function GU({className:t,orientation:n="vertical",...a}){return V.jsx(FU,{"data-slot":"scroll-area-scrollbar","data-orientation":n,orientation:n,className:st("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none","[@media(any-pointer:coarse)]:hidden",t),...a,children:V.jsx(YU,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function DH(t){return t}function XU(t){return encodeURIComponent(t)}function KU(){const{t}=gc(),n=Ya(),a=mx(),{isMobile:i,setOpenMobile:s}=Us(),{toggleDevice:l}=AN(),u=Ql("/devices/:deviceId/windows/:windowId/panes/:paneId",n.pathname),f=u==null?void 0:u.params.deviceId,m=u==null?void 0:u.params.windowId,h=u==null?void 0:u.params.paneId,y=Lr(I=>I.snapshots),p=Lr(I=>I.connectedDevices),b=Lr(I=>I.closeWindow),v=Lr(I=>I.closePane),S=ec(I=>{var A;return((A=I.settings)==null?void 0:A.language)??"en_US"}),{data:E}=TC({queryKey:["devices"],queryFn:async()=>{const I=await fetch("/api/devices");if(!I.ok)throw new Error("Failed to fetch devices");return I.json()},throwOnError:!1}),R=Lr(I=>I.hydrateDeviceErrors);x.useEffect(()=>{E!=null&&E.devices&&R(E.devices.map(I=>({deviceId:I.id,lastError:I.lastError??null,lastErrorType:I.lastErrorType??null})))},[E,R]);const T=x.useCallback((I,A)=>{a(I,{replace:(A==null?void 0:A.replace)??!0}),i&&s(!1)},[a,i,s]),N=x.useCallback((I,A,j)=>{M.current=null,window.dispatchEvent(new CustomEvent("tmex:user-initiated-selection",{detail:{deviceId:I,windowId:A,paneId:j}})),T(`/devices/${I}/windows/${A}/panes/${XU(j)}`)},[T]),_=Lr(I=>I.selectWindow),M=x.useRef(null);x.useEffect(()=>{var z,ie;const I=M.current;if(!I)return;if(Date.now()-I.at>5e3){M.current=null;return}const{deviceId:A,windowId:j}=I,W=y[A],X=(z=W==null?void 0:W.session)==null?void 0:z.windows;if(!X)return;const D=X.find(le=>le.id===j);if(!((ie=D==null?void 0:D.panes)!=null&&ie.length))return;M.current=null;const F=D.panes.find(le=>le.active)??D.panes[0];N(A,j,F.id)},[y,N]);const P=x.useCallback((I,A,j)=>{_(I,A);const W=j.find(X=>X.active)??j[0];W?(N(I,A,W.id),M.current=null):M.current={deviceId:I,windowId:A,at:Date.now()}},[N,_]),H=x.useCallback((I,A)=>{A?I===f&&T("/devices"):T(`/devices/${I}`),l(I,A)},[l,f,T]),O=x.useCallback((I,A)=>{I===f&&A===m&&T("/devices"),b(I,A)},[b,f,m,T]),L=x.useCallback(I=>{Lr.getState().createWindow(I)},[]),K=(E==null?void 0:E.devices)??[],re=x.useMemo(()=>[...K].sort((I,A)=>I.name.localeCompare(A.name,yA(S),{numeric:!0,sensitivity:"base"})),[K,S]);return V.jsxs(E1,{className:"flex flex-col flex-1 min-h-0",children:[V.jsx(pU,{children:t("device.devices")}),V.jsx(qU,{className:"flex-1 min-h-0",children:V.jsxs("div",{className:"space-y-1.5 py-2",children:[re.map(I=>{var A,j;return V.jsx(QU,{device:I,windows:((j=(A=y[I.id])==null?void 0:A.session)==null?void 0:j.windows)??null,isConnected:p.has(I.id),selectedWindowId:m,selectedPaneId:h,onConnectToggle:()=>H(I.id,p.has(I.id)),onCreateWindow:L,onCloseWindow:O,onClosePane:v,onPaneClick:N,onWindowClick:P},I.id)}),re.length===0&&V.jsx("div",{className:"text-center text-sm text-muted-foreground py-4",children:t("sidebar.noDevices")})]})})]})}function QU({device:t,windows:n,isConnected:a,selectedWindowId:i,selectedPaneId:s,onConnectToggle:l,onCreateWindow:u,onCloseWindow:f,onClosePane:m,onPaneClick:h,onWindowClick:y}){const{t:p}=gc(),b=t.type==="local"?Ux:IN;return V.jsxs("div",{"data-testid":`device-item-${t.id}`,className:st("rounded-lg border overflow-hidden text-select-none",a?"bg-card/50":"bg-muted/20"),onClick:a?void 0:l,children:[V.jsx("div",{className:"px-3 py-1 bg-muted/30 border-b",children:V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx(b,{className:"ml-1 h-4 w-4 text-muted-foreground shrink-0"}),V.jsx("span",{className:"flex-1 truncate text-xs font-medium text-select-none",children:t.name}),V.jsx(OU,{deviceId:t.id,className:"shrink-0"}),V.jsx("div",{className:st("h-2 w-2 rounded-full shrink-0",a?"bg-emerald-500":"bg-gray-400")}),V.jsx(Jp,{variant:"ghost",size:"icon-xs",onClick:v=>{v.stopPropagation(),l()},"data-testid":a?`device-disconnect-${t.id}`:`device-connect-${t.id}`,title:p(a?"device.disconnect":"device.connect"),children:a?V.jsx(WN,{className:"h-3.5 w-3.5 text-orange-500"}):V.jsx(ZN,{className:"h-3.5 w-3.5 text-emerald-500"})})]})}),a&&V.jsxs("div",{className:"p-1 space-y-0.5",children:[!n&&V.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:p("device.connecting")}),(n==null?void 0:n.length)===0&&V.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5 text-center",children:p("window.noWindows")}),n==null?void 0:n.map(v=>V.jsx(WU,{deviceId:t.id,window:v,isSelected:v.id===i,selectedPaneId:s,onPaneClick:h,onWindowClick:y,onCloseWindow:f,onClosePane:m},v.id)),V.jsxs("button",{type:"button","data-testid":`window-create-${t.id}`,onPointerDown:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),onClick:()=>u(t.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:[V.jsx(KN,{className:"h-3.5 w-3.5 shrink-0"}),V.jsx("span",{className:"text-xs",children:p("window.new")})]})]})]})}function WU({deviceId:t,window:n,isSelected:a,selectedPaneId:i,onPaneClick:s,onWindowClick:l,onCloseWindow:u,onClosePane:f}){const m=n.panes.length>1,h=n.panes.find(p=>p.id===i),y=a&&!!h;return V.jsxs("div",{className:"space-y-0.5",children:[V.jsxs("div",{className:"group relative",children:[V.jsxs("button",{type:"button",onClick:()=>l(t,n.id,n.panes),"data-testid":`window-item-${n.id}`,className:st("w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors pr-7",y?"bg-primary/15 text-primary border border-primary/30":"hover:bg-accent/50 text-foreground border border-transparent"),children:[V.jsx(Sp,{variant:y?"default":"outline",className:"h-5 text-[10px] px-1.5 shrink-0",children:n.index}),V.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:n.name}),n.active&&V.jsx("span",{className:st("h-1.5 w-1.5 rounded-full shrink-0",y?"bg-foreground/80":"bg-foreground/50")})]}),V.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),u(t,n.id)},className:st("absolute right-1.5 top-1/2 -translate-y-1/2 h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",y?"opacity-100":"opacity-0 group-hover:opacity-100"),title:"Close window",children:V.jsx("span",{className:"text-xs leading-none",children:"×"})})]}),m&&V.jsx("div",{className:"ml-4 pl-2 border-l border-border/50 space-y-0.5",children:n.panes.map(p=>{const b=p.id===i;return V.jsxs("div",{className:"group relative",children:[V.jsxs("button",{type:"button",onClick:()=>s(t,n.id,p.id),"data-testid":`pane-item-${p.id}`,className:st("w-full flex items-center gap-2 px-2 py-1 rounded-md text-left transition-colors pr-7",b?"bg-primary/10 text-primary border border-primary/20":"hover:bg-accent/30 text-muted-foreground border border-transparent"),children:[V.jsx("span",{className:"text-[10px] font-mono opacity-60 w-4",children:p.index}),V.jsx("span",{className:"flex-1 truncate text-xs",children:p.title||`Pane ${p.index}`}),p.active&&V.jsx("span",{className:st("h-1 w-1 rounded-full shrink-0",b?"bg-foreground/80":"bg-foreground/50")})]}),V.jsx("button",{type:"button",onClick:v=>{v.stopPropagation(),f(t,n.id,p.id,n.panes.length)},className:st("absolute right-1.5 top-1/2 -translate-y-1/2 h-5 w-5 flex items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground transition-opacity",b?"opacity-100":"opacity-0 group-hover:opacity-100"),title:"Close pane",children:V.jsx("span",{className:"text-xs leading-none",children:"×"})})]},p.id)})})]})}function $U(t,n){let a;try{a=t()}catch{return}return{getItem:s=>{var l;const u=m=>m===null?null:JSON.parse(m,void 0),f=(l=a.getItem(s))!=null?l:null;return f instanceof Promise?f.then(u):u(f)},setItem:(s,l)=>a.setItem(s,JSON.stringify(l,void 0)),removeItem:s=>a.removeItem(s)}}const wp=t=>n=>{try{const a=t(n);return a instanceof Promise?a:{then(i){return wp(i)(a)},catch(i){return this}}}catch(a){return{then(i){return this},catch(i){return wp(i)(a)}}}},ZU=(t,n)=>(a,i,s)=>{let l={storage:$U(()=>window.localStorage),partialize:R=>R,version:0,merge:(R,T)=>({...T,...R}),...n},u=!1,f=0;const m=new Set,h=new Set;let y=l.storage;if(!y)return t((...R)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),a(...R)},i,s);const p=()=>{const R=l.partialize({...i()});return y.setItem(l.name,{state:R,version:l.version})},b=s.setState;s.setState=(R,T)=>(b(R,T),p());const v=t((...R)=>(a(...R),p()),i,s);s.getInitialState=()=>v;let S;const E=()=>{var R,T;if(!y)return;const N=++f;u=!1,m.forEach(M=>{var P;return M((P=i())!=null?P:v)});const _=((T=l.onRehydrateStorage)==null?void 0:T.call(l,(R=i())!=null?R:v))||void 0;return wp(y.getItem.bind(y))(l.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==l.version){if(l.migrate){const P=l.migrate(M.state,M.version);return P instanceof Promise?P.then(H=>[!0,H]):[!0,P]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var P;if(N!==f)return;const[H,O]=M;if(S=l.merge(O,(P=i())!=null?P:v),a(S,!0),H)return p()}).then(()=>{N===f&&(_==null||_(S,void 0),S=i(),u=!0,h.forEach(M=>M(S)))}).catch(M=>{N===f&&(_==null||_(void 0,M))})};return s.persist={setOptions:R=>{l={...l,...R},R.storage&&(y=R.storage)},clearStorage:()=>{y==null||y.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>E(),hasHydrated:()=>u,onHydrate:R=>(m.add(R),()=>{m.delete(R)}),onFinishHydration:R=>(h.add(R),()=>{h.delete(R)})},l.skipHydration||E(),S||v},JU=ZU,vw=Vp()(JU(t=>({sidebarCollapsed:!1,inputMode:"direct",editorSendWithEnter:!0,theme:"dark",editorHistory:[],editorDrafts:{},setSidebarCollapsed:n=>t({sidebarCollapsed:n}),setInputMode:n=>t({inputMode:n}),setEditorSendWithEnter:n=>t({editorSendWithEnter:n}),setTheme:n=>t({theme:n}),addEditorHistory:n=>t(a=>({editorHistory:[n,...a.editorHistory.slice(0,49)]})),setEditorDraft:(n,a)=>t(i=>({editorDrafts:{...i.editorDrafts,[n]:a}})),removeEditorDraft:n=>t(a=>{if(!(n in a.editorDrafts))return a;const i={...a.editorDrafts};return delete i[n],{editorDrafts:i}})}),{name:"tmex-ui",partialize:t=>({sidebarCollapsed:t.sidebarCollapsed,inputMode:t.inputMode,editorSendWithEnter:t.editorSendWithEnter,theme:t.theme,editorHistory:t.editorHistory,editorDrafts:t.editorDrafts})}));function eH(){const{t}=gc(),{isMobile:n,setOpenMobile:a}=Us(),i=ec(y=>{var p;return(p=y.settings)==null?void 0:p.siteName}),s=ec(y=>y.fetchSettings);x.useEffect(()=>{s()},[s]);const l=i??"tmex",u=vw(y=>y.theme),f=vw(y=>y.setTheme),m=u==="dark",h=()=>{const y=m?"light":"dark";f(y),document.documentElement.classList.toggle("dark",y==="dark")};return V.jsxs("div",{className:"flex items-center gap-2 px-2",children:[V.jsxs(Of,{to:"/",className:"flex flex-1 items-center gap-3 overflow-hidden",children:[V.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-lg border-2 border-black",children:V.jsx("img",{src:"/logo.png",alt:l,className:"h-full w-full object-cover"})}),V.jsx("span",{className:"truncate text-sm font-semibold tracking-tight",children:l})]}),V.jsx("button",{type:"button",onClick:h,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":t(m?"settings.themeLight":"settings.themeDark"),title:t(m?"settings.themeLight":"settings.themeDark"),children:m?V.jsx(a_,{className:"h-4 w-4"}):V.jsx(VN,{className:"h-4 w-4"})}),V.jsx(Of,{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":t("sidebar.settings"),title:t("sidebar.settings"),children:V.jsx(n_,{className:"h-4 w-4"})}),n&&V.jsx("button",{type:"button","data-testid":"mobile-sidebar-close",onClick:()=>a(!1),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":t("nav.closeSidebar"),title:t("nav.closeSidebar"),children:V.jsx(Hx,{className:"h-4 w-4"})})]})}const tH=[{title:"nav.manageDevices",url:"/devices",icon:Ux}];function nH({...t}){return V.jsxs(cU,{variant:"inset",...t,children:[V.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),V.jsx(dU,{className:"py-3",children:V.jsx(eH,{})}),V.jsx(mU,{className:"flex flex-col",children:V.jsx(KU,{})}),V.jsxs(hU,{children:[V.jsx(RU,{items:tH}),V.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})}function rH(){var t;try{const n=localStorage.getItem("tmex-ui");if(!n){document.documentElement.classList.add("dark");return}const a=JSON.parse(n),i=(t=a==null?void 0:a.state)==null?void 0:t.theme,s=i==="dark"||i===void 0;document.documentElement.classList.toggle("dark",s)}catch{document.documentElement.classList.add("dark")}}rH();const aH=new uC({defaultOptions:{queries:{staleTime:5e3,retry:1}}});function iH(){return V.jsx(DN,{children:V.jsxs(lU,{children:[V.jsx(nH,{}),V.jsxs(fU,{className:"h-dvh overflow-hidden",children:[V.jsx("div",{className:"h-[var(--tmex-safe-area-top)]"}),V.jsx(w2,{}),V.jsx("div",{className:"h-[var(--tmex-safe-area-bottom)]"})]})]})})}function Ll({moduleLoader:t}){const[n,a]=x.useState(null),i=JO();x.useEffect(()=>{t().then(a)},[t]);const s=n==null?void 0:n.default,l=n==null?void 0:n.PageTitle,u=n==null?void 0:n.PageActions;return V.jsxs(V.Fragment,{children:[V.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:[V.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-4",children:[V.jsx(uU,{className:"-ml-1 shrink-0","data-testid":"mobile-sidebar-open"}),V.jsx(YL,{orientation:"vertical",className:"mr-2 shrink-0 data-[orientation=vertical]:h-4"}),V.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:l?V.jsx(l,{...i}):""})]}),V.jsx("div",{className:"flex shrink-0 items-center gap-1 px-4",children:u&&V.jsx(u,{...i})})]}),V.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 !pt-0 p-2 md:p-4 mb-2",children:V.jsx("div",{className:"bg-muted/50 min-h-0 flex-1 overflow-auto overscroll-auto rounded-xl [-webkit-overflow-scrolling:touch]",children:s?V.jsx(s,{}):null})})]})}const oH=()=>Ep(()=>import("./SettingsPage-Bi8Kez5a.js"),__vite__mapDeps([0,1,2,3])),bw=()=>Ep(()=>import("./DevicesPage-_g8yXgKX.js"),__vite__mapDeps([4,1,2])),Sw=()=>Ep(()=>import("./DevicePage-CQuQ0yeD.js"),__vite__mapDeps([5,2,3])),sH=G2([{path:"/",Component:iH,children:[{index:!0,element:V.jsx(Ll,{moduleLoader:bw})},{path:"devices",element:V.jsx(Ll,{moduleLoader:bw})},{path:"devices/:deviceId",element:V.jsx(Ll,{moduleLoader:Sw})},{path:"devices/:deviceId/windows/:windowId/panes/:paneId",element:V.jsx(Ll,{moduleLoader:Sw})},{path:"settings",element:V.jsx(Ll,{moduleLoader:oH})}]}]),O1=document.getElementById("root");if(!O1)throw new Error("Root element not found");NC.createRoot(O1).render(V.jsx(x.StrictMode,{children:V.jsxs(hC,{client:aH,children:[V.jsx(v2,{router:sH}),V.jsx(NM,{richColors:!0,position:"top-right",closeButton:!0,offset:{top:"calc(16px + var(--tmex-safe-area-top))",right:"16px",bottom:"16px",left:"16px"},mobileOffset:{top:"calc(12px + var(--tmex-safe-area-top))",right:"12px",bottom:"12px",left:"12px"},toastOptions:{duration:6e3}})]})}));export{r1 as $,Yz as A,Jp as B,Yx as C,x4 as D,Qt as E,h3 as F,vc as G,wc as H,cH as I,r4 as J,w1 as K,l3 as L,hH as M,K4 as N,Wr as O,E_ as P,s4 as Q,o4 as R,OH as S,yH as T,sg as U,If as V,a1 as W,Hx as X,Sr as Y,gr as Z,t3 as _,dC as a,Jn as a$,ht as a0,JE as a1,p1 as a2,CH as a3,Ls as a4,$e as a5,As as a6,y4 as a7,t1 as a8,n1 as a9,gH as aA,Gz as aB,Wz as aC,Bz as aD,Ni as aE,RH as aF,Vl as aG,EH as aH,AE as aI,TH as aJ,Rf as aK,dH as aL,FL as aM,Lr as aN,Ux as aO,KN as aP,IN as aQ,Sp as aR,OU as aS,YL as aT,Ip as aU,rL as aV,cc as aW,zm as aX,ql as aY,sC as aZ,zn as a_,Ia as aa,p4 as ab,Ye as ac,af as ad,nc as ae,Gp as af,Vx as ag,pH as ah,qx as ai,i1 as aj,WE as ak,Kz as al,fg as am,uH as an,fH as ao,s1 as ap,MH as aq,nk as ar,bn as as,Ba as at,Pa as au,qt as av,Tz as aw,zs as ax,zz as ay,Tt as az,ec as b,zw as b0,wH as b1,uL as b2,xH as b3,bH as b4,SH as b5,qu as b6,Ua as b7,A_ as b8,kf as b9,mx as bA,DH as bB,XU as bC,Fx as bD,kt as bE,Ro as bF,v4 as bG,_E as bH,S4 as bI,Xp as ba,rc as bb,mL as bc,tg as bd,dp as be,la as bf,HS as bg,Tm as bh,er as bi,dL as bj,hL as bk,Xx as bl,e1 as bm,Hz as bn,AH as bo,HE as bp,_z as bq,QL as br,NU as bs,ls as bt,wn as bu,eg as bv,T1 as bw,vH as bx,Jl as by,JO as bz,br as c,vw as d,TC as e,uf as f,i4 as g,ZL as h,An as i,V as j,st as k,E4 as l,JL as m,l4 as n,$L as o,Br as p,mH as q,x as r,Wp as s,yA as t,gc as u,Eo as v,tc as w,yc as x,dn as y,Bf as z};
|
|
215
|
+
//# sourceMappingURL=index-kXpemMRY.js.map
|