9remote 3.0.12 → 3.0.13
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/README.md +12 -10
- package/dist/cli.cjs +71 -71
- package/dist/server.cjs +175 -175
- package/dist/ui/assets/index-WDGxckRM.js +8 -0
- package/dist/ui/index.html +1 -1
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +2 -2
- package/dist/web/__next._full.txt +3 -3
- package/dist/web/__next._head.txt +1 -1
- package/dist/web/__next._index.txt +2 -2
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/3346-23aafd4add63869a.js +1 -0
- package/dist/web/_next/static/chunks/4023-66934a18c86e64c8.js +1 -0
- package/dist/web/_next/static/chunks/4958-179397687a9efabd.js +86 -0
- package/dist/web/_next/static/chunks/8387-9ffbf41a5664cf04.js +1 -0
- package/dist/web/_next/static/chunks/8669-9e059733295a6fc1.js +1 -0
- package/dist/web/_next/static/chunks/9958-35139b04963145ff.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/admins/{page-55a5b7d9e2cce009.js → page-cbe0a81654621c59.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/login/{page-0ee5816b25a58124.js → page-385a65c442c5f9eb.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/modes/{page-4a42062c1aa3bdfe.js → page-3c1c39a594e21bf9.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/ota/{page-f933a80b41b1fa71.js → page-71f6fb68d1dc9334.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/{page-9af75732b2cda9b6.js → page-680a917a0c0b046c.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/turn/{page-fbb8e50d077e6051.js → page-271235635424b233.js} +1 -1
- package/dist/web/_next/static/chunks/app/dev/question/page-8dc068c655f29856.js +1 -0
- package/dist/web/_next/static/chunks/app/login/page-798b68f514800b19.js +1 -0
- package/dist/web/_next/static/chunks/app/page-81affa2ae3534100.js +22 -0
- package/dist/web/_next/static/chunks/app/workspace/layout-123d4cfb7b9f0946.js +14 -0
- package/dist/web/_next/static/chunks/webpack-34aa84f85d3087cb.js +1 -0
- package/dist/web/_next/static/css/7bac24727badd523.css +1 -0
- package/dist/web/_not-found/__next._full.txt +2 -2
- package/dist/web/_not-found/__next._head.txt +1 -1
- package/dist/web/_not-found/__next._index.txt +2 -2
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/web/_not-found/__next._not-found.txt +1 -1
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +2 -2
- package/dist/web/admin/__next._full.txt +3 -3
- package/dist/web/admin/__next._head.txt +1 -1
- package/dist/web/admin/__next._index.txt +2 -2
- package/dist/web/admin/__next._tree.txt +2 -2
- package/dist/web/admin/__next.admin.__PAGE__.txt +2 -2
- package/dist/web/admin/__next.admin.txt +1 -1
- package/dist/web/admin/admins/__next._full.txt +3 -3
- package/dist/web/admin/admins/__next._head.txt +1 -1
- package/dist/web/admin/admins/__next._index.txt +2 -2
- package/dist/web/admin/admins/__next._tree.txt +2 -2
- package/dist/web/admin/admins/__next.admin.admins.__PAGE__.txt +2 -2
- package/dist/web/admin/admins/__next.admin.admins.txt +1 -1
- package/dist/web/admin/admins/__next.admin.txt +1 -1
- package/dist/web/admin/admins.html +1 -1
- package/dist/web/admin/admins.txt +3 -3
- package/dist/web/admin/login/__next._full.txt +3 -3
- package/dist/web/admin/login/__next._head.txt +1 -1
- package/dist/web/admin/login/__next._index.txt +2 -2
- package/dist/web/admin/login/__next._tree.txt +2 -2
- package/dist/web/admin/login/__next.admin.login.__PAGE__.txt +2 -2
- package/dist/web/admin/login/__next.admin.login.txt +1 -1
- package/dist/web/admin/login/__next.admin.txt +1 -1
- package/dist/web/admin/login.html +1 -1
- package/dist/web/admin/login.txt +3 -3
- package/dist/web/admin/modes/__next._full.txt +3 -3
- package/dist/web/admin/modes/__next._head.txt +1 -1
- package/dist/web/admin/modes/__next._index.txt +2 -2
- package/dist/web/admin/modes/__next._tree.txt +2 -2
- package/dist/web/admin/modes/__next.admin.modes.__PAGE__.txt +2 -2
- package/dist/web/admin/modes/__next.admin.modes.txt +1 -1
- package/dist/web/admin/modes/__next.admin.txt +1 -1
- package/dist/web/admin/modes.html +1 -1
- package/dist/web/admin/modes.txt +3 -3
- package/dist/web/admin/ota/__next._full.txt +3 -3
- package/dist/web/admin/ota/__next._head.txt +1 -1
- package/dist/web/admin/ota/__next._index.txt +2 -2
- package/dist/web/admin/ota/__next._tree.txt +2 -2
- package/dist/web/admin/ota/__next.admin.ota.__PAGE__.txt +2 -2
- package/dist/web/admin/ota/__next.admin.ota.txt +1 -1
- package/dist/web/admin/ota/__next.admin.txt +1 -1
- package/dist/web/admin/ota.html +1 -1
- package/dist/web/admin/ota.txt +3 -3
- package/dist/web/admin/turn/__next._full.txt +3 -3
- package/dist/web/admin/turn/__next._head.txt +1 -1
- package/dist/web/admin/turn/__next._index.txt +2 -2
- package/dist/web/admin/turn/__next._tree.txt +2 -2
- package/dist/web/admin/turn/__next.admin.turn.__PAGE__.txt +2 -2
- package/dist/web/admin/turn/__next.admin.turn.txt +1 -1
- package/dist/web/admin/turn/__next.admin.txt +1 -1
- package/dist/web/admin/turn.html +1 -1
- package/dist/web/admin/turn.txt +3 -3
- package/dist/web/admin.html +1 -1
- package/dist/web/admin.txt +3 -3
- package/dist/web/dev/question/__next._full.txt +3 -3
- package/dist/web/dev/question/__next._head.txt +1 -1
- package/dist/web/dev/question/__next._index.txt +2 -2
- package/dist/web/dev/question/__next._tree.txt +2 -2
- package/dist/web/dev/question/__next.dev.question.__PAGE__.txt +2 -2
- package/dist/web/dev/question/__next.dev.question.txt +1 -1
- package/dist/web/dev/question/__next.dev.txt +1 -1
- package/dist/web/dev/question.html +1 -1
- package/dist/web/dev/question.txt +3 -3
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +3 -3
- package/dist/web/login/__next._full.txt +3 -3
- package/dist/web/login/__next._head.txt +1 -1
- package/dist/web/login/__next._index.txt +2 -2
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +2 -2
- package/dist/web/login/__next.login.txt +1 -1
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +3 -3
- package/dist/web/workspace/__next._full.txt +3 -3
- package/dist/web/workspace/__next._head.txt +1 -1
- package/dist/web/workspace/__next._index.txt +2 -2
- package/dist/web/workspace/__next._tree.txt +2 -2
- package/dist/web/workspace/__next.workspace.__PAGE__.txt +1 -1
- package/dist/web/workspace/__next.workspace.txt +2 -2
- package/dist/web/workspace/browse/__next._full.txt +3 -3
- package/dist/web/workspace/browse/__next._head.txt +1 -1
- package/dist/web/workspace/browse/__next._index.txt +2 -2
- package/dist/web/workspace/browse/__next._tree.txt +2 -2
- package/dist/web/workspace/browse/__next.workspace.browse.__PAGE__.txt +1 -1
- package/dist/web/workspace/browse/__next.workspace.browse.txt +1 -1
- package/dist/web/workspace/browse/__next.workspace.txt +2 -2
- package/dist/web/workspace/browse.html +1 -1
- package/dist/web/workspace/browse.txt +3 -3
- package/dist/web/workspace/editor/__next._full.txt +3 -3
- package/dist/web/workspace/editor/__next._head.txt +1 -1
- package/dist/web/workspace/editor/__next._index.txt +2 -2
- package/dist/web/workspace/editor/__next._tree.txt +2 -2
- package/dist/web/workspace/editor/__next.workspace.editor.__PAGE__.txt +1 -1
- package/dist/web/workspace/editor/__next.workspace.editor.txt +1 -1
- package/dist/web/workspace/editor/__next.workspace.txt +2 -2
- package/dist/web/workspace/editor.html +1 -1
- package/dist/web/workspace/editor.txt +3 -3
- package/dist/web/workspace/files/__next._full.txt +3 -3
- package/dist/web/workspace/files/__next._head.txt +1 -1
- package/dist/web/workspace/files/__next._index.txt +2 -2
- package/dist/web/workspace/files/__next._tree.txt +2 -2
- package/dist/web/workspace/files/__next.workspace.files.__PAGE__.txt +1 -1
- package/dist/web/workspace/files/__next.workspace.files.txt +1 -1
- package/dist/web/workspace/files/__next.workspace.txt +2 -2
- package/dist/web/workspace/files.html +1 -1
- package/dist/web/workspace/files.txt +3 -3
- package/dist/web/workspace/git/__next._full.txt +3 -3
- package/dist/web/workspace/git/__next._head.txt +1 -1
- package/dist/web/workspace/git/__next._index.txt +2 -2
- package/dist/web/workspace/git/__next._tree.txt +2 -2
- package/dist/web/workspace/git/__next.workspace.git.__PAGE__.txt +1 -1
- package/dist/web/workspace/git/__next.workspace.git.txt +1 -1
- package/dist/web/workspace/git/__next.workspace.txt +2 -2
- package/dist/web/workspace/git.html +1 -1
- package/dist/web/workspace/git.txt +3 -3
- package/dist/web/workspace/mobile/__next._full.txt +3 -3
- package/dist/web/workspace/mobile/__next._head.txt +1 -1
- package/dist/web/workspace/mobile/__next._index.txt +2 -2
- package/dist/web/workspace/mobile/__next._tree.txt +2 -2
- package/dist/web/workspace/mobile/__next.workspace.mobile.__PAGE__.txt +1 -1
- package/dist/web/workspace/mobile/__next.workspace.mobile.txt +1 -1
- package/dist/web/workspace/mobile/__next.workspace.txt +2 -2
- package/dist/web/workspace/mobile.html +1 -1
- package/dist/web/workspace/mobile.txt +3 -3
- package/dist/web/workspace/remote/__next._full.txt +3 -3
- package/dist/web/workspace/remote/__next._head.txt +1 -1
- package/dist/web/workspace/remote/__next._index.txt +2 -2
- package/dist/web/workspace/remote/__next._tree.txt +2 -2
- package/dist/web/workspace/remote/__next.workspace.remote.__PAGE__.txt +1 -1
- package/dist/web/workspace/remote/__next.workspace.remote.txt +1 -1
- package/dist/web/workspace/remote/__next.workspace.txt +2 -2
- package/dist/web/workspace/remote.html +1 -1
- package/dist/web/workspace/remote.txt +3 -3
- package/dist/web/workspace/terminal/default/__next._full.txt +3 -3
- package/dist/web/workspace/terminal/default/__next._head.txt +1 -1
- package/dist/web/workspace/terminal/default/__next._index.txt +2 -2
- package/dist/web/workspace/terminal/default/__next._tree.txt +2 -2
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.__PAGE__.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.$d$sessionId.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.terminal.txt +1 -1
- package/dist/web/workspace/terminal/default/__next.workspace.txt +2 -2
- package/dist/web/workspace/terminal/default.html +1 -1
- package/dist/web/workspace/terminal/default.txt +3 -3
- package/dist/web/workspace/workspaces/__next._full.txt +3 -3
- package/dist/web/workspace/workspaces/__next._head.txt +1 -1
- package/dist/web/workspace/workspaces/__next._index.txt +2 -2
- package/dist/web/workspace/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspace/workspaces/__next.workspace.txt +2 -2
- package/dist/web/workspace/workspaces/__next.workspace.workspaces.__PAGE__.txt +1 -1
- package/dist/web/workspace/workspaces/__next.workspace.workspaces.txt +1 -1
- package/dist/web/workspace/workspaces.html +1 -1
- package/dist/web/workspace/workspaces.txt +3 -3
- package/dist/web/workspace.html +1 -1
- package/dist/web/workspace.txt +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/index-Dpl_RN3z.js +0 -8
- package/dist/web/_next/static/chunks/3977.8cfd8dec4cb8e893.js +0 -1
- package/dist/web/_next/static/chunks/5018-0af0eec430de34c7.js +0 -86
- package/dist/web/_next/static/chunks/635-d6ae421935055337.js +0 -1
- package/dist/web/_next/static/chunks/774-72d0e3531439cf1c.js +0 -1
- package/dist/web/_next/static/chunks/8439-43c6c0f6514a09d9.js +0 -1
- package/dist/web/_next/static/chunks/9958-448e936357b2d620.js +0 -1
- package/dist/web/_next/static/chunks/app/dev/question/page-c28a92f80ec9e5a7.js +0 -1
- package/dist/web/_next/static/chunks/app/login/page-4515f1948afb340b.js +0 -1
- package/dist/web/_next/static/chunks/app/page-0697c18fdefef84e.js +0 -22
- package/dist/web/_next/static/chunks/app/workspace/layout-69aa78d0d618e242.js +0 -14
- package/dist/web/_next/static/chunks/webpack-d869f11e68050bab.js +0 -1
- package/dist/web/_next/static/css/98e745d5833fdea2.css +0 -1
- /package/dist/web/_next/static/{DzBpmOtMidkKu3UY9el_- → eD-pRSm_Yh2oF-5ufptf0}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{DzBpmOtMidkKu3UY9el_- → eD-pRSm_Yh2oF-5ufptf0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8387],{992:(e,t,n)=>{"use strict";n.d(t,{Nw:()=>_,eJ:()=>b,rh:()=>A});var r=n(2074),i=n(38845),a=n(29091),s=n(7938),o=n(11155),l=n(90084),c=n(31408);let d="9remote_fleet_cache",p="9remote_fleet_focus",u="9remote_fleet_connected",h=null,m=null,g=new Map,f=new Map,y=null;function b(e){return e&&g.get(e)?.busRef?.current||null}function _(e,t){if(!e)return;let n=A.getState();if(!n.hosts[e])return;let r=g.get(e)?.busRef?.current;if(r&&"online"===n.hosts[e].status)return void t(r);n.ensureHost(e);let i=f.get(e)||[];i.push(t),f.set(e,i)}function w(){try{return JSON.parse(localStorage.getItem(u)||"[]")}catch{return[]}}function k(e,t){if(e)try{let n=w(),r=new Set(n);t?r.add(e):r.delete(e),localStorage.setItem(u,JSON.stringify([...r]))}catch{}}function v(e){clearTimeout(y),y=setTimeout(()=>{y=null;let t={};for(let[n,r]of Object.entries(e().hosts))t[n]={label:r.label,platform:r.platform,version:r.version,sessions:r.sessions,workspaces:r.workspaces,statusMap:r.statusMap,lastSeenAt:r.lastSeenAt};try{localStorage.setItem(d,JSON.stringify(t))}catch{}},1e3)}let S=e=>({key:e,full:null,label:"",status:"offline",carrier:"ws",sessions:[],workspaces:[],statusMap:{},platform:null,version:null,lastSeenAt:null}),A=(0,r.v)((e,t)=>({hosts:{},currentKey:null,focus:function(){try{let e=localStorage.getItem(p);return null===e?null:e}catch{return null}}(),overlayOpen:!1,sync(n,r){let i=r||"",a=new Map;for(let e of n){let t=(0,o.Uo)(e.key);t&&!a.has(t)&&a.set(t,{full:e.key,label:e.label||""})}i&&!a.has(i)&&a.set(i,{full:null,label:""});let s=[...a.keys()].filter(e=>e!==i).slice(0,8),l=new Set(s);for(let[e,t]of g)l.has(e)||(t.disconnect(),g.delete(e));let c=function(){try{return JSON.parse(localStorage.getItem(d)||"{}")}catch{return{}}}(),p=new Set(w());for(let n of(e(e=>{let t={};for(let[n,r]of a){let a=e.hosts[n]||{...S(n),...c[n]||{}};t[n]={...a,key:n,full:r.full,label:r.label||a.label,status:n===i?"full":l.has(n)&&("online"===a.status||"connecting"===a.status)?a.status:"offline"}}return{hosts:t,currentKey:i}}),s))p.has(n)&&t()._openHost(n);t()._probeUnconnected(),h||(h=setInterval(()=>{document.hidden||A.getState()._probeUnconnected()},6e4),m=()=>{"visible"===document.visibilityState&&A.getState()._probeUnconnected()},document.addEventListener("visibilitychange",m))},_probeUnconnected(){let e=t(),n=Object.values(e.hosts).filter(t=>t.key!==e.currentKey&&!g.has(t.key)).map(e=>e.key);n.length&&fetch("/api/host-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({heads:n})}).then(e=>e.ok?e.json():null).then(e=>{let r=t();for(let i of n){let n=e?.hosts?.[i];if(!n)continue;let a=r.hosts[i];if(!a||i===r.currentKey||g.has(i))continue;let s=n.online?"online":"offline";a.status!==s&&t()._patchHost(i,{status:s})}}).catch(()=>{})},_openHost(e){if(g.has(e))return;let n=t().hosts[e],r=function(){try{return localStorage.getItem("9remote_deviceId")}catch{return null}}();if(!n||!r)return;let c=(0,o.Cj)(n.full);c&&(0,l.LG)(e,{tail:c});let d=n=>t()._patchHost(e,n),p=!1,u=null,h=e=>{e?.emit("getSessions",e=>{Array.isArray(e)&&d({sessions:e})}),e?.emit("getWorkspaces",e=>{Array.isArray(e)&&d({workspaces:e})}),e?.emit("getStatusState")},m=new i.g({tunnelUrl:null,localIp:null,namespace:"",socketOptions:{auth:{apiKey:e,tempKey:null,deviceId:r}},apiKey:e,deviceId:r,tempKey:null,onConnect:n=>{clearTimeout(u),d({status:"online",lastSeenAt:Date.now()});let r=f.get(e);if(r)for(let t of(f.delete(e),r))try{t(n)}catch{}p||(p=!0,n.on("connect",()=>{n.emit("device:clientReady"),h(n)}),n.on("serverInfo",e=>d({platform:e?.platform||null,version:e?.version||null})),n.on("statusState",n=>t().applyStatusState(e,n)),n.on("statusChange",n=>t().applyStatusChange(e,n)),n.on("statusCleared",n=>t().applyStatusCleared(e,n)),n.on("sessionsChanged",()=>h(n)),n.on("workspacesChanged",()=>h(n)),n.on("session-renamed",()=>h(n)),n.on("sessionClosed",e=>{e&&a.B.getState().closeSession(e),h(n)}),n.on("device:rejected",()=>t()._closeHost(e)),n.on("device:tailRejected",()=>t()._closeHost(e)),n.emit("device:clientReady")),h(n)},onDisconnect:()=>{f.delete(e),t()._patchHost(e,{status:"offline",lastSeenAt:Date.now()})}},{enableWebRTC:s.eR.enableWebRTC,enableTurn:s.eR.enableTurn,apiKey:e,onTransportChange:n=>t()._patchHost(e,{carrier:n||"ws"})});g.set(e,m),d({status:"connecting"}),u=setTimeout(()=>{t().hosts[e]?.status==="connecting"&&t()._patchHost(e,{status:"offline"})},15e3),m.connect()},_patchHost(n,r){e(e=>{let t=e.hosts[n];return t?{hosts:{...e.hosts,[n]:{...t,...r}}}:e}),v(t)},applyStatusState(n,r){let i=r||{};e(e=>{let t=e.hosts[n];return!t||(0,c.h3)(t.statusMap,i)?e:{hosts:{...e.hosts,[n]:{...t,statusMap:i}}}}),v(t)},applyStatusChange(n,{sessionId:r,state:i,tool:a,since:s,conversationId:o}={}){r&&(e(e=>{let t=e.hosts[n];if(!t)return e;let l=t.statusMap[r],d={state:i,tool:void 0!==a?a:l?.tool,since:s,...o||l?.conversationId?{conversationId:o||l?.conversationId}:{}};return(0,c.dI)(l,d)?e:{hosts:{...e.hosts,[n]:{...t,statusMap:{...t.statusMap,[r]:d}}}}}),v(t))},applyStatusCleared(n,r){r&&(e(e=>{let t=e.hosts[n],i=t?.statusMap?.[r];return i?{hosts:{...e.hosts,[n]:{...t,statusMap:{...t.statusMap,[r]:{...i,state:"idle"}}}}}:e}),v(t))},_closeHost(e){let n=g.get(e);n&&(n.disconnect(),g.delete(e)),f.delete(e),t()._patchHost(e,{status:"offline",lastSeenAt:Date.now()})},setFocus(t){try{localStorage.setItem(p,t)}catch{}e({focus:t})},ensureHost(e){e===t().currentKey||g.has(e)||t()._openHost(e)},connectHost(e){k(e,!0),t().retryHost(e)},setAutoConnect(e,t){k(e,t)},retryHost(e){let n=g.get(e);n&&(n.disconnect(),g.delete(e)),t()._openHost(e)},disconnectHost(e){k(e,!1),t()._closeHost(e)},clearFocus(){try{localStorage.setItem(p,"")}catch{}e({focus:""})},closeAll(){for(let e of g.values())e.disconnect();g.clear(),f.clear(),h&&(clearInterval(h),h=null,document.removeEventListener("visibilitychange",m),m=null),e({overlayOpen:!1})},openOverlay(){e({overlayOpen:!0})},closeOverlay(){e({overlayOpen:!1})}}))},2163:(e,t,n)=>{"use strict";function r(e){if(!e)return"";if(e.length<=14)return e;let t=e.substring(0,8),n=e.substring(e.length-6),r="•".repeat(12);return`${t}${r}${n}`}n.d(t,{o:()=>r})},2805:(e,t,n)=>{"use strict";n.d(t,{XS:()=>o,_r:()=>a,d8:()=>l,es:()=>c,sP:()=>s});var r=n(90076);let i=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function a(){let e=window.location.hostname;return"localhost"===e||"::1"===e||"[::1]"===e||e.startsWith("127.")||e.endsWith(".localhost")}function s(){return a()||!!window.__TAURI__}function o(){return!!window.__TAURI__||window.location.port===String(r._8)||!0}function l(){if(a())return!0;let e=i.exec(window.location.hostname);if(!e||e.slice(1).some(e=>Number(e)>255))return!1;let t=Number(e[1]),n=Number(e[2]);return 10===t||192===t&&168===n||172===t&&!!(n>=16)&&!!(n<=31)}function c(e){return a()&&window.location.port!==String(r._8)?e?.loopbackOrigin||r.lE:null}},4018:(e,t,n)=>{"use strict";n.d(t,{N:()=>i.N0,u:()=>l});var r=n(1521),i=n(86129);let a="9remote_api_keys",s=()=>{window.dispatchEvent(new Event(i.N0))};function o(e){try{return btoa(e)}catch{return e}}function l(){let e=(0,r.useCallback)(()=>{try{let e=localStorage.getItem(a);if(!e)return[];return JSON.parse(e).map(e=>({...e,key:function(e){try{return atob(e)}catch{return e}}(e.key)}))}catch(e){return console.error("Failed to load API keys:",e),[]}},[!0]),t=(0,r.useCallback)((t,n="")=>{if(t&&1)try{let r=e(),i=r.findIndex(e=>e.key===t);if(-1!==i){let e=r.map((e,t)=>({...e,key:o(e.key),lastLoginDate:t===i?new Date().toISOString():e.lastLoginDate}));localStorage.setItem(a,JSON.stringify(e));return}let l={id:Date.now().toString(),key:o(t),label:n||`Key ${r.length+1}`,createdAt:new Date().toISOString(),lastLoginDate:new Date().toISOString()},c=[...r.map(e=>({...e,key:o(e.key)})),l];localStorage.setItem(a,JSON.stringify(c)),s()}catch(e){console.error("Failed to save API key:",e)}},[!0,e]),n=(0,r.useCallback)(t=>{try{let n=e().filter(e=>e.id!==t).map(e=>({...e,key:o(e.key)}));localStorage.setItem(a,JSON.stringify(n)),s()}catch(e){console.error("Failed to remove API key:",e)}},[!0,e]),i=(0,r.useCallback)(()=>{try{localStorage.removeItem(a)}catch(e){console.error("Failed to clear API keys:",e)}},[!0]),l=(0,r.useCallback)(()=>{try{let e=localStorage.getItem(a);if(!e)return!1;return JSON.parse(e).length>0}catch{return!1}},[!0]),c=(0,r.useCallback)((t,n)=>{try{let r=e().map(e=>({...e,key:o(e.key),label:e.id===t?n:e.label||""}));localStorage.setItem(a,JSON.stringify(r)),s()}catch(e){console.error("Failed to rename API key:",e)}},[!0,e]),d=(0,r.useCallback)(t=>{if(t&&1)try{let n=e().map(e=>({...e,key:o(e.key),lastLoginDate:e.key===t?new Date().toISOString():e.lastLoginDate}));localStorage.setItem(a,JSON.stringify(n))}catch(e){console.error("Failed to update last login date:",e)}},[!0,e]);return{saveKey:t,loadKeys:e,removeKey:n,renameKey:c,clearKeys:i,hasStoredKeys:l,updateLastLogin:d}}},7938:(e,t,n)=>{"use strict";n.d(t,{D5:()=>s,FO:()=>c,I9:()=>l,Ic:()=>o,eR:()=>r,ij:()=>a,tC:()=>i});let r={namespace:"/remote",enableWebRTC:!0,enableTurn:!1,debug:{transport:!1,remote:!1,panel:!1,showButton:!1},dcChunkSize:8,dcReliable:!1,dcOrdered:!1,hashRequestInterval:1500,lastDataThreshold:500,restreamDelay:200,mouseThrottle:8,keyThrottle:25,scrollInterval:100,tileLoadTimeout:600,batchSize:16,batchDelay:3,decodeQueueCap:48,resizeDebounceMs:100,resizeStableFrames:3,resizeMaxFrames:30,focusDebounce:50,longPressDelay:1e3,doubleClickDelay:300,moveThreshold:10,edgeScrollThreshold:15,edgeScrollMultiplier:1.5,momentumFriction:.94,momentumMinVelocity:.3,pointerMode:"trackpad",trackpadSensitivity:1.3,trackpadAcceleration:1.5,trackpadTapMaxMove:8,trackpadTapMaxDuration:220,trackpadCursorSize:20,trackpadEdgeMarginRatio:.25,clipboardBadgeTimeout:1e4,gestureLockDelay:80,gestureDistanceThreshold:15,gestureCentroidThreshold:10,gestureDominanceRatio:2,wheelScrollMultiplier:2.5,wheelLineHeight:40,wheelPageHeight:400,wheelZoomStep:.1,wheelBoostInterval:250,mouseButtonMap:{0:"left",1:"middle",2:"right"},pcModeControls:{rectangleSelect:!1,pointerModeToggle:!1,handMode:!1,keyboardToggle:!1,textPanel:!0,modifierRow:!0,help:!0}},i={ctrl:"control",cmd:"command",alt:"alt",shift:"shift"},a=[{id:"ctrl",label:"Ctrl",modifier:"ctrl",type:"modifier"},{id:"alt",label:"Alt",modifier:"alt",type:"modifier"},{id:"shift",label:"Shift",modifier:"shift",type:"modifier"},{id:"cmd",label:"⌘",modifier:"cmd",type:"modifier"},{id:"esc",label:"Esc",key:"escape",type:"key"},{id:"tab",label:"Tab",key:"tab",type:"key"},{id:"enter",label:"↵",key:"enter",type:"key",primary:!0},{id:"backspace",label:"⌫",key:"backspace",type:"key"},{id:"undo",label:"Undo",key:"z",modifiers:["control"],type:"combo",osAdaptive:!0},{id:"redo",label:"Redo",key:"z",modifiers:["control","shift"],type:"combo",osAdaptive:!0},{id:"up",label:"↑",key:"up",type:"arrow"},{id:"down",label:"↓",key:"down",type:"arrow"},{id:"left",label:"←",key:"left",type:"arrow"},{id:"right",label:"→",key:"right",type:"arrow"},{id:"home",label:"Home",key:"home",type:"key"},{id:"end",label:"End",key:"end",type:"key"},{id:"pgup",label:"PgUp",key:"pageup",type:"key"},{id:"pgdn",label:"PgDn",key:"pagedown",type:"key"},{id:"del",label:"Del",key:"delete",type:"key"},{id:"ins",label:"Ins",key:"insert",type:"key"},{id:"f1",label:"F1",key:"f1",type:"key"},{id:"f2",label:"F2",key:"f2",type:"key"},{id:"f3",label:"F3",key:"f3",type:"key"},{id:"f4",label:"F4",key:"f4",type:"key"},{id:"f5",label:"F5",key:"f5",type:"key"},{id:"f6",label:"F6",key:"f6",type:"key"},{id:"f7",label:"F7",key:"f7",type:"key"},{id:"f8",label:"F8",key:"f8",type:"key"},{id:"f9",label:"F9",key:"f9",type:"key"},{id:"f10",label:"F10",key:"f10",type:"key"},{id:"f11",label:"F11",key:"f11",type:"key"},{id:"f12",label:"F12",key:"f12",type:"key"},{id:"ctrlAltDel",label:"Ctl+Alt+Del",key:"delete",modifiers:["control","alt"],type:"combo"},{id:"ctrlShiftEsc",label:"Task Mgr",key:"escape",modifiers:["control","shift"],type:"combo"},{id:"altTab",label:"Alt+Tab",key:"tab",modifiers:["alt"],type:"combo"},{id:"altF4",label:"Alt+F4",key:"f4",modifiers:["alt"],type:"combo"},{id:"winKey",label:"Win",key:"command",type:"key"},{id:"printScreen",label:"PrtSc",key:"printscreen",type:"key"},{id:"paste",label:"Paste",key:"v",modifiers:["control"],type:"combo",osAdaptive:!0},{id:"cut",label:"Cut",key:"x",modifiers:["control"],type:"combo",osAdaptive:!0},{id:"selectAll",label:"All",key:"a",modifiers:["control"],type:"combo",osAdaptive:!0},{id:"desktopPrev",label:"◀ Desk",type:"desktop",direction:"prev"},{id:"desktopNext",label:"Desk ▶",type:"desktop",direction:"next"},{id:"desktopNew",label:"+ Desk",type:"desktop",direction:"new"}],s=["esc","undo","up","down","tab","ctrl","alt","shift","cmd","backspace"],o="enter",l=[["left","right","home","end","pgup","pgdn","del"],["f1","f2","f3","f4","f5","f6","f7","altTab"],["f9","f10","f11","f12","ctrlAltDel",,"desktopPrev","desktopNext","desktopNew"]],c={enter:"enter",return:"enter",space:" ",backspace:"backspace",tab:"tab",escape:"escape",Enter:"enter"," ":"space",Backspace:"backspace",Tab:"tab",Escape:"escape",ArrowUp:"up",ArrowDown:"down",ArrowLeft:"left",ArrowRight:"right",Home:"home",End:"end",PageUp:"pageup",PageDown:"pagedown",Delete:"delete",Insert:"insert",F1:"f1",F2:"f2",F3:"f3",F4:"f4",F5:"f5",F6:"f6",F7:"f7",F8:"f8",F9:"f9",F10:"f10",F11:"f11",F12:"f12",CapsLock:"capslock",NumLock:"numlock",ScrollLock:"scrolllock",PrintScreen:"printscreen",ContextMenu:"menu"}},11155:(e,t,n)=>{"use strict";function r(e){if("string"!=typeof e||!e)return!1;let t=function(e){if(!e||!e.startsWith("sk-"))return null;if(/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}-[a-np-z1-9]{8}$/.test(e)){let[,t,n,r]=e.split("-");return{machineId:t,keyId:n,version:2,tail:r}}if(/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}$/.test(e)){let[,t,n]=e.split("-");return{machineId:t,keyId:n,version:2}}let t=e.match(/^sk-([a-z0-9]{8})-([a-z0-9]{4})-([0-9a-f]{6})$/);return t?{machineId:t[1],keyId:t[2],crc:t[3]}:null}(e.trim().toLowerCase());return!!t&&2!==t.version}function i(e){if("string"!=typeof e||!/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}-[a-np-z1-9]{8}$/.test(e))return e||null;let t=e.split("-");return`${t[0]}-${t[1]}-${t[2]}`}function a(e){return"string"==typeof e&&/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}-[a-np-z1-9]{8}$/.test(e)?e.split("-")[3]:null}n.d(t,{Cj:()=>a,PF:()=>r,Uo:()=>i})},18057:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(73365),i=n(1521),a=n(64683),s=n(8910),o=n(78762),l=n(52345);function c({isOpen:e,onClose:t}){let{t:n,locale:d,setLocale:p}=(0,o.s)();return((0,i.useEffect)(()=>{if(!e)return;let n=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-[2px] animate-in fade-in duration-200",onClick:t}),(0,r.jsxs)("div",{className:"relative card-elev max-w-lg w-full max-h-[90dvh] flex flex-col animate-in zoom-in-95 duration-200",children:[(0,r.jsxs)("div",{className:"px-5 py-4 flex items-center justify-between flex-shrink-0",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-text",children:n("menu.language")}),(0,r.jsx)("button",{onClick:t,className:"p-2 text-text-muted hover:text-text hover:bg-surface-2 rounded-brand transition-all duration-150 ease-out","aria-label":n("common.close"),children:(0,r.jsx)(a.X,{size:20})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto modal-scrollable p-3",children:(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:l.dI.map(e=>{let n=e.code===d;return(0,r.jsxs)("button",{onClick:()=>{var n;return n=e.code,void((0,s.e)(),p(n),t())},className:`px-2 py-2 rounded-brand flex items-center gap-2 transition-all duration-150 ease-out active:scale-[0.97] min-w-0 ${n?"bg-brand-500 text-white":"text-text hover:bg-surface-2"}`,children:[(0,r.jsx)("img",{src:`https://flagcdn.com/w80/${e.country}.png`,alt:e.label,className:"w-5 h-[14px] object-cover rounded-[2px] flex-shrink-0",loading:"lazy"}),(0,r.jsx)("span",{className:"flex-1 text-sm font-medium truncate text-left",children:e.label}),n&&(0,r.jsx)(a.aJ,{size:14,className:"flex-shrink-0"})]},e.code)})})})]})]}):null}},20464:(e,t,n)=>{"use strict";n.d(t,{As:()=>g,zg:()=>p});var r=n(1521),i=n(29717),a=n(90076),s=n(11155),o=n(90084),l=n(2805),c=n(97711);let d="wrong-key-tail";async function p(e,t,n=a.qn){try{let t=new AbortController,r=setTimeout(()=>t.abort(),n),i=await fetch(`${e}/api/health`,{signal:t.signal});return clearTimeout(r),i.ok}catch{return!1}}async function u(e,{tail:t,tempKey:n},r=a.qn){try{let i=new AbortController,a=setTimeout(()=>i.abort(),r),s=await fetch(`${e}/api/verify-key`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tail:t||null,tempKey:n||null}),signal:i.signal});if(clearTimeout(a),!s.ok)return null;return(await s.json())?.ok===!0}catch{return null}}async function h(){return(0,l._r)()?(0,l.es)(await m()):(0,l.d8)()?window.location.origin:null}async function m(){try{let e=await fetch(a.Go);return e.ok?await e.json():null}catch{return null}}function g(){let[e,t]=(0,r.useState)(!1),[n,l]=(0,r.useState)(""),p=(0,i.useRouter)(),{setAuth:m}=(0,c.F)(),g=(0,r.useCallback)(async(e,{persistSession:n=!0}={})=>{t(!0),l("");try{let t,r=await h();if(r){let t=e.tail||(0,s.Cj)(e.apiKey||""),i=e.tempKey||(e.token?.length<=8?e.token:null);try{let a=await u(r,{tail:t,tempKey:i});if(!0===a){let a=e.apiKey||i||"",l=(0,s.Uo)(a)||"direct";return t&&(0,o.LG)(l,{tail:t}),n&&m({apiKey:l,tunnelUrl:r,mode:"local",tempKey:i?i.toUpperCase():null,localIp:null}),{success:!0,shouldAskToSave:!0,apiKey:l}}if(!1===a)return l(d),{success:!1,wrongTail:!0}}catch{}}let i=new AbortController,c=setTimeout(()=>i.abort(),a.cC);try{t=await fetch(a.Sn.connect,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,apiKey:(0,s.Uo)(e.apiKey)}),signal:i.signal})}catch(e){throw Error(e?.name==="AbortError"?"Connection timed out. Please try again.":"Network error. Please try again.")}finally{clearTimeout(c)}if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Authentication failed")}let p=await t.json(),g=(0,s.Uo)(e.apiKey||p.apiKey);p.hostKeys?.x&&(0,o.LG)(g,{hostSealKey:p.hostKeys.x,hostPubKey:p.hostKeys.ed||null});let f=e.tail||(0,s.Cj)(e.apiKey||"");if(p.tunnelUrl&&(f||e.tempKey)){let t=await u(p.tunnelUrl,{tail:f,tempKey:e.tempKey||null});if(!1===t)return l(d),{success:!1,wrongTail:!0}}return n&&m({apiKey:g,tunnelUrl:p.tunnelUrl||null,mode:"remote",tempKey:e.tempKey?e.tempKey.toUpperCase():null,localIp:p.localIp||null}),{success:!0,shouldAskToSave:!0,apiKey:g}}catch(e){return l(e.message),{success:!1,error:e.message}}finally{t(!1)}},[p,m]);return{loading:e,error:n,setError:l,authenticateWithToken:(0,r.useCallback)(async(e,t=!1,n=null,r)=>t?g({token:e,tempKey:e,tail:n},r):g({token:e},r),[g]),authenticateWithApiKey:(0,r.useCallback)((e,t)=>g({apiKey:e},t),[g])}}},27520:(e,t,n)=>{"use strict";n.d(t,{FQ:()=>l,Lq:()=>m,UX:()=>o,k_:()=>d,yO:()=>c});var r=n(2805);let i=[],a=new Set,s=location.hostname.startsWith("dev.")||"localhost"===location.hostname&&!(0,r.XS)()||"1"===localStorage.getItem("9remote:termLog");function o(){return s}function l(){return i}function c(e){return a.add(e),()=>a.delete(e)}function d(){for(let e of(i.length=0,a))try{e(null)}catch(e){}}function p(e){if(null==e)return"";if(e instanceof Uint8Array||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return`<${e.byteLength}b>`;if("string"==typeof e)return e.length>120?`${e.slice(0,60)}…${e.length}b`:e;if("object"==typeof e)try{return JSON.stringify(e)}catch(e){}return String(e)}let u=new Set(["recv"]),h=null;function m(e,...t){if(!s)return;let n=Date.now(),r=t.map(p).join(" ");if(h&&h.category===e&&h.baseMsg===r&&n-h.ts<3e3||u.has(e)&&h&&h.category===e&&n-h.ts<300){h.count=(h.count||1)+1,h.ts=n,h.msg=`${r} \xd7${h.count}`,queueMicrotask(()=>{for(let e of a)try{e(h)}catch(e){}});return}let o={ts:n,category:e,msg:r,baseMsg:r,count:1};h=o,i.push(o),i.length>800&&i.shift();try{console.log(`[termLog ${e}] ${r}`)}catch{}queueMicrotask(()=>{for(let e of a)try{e(o)}catch(e){}})}},29091:(e,t,n)=>{"use strict";n.d(t,{B:()=>h});var r=n(2074),i=n(11472),a=n(34277),s=n(61826),o=n(33897);let l=(e,{min:t,max:n})=>Math.max(t,Math.min(n,Math.round(e)));var c=n(79253);let d={name:null,value:null},p=null,u=()=>{if(p&&(clearTimeout(p),p=null),null===d.name)return;let{name:e,value:t}=d;d.name=null,d.value=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}};window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&u()});let h=(0,r.v)((0,i.Zr)((e,t,n)=>({...{viewStack:[{type:"list"}],openedSessions:[],activeWorkspaceId:null,setActiveWorkspaceId:t=>e(e=>({activeWorkspaceId:t,fullMode:!!e.fullModes?.[t??o.AD]})),livePanes:[],touchLivePane:t=>e(e=>{let n=Array.isArray(t)?t:[t];return{livePanes:[...e.livePanes.filter(e=>!n.includes(e)),...n].slice(-a.kn)}}),mountedWorkspaces:{},markWorkspaceMounted:t=>e(e=>{let n=t??o.AD;return e.mountedWorkspaces[n]?e:{mountedWorkspaces:{...e.mountedWorkspaces,[n]:!0}}}),isWorkspaceMounted:e=>{let n=e??o.AD;return!!t().mountedWorkspaces[n]},drafts:{},setDraft:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:n}})),collapsedWorkspaces:{},toggleWorkspace:t=>e(e=>({collapsedWorkspaces:{...e.collapsedWorkspaces,[t]:!e.collapsedWorkspaces[t]}})),cwdBySession:{},setCwd:(t,n)=>{if(!t||!n)return;let r=(0,c.kb)(n);e(e=>e.cwdBySession[t]===r?e:{cwdBySession:{...e.cwdBySession,[t]:r}})},pushView:t=>e(e=>{let n=Array.isArray(e.viewStack)?e.viewStack:[];return{viewStack:[...s.yP.includes(t?.type)?n:n.filter((e,t)=>!(s.yP.includes(e?.type)&&t===n.length-1)),t]}}),popView:()=>e(e=>{let t=Array.isArray(e.viewStack)?e.viewStack:[];return{viewStack:t.length>1?t.slice(0,-1):[{type:"list"}]}}),setViewStack:t=>e({viewStack:t}),addOpenedSession:t=>e(e=>({openedSessions:e.openedSessions.includes(t)?e.openedSessions:[...e.openedSessions,t]})),removeOpenedSession:t=>e(e=>{let{[t]:n,...r}=e.drafts,{[t]:i,...a}=e.pendingStartup,{[t]:s,...o}=e.artifactsBySession;return{artifactsBySession:o,openedSessions:e.openedSessions.filter(e=>e!==t),livePanes:e.livePanes.filter(e=>e!==t),hiddenPaneSessionIds:e.hiddenPaneSessionIds?e.hiddenPaneSessionIds.filter(e=>e!==t):[],drafts:r,pendingStartup:a}}),replaceOpenedSession:(t,n)=>e(e=>{if(!n||t===n)return e;let r=e=>e===t?n:e;return{openedSessions:!t||e.openedSessions.includes(t)?e.openedSessions.map(r):e.openedSessions.includes(n)?e.openedSessions:[...e.openedSessions,n],livePanes:e.livePanes.map(r)}}),clearOpenedSessions:()=>e({openedSessions:[],livePanes:[]}),reorderOpenedSessions:t=>e(e=>{let n=new Set(t),r=t.filter(t=>e.openedSessions.includes(t));if(r.length<2)return{};let i=0;return{openedSessions:e.openedSessions.map(e=>n.has(e)?r[i++]:e)}}),closeSession:t=>e(e=>{let{[t]:n,...r}=e.drafts,{[t]:i,...a}=e.pendingStartup,{[t]:s,...o}=e.agentBySession,l=((e,t)=>{let n={};for(let[r,i]of Object.entries(e))n[r]={at:0,sessions:t?i.sessions.map(t):i.sessions};return n})(e.agentHistory,e=>e.openSessionId===t?{...e,openSessionId:null}:e);return{openedSessions:e.openedSessions.filter(e=>e!==t),livePanes:e.livePanes.filter(e=>e!==t),drafts:r,pendingStartup:a,agentBySession:o,agentHistory:l}}),getCurrentView:()=>{let{viewStack:e}=t();return e[e.length-1]},getSelectedSession:()=>{let{viewStack:e}=t();for(let t=e.length-1;t>=0;t--)if("terminal"===e[t].type)return e[t].sessionId;return null},reset:()=>e({viewStack:[{type:"list"}],openedSessions:[],livePanes:[],activeWorkspaceId:null})},...{sidebarCollapsed:!1,toggleSidebar:()=>e(e=>({sidebarCollapsed:!e.sidebarCollapsed})),setSidebarCollapsed:t=>e({sidebarCollapsed:!!t}),sidebarWidth:a.gH.default,setSidebarWidth:t=>e({sidebarWidth:l(t,a.gH)}),fullModes:{},fullMode:!1,toggleFullMode:t=>e(e=>{let n=t??e.activeWorkspaceId??o.AD,r=!e.fullModes[n];return{fullModes:{...e.fullModes,[n]:r},fullMode:n===(e.activeWorkspaceId??o.AD)?r:e.fullMode}}),setFullMode:(t,n)=>e(e=>{let r="boolean"==typeof t?e.activeWorkspaceId??o.AD:t??e.activeWorkspaceId??o.AD,i="boolean"==typeof t?t:!!n;return{fullModes:{...e.fullModes,[r]:i},fullMode:r===(e.activeWorkspaceId??o.AD)?i:e.fullMode}}),hiddenPaneSessionIds:[],toggleHidePane:t=>e(e=>({hiddenPaneSessionIds:e.hiddenPaneSessionIds.includes(t)?e.hiddenPaneSessionIds.filter(e=>e!==t):[...e.hiddenPaneSessionIds,t]})),unhidePane:t=>e(e=>({hiddenPaneSessionIds:e.hiddenPaneSessionIds.filter(e=>e!==t)})),paneWidths:{},setPaneWidth:(t,n)=>e(e=>({paneWidths:{...e.paneWidths,[t]:null==n?null:l(n,a.k9)}})),autoPaneWidths:{},setAutoPaneWidth:(t,n)=>e(e=>({autoPaneWidths:{...e.autoPaneWidths,[t]:null==n?null:Math.round(n)}})),rightPanelOpen:window.innerWidth>=a.jK,rightPanelTabs:{},rightPanelWidth:a.Ds.default,toggleRightPanel:()=>e(e=>({rightPanelOpen:!e.rightPanelOpen,rightPanelWasOpen:null})),closeRightPanel:()=>e({rightPanelOpen:!1,rightPanelWasOpen:null}),openRightPanel:()=>e({rightPanelOpen:!0,rightPanelWasOpen:null}),setRightPanelTab:(t,n)=>e(e=>({rightPanelOpen:!0,rightPanelWasOpen:null,...null!=n?{rightPanelTabs:{...e.rightPanelTabs,[n]:t}}:{}})),rightPanelRoots:{},setRightPanelRoot:(t,n)=>e(e=>{if(null==t)return e;let r=e.rightPanelRoots[t],i=n&&n!==t?n:void 0;if(r===i)return e;let a={...e.rightPanelRoots};return i?a[t]=i:delete a[t],{rightPanelRoots:a}}),setRightPanelWidth:t=>e({rightPanelWidth:l(t,a.Ds)}),editorFilePath:null,editorPanelWidth:a.Ao.default,setEditorPanelWidth:t=>e({editorPanelWidth:l(t,a.Ao)}),editorPreviewSeq:0,artifactTitle:null,rightPanelWasOpen:null,artifactSessionId:null,openEditorFile:(t,n={})=>e(e=>({editorFilePath:t,editorPreviewSeq:n.preview?e.editorPreviewSeq+1:0,artifactTitle:n.artifactTitle||null,artifactSessionId:n.artifactSessionId||null,...n.artifactTitle?{rightPanelWasOpen:e.rightPanelWasOpen??e.rightPanelOpen,rightPanelOpen:!1}:{}})),closeEditorFile:()=>e(e=>({editorFilePath:null,editorPreviewSeq:0,artifactTitle:null,artifactSessionId:null,rightPanelWasOpen:null,...e.rightPanelWasOpen?{rightPanelOpen:!0}:{},...e.artifactSessionId&&e.editorFilePath?{artifactsBySession:((e,t,n)=>{let r=e[t];if(!r)return e;let i=r.filter(e=>e.path!==n);if(i.length===r.length)return e;let{[t]:a,...s}=e;return i.length?{...s,[t]:i}:s})(e.artifactsBySession,e.artifactSessionId,e.editorFilePath)}:{}})),hiddenHeaderButtons:["mobile"],hiddenHeaderButtonsMigrated:!1,toggleHeaderButton:t=>e(e=>({hiddenHeaderButtons:e.hiddenHeaderButtons.includes(t)?e.hiddenHeaderButtons.filter(e=>e!==t):[...e.hiddenHeaderButtons,t]})),mobileLowPower:!1,setMobileLowPower:t=>e({mobileLowPower:!!t}),mobileDeviceCount:0,setMobileDeviceCount:t=>e({mobileDeviceCount:Number(t)||0}),mobileAvailable:!1,setMobileAvailable:t=>e({mobileAvailable:!!t}),mobileOpen:!1,mobileMode:"float",mobilePanelWidth:a.b5.default,mobileFloatRect:null,setMobileOpen:t=>e({mobileOpen:!!t}),setMobileMode:t=>e({mobileMode:t,mobileOpen:!0}),setMobilePanelWidth:t=>e({mobilePanelWidth:l(t,a.b5)}),setMobileFloatRect:t=>e({mobileFloatRect:t}),mobileSession:null,setMobileSession:t=>e(e=>({mobileSession:"function"==typeof t?t(e.mobileSession):t}))},...{webglEnabled:!0,setWebglEnabled:t=>e({webglEnabled:!!t}),fontSize:null,setFontSize:t=>e({fontSize:t?Math.max(10,Math.min(18,Math.round(t))):null}),terminalTheme:"default",setTerminalTheme:t=>e({terminalTheme:t||"default"}),terminalBackgrounds:["art8"],setTerminalBackgrounds:t=>e({terminalBackgrounds:Array.isArray(t)?t.filter(Boolean):[]}),terminalBackgroundOpacity:null,setTerminalBackgroundOpacity:t=>e({terminalBackgroundOpacity:null==t?a._z:Number(Math.max(a.DW.min,Math.min(a.DW.max,Math.round(t/a.DW.step)*a.DW.step)).toFixed(2))}),customBackgrounds:[],setCustomBackgrounds:t=>e({customBackgrounds:Array.isArray(t)?t.filter(e=>e?.id&&e?.dataUrl):[]}),backgroundBySession:{},setSessionBackground:(t,n)=>e(e=>{let r={...e.backgroundBySession};return n?r[t]=n:delete r[t],{backgroundBySession:r}}),showFolderButton:!0,showNoteButton:!1,setShowFolderButton:t=>e({showFolderButton:!!t}),setShowNoteButton:t=>e({showNoteButton:!!t}),noteChips:[],addNoteChip:t=>e(e=>({noteChips:[...e.noteChips,t]})),removeNoteChip:t=>e(e=>({noteChips:e.noteChips.filter(e=>e!==t)})),pinnedNotes:{},setNotePinned:(t,n)=>e(e=>{let r={...e.pinnedNotes};return n?r[t]=!0:delete r[t],{pinnedNotes:r}})},...{agentCaps:{},setAgentCaps:t=>e({agentCaps:t||{}}),artifactEnabled:!1,setArtifactEnabled:t=>e({artifactEnabled:!!t}),mcpClients:[],setMcpClients:t=>e({mcpClients:Array.isArray(t)?t:[]}),agentClisBy:{},setAgentClis:(t,n)=>e(e=>({agentClisBy:{...e.agentClisBy,[t]:{list:Array.isArray(n)?n:[],at:Date.now()}}})),agentHistory:{},setAgentHistory:(t,n)=>e(e=>({agentHistory:{...e.agentHistory,[t]:{at:Date.now(),sessions:Array.isArray(n)?n:[]}}})),invalidateAgentHistory:()=>e(e=>({agentHistory:(e=>{let t={};for(let[n,r]of Object.entries(e))t[n]={at:0,sessions:r.sessions};return t})(e.agentHistory)})),agentBySession:{},setSessionAgent:(t,n)=>e(e=>e.agentBySession[t]===n?e:{agentBySession:{...e.agentBySession,[t]:n}}),pendingStartup:{},queueStartup:(t,n)=>e(e=>({pendingStartup:{...e.pendingStartup,[t]:n}})),consumeStartup:n=>{let r=t().pendingStartup[n];return void 0===r?null:(e(e=>{let{[n]:t,...r}=e.pendingStartup;return{pendingStartup:r}}),r)},artifactsBySession:{},pushArtifact:(t,n)=>e(e=>{if(!t||!n?.path)return{};let r=(e.artifactsBySession[t]||[]).filter(e=>e.path!==n.path);return{artifactsBySession:{...e.artifactsBySession,[t]:[n,...r].slice(0,a.zv)}}}),removeArtifact:(t,n)=>e(e=>({artifactsBySession:((e,t,n)=>{let r=e[t];if(!r)return e;let i=r.filter(e=>e.path!==n);if(i.length===r.length)return e;let{[t]:a,...s}=e;return i.length?{...s,[t]:i}:s})(e.artifactsBySession,t,n)}))}}),{name:"terminal-ui-state",partialize:e=>({viewStack:e.viewStack,openedSessions:e.openedSessions,agentBySession:e.agentBySession,activeWorkspaceId:e.activeWorkspaceId,collapsedWorkspaces:e.collapsedWorkspaces,webglEnabled:e.webglEnabled,fontSize:e.fontSize,terminalTheme:e.terminalTheme,terminalBackgrounds:e.terminalBackgrounds,terminalBackgroundOpacity:e.terminalBackgroundOpacity,backgroundBySession:e.backgroundBySession,showFolderButton:e.showFolderButton,showNoteButton:e.showNoteButton,noteChips:e.noteChips,pinnedNotes:e.pinnedNotes,sidebarCollapsed:e.sidebarCollapsed,sidebarWidth:e.sidebarWidth,fullModes:e.fullModes||{},fullMode:e.fullMode,hiddenPaneSessionIds:e.hiddenPaneSessionIds||[],paneWidths:e.paneWidths,rightPanelOpen:e.rightPanelOpen,rightPanelTabs:e.rightPanelTabs,rightPanelWidth:e.rightPanelWidth,editorPanelWidth:e.editorPanelWidth,hiddenHeaderButtons:e.hiddenHeaderButtons,hiddenHeaderButtonsMigrated:e.hiddenHeaderButtonsMigrated,mobileLowPower:e.mobileLowPower,mobileMode:e.mobileMode,mobilePanelWidth:e.mobilePanelWidth,mobileFloatRect:e.mobileFloatRect,artifactsBySession:e.artifactsBySession}),storage:{getItem:e=>{try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t);return n&&!Array.isArray(n.viewStack)&&(n.viewStack=[{type:"list"}]),n}catch{return null}},setItem:(e,t)=>{d.name=e,d.value=t,p||(p=setTimeout(u,a.eu))},removeItem:e=>{d.name===e&&(d.name=null,d.value=null),localStorage.removeItem(e)}},onRehydrateStorage:()=>e=>{e&&(Array.isArray(e.viewStack)&&0!==e.viewStack.length||(e.viewStack=[{type:"list"}]),e.viewStack=e.viewStack.filter(e=>!s.yP.includes(e?.type)),0===e.viewStack.length&&(e.viewStack=[{type:"list"}]),Array.isArray(e.terminalBackgrounds)||(e.terminalBackgrounds=[]),e.terminalBackground&&"none"!==e.terminalBackground&&0===e.terminalBackgrounds.length&&(e.terminalBackgrounds=[e.terminalBackground]),e.agentBySession&&"object"==typeof e.agentBySession||(e.agentBySession={}),window.innerWidth<a.jK&&(e.rightPanelOpen=!1),!e.hiddenHeaderButtonsMigrated&&(e.hiddenHeaderButtonsMigrated=!0,Array.isArray(e.hiddenHeaderButtons)?e.hiddenHeaderButtons.includes("mobile")||(e.hiddenHeaderButtons=[...e.hiddenHeaderButtons,"mobile"]):e.hiddenHeaderButtons=["mobile"]))}}))},31408:(e,t,n)=>{"use strict";function r(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!(r in t)||e[r]!==t[r])return!1;return!0}function i(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function a(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let i of n)if(!(i in t)||!r(e[i],t[i]))return!1;return!0}n.d(t,{dI:()=>r,h3:()=>a,nk:()=>i})},31735:(e,t,n)=>{"use strict";n.d(t,{H$:()=>l,d6:()=>s,ey:()=>o});var r=n(1521),i=n(29717);let a="9remote_nav:",s=(e,t)=>{if(e&&t)try{localStorage.setItem(a+e,t)}catch{}},o=e=>{if(!e)return null;try{return localStorage.getItem(a+e)}catch{return null}};function l(e){let t=(0,i.usePathname)(),n=(0,i.useSearchParams)();(0,r.useEffect)(()=>{if(!e||!t?.startsWith("/workspace"))return;let r=function(e,t){if(!e)return"";let n=t?.toString();return n?`${e}?${n}`:e}(t,n);r&&s(e,r)},[e,t,n])}},33897:(e,t,n)=>{"use strict";n.d(t,{AD:()=>r,Jc:()=>l,Mt:()=>s,g4:()=>o,gk:()=>a,xs:()=>i});let r="__ungrouped__",i=e=>e?.workspaceId??e?.groupId??null;function a({sessions:e,openedSessions:t,livePanes:n,mountedWorkspaces:s,activeWorkspaceId:o,isDesktop:l}){let c=new Set(e.filter(e=>i(e)===(o??null)).map(e=>e.id)),d=t.filter(e=>c.has(e)),p=new Set([...d,...n.filter(e=>t.includes(e))]),u=t.filter(e=>p.has(e)),h=new Map(e.map(e=>[e.id,i(e)])),m=new Set(t.filter(e=>!!c.has(e)||!!l&&!!s[h.get(e)??r])),g=new Map(d.map((e,t)=>[e,t]));return{workspaceSessionIds:c,workspaceOpenedSessions:d,renderedSessions:u,mountedSet:m,workspaceIndex:g}}let s=(e,t,n)=>!t&&n.has(e)?120*n.get(e):0;function o({container:e,pane:t}){if(!e||!t||t.offsetWidth<=0)return null;let n=t.getBoundingClientRect().left-e.getBoundingClientRect().left;return Math.max(0,Math.min(e.scrollLeft+n-(e.clientWidth-t.offsetWidth)/2,e.scrollWidth-e.clientWidth))}function l({rowWidth:e,paneCount:t,sidebarWidth:n,sidePx:r,gapPx:i,paddingPx:a,minWidth:s,applied:o}){if(!(e>0)||t<=0)return null;let c=Math.max(s,Math.floor((e-n-a-r-(t-1)*i)/t));return null==o?c:Math.min(o,c)}},34277:(e,t,n)=>{"use strict";n.d(t,{$Z:()=>X,Ao:()=>p,B$:()=>j,BM:()=>er,DW:()=>H,Ds:()=>d,EE:()=>R,FC:()=>em,Fz:()=>u,GL:()=>h,Gp:()=>Y,IJ:()=>Q,Il:()=>eh,Jv:()=>o,KA:()=>y,KN:()=>P,Lo:()=>Z,M8:()=>ee,Mg:()=>ev,Nz:()=>eb,OM:()=>ec,Pj:()=>$,Pz:()=>J,RF:()=>eg,RS:()=>G,TM:()=>D,Tb:()=>w,Tk:()=>b,Uc:()=>ei,VE:()=>eo,W$:()=>L,YA:()=>eu,YS:()=>A,ZU:()=>M,_C:()=>eS,_O:()=>V,_z:()=>E,aD:()=>I,am:()=>S,ar:()=>O,b5:()=>m,b9:()=>ey,bl:()=>ef,bs:()=>T,c:()=>B,cK:()=>ew,dU:()=>en,de:()=>eC,dt:()=>r,eE:()=>el,eu:()=>x,fw:()=>ed,g$:()=>ek,gH:()=>c,hp:()=>C,i5:()=>ep,iW:()=>_,j4:()=>et,jK:()=>i,k9:()=>a,kn:()=>l,ll:()=>v,ok:()=>eT,pS:()=>s,pZ:()=>W,pt:()=>q,qQ:()=>k,qj:()=>g,qw:()=>ea,t:()=>U,vP:()=>F,vk:()=>K,wu:()=>N,y:()=>e_,zm:()=>es,zv:()=>f});let r=["git status","git add .",'git commit -m ""',"git push","git pull","git fetch","git diff","git log --oneline","git branch","git checkout","git checkout -b","git switch","git stash","git stash pop","git merge","git rebase","git clone","git remote -v","git restore","npm install","npm ci","npm run dev","npm run build","npm run test","npm run lint","npm outdated","pnpm install","pnpm dev","yarn dev","bun install","cd ..","cd ~","cd -","ls -la","ll","mkdir -p","cp -r","find . -name","du -sh","chmod +x","ln -s","grep -rn","grep -i","wc -l","tail -f","ps aux","df -h","free -h","lsof -i","netstat -tlnp","docker ps","docker ps -a","docker images","docker logs -f","docker exec -it","docker compose up -d","docker compose down","docker build -t","code .","claude","claude --continue","claude --resume","claude --dangerously-skip-permissions","claude mcp","codex","codex --full-auto"],i=760,a={min:400,max:1/0},s=2,o=0,l=12,c={default:190,min:180,max:1/0},d={default:190,min:190,max:1/0},p={default:420,min:280,max:1/0},u=[{id:"remote",labelKey:"menu.remoteDesktop",group:"header"},{id:"mobile",labelKey:"mobile.androidDevice",group:"header"},{id:"sites",labelKey:"menu.sites",group:"header"},{id:"notifications",labelKey:"menu.notificationsButton",group:"header"},{id:"folder",labelKey:"menu.showFolder",group:"pane",storeKey:"showFolderButton",setterKey:"setShowFolderButton"},{id:"note",labelKey:"menu.showNote",group:"pane",storeKey:"showNoteButton",setterKey:"setShowNoteButton"}],h=[{group:"header",titleKey:"menu.headerButtons"},{group:"pane",titleKey:"menu.showButtons"}],m={default:300,min:240,max:1/0},g={width:{default:300,min:240,max:900},height:{default:620,min:320},margin:12,defaultOffset:24},f=20,y=1e4,b={maxDepth:1,deepMaxDepth:3,cacheTtlMs:3e4},_={topThresholdLines:5,guardMs:600,minFetchBytes:256,chainMax:3,chainDebounceMs:300,disabled:!1},w=5242880,k=5,v=3e3,S=150,A=100,T=101,C=200,R={Escape:{data:"\x1b"},c:{ctrl:!0,data:"\x03",requireNoSelection:!0},d:{ctrl:!0,data:"\x04"},z:{ctrl:!0,data:"\x1a"},l:{ctrl:!0,data:"\f"}},x=250,P=999,D=["check again","continue","summarize"],I="terminal:noteSync",F="terminal:openSession",N=5e3,M=250,L=90,$={cursorBlink:!0,fontSize:12,fontSizeMobile:12,fontFamily:'ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", "Noto Sans Mono", Menlo, Monaco, "Courier New", monospace',scrollback:15e3,convertEol:!0,allowProposedApi:!0,scrollOnUserInput:!0,fastScrollModifier:"none",smoothScrollDuration:0,rescaleOverlappingGlyphs:!0,minimumContrastRatio:4.5,macOptionIsMeta:!0};function O(e){return null!=e?e:window.innerWidth<768?$.fontSizeMobile:$.fontSize}let E=.8,U=.25,B="16,16,20",W="116,120,136",j=.28,H={min:.3,max:.95,step:.01},K={none:{label:"None"},art1:{label:"Anime 1",src:"/backgrounds/bg9.jpg"},art2:{label:"Anime 2",src:"/backgrounds/bg2.jpg"},art3:{label:"Anime 3",src:"/backgrounds/bg3.jpg"},art4:{label:"Anime 4",src:"/backgrounds/bg4.jpg"},art5:{label:"Anime 5",src:"/backgrounds/bg5.jpg"},art7:{label:"Anime 7",src:"/backgrounds/bg7.jpg"},art8:{label:"Anime 8",src:"/backgrounds/bg8.jpg"},art9:{label:"Anime 9",src:"/backgrounds/bg10.jpg"},art10:{label:"Anime 10",src:"/backgrounds/bg11.jpg"},art11:{label:"Anime 11",src:"/backgrounds/bg12.jpg"},art12:{label:"Anime 12",src:"/backgrounds/bg13.jpg"}};function q(e,t){return e&&t&&"none"!==t&&(K[t]||String(t).startsWith("custom"))?{...e,background:"#10101400"}:e}function z(e){return"custom"===e?"custom":"string"==typeof e&&e.startsWith("custom:")?e.slice(7):null}function G(e,t=[]){let n=z(e);return n?t.find(e=>e?.id===n)?.dataUrl||null:K[e]?.src||null}function J(e){return K[e]?.label||(z(e)?"Custom":K.none.label)}let V=4e3,Z=2e4;function Q(e,t=[]){return Array.isArray(e)?e.filter(e=>{let n=z(e);return n?t.some(e=>e?.id===n):"none"===e||!!K[e]}):[]}function X(e,t,n=[],r=0){var i;return Q([e],n)[0]||(i=Q(t,n),Array.isArray(i)&&0!==i.length&&i[r%i.length]||"none")}let Y={gpuAcceleration:"auto",smoothScrollDuration:125},ee={clipboard:!0,search:!0,image:!0},et=30,en=2,er=100,ei=600,ea=150,es=4e3,eo=3e3,el=8e3,ec=6e4,ed=3e4,ep="28%",eu=400,eh={lineHeight:18,sensitivity:1,friction:.95,minVelocity:.3,maxVelocity:55,wheelStepLines:1,tuiThrottleMs:50,momentumRenderCadenceMs:33,tuiBackpressureTimeoutMs:120,sgrUp:(e,t)=>`\x1b[<64;${e};${t}M`,sgrDown:(e,t)=>`\x1b[<65;${e};${t}M`},em={longPressMs:450,moveTolerance:10,wordChars:/[A-Za-z0-9._\-/~:@]/},eg={verbs:["cd","ls","ll","cat","less","more","head","tail","vim","nvim","nano","bat","code","code-insiders","rm","cp","mv","mkdir","touch","chmod","open","grep"],ttlMs:3e5,debounceMs:120,maxDirs:20,maxResults:8},ef={minDistance:60,ratio:1.5,maxDuration:500},ey=e=>!!e&&27!==e.charCodeAt(0),eb=e=>"string"==typeof e&&(/^\x1b\[[?>=][0-9;]*c$/.test(e)||/^\x1b\[[0-9]+;[0-9]+R$/.test(e)||/^\x1b\[0n$/.test(e)||/^\x1b\]\d+;/.test(e)),e_=[{id:"ctrl",label:"Ctrl",key:"Ctrl",type:"modifier"},{id:"opt",label:"Opt",key:"Alt",type:"modifier"},{id:"shift",label:"Shift",key:"Shift",type:"modifier"},{id:"meta",label:"⌘",key:"Meta",type:"modifier"},{id:"esc",label:"Esc",key:"Escape",type:"key"},{id:"tab",label:"Tab",key:"Tab",type:"key"},{id:"enter",label:"↵",key:"Enter",type:"key"},{id:"backspace",label:"⌫",key:"Backspace",type:"key"},{id:"up",label:"↑",key:"ArrowUp",type:"arrow"},{id:"down",label:"↓",key:"ArrowDown",type:"arrow"},{id:"left",label:"←",key:"ArrowLeft",type:"arrow"},{id:"right",label:"→",key:"ArrowRight",type:"arrow"},{id:"home",label:"Home",key:"Home",type:"key"},{id:"end",label:"End",key:"End",type:"key"},{id:"pgup",label:"PgUp",key:"PageUp",type:"key"},{id:"pgdn",label:"PgDn",key:"PageDown",type:"key"},{id:"del",label:"Del",key:"Delete",type:"key"},{id:"ins",label:"Ins",key:"Insert",type:"key"},{id:"ctrlA",label:"^A",key:"a",type:"ctrl"},{id:"ctrlC",label:"^C",key:"c",type:"ctrl"},{id:"ctrlD",label:"^D",key:"d",type:"ctrl"},{id:"ctrlE",label:"^E",key:"e",type:"ctrl"},{id:"ctrlK",label:"^K",key:"k",type:"ctrl"},{id:"ctrlL",label:"^L",key:"l",type:"ctrl"},{id:"ctrlN",label:"^N",key:"n",type:"ctrl"},{id:"ctrlP",label:"^P",key:"p",type:"ctrl"},{id:"ctrlR",label:"^R",key:"r",type:"ctrl"},{id:"ctrlT",label:"^T",key:"t",type:"ctrl"},{id:"ctrlU",label:"^U",key:"u",type:"ctrl"},{id:"ctrlW",label:"^W",key:"w",type:"ctrl"},{id:"ctrlX",label:"^X",key:"x",type:"ctrl"},{id:"ctrlY",label:"^Y",key:"y",type:"ctrl"},{id:"ctrlZ",label:"^Z",key:"z",type:"ctrl"},{id:"f1",label:"F1",key:"F1",type:"key"},{id:"f2",label:"F2",key:"F2",type:"key"},{id:"f3",label:"F3",key:"F3",type:"key"},{id:"f4",label:"F4",key:"F4",type:"key"},{id:"f5",label:"F5",key:"F5",type:"key"},{id:"f6",label:"F6",key:"F6",type:"key"},{id:"f7",label:"F7",key:"F7",type:"key"},{id:"f8",label:"F8",key:"F8",type:"key"},{id:"f9",label:"F9",key:"F9",type:"key"},{id:"f10",label:"F10",key:"F10",type:"key"},{id:"f11",label:"F11",key:"F11",type:"key"},{id:"f12",label:"F12",key:"F12",type:"key"},{id:"pipe",label:"|",key:"|",type:"key"},{id:"tilde",label:"~",key:"~",type:"key"},{id:"slash",label:"/",key:"/",type:"key"},{id:"backslash",label:"\\",key:"\\",type:"key"},{id:"dash",label:"-",key:"-",type:"key"},{id:"underscore",label:"_",key:"_",type:"key"}],ew=["esc","up","down","ctrlC","ctrl","opt","shift","tab","slash"],ek="enter",ev=[["left","right","home","end","pgup","pgdn","del"],["ctrlZ","ctrlR","ctrlL","ctrlA","ctrlE","ctrlW","ctrlD"],["f1","f2","f3","f4","f5","f10","f11"]],eS={base:"flex items-center justify-center rounded-brand font-semibold transition-all duration-150 ease-out active:scale-[0.94]",textNormal:"text-xs",textSmall:"text-[11px]",normal:"bg-surface-2 hover:bg-surface-3 text-text",arrow:"bg-surface-2 hover:bg-surface-3 text-text text-sm",modifierActive:"bg-brand-500 text-white shadow-sm",pinned:"bg-brand-500/15 hover:bg-brand-500/25 text-brand-400",size:{minWidth:"34px",height:"32px",paddingLeft:"6px",paddingRight:"6px"},sizeLarge:{minWidth:"38px",height:"32px",paddingLeft:"8px",paddingRight:"8px"},sizeSmall:{width:"28px",height:"28px"}},eA=["main","master"],eT=e=>eA.includes(e),eC={DELAY_MS:400,GAP_PX:6,EDGE_PX:8,MAX_WIDTH_PX:320,EST_HEIGHT_PX:48,SLACK_PX:.5}},38415:(e,t,n)=>{"use strict";n.d(t,{Gf:()=>l,Gi:()=>u,Hu:()=>o,Nn:()=>d,O8:()=>a,cu:()=>c,ij:()=>p,l7:()=>s,no:()=>h,pe:()=>r,rl:()=>i,xO:()=>m});let r="https://api.github.com",i="https://github.com/decolua/9remote",a=`${r}/repos/decolua/9remote`,s=!1,o=".devcontainer/devcontainer.json",l="NREMOTE_API_KEY",c={name:"9Remote",image:"mcr.microsoft.com/devcontainers/universal:latest",postCreateCommand:"npm install -g 9remote@latest",postAttachCommand:"nohup 9remote start > /tmp/9remote.log 2>&1 &",forwardPorts:[2208],portsAttributes:{2208:{label:"9Remote Server",onAutoForward:"silent",visibility:"public"}}},d=3e3,p=60,u={available:"Available",starting:"Starting",shutdown:"Shutdown",unknown:"Unknown"},h={user:"/user",codespaces:"/user/codespaces",codespaceByName:e=>`/user/codespaces/${e}`,startCodespace:e=>`/user/codespaces/${e}/start`,userReposList:"/user/repos?per_page=100&sort=updated&affiliation=owner,collaborator",repoContents:(e,t,n)=>`/repos/${e}/${t}/contents/${n}`,createCodespaceForRepo:(e,t)=>`/repos/${e}/${t}/codespaces`,codespaceSecretsPublicKey:"/user/codespaces/secrets/public-key",codespaceSecret:e=>`/user/codespaces/secrets/${e}`,codespaceSecretRepos:(e,t)=>`/user/codespaces/secrets/${e}/repositories/${t}`};function m(e){return`https://${e}-2208.app.github.dev`}},38845:(e,t,n)=>{"use strict";n.d(t,{g:()=>j});var r=n(86129);class i{static{this.id="base"}static{this.capabilities={control:!1,binary:!1,signaling:"none"}}static{this.priority={control:0,binary:0}}constructor(){this._listeners=new Map,this._state=r.Of.idle}get state(){return this._state}get ready(){return this._state===r.Of.open}supports(e){return!!this.constructor.capabilities[e]}getPriority(e){return this.constructor.priority[e]??0}on(e,t){this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t)}off(e,t){this._listeners.get(e)?.delete(t)}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let e of n)e(...t)}_setState(e){this._state!==e&&(this._state=e,this._emit("stateChange",e))}connect(e){throw Error("Not implemented: connect")}disconnect(){throw Error("Not implemented: disconnect")}send(e,t){throw Error("Not implemented: send")}}var a=n(48193),s=n(63977);let o={transports:["websocket"],reconnection:!1,reconnectionDelay:1e3,reconnectionDelayMax:5e3};class l{constructor({tunnelUrl:e,namespace:t="",socketOptions:n={}}){this._tunnelUrl=e,this._namespace=t,this._socketOptions=n}connect({onSocket:e,onFail:t}){let n=this._namespace?`${this._tunnelUrl}${this._namespace}`:this._tunnelUrl,r=this._tunnelUrl===window.location.origin?"local":"tunnel",i=(0,a.io)(n,{...o,...this._socketOptions,path:"/socket.io",auth:e=>{(0,s.freshAuth)(this._socketOptions.auth,r).then(e)}}),l=!1;i.once("connect",()=>{l||(l=!0,e(i,r))}),i.once("connect_error",()=>{l||(l=!0,t?.())})}}let c={transports:["websocket"],reconnection:!1};class d{constructor({tunnelUrl:e,localIp:t,namespace:n="",socketOptions:r={}}){this._tunnelUrl=e,this._localIp=t,this._namespace=n,this._socketOptions=r}connect({onSocket:e,onFail:t}){let n=!1,r=(t,r)=>{if(n){try{t.disconnect()}catch{}return}n=!0,e(t,r)},i=e=>this._namespace?`${e}${this._namespace}`:e,o=e=>({...c,...this._socketOptions,path:"/socket.io",auth:t=>{(0,s.freshAuth)(this._socketOptions.auth,e).then(t)}}),l=()=>{let e=this._tunnelUrl===window.location.origin?"local":"tunnel",s=(0,a.io)(i(this._tunnelUrl),o(e));s.once("connect",()=>r(s,e)),s.once("connect_error",()=>void(!n&&(n=!0,t?.())))};if(!this._localIp||"https:"===window.location.protocol)return void l();let d=(0,a.io)(i(`http://${this._localIp}`),o("local"));d.once("connect",()=>r(d,"local")),d.once("connect_error",()=>{n||(d.disconnect(),l())})}}var p=n(90076),u=n(82227),h=n(52159),m=n(27520);let g=u.V.retry;class f extends i{static{this.id="ws"}static{this.capabilities={control:!0,binary:!0,file:!0,signaling:"ws"}}static{this.priority={control:100,binary:10,file:10}}constructor(){super(),this._socket=null,this._connectionMode="local",this._retryTimer=null,this._retryAttempt=0,this._retryScheduled=!1,this._retryNowTimer=null,this._destroyed=!1,this._blocked=!1,this._updating=!1,this._connecting=!1,this._visibilityHandler=null,this._lastInboundAt=Date.now(),this._lastMsgAt=0,this._retrySeq=0}get lastInboundAt(){return this._lastInboundAt}get lastMsgAt(){return this._lastMsgAt}get socket(){return this._socket}get connectionMode(){return this._connectionMode}get blocked(){return this._blocked}setUpdating(e){this._updating=e,e&&(this._maxAttempts=g.updateReconnectMaxAttempts,this._retryAttempt=0,(0,h.c)("transport",`[ws] updating=true maxAttempts=${this._maxAttempts}`))}forceReconnect(){this._destroyed||this._forceReconnect()}retryNow(e="?"){if(this._blocked)return void(0,m.Lq)("switch",`ws retryNow SKIP by=${e} (blocked)`);let t=Date.now(),n=t-(this._lastRetryNowAt||0);if(n<3e3){this._retryNowTimer||(this._retryNowTimer=setTimeout(()=>{this._retryNowTimer=null,this.retryNow(`${e}-deferred`)},3e3-n)),(0,h.c)("transport","[ws] retryNow throttled → deferred"),(0,m.Lq)("switch",`ws retryNow DEFER by=${e} (${3e3-n}ms left)`);return}(0,m.Lq)("switch",`ws retryNow GO by=${e} (drops attempt ${this._retryAttempt})`),this._retrySeq++,this._lastRetryNowAt=t,clearTimeout(this._retryNowTimer),this._retryNowTimer=null,clearTimeout(this._retryTimer),clearTimeout(this._connectingTimer),this._retryTimer=null,this._retryScheduled=!1,this._retryAttempt=0,this._connecting=!1,this._destroyed=!0,this._detachSocketEvents(),this._socket?.disconnect(),this._socket=null,this._destroyed=!1,this._ctx?.onRetryStatus?.({isRetrying:!0,attempt:1,maxAttempts:this._maxAttempts,failed:!1}),this._setState(r.Of.connecting),this._connectInternal()}setBlocked(e){this._blocked=e,(0,h.c)("transport",`[ws] blocked=${e}`),e?(this._cancelRetry(),this._socket?.disconnect()):this._socket?.connected||this._destroyed||this._connectInternal()}connect(e){this._ctx=e,this._auth=e.auth,this._maxAttempts=this._auth.tempKey?g.maxAttempts:g.savedKeyMaxAttempts,this._reconnectMaxAttempts=g.reconnectMaxAttempts,this._destroyed=!1,this._attachNetworkListeners(),this._setState(r.Of.connecting),this._connectInternal()}disconnect(){this._destroyed=!0,this._retrySeq++,this._cancelRetry(),this._removeNetworkListeners(),this._detachSocketEvents(),this._socket?.disconnect(),this._socket=null,this._setState(r.Of.closed)}send(e,t){if(!this._socket?.connected)return!1;if(e===r.l_.control){let{event:e,args:n=[],cb:r}=t;return r?this._socket.emit(e,...n,r):this._socket.emit(e,...n),!0}return e===r.l_.binary?(this._socket.emit("tiles-bin-v2",t),!0):e===r.l_.file&&(this._socket.emit("file-bin",t),!0)}_connectInternal(){if(this._connecting||this._socket?.connected||this._destroyed)return;if(!this._auth.tunnelUrl&&!this._auth.localIp){(0,h.c)("transport","[ws] connect HOLD (no tunnelUrl/localIp yet) → retry"),(0,m.Lq)("switch","ws connect HOLD (no url yet) → fetch on retry"),this._setState(r.Of.degraded),this._scheduleRetry();return}this._connecting=!0,clearTimeout(this._connectingTimer),this._connectingTimer=setTimeout(()=>{this._connecting=!1},g.interval);let e={tunnelUrl:this._auth.tunnelUrl,namespace:this._auth.namespace||"",socketOptions:this._auth.socketOptions||{}};(0,h.c)("transport",`[ws] connect: tunnelUrl=${this._auth.tunnelUrl} localIp=${this._auth.localIp||"none"}`),(u.G.localFirstConnection&&this._auth.localIp&&"tunnel"!==this._connectionMode?new d({...e,localIp:this._auth.localIp}):new l(e)).connect({onSocket:(e,t)=>{if(this._connecting=!1,clearTimeout(this._connectingTimer),this._socket?.connected&&this._socket!==e){try{e.disconnect()}catch{}return}this._connectionMode=t,this._socket=e,this._retryAttempt=0,this._updating=!1,this._maxAttempts=this._reconnectMaxAttempts,this._cancelRetry(),this._attachSocketEvents(e),(0,h.c)("transport",`[ws] connect mode=${t}`),(0,m.Lq)("switch",`ws open mode=${t}`),this._setState(r.Of.open)},onFail:()=>{this._connecting=!1,clearTimeout(this._connectingTimer),(0,h.c)("transport","[ws] connect FAIL → schedule retry"),this._scheduleRetry()}})}_attachSocketEvents(e){e.on("disconnect",e=>{(0,h.c)("transport",`[ws] disconnect reason=${e}`),(0,m.Lq)("switch",`ws disconnect reason=${e}`),this._setState(r.Of.degraded),this._destroyed||this._forceReconnect()}),e.on("connect_error",e=>{(0,h.c)("transport",`[ws] connect_error ${e?.message||e}`),this._setState(r.Of.degraded),this._forceReconnect()}),e.io?.on?.("pong",()=>{this._lastInboundAt=Date.now()}),e.on("connect",()=>{this._lastInboundAt=Date.now()}),e.onAny((e,t)=>{this._lastMsgAt=Date.now(),this._emit("message",{event:e,data:t,source:"ws"})})}_attachNetworkListeners(){this._visibilityHandler||(this._visibilityHandler=()=>{"visible"!==document.visibilityState||this._socket?.connected||this._connecting||this.retryNow("visible")},this._offlineHandler=()=>{(0,m.Lq)("switch","ws offline event → drop socket, degraded"),this._socket?.disconnect(),this._socket=null,this._setState(r.Of.degraded)},this._onlineHandler=()=>{this._socket?.connected||this._connecting?(0,m.Lq)("switch",`ws online event → skip (${this._connecting?"handshaking":"already up"})`):this.retryNow("online")},this._pagehideHandler=()=>{try{this._socket?.disconnect()}catch{}},window.addEventListener("pagehide",this._pagehideHandler),document.addEventListener("visibilitychange",this._visibilityHandler),window.addEventListener("offline",this._offlineHandler),window.addEventListener("online",this._onlineHandler))}_detachSocketEvents(){if(this._socket)try{this._socket.offAny()}catch{}}_removeNetworkListeners(){this._pagehideHandler&&(window.removeEventListener("pagehide",this._pagehideHandler),this._pagehideHandler=null),this._visibilityHandler&&(document.removeEventListener("visibilitychange",this._visibilityHandler),this._visibilityHandler=null),this._offlineHandler&&(window.removeEventListener("offline",this._offlineHandler),this._offlineHandler=null),this._onlineHandler&&(window.removeEventListener("online",this._onlineHandler),this._onlineHandler=null)}_forceReconnect(){if(!this._destroyed&&!this._blocked&&!this._retryScheduled&&!this._connecting){if(this._retrySeq++,this._retryAttempt++,this._retryAttempt>u.V.reconnect.fastFailThreshold){this._retryAttempt=0,this._scheduleRetry();return}this._socket?.disconnect(),this._socket=null,this._connectInternal()}}_scheduleRetry(){this._retryScheduled||this._destroyed||this._blocked||(this._retryScheduled=!0,this._retryTimer=setTimeout(()=>this._doRetry(),g.interval))}async _doRetry(){if(this._destroyed)return;if("u">typeof document&&"hidden"===document.visibilityState){(0,m.Lq)("switch",`ws retry HOLD (hidden, still at ${this._retryAttempt}/${this._maxAttempts})`),this._retryScheduled=!1,this._scheduleRetry();return}this._retryAttempt++;let e=this._retryAttempt,t=this._retrySeq;if(e>this._maxAttempts){this._retryScheduled=!1,(0,m.Lq)("switch",`ws GAVE UP after ${this._maxAttempts} attempts → closed`),this._ctx?.onRetryStatus?.({isRetrying:!1,attempt:e,maxAttempts:this._maxAttempts,failed:!0}),this._setState(r.Of.closed);return}(0,h.c)("transport",`[ws] retry attempt=${e}/${this._maxAttempts}`),(0,m.Lq)("switch",`ws retry ${e}/${this._maxAttempts}`),this._ctx?.onRetryStatus?.({isRetrying:!0,attempt:e,maxAttempts:this._maxAttempts,failed:!1});try{let e=await fetch(p.Sn.connect,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:this._auth.apiKey})});if(!e.ok)throw Error("Failed");let{tunnelUrl:n,localIp:r}=await e.json();if(t!==this._retrySeq)return void(0,m.Lq)("switch","ws retry ABORT (superseded mid-fetch)");this._auth.tunnelUrl=n,this._auth.localIp=r||null,this._connectionMode="local",this._ctx?.onUrlUpdate?.({tunnelUrl:n,localIp:r}),this._socket?.disconnect(),this._retryScheduled=!1,this._connectInternal()}catch{if(t!==this._retrySeq)return;this._retryScheduled=!1,this._scheduleRetry()}}_cancelRetry(){clearTimeout(this._retryTimer),this._retryTimer=null,clearTimeout(this._retryNowTimer),this._retryNowTimer=null,this._retrySeq++,this._retryAttempt=0,this._retryScheduled=!1,this._ctx?.onRetryStatus?.({isRetrying:!1,attempt:0,maxAttempts:this._maxAttempts,failed:!1})}}function y(e,t){if(t instanceof Uint8Array){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return{__b:btoa(e)}}return t}function b(e,t){if(t&&"object"==typeof t&&"string"==typeof t.__b){let e=atob(t.__b),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}return t}function _(e){return JSON.stringify(e,y)}function w(e,t=null){let n=[],r={event:e.event,args:function e(t,n){if(t instanceof ArrayBuffer)return n.push(new Uint8Array(t)),{__B:n.length-1};if(ArrayBuffer.isView(t))return n.push(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),{__B:n.length-1};if(Array.isArray(t))return t.map(t=>e(t,n));if(t&&"object"==typeof t){let r={};for(let i of Object.keys(t))r[i]=e(t[i],n);return r}return t}(e.args||[],n),ackId:e.ackId??null,lens:n.map(e=>e.length)};t&&(r.frag=t.id,r.part=t.part,r.parts=t.parts);let i=new TextEncoder().encode(JSON.stringify(r)),a=new Uint8Array(4+i.length+n.reduce((e,t)=>e+t.length,0));new DataView(a.buffer).setUint32(0,i.length,!0),a.set(i,4);let s=4+i.length;for(let e of n)a.set(e,s),s+=e.length;return a}function k(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.length<4)throw Error("frame too short");let n=4+new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!0);if(n>t.length)throw Error("frame header truncated");let r=JSON.parse(new TextDecoder().decode(t.subarray(4,n))),i=[],a=n;for(let e of r.lens||[]){if(a+e>t.length)throw Error("frame part truncated");i.push(t.subarray(a,a+e)),a+=e}return{event:r.event,args:function e(t,n){if(Array.isArray(t))return t.map(t=>e(t,n));if(t&&"object"==typeof t){if("number"==typeof t.__B)return n[t.__B]??null;let r={};for(let i of Object.keys(t))r[i]=e(t[i],n);return r}return t}(r.args||[],i),ackId:r.ackId??null,frag:r.frag,part:r.part,parts:r.parts}}function v(){let e=new Map;return{push(t){let{frag:n,part:r,parts:i}=t;if(null==n)return t;if(!Number.isInteger(r)||!Number.isInteger(i)||r<0||i<1||r>=i||i>4096)return null;let a=e.get(n);a||(e.size>=4&&e.delete(e.keys().next().value),a={slices:Array(i),got:0},e.set(n,a));let s=t.args?.[0];if(null==s||(!a.slices[r]&&(a.slices[r]=s,a.got++),a.got<i))return null;e.delete(n);let o=new Uint8Array(a.slices.reduce((e,t)=>e+t.byteLength,0)),l=0;for(let e of a.slices)o.set(e,l),l+=e.byteLength;return k(o)}}}var S=n(90084),A=n(7938);let T=null,C=0,R=new Map,x=0;async function P(e,t){let n=`9remote_turn_cache_${t?.slice(0,12)||"anon"}`;try{let e="u">typeof localStorage?localStorage.getItem(n):null;if(e){let t=JSON.parse(e);if(t?.expiresAt>Date.now()&&Array.isArray(t.iceServers)&&t.iceServers.length)return t.iceServers}}catch{}try{let r=await fetch(e,{headers:{"X-API-Key":t},signal:AbortSignal.timeout(4e3)});if(r.ok){let e=await r.json();if(e?.iceServers?.length){try{"u">typeof localStorage&&localStorage.setItem(n,JSON.stringify({iceServers:e.iceServers,expiresAt:Date.now()+828e5}))}catch{}return e.iceServers}}}catch(e){console.warn("[WebRtcProtocol] TURN fetch failed:",e.message)}return null}class D extends i{static{this.id="rtc"}static{this.capabilities={control:!0,binary:!0,file:!0,signaling:"external"}}static{this.priority={control:50,binary:100,file:100}}constructor(){super(),this._pc=null,this._dcControl=null,this._dcBinary=null,this._dcFile=null,this._typeDetail="dc-stun",this._localCandidateTypes=new Set,this._answerApplied=!1,this._pendingCandidates=[],this._iceReachedChecking=!1,this._everOpened=!1,this._isLoopback=!1,this._pendingEmit=null,this._flushTimer=null,this._latestTileTs=new Map,this._hbTimer=null,this._hbLastPing=0,this._peerEnv2=!1,this._peerFragCtl=!1,this._v2Announced=!1,this._v2RxSeen=!1,this._fragSeq=0,this._reassemble=v(),this._lastInboundAt=0,this._signalingHandlers={},this._signaling=null,this._useTurn=!1}get lastInboundAt(){return this._lastInboundAt}getPriority(e){return"dc-turn"===this._typeDetail?5:150}async connect(e){this._ctx=e,this._cleanupPeer(),this._peerEpoch=(this._peerEpoch??0)+1,this._localCandidateTypes=new Set,this._answerApplied=!1,this._pendingCandidates=[],this._iceReachedChecking=!1,this._everOpened=!1,this._isLoopback=!1,this._typeDetail="dc-stun",this._lastMid=null,this._remoteGatheringDone=!1,this._setState(r.Of.connecting),this.connectingSince=Date.now(),this.connectDeadline=this.connectingSince+r.AC,clearTimeout(this._connectTimer),this._connectTimer=setTimeout(()=>{this._state!==r.Of.open&&((0,h.c)("transport",`[rtc] connect timeout (${r.AC}ms, state=${this._state}) → close + retry`),this._closePeer(`connect-timeout (state=${this._state})`))},r.AC);let t=[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302","stun:stun2.l.google.com:19302","stun:stun3.l.google.com:19302","stun:stun4.l.google.com:19302"]},{urls:"stun:global.stun.twilio.com:3478"},{urls:"stun:stun.cloudflare.com:3478"}];if(this._useTurn=!!(e.useTurn||e.profile?.rtc?.enableTurn),e.iceServers?.length)t=e.iceServers;else if(this._useTurn){let n=await P(p.Sn.turnCredentials,e.auth?.apiKey);n?.length&&(t=n)}let n=new RTCPeerConnection({iceServers:t,iceCandidatePoolSize:4,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"});this._pc=n;let i=e.profile?.rtc?.dcControl?.ordered??!0,a=n.createDataChannel("control",{ordered:i}),s=n.createDataChannel("binary",{ordered:!1,maxPacketLifeTime:500}),o=n.createDataChannel("file",{ordered:!0});s.binaryType="arraybuffer",a.binaryType="arraybuffer",o.binaryType="arraybuffer",this._dcControl=a,this._dcBinary=s,this._dcFile=o;let l=async()=>{if("open"!==a.readyState||"open"!==s.readyState)return;let e="";try{let t=await n.getStats();t.forEach(n=>{if("candidate-pair"===n.type&&"succeeded"===n.state){let r=[...t.values()].find(e=>e.id===n.localCandidateId),i=[...t.values()].find(e=>e.id===n.remoteCandidateId);(r?.candidateType==="relay"||i?.candidateType==="relay")&&(this._typeDetail="dc-turn");let a=r?.address||r?.ip||"",s=i?.address||i?.ip||"";("127.0.0.1"===a||"::1"===a||"127.0.0.1"===s||"::1"===s)&&(this._isLoopback=!0),e=`local=${r?.candidateType}/${r?.protocol} remote=${i?.candidateType}/${i?.protocol}`}})}catch{}this.send(r.l_.control,{event:"rtc:linkType",args:[this._typeDetail]}),(0,h.c)("transport",`[rtc] dc OPEN type=${this._typeDetail} ${e}`),(0,m.Lq)("switch",`rtc dc OPEN (${this._typeDetail} ${e})`),clearTimeout(this._connectTimer),this._connectTimer=null,this._everOpened=!0,this._lastInboundAt=Date.now(),this._setState(r.Of.open)};a.onopen=l,s.onopen=l;let c=()=>{let e=!this._dcControl||"closed"===this._dcControl.readyState,t=!this._dcBinary||"closed"===this._dcBinary.readyState;(0,m.Lq)("switch",`rtc dc-close (ctrl=${this._dcControl?.readyState} bin=${this._dcBinary?.readyState})`),e&&t?this._setState(r.Of.closed):this._setState(r.Of.degraded)};a.onclose=c,s.onclose=c,o.onclose=()=>{this._dcFile=null},a.onerror=e=>{let t=e.error?.message??"unknown";t.includes("User-Initiated")||console.error("[rtc] dcControl ERROR:",t)},s.onerror=e=>{let t=e.error?.message??"unknown";t.includes("User-Initiated")||console.error("[rtc] dcBinary ERROR:",t)},o.onerror=e=>{let t=e.error?.message??"unknown";t.includes("User-Initiated")||console.error("[rtc] dcFile ERROR:",t)},a.onmessage=({data:e})=>{let t;this._lastInboundAt=Date.now();try{let n;if("string"==typeof e)n=JSON.parse("string"==typeof e?e:new TextDecoder().decode(e),b);else n=k(e),this._v2RxSeen||(this._v2RxSeen=!0,(0,m.Lq)("switch","env2: first v2 binary frame DECODED from agent (mutual upgrade confirmed)"));t=this._reassemble.push(n)}catch(e){console.error("[rtc] control parse error:",e.message);return}if(t){if("__ping"===t.event){this._hbTimer||this._startHeartbeatWatch(),this._hbLastPing=Date.now();try{a.send(_({event:"__pong",args:t.args||[]}))}catch{}return}this._emit("message",{event:t.event,data:t,source:"rtc"})}},s.onmessage=({data:e})=>{this._lastInboundAt=Date.now(),e instanceof ArrayBuffer&&this._receiveTile(e)},o.onmessage=({data:e})=>{this._lastInboundAt=Date.now(),e instanceof ArrayBuffer&&this._emit("binary",{channel:"file",buffer:e,source:"rtc"})},n.onicecandidate=({candidate:e})=>{var t;if(!e)return void this._sendSignaling({type:"ice",candidate:"",mid:this._lastMid||"0"});this._lastMid=e.sdpMid;let n=/typ (host|srflx|relay|prflx)/.exec(e.candidate||"");n&&this._localCandidateTypes.add(n[1]);let r=(t=e.candidate)&&t.includes("typ srflx")&&t.split(" ")[4]||null;r&&this._emit("netFingerprint",r),this._sendSignaling({type:"ice",candidate:e.candidate,mid:e.sdpMid})},n.oniceconnectionstatechange=()=>{(0,h.c)("transport",`[rtc] iceState=${n.iceConnectionState}`),(0,m.Lq)("switch",`rtc ice=${n.iceConnectionState} types=[${[...this._localCandidateTypes].join(",")}]`),"checking"===n.iceConnectionState&&(this._iceReachedChecking=!0),"disconnected"===n.iceConnectionState?this._setState(r.Of.degraded):"failed"===n.iceConnectionState?this._closePeer("ice-failed"):"connected"===n.iceConnectionState&&this._dcControl?.readyState==="open"&&this._dcBinary?.readyState==="open"&&this._setState(r.Of.open)},this._signaling=e.signaling,this._signaling?.on?.(e=>this._handleSignal(e));try{let e=await n.createOffer();await n.setLocalDescription(e),(0,h.c)("transport","[rtc] offer sent"),(0,m.Lq)("switch","rtc offer sent"),this._sendSignaling({type:"offer",sdp:e.sdp,useTurn:this._useTurn})}catch(e){console.error("[rtc] createOffer error:",e.message),this._closePeer(`create-offer:${e.message}`)}}disconnect(e="?"){this._closePeer(`manual-disconnect by=${e} state=${this._state}`),this._signaling?.off?.(),this._signaling=null}send(e,t){if(e===r.l_.control){if(this._dcControl?.readyState!=="open")return!1;let e={event:t.event,args:t.args||[],ackId:t.ackId||null};if(this._peerEnv2)return!!this._sendFramed(e)&&(this._v2Announced||(this._v2Announced=!0,(0,m.Lq)("switch","env2: client→agent control now SENT as v2 binary frames")),!0);try{return this._dcControl.send(_(e)),!0}catch(e){return!1}}if(e===r.l_.binary){if(this._dcBinary?.readyState!=="open")return!1;try{return this._dcBinary.send(t),!0}catch(e){return console.error("[rtc] send binary error:",e.message),!1}}if(e===r.l_.file){if(this._dcFile?.readyState!=="open")return!1;try{if(this._dcFile.bufferedAmount>r.HE.dcBufferThreshold)return!1;return this._dcFile.send(t),!0}catch(e){console.error("[rtc] send file error:",e.message)}}return!1}get typeDetail(){return this._typeDetail}get isLoopback(){return this._isLoopback}_closePeer(e){(0,m.Lq)("switch",`rtc→closed reason=${e}`),this._cleanupPeer(),this._setState(r.Of.closed)}setPeerCaps(e){this._peerEnv2=!!e?.env2,this._peerFragCtl=!!e?.fragCtl}get maxControlBytes(){return this._pc?.sctp?.maxMessageSize||r.dT}_sendFramed(e){var t;let n,r,i=this._peerFragCtl?this.maxControlBytes:1/0,a=(t=++this._fragSeq,(r=function(e,t){if(e.byteLength<=t)return[e];let n=t-192;if(n<=0)return null;let r=Math.ceil(e.byteLength/n);if(r>4096)return null;let i=[];for(let t=0;t<r;t++)i.push(e.subarray(t*n,Math.min((t+1)*n,e.byteLength)));return i}(n=w(e),i))?1===r.length?[n]:r.map((n,i)=>w({event:e.event,args:[n]},{id:t,part:i,parts:r.length})):null);if(!a)return!1;try{for(let e of a)this._dcControl.send(e);return!0}catch(e){return(0,h.c)("transport",`[rtc] control send refused: ${e.message}`),!1}}_startHeartbeatWatch(){this._hbTimer&&(clearInterval(this._hbTimer),this._hbTimer=null),this._hbLastPing=Date.now(),this._hbTimer=setInterval(()=>{if(this._state!==r.Of.open){clearInterval(this._hbTimer),this._hbTimer=null;return}let e=Date.now()-this._hbLastPing;e>r.An&&((0,h.c)("transport",`[rtc] heartbeat: no ping for ${e}ms → closing stalled peer`),this._closePeer(`heartbeat-stale (${e}ms)`))},r.KF)}async _addRemoteCandidate({candidate:e,mid:t}){e||(this._remoteGatheringDone=!0),await this._pc.addIceCandidate(new RTCIceCandidate(e?{candidate:e,sdpMid:t}:{candidate:"",sdpMid:t||"0"})).catch(()=>{})}_startDeadPathWatch(){clearInterval(this._deadPathTimer),this._deadPathTimer=setInterval(async()=>{if(this._state===r.Of.open||!this._pc)return this._stopDeadPathWatch();if(!this._remoteGatheringDone||"complete"!==this._pc.iceGatheringState)return;let e=0,t=0;try{(await this._pc.getStats()).forEach(n=>{"candidate-pair"===n.type&&(e++,"failed"===n.state&&t++)})}catch{return}e&&!(t<e)&&(this._stopDeadPathWatch(),this._closePeer(`dead-path (${t} pair(s) failed)`))},r.QS)}_stopDeadPathWatch(){clearInterval(this._deadPathTimer),this._deadPathTimer=null}_sendSignaling(e){this._signaling?.send?.(e)}async _handleSignal(e){if((0,h.c)("transport",`[rtc] signal: ${e.type}`),(0,m.Lq)("switch",`rtc signal recv=${e.type}`),this._pc)try{if("answer"===e.type){if(this._answerApplied||"stable"===this._pc.signalingState){(0,h.c)("transport","[rtc] duplicate answer ignored"),(0,m.Lq)("switch","rtc duplicate answer ignored");return}if(e.pub&&e.sig&&!await this._verifyHostAnswer(e)){console.error("[rtc] host key verification FAILED — relayed answer rejected"),this._closePeer("host-key-rejected");return}await this._pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp})),this._answerApplied=!0,(0,h.c)("transport","[rtc] answer set"),(0,m.Lq)("switch","rtc answer applied");let t=this._pendingCandidates;for(let e of(this._pendingCandidates=[],t))await this._addRemoteCandidate(e);clearTimeout(this._connectTimer),this.connectDeadline=Date.now()+r.HJ,this._startDeadPathWatch(),this._connectTimer=setTimeout(async()=>{if(this._state!==r.Of.open){try{let e=await this._pc.getStats();e.forEach(t=>{if("candidate-pair"!==t.type)return;let n=e.get(t.localCandidateId),r=e.get(t.remoteCandidateId),i=(n?.address||n?.ip||"?").split(":")[0].slice(-12),a=r?.address||r?.ip||"?";(0,m.Lq)("switch",`pair ${t.state} ${n?.candidateType}:${i}→${r?.candidateType}:${a}`)})}catch{}this._closePeer(`ice-timeout (state=${this._state})`)}},r.HJ)}else if("ice"===e.type){if(!this._answerApplied)return void this._pendingCandidates.push(e);await this._addRemoteCandidate(e)}else"error"===e.type&&((0,h.c)("transport",`[rtc] server error: ${e.message}`),this._closePeer(`server-error:${e.message}`))}catch(e){console.error("[rtc] signal handle error:",e.message)}}async _verifyHostAnswer(e){let t=this._ctx?.auth?.apiKey;if(!t)return!0;let n=(0,S.lz)(t),r=n?.hostPubKey?n:null,i=!!n?.hostSealKey;if((0,h.c)("auth","[seal] verify answer:",{agentSentXpub:!!e.xpub,pinned:!!r,stalePin:!!(n?.hostPubKey&&!i),pendingFp2:(0,S.e1)()}),r){if(r.hostPubKey!==e.pub){let n=(0,S.e1)();return n&&await (0,S.t8)(e.pub,e.xpub)===n?((0,S.LG)(t,{hostPubKey:e.pub,hostSealKey:e.xpub,fp2:n}),(0,h.c)("transport","[rtc] host key re-pinned via fresh pairing fp2"),!0):((0,h.c)("auth","[seal] REJECT answer — pinned pub differs (host key rotated?) and no fresh fp2 to re-pin"),!1)}let n=await (0,S.D5)(e.pub,e.sdp,e.sig);if(!1===n)return(0,h.c)("auth","[seal] REJECT answer — signature invalid (relay tampering?)"),!1;if(null===n){if(!i)return(0,h.c)("auth","[seal] REJECT answer — no Ed25519 in browser and pinned fp2 predates sealing"),!1;let t=await (0,S.t8)(e.pub,e.xpub)===r.fp2;return t||(0,h.c)("auth","[seal] REJECT answer — fp2 fallback mismatch vs pinned",r.fp2),t}return!0}let a=(0,S.e1)();if(a){let n=await (0,S.t8)(e.pub,e.xpub);if(n!==a)return(0,h.c)("auth","[seal] REJECTED — fp2",n,"!= code",a,e.xpub?"":"(agent sent no sealing key — needs the source build)"),(0,S.HY)(),!1;(0,S.LG)(t,{hostPubKey:e.pub,hostSealKey:e.xpub,fp2:n}),(0,h.c)("auth","[seal] pinned via RTC — fp2",n,"sealing key stored"),(0,h.c)("transport","[rtc] host key pinned via pairing fp2")}return!0}natVerdict(){let e=this._localCandidateTypes;return this._everOpened||e.has("relay")?"ok":0===e.size||e.has("srflx")&&(!this._answerApplied||this._iceReachedChecking)?"unknown":"hard"}_cleanupPeer(){for(let e of(clearTimeout(this._connectTimer),this._connectTimer=null,this._stopDeadPathWatch(),this._hbTimer&&(clearInterval(this._hbTimer),this._hbTimer=null),[this._dcControl,this._dcBinary,this._dcFile]))if(e){e.onopen=null,e.onclose=null,e.onerror=null,e.onmessage=null;try{e.close()}catch{}}if(this._dcControl=null,this._dcBinary=null,this._dcFile=null,this._isLoopback=!1,this._typeDetail="dc-stun",this._pc){this._pc.onicecandidate=null,this._pc.oniceconnectionstatechange=null;try{this._pc.close()}catch{}this._pc=null}this._pendingEmit=null,this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=null),this._latestTileTs.clear(),this._reassemble=v()}_receiveTile(e){let t=++C,r=e.byteLength;new Promise(r=>{let i=setTimeout(()=>{R.has(t)&&(R.delete(t),r(null))},8e3),a=A.eR.decodeQueueCap;for(;R.size>=a;){let e=R.keys().next().value,t=R.get(e);if(!t)break;clearTimeout(t.timer),R.delete(e),t.resolve(null)}let s=function(){if(!1===T)return null;if(T)return T;try{T=new Worker(n.tu(new URL(n.p+n.u(3692),n.b)))}catch{return T=!1,null}return T.onmessage=({data:{tiles:e,timestamp:t,id:n,hasBitmap:r,error:i}})=>{x=0;let a=R.get(n);if(!a){if(e)for(let t of e)t.bitmap?.close?.();return}clearTimeout(a.timer),R.delete(n),a.resolve(i?null:{tiles:e,timestamp:t,hasBitmap:r})},T.onerror=e=>{console.error("[Worker] tileDecoder:",e.message),function(){if(T)try{T.terminate()}catch{}for(let{resolve:e}of(T=null,R.values()))try{e(null)}catch{}R.clear()}(),++x>=3&&(T=!1)},T}();if(!s){clearTimeout(i),R.delete(t),r(null);return}R.set(t,{resolve:r,timer:i}),s.postMessage({buffer:e,id:t,v:2},[e])}).then(e=>{if(!e)return;let{tiles:t,timestamp:n,hasBitmap:i}=e;for(let e of(this._pendingEmit||(this._pendingEmit={tiles:new Map,timestamp:n,hasBitmap:i,bytes:0}),this._pendingEmit.bytes+=r,t))n>=(this._latestTileTs.get(e.tileIndex)??0)?(this._latestTileTs.set(e.tileIndex,n),this._pendingEmit.tiles.get(e.tileIndex)?.bitmap?.close?.(),this._pendingEmit.tiles.set(e.tileIndex,e),n>this._pendingEmit.timestamp&&(this._pendingEmit.timestamp=n)):e.bitmap?.close?.();this._flushTimer&&clearTimeout(this._flushTimer),this._flushTimer=setTimeout(()=>{if(this._flushTimer=null,!this._pendingEmit)return;let{tiles:e,timestamp:t,hasBitmap:n,bytes:r}=this._pendingEmit;this._pendingEmit=null;let i=[...e.values()];i.length&&this._emit("message",{event:"tiles-data",data:{tiles:i,timestamp:t,hasBitmap:n,bytes:r,transport:this._typeDetail},source:"rtc"})},0)})}}let I=new Map;function F(e){if(!e?.id)throw Error("Adapter missing static id");I.set(e.id,e)}function N({urls:e,timeoutMs:t,PeerConnection:n}={}){let i=n||("u">typeof RTCPeerConnection?RTCPeerConnection:null);if(!i)return Promise.resolve(null);let a=[{urls:e||r.cx.urls}];return new Promise(e=>{let n,s,o=!1,l=t=>{if(!o){o=!0,clearTimeout(s);try{n.onicecandidate=null,n.close()}catch{}e(t)}};try{n=new i({iceServers:a,iceCandidatePoolSize:0})}catch{return e(null)}s=setTimeout(()=>l(null),t??r.cx.timeoutMs),n.onicecandidate=({candidate:e})=>{var t;if(!e)return l(null);let n=(t=e.candidate)&&t.includes("typ srflx")&&t.split(" ")[4]||null;n&&l(n)};try{n.createDataChannel("probe"),n.createOffer().then(e=>n.setLocalDescription(e)).catch(()=>l(null))}catch{l(null)}})}let M="no-public-ip";function L(e){let t=0,n=!1;for(let r of e.values())"candidate-pair"===r.type&&(r.nominated||r.selected)&&(n=!0,t+=(r.bytesReceived??0)+(r.responsesReceived??0));return n?t:null}function $(e,t){let n=e._adapters.get("rtc"),i=n?._pc;if(!i||"failed"===i.connectionState)return void e._forceRestartRtc(`${t}-pc-failed`);if(e._probeLive?.rtc===n)return void(0,m.Lq)("switch",`${t} probe shared (already measuring this peer)`);clearTimeout(e._resumeProbeTimer);let a=++e._probeToken;e._probeLive={rtc:n,token:a},(async()=>{let t=L(await i.getStats());return null==t||(await new Promise(t=>{e._resumeProbeTimer=setTimeout(t,r.UT)}),a!==e._probeToken)?null:L(await i.getStats())-t})().then(i=>{if(a!==e._probeToken)return;let s=n?.lastInboundAt&&Date.now()-n.lastInboundAt<r.An;null!=i&&i>0||s?(0,m.Lq)("switch",`${t} probe alive (Δ=${i}, recent=${!!s})`):((0,m.Lq)("switch",`${t} probe DEAD (Δ=${i}) → forceRestartRtc`),e._forceRestartRtc(`${t}-probe-dead`))}).catch(()=>{a!==e._probeToken||(n?.lastInboundAt&&Date.now()-n.lastInboundAt<r.An?(0,m.Lq)("switch",`${t} probe error ignored (rtc recently active)`):((0,m.Lq)("switch",`${t} probe error → forceRestartRtc`),e._forceRestartRtc(`${t}-probe-error`)))}).finally(()=>{e._probeLive?.token===a&&(e._probeLive=null)})}function O(e,t){if(t?.type!=="error")return!1;let n=t.message===r.bg.pending?"pending":t.message===r.bg.rejected?"rejected":null;return!!n&&((0,h.c)("transport",`[pm] device ${n} → approval UI`),e._awaitingApproval=!0,e._wsCallbacks.onApproval?.(n),!0)}function E(e){if((0,m.Lq)("switch","signaling ready"),B(e),e._awaitingApproval)return;let t=e._adapters.get("rtc");if(!t){(0,m.Lq)("switch","sig-ready → start rtc (was deferred)"),e._startSecondaryAdapters();return}t.state===r.Of.closed&&((0,m.Lq)("switch","sig-ready → restartRtc (rtc was closed)"),e._restartRtc("sig-ready"))}function U(e,t){!(e._sig?.ready&&e._sig.send(t))&&("offer"===t.type&&(e._sigBuffer=e._sigBuffer.filter(e=>"offer"!==e.type&&"ice"!==e.type)),e._sigBuffer.push(t),e._sigBuffer.length>32&&e._sigBuffer.shift())}function B(e){if(!e._sigBuffer.length)return;let t=e._sigBuffer;for(let n of(e._sigBuffer=[],t))U(e,n)}async function W(e){if(e._auth.tunnelUrl!==window.location.origin)try{(0,h.c)("transport",`[pm] refreshTunnelUrl: fetching from ${p.O}/api/connect`);let t=await fetch(`${p.O}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e._auth.apiKey})});if(!t.ok)return void(0,h.c)("transport",`[pm] refreshTunnelUrl: HTTP ${t.status}`);let n=await t.json();(0,h.c)("transport",`[pm] refreshTunnelUrl: got ${n.tunnelUrl} (was ${e._auth.tunnelUrl})`),n.tunnelUrl&&n.tunnelUrl!==e._auth.tunnelUrl&&(e._auth.tunnelUrl=n.tunnelUrl)}catch(e){(0,h.c)("transport",`[pm] refreshTunnelUrl: error ${e.message}`)}}F(f),F(D);class j{constructor(e,t){const{profile:n,auth:i,wsCallbacks:a,rtcCallbacks:s,peerId:o}=function(e,t){let n=t?.enableWebRTC?"remoteDesktop":"clientApp",i={...r.j3[n]};t?.enableWebRTC||(i.enabled=["ws"]),t?.enableTurn&&(i.rtc={...i.rtc,enableTurn:!0});let a={tunnelUrl:e.tunnelUrl,localIp:e.localIp,apiKey:e.apiKey,tempKey:e.tempKey,deviceId:e.deviceId,namespace:e.namespace,socketOptions:e.socketOptions},s={onConnect:e.onConnect,onDisconnect:e.onDisconnect,onRetryStatus:e.onRetryStatus,onUrlUpdate:e.onUrlUpdate,onApproval:e.onApproval},o=t?{onUpgrade:t.onUpgrade,onFallback:t.onFallback,onTransportChange:t.onTransportChange}:{},l=`${e.deviceId}:${Math.random().toString(36).slice(2,10)}`;return a.socketOptions?.auth&&(a.socketOptions.auth.peerId=l),{profile:i,auth:a,wsCallbacks:s,rtcCallbacks:o,peerId:l}}(e,t);for(const e of(this._profile=n,this._auth=i,this._wsCallbacks=a,this._rtcCallbacks=s,this._peerId=o,Object.assign(this,{_adapters:new Map,_buffer:[],_pendingAcks:new Map,_ackTimers:new Map,_ackSeq:0,_rtcRestartAttempts:0,_rtcRestartTimer:null,_rtcRestartDueAt:0,_probeAttempts:0,_rtcGivenUp:!1,_giveUpIp:null,_lastStunProbeAt:0,_rejoinDebounceTimer:null,_netFingerprint:null,_awaitingApproval:!1,_ackTimeoutMs:r.QZ.ackTimeoutMs,_hiddenAt:null,_resumeProbeTimer:null,_probeToken:0,_probeLive:null,_connected:!1,_type:"ws",_connectionMode:"tunnel",_lastWsState:null,_rawSocket:null,_onConnectFired:!1,_rtcSignalingHandler:null,_sig:null,_sigDestroyed:!1,_sigBuffer:[],_wsFallbackTimer:null}),this._bus=function(e){let t=new Map,n=(e,n)=>{t.has(e)||t.set(e,[]),t.get(e).push(n)},r=(e,n)=>{let r=t.get(e);if(!r)return;let i=r.findIndex(e=>e===n||e._original===n);-1!==i&&r.splice(i,1)};return{_listeners:t,get connected(){return e._anyAdapterReady()},get id(){return e._rawSocket?.id||null},emit(t,...n){e._sendControl(t,n)},on(e,t){n(e,t)},off(e,t){r(e,t)},once(e,t){let i=(...n)=>{r(e,i),t(...n)};i._original=t,n(e,i)},listeners:e=>[...t.get(e)||[]],dispatch(e,n=[]){let r=t.get(e);if(r?.length){for(let e of[...r])if(r.includes(e))try{e(...n)}catch{}}},clear(){t.clear()},disconnect(){e._rawSocket?.disconnect()}}}(this),this.busRef={current:this._bus},S.IU))this._bus.on(e,t=>(0,S.lu)(this,e,t));this._watchers=function(e){let t=()=>{let t;if((0,m.Lq)("switch",`visibility=${document.visibilityState}`),"visible"!==document.visibilityState)return;let n=e._adapters.get("ws"),i=e._adapters.get("rtc");(0,m.Lq)("switch",`resume check: ws=${n?.ready?"ready":n?.state} rtc=${i?.ready?"ready":i?.state}`);let a=Math.max(n?.lastInboundAt??0,n?.lastMsgAt??0),s=n?.ready&&function({ready:e=!0,lastInboundAt:t=0,now:n}={}){return!!e&&(!t||n-t>=r.Rh)}({ready:!0,lastInboundAt:a,now:Date.now()});if(n){let e=n.lastInboundAt??0,t=n.lastMsgAt??0,r=Date.now();(0,m.Lq)("switch",`zombie check: verdict=${!!s} ready=${!!n.ready} lastPong=${e?`${r-e}ms`:"never"} lastMsg=${t?`${r-t}ms`:"never"}`)}if(s){(0,h.c)("transport","[pm] ws zombie on resume → force reconnect");try{n.forceReconnect?.()}catch{}}if(e._awaitingApproval)return;if(e._rtcGivenUp)return void e._maybeRearmRtc();if(t=e._rtcRestartTimer?Math.max(e._rtcRestartDueAt-Date.now(),0):-1,(0,m.Lq)("switch",`RESET attempts (was ${e._rtcRestartAttempts}) reason=resume pendingIn=${t}ms`),e._rtcRestartAttempts=0,e._probeAttempts=0,t<=r.QZ.backoffMs[0]||((0,m.Lq)("switch",`resume: pending rung was ${t}ms out → re-arm fast`),e._disarmRestart(),e._scheduleRtcRestart("resume-rearm")),!e._canSignal())return void e._sig?.retryNow("resume-no-carrier");let o=i?.state;i&&o!==r.Of.closed&&o!==r.Of.degraded?function(e){let t=e._adapters.get("rtc");if(!t?.ready)return e._restartRtc("resume-not-ready");let n=e._hiddenAt?Date.now()-e._hiddenAt:0;if("function"==typeof matchMedia&&matchMedia("(pointer: coarse)").matches&&n>r.Tr){(0,m.Lq)("switch",`resume: hidden ${Math.round(n/1e3)}s on touch → skip probe, force restart`),(0,h.c)("transport",`[pm] resume: hidden ${Math.round(n/1e3)}s → immediate restart`),e._forceRestartRtc("resume-hidden-touch");return}$(e,"resume")}(e):((0,m.Lq)("switch",`visibility → restartRtc (rtc=${o||"absent"})`),e._restartRtc("resume-dead-rtc"))},n=()=>{if("hidden"===document.visibilityState){e._hiddenAt=Date.now();return}clearTimeout(e._resumeCoalesceTimer),e._resumeCoalesceTimer=setTimeout(t,150)};document.addEventListener("visibilitychange",n);let i=()=>{"visible"===document.visibilityState&&n()},a=()=>{e._hiddenAt=Date.now()};document.addEventListener("resume",i),document.addEventListener("freeze",a);let s=()=>{clearTimeout(e._netDebounceTimer),e._netDebounceTimer=setTimeout(()=>{!1===navigator.onLine?(0,m.Lq)("switch","net-change: still offline → wait"):((0,h.c)("transport","[pm] network change → probe rtc"),(0,m.Lq)("switch",`net-change: online=${navigator.onLine} → kick sig + ws + rtc`),e._sig?.retryNow("net-change"),e.retryNow("net-change"),(0,m.Lq)("switch",`RESET attempts (was ${e._rtcRestartAttempts}) givenUp=${e._rtcGivenUp} reason=net-change`),e._rtcRestartAttempts=0,e._probeAttempts=0,e._rtcGivenUp=!1,e._giveUpIp=null,e._shouldRenegotiate()&&e._restartRtc("net-change"))},r.o_.debounceMs)};return window.addEventListener("online",s),navigator.connection?.addEventListener?.("change",s),{visibilityHandler:n,detach(){document.removeEventListener("visibilitychange",n),document.removeEventListener("resume",i),document.removeEventListener("freeze",a),window.removeEventListener("online",s),navigator.connection?.removeEventListener?.("change",s),clearTimeout(e._netDebounceTimer),e._netDebounceTimer=null,clearTimeout(e._resumeCoalesceTimer),e._resumeCoalesceTimer=null}}}(this)}get type(){return this._type}get connected(){return this._connected}get connectionMode(){return this._connectionMode}get wsBlocked(){return this._adapters.get("ws")?.blocked||!1}setWsBlocked(e){this._adapters.get("ws")?.setBlocked(e)}setUpdating(e){this._adapters.get("ws")?.setUpdating(e)}retryNow(e="user"){let t=this._adapters.get("ws");t?t.retryNow?.(e):((0,m.Lq)("switch",`retryNow by=${e}: no ws adapter → full connect()`),this.connect())}emit(e,...t){this._sendControl(e,t)}sendBinary(e,t){let n=this._pickAdapter(e);return!!n&&n.send(e,t)}connect(){this._sigDestroyed=!1;let e=this._profile.enabled.includes("rtc");e&&this._initSignalingClient(),e&&(this._canSignal()?this._startSecondaryAdapters():((0,m.Lq)("switch","rtc deferred — waiting for signaling relay"),clearTimeout(this._rtcDeferTimer),this._rtcDeferTimer=setTimeout(()=>{this._sigDestroyed||this._adapters.has("rtc")||((0,m.Lq)("switch","rtc defer expired → start anyway"),this._startSecondaryAdapters())},r.BF))),this._startWsFallback(),(0,h.c)("transport","[pm] connect: RTC + WS parallel (RTC preferred, WS warm standby)."),(0,m.Lq)("switch","connect: RTC + WS parallel")}async _startWsFallback(){if(!(this._adapters.has("ws")||this._sigDestroyed||this._adapters.get("rtc")?.isLoopback)){if((0,m.Lq)("switch","ws-fallback: start (refresh url)"),await this._refreshTunnelUrl(),this._adapters.has("ws")||this._sigDestroyed||this._adapters.get("rtc")?.isLoopback)return void(0,m.Lq)("switch","ws-fallback: aborted (destroyed, loopback or already attached)");(0,m.Lq)("switch","ws-fallback: connecting"),this._instantiate("ws"),this._adapters.get("ws")?.connect(this._buildCtx("ws"))}}async _refreshTunnelUrl(){return W(this)}_initSignalingClient(){!function(e){if(!r.gI.enabled||e._sig||e._sigDestroyed||!e._auth.deviceId||!e._auth.apiKey)return;let t=p.O.replace(/^http/,"ws")+"/signaling";n.e(6739).then(n.bind(n,46739)).then(({SignalingClient:n})=>{e._sig||e._sigDestroyed||(e._sig=new n({url:t,role:"client",roomId:e._auth.apiKey,apiKey:e._auth.apiKey,from:e._peerId,onReady:()=>E(e),pingMs:r.gI.pingMs}),e._sig.on(t=>{if("error"===t.type&&"rtc-disabled"===t.message){e._rtcTestDisabled=!0,(0,m.Lq)("switch","rtc-disabled by agent → stop RTC retry (use WS)");return}O(e,t)||e._rtcSignalingHandler?.(t)}),e._sig.connect())}).catch(e=>(0,h.c)("transport",`[pm] SignalingClient load failed: ${e?.message||e}`))}(this)}_instantiate(e){if(this._adapters.has(e))return;let t=I.get(e);if(!t)return;let n=new t;n.on("stateChange",t=>this._onAdapterStateChange(e,t)),n.on("message",({event:e,data:t,source:n})=>this._dispatch(e,t,n)),n.on("binary",e=>this._onBinary(e)),"rtc"===e&&(n.on("netFingerprint",e=>this._onNetFingerprint(e)),this._srvCaps&&n.setPeerCaps?.(this._srvCaps)),this._adapters.set(e,n)}_onNetFingerprint(e){if(!e||e===this._netFingerprint)return;let t=this._netFingerprint;this._netFingerprint=e,t&&(0,h.c)("transport",`[pm] net fingerprint ${t}→${e} (same network — no backoff reset)`)}_maybeRearmRtc(){if(!this._rtcGivenUp)return;let e=Date.now();e-this._lastStunProbeAt<r.cx.minIntervalMs||(this._lastStunProbeAt=e,N().then(e=>{var t;if(this._sigDestroyed||!this._rtcGivenUp)return;let n=e||(this._giveUpIp===M?M:null);(t=this._giveUpIp,n&&(!t||n!==t))?((0,m.Lq)("switch",`rearm check: ip ${this._giveUpIp||"unknown"}→${n} changed → re-arm RTC`),(0,h.c)("transport","[pm] public ip changed → re-arm rtc"),this._rtcGivenUp=!1,this._giveUpIp=null,this._probeAttempts=0,this._rtcRestartAttempts=0,this._netFingerprint=e,this._canSignal())?this._shouldRenegotiate()&&this._restartRtc("stun-rearm"):this._sig?.retryNow("stun-rearm"):(0,m.Lq)("switch",`rearm check: ip=${n||"unknown"} same as give-up → stay WS-only`)}).catch(()=>{}))}_startSecondaryAdapters(){for(let e of((0,h.c)("transport",`[pm] startSecondary enabled=${this._profile.enabled}`),(0,h.c)("transport",`[pm] startSecondary rtcTestDisabled=${!!this._rtcTestDisabled}`),this._profile.enabled))"ws"!==e&&("rtc"!==e||!this._rtcTestDisabled)&&(this._adapters.has(e)||((0,h.c)("transport",`[pm] start adapter ${e}`),this._instantiate(e),this._adapters.get(e)?.connect(this._buildCtx(e))))}_handleApprovalSignal(e){return O(this,e)}_onSignalingReady(){E(this)}_canSignal(){return!!this._sig?.ready}_shouldRenegotiate(){return!this._awaitingApproval&&this._canSignal()}_restartRtc(e="?"){(0,m.Lq)("switch",`restartRtc CALLED by=${e} attempts=${this._rtcRestartAttempts}`);let t=this._adapters.get("rtc"),n=function({testDisabled:e,givenUp:t,rtcState:n,hasRtc:i}){return e?"skip-test-disabled":t?"skip-given-up":i&&(n===r.Of.connecting||n===r.Of.open)?"skip-in-flight":i?"restart":"start-fresh"}({testDisabled:!!this._rtcTestDisabled,givenUp:this._rtcGivenUp,rtcState:t?.state,hasRtc:!!t});if("skip-test-disabled"===n)return void(0,m.Lq)("switch","restartRtc skipped (rtcTestDisabled)");if("skip-given-up"===n)return void(0,m.Lq)("switch","restartRtc skipped (hard NAT → WS-only)");if("skip-in-flight"===n)return void(0,m.Lq)("switch",`restartRtc skipped (rtc=${t.state})`);if("start-fresh"===n){(0,m.Lq)("switch","restartRtc: no rtc → startSecondary"),this._startSecondaryAdapters();return}(0,m.Lq)("switch","restartRtc: tear down + renegotiate"),(0,h.c)("transport","[pm] ws reconnected → restart rtc");try{t.disconnect(`restart:${e}`)}catch{}this._adapters.delete("rtc"),this._rtcSignalingHandler=null,this._startSecondaryAdapters()}_forceRestartRtc(e="?"){(0,m.Lq)("switch",`forceRestartRtc CALLED by=${e}`);let t=this._adapters.get("rtc");if(t){try{t.disconnect(`force:${e}`)}catch{}this._adapters.delete("rtc"),this._rtcSignalingHandler=null}this._rtcGivenUp?(0,m.Lq)("switch","forceRestartRtc: torn down, no renegotiate (hard NAT)"):this._startSecondaryAdapters()}disconnect(){this._watchers?.detach(),this._watchers=null,clearTimeout(this._resumeProbeTimer),this._resumeProbeTimer=null,clearTimeout(this._rtcDeferTimer),this._rtcDeferTimer=null,this._probeToken++;try{this._sig?.disconnect()}catch{}for(let e of(this._sig=null,this._sigDestroyed=!0,this._sigBuffer=[],clearTimeout(this._wsFallbackTimer),clearTimeout(this._rejoinDebounceTimer),this._rejoinDebounceTimer=null,this._adapters.values()))try{e.disconnect("pm-disconnect")}catch{}for(let e of(this._adapters.clear(),this._bus.clear(),this._buffer=[],this._connected=!1,this._rawSocket=null,this._disarmRestart(),(0,m.Lq)("switch",`RESET attempts (was ${this._rtcRestartAttempts}) reason=pm-disconnect`),this._rtcRestartAttempts=0,this._probeAttempts=0,this._rtcGivenUp=!1,this._giveUpIp=null,this._lastStunProbeAt=0,this._ackTimers.values()))clearTimeout(e);this._ackTimers.clear()}_buildCtx(e,t){let n={auth:this._auth,profile:this._profile};return"ws"===e&&(n.onRetryStatus=this._wsCallbacks.onRetryStatus,n.onUrlUpdate=e=>{e.tunnelUrl&&(this._auth.tunnelUrl=e.tunnelUrl),void 0!==e.localIp&&(this._auth.localIp=e.localIp),this._wsCallbacks.onUrlUpdate?.(e)}),"rtc"===e&&(n.signaling={send:e=>this._sendSignaling(e),on:e=>{this._rtcSignalingHandler=e},off:()=>{this._rtcSignalingHandler=null}}),n}_onAdapterStateChange(e,t){(0,h.c)("transport",`[pm] ${e} state=${t}`),("rtc"!==e||t!==r.Of.closed)&&(0,m.Lq)("switch",`${e}→${t}`),"ws"===e&&function(e,t){let n=e._adapters.get("ws");if(t===r.Of.open){let t=e._lastWsState===r.Of.degraded;e._connected=!0,e._connectionMode=n?.connectionMode||"tunnel",e._rawSocket=n?.socket||null,t&&e._maybeFireRejoin("ws","ws reconnect while rtc ready"),e._lastWsState!==r.Of.open&&(e._onConnectFired?e._wsCallbacks.onUrlUpdate?.({}):(e._onConnectFired=!0,(0,m.Lq)("switch",`onConnect FIRE (ws, mode=${e._connectionMode})`),e._wsCallbacks.onConnect?.(e._bus,e._connectionMode)))}else e._rawSocket=null,e._lastWsState===r.Of.open&&((0,m.Lq)("switch","ws down"),e._anyAdapterReady()&&(0,m.Lq)("switch","ws down but rtc alive → skip onDisconnect"));e._lastWsState=t}(this,t),"rtc"===e&&function(e,t){if(t===r.Of.open){let t=e._onConnectFired;clearTimeout(e._wsFallbackTimer),e._rtcCallbacks.onUpgrade?.(e._adapters.get("rtc")?.typeDetail||"dc-stun"),e._onConnectFired||(e._onConnectFired=!0,e._connected=!0,e._connectionMode="webrtc",(0,m.Lq)("switch","onConnect FIRE (rtc, mode=webrtc)"),e._wsCallbacks.onConnect?.(e._bus,e._connectionMode)),e._rtcRestartAttempts=0,e._probeAttempts=0,e._rtcGivenUp=!1,e._giveUpIp=null,e._disarmRestart(),clearTimeout(e._rejoinDebounceTimer),e._rejoinDebounceTimer=null;let n=e._adapters.get("rtc");if(n?.isLoopback){(0,m.Lq)("switch","rtc loopback detected (same machine) → drop ws standby");let t=e._adapters.get("ws");if(t){try{t.disconnect()}catch{}e._adapters.delete("ws")}}t&&e._maybeFireRejoin("rtc","rtc reconnect while ws ready")}if(t===r.Of.closed){for(let t of(e._rtcCallbacks.onFallback?.("ws"),(0,m.Lq)("switch","rtc closed → startWsFallback + scheduleRtcRestart"),e._startWsFallback(),clearTimeout(e._wsFallbackTimer),e._pendingAcks.values()))try{t({error:"rtc-closed"})}catch{}for(let t of(e._pendingAcks.clear(),e._ackTimers.values()))clearTimeout(t);e._ackTimers.clear(),e._scheduleRtcRestart("rtc-closed")}}(this,t),"rtc"===e&&t===r.Of.open&&((0,h.c)("auth","[seal] rtc OPEN → sending proof"),(0,S.pV)(this)),this._recomputeType();let n=this._anyAdapterReady();n!==this._connected&&(this._connected=n,n||(this._onConnectFired=!1,(0,m.Lq)("switch",`onDisconnect FIRE (last carrier gone: ${e}→${t})`),this._wsCallbacks.onDisconnect?.(`${e}-${t}`))),this._flushBuffer()}_maybeFireRejoin(e,t){let n="ws"===e?this._adapters.get("rtc"):this._adapters.get("ws");if(n?.ready){(0,h.c)("transport",`[pm] ${t} → skip rejoin (other ready)`),(0,m.Lq)("switch",`${t} → skip rejoin (other ready)`);return}if("ws"===e&&n&&n.state===r.Of.connecting){(0,h.c)("transport",`[pm] ${t} → debounce rejoin (rtc connecting)`),(0,m.Lq)("switch",`${t} → debounce rejoin ${r.ZN}ms (rtc connecting)`),clearTimeout(this._rejoinDebounceTimer),this._rejoinDebounceTimer=setTimeout(()=>{this._rejoinDebounceTimer=null;let e=this._adapters.get("rtc");e?.ready?(0,m.Lq)("switch","debounce: rtc opened → skip rejoin"):((0,m.Lq)("switch",`debounce expired → FIRE rejoin (rtc=${e?.state||"absent"})`),this._bus.dispatch("connect",[]))},r.ZN);return}(0,m.Lq)("switch",`${t} → FIRE rejoin`),this._bus.dispatch("connect",[])}_recomputeType(){let e=this._pickAdapter(r.l_.binary)||this._pickAdapter(r.l_.control),t=e&&"rtc"===e.constructor.id?e.typeDetail||"dc-stun":"ws";t!==this._type&&(this._type=t,this._rtcCallbacks.onTransportChange?.(t))}_anyAdapterReady(){for(let e of this._adapters.values())if(e.ready)return!0;return!1}_pickAdapter(e){return function(e,t,n){let r=t.channels[n];if(!r)return null;let i=[...e.values()].filter(e=>e.supports(n)&&e.ready);return i.length?(i.sort((e,t)=>{let i=t.getPriority?t.getPriority(n):t.constructor.priority[n]??0,a=e.getPriority?e.getPriority(n):e.constructor.priority[n]??0;if(i!==a)return i-a;if(r.prefer){if(t.constructor.id===r.prefer)return 1;if(e.constructor.id===r.prefer)return -1}return 0}),i[0]||null):null}(this._adapters,this._profile,e)}_sendControl(e,t){!function(e,t,n){let i="function"==typeof n[n.length-1]?n.pop():null,a=e._pickAdapter(r.l_.control);if(!a){(0,h.c)("transport",`[pm] buffer event=${t} (no adapter ready)`),(0,m.Lq)("switch",`buffer "${t}" (no adapter)`),e._buffer.push({event:t,args:n,cb:i});return}if((0,h.c)("transport",`[pm] send control event=${t} via=${a.constructor.id}`),"rtc"===a.constructor.id){let s=null;if(i&&(s=`c_${++e._ackSeq}`,e._pendingAcks.set(s,i),e._scheduleAckTimeout(s,{event:t,args:n})),!a.send(r.l_.control,{event:t,args:n,ackId:s})){let o=e._pickAdapter(r.l_.control);if(o&&o!==a&&o.send(r.l_.control,i?{event:t,args:n,ackId:s,cb:i}:{event:t,args:n,ackId:s}))return;(0,h.c)("transport",`[pm] rtc refused event=${t} → buffered`),e._buffer.push({event:t,args:n,cb:i})}}else a.send(r.l_.control,{event:t,args:n,cb:i})}(this,e,t)}_flushBuffer(){!function(e){if(!e._buffer.length)return;let t=e._pickAdapter(r.l_.control);if(!t)return;let n=e._buffer.splice(0);for(let{event:r,args:i,cb:a}of((0,h.c)("transport",`[pm] flush ${n.length} buffered via=${t.constructor.id}`),n))e._sendControl(r,a?[...i,a]:i)}(this)}_dispatch(e,t,n){!function(e,t,n,i){if("srvCaps"===t){let t="rtc"===i?n?.args?.[0]:n;(0,h.c)("transport",`[pm] srvCaps from agent via ${i}: ${JSON.stringify(t)}`),e._srvCaps=t||{},e._adapters.get("rtc")?.setPeerCaps?.(e._srvCaps)}if("__ack"===t){let{ackId:t,args:r}=n||{},i=e._pendingAcks.get(t);if(i){e._pendingAcks.delete(t);let n=e._ackTimers.get(t);n&&(clearTimeout(n),e._ackTimers.delete(t)),i(...r||[])}return}if("device:approved"===t){e._awaitingApproval=!1;let t=e._adapters.get("rtc");e._canSignal()&&(!t||t.state===r.Of.closed)&&e._restartRtc("device-approved")}if("rtc:enabled"===t){e._rtcTestDisabled&&(e._rtcTestDisabled=!1,(0,m.Lq)("switch","rtc:enabled by agent → clear flag + restart RTC"),e._restartRtc("rtc-enabled"));return}if("tunnel:updated"===t){let t="rtc"===i?n?.args?.[0]:n;if(t){let{tunnelUrl:n,localIp:r,status:i}=t;if(e._auth.tunnelUrl===window.location?.origin)return(0,m.Lq)("switch",`tunnel:updated ignored (carrier is the page origin; got url=${n||"none"})`);if((0,m.Lq)("switch",`tunnel:updated recv (status=${i} url=${n||"none"})`),"ready"===i&&n){let t=e._auth.tunnelUrl!==n;e._auth.tunnelUrl=n,r&&(e._auth.localIp=r),e._wsCallbacks.onUrlUpdate?.({tunnelUrl:n,localIp:r});let i=e._adapters.get("ws");if(i&&(!i.ready||t)){(0,m.Lq)("switch",`tunnel:updated → ${t?"url changed":"ws not ready"} → retry ws with new URL`);try{i.retryNow("tunnel-updated")}catch{}}}else"down"===i&&(e._auth.tunnelUrl="",e._wsCallbacks.onUrlUpdate?.({tunnelUrl:"",localIp:r}))}return}let a="rtc"===i&&Array.isArray(n?.args)?n.args:[n];e._bus?.dispatch(t,a)}(this,e,t,n)}_onBinary(e){e&&"file"===e.channel&&this._bus?.dispatch("file-bin",[e.buffer])}_scheduleAckTimeout(e){var t;let n;t=this,n=setTimeout(()=>{t._ackTimers.delete(e),(0,h.c)("transport",`[pm] ack timeout ackId=${e} event=undefined → suspect zombie RTC`);let n=t._pendingAcks.get(e),i=t._adapters.get("rtc");t._adapters.get("ws");let a=Date.now(),s=i?.lastInboundAt||0;i?.ready&&s&&a-s<r.An?(0,m.Lq)("switch",`ack-timeout ? ignored (rtc active, lastInbound=${a-s}ms ago)`):i?.state===r.Of.open?$(t,"ack-timeout:?"):t._scheduleRtcRestart("ack-timeout")},t._ackTimeoutMs),t._ackTimers.set(e,n)}_armRestart(e,t){clearTimeout(this._rtcRestartTimer),this._rtcRestartDueAt=Date.now()+t,this._rtcRestartTimer=setTimeout(e,t)}_disarmRestart(){let e=this._rtcRestartTimer?Math.max(this._rtcRestartDueAt-Date.now(),0):-1;return clearTimeout(this._rtcRestartTimer),this._rtcRestartTimer=null,this._rtcRestartDueAt=0,e}_scheduleRtcRestart(e="?"){if((0,m.Lq)("switch",`rtcRestart REQ by=${e} attempts=${this._rtcRestartAttempts} probe=${this._probeAttempts} givenUp=${this._rtcGivenUp} pending=${!!this._rtcRestartTimer}`),this._rtcRestartTimer){let t=Math.max(this._rtcRestartDueAt-Date.now(),0);(0,m.Lq)("switch",`rtcRestart SKIP by=${e} (pending rung ${this._rtcRestartAttempts} fires in ${t}ms)`);return}if(this._rtcGivenUp){(0,m.Lq)("switch","scheduleRtcRestart skipped (hard NAT → WS-only)"),(0,h.c)("transport","[pm] rtc probe skipped (given up — hard NAT)");return}let t=function({attempts:e,probeAttempts:t,verdict:n}){let i,a,s=e>=r.QZ.maxAttempts,o=t;if(s){if(i=r.QZ.probeBackoffMs[t]??r.QZ.probeBackoffMs.at(-1),(o=t+1)>=r.QZ.classifyAfterProbes){if("hard"===(a=n?.()??"unknown"))return{giveUp:!0,verdict:a,probeAttempts:o};o=0}}else i=r.QZ.backoffMs[e]??r.QZ.backoffMs.at(-1);return{delay:i,isProbe:s,attempts:e+1,probeAttempts:o,verdict:a}}({attempts:this._rtcRestartAttempts,probeAttempts:this._probeAttempts,verdict:()=>this._adapters.get("rtc")?.natVerdict?.()??"unknown"});if(void 0!==t.verdict&&((0,m.Lq)("switch",`scheduleRtcRestart natVerdict=${t.verdict} probeAttempts=${t.probeAttempts}`),(0,h.c)("transport",`[pm] rtc nat verdict=${t.verdict} after ${t.probeAttempts} probes`)),t.giveUp){this._probeAttempts=t.probeAttempts,this._rtcGivenUp=!0,this._giveUpIp=this._netFingerprint,this._giveUpIp||N().then(e=>{this._rtcGivenUp&&!this._giveUpIp&&(this._giveUpIp=e||M,(0,m.Lq)("switch",`give-up baseline from probe: ip=${this._giveUpIp}`))}).catch(()=>{}),(0,m.Lq)("switch",`RTC give-up: hard NAT → WS-only (ip=${this._giveUpIp||"pending"})`);return}let{delay:n,isProbe:i}=t;this._probeAttempts=t.probeAttempts,this._rtcRestartAttempts=t.attempts,(0,m.Lq)("switch",`rtcRestart ARM by=${e} rung=${this._rtcRestartAttempts} delay=${n}ms probe=${i}`),(0,h.c)("transport",`[pm] schedule rtc ${i?"probe":"restart"} #${this._rtcRestartAttempts} in ${n}ms`);let a=()=>{if(this._disarmRestart(),this._awaitingApproval||!this._sig?.ready)return;let e=this._adapters.get("rtc");if(e){let t=function({state:e,connectingSince:t,connectDeadline:n,now:i,connectTimeoutMs:a}){return e!==r.Of.connecting?"restart":i<function({connectingSince:e,connectDeadline:t,connectTimeoutMs:n}){return t??(e??0)+n}({connectingSince:t,connectDeadline:n,connectTimeoutMs:a})?"wait":"teardown"}({state:e.state,connectingSince:e.connectingSince,connectDeadline:e.connectDeadline,now:Date.now(),connectTimeoutMs:r.AC});if("wait"===t){let t=Math.max(function({connectingSince:e,connectDeadline:t,connectTimeoutMs:n}){return t??(e??0)+n}({connectingSince:e.connectingSince,connectDeadline:e.connectDeadline,connectTimeoutMs:r.AC})-Date.now(),n);(0,m.Lq)("switch",`restart tick: peer still young (rung ${this._rtcRestartAttempts}) → re-arm in ${t}ms, no rung spent`),this._armRestart(a,t);return}if("teardown"===t){try{e.disconnect(`rung-${this._rtcRestartAttempts}-teardown`)}catch{}this._adapters.delete("rtc"),this._rtcSignalingHandler=null}}this._restartRtc(`rung-${this._rtcRestartAttempts}`)};this._armRestart(a,n)}_sendSignaling(e){U(this,e)}_flushSigBuffer(){B(this)}}},42174:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(73365),i=n(1521),a=n(98196),s=n(8910),o=n(78762),l=n(64683);function c({isOpen:e,onClose:t,onConfirm:n,title:d,message:p,confirmText:u,cancelText:h}){let{t:m}=(0,o.s)(),g=(0,i.useRef)(null),f=(0,i.useRef)(null),y=u??m("common.confirm"),b=h??m("common.cancel");return((0,i.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>{f.current?.focus()});return()=>cancelAnimationFrame(t)},[e]),(0,i.useEffect)(()=>{if(!e)return;let r=e=>{if("Escape"===e.key)e.preventDefault(),e.stopPropagation(),t();else if("Enter"===e.key){if(g.current&&document.activeElement===g.current){e.preventDefault(),e.stopPropagation(),t();return}e.preventDefault(),e.stopPropagation(),(0,s.e)(),n?.(),t()}};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[e,t,n]),!e||"u"<typeof document)?null:(0,a.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center px-4",style:{paddingTop:"max(1rem, env(safe-area-inset-top))",paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[4px] animate-in fade-in duration-150",onClick:t}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",className:"relative card-elev max-w-md w-full my-auto max-h-[min(85%,calc(var(--app-height,85vh)-2rem))] overflow-y-auto animate-in zoom-in-95 duration-200",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{className:"px-6 py-4",children:(0,r.jsx)("h3",{className:"text-lg font-semibold text-text",children:d})}),(0,r.jsx)("div",{className:"px-6 pb-4",children:(0,r.jsx)("p",{className:"text-text whitespace-pre-line",children:p})}),(0,r.jsxs)("div",{className:"px-6 py-4 flex justify-end gap-3",children:[(0,r.jsxs)("button",{ref:g,onClick:()=>{(0,s.e)(),t()},className:"px-4 py-2 bg-surface-2 hover:bg-surface-3 text-text rounded-brand transition-all duration-150 ease-out active:scale-[0.98] font-medium flex items-center gap-1.5",children:[(0,r.jsx)("span",{children:b}),(0,r.jsx)("kbd",{className:"hidden sm:inline-flex items-center text-[10px] font-mono px-1 py-0.5 rounded bg-surface-3 text-text-muted leading-none",children:"Esc"})]}),(0,r.jsxs)("button",{ref:f,onClick:()=>{(0,s.e)(),n?.(),t()},className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-brand transition-all duration-150 ease-out active:scale-[0.98] font-medium flex items-center gap-1.5 focus:outline-none focus:ring-2 focus:ring-red-500/50",children:[(0,r.jsx)("span",{children:y}),(0,r.jsx)("kbd",{className:"hidden sm:inline-flex items-center justify-center w-4 h-4 rounded bg-white/20 text-white",children:(0,r.jsx)(l.Lt,{size:10,strokeWidth:2.5})})]})]})]})]}),document.body)}},45111:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(73365);function i({size:e="md",text:t,className:n=""}){return(0,r.jsxs)("div",{className:`flex flex-col items-center justify-center gap-3 ${n}`,children:[(0,r.jsx)("div",{className:`animate-spin rounded-full border-brand-500 border-t-transparent ${{sm:"h-4 w-4 border-2",md:"h-8 w-8 border-2",lg:"h-12 w-12 border-b-2"}[e]}`}),t&&(0,r.jsx)("p",{className:"text-brand-500 text-sm font-medium",children:t})]})}},49262:(e,t,n)=>{var r={"./ar.js":[22180,2180],"./de.js":[81228,1228],"./en.js":[58628],"./es.js":[9259,9259],"./fa.js":[68638,8638],"./fr.js":[87507,7507],"./he.js":[27960,7960],"./hi.js":[20132,132],"./id.js":[41222,1222],"./it.js":[46742,6742],"./ja.js":[40674,674],"./ko.js":[50213,213],"./ms.js":[98467,8467],"./nl.js":[30925,925],"./pl.js":[91243,1243],"./pt.js":[24643,4643],"./ru.js":[82038,2038],"./sv.js":[83514,3514],"./th.js":[96419,6419],"./tr.js":[2849,2849],"./uk.js":[29299,9299],"./vi.js":[71750,1750],"./zh.js":[43429,3429]};function i(e){if(!n.o(r,e))return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],i=t[0];return Promise.all(t.slice(1).map(n.e)).then(()=>n(i))}i.keys=()=>Object.keys(r),i.id=49262,e.exports=i},52159:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var r=n(7938);function i(e,...t){r.eR.debug?.[e]&&console.log(...t)}},52345:(e,t,n)=>{"use strict";n.d(t,{Xn:()=>i,dI:()=>r,zl:()=>a});let r=[{code:"en",label:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8",country:"us"},{code:"vi",label:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3",country:"vn"},{code:"zh",label:"中文",flag:"\uD83C\uDDE8\uD83C\uDDF3",country:"cn"},{code:"es",label:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8",country:"es"},{code:"hi",label:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3",country:"in"},{code:"ar",label:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6",country:"sa"},{code:"pt",label:"Portugu\xeas",flag:"\uD83C\uDDE7\uD83C\uDDF7",country:"br"},{code:"ru",label:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA",country:"ru"},{code:"ja",label:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5",country:"jp"},{code:"de",label:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA",country:"de"},{code:"fr",label:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7",country:"fr"},{code:"ko",label:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7",country:"kr"},{code:"it",label:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9",country:"it"},{code:"tr",label:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7",country:"tr"},{code:"id",label:"Bahasa Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9",country:"id"},{code:"th",label:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED",country:"th"},{code:"pl",label:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1",country:"pl"},{code:"nl",label:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1",country:"nl"},{code:"uk",label:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6",country:"ua"},{code:"fa",label:"فارسی",flag:"\uD83C\uDDEE\uD83C\uDDF7",country:"ir"},{code:"ms",label:"Bahasa Melayu",flag:"\uD83C\uDDF2\uD83C\uDDFE",country:"my"},{code:"sv",label:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA",country:"se"},{code:"el",label:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7",country:"gr"},{code:"he",label:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1",country:"il"}],i="en",a="9remote_locale"},58628:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});let r={common:{statusIdle:"Idle",statusWorking:"Working",statusBlocked:"Needs input",statusDone:"Your turn",connect:"Connect",disconnect:"Disconnect",loading:"Loading...",cancel:"Cancel",confirm:"Confirm",save:"Save",delete:"Delete",close:"Close",back:"Back",next:"Next",edit:"Edit",rename:"Rename",remove:"Remove",open:"Open",yes:"Yes",no:"No",ok:"OK",error:"Error",success:"Success",failed:"Failed",retry:"Retry",refresh:"Refresh",clipboard:"Clipboard",clipboardCopy:"Copy",clipboardEmpty:"Clipboard is empty",search:"Search",create:"Create",new:"New",add:"Add",copy:"Copy",copied:"Copied",download:"Download",upload:"Upload",enabled:"Enabled",disabled:"Disabled",on:"on",off:"off",minute:"min",hour:"h",day:"d",minutesAgo:"{n} min ago",hoursAgo:"{n} hours ago",daysAgo:"{n} days ago",done:"Done"},agentSwitcher:{title:"Your devices",active:"ACTIVE",unnamed:"Untitled",connecting:"Connecting…",unreachable:"Can't reach this device. Is it online?"},hosts:{title:"Hosts",openHost:"Open host",connecting:"Connecting…",lastSeen:"Last seen",online:"Online",offline:"Offline",sessions:"sessions",working:"working",attention:"need you",noSessions:"No sessions",addHost:"Add host",removeHost:"Remove host",removeHostMessage:'Remove "{name}" from your saved hosts? The machine itself is not affected.',disconnectMessage:'Disconnect from "{name}"? Its terminals keep running; the key stays saved.'},login:{tagline:"Access your terminal from anywhere",heroLine1:"Any machine.",heroLine2:"One terminal.",heroLine3:"In your pocket.",featureTerminal:"Terminal",featureDesktop:"Desktop",featureFiles:"Files",termConnected:"agent connected",termTunnel:"tunnel established",termReady:"ready",accessKey:"Access Key",placeholder:"sk-xxx... or One-Time Key (ABC123)",rememberKey:"Remember this key",connect:"Connect",connecting:"Connecting...",authenticating:"Authenticating with token...",invalidKeyTail:"Wrong access key — check the last characters and try again.",scanQr:"Scan QR to login",qrScanTitle:"Scan QR Code",qrHint:"Point the camera at the QR code shown on the machine running 9Remote.",qrDetected:"QR Code detected!",qrAuthenticating:"Authenticating...",qrPleaseWait:"Please wait...",qrLibFail:"Failed to load the QR scanner library.",qrInitFail:"Could not start the scanner.",qrCamDenied:"Camera permission denied. Allow camera access and try again.",qrNoCamera:"No camera found on this device.",qrCamBusy:"Camera is in use by another app.",qrCamError:"Could not open the camera.",agentOffline:"This machine isn't running 9remote. Start the agent, then try again.",legacyKeyUpdateRequired:"Agent update required",legacyKeyUpdateHint:"This device uses an older key format. Update 9remote on that machine to connect:",legacyKeyError:"This access key uses an older format. Please update 9remote to the latest version on your host machine.",updateRequired:"Update required",savedKeys:"Saved Keys",login:"Login",lastLogin:"Last login",namePlaceholder:"Name this key (optional)",rename:"Rename",deleteKeyTitle:"Delete key",deleteKeyConfirm:'Are you sure you want to delete "{name}"?',justNow:"Just now",minutesAgo:"{n}m ago",hoursAgo:"{n}h ago",daysAgo:"{n}d ago",tapToScan:"Tap to scan",orEnterManually:"or enter key manually",addKey:"Add Key",secureTitle:"Secure & Encrypted",secureDesc:"All connections are end-to-end encrypted and secure.",featAccessTitle:"Access Anywhere",featAccessDesc:"Connect from any device, anywhere.",featSecureTitle:"Secure Connection",featSecureDesc:"End-to-end encryption keeps you safe.",featFastTitle:"Fast & Reliable",featFastDesc:"Low latency and high performance.",featSessionsTitle:"Multiple Sessions",featSessionsDesc:"Manage and switch between sessions.",home:"Home",docs:"Docs"},menu:{reloadRestart:"Reload & Restart",restartHost:"Restart 9remote host",restartConfirmTitle:"Restart 9remote host?",restartConfirmMessage:"This restarts the agent process (no reinstall). Terminal sessions are preserved. It takes a few seconds.",restartStarting:"Restarting host…",restartRestarting:"Restarting 9remote…",restartDone:"Restarted! Reconnecting…",restartTimeout:"Restart is taking too long",restartTimeoutHint:"Reconnect manually if it doesn't recover.",title:"Menu",language:"Language",theme:"Theme",notifications:"Notifications",webgl:"GPU Render (Faster)",webglHint:"Turn off if text looks wrong",notificationsHint:"Notify when agent finishes",files:"File Explorer",downloading:"Downloading",copying:"Copying",conflictTitle:"File already exists",conflictMessage:"{name} already exists. Replace or skip?",skip:"Skip",skipAll:"Skip all",replace:"Replace",replaceAll:"Replace all",sites:"Local Sites",terminalSettings:"Terminal Settings",fontSize:"Font Size",terminalTheme:"Terminal Theme",terminalBackground:"Background",bgDim:"Background dim",bgApplyAll:"Apply to all",bgUrlPlaceholder:"Image URL (https://…)",bgSave:"Save",bgSaveFailed:"Could not save background",bgFromDevice:"Choose from device",bgFromUrl:"Paste image URL",bgChange:"Change image",bgAdd:"Add",bgCustomLabel:"Custom",bgDeleteFailed:"Could not delete background",bgCustomTitle:"Custom background",commandNotes:"Command Notes",showButtons:"Quick Buttons",showFolder:"Folder & Git Button",showNote:"Checklist Button",artifactHint:"The AI can preview html, docx, pdf, images and more instantly, beside your terminal.",artifactPanel:"Artifact preview",settingsJarvis:"Jarvis",jarvisToggle:"Jarvis coordinator",jarvisToggleHint:"Show the Jarvis button in the header. Its tools need the MCP switch in Plugins.",jarvisMcpOff:"The MCP switch in Plugins is off - Jarvis will start without its coordinator tools.",community:"Community",installApp:"Install App",upgrade:"Upgrade",upgradeExpires:"Expires",upgradeRestore:"Restore Purchases",codespace:"Codespace",logout:"Logout",settingsGeneral:"General",settingsAppearance:"Appearance",settingsTerminalTab:"Terminal",settingsMcp:"Plugins",mcpIntro:"Extra abilities you can give your AI coding tools.",mcpTools:"Allow",mcpRestartHint:"Turning it off applies at once. Turning it on needs the AI tool restarted.",mcpUnavailable:"Update this host to use MCP.",artifactFormats:"Formats it can show",mcpClients:"Works with",settingsWorkspace:"Workspace",settingsApplication:"Application",settingsAccount:"Account",themeLight:"Light",themeDark:"Dark",reload:"Reload App",remoteDesktop:"Remote Desktop",headerButtons:"Header buttons",settingsButtons:"Buttons",notificationsButton:"Notifications",settings:"Settings",enablePush:"Enable Push Notifications",disablePush:"Disable Push Notifications",pushHint:"Enable push notifications to get alerted when AI completes tasks",pushActiveHint:"Push notifications are on for this device. You'll be alerted when AI completes tasks.",versionMismatch:"9remote {version} is outdated",versionMismatchHint:"Some features may not work. Run:",updateNow:"Update now",updating:"Updating… reconnecting",webReloadTitle:"New web version available",webReloadHint:"Reload to get the latest interface.",reloadWeb:"Reload",updateAvailableTitle:"9Remote host update available",updateConfirmTitle:"Update 9remote?",updateConfirmMessage:"This installs the latest version and restarts the connection. It takes about a minute.",updateStarting:"Starting update…",updateInstalling:"Installing new version…",updateTimeout:"Update is taking too long",updateTimeoutHint:"Reload manually if it doesn't recover.",updateRestarting:"Updating 9remote…",updateReconnecting:"Reconnecting…",updateDone:"Updated! Reloading…",version:"Version",orientation:"Screen Orientation",orientationPortrait:"Portrait",orientationLandscape:"Landscape",orientationAuto:"Auto"},workspace:{loading:"Loading...",logoutTitle:"Logout",logoutMessage:"Are you sure you want to logout?",failedCreateSession:"Failed to create session: {error}",failedRenameSession:"Failed to rename session: {error}"},sessions:{headerTitle:"9remote.cc",connected:"Connected",disconnected:"Disconnected",codespaceStopped:"Codespace stopped",placeholder:"Terminal name (optional)",newButton:"+ New",empty:"No active sessions",emptyHint:"Create a new session to get started",created:"Created {time}",deleteTitle:"Delete Session",deleteMessage:'Are you sure you want to delete "{name}"?',editName:"Edit name",sessionActions:"Session actions",maximize:"Maximize",restoreSplit:"Restore split",split:"Split",hidePanel:"Hide panel",showPanel:"Show panel",resumeSession:"Resume session",restartAi:"Restart AI",markRead:"Mark as read",openAsUi:"Open as chat UI",openAsTerminal:"Open as terminal",modeSwitchFailed:"Could not switch this terminal",newTerminal:"New terminal",options:"Options"},agentHistory:{title:"History",empty:"No past conversations here yet",untitled:"Untitled",openNow:"Open in a terminal",minutesAgo:"{n}m",hoursAgo:"{n}h",daysAgo:"{n}d",showAll:"View all history",searchPlaceholder:"Search conversations…",allAgents:"All agents",delete:"Delete session",deleteTitle:"Delete conversation",deleteMessage:'Delete "{title}"? This permanently deletes the conversation transcript.',noResults:"No matching conversations"},workspaces:{title:"Workspaces",newWorkspace:"Add workspace",newWorkspacePrompt:"Workspace name",defaultName:"New workspace",ungrouped:"No workspace",addTerminal:"New terminal here",moveToWorkspace:"Move to workspace",rename:"Rename workspace",delete:"Remove workspace",emptyWorkspace:"No terminals here",selectFolder:"Choose folder",browse:"Browse",recentFolders:"Recent",searchFolders:"Search folders...",parentFolder:"Up one level",drives:"Drives",homeFolder:"Home",hiddenFolders:"Hidden folders",selectNamed:'Choose "{name}"',enterPath:"Type a path and press Enter",pathNotFolder:"That path is not a folder",filterOrPath:"Search, or type a path like /home/me",notADirectory:'"{name}" is not a folder in {dir}',multipleDirMatches:'"{name}" matches several folders in {dir}',invalidPath:"Invalid path",openHere:"New terminal here",tabFiles:"Files",tabGit:"Git",tabTrees:"Trees",refreshRepos:"Rescan repos",onlyChanged:"Only changed files",openFullFiles:"Open full file explorer",emptyTitle:"Nothing open yet",cardWorkspaceTitle:"Workspace",cardWorkspaceDesc:"Open a folder and run terminals in it",cardRemoteTitle:"Remote desktop",cardRemoteDesc:"Control this machine's screen",emptyWordTerminal:"Remote Terminal",emptyWordRemote:"Remote Desktop",emptyTagWorkspace:"workspace \xb7 pty",emptyTagRemote:"remote \xb7 webrtc",emptyMetaWorkspace:"open a folder \xb7 <b>sessions persist</b>",emptyMetaRemote:"control this machine \xb7 <b>low latency</b>",worktrees:"Worktrees",branches:"Branches",newWorktree:"New worktree",worktreeName:"Branch name",worktreeRepoLabel:"Repo to add the worktree in",worktreeNameAscii:"This name can't become a branch — type it in Latin letters.",addWorktree:"Add worktree",removeWorktree:"Remove worktree",removeWorktreeMessage:'Remove worktree at "{path}"?',removeWorktreeFolder:"Folder: {path}",removeWorktreeBranchDelete:"Branch: {branch} (fully merged — deleted too)",removeWorktreeBranchKeep:"Branch: {branch} (not fully merged — kept)",removeWorktreeSessions:"{count} session(s) inside: {names}",removeWorktreeBranch:'Branch "{branch}" is deleted too (when fully merged).',worktreeBranchKept:'Branch "{branch}" kept: not fully merged.',worktreeBusy:"{count} terminal(s) still run in this worktree: {names}",worktreeDirty:"This worktree has modified or untracked files — forcing the removal deletes them for good. Continue?",checkedOut:"checked out",newBranch:"New branch",checkout:"Checkout",searchBranch:"Search branches",worktreePath:"Worktree path",nestedRepos:"{count} repos",showCleanRepos:"Show {count} unchanged repo(s)",showHiddenRepos:"Unhide {count} repo(s)",hideRepo:"Hide this repo",scanDeeper:"Scan subfolders deeper",deleteTitle:"Remove workspace",deleteMessage:'Remove workspace "{name}"? Its terminals are closed. Files on disk are untouched.'},terminal:{quotaNoData:"No quota data",quotaUsageTitle:"usage",back:"Back",menu:"Menu",newTerminal:"New terminal",remoteDesktop:"Remote Desktop",defaultName:"Term",searchAgents:"Search terminal or agent",noAgentsFound:"No match",skipPermissions:"Skip permission prompts",plainShell:"Terminal",nameLabel:"Name (optional)",workspaceRoot:"Workspace root",detachedHead:"detached",browseFolders:"Browse folders…",shell:"Shell"},files:{selectWorkspace:"Select Workspace",recentWorkspaces:"Recent Workspaces",home:"Home",root:"Root",drive:"Drive {letter}",codespaces:"Codespaces",removeRecent:"Remove from recent",removeTitle:"Remove Workspace",removeMessage:'Remove "{name}" from recent workspaces?',setAsWorkspace:"Set as Workspace",openFolder:"Open Folder",newFile:"New File",newFolder:"New Folder",rename:"Rename",delete:"Delete",deleteFile:"Delete File",deleteFolder:"Delete Folder",deleteFileMessage:'Delete "{name}"?',deleteFolderMessage:'Delete folder "{name}" and all its contents?',emptyFolder:"Empty folder",git:"Git",parent:"Parent folder",workspace:"Workspace",failedLoad:"Failed to load: {error}",failedDelete:"Failed to delete: {error}",failedCreate:"Failed to create: {error}",failedRename:"Failed to rename: {error}",enterName:"Enter name",confirmRename:"Rename to:",setWorkspace:"Set Workspace",setAsWorkspaceTitle:"Set as workspace",switchWorkspace:"Switch workspace",searchFiles:"Search files",toggleHidden:"Toggle hidden files",searchPlaceholder:"Search files...",searching:"Searching...",noFilesFound:"No files found",noGitRepo:"No git repository",cannotOpenBinary:"Cannot open binary file",createNew:"Create New",file:"File",folder:"Folder",placeholderFile:"filename.js",placeholderFolder:"folder-name",pickFile:"Choose files",pickFolder:"Choose folder",copyPath:"Copy path",copyRelPath:"Copy Relative Path",copyName:"Copy Filename",delete:"Delete",rename:"Rename",deleteConfirmTitle:"Delete",deleteConfirmMessage:'Delete "{name}"?'},fileKind:{web:"Web pages",document:"Documents",sheet:"Spreadsheets",image:"Images",media:"Audio & video",diagram:"Diagrams",code:"Code & text"},editor:{save:"Save",saving:"Saving...",saved:"Saved",unsaved:"Unsaved changes",close:"Close",discard:"Discard",discardTitle:"Discard Changes",discardMessage:"You have unsaved changes. Discard them?",unsavedTitle:"Save changes to {name}?",unsavedBody:"Your changes will be lost if you don't save them.",failedLoad:"Failed to load file: {error}",failedSave:"Failed to save: {error}",openFull:"Open in full editor",artifact:"Artifact",preview:"Preview",editCode:"Edit code",reload:"Reload",previewFailed:"Preview failed",previewNoRoute:"No LAN or tunnel route to the agent",previewBack:"Back",previewForward:"Forward",previewOpenTab:"Open in a new tab",changedOnDisk:"Changed on disk",reloadFromDisk:"Reload",mermaidEmpty:"Nothing to draw",readOnly:"Read only",line:"Line",column:"Column",gitDiff:"Git Diff",typeText:"Type text and insert...",insert:"Insert",statusModified:"Modified",statusAdded:"Added",statusUntracked:"Untracked"},git:{title:"Git",branch:"Branch",changes:"Changes",staged:"Staged",unstaged:"Unstaged",untracked:"Untracked",commit:"Commit",commitAndPush:"Commit & Push",commitSuccess:"Commit successful",pushSuccess:"Push successful",stageFailed:"Failed to stage changes",commitFailed:"Commit failed",pushFailed:"Push failed",pullSuccess:"Pull successful",pullFailed:"Pull failed",stageAllConfirmTitle:"Stage All & Commit",stageAllConfirmMessage:"No changes are staged. Stage all changes and commit?",stageAndCommit:"Stage & Commit",gitActions:"Git actions",commitPlaceholder:"Commit message…",stageAllNote:"Stage all \xb7 {count}",upToDate:"Everything up-to-date",commitMessage:"Commit message",push:"Push",pull:"Pull",fetch:"Fetch",stage:"Stage",stageAll:"Stage All",unstage:"Unstage",discard:"Discard",discardChanges:"Discard Changes",discardMessage:'Discard changes to "{name}"?',noChanges:"No changes",diff:"Diff",pushing:"Pushing...",pulling:"Pulling...",committing:"Committing...",failedCommit:"Failed to commit: {error}",failedPush:"Failed to push: {error}",failedPull:"Failed to pull: {error}",status:"Status",diffTab:"Diff",modified:"Modified",added:"Added",deleted:"Deleted",untrackedTitle:"Untracked",openFile:"Open file",discardChangesTitle:"Discard changes",discardConfirmTitle:"Discard Changes",discardConfirmDelete:'Are you sure you want to delete "{name}"? This cannot be undone.',discardConfirmDiscard:'Are you sure you want to discard changes in "{name}"? This cannot be undone.',addToGitignore:"Add to .gitignore"},fileExplorer:{explorer:"Explorer",search:"Search",sourceControl:"Source Control",settings:"Settings",outline:"Outline",noFolderOpen:"No folder open",uploadingCount:"Uploading {{n}}/{{total}}…",uploadFailedCount:"{{n}} of {{total}} files failed to upload",openFolder:"Open Folder",recentWorkspaces:"Recent Workspaces",openedEditors:"Open Editors",closeEditor:"Close",closeOthers:"Close Others",closeAll:"Close All",closeAllSaved:"Close All Saved",saveAll:"Save All",newFile:"New File",newFolder:"New Folder",refreshExplorer:"Refresh Explorer",collapseAll:"Collapse All",searchInFiles:"Search in files",replaceInFiles:"Replace in files",searchPlaceholder:"Search",replacePlaceholder:"Replace",caseSensitive:"Match Case",wholeWord:"Match Whole Word",useRegex:"Use Regular Expression",filesToInclude:"files to include",filesToExclude:"files to exclude",noResults:"No results found",resultCount:"{count} results in {fileCount} files",replaceAll:"Replace All",replaceConfirmTitle:"Replace in Files",replaceConfirmMessage:"Replace {count} occurrences in {fileCount} files?",commandPalette:"Command Palette",quickOpen:"Quick Open File",typeCommand:"Type a command",typeFileName:"Type a file name",noCommandsFound:"No commands found",workspaceSwitcher:"Switch Workspace",pinWorkspace:"Pin",unpinWorkspace:"Unpin",renameWorkspace:"Rename Workspace",workspaceNamePlaceholder:"Workspace display name",pinned:"Pinned",recent:"Recent",searchWorkspaces:"Search workspaces",welcomeTitle:"Welcome",welcomeSubtitle:"Open a folder to start working",welcomeOpenFolder:"Open Folder",welcomeRecent:"Recent",toggleSidebar:"Toggle Sidebar",togglePanel:"Toggle Panel",togglePanelBottom:"Toggle Bottom Panel",toggleWordWrap:"Toggle Word Wrap",zoomIn:"Zoom In",zoomOut:"Zoom Out",resetZoom:"Reset Zoom",formatDocument:"Format Document",findInFile:"Find",replaceInFile:"Replace",goToLine:"Go to Line",goToFile:"Go to File",revealInOS:"Reveal in Finder/Explorer",openInTerminal:"Open in Terminal",copyPath:"Copy Path",copyRelativePath:"Copy Relative Path",duplicate:"Duplicate",cut:"Cut",paste:"Paste",autoSave:"Auto Save",autoSaveOff:"Off",autoSaveAfterDelay:"After Delay",autoSaveOnFocusChange:"On Focus Change",fontSize:"Font Size",wordWrap:"Word Wrap",language:"Language",encoding:"Encoding",spaces:"Spaces",branch:"Branch",noBranch:"No branch",commitMessage:"Commit Message",commitMessagePlaceholder:"Message (Cmd+Enter to commit)",stage:"Stage",stageAll:"Stage All",unstage:"Unstage",push:"Push",pull:"Pull",sync:"Sync",staged:"Staged Changes",changes:"Changes",untracked:"Untracked",bottomPanelTerminal:"Terminal",bottomPanelOutput:"Output",bottomPanelProblems:"Problems",expandAll:"Expand All",recentFiles:"Recent Files",closedTabReopen:"Reopen Closed Tab",unsavedDot:"●",loadingTree:"Loading...",fileWatcherActive:"Watching for changes"},mobile:{title:"Android Device",refreshDevices:"Refresh devices",pickDevice:"Pick a device to mirror",noDevices:"No Android device found. Start an emulator or attach a device with USB debugging on.",starting:"Starting stream…",unsupportedBrowser:"This browser cannot decode the video stream. Use Chrome, Edge, or Safari 16.4+.",back:"Back",home:"Home",recents:"Recents",power:"Lock screen",shutdownDevice:"Shut down the emulator",shutdownTitle:"Shut down emulator?",shutdownMessage:"{name} will stop, losing anything running on it. Starting it again takes around 20 seconds.",shutdownConfirm:"Shut down",androidDevice:"Android Device",deviceRunning:"Android Device — {count} running",rotate:"Rotate",stopped:"Stopped",startDevice:"Start device",stopDevice:"Stop device",switchDevice:"Switch device",lowPower:"Low power mode",lowPowerHint:"No emulator window — much less CPU, fewer frames",noDevicesWithSdk:"No device running. Start an emulator below, or attach a phone with USB debugging on.",phaseLaunching:"Starting emulator…",phaseBooting:"Booting Android…",phaseReady:"Almost ready…",backToScreen:"Back to the device screen",tabApps:"Apps",tabLogs:"Logs",dropApk:"Install an APK",dropApkHint:"Drop a file here, or tap to choose",installing:"Installing…",installedApps:"Installed apps",noApps:"No user apps installed",launch:"Launch",forceStop:"Force stop",clearData:"Clear data",uninstall:"Uninstall",deepLinkPlaceholder:"myapp://path or https://…",filterByApp:"Filter by app",allApps:"All apps",minLevel:"Level",clearLog:"Clear log",pauseLog:"Pause",resumeLog:"Resume",logPaused:"Paused — new lines are not shown",noLogs:"Waiting for log output…",hideNoise:"Hide driver noise",showNoise:"Show driver noise (hidden by default)",modeFloat:"Unpin (float over the page)",modePin:"Pin to the right",resize:"Resize",setupTitle:"Android tooling",setupInstall:"Install",setupExtracting:"Extracting…",setupInstallTo:"Installs to",setupLowDisk:"Not enough disk space at the install location",setupRequires:"Needs {deps} first",setupDepsCmdline:"command line tools",setupDepsJdk:"Java 17",setupDepsEmulator:"emulator",setupBannerHint:"Some Android tools are missing — tap to install",addDevice:"Add device",noDevicesHint:"No device yet — tap + to create one, or plug in a phone with USB debugging on.",presetReady:"Ready — nothing to download",presetDownload:"Android 16 \xb7 ~1.5 GB download","provisionStep_platform-tools":"Downloading adb…",provisionStep_jdk:"Downloading Java…","provisionStep_cmdline-tools":"Downloading SDK tools…",provisionStep_emulator:"Downloading the emulator…",provisionStep_image:"Downloading Android…",provisionStep_create:"Creating the device…",imagesTitle:"System images",imagesSearch:"Search system images…",imagesNone:"No system images match",imageInstall:"Install image",imageRemove:"Remove image",imageRemoveTitle:"Remove system image?",imageRemoveMessage:"{path} will be deleted from the host. AVDs using it will no longer start.",avdCreateTitle:"Create Virtual Device",avdStep1:"Hardware",avdStep2:"System Image",avdStep3:"Name",avdNoProfiles:"No device profiles available",avdNamePlaceholder:"AVD name",avdInstalledBelow:"Installed images are marked",avdMenu:"AVD options",avdWipe:"Wipe data",avdWipeTitle:"Wipe AVD data?",avdWipeMessage:"{name} will lose all apps, accounts and files — back to a fresh device.",avdDelete:"Delete",avdDeleteTitle:"Delete AVD?",avdDeleteMessage:"{name} and its storage on the host will be removed permanently."},remote:{title:"Remote Desktop",connecting:"Connecting...",disconnected:"Disconnected",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",receivingImage:"Receiving screen…",keyboard:"Keyboard",mouse:"Mouse",fps:"FPS",debug:"Debug",help:"Help",close:"Close",sendKey:"Send Key",helpTitle:"Remote Desktop Help",notAvailable:"Remote desktop is not available",customizeKeys:"Customize keys",back:"Back",resetZoom:"Reset zoom",refresh:"Refresh",rectangleSelection:"Rectangle selection",handMode:"Hand mode",toggleKeyboard:"Toggle native keyboard",hideControls:"Hide controls",showControls:"Show controls",textBatchInput:"Text batch input",extraKeys:"Extra keys",customizeRemoteKeys:"Customize Remote Keys",exitRemote:"Exit remote desktop",debugTitle:"Debug Stats",minimize:"Minimize",transport:"Transport",latency:"Latency",tilesPerSec:"Tiles/sec",bandwidth:"Bandwidth",clearStats:"Clear Stats",lockTitle:"Windows is locked",lockGrantDesc:'Turn on "Unlock PC remotely" in 9remote host on this PC.',lockDesc:"Enter the Windows PIN or password for this computer",lockPlaceholder:"Windows PIN or password",unlock:"Unlock",unlocking:"Unlocking…",unlockFailed:"Unlock failed — check your PIN/password and try again."},remoteHelp:{modePc:"PC / Mouse",modeTrackpad:"Touch \xb7 Trackpad",modeDirect:"Touch \xb7 Direct",mouseTitle:"Mouse",keyboardTitle:"Keyboard",gesturesTrackpadTitle:"Gestures (Trackpad ✋)",gesturesDirectTitle:"Gestures (Direct)",toolbarTitle:"Toolbar",mouseClickKey:"Click / Drag",mouseClickDesc:"Left-click, drag to select/move",mouseRightKey:"Right-click",mouseRightDesc:"Context menu on remote",mouseWheelKey:"Wheel",mouseWheelDesc:"Scroll remote (Shift + Wheel = horizontal)",mouseDoubleKey:"Double-click",mouseDoubleDesc:"Double-click on remote",keyPhysicalKey:"Physical keys",keyPhysicalDesc:"Sent directly (Tab, F-keys, etc. captured)",keyModifierKey:"Ctrl / Alt / Shift / ⌘",keyModifierDesc:"Sticky modifier — combine with next key",trackpadSwipeKey:"1 finger swipe",trackpadSwipeDesc:"Move virtual cursor",trackpadTapKey:"1 finger tap",trackpadTapDesc:"Left-click at cursor",trackpad2TapKey:"2 fingers tap",trackpad2TapDesc:"Right-click at cursor",trackpad2SwipeKey:"2 fingers swipe",trackpad2SwipeDesc:"Scroll at cursor position",trackpadPinchKey:"2 fingers pinch",trackpadPinchDesc:"Zoom canvas",trackpadScrollLockKey:"Hold + drag",trackpadScrollLockDesc:"Hold to lock scroll, drag any direction",directTapKey:"1 finger tap",directTapDesc:"Click at tap position",directLongKey:"1 finger long-press",directLongDesc:"Right-click",directDoubleKey:"1 finger double-tap",directDoubleDesc:"Double-click",directScrollKey:"2 fingers swipe",directScrollDesc:"Scroll remote",directPinchKey:"2 fingers pinch",directPinchDesc:"Zoom canvas",directPanKey:"1 finger drag (zoom>1)",directPanDesc:"Pan canvas",toolbarHandDesc:"Hold left-click (drag mode) — tap again to release",toolbarMouseDirectDesc:"Switch to Direct mode",toolbarMouseTrackpadDesc:"Switch to Trackpad (virtual cursor)",toolbarKeyboardDesc:"Native keyboard / text batch input",toolbarRectDesc:"Rectangle selection mode"},remoteControls:{enterToSend:"Tab or Ctrl+Num to switch tab",typeToSend:"Type text to send...",send:"Send",trackpadMode:"Trackpad mode",directMode:"Direct mode",bottomRow:"Bottom Row",extraPanel:"Extra Panel",exitConfirmMessage:"Are you sure you want to exit the current remote desktop session?"},connection:{retrying:"Reconnecting...",waitingApproval:"Waiting for Approval",approvalDescription:"The 9Remote host needs to approve this device before you can connect.",approvalHint:"Check the terminal on your machine.",rejectedTitle:"Device Rejected",rejectedDescription:"This device was not approved by the 9Remote host.",backToLogin:"Back to Login",failed:"Connection Failed",failedDescription:"Unable to connect after {n} attempts",attemptOf:"Attempt {n} of {total}",exit:"Exit",cancel:"Cancel",retry:"Retry now"},notifications:{claudeCode:"Claude Code",codex:"Codex",geminiCli:"Gemini CLI",openCode:"OpenCode",title:"Notifications",empty:"No notifications",needsInput:"needs input",badgeTitle:"{blocked} needs input, {done} your turn",replied:"replied",agent:"Agent"},sites:{title:"Sites",localSites:"Local Sites",selectSitePreview:"Select a site to preview",browserNewTab:"New tab",browserAddressPlaceholder:"localhost:3000 or /path",browserNotConnected:"Connect to your agent first",portPlaceholder:"port",loadingSites:"Loading Sites...",notConnected:"Not connected to the agent",noSitesFound:"No sites found",startServerHint:"Start a local dev server to see it here",siteNamePlaceholder:"Site name",saveTitle:"Save",editNameTitle:"Edit name",removeTitle:"Remove",removePortTitle:"Remove Port",removePortMessage:"Remove port {port} from saved list?",popupBlocked:"Popup blocked! Please allow popups for this site.",startProxyFailed:"Failed to start proxy session for {name}",foundCount:"{n} site{suffix} found",focusOpenedTab:"Focus opened tab",openInNewTab:"Open in new tab",goBack:"Go back",goForward:"Go forward",loadingSite:"Loading...",empty:"No active sites",emptyHint:"Run a local server to see it here",open:"Open",refresh:"Refresh",newTabTitle:"Open local site",errorSwBlocked:"This browser blocked the service worker the site view needs",errorNoBridge:"Connect to your agent first",errorNoSession:"Port {port} is no longer open — reopen the site",errorTimeout:"The site did not answer in time",errorNoReply:"No reply from the agent",errorGeneric:"The site could not be loaded"},commandNotes:{title:"Command Notes",noSavedCommands:"No saved commands",addFirstBelow:"Add your first command below",clickToCopy:"Click to copy",copiedBang:"Copied!",copy:"Copy",edit:"Edit",delete:"Delete",editCommandPlaceholder:"Edit command...",addCommandPlaceholder:"Add command...",update:"Update",add:"Add",empty:"No notes yet",emptyHint:"Save commands for quick access",add:"Add Note",edit:"Edit Note",delete:"Delete Note",deleteMessage:"Delete this note?",name:"Name",command:"Command",save:"Save",placeholderName:"e.g. Start dev server",placeholderCommand:"e.g. npm run dev"},mobileKeyboard:{pasteHere:"Paste here (Cmd+V)",enterToSend:"{shortcut} to switch tab",typeCommand:"Type command and send...",send:"Send",toggleExtraKeys:"Toggle extra keys",toggleTextInput:"Toggle text input",customizeTerminalKeys:"Customize Terminal Keys",mainBar:"Main Bar",extraPanel:"Extra Panel",fileTooLarge:"File too large (max 5MB)",readFileFailed:"Failed to read file",uploadFailed:"Failed to upload file: {error}"},terminalPane:{scrollToBottom:"Scroll to bottom",refresh:"Refresh terminal",openFolder:"Open folder",openFolderHere:"Open files here",changedFiles:"Changed files",pasteOrType:"Paste or type here",paste:"Paste",note:"Checklist",addToNote:"Add to checklist"},note:{title:"Checklist",placeholder:"No tasks yet",copy:"Copy",clear:"Clear",saved:"Saved",addSuccess:"Added to checklist",copyTodo:"Copy to-do items",multilinePlaceholder:"One task per line…",addLines:"Add each line as an item",copyItem:"Copy — taps stack rows in list order",edit:"Edit",drag:"Drag to reorder",pin:"Pin above the terminal",unpin:"Unpin",expand:"Open the full checklist",allDone:"All done",clearDone:"Clear done",sendHint:"Send to terminal with checklist",addChip:"Add chip",removeChip:"Remove chip",chipPlaceholder:"Chip text…"},pwaGuide:{copyYourKey:"Copy Your Key",copyKeyHint:"Tap the key below to copy — you'll need it to login after installing",tapToCopyApiKey:"Tap to copy API key",copiedBang:"Copied!",copy:"Copy",tapShareButton:"Tap Share Button",tapShareHint:"Tap the share button at the bottom of Safari",addToHome:"Add to Home Screen",addToHomeHint:'Scroll down and tap "Add to Home Screen"',openAppPasteKey:"Open App & Paste Key",openAppPasteKeyHint:"Open the installed app and paste your key to login",openMenu:"Open Menu",openMenuHint:"Tap the menu button (three dots) in Chrome",installApp:"Install App",installAppHint:'Tap "Install app" or "Add to Home screen"',lookInstallIcon:"Look for Install Icon",lookInstallIconHint:"Look for the install icon in the address bar",clickInstallPaste:"Click Install & Paste Key",installNow:"Install Now",installNowHint:"Install 9Remote as an app for quick access",installing:"Installing...",clickInstallPasteHint:"Click install, open the app, and paste your key to login",alternativeHint:'Alternative: Open browser menu → "Install 9Remote" or "Create shortcut"',loadingPlatform:"Loading platform detection...",iosPlatform:"iOS (iPhone/iPad)",androidPlatform:"Android",macosPlatform:"macOS",windowsPlatform:"Windows",desktopPlatform:"Desktop",alreadyInstalled:"Already Installed!",alreadyInstalledHint:"You're already using 9Remote as an installed app",installationGuide:"Installation Guide",installationSteps:"Installation Steps:"},community:{title:"Community",description:"Join the 9Remote community"},pwa:{title:"Install as App",description:"Install 9Remote on your device for the best experience",iosTitle:"iOS Safari",androidTitle:"Android Chrome",desktopTitle:"Desktop"},codespace:{title:"Codespace",name:"Name",status:"Status",running:"Running",autoStart:"Auto Start 9Remote",autoStartHint:"Start 9Remote when codespace opens",stop:"Stop Codespace",stopHint:"Stop to save usage",restartHint:"To restart, go to GitHub",unknown:"Unknown"},history:{title:"Command history",empty:"No commands yet",clearAll:"Clear all",snippets:"Snippets",history:"History",pin:"Pin as snippet",unpin:"Unpin",editSnippet:"Edit snippet",aliasLabel:"Alias",aliasHint:"Type this shortcut then send to run the command",commandLabel:"Command",aliasPlaceholder:"e.g. nrd"},voice:{dictate:"Voice input",language:"Voice language",clear:"Clear",denied:"Microphone blocked — allow mic access in your browser settings"},shortcuts:{title:"Keyboard shortcuts",menuLabel:"Keyboard shortcuts",switchTerminal:"Switch terminal",switchWorkspace:"Switch workspace",terminalActions:"New / Close terminal",togglePanels:"Toggle side panels",palette:"Search files",help:"Keyboard shortcuts",sessionPrev:"Previous terminal",sessionNext:"Next terminal",workspacePrev:"Previous workspace",workspaceNext:"Next workspace",sessionIndex:"Go to terminal 1-9",closeTerminal:"Close terminal",fitPanes:"Auto-fit panes",toggleFocus:"Toggle terminal / input focus",newTerminal:"New terminal",toggleSidebar:"Toggle sidebar",toggleRightPanel:"Toggle side panel"}}},61826:(e,t,n)=>{"use strict";n.d(t,{O5:()=>c,U2:()=>r,dX:()=>d,mn:()=>l,yP:()=>a});let r="/workspace",i={list:()=>r,terminal:e=>`${r}/terminal/${encodeURIComponent(e.sessionId||"")}`,files:e=>o(`${r}/files`,{ws:e.workspace,p:e.currentPath}),editor:e=>o(`${r}/editor`,{path:e.path,line:e.line,col:e.column}),git:e=>o(`${r}/git`,{ws:e.workspace}),remote:()=>`${r}/remote`,mobile:()=>`${r}/mobile`,workspaces:()=>`${r}/workspaces`,browse:e=>o(`${r}/browse`,{path:e.path})},a=["site"],s={"":"list",terminal:"terminal",files:"files",editor:"editor",git:"git",remote:"remote",mobile:"mobile",workspaces:"workspaces",browse:"browse"};function o(e,t){let n=Object.entries(t).filter(([,e])=>null!=e&&""!==e).map(([e,t])=>`${e}=${encodeURIComponent(t)}`).join("&");return n?`${e}?${n}`:e}function l(e,t){if(!e?.startsWith(r))return null;let[n,i]=e.slice(r.length).replace(/^\//,"").split("/"),a=s[n||""];if(!a)return null;let o=e=>t?.get(e)||void 0;switch(a){case"terminal":return{type:a,sessionId:i?decodeURIComponent(i):void 0};case"files":return{type:a,workspace:o("ws"),currentPath:o("p")};case"editor":return{type:a,path:o("path"),line:p(o("line")),column:p(o("col"))};case"git":return{type:a,workspace:o("ws")};case"browse":return{type:a,path:o("path")};default:return{type:a}}}function c(e){return(i[e?.type]||i.list)(e)}function d(e,t){let n=c(t),r=e.findIndex(e=>c(e)===n);if(-1!==r)return e.slice(0,r+1);if("terminal"===t.type&&e[e.length-1]?.type==="terminal"){let n=[...e];return n[n.length-1]=t,n}return null}function p(e){let t=Number(e);return Number.isFinite(t)?t:void 0}},63977:(e,t,n)=>{"use strict";n.d(t,{freshAuth:()=>a});var r=n(90084),i=n(86251);async function a(e={},t){let n={...e,connectionMode:t},s=(0,r.lz)(e.apiKey),o=e.tempKey?(0,r.lz)(e.tempKey):null,l=s?.tail?s:o?.tail?o:s||o,c=l?.tail;if(delete n.keyTail,delete n.keyTailSealed,!c)return n;if(l?.hostSealKey){let e=await (0,i.Y)(c,l.hostSealKey);if(e)return n.keyTailSealed=e,n}return n.keyTail=c,n}},73426:(e,t,n)=>{"use strict";n.d(t,{x:()=>p,z:()=>u});var r=n(90076),i=n(20464),a=n(31735),s=n(97711),o=n(11155),l=n(992),c=n(90084),d=n(86129);async function p(e,{route:t,currentKey:n}={}){n&&((0,a.d6)(n,window.location.pathname+window.location.search),l.rh.getState().setAutoConnect((0,o.Uo)(n),!0));let c=await fetch(r.Sn.connect,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e})});if(!c.ok)throw Error("connect failed");let d=await c.json(),u=!1;for(let t=0;t<r.jP&&!u;t++)(u=await (0,i.zg)(d.tunnelUrl,e))||!(t<r.jP-1)||await new Promise(e=>setTimeout(e,r.dM));if(!u)throw Error("unreachable");(0,s.v)({apiKey:e,tunnelUrl:d.tunnelUrl,mode:"remote",localIp:d.localIp||null}),window.location.href=t||(0,a.ey)(e)||"/workspace/"}function u(e,{remember:t=!0,leavingHead:n=null}={}){if(e?.tail&&e.tempKey&&(0,c.LG)(e.tempKey,{tail:e.tail}),t)try{sessionStorage.setItem(d.aS,"1")}catch{}n&&l.rh.getState().setAutoConnect((0,o.Uo)(n),!0),window.location.href="/workspace/"}},75687:(e,t,n)=>{"use strict";function r(e){let t=String(e||"").trim(),n=e=>({tempKey:e.slice(0,6).toUpperCase(),tail:e.slice(6,8).toUpperCase()}),r=/#([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(r)return n(r[1].replace(/-/g,""));let i=/^([A-NP-Z1-9]{6}-?[a-np-z1-9]{2})$/i.exec(t);if(i)return n(i[1].replace(/-/g,""));let a=/[?&]k=([A-NP-Z1-9]{6})(?:[^A-NP-Z1-9]|$)/i.exec(t);return a?{tempKey:a[1].toUpperCase()}:/^[A-NP-Z1-9]{6}$/i.test(t)?{tempKey:t.toUpperCase()}:null}n.d(t,{k:()=>r})},78762:(e,t,n)=>{"use strict";n.d(t,{s:()=>u});var r=n(1521),i=n(2074),a=n(52345),s=n(58628);let o=a.dI.map(e=>e.code),l=new Map,c=(e,t)=>{if(!o.includes(e)||e===a.Xn||d.getState().dicts[e]||l.has(e))return;let r=n(49262)(`./${e}.js`).then(n=>{l.delete(e);let r=n.default;return t(t=>({dicts:{...t.dicts,[e]:r}})),r}).catch(()=>{l.delete(e)});l.set(e,r)},d=(0,i.v)(e=>({locale:a.Xn,dicts:{[a.Xn]:s.default},hydrated:!1,hydrate:()=>{let t=function(){try{let e=window.localStorage.getItem(a.zl);if(e&&o.includes(e))return e}catch{}return a.Xn}();c(t,e),e({locale:t,hydrated:!0})},setLocale:t=>{if(o.includes(t)){try{window.localStorage.setItem(a.zl,t)}catch{}c(t,e),e({locale:t})}}}));function p(e,t){if(e)return t.split(".").reduce((e,t)=>null==e?e:e[t],e)}function u(){let{locale:e,dicts:t,hydrated:n,hydrate:i,setLocale:s}=d();(0,r.useEffect)(()=>{n||i()},[n,i]);let o=t[e]||t[a.Xn],l=t[a.Xn];return{t:(0,r.useMemo)(()=>(e,t)=>{var n;return n=p(o,e)??p(l,e)??e,"string"==typeof n&&t?n.replace(/\{(\w+)\}/g,(e,n)=>null!=t[n]?t[n]:`{${n}}`):n},[o,l]),locale:e,setLocale:s,hydrated:n}}},79253:(e,t,n)=>{"use strict";n.d(t,{$b:()=>_,A0:()=>z,AE:()=>f,Ax:()=>I,Dk:()=>P,GW:()=>H,Jl:()=>j,Kr:()=>q,L0:()=>Q,L8:()=>y,LN:()=>E,Qw:()=>M,RV:()=>function e(t){let n;if(!t||"object"!=typeof t)return t;if(Array.isArray(t)){let n=!1,r=t.map(t=>{let r=e(t);return r!==t&&(n=!0),r});return n?r:t}for(let a of Object.keys(t)){let s=t[a];if(i.has(a)&&"string"==typeof s&&s.includes("\\"))(n||={...t})[a]=r(s);else if(s&&"object"==typeof s){let r=e(s);r!==s&&((n||={...t})[a]=r)}}return n||t},W5:()=>X,YO:()=>k,ZH:()=>b,_C:()=>B,bd:()=>Z,cv:()=>W,d5:()=>K,fQ:()=>v,gh:()=>R,hh:()=>L,iB:()=>w,kS:()=>U,kb:()=>r,mv:()=>C,n2:()=>F,pA:()=>D,qu:()=>N,rL:()=>J,so:()=>S,u:()=>g,vd:()=>$,vs:()=>A,xW:()=>T,xl:()=>G,xr:()=>V,zT:()=>O});let r=e=>"string"==typeof e?e.replace(/\\/g,"/"):e,i=new Set(["path","currentPath","parentPath","dirPath","filePath","repoPath","oldPath","newPath","fullPath","relativePath"]),a=[".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".svg",".avif",".apng",".tif",".tiff",".heic",".heif"],s=[".mp4",".m4v",".webm",".ogv",".mov",".mkv",".avi",".3gp"],o=[".mp3",".wav",".ogg",".oga",".flac",".m4a",".aac",".opus"],l=[".pdf"],c=[".docx"],d=[".xlsx",".xls",".csv",".tsv"],p=[".html",".htm",".xhtml"],u=[".mmd",".mermaid"],h=[".md",".markdown",".mdx"];function m(e,t){if(!e)return!1;let n=e.toLowerCase();return t.some(e=>n.endsWith(e))}let g=e=>m(e,a),f=e=>m(e,s),y=e=>m(e,o),b=e=>m(e,l),_=e=>m(e,c),w=e=>m(e,d);function k(e){return e?m(e,p)?"html":m(e,h)?"markdown":m(e,u)?"mermaid":null:null}let v="9remote-preview",S={".js":"javascript",".jsx":"javascript",".ts":"javascript",".tsx":"javascript",".mjs":"javascript",".cjs":"javascript",".html":"html",".htm":"html",".xhtml":"html",".css":"css",".scss":"css",".sass":"css",".less":"css",".styl":"css",".json":"json",".json5":"json",".jsonc":"json",".md":"markdown",".markdown":"markdown",".mdx":"markdown",".py":"python",".pyw":"python",".rb":"ruby",".php":"php",".go":"go",".rs":"rust",".java":"java",".kt":"kotlin",".kts":"kotlin",".swift":"swift",".scala":"scala",".clj":"clojure",".cljs":"clojure",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hs":"haskell",".ml":"ocaml",".mli":"ocaml",".jl":"julia",".pl":"perl",".pm":"perl",".tcl":"tcl",".lua":"lua",".r":"r",".dart":"dart",".groovy":"groovy",".gradle":"groovy",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".cs":"csharp",".m":"objectivec",".sh":"shell",".bash":"shell",".zsh":"shell",".fish":"shell",".ps1":"powershell",".bat":"batch",".cmd":"batch",".yml":"yaml",".yaml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".properties":"ini",".xml":"xml",".sql":"sql",".graphql":"graphql",".gql":"graphql",".proto":"protobuf",".vue":"vue",".svelte":"svelte",".csv":"csv",".tsv":"csv",".log":"log",".diff":"diff",".patch":"diff",".dockerfile":"dockerfile",".makefile":"makefile",".mk":"makefile",".env":"env",".gitignore":"gitignore"},A={M:"text-git-modified",A:"text-git-added",D:"text-git-deleted","?":"text-git-untracked",U:"text-git-modified"},T={normal:{indentBase:12,indentStep:12,icon:16,chevron:14,text:"text-[15px] sm:text-sm",padY:"py-1 sm:py-0.5"},compact:{indentBase:8,indentStep:8,icon:14,chevron:12,text:"text-[13px] sm:text-[12px]",padY:"py-0.5 sm:py-[1px]"}},C=e=>e?"folder-changed"===e?22:32:4,R=768,x="git-diff:",P=(e,t)=>`${x}${e}:${t}`,D=e=>"string"==typeof e&&e.startsWith(x),I=e=>{let t=e.slice(x.length),n=t.indexOf(":");return{status:t.slice(0,n),absPath:t.slice(n+1)}},F=(e,t,n)=>`${x}${e}:${t}\u0000${n}`,N=e=>{let{status:t,absPath:n}=I(e),r=n.indexOf("\0");return -1===r?{status:t,repoPath:null,filePath:n}:{status:t,repoPath:n.slice(0,r),filePath:n.slice(r+1)}},M=18,L=12,$=40,O=48,E=30,U=10,B=70,W=20,j={MAX_DIRS:40,DEBOUNCE_MS:300,PREVIEW_DEBOUNCE_MS:1e3,IDLE_UNWATCH_MS:6e4},H="fileExplorer:gitRefresh",K={sidebarWidth:"fileExplorer.sidebarWidth",sidebarVisible:"fileExplorer.sidebarVisible",bottomPanelVisible:"fileExplorer.bottomPanelVisible",bottomPanelHeight:"fileExplorer.bottomPanelHeight",activityPanel:"fileExplorer.activityPanel",recentFiles:"fileExplorer.recentFiles",openTabs:"fileExplorer.openTabs",editorFontSize:"fileExplorer.editorFontSize",wordWrap:"fileExplorer.wordWrap",expandedFolders:"fileExplorer.expandedFolders",showHidden:"fileExplorer.showHidden"},q={explorer:"explorer",search:"search",scm:"scm",settings:"settings"},z=14,G=4,J=9,V=10,Z=28,Q=5,X=4194304},80186:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(73365);function i({children:e,variant:t="primary",size:n="md",disabled:a=!1,loading:s=!1,onClick:o,className:l="",...c}){let d=`font-semibold rounded-brand transition-all duration-150 ease-out transform active:scale-[0.97] ${{primary:"bg-brand-500 hover:bg-brand-600 disabled:bg-surface-3 disabled:text-text-muted text-white shadow-sm",secondary:"bg-surface-2 hover:bg-surface-3 disabled:bg-surface disabled:text-text-muted text-text",danger:"bg-red-500 hover:bg-red-600 disabled:bg-surface-3 disabled:text-text-muted text-white",success:"bg-green-600 hover:bg-green-700 disabled:bg-surface-3 disabled:text-text-muted text-white"}[t]} ${{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-base",lg:"px-6 py-3 text-lg"}[n]} ${a||s?"cursor-not-allowed":""} ${l}`;return(0,r.jsx)("button",{onClick:o,disabled:a||s,className:d,...c,children:s?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("span",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),e]}):e})}},82227:(e,t,n)=>{"use strict";n.d(t,{G:()=>r,V:()=>i});let r={localFirstConnection:!1},i={retry:{interval:2e3,maxAttempts:15,savedKeyMaxAttempts:15,reconnectMaxAttempts:15,updateReconnectMaxAttempts:45},reconnect:{fastFailThreshold:3},update:{installingAt:4,restartingAt:15,timeoutSec:90}}},86129:(e,t,n)=>{"use strict";n.d(t,{AC:()=>d,An:()=>c,BF:()=>h,El:()=>k,HE:()=>R,HJ:()=>p,J2:()=>_,Jd:()=>A,KF:()=>l,ML:()=>b,N0:()=>S,Of:()=>x,QS:()=>u,QZ:()=>a,Rh:()=>C,Tr:()=>g,UT:()=>m,ZN:()=>o,aS:()=>v,bg:()=>y,cx:()=>s,dT:()=>i,gI:()=>f,j3:()=>P,l_:()=>r,o_:()=>T,qM:()=>w});let r={control:"control",binary:"binary",file:"file"},i=65536,a={ackTimeoutMs:5e3,maxAttempts:3,backoffMs:[500,1500,3e3],probeBackoffMs:[3e4,6e4,12e4,3e5],classifyAfterProbes:3},s={urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"],timeoutMs:2500,minIntervalMs:15e3},o=500,l=1e4,c=25e3,d=4e3,p=15e3,u=1e3,h=12e3,m=2e3,g=1e4,f={enabled:!0,pingMs:25e3},y={pending:"pending-approval",rejected:"device-rejected"},b={mismatch:"mismatch",sealUnreadable:"seal-unreadable",timeout:"proof-timeout"},_={pending:"pending",approved:"approved",rejected:"rejected",reconnect:"reconnect"},w=8,k="9remote_pending_save",v="9remote_wants_save",S="9remote:keys-changed",A="9remote_login_error",T={debounceMs:500},C=3e4,R={chunkSize:65528,windowSize:64,dcBufferThreshold:8388608,maxUploadSize:0x3200000,maxDownloadSize:0xc800000,maxStreamMediaSize:524288e3},x={idle:"idle",connecting:"connecting",open:"open",degraded:"degraded",closed:"closed"},P={clientApp:{enabled:["ws","rtc"],parallel:!0,channels:{control:{strategy:"priority",prefer:"rtc"},binary:{strategy:"priority",prefer:"rtc"},file:{strategy:"priority",prefer:"rtc"}},rtc:{enableTurn:!0,dcControl:{ordered:!0}}},remoteDesktop:{enabled:["ws","rtc"],parallel:!0,channels:{control:{strategy:"priority",prefer:"rtc"},binary:{strategy:"priority",prefer:"rtc"},file:{strategy:"priority",prefer:"rtc"}},rtc:{enableTurn:!0,dcControl:{ordered:!0}}}}},86251:(e,t,n)=>{"use strict";n.d(t,{O:()=>p,Y:()=>c});let r=new Uint8Array([48,42,48,5,6,3,43,101,110,3,33,0]);function i(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function a(e){let t="",n=new Uint8Array(e);for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function s(...e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}async function o(e){let t;try{t=i(String(e))}catch{return null}if(32!==t.length)return null;try{return await crypto.subtle.importKey("spki",s(r,t),{name:"X25519"},!0,[])}catch{return null}}async function l(e,t,n,r){let i=await crypto.subtle.deriveBits({name:"X25519",public:t},e,256),a=await crypto.subtle.importKey("raw",i,"HKDF",!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:s(n,r),info:new TextEncoder().encode("9remote-tail-seal-v1")},a,{name:"AES-GCM",length:256},!1,["encrypt"])}async function c(e,t){if("string"!=typeof e||!e||"string"!=typeof t||!t)return null;let n=await o(t);if(!n)return null;try{let t=await crypto.subtle.generateKey({name:"X25519"},!0,["deriveBits"]),r=new Uint8Array(await crypto.subtle.exportKey("spki",t.publicKey)).slice(-32),i=new Uint8Array(await crypto.subtle.exportKey("spki",n)).slice(-32),s=await l(t.privateKey,n,r,i),o=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},s,new TextEncoder().encode(e));return{epk:a(r),iv:a(o),ct:a(c)}}catch{return null}}let d="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";async function p(e,t){if("u"<typeof crypto||!crypto.subtle)return null;let n=[e,t].map(e=>{let t;try{t=i(String(e||""))}catch{t=new Uint8Array(0)}let n=new Uint8Array(2);return new DataView(n.buffer).setUint16(0,t.length),s(n,t)}),r=new Uint8Array(await crypto.subtle.digest("SHA-256",s(...n)));return d[r[0]%32]+d[r[1]%32]}},90076:(e,t,n)=>{"use strict";n.d(t,{Go:()=>s,O:()=>r,Sn:()=>o,_8:()=>i,cC:()=>p,dM:()=>c,jP:()=>l,lE:()=>a,qn:()=>d});let r="https://9remote.cc",i=2208,a=`http://127.0.0.1:${i}`,s=`${a}/api/ui/state`,o={connect:`${r}/api/connect`,tempKeyCreate:`${r}/api/temp-key/create`,tempKeyVerify:`${r}/api/temp-key/verify`,tempKeyRemove:`${r}/api/temp-key/remove`,localSites:"/api/local-sites",turnCredentials:`${r}/api/webrtc/turn-credentials`},l=5,c=2e3,d=5e3,p=1e4},90084:(e,t,n)=>{"use strict";n.d(t,{$4:()=>d,D5:()=>_,HY:()=>h,I8:()=>f,IU:()=>w,LG:()=>p,cH:()=>y,e1:()=>m,lu:()=>k,lz:()=>c,pV:()=>v,t8:()=>u});var r=n(86129);n(52159);var i=n(86251);let a="9remote_device_trust",s="9remote_pending_fp2";function o(){try{return JSON.parse(localStorage.getItem(a)||"{}")}catch{return{}}}function l(e){localStorage.setItem(a,JSON.stringify(e))}function c(e){return o()[e]||null}function d(e){if(!e)return e;let t=c(e)?.tail;return t?`${e}-${t}`:e}function p(e,t){let n=o();n[e]={...n[e]||{},...t},l(n)}async function u(e,t){return e&&t?await (0,i.O)(e,t):null}function h(){let e=sessionStorage.getItem(s);return sessionStorage.removeItem(s),e?JSON.parse(e).fp2??null:null}function m(){try{let e=sessionStorage.getItem(s);if(!e)return null;let{fp2:t,exp:n}=JSON.parse(e);if(!t||Date.now()>n)return sessionStorage.removeItem(s),null;return t}catch{return null}}let g="9remote_api_keys";function f(){try{let e=sessionStorage.getItem(r.El);if(!e)return;sessionStorage.removeItem(r.El);let t=JSON.parse(localStorage.getItem(g)||"[]");if(t.some(t=>{try{return atob(t.key)===e}catch{return!1}}))return;t.push({id:String(Date.now()),key:btoa(e),label:`Key ${t.length+1}`,createdAt:new Date().toISOString(),lastLoginDate:new Date().toISOString()}),localStorage.setItem(g,JSON.stringify(t));try{window.dispatchEvent(new Event(r.N0))}catch{}}catch{}}function y(e){if(e)try{let t=o();delete t[e],l(t)}catch{}}function b(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}async function _(e,t,n){try{let r=await crypto.subtle.importKey("raw",b(e),{name:"Ed25519"},!1,["verify"]);return await crypto.subtle.verify("Ed25519",r,b(n),new TextEncoder().encode(t))}catch{return null}}let w=["device:keyIssued","device:tailRejected"];function k(e,t,n){let i=e._auth?.apiKey;if(!i)return!1;if("device:keyIssued"===t){e._auth.tempKey=null,e._auth.socketOptions?.auth&&(e._auth.socketOptions.auth.tempKey=null);let t=n?.tail;return!t||(p(i,{tail:t}),e._tailProofSent=e._adapters.get("rtc")?._peerEpoch??0,sessionStorage.getItem(r.aS)&&(sessionStorage.removeItem(r.aS),sessionStorage.setItem(r.El,`${i}-${t}`),f()),!0)}return"device:tailRejected"===t&&(n?.reason===r.ML.sealUnreadable&&p(i,{hostSealKey:null}),!0)}async function v(e){let t=e._auth?.apiKey;if(!t)return;let i=e._adapters.get("rtc");if(!i?.ready)return;let a=i._peerEpoch??0;if(e._tailProofSent===a)return;let{freshAuth:s}=await Promise.resolve().then(n.bind(n,63977)),o=await s({apiKey:t,tempKey:e._auth?.tempKey||null},"rtc");(o.keyTail||o.keyTailSealed)&&i.send(r.l_.control,{event:"device:tailProof",args:[{keyTail:o.keyTail,keyTailSealed:o.keyTailSealed,tempKey:e._auth?.tempKey||null}]})&&(e._tailProofSent=a)}},97711:(e,t,n)=>{"use strict";n.d(t,{F:()=>o,v:()=>s});var r=n(1521);let i="9remote_auth";function a(e){"u">typeof document&&(document.cookie=`${i}=${e}; path=/; max-age=86400; SameSite=Lax`)}function s({apiKey:e,tunnelUrl:t,mode:n="remote",tempKey:r=null,localIp:i=null}){try{sessionStorage.setItem("apiKey",e),sessionStorage.setItem("tunnelUrl",t),sessionStorage.setItem("mode",n||"remote"),r?sessionStorage.setItem("tempKey",r):sessionStorage.removeItem("tempKey"),i?sessionStorage.setItem("localIp",i):sessionStorage.removeItem("localIp")}catch{}a(e)}function o(){let e=(0,r.useCallback)(()=>{let e,t,n,r,i;try{e=sessionStorage.getItem("apiKey"),t=sessionStorage.getItem("tunnelUrl"),n=sessionStorage.getItem("mode"),r=sessionStorage.getItem("tempKey"),i=sessionStorage.getItem("localIp")}catch{return null}return e?(a(e),{apiKey:e,tunnelUrl:t,mode:n,tempKey:r,localIp:i}):null},[]);return{getAuth:e,setAuth:(0,r.useCallback)(e=>s(e),[]),clearAuth:(0,r.useCallback)(()=>{try{sessionStorage.clear()}catch{}"u">typeof document&&(document.cookie=`${i}=; path=/; max-age=0`)},[])}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8669],{2074:(t,e,s)=>{s.d(e,{v:()=>o});var r=s(1521);let i=t=>{let e,s=new Set,r=(t,r)=>{let i="function"==typeof t?t(e):t;if(!Object.is(i,e)){let t=e;e=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},e,i),s.forEach(s=>s(e,t))}},i=()=>e,n={setState:r,getState:i,getInitialState:()=>o,subscribe:t=>(s.add(t),()=>s.delete(t))},o=e=t(r,i,n);return n},n=t=>{let e=t?i(t):i,s=t=>(function(t,e=t=>t){let s=r.useSyncExternalStore(t.subscribe,r.useCallback(()=>e(t.getState()),[t,e]),r.useCallback(()=>e(t.getInitialState()),[t,e]));return r.useDebugValue(s),s})(e,t);return Object.assign(s,e),s},o=t=>t?n(t):n},11472:(t,e,s)=>{function r(t,e){let s;try{s=t()}catch(t){return}return{getItem:t=>{var r;let i=t=>null===t?null:JSON.parse(t,null==e?void 0:e.reviver),n=null!=(r=s.getItem(t))?r:null;return n instanceof Promise?n.then(i):i(n)},setItem:(t,r)=>s.setItem(t,JSON.stringify(r,null==e?void 0:e.replacer)),removeItem:t=>s.removeItem(t)}}s.d(e,{KU:()=>r,Zr:()=>n});let i=t=>e=>{try{let s=t(e);if(s instanceof Promise)return s;return{then:t=>i(t)(s),catch(t){return this}}}catch(t){return{then(t){return this},catch:e=>i(e)(t)}}},n=(t,e)=>(s,n,o)=>{let a,h={storage:r(()=>window.localStorage),partialize:t=>t,version:0,merge:(t,e)=>({...e,...t}),...e},c=!1,l=0,u=new Set,p=new Set,d=h.storage;if(!d)return t((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${h.name}', the given storage is currently unavailable.`),s(...t)},n,o);let f=()=>{let t=h.partialize({...n()});return d.setItem(h.name,{state:t,version:h.version})},y=o.setState;o.setState=(t,e)=>(y(t,e),f());let g=t((...t)=>(s(...t),f()),n,o);o.getInitialState=()=>g;let m=()=>{var t,e;if(!d)return;let r=++l;c=!1,u.forEach(t=>{var e;return t(null!=(e=n())?e:g)});let o=(null==(e=h.onRehydrateStorage)?void 0:e.call(h,null!=(t=n())?t:g))||void 0;return i(d.getItem.bind(d))(h.name).then(t=>{if(t)if("number"!=typeof t.version||t.version===h.version)return[!1,t.state];else{if(h.migrate){let e=h.migrate(t.state,t.version);return e instanceof Promise?e.then(t=>[!0,t]):[!0,e]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(t=>{var e;if(r!==l)return;let[i,o]=t;if(s(a=h.merge(o,null!=(e=n())?e:g),!0),i)return f()}).then(()=>{r===l&&(null==o||o(n(),void 0),a=n(),c=!0,p.forEach(t=>t(a)))}).catch(t=>{r===l&&(null==o||o(void 0,t))})};return o.persist={setOptions:t=>{h={...h,...t},t.storage&&(d=t.storage)},clearStorage:()=>{++l,null==d||d.removeItem(h.name)},getOptions:()=>h,rehydrate:()=>m(),hasHydrated:()=>c,onHydrate:t=>(u.add(t),()=>{u.delete(t)}),onFinishHydration:t=>(p.add(t),()=>{p.delete(t)})},h.skipHydration||m(),a||g}},29717:(t,e,s)=>{var r=s(21505);s.o(r,"usePathname")&&s.d(e,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(e,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(e,{useSearchParams:function(){return r.useSearchParams}})},48193:(t,e,s)=>{let r,i,n;s.d(e,{io:()=>tA});var o,a,h={};s.r(h),s.d(h,{Decoder:()=>tf,Encoder:()=>td,PacketType:()=>a,isPacketValid:()=>t_,protocol:()=>tp});let c=Object.create(null);c.open="0",c.close="1",c.ping="2",c.pong="3",c.message="4",c.upgrade="5",c.noop="6";let l=Object.create(null);Object.keys(c).forEach(t=>{l[c[t]]=t});let u={type:"error",data:"parser error"},p="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),d="function"==typeof ArrayBuffer,f=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,y=({type:t,data:e},s,r)=>{if(p&&e instanceof Blob)if(s)return r(e);else return g(e,r);if(d&&(e instanceof ArrayBuffer||f(e)))if(s)return r(e);else return g(new Blob([e]),r);return r(c[t]+(e||""))},g=(t,e)=>{let s=new FileReader;return s.onload=function(){e("b"+(s.result.split(",")[1]||""))},s.readAsDataURL(t)};function m(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<_.length;t++)b[_.charCodeAt(t)]=t;let v="function"==typeof ArrayBuffer,w=(t,e)=>{if("string"!=typeof t)return{type:"message",data:E(t,e)};let s=t.charAt(0);return"b"===s?{type:"message",data:k(t.substring(1),e)}:l[s]?t.length>1?{type:l[s],data:t.substring(1)}:{type:l[s]}:u},k=(t,e)=>v?E((t=>{let e=.75*t.length,s=t.length,r,i=0,n,o,a,h;"="===t[t.length-1]&&(e--,"="===t[t.length-2]&&e--);let c=new ArrayBuffer(e),l=new Uint8Array(c);for(r=0;r<s;r+=4)n=b[t.charCodeAt(r)],o=b[t.charCodeAt(r+1)],a=b[t.charCodeAt(r+2)],h=b[t.charCodeAt(r+3)],l[i++]=n<<2|o>>4,l[i++]=(15&o)<<4|a>>2,l[i++]=(3&a)<<6|63&h;return c})(t),e):{base64:!0,data:t},E=(t,e)=>"blob"===e?t instanceof Blob?t:new Blob([t]):t instanceof ArrayBuffer?t:t.buffer;function O(t){return t.reduce((t,e)=>t+e.length,0)}function A(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),r=0;for(let i=0;i<e;i++)s[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),s}function T(t){if(t){var e=t;for(var s in T.prototype)e[s]=T.prototype[s];return e}}T.prototype.on=T.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},T.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this},T.prototype.off=T.prototype.removeListener=T.prototype.removeAllListeners=T.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<r.length;i++)if((s=r[i])===e||s.fn===e){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},T.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=Array(arguments.length-1),s=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,i=s.length;r<i;++r)s[r].apply(this,e)}return this},T.prototype.emitReserved=T.prototype.emit,T.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},T.prototype.hasListeners=function(t){return!!this.listeners(t).length};let R="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),C="u">typeof self?self:"u">typeof window?window:Function("return this")();function S(t,...e){return e.reduce((e,s)=>(t.hasOwnProperty(s)&&(e[s]=t[s]),e),{})}let N=C.setTimeout,B=C.clearTimeout;function x(t,e){e.useNativeTimers?(t.setTimeoutFn=N.bind(C),t.clearTimeoutFn=B.bind(C)):(t.setTimeoutFn=C.setTimeout.bind(C),t.clearTimeoutFn=C.clearTimeout.bind(C))}function L(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class P extends Error{constructor(t,e,s){super(t),this.description=e,this.context=s,this.type="TransportError"}}class q extends T{constructor(t){super(),this.writable=!1,x(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,s){return super.emitReserved("error",new P(t,e,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=w(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return -1===t.indexOf(":")?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(t){let e=function(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}(t);return e.length?"?"+e:""}}class I extends q{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||e()})),this.writable||(t++,this.once("drain",function(){--t||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};((t,e)=>{let s=t.split("\x1e"),r=[];for(let t=0;t<s.length;t++){let i=w(s[t],e);if(r.push(i),"error"===i.type)break}return r})(t,this.socket.binaryType).forEach(e),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){var e;let s,r,i;this.writable=!1,e=t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(s=t.length),i=0,t.forEach((t,n)=>{y(t,!1,t=>{r[n]=t,++i===s&&e(r.join("\x1e"))})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=L()),this.supportsBinary||e.sid||(e.b64=1),this.createUri(t,e)}}let j=!1;try{j="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}let D=j;function U(){}class F extends I{constructor(t){if(super(t),"u">typeof location){const e="https:"===location.protocol;let s=location.port;s||(s=e?"443":"80"),this.xd="u">typeof location&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,e){let s=this.request({method:"POST",data:t});s.on("success",e),s.on("error",(t,e)=>{this.onError("xhr post error",t,e)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(t,e)=>{this.onError("xhr poll error",t,e)}),this.pollXhr=t}}class V extends T{constructor(t,e,s){super(),this.createRequest=t,x(this,s),this._opts=s,this._method=s.method||"GET",this._uri=e,this._data=void 0!==s.data?s.data:null,this._create()}_create(){var t;let e=S(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(e);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let t in s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(t)&&s.setRequestHeader(t,this._opts.extraHeaders[t])}catch(t){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{s.setRequestHeader("Accept","*/*")}catch(t){}null==(t=this._opts.cookieJar)||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var t;3===s.readyState&&(null==(t=this._opts.cookieJar)||t.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(t){this.setTimeoutFn(()=>{this._onError(t)},0);return}"u">typeof document&&(this._index=V.requestsCount++,V.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=U,t)try{this._xhr.abort()}catch(t){}"u">typeof document&&delete V.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function M(){for(let t in V.requests)V.requests.hasOwnProperty(t)&&V.requests[t].abort()}V.requestsCount=0,V.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",M):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",M,!1));let H=(n=z({xdomain:!1}))&&null!==n.responseType;class K extends F{constructor(t){super(t);const e=t&&t.forceBase64;this.supportsBinary=H&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new V(z,this.uri(),t)}}function z(t){let e=t.xdomain;try{if("u">typeof XMLHttpRequest&&(!e||D))return new XMLHttpRequest}catch(t){}if(!e)try{return new C[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}let J="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class W extends q{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,s=J?{}:S(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,s)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;y(s,this.supportsBinary,t=>{try{this.doWrite(s,t)}catch(t){}r&&R(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=L()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}}let Y=C.WebSocket||C.MozWebSocket;class $ extends W{createSocket(t,e,s){return J?new Y(t,e,s):e?new Y(t,e):new Y(t)}doWrite(t,e){this.ws.send(e)}}class Q extends q{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{var e,s;let n,o,a,h,c=(e=Number.MAX_SAFE_INTEGER,s=this.socket.binaryType,i||(i=new TextDecoder),n=[],o=0,a=-1,h=!1,new TransformStream({transform(t,r){for(n.push(t);;){if(0===o){if(1>O(n))break;let t=A(n,1);h=(128&t[0])==128,o=(a=127&t[0])<126?3:126===a?1:2}else if(1===o){if(2>O(n))break;let t=A(n,2);a=new DataView(t.buffer,t.byteOffset,t.length).getUint16(0),o=3}else if(2===o){if(8>O(n))break;let t=A(n,8),e=new DataView(t.buffer,t.byteOffset,t.length),s=e.getUint32(0);if(s>2097151){r.enqueue(u);break}a=0x100000000*s+e.getUint32(4),o=3}else{if(O(n)<a)break;let t=A(n,a);r.enqueue(w(h?t:i.decode(t),s)),o=0}if(0===a||a>e){r.enqueue(u);break}}}})),l=t.readable.pipeThrough(c).getReader(),g=new TransformStream({transform(t,e){var s;s=s=>{let r,i=s.length;if(i<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,i);else if(i<65536){let t=new DataView((r=new Uint8Array(3)).buffer);t.setUint8(0,126),t.setUint16(1,i)}else{let t=new DataView((r=new Uint8Array(9)).buffer);t.setUint8(0,127),t.setBigUint64(1,BigInt(i))}t.data&&"string"!=typeof t.data&&(r[0]|=128),e.enqueue(r),e.enqueue(s)},p&&t.data instanceof Blob?t.data.arrayBuffer().then(m).then(s):d&&(t.data instanceof ArrayBuffer||f(t.data))?s(m(t.data)):y(t,!1,t=>{r||(r=new TextEncoder),s(r.encode(t))})}});g.readable.pipeTo(t.writable),this._writer=g.writable.getWriter();let _=()=>{l.read().then(({done:t,value:e})=>{t||(this.onPacket(e),_())}).catch(t=>{})};_();let b={type:"open"};this.query.sid&&(b.data=`{"sid":"${this.query.sid}"}`),this._writer.write(b).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let s=t[e],r=e===t.length-1;this._writer.write(s).then(()=>{r&&R(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;null==(t=this._transport)||t.close()}}let X={websocket:$,webtransport:Q,polling:K},G=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Z=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(t){var e,s;let r,i;if(t.length>8e3)throw"URI too long";let n=t,o=t.indexOf("["),a=t.indexOf("]");-1!=o&&-1!=a&&(t=t.substring(0,o)+t.substring(o,a).replace(/:/g,";")+t.substring(a,t.length));let h=G.exec(t||""),c={},l=14;for(;l--;)c[Z[l]]=h[l]||"";return -1!=o&&-1!=a&&(c.source=n,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),r=(e=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==e.slice(0,1)||0===e.length)&&r.splice(0,1),"/"==e.slice(-1)&&r.splice(r.length-1,1),c.pathNames=r,s=c.query,i={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,s){e&&(i[e]=s)}),c.queryKey=i,c}let te="function"==typeof addEventListener&&"function"==typeof removeEventListener,ts=[];te&&addEventListener("offline",()=>{ts.forEach(t=>t())},!1);class tr extends T{constructor(t,e){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&"object"==typeof t&&(e=t,t=null),t){const s=tt(t);e.hostname=s.host,e.secure="https"===s.protocol||"wss"===s.protocol,e.port=s.port,s.query&&(e.query=s.query)}else e.host&&(e.hostname=tt(e.host).host);x(this,e),this.secure=null!=e.secure?e.secure:"u">typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("u">typeof location?location.hostname:"localhost"),this.port=e.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(t=>{let e=t.prototype.name;this.transports.push(e),this._transportsByName[e]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},s=t.split("&");for(let t=0,r=s.length;t<r;t++){let r=s[t].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}(this.opts.query)),te&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ts.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);let s=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let t=this.opts.rememberUpgrade&&tr.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(t);e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",tr.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=Error("server error");e.code=t.data,this._onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let e=0;e<this.writeBuffer.length;e++){let s=this.writeBuffer[e].data;if(s&&(t+="string"==typeof s?function(t){let e=0,s=0;for(let r=0,i=t.length;r<i;r++)(e=t.charCodeAt(r))<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(r++,s+=4);return s}(s):Math.ceil(1.33*(s.byteLength||s.size))),e>0&&t>this._maxPayload)return this.writeBuffer.slice(0,e);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,R(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,e,s){return this._sendPacket("message",t,e,s),this}send(t,e,s){return this._sendPacket("message",t,e,s),this}_sendPacket(t,e,s,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;let i={type:t,data:e,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},s=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(tr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),te&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let t=ts.indexOf(this._offlineEventListener);-1!==t&&ts.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this._prevBufferLen=0}}}tr.protocol=4;class ti extends tr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),s=!1;tr.priorWebsocketSuccess=!1;let r=()=>{s||(e.send([{type:"ping",data:"probe"}]),e.once("packet",t=>{if(!s)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;tr.priorWebsocketSuccess="websocket"===e.name,this.transport.pause(()=>{s||"closed"!==this.readyState&&(c(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let t=Error("probe error");t.transport=e.name,this.emitReserved("upgradeError",t)}}))};function i(){s||(s=!0,c(),e.close(),e=null)}let n=t=>{let s=Error("probe error: "+t);s.transport=e.name,i(),this.emitReserved("upgradeError",s)};function o(){n("transport closed")}function a(){n("socket closed")}function h(t){e&&t.name!==e.name&&i()}let c=()=>{e.removeListener("open",r),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",h)};e.once("open",r),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",h),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{s||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&e.push(t[s]);return e}}class tn extends ti{constructor(t,e={}){const s="object"==typeof t,r=s?{...t}:{...e};(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(t=>X[t]).filter(t=>!!t)),super(s?r:t,r)}}tn.protocol;let to="function"==typeof ArrayBuffer,ta=Object.prototype.toString,th="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===ta.call(Blob),tc="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===ta.call(File);function tl(t){return to&&(t instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer))||th&&t instanceof Blob||tc&&t instanceof File}let tu=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],tp=5;(o=a||(a={}))[o.CONNECT=0]="CONNECT",o[o.DISCONNECT=1]="DISCONNECT",o[o.EVENT=2]="EVENT",o[o.ACK=3]="ACK",o[o.CONNECT_ERROR=4]="CONNECT_ERROR",o[o.BINARY_EVENT=5]="BINARY_EVENT",o[o.BINARY_ACK=6]="BINARY_ACK";class td{constructor(t){this.replacer=t}encode(t){return(t.type===a.EVENT||t.type===a.ACK)&&function t(e,s){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let s=0,r=e.length;s<r;s++)if(t(e[s]))return!0;return!1}if(tl(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1==arguments.length)return t(e.toJSON(),!0);for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return!0;return!1}(t)?this.encodeAsBinary({type:t.type===a.EVENT?a.BINARY_EVENT:a.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===a.BINARY_EVENT||t.type===a.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e,s,r=(e=[],s=t.data,t.data=function t(e,s,r){if(!e)return e;if(tl(e)){let t={_placeholder:!0,num:s.length};return s.push(e),t}if(Array.isArray(e)){let r=Array(e.length);for(let i=0;i<e.length;i++)r[i]=t(e[i],s);return r}if("object"==typeof e&&!(e instanceof Date)){if(e.toJSON&&"function"==typeof e.toJSON&&!r)return t(e.toJSON(),s,!0);let i={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t(e[r],s));return i}return e}(s,e),t.attachments=e.length,{packet:t,buffers:e}),i=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(i),n}}class tf extends T{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof t?{reviver:t}:t)}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let s=(e=this.decodeString(t)).type===a.BINARY_EVENT;s||e.type===a.BINARY_ACK?(e.type=s?a.EVENT:a.ACK,this.reconstructor=new ty(e)):super.emitReserved("decoded",e)}else if(tl(t)||t.base64)if(this.reconstructor)(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+t)}decodeString(t){let e=0,s={type:Number(t.charAt(0))};if(void 0===a[s.type])throw Error("unknown packet type "+s.type);if(s.type===a.BINARY_EVENT||s.type===a.BINARY_ACK){let r=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);let i=t.substring(r,e);if(i!=Number(i)||"-"!==t.charAt(e))throw Error("Illegal attachments");let n=Number(i);if(!tg(n)||n<1)throw Error("Illegal attachments");if(n>this.opts.maxAttachments)throw Error("too many attachments");s.attachments=n}if("/"===t.charAt(e+1)){let r=e+1;for(;++e&&","!==t.charAt(e)&&e!==t.length;);s.nsp=t.substring(r,e)}else s.nsp="/";let r=t.charAt(e+1);if(""!==r&&Number(r)==r){let r=e+1;for(;++e;){let s=t.charAt(e);if(null==s||Number(s)!=s){--e;break}if(e===t.length)break}s.id=Number(t.substring(r,e+1))}if(t.charAt(++e)){let r=this.tryParse(t.substr(e));if(tf.isPayloadValid(s.type,r))s.data=r;else throw Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case a.CONNECT:return tm(e);case a.DISCONNECT:return void 0===e;case a.CONNECT_ERROR:return"string"==typeof e||tm(e);case a.EVENT:case a.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tu.indexOf(e[0]));case a.ACK:case a.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ty{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e,s;let t=(e=this.reconPack,s=this.buffers,e.data=function t(e,s){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<s.length)return s[e.num];throw Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=t(e[r],s);else if("object"==typeof e)for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=t(e[r],s));return e}(e.data,s),delete e.attachments,e);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let tg=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t};function tm(t){return"[object Object]"===Object.prototype.toString.call(t)}function t_(t){var e;return"string"==typeof t.nsp&&(void 0===(e=t.id)||tg(e))&&function(t,e){switch(t){case a.CONNECT:return void 0===e||tm(e);case a.DISCONNECT:return void 0===e;case a.EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===tu.indexOf(e[0]));case a.ACK:return Array.isArray(e);case a.CONNECT_ERROR:return"string"==typeof e||tm(e);default:return!1}}(t.type,t.data)}function tb(t,e,s){return t.on(e,s),function(){t.off(e,s)}}let tv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tw extends T{constructor(t,e,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[tb(t,"open",this.onopen.bind(this)),tb(t,"packet",this.onpacket.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var s,r,i;if(tv.hasOwnProperty(t))throw Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let n={type:a.EVENT,data:e};if(n.options={},n.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){let t=this.ids++,s=e.pop();this._registerAckCallback(t,s),n.id=t}let o=null==(r=null==(s=this.io.engine)?void 0:s.transport)?void 0:r.writable,h=this.connected&&!(null==(i=this.io.engine)?void 0:i._hasPingExpired());return this.flags.volatile&&!o||(h?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(t,e){var s;let r=null!=(s=this.flags.timeout)?s:this._opts.ackTimeout;if(void 0===r){this.acks[t]=e;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,Error("operation has timed out"))},r),n=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,t)};n.withError=!0,this.acks[t]=n}emitWithAck(t,...e){return new Promise((s,r)=>{let i=(t,e)=>t?r(t):s(e);i.withError=!0,e.push(i),this.emit(t,...e)})}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((t,...r)=>(this._queue[0],null!==t?s.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;let e=this._queue[0];(!e.pending||t)&&(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:a.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case a.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case a.EVENT:case a.BINARY_EVENT:this.onevent(t);break;case a.ACK:case a.BINARY_ACK:this.onack(t);break;case a.DISCONNECT:this.ondisconnect();break;case a.CONNECT_ERROR:this.destroy();let e=Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){let e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length)for(let e of this._anyListeners.slice())e.apply(this,t);super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,s=!1;return function(...r){s||(s=!0,e.packet({type:a.ACK,id:t,data:r}))}}onack(t){let e=this.acks[t.id];"function"==typeof e&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:a.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let s=0;s<e.length;s++)if(t===e[s]){e.splice(s,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let e of this._anyOutgoingListeners.slice())e.apply(this,t.data)}}function tk(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}tk.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(1&Math.floor(10*e))==0?t-s:t+s}return 0|Math.min(t,this.max)},tk.prototype.reset=function(){this.attempts=0},tk.prototype.setMin=function(t){this.ms=t},tk.prototype.setMax=function(t){this.max=t},tk.prototype.setJitter=function(t){this.jitter=t};class tE extends T{constructor(t,e){var s;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,x(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(s=e.randomizationFactor)?s:.5),this.backoff=new tk({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const r=e.parser||h;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null==(e=this.backoff)||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null==(e=this.backoff)||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null==(e=this.backoff)||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new tn(this.uri,this.opts);let e=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let r=tb(e,"open",function(){s.onopen(),t&&t()}),i=e=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",e),t?t(e):this.maybeReconnectOnOpen()},n=tb(e,"error",i);if(!1!==this._timeout){let t=this._timeout,s=this.setTimeoutFn(()=>{r(),i(Error("timeout")),e.close()},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(r),this.subs.push(n),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(tb(t,"ping",this.onping.bind(this)),tb(t,"data",this.ondata.bind(this)),tb(t,"error",this.onerror.bind(this)),tb(t,"close",this.onclose.bind(this)),tb(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){R(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new tw(this,t,e),this.nsps[t]=s),s}_destroy(t){for(let t of Object.keys(this.nsps))if(this.nsps[t].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let s=0;s<e.length;s++)this.engine.write(e[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var s;this.cleanup(),null==(s=this.engine)||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()}))},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}let tO={};function tA(t,e){let s;"object"==typeof t&&(e=t,t=void 0);let r=function(t,e="",s){let r=t;s=s||"u">typeof location&&location,null==t&&(t=s.protocol+"//"+s.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?s.protocol+t:s.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==s?s.protocol+"//"+t:"https://"+t),r=tt(t)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(s&&s.port===r.port?"":":"+r.port),r}(t,(e=e||{}).path||"/socket.io"),i=r.source,n=r.id,o=r.path,a=tO[n]&&o in tO[n].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?s=new tE(i,e):(tO[n]||(tO[n]=new tE(i,e)),s=tO[n]),r.query&&!e.query&&(e.query=r.queryKey),s.socket(r.path,e)}Object.assign(tA,{Manager:tE,Socket:tw,io:tA,connect:tA})}}]);
|