9remote 3.0.13 → 3.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +101 -98
- package/dist/server.cjs +200 -200
- package/dist/ui/assets/index-DcykK_na.js +8 -0
- package/dist/ui/assets/index-SHlsPzjb.css +1 -0
- package/dist/ui/index.html +2 -2
- 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/2881-71aed16f0b88cb34.js +1 -0
- package/dist/web/_next/static/chunks/{4958-179397687a9efabd.js → 4136-d7c1ff2da0833b42.js} +13 -13
- package/dist/web/_next/static/chunks/5788-2151395b4db264e7.js +1 -0
- package/dist/web/_next/static/chunks/6669-178477b6a852b251.js +1 -0
- package/dist/web/_next/static/chunks/9958-8030d12d1aa9659a.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/admins/page-306d339ee530b5f6.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/login/{page-385a65c442c5f9eb.js → page-691eef7459d86ee3.js} +1 -1
- package/dist/web/_next/static/chunks/app/admin/modes/page-6e1277223ac77414.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/ota/page-3a2b0ecbedd59e35.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/page-1fca731dbc8d61d3.js +1 -0
- package/dist/web/_next/static/chunks/app/admin/turn/page-7df8fb088cf7ccda.js +1 -0
- package/dist/web/_next/static/chunks/app/dev/question/page-92c77506bb59e639.js +1 -0
- package/dist/web/_next/static/chunks/app/login/page-2a2743b7f8cb2435.js +1 -0
- package/dist/web/_next/static/chunks/app/page-590ad581a1270380.js +22 -0
- package/dist/web/_next/static/chunks/app/workspace/layout-d6c53117c6436790.js +14 -0
- package/dist/web/_next/static/css/99ebcb780b6d29f4.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-NAPslvk3.css +0 -1
- package/dist/ui/assets/index-WDGxckRM.js +0 -8
- package/dist/web/_next/static/chunks/4023-66934a18c86e64c8.js +0 -1
- package/dist/web/_next/static/chunks/8334-eeba96b49fa7e52d.js +0 -1
- package/dist/web/_next/static/chunks/8387-9ffbf41a5664cf04.js +0 -1
- package/dist/web/_next/static/chunks/9958-35139b04963145ff.js +0 -1
- package/dist/web/_next/static/chunks/app/admin/admins/page-cbe0a81654621c59.js +0 -1
- package/dist/web/_next/static/chunks/app/admin/modes/page-3c1c39a594e21bf9.js +0 -1
- package/dist/web/_next/static/chunks/app/admin/ota/page-71f6fb68d1dc9334.js +0 -1
- package/dist/web/_next/static/chunks/app/admin/page-680a917a0c0b046c.js +0 -1
- package/dist/web/_next/static/chunks/app/admin/turn/page-271235635424b233.js +0 -1
- package/dist/web/_next/static/chunks/app/dev/question/page-8dc068c655f29856.js +0 -1
- package/dist/web/_next/static/chunks/app/login/page-798b68f514800b19.js +0 -1
- package/dist/web/_next/static/chunks/app/page-81affa2ae3534100.js +0 -22
- package/dist/web/_next/static/chunks/app/workspace/layout-123d4cfb7b9f0946.js +0 -14
- package/dist/web/_next/static/css/7bac24727badd523.css +0 -1
- /package/dist/web/_next/static/{eD-pRSm_Yh2oF-5ufptf0 → xSpq32VEKUqU6vBkX2q0J}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{eD-pRSm_Yh2oF-5ufptf0 → xSpq32VEKUqU6vBkX2q0J}/_ssgManifest.js +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const __importMetaUrl = require('url').pathToFileURL(__filename).href;
|
|
3
|
-
var
|
|
4
|
-
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return P.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return P.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return P.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(P){var g=c((0,d.execSync)(A[T]).toString());return P?g:a(g)}function u(P){return new p.default(function(g,b){return(0,d.exec)(A[T],{},function(S,I,_){if(S)return b(new Error("Error while obtaining machine id: "+S.stack));var U=c(I.toString());return g(P?U:a(U))})})}Object.defineProperty(o,"__esModule",{value:!0});var f=n(35),p=i(f);o.machineIdSync=l,o.machineId=u;var d=n(70),h=n(71),w=process,T=w.platform,O={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},A={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:O[s()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(r,o,n){r.exports={default:n(36),__esModule:!0}},function(r,o,n){n(66),n(68),n(69),n(67),r.exports=n(6).Promise},function(r,o){r.exports=function(){}},function(r,o){r.exports=function(n,i,s,a){if(!(n instanceof i)||a!==void 0&&a in n)throw TypeError(s+": incorrect invocation!");return n}},function(r,o,n){var i=n(13),s=n(31),a=n(62);r.exports=function(c){return function(l,u,f){var p,d=i(l),h=s(d.length),w=a(f,h);if(c&&u!=u){for(;h>w;)if(p=d[w++],p!=p)return!0}else for(;h>w;w++)if((c||w in d)&&d[w]===u)return c||w||0;return!c&&-1}}},function(r,d,n){var i=n(7),s=n(44),a=n(43),c=n(3),l=n(31),u=n(64),f={},p={},d=r.exports=function(h,w,T,O,A){var P,g,b,S,I=A?function(){return h}:u(h),_=i(T,O,w?2:1),U=0;if(typeof I!="function")throw TypeError(h+" is not iterable!");if(a(I)){for(P=l(h.length);P>U;U++)if(S=w?_(c(g=h[U])[0],g[1]):_(h[U]),S===f||S===p)return S}else for(b=I.call(h);!(g=b.next()).done;)if(S=s(b,_,g.value,w),S===f||S===p)return S};d.BREAK=f,d.RETURN=p},function(r,o){r.exports=function(n,i,s){var a=s===void 0;switch(i.length){case 0:return a?n():n.call(s);case 1:return a?n(i[0]):n.call(s,i[0]);case 2:return a?n(i[0],i[1]):n.call(s,i[0],i[1]);case 3:return a?n(i[0],i[1],i[2]):n.call(s,i[0],i[1],i[2]);case 4:return a?n(i[0],i[1],i[2],i[3]):n.call(s,i[0],i[1],i[2],i[3])}return n.apply(s,i)}},function(r,o,n){var i=n(11);r.exports=Object("z").propertyIsEnumerable(0)?Object:function(s){return i(s)=="String"?s.split(""):Object(s)}},function(r,o,n){var i=n(10),s=n(1)("iterator"),a=Array.prototype;r.exports=function(c){return c!==void 0&&(i.Array===c||a[s]===c)}},function(r,o,n){var i=n(3);r.exports=function(s,a,c,l){try{return l?a(i(c)[0],c[1]):a(c)}catch(f){var u=s.return;throw u!==void 0&&i(u.call(s)),f}}},function(r,o,n){"use strict";var i=n(49),s=n(17),a=n(18),c={};n(5)(c,n(1)("iterator"),function(){return this}),r.exports=function(l,u,f){l.prototype=i(c,{next:s(1,f)}),a(l,u+" Iterator")}},function(r,o,n){var i=n(1)("iterator"),s=!1;try{var a=[7][i]();a.return=function(){s=!0},Array.from(a,function(){throw 2})}catch{}r.exports=function(c,l){if(!l&&!s)return!1;var u=!1;try{var f=[7],p=f[i]();p.next=function(){return{done:u=!0}},f[i]=function(){return p},c(f)}catch{}return u}},function(r,o){r.exports=function(n,i){return{value:i,done:!!n}}},function(r,o,n){var i=n(2),s=n(30).set,a=i.MutationObserver||i.WebKitMutationObserver,c=i.process,l=i.Promise,u=n(11)(c)=="process";r.exports=function(){var f,p,d,h=function(){var A,P;for(u&&(A=c.domain)&&A.exit();f;){P=f.fn,f=f.next;try{P()}catch(g){throw f?d():p=void 0,g}}p=void 0,A&&A.enter()};if(u)d=function(){c.nextTick(h)};else if(a){var w=!0,T=document.createTextNode("");new a(h).observe(T,{characterData:!0}),d=function(){T.data=w=!w}}else if(l&&l.resolve){var O=l.resolve();d=function(){O.then(h)}}else d=function(){s.call(i,h)};return function(A){var P={fn:A,next:void 0};p&&(p.next=P),f||(f=P,d()),p=P}}},function(r,o,n){var i=n(3),s=n(50),a=n(22),c=n(19)("IE_PROTO"),l=function(){},u="prototype",f=function(){var p,d=n(16)("iframe"),h=a.length,w=">";for(d.style.display="none",n(25).appendChild(d),d.src="javascript:",p=d.contentWindow.document,p.open(),p.write("<script>document.F=Object</script"+w),p.close(),f=p.F;h--;)delete f[u][a[h]];return f()};r.exports=Object.create||function(p,d){var h;return p!==null?(l[u]=i(p),h=new l,l[u]=null,h[c]=p):h=f(),d===void 0?h:s(h,d)}},function(r,o,n){var i=n(12),s=n(3),a=n(54);r.exports=n(4)?Object.defineProperties:function(c,l){s(c);for(var u,f=a(l),p=f.length,d=0;p>d;)i.f(c,u=f[d++],l[u]);return c}},function(r,o,n){var i=n(55),s=n(17),a=n(13),c=n(32),l=n(8),u=n(26),f=Object.getOwnPropertyDescriptor;o.f=n(4)?f:function(p,d){if(p=a(p),d=c(d,!0),u)try{return f(p,d)}catch{}if(l(p,d))return s(!i.f.call(p,d),p[d])}},function(r,o,n){var i=n(8),s=n(63),a=n(19)("IE_PROTO"),c=Object.prototype;r.exports=Object.getPrototypeOf||function(l){return l=s(l),i(l,a)?l[a]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(r,o,n){var i=n(8),s=n(13),a=n(39)(!1),c=n(19)("IE_PROTO");r.exports=function(l,u){var f,p=s(l),d=0,h=[];for(f in p)f!=c&&i(p,f)&&h.push(f);for(;u.length>d;)i(p,f=u[d++])&&(~a(h,f)||h.push(f));return h}},function(r,o,n){var i=n(53),s=n(22);r.exports=Object.keys||function(a){return i(a,s)}},function(r,o){o.f={}.propertyIsEnumerable},function(r,o,n){var i=n(5);r.exports=function(s,a,c){for(var l in a)c&&s[l]?s[l]=a[l]:i(s,l,a[l]);return s}},function(r,o,n){r.exports=n(5)},function(r,o,n){var i=n(9),s=n(3),a=function(c,l){if(s(c),!i(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};r.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(c,l,u){try{u=n(7)(Function.call,n(51).f(Object.prototype,"__proto__").set,2),u(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(f,p){return a(f,p),l?f.__proto__=p:u(f,p),f}})({},!1):void 0),check:a}},function(r,o,n){"use strict";var i=n(2),s=n(6),a=n(12),c=n(4),l=n(1)("species");r.exports=function(u){var f=typeof s[u]=="function"?s[u]:i[u];c&&f&&!f[l]&&a.f(f,l,{configurable:!0,get:function(){return this}})}},function(r,o,n){var i=n(3),s=n(14),a=n(1)("species");r.exports=function(c,l){var u,f=i(c).constructor;return f===void 0||(u=i(f)[a])==null?l:s(u)}},function(r,o,n){var i=n(20),s=n(15);r.exports=function(a){return function(c,l){var u,f,p=String(s(c)),d=i(l),h=p.length;return d<0||d>=h?a?"":void 0:(u=p.charCodeAt(d),u<55296||u>56319||d+1===h||(f=p.charCodeAt(d+1))<56320||f>57343?a?p.charAt(d):u:a?p.slice(d,d+2):(u-55296<<10)+(f-56320)+65536)}}},function(r,o,n){var i=n(20),s=Math.max,a=Math.min;r.exports=function(c,l){return c=i(c),c<0?s(c+l,0):a(c,l)}},function(r,o,n){var i=n(15);r.exports=function(s){return Object(i(s))}},function(r,o,n){var i=n(21),s=n(1)("iterator"),a=n(10);r.exports=n(6).getIteratorMethod=function(c){if(c!=null)return c[s]||c["@@iterator"]||a[i(c)]}},function(r,o,n){"use strict";var i=n(37),s=n(47),a=n(10),c=n(13);r.exports=n(27)(Array,"Array",function(l,u){this._t=c(l),this._i=0,this._k=u},function(){var l=this._t,u=this._k,f=this._i++;return!l||f>=l.length?(this._t=void 0,s(1)):u=="keys"?s(0,f):u=="values"?s(0,l[f]):s(0,[f,l[f]])},"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(r,o){},function(r,o,n){"use strict";var i,s,a,c=n(28),l=n(2),u=n(7),f=n(21),p=n(23),d=n(9),h=(n(3),n(14)),w=n(38),T=n(40),O=(n(58).set,n(60)),A=n(30).set,P=n(48)(),g="Promise",b=l.TypeError,I=l.process,S=l[g],I=l.process,_=f(I)=="process",U=function(){},Z=!!(function(){try{var y=S.resolve(1),v=(y.constructor={})[n(1)("species")]=function(x){x(U,U)};return(_||typeof PromiseRejectionEvent=="function")&&y.then(U)instanceof v}catch{}})(),ge=function(y,v){return y===v||y===S&&v===a},ye=function(y){var v;return!(!d(y)||typeof(v=y.then)!="function")&&v},ne=function(y){return ge(S,y)?new De(y):new s(y)},De=s=function(y){var v,x;this.promise=new y(function(N,z){if(v!==void 0||x!==void 0)throw b("Bad Promise constructor");v=N,x=z}),this.resolve=h(v),this.reject=h(x)},It=function(y){try{y()}catch(v){return{error:v}}},gt=function(y,v){if(!y._n){y._n=!0;var x=y._c;P(function(){for(var N=y._v,z=y._s==1,yt=0,Lt=function(Ze){var be,er,gn=z?Ze.ok:Ze.fail,yn=Ze.resolve,_t=Ze.reject,tr=Ze.domain;try{gn?(z||(y._h==2&&Je(y),y._h=1),gn===!0?be=N:(tr&&tr.enter(),be=gn(N),tr&&tr.exit()),be===Ze.promise?_t(b("Promise-chain cycle")):(er=ye(be))?er.call(be,yn,_t):yn(be)):_t(N)}catch(Ha){_t(Ha)}};x.length>yt;)Lt(x[yt++]);y._c=[],y._n=!1,v&&!y._h&&mn(y)})}},mn=function(y){A.call(l,function(){var v,x,N,z=y._v;if(re(y)&&(v=It(function(){_?I.emit("unhandledRejection",z,y):(x=l.onunhandledrejection)?x({promise:y,reason:z}):(N=l.console)&&N.error&&N.error("Unhandled promise rejection",z)}),y._h=_||re(y)?2:1),y._a=void 0,v)throw v.error})},re=function(y){if(y._h==1)return!1;for(var v,x=y._a||y._c,N=0;x.length>N;)if(v=x[N++],v.fail||!re(v.promise))return!1;return!0},Je=function(y){A.call(l,function(){var v;_?I.emit("rejectionHandled",y):(v=l.onrejectionhandled)&&v({promise:y,reason:y._v})})},ae=function(y){var v=this;v._d||(v._d=!0,v=v._w||v,v._v=y,v._s=2,v._a||(v._a=v._c.slice()),gt(v,!0))},hn=function(y){var v,x=this;if(!x._d){x._d=!0,x=x._w||x;try{if(x===y)throw b("Promise can't be resolved itself");(v=ye(y))?P(function(){var N={_w:x,_d:!1};try{v.call(y,u(hn,N,1),u(ae,N,1))}catch(z){ae.call(N,z)}}):(x._v=y,x._s=1,gt(x,!1))}catch(N){ae.call({_w:x,_d:!1},N)}}};Z||(S=function(y){w(this,S,g,"_h"),h(y),i.call(this);try{y(u(hn,this,1),u(ae,this,1))}catch(v){ae.call(this,v)}},i=function(y){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(56)(S.prototype,{then:function(y,v){var x=ne(O(this,S));return x.ok=typeof y!="function"||y,x.fail=typeof v=="function"&&v,x.domain=_?I.domain:void 0,this._c.push(x),this._a&&this._a.push(x),this._s&>(this,!1),x.promise},catch:function(y){return this.then(void 0,y)}}),De=function(){var y=new i;this.promise=y,this.resolve=u(hn,y,1),this.reject=u(ae,y,1)}),p(p.G+p.W+p.F*!Z,{Promise:S}),n(18)(S,g),n(59)(g),a=n(6)[g],p(p.S+p.F*!Z,g,{reject:function(y){var v=ne(this),x=v.reject;return x(y),v.promise}}),p(p.S+p.F*(c||!Z),g,{resolve:function(y){if(y instanceof S&&ge(y.constructor,this))return y;var v=ne(this),x=v.resolve;return x(y),v.promise}}),p(p.S+p.F*!(Z&&n(46)(function(y){S.all(y).catch(U)})),g,{all:function(y){var v=this,x=ne(v),N=x.resolve,z=x.reject,yt=It(function(){var Lt=[],Ze=0,be=1;T(y,!1,function(er){var gn=Ze++,yn=!1;Lt.push(void 0),be++,v.resolve(er).then(function(_t){yn||(yn=!0,Lt[gn]=_t,--be||N(Lt))},z)}),--be||N(Lt)});return yt&&z(yt.error),x.promise},race:function(y){var v=this,x=ne(v),N=x.reject,z=It(function(){T(y,!1,function(yt){v.resolve(yt).then(x.resolve,N)})});return z&&N(z.error),x.promise}})},function(r,o,n){"use strict";var i=n(61)(!0);n(27)(String,"String",function(s){this._t=String(s),this._i=0},function(){var s,a=this._t,c=this._i;return c>=a.length?{value:void 0,done:!0}:(s=i(a,c),this._i+=s.length,{value:s,done:!1})})},function(r,o,n){n(65);for(var i=n(2),s=n(5),a=n(10),c=n(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var f=l[u],p=i[f],d=p&&p.prototype;d&&!d[c]&&s(d,c,f),a[f]=a.Array}},function(r,o){r.exports=require("child_process")},function(r,o){r.exports=require("crypto")}])})});var Fs={};qa(Fs,{initTray:()=>bo,killTray:()=>Vn,openBrowser:()=>Yn,showTrayNotification:()=>xo,updateTrayTooltip:()=>Ir});function _s(e){for(let t of e)try{if(rn.default.existsSync(t))return t}catch{}return null}function kl(){if(process.platform==="win32"){for(let e of Ds)try{if(rn.default.existsSync(e))return rn.default.readFileSync(e).toString("base64")}catch{}return Ls}return Ls}function Ol(){if(process.env.NREMOTE_DESKTOP)return!1;let e=process.platform;return!(!["darwin","win32","linux"].includes(e)||e==="linux"&&!process.env.DISPLAY)}function Bs(){let{port:e,tunnelUrl:t,running:r}=on,o=r?t?"Tunnel ON":"Local only":"Idle",n=`http://localhost:${e}`;return`9Remote \u2022 ${o}
|
|
3
|
+
var Xa=Object.create;var Yr=Object.defineProperty;var Qa=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var Ja=Object.getPrototypeOf,Za=Object.prototype.hasOwnProperty;var za=(e,t)=>()=>(e&&(t=e(e=0)),t);var me=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ec=(e,t)=>{for(var r in t)Yr(e,r,{get:t[r],enumerable:!0})},tc=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of qa(t))!Za.call(e,n)&&n!==r&&Yr(e,n,{get:()=>t[n],enumerable:!(o=Qa(t,n))||o.enumerable});return e};var R=(e,t,r)=>(r=e!=null?Xa(Ja(e)):{},tc(t||!e||!e.__esModule?Yr(r,"default",{value:e,enumerable:!0}):r,e));var ai=me((On,qr)=>{(function(e,t){typeof On=="object"&&typeof qr=="object"?qr.exports=t(require("child_process"),require("crypto")):typeof define=="function"&&define.amd?define(["child_process","crypto"],t):typeof On=="object"?On["electron-machine-id"]=t(require("child_process"),require("crypto")):e["electron-machine-id"]=t(e.child_process,e.crypto)})(On,function(e,t){return(function(r){function o(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return r[i].call(s.exports,s,s.exports,o),s.loaded=!0,s.exports}var n={};return o.m=r,o.c=n,o.p="",o(0)})([function(r,o,n){r.exports=n(34)},function(r,o,n){var i=n(29)("wks"),s=n(33),a=n(2).Symbol,c=typeof a=="function",l=r.exports=function(u){return i[u]||(i[u]=c&&a[u]||(c?a:s)("Symbol."+u))};l.store=i},function(r,o){var n=r.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=n)},function(r,o,n){var i=n(9);r.exports=function(s){if(!i(s))throw TypeError(s+" is not an object!");return s}},function(r,o,n){r.exports=!n(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(r,o,n){var i=n(12),s=n(17);r.exports=n(4)?function(a,c,l){return i.f(a,c,s(1,l))}:function(a,c,l){return a[c]=l,a}},function(r,o){var n=r.exports={version:"2.4.0"};typeof __e=="number"&&(__e=n)},function(r,o,n){var i=n(14);r.exports=function(s,a,c){if(i(s),a===void 0)return s;switch(c){case 1:return function(l){return s.call(a,l)};case 2:return function(l,u){return s.call(a,l,u)};case 3:return function(l,u,f){return s.call(a,l,u,f)}}return function(){return s.apply(a,arguments)}}},function(r,o){var n={}.hasOwnProperty;r.exports=function(i,s){return n.call(i,s)}},function(r,o){r.exports=function(n){return typeof n=="object"?n!==null:typeof n=="function"}},function(r,o){r.exports={}},function(r,o){var n={}.toString;r.exports=function(i){return n.call(i).slice(8,-1)}},function(r,o,n){var i=n(3),s=n(26),a=n(32),c=Object.defineProperty;o.f=n(4)?Object.defineProperty:function(l,u,f){if(i(l),u=a(u,!0),i(f),s)try{return c(l,u,f)}catch{}if("get"in f||"set"in f)throw TypeError("Accessors not supported!");return"value"in f&&(l[u]=f.value),l}},function(r,o,n){var i=n(42),s=n(15);r.exports=function(a){return i(s(a))}},function(r,o){r.exports=function(n){if(typeof n!="function")throw TypeError(n+" is not a function!");return n}},function(r,o){r.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},function(r,o,n){var i=n(9),s=n(2).document,a=i(s)&&i(s.createElement);r.exports=function(c){return a?s.createElement(c):{}}},function(r,o){r.exports=function(n,i){return{enumerable:!(1&n),configurable:!(2&n),writable:!(4&n),value:i}}},function(r,o,n){var i=n(12).f,s=n(8),a=n(1)("toStringTag");r.exports=function(c,l,u){c&&!s(c=u?c:c.prototype,a)&&i(c,a,{configurable:!0,value:l})}},function(r,o,n){var i=n(29)("keys"),s=n(33);r.exports=function(a){return i[a]||(i[a]=s(a))}},function(r,o){var n=Math.ceil,i=Math.floor;r.exports=function(s){return isNaN(s=+s)?0:(s>0?i:n)(s)}},function(r,o,n){var i=n(11),s=n(1)("toStringTag"),a=i((function(){return arguments})())=="Arguments",c=function(l,u){try{return l[u]}catch{}};r.exports=function(l){var u,f,p;return l===void 0?"Undefined":l===null?"Null":typeof(f=c(u=Object(l),s))=="string"?f:a?i(u):(p=i(u))=="Object"&&typeof u.callee=="function"?"Arguments":p}},function(r,o){r.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(r,o,n){var i=n(2),s=n(6),a=n(7),c=n(5),l="prototype",u=function(f,p,d){var h,w,E,O=f&u.F,T=f&u.G,A=f&u.S,P=f&u.P,M=f&u.B,g=f&u.W,b=T?s:s[p]||(s[p]={}),L=b[l],$=T?i:A?i[p]:(i[p]||{})[l];T&&(d=p);for(h in d)w=!O&&$&&$[h]!==void 0,w&&h in b||(E=w?$[h]:d[h],b[h]=T&&typeof $[h]!="function"?d[h]:M&&w?a(E,i):g&&$[h]==E?(function(Y){var re=function(ve,oe,Be){if(this instanceof Y){switch(arguments.length){case 0:return new Y;case 1:return new Y(ve);case 2:return new Y(ve,oe)}return new Y(ve,oe,Be)}return Y.apply(this,arguments)};return re[l]=Y[l],re})(E):P&&typeof E=="function"?a(Function.call,E):E,P&&((b.virtual||(b.virtual={}))[h]=E,f&u.R&&L&&!L[h]&&c(L,h,E)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,r.exports=u},function(r,o){r.exports=function(n){try{return!!n()}catch{return!0}}},function(r,o,n){r.exports=n(2).document&&document.documentElement},function(r,o,n){r.exports=!n(4)&&!n(24)(function(){return Object.defineProperty(n(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(r,o,n){"use strict";var i=n(28),s=n(23),a=n(57),c=n(5),l=n(8),u=n(10),f=n(45),p=n(18),d=n(52),h=n(1)("iterator"),w=!([].keys&&"next"in[].keys()),E="@@iterator",O="keys",T="values",A=function(){return this};r.exports=function(P,M,g,b,L,$,Y){f(g,M,b);var re,ve,oe,Be=function(v){if(!w&&v in ie)return ie[v];switch(v){case O:return function(){return new g(this,v)};case T:return function(){return new g(this,v)}}return function(){return new g(this,v)}},Nt=M+" Iterator",wt=L==T,Tn=!1,ie=P.prototype,et=ie[h]||ie[E]||L&&ie[L],ue=et||Be(L),bn=L?wt?Be("entries"):ue:void 0,y=M=="Array"&&ie.entries||et;if(y&&(oe=d(y.call(new P)),oe!==Object.prototype&&(p(oe,Nt,!0),i||l(oe,h)||c(oe,h,A))),wt&&et&&et.name!==T&&(Tn=!0,ue=function(){return et.call(this)}),i&&!Y||!w&&!Tn&&ie[h]||c(ie,h,ue),u[M]=ue,u[Nt]=A,L)if(re={values:wt?ue:Be(T),keys:$?ue:Be(O),entries:bn},Y)for(ve in re)ve in ie||a(ie,ve,re[ve]);else s(s.P+s.F*(w||Tn),M,re);return re}},function(r,o){r.exports=!0},function(r,o,n){var i=n(2),s="__core-js_shared__",a=i[s]||(i[s]={});r.exports=function(c){return a[c]||(a[c]={})}},function(r,o,n){var i,s,a,c=n(7),l=n(41),u=n(25),f=n(16),p=n(2),d=p.process,h=p.setImmediate,w=p.clearImmediate,E=p.MessageChannel,O=0,T={},A="onreadystatechange",P=function(){var g=+this;if(T.hasOwnProperty(g)){var b=T[g];delete T[g],b()}},M=function(g){P.call(g.data)};h&&w||(h=function(g){for(var b=[],L=1;arguments.length>L;)b.push(arguments[L++]);return T[++O]=function(){l(typeof g=="function"?g:Function(g),b)},i(O),O},w=function(g){delete T[g]},n(11)(d)=="process"?i=function(g){d.nextTick(c(P,g,1))}:E?(s=new E,a=s.port2,s.port1.onmessage=M,i=c(a.postMessage,a,1)):p.addEventListener&&typeof postMessage=="function"&&!p.importScripts?(i=function(g){p.postMessage(g+"","*")},p.addEventListener("message",M,!1)):i=A in f("script")?function(g){u.appendChild(f("script"))[A]=function(){u.removeChild(this),P.call(g)}}:function(g){setTimeout(c(P,g,1),0)}),r.exports={set:h,clear:w}},function(r,o,n){var i=n(20),s=Math.min;r.exports=function(a){return a>0?s(i(a),9007199254740991):0}},function(r,o,n){var i=n(9);r.exports=function(s,a){if(!i(s))return s;var c,l;if(a&&typeof(c=s.toString)=="function"&&!i(l=c.call(s))||typeof(c=s.valueOf)=="function"&&!i(l=c.call(s))||!a&&typeof(c=s.toString)=="function"&&!i(l=c.call(s)))return l;throw TypeError("Can't convert object to primitive value")}},function(r,o){var n=0,i=Math.random();r.exports=function(s){return"Symbol(".concat(s===void 0?"":s,")_",(++n+i).toString(36))}},function(r,o,n){"use strict";function i(A){return A&&A.__esModule?A:{default:A}}function s(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function a(A){return(0,h.createHash)("sha256").update(A).digest("hex")}function c(A){switch(E){case"darwin":return A.split("IOPlatformUUID")[1].split(`
|
|
4
|
+
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return A.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return A.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return A.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function l(A){var P=c((0,d.execSync)(T[E]).toString());return A?P:a(P)}function u(A){return new p.default(function(P,M){return(0,d.exec)(T[E],{},function(g,b,L){if(g)return M(new Error("Error while obtaining machine id: "+g.stack));var $=c(b.toString());return P(A?$:a($))})})}Object.defineProperty(o,"__esModule",{value:!0});var f=n(35),p=i(f);o.machineIdSync=l,o.machineId=u;var d=n(70),h=n(71),w=process,E=w.platform,O={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},T={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:O[s()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(r,o,n){r.exports={default:n(36),__esModule:!0}},function(r,o,n){n(66),n(68),n(69),n(67),r.exports=n(6).Promise},function(r,o){r.exports=function(){}},function(r,o){r.exports=function(n,i,s,a){if(!(n instanceof i)||a!==void 0&&a in n)throw TypeError(s+": incorrect invocation!");return n}},function(r,o,n){var i=n(13),s=n(31),a=n(62);r.exports=function(c){return function(l,u,f){var p,d=i(l),h=s(d.length),w=a(f,h);if(c&&u!=u){for(;h>w;)if(p=d[w++],p!=p)return!0}else for(;h>w;w++)if((c||w in d)&&d[w]===u)return c||w||0;return!c&&-1}}},function(r,d,n){var i=n(7),s=n(44),a=n(43),c=n(3),l=n(31),u=n(64),f={},p={},d=r.exports=function(h,w,E,O,T){var A,P,M,g,b=T?function(){return h}:u(h),L=i(E,O,w?2:1),$=0;if(typeof b!="function")throw TypeError(h+" is not iterable!");if(a(b)){for(A=l(h.length);A>$;$++)if(g=w?L(c(P=h[$])[0],P[1]):L(h[$]),g===f||g===p)return g}else for(M=b.call(h);!(P=M.next()).done;)if(g=s(M,L,P.value,w),g===f||g===p)return g};d.BREAK=f,d.RETURN=p},function(r,o){r.exports=function(n,i,s){var a=s===void 0;switch(i.length){case 0:return a?n():n.call(s);case 1:return a?n(i[0]):n.call(s,i[0]);case 2:return a?n(i[0],i[1]):n.call(s,i[0],i[1]);case 3:return a?n(i[0],i[1],i[2]):n.call(s,i[0],i[1],i[2]);case 4:return a?n(i[0],i[1],i[2],i[3]):n.call(s,i[0],i[1],i[2],i[3])}return n.apply(s,i)}},function(r,o,n){var i=n(11);r.exports=Object("z").propertyIsEnumerable(0)?Object:function(s){return i(s)=="String"?s.split(""):Object(s)}},function(r,o,n){var i=n(10),s=n(1)("iterator"),a=Array.prototype;r.exports=function(c){return c!==void 0&&(i.Array===c||a[s]===c)}},function(r,o,n){var i=n(3);r.exports=function(s,a,c,l){try{return l?a(i(c)[0],c[1]):a(c)}catch(f){var u=s.return;throw u!==void 0&&i(u.call(s)),f}}},function(r,o,n){"use strict";var i=n(49),s=n(17),a=n(18),c={};n(5)(c,n(1)("iterator"),function(){return this}),r.exports=function(l,u,f){l.prototype=i(c,{next:s(1,f)}),a(l,u+" Iterator")}},function(r,o,n){var i=n(1)("iterator"),s=!1;try{var a=[7][i]();a.return=function(){s=!0},Array.from(a,function(){throw 2})}catch{}r.exports=function(c,l){if(!l&&!s)return!1;var u=!1;try{var f=[7],p=f[i]();p.next=function(){return{done:u=!0}},f[i]=function(){return p},c(f)}catch{}return u}},function(r,o){r.exports=function(n,i){return{value:i,done:!!n}}},function(r,o,n){var i=n(2),s=n(30).set,a=i.MutationObserver||i.WebKitMutationObserver,c=i.process,l=i.Promise,u=n(11)(c)=="process";r.exports=function(){var f,p,d,h=function(){var T,A;for(u&&(T=c.domain)&&T.exit();f;){A=f.fn,f=f.next;try{A()}catch(P){throw f?d():p=void 0,P}}p=void 0,T&&T.enter()};if(u)d=function(){c.nextTick(h)};else if(a){var w=!0,E=document.createTextNode("");new a(h).observe(E,{characterData:!0}),d=function(){E.data=w=!w}}else if(l&&l.resolve){var O=l.resolve();d=function(){O.then(h)}}else d=function(){s.call(i,h)};return function(T){var A={fn:T,next:void 0};p&&(p.next=A),f||(f=A,d()),p=A}}},function(r,o,n){var i=n(3),s=n(50),a=n(22),c=n(19)("IE_PROTO"),l=function(){},u="prototype",f=function(){var p,d=n(16)("iframe"),h=a.length,w=">";for(d.style.display="none",n(25).appendChild(d),d.src="javascript:",p=d.contentWindow.document,p.open(),p.write("<script>document.F=Object</script"+w),p.close(),f=p.F;h--;)delete f[u][a[h]];return f()};r.exports=Object.create||function(p,d){var h;return p!==null?(l[u]=i(p),h=new l,l[u]=null,h[c]=p):h=f(),d===void 0?h:s(h,d)}},function(r,o,n){var i=n(12),s=n(3),a=n(54);r.exports=n(4)?Object.defineProperties:function(c,l){s(c);for(var u,f=a(l),p=f.length,d=0;p>d;)i.f(c,u=f[d++],l[u]);return c}},function(r,o,n){var i=n(55),s=n(17),a=n(13),c=n(32),l=n(8),u=n(26),f=Object.getOwnPropertyDescriptor;o.f=n(4)?f:function(p,d){if(p=a(p),d=c(d,!0),u)try{return f(p,d)}catch{}if(l(p,d))return s(!i.f.call(p,d),p[d])}},function(r,o,n){var i=n(8),s=n(63),a=n(19)("IE_PROTO"),c=Object.prototype;r.exports=Object.getPrototypeOf||function(l){return l=s(l),i(l,a)?l[a]:typeof l.constructor=="function"&&l instanceof l.constructor?l.constructor.prototype:l instanceof Object?c:null}},function(r,o,n){var i=n(8),s=n(13),a=n(39)(!1),c=n(19)("IE_PROTO");r.exports=function(l,u){var f,p=s(l),d=0,h=[];for(f in p)f!=c&&i(p,f)&&h.push(f);for(;u.length>d;)i(p,f=u[d++])&&(~a(h,f)||h.push(f));return h}},function(r,o,n){var i=n(53),s=n(22);r.exports=Object.keys||function(a){return i(a,s)}},function(r,o){o.f={}.propertyIsEnumerable},function(r,o,n){var i=n(5);r.exports=function(s,a,c){for(var l in a)c&&s[l]?s[l]=a[l]:i(s,l,a[l]);return s}},function(r,o,n){r.exports=n(5)},function(r,o,n){var i=n(9),s=n(3),a=function(c,l){if(s(c),!i(l)&&l!==null)throw TypeError(l+": can't set as prototype!")};r.exports={set:Object.setPrototypeOf||("__proto__"in{}?(function(c,l,u){try{u=n(7)(Function.call,n(51).f(Object.prototype,"__proto__").set,2),u(c,[]),l=!(c instanceof Array)}catch{l=!0}return function(f,p){return a(f,p),l?f.__proto__=p:u(f,p),f}})({},!1):void 0),check:a}},function(r,o,n){"use strict";var i=n(2),s=n(6),a=n(12),c=n(4),l=n(1)("species");r.exports=function(u){var f=typeof s[u]=="function"?s[u]:i[u];c&&f&&!f[l]&&a.f(f,l,{configurable:!0,get:function(){return this}})}},function(r,o,n){var i=n(3),s=n(14),a=n(1)("species");r.exports=function(c,l){var u,f=i(c).constructor;return f===void 0||(u=i(f)[a])==null?l:s(u)}},function(r,o,n){var i=n(20),s=n(15);r.exports=function(a){return function(c,l){var u,f,p=String(s(c)),d=i(l),h=p.length;return d<0||d>=h?a?"":void 0:(u=p.charCodeAt(d),u<55296||u>56319||d+1===h||(f=p.charCodeAt(d+1))<56320||f>57343?a?p.charAt(d):u:a?p.slice(d,d+2):(u-55296<<10)+(f-56320)+65536)}}},function(r,o,n){var i=n(20),s=Math.max,a=Math.min;r.exports=function(c,l){return c=i(c),c<0?s(c+l,0):a(c,l)}},function(r,o,n){var i=n(15);r.exports=function(s){return Object(i(s))}},function(r,o,n){var i=n(21),s=n(1)("iterator"),a=n(10);r.exports=n(6).getIteratorMethod=function(c){if(c!=null)return c[s]||c["@@iterator"]||a[i(c)]}},function(r,o,n){"use strict";var i=n(37),s=n(47),a=n(10),c=n(13);r.exports=n(27)(Array,"Array",function(l,u){this._t=c(l),this._i=0,this._k=u},function(){var l=this._t,u=this._k,f=this._i++;return!l||f>=l.length?(this._t=void 0,s(1)):u=="keys"?s(0,f):u=="values"?s(0,l[f]):s(0,[f,l[f]])},"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(r,o){},function(r,o,n){"use strict";var i,s,a,c=n(28),l=n(2),u=n(7),f=n(21),p=n(23),d=n(9),h=(n(3),n(14)),w=n(38),E=n(40),O=(n(58).set,n(60)),T=n(30).set,A=n(48)(),P="Promise",M=l.TypeError,b=l.process,g=l[P],b=l.process,L=f(b)=="process",$=function(){},Y=!!(function(){try{var y=g.resolve(1),v=(y.constructor={})[n(1)("species")]=function(x){x($,$)};return(L||typeof PromiseRejectionEvent=="function")&&y.then($)instanceof v}catch{}})(),re=function(y,v){return y===v||y===g&&v===a},ve=function(y){var v;return!(!d(y)||typeof(v=y.then)!="function")&&v},oe=function(y){return re(g,y)?new Be(y):new s(y)},Be=s=function(y){var v,x;this.promise=new y(function(D,ee){if(v!==void 0||x!==void 0)throw M("Bad Promise constructor");v=D,x=ee}),this.resolve=h(v),this.reject=h(x)},Nt=function(y){try{y()}catch(v){return{error:v}}},wt=function(y,v){if(!y._n){y._n=!0;var x=y._c;A(function(){for(var D=y._v,ee=y._s==1,vt=0,Dt=function(tt){var Re,ar,An=ee?tt.ok:tt.fail,xn=tt.resolve,Bt=tt.reject,cr=tt.domain;try{An?(ee||(y._h==2&&et(y),y._h=1),An===!0?Re=D:(cr&&cr.enter(),Re=An(D),cr&&cr.exit()),Re===tt.promise?Bt(M("Promise-chain cycle")):(ar=ve(Re))?ar.call(Re,xn,Bt):xn(Re)):Bt(D)}catch(Ya){Bt(Ya)}};x.length>vt;)Dt(x[vt++]);y._c=[],y._n=!1,v&&!y._h&&Tn(y)})}},Tn=function(y){T.call(l,function(){var v,x,D,ee=y._v;if(ie(y)&&(v=Nt(function(){L?b.emit("unhandledRejection",ee,y):(x=l.onunhandledrejection)?x({promise:y,reason:ee}):(D=l.console)&&D.error&&D.error("Unhandled promise rejection",ee)}),y._h=L||ie(y)?2:1),y._a=void 0,v)throw v.error})},ie=function(y){if(y._h==1)return!1;for(var v,x=y._a||y._c,D=0;x.length>D;)if(v=x[D++],v.fail||!ie(v.promise))return!1;return!0},et=function(y){T.call(l,function(){var v;L?b.emit("rejectionHandled",y):(v=l.onrejectionhandled)&&v({promise:y,reason:y._v})})},ue=function(y){var v=this;v._d||(v._d=!0,v=v._w||v,v._v=y,v._s=2,v._a||(v._a=v._c.slice()),wt(v,!0))},bn=function(y){var v,x=this;if(!x._d){x._d=!0,x=x._w||x;try{if(x===y)throw M("Promise can't be resolved itself");(v=ve(y))?A(function(){var D={_w:x,_d:!1};try{v.call(y,u(bn,D,1),u(ue,D,1))}catch(ee){ue.call(D,ee)}}):(x._v=y,x._s=1,wt(x,!1))}catch(D){ue.call({_w:x,_d:!1},D)}}};Y||(g=function(y){w(this,g,P,"_h"),h(y),i.call(this);try{y(u(bn,this,1),u(ue,this,1))}catch(v){ue.call(this,v)}},i=function(y){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},i.prototype=n(56)(g.prototype,{then:function(y,v){var x=oe(O(this,g));return x.ok=typeof y!="function"||y,x.fail=typeof v=="function"&&v,x.domain=L?b.domain:void 0,this._c.push(x),this._a&&this._a.push(x),this._s&&wt(this,!1),x.promise},catch:function(y){return this.then(void 0,y)}}),Be=function(){var y=new i;this.promise=y,this.resolve=u(bn,y,1),this.reject=u(ue,y,1)}),p(p.G+p.W+p.F*!Y,{Promise:g}),n(18)(g,P),n(59)(P),a=n(6)[P],p(p.S+p.F*!Y,P,{reject:function(y){var v=oe(this),x=v.reject;return x(y),v.promise}}),p(p.S+p.F*(c||!Y),P,{resolve:function(y){if(y instanceof g&&re(y.constructor,this))return y;var v=oe(this),x=v.resolve;return x(y),v.promise}}),p(p.S+p.F*!(Y&&n(46)(function(y){g.all(y).catch($)})),P,{all:function(y){var v=this,x=oe(v),D=x.resolve,ee=x.reject,vt=Nt(function(){var Dt=[],tt=0,Re=1;E(y,!1,function(ar){var An=tt++,xn=!1;Dt.push(void 0),Re++,v.resolve(ar).then(function(Bt){xn||(xn=!0,Dt[An]=Bt,--Re||D(Dt))},ee)}),--Re||D(Dt)});return vt&&ee(vt.error),x.promise},race:function(y){var v=this,x=oe(v),D=x.reject,ee=Nt(function(){E(y,!1,function(vt){v.resolve(vt).then(x.resolve,D)})});return ee&&D(ee.error),x.promise}})},function(r,o,n){"use strict";var i=n(61)(!0);n(27)(String,"String",function(s){this._t=String(s),this._i=0},function(){var s,a=this._t,c=this._i;return c>=a.length?{value:void 0,done:!0}:(s=i(a,c),this._i+=s.length,{value:s,done:!1})})},function(r,o,n){n(65);for(var i=n(2),s=n(5),a=n(10),c=n(1)("toStringTag"),l=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],u=0;u<5;u++){var f=l[u],p=i[f],d=p&&p.prototype;d&&!d[c]&&s(d,c,f),a[f]=a.Array}},function(r,o){r.exports=require("child_process")},function(r,o){r.exports=require("crypto")}])})});var Xs={};ec(Xs,{initTray:()=>zn,killTray:()=>Pt,openBrowser:()=>kt,showTrayNotification:()=>_o,updateTrayTooltip:()=>mn});function Fs(e){for(let t of e)try{if(pn.default.existsSync(t))return t}catch{}return null}function Cl(){if(process.platform==="win32"){for(let e of Gs)try{if(pn.default.existsSync(e))return pn.default.readFileSync(e).toString("base64")}catch{}return Us}return Us}function Ml(){if(process.env.NREMOTE_DESKTOP)return!1;let e=process.platform;return!(!["darwin","win32","linux"].includes(e)||e==="linux"&&!process.env.DISPLAY)}function Vs(){let{port:e,tunnelUrl:t,running:r}=dn,o=r?t?"Tunnel ON":"Local only":"Idle",n=`http://localhost:${e}`;return`9Remote \u2022 ${o}
|
|
5
5
|
Local: ${n}
|
|
6
|
-
Right-click to open / quit`}function
|
|
7
|
-
`,"utf8")}catch{}};return Cs.default.createInterface({input:i.stdout}).on("line",c=>{try{let l=JSON.parse(c);if(l.type!=="click")return;l.index===0?r?.():l.index===1&&(t?.(),Vn(),setTimeout(()=>process.exit(0),500))}catch{}}),i.on("error",()=>{}),i.stderr.on("data",()=>{}),["Open Web UI","Shutdown"].forEach((c,l)=>s({action:"add-item",index:l,title:c,enabled:!0})),{_isWin:!0,_setTooltip(c){s({action:"set-tooltip",text:c})},sendAction(){},kill(){try{s({action:"kill"})}catch{}setTimeout(()=>{try{i&&!i.killed&&i.kill()}catch{}},300)}}}async function bo({port:e,onQuit:t,onOpenUI:r}){if(!Ol())return null;if(process.platform==="win32")return on={port:e,tunnelUrl:"",running:!0},te=Ll({port:e,onQuit:t,onOpenUI:r}),te;try{let o=Il();if(!o)return null;let i={darwin:"tray_darwin_release",win32:"tray_windows_release.exe",linux:"tray_linux_release"}[process.platform];if(!i)return null;let s=Ce.default.join(Ns,"systray2","traybin",i);if(!rn.default.existsSync(s))return null;if(process.platform!=="win32")try{rn.default.chmodSync(s,493)}catch{}return on={port:e,tunnelUrl:"",running:!0},te=new o({menu:Us(),debug:!1,copyDir:!0}),te.onClick(a=>{let c=a.item?.title||a.item;c==="Open Web UI"?r?.():c==="Shutdown"&&(t?.(),Vn(),setTimeout(()=>process.exit(0),500))}),typeof te.ready=="function"?te.ready().catch(()=>{}):(te.onReady(()=>{}),te.onError(()=>{})),te}catch{return null}}function Ir({tunnelUrl:e,running:t}={}){if(e!==void 0&&(on.tunnelUrl=e),t!==void 0&&(on.running=t),!!te){if(te._isWin){te._setTooltip?.(Bs());return}try{te.sendAction({type:"update-menu",menu:Us(),seq_id:-1})}catch{}}}function Vn(){let e=te;if(te=null,e)try{e.kill(!0)}catch{}}function xo({title:e="9Remote",message:t}){let r=process.platform;if(t){if(r==="win32"){let o=c=>String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),n=c=>String(c).replace(/'/g,"''"),i="9Remote",s=`<toast><visual><binding template="ToastText02"><text id="1">${o(e)}</text><text id="2">${o(t)}</text></binding></visual></toast>`,a=["try {","[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType=WindowsRuntime] > $null;","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType=WindowsRuntime] > $null;","$xml = New-Object Windows.Data.Xml.Dom.XmlDocument;",`$xml.LoadXml('${n(s)}');`,"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml);",`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${n(i)}').Show($toast);`,"} catch {","Add-Type -AssemblyName System.Windows.Forms;","$n = New-Object System.Windows.Forms.NotifyIcon;","$n.Icon = [System.Drawing.SystemIcons]::Information;",`$n.BalloonTipTitle = '${n(e)}';`,`$n.BalloonTipText = '${n(t)}';`,"$n.Visible = $true;","$n.ShowBalloonTip(5000);","Start-Sleep -Seconds 6;","$n.Dispose();","}"].join(" ");try{(0,Ye.spawn)("powershell.exe",["-NoProfile","-WindowStyle","Hidden","-Command",a],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(r==="darwin"){try{let o=s=>String(s).replace(/"/g,'\\"'),n=`display notification "${o(t)}" with title "${o(e)}"`;(0,Ye.spawn)("osascript",["-e",n],{detached:!0,stdio:"ignore"}).unref()}catch{}return}try{(0,Ye.spawn)("notify-send",[e,t],{detached:!0,stdio:"ignore"}).unref()}catch{}}}function Yn(e){let t=process.platform;if(t==="win32"){try{(0,Ye.spawn)("rundll32.exe",["url.dll,FileProtocolHandler",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref();return}catch{}try{(0,Ye.spawn)("cmd.exe",["/d","/s","/c","start","",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(t==="darwin"){try{(0,Ye.spawn)("open",[e],{detached:!0,stdio:"ignore"}).unref()}catch{}return}let r=[["setsid",["--fork","xdg-open",e]],["setsid",["xdg-open",e]],["xdg-open",[e]],["gio",["open",e]],["sensible-browser",[e]],["x-www-browser",[e]]];for(let[o,n]of r)try{(0,Ye.spawn)(o,n,{detached:!0,stdio:"ignore",env:{...process.env}}).unref();return}catch{}}var Ye,Cs,rn,Ce,Ms,$s,Ns,te,on,Or,Ls,Ds,Pl,sn=Xa(()=>{Ye=require("child_process"),Cs=R(require("readline"),1),rn=R(require("fs"),1),Ce=R(require("path"),1),Ms=R(require("os"),1),$s=require("url"),Ns=(0,Ce.join)(Ms.default.homedir(),".9remote","runtime","node_modules"),te=null,on={port:0,tunnelUrl:"",running:!1},Or=Ce.default.dirname((0,$s.fileURLToPath)(__importMetaUrl)),Ls="iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAAEsAAAAAQAAASwAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAECgAwAEAAAAAQAAAEAAAAAAEz0GrAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAGNhJREFUeAHVm1lsncd1x8/dF5IiJZmSbMlUJFuWE8l2FM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p2myhb2+efllOb5/27o6v25zuAQfvO2FPPPqgLT592hblHzhB8Li5Sy8bp44ftqlHT9mllXWdBPH+Pd0dKpadf9PaK0t2RQoAMI7OZ1957iLcSTiPoAqwABrYwzzlccGf3Udvg+ku7vmFE6wRtJa6A+MlpqRL0LTeAWf1rs/7f07b1716DG0fOOogeRPoSRH1XMnump2193SXrdKu27Redo7fNWFPfvhhO3Dqs3atMmvtBi9CHalGwulEef/1F21l/pq9fKNpy/J+KAEnyAMIFsQS8odRFANw1QPfLcGVEZWSRhTyvgtsrwZodIIBtNOEiU56KhENP3z/N6GZ53nMb2eaoh2ZgmUXr1r73MuWPfKYrrdtKStra/IBtZk5O/gnf22Pddesox2gr/v+SuUuu1Jra0fYEABJLTMrl6o2feMN6557za639eo0WbX5Vk2mzuUn7ydDbpk5nYO7WhLaCKUBhJR7jMApJvkg+NZPLFAHoUGPre0qM+vw8aiPaAHxdbik9wC8MUdizJMnsrIUkpdwh7Nrtlje7dteSxccPwPokrPS1InPKnajMGNXOjm7sVrTtbfp7dwbyno9zq/oQfSVn9gvX5+3Cy15inzBunKWdRaN8hnRWLZgfY3NbKM4f0SRHDISB+7WgD4RfkRgorlJPhU1NoJmqAAxgRHLga+VecDgOkrgTE4ORUgfTtfRGj9azdiB3LpdaBetuGPGPTaXIw5A7WZTR1yZO8uDLVM8CrIieDbOn7E9p39sL7163t5o5uxmL289fYkyoeNxoVI1052iWK7qhliRYtSmaY4HLJaDW5GAuyJcwtEfyRJA9PF2Elscqj6C4WNofrx3UIBGBazJhrwzX140dM17bb1vD5y/aO9bW7W31t5rnb1HLFedFBPsKATpTArTDEsJneV5y196xWYv/MpevLpsr9U147pu7zm4z/7wi39u0zNSosbhRZjTHjKwvL79rW/a9777XbEVH8mIzFHuZJixychdwH0ALCIn0Dv4wMf3Xr9sSx14c9G5QxIITmoIhxs7s7RhF1azdmy1ZYdX162vNb02c7dtTM5at1C1rGYvoztAvqEj8+o1y119yxavXrefLNZsXt9+NqSclvjtldI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OHxmnVlTRah7NKwIc8I4o3/EP2jsEH8v5XWAJPJ30Hyagtg0bAYX4A9wH1MVCC6sKMhGWgos8SFxu2Layhr8uK8DkPFZ2f/9F0Ir0DhTfRUUWTFy+VIYsxIk6Dh2OgUDImbMH2ND34c/lfKc7FPluIAuBESGgcdEIMg3Q5AAt1OEjaWRLYflCWKkHoHWGieucdAFITwAfQlF2xXk8pBICjBO+arkvyIWGQIcUWXBfV+BC7OJvrAcWPKIZAvzsIm4CLPt1tOGwUIUiLQ3MnJvoAAuABPGWWgC8f8tAkMeKgTN5T8grOJ2TfyefXRfy9KPMhFZJ/mXknPAQ6clC3QVaZmKcdYUmpQ1hv84J/hMYE0jZgsUJpKvtuQUdw2/5lZkUtNcUnI8WdpA4uSkUHRxZ6xmpPk0KcKVZA8AUBVKR1h5kMHGlBTXuk8TQWEtp3kfyt+vxwaz92s28o4uVu/y9p4V8+omyBPpxSB3Vb+WgNOt3WFDopT/1ol4dI8/a22B50Efu7rFE/6T6xbnQKRrCODPxT4dddmATMJmFGM9ws8Bga8Q2KuYWgiTscKjD2uU16JzIm47Pux/7jpNo8YMhfVlwYqekRwrwDAd4xOMnxjvsIwNY+/OssmFKLVKXbhMNq/wfFc4pjZ/mOwLsZbxPKhcTk4e/LYLvgm4EkyyTQI9MYnkM+yH7Lf56+E42k/n0+83kdH4+Ew1AYnU/37Js4qTZ6Ma/nCEUItORwoC6+Z6jx1qRu+1Slx0jnQ8/QLTDpn9XlinV+R/8+/7/EshPRLVmq9wAAAABJRU5ErkJggg==",Ds=[Ce.default.join(Or,"assets","trayIcon.ico"),Ce.default.join(Or,"..","assets","trayIcon.ico")],Pl=[Ce.default.join(Or,"assets","tray.ps1"),Ce.default.join(Or,"..","assets","tray.ps1")]});var Co=ue((kp,oa)=>{oa.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var aa=ue((Op,sa)=>{var Wl=Co();function ia(e){this.mode=Wl.MODE_8BIT_BYTE,this.data=e}ia.prototype={getLength:function(){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};sa.exports=ia});var Mo=ue((Ip,ca)=>{var Ae={glog:function(e){if(e<1)throw new Error("glog("+e+")");return Ae.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return Ae.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(j=0;j<8;j++)Ae.EXP_TABLE[j]=1<<j;var j;for(j=8;j<256;j++)Ae.EXP_TABLE[j]=Ae.EXP_TABLE[j-4]^Ae.EXP_TABLE[j-5]^Ae.EXP_TABLE[j-6]^Ae.EXP_TABLE[j-8];var j;for(j=0;j<255;j++)Ae.LOG_TABLE[Ae.EXP_TABLE[j]]=j;var j;ca.exports=Ae});var $o=ue((Lp,la)=>{var Ot=Mo();function $r(e,t){if(e.length===void 0)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+t);for(var o=0;o<e.length-r;o++)this.num[o]=e[o+r]}$r.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<e.getLength();o++)t[r+o]^=Ot.gexp(Ot.glog(this.get(r))+Ot.glog(e.get(o)));return new $r(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=Ot.glog(this.get(0))-Ot.glog(e.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(var n=0;n<e.getLength();n++)r[n]^=Ot.gexp(Ot.glog(e.get(n))+t);return new $r(r,0).mod(e)}};la.exports=$r});var fa=ue((_p,ua)=>{ua.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var ma=ue((Cp,da)=>{var he=Co(),pa=$o(),jl=Mo(),pt=fa(),J={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;J.getBCHDigit(t)-J.getBCHDigit(J.G15)>=0;)t^=J.G15<<J.getBCHDigit(t)-J.getBCHDigit(J.G15);return(e<<10|t)^J.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;J.getBCHDigit(t)-J.getBCHDigit(J.G18)>=0;)t^=J.G18<<J.getBCHDigit(t)-J.getBCHDigit(J.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!==0;)t++,e>>>=1;return t},getPatternPosition:function(e){return J.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case pt.PATTERN000:return(t+r)%2===0;case pt.PATTERN001:return t%2===0;case pt.PATTERN010:return r%3===0;case pt.PATTERN011:return(t+r)%3===0;case pt.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case pt.PATTERN101:return t*r%2+t*r%3===0;case pt.PATTERN110:return(t*r%2+t*r%3)%2===0;case pt.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new pa([1],0),r=0;r<e;r++)t=t.multiply(new pa([1,jl.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case he.MODE_NUMBER:return 10;case he.MODE_ALPHA_NUM:return 9;case he.MODE_8BIT_BYTE:return 8;case he.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case he.MODE_NUMBER:return 12;case he.MODE_ALPHA_NUM:return 11;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case he.MODE_NUMBER:return 14;case he.MODE_ALPHA_NUM:return 13;case he.MODE_8BIT_BYTE:return 16;case he.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){var t=e.getModuleCount(),r=0,o=0,n=0;for(o=0;o<t;o++)for(n=0;n<t;n++){for(var i=0,s=e.isDark(o,n),a=-1;a<=1;a++)if(!(o+a<0||t<=o+a))for(var c=-1;c<=1;c++)n+c<0||t<=n+c||a===0&&c===0||s===e.isDark(o+a,n+c)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<t-1;o++)for(n=0;n<t-1;n++){var l=0;e.isDark(o,n)&&l++,e.isDark(o+1,n)&&l++,e.isDark(o,n+1)&&l++,e.isDark(o+1,n+1)&&l++,(l===0||l===4)&&(r+=3)}for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(o,n)&&!e.isDark(o,n+1)&&e.isDark(o,n+2)&&e.isDark(o,n+3)&&e.isDark(o,n+4)&&!e.isDark(o,n+5)&&e.isDark(o,n+6)&&(r+=40);for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(o,n)&&!e.isDark(o+1,n)&&e.isDark(o+2,n)&&e.isDark(o+3,n)&&e.isDark(o+4,n)&&!e.isDark(o+5,n)&&e.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;n<t;n++)for(o=0;o<t;o++)e.isDark(o,n)&&u++;var f=Math.abs(100*u/t/t-50)/5;return r+=f*10,r}};da.exports=J});var No=ue((Mp,ha)=>{ha.exports={L:1,M:0,Q:3,H:2}});var ya=ue(($p,ga)=>{var Nr=No();function Me(e,t){this.totalCount=e,this.dataCount=t}Me.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Me.getRSBlocks=function(e,t){var r=Me.getRsBlockTable(e,t);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var s=r[i*3+0],a=r[i*3+1],c=r[i*3+2],l=0;l<s;l++)n.push(new Me(a,c));return n};Me.getRsBlockTable=function(e,t){switch(t){case Nr.L:return Me.RS_BLOCK_TABLE[(e-1)*4+0];case Nr.M:return Me.RS_BLOCK_TABLE[(e-1)*4+1];case Nr.Q:return Me.RS_BLOCK_TABLE[(e-1)*4+2];case Nr.H:return Me.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};ga.exports=Me});var Ea=ue((Np,va)=>{function wa(){this.buffer=[],this.length=0}wa.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};va.exports=wa});var ba=ue((Dp,Aa)=>{var Gl=aa(),dt=ma(),Vl=$o(),Sa=ya(),Ta=Ea();function $e(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}$e.prototype={addData:function(e){var t=new Gl(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=Sa.getRSBlocks(e,this.errorCorrectLevel),r=new Ta,o=0,n=0;n<t.length;n++)o+=t[n].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];r.put(s.mode,4),r.put(s.getLength(),dt.getLengthInBits(s.mode,e)),s.write(r)}if(r.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache===null&&(this.dataCache=$e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=r&&r<=6&&(o===0||o===6)||0<=o&&o<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=o&&o<=4?this.modules[e+r][t+o]=!0:this.modules[e+r][t+o]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=dt.getLostPoint(this);(r===0||e>o)&&(e=o,t=r)}return t},createMovieClip:function(e,t,r){var o=e.createEmptyMovieClip(t,r),n=1;this.make();for(var i=0;i<this.modules.length;i++)for(var s=i*n,a=0;a<this.modules[i].length;a++){var c=a*n,l=this.modules[i][a];l&&(o.beginFill(0,100),o.moveTo(c,s),o.lineTo(c+n,s),o.lineTo(c+n,s+n),o.lineTo(c,s+n),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]===null&&(this.modules[e][6]=e%2===0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]===null&&(this.modules[6][t]=t%2===0)},setupPositionAdjustPattern:function(){for(var e=dt.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var o=e[t],n=e[r];if(this.modules[o][n]===null)for(var i=-2;i<=2;i++)for(var s=-2;s<=2;s++)Math.abs(i)===2||Math.abs(s)===2||i===0&&s===0?this.modules[o+i][n+s]=!0:this.modules[o+i][n+s]=!1}},setupTypeNumber:function(e){for(var t=dt.getBCHTypeNumber(this.typeNumber),r,o=0;o<18;o++)r=!e&&(t>>o&1)===1,this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3]=r;for(var n=0;n<18;n++)r=!e&&(t>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,o=dt.getBCHTypeInfo(r),n,i=0;i<15;i++)n=!e&&(o>>i&1)===1,i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;for(var s=0;s<15;s++)n=!e&&(o>>s&1)===1,s<8?this.modules[8][this.moduleCount-s-1]=n:s<9?this.modules[8][15-s-1+1]=n:this.modules[8][15-s-1]=n;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(s===6&&s--;;){for(var a=0;a<2;a++)if(this.modules[o][s-a]===null){var c=!1;i<e.length&&(c=(e[i]>>>n&1)===1);var l=dt.getMask(t,o,s-a);l&&(c=!c),this.modules[o][s-a]=c,n--,n===-1&&(i++,n=7)}if(o+=r,o<0||this.moduleCount<=o){o-=r,r=-r;break}}}};$e.PAD0=236;$e.PAD1=17;$e.createData=function(e,t,r){for(var o=Sa.getRSBlocks(e,t),n=new Ta,i=0;i<r.length;i++){var s=r[i];n.put(s.mode,4),n.put(s.getLength(),dt.getLengthInBits(s.mode,e)),s.write(n)}for(var a=0,c=0;c<o.length;c++)a+=o[c].dataCount;if(n.getLengthInBits()>a*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+a*8+")");for(n.getLengthInBits()+4<=a*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=a*8||(n.put($e.PAD0,8),n.getLengthInBits()>=a*8));)n.put($e.PAD1,8);return $e.createBytes(n,o)};$e.createBytes=function(e,t){for(var r=0,o=0,n=0,i=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,l=t[a].totalCount-c;o=Math.max(o,c),n=Math.max(n,l),i[a]=new Array(c);for(var u=0;u<i[a].length;u++)i[a][u]=255&e.buffer[u+r];r+=c;var f=dt.getErrorCorrectPolynomial(l),p=new Vl(i[a],f.getLength()-1),d=p.mod(f);s[a]=new Array(f.getLength()-1);for(var h=0;h<s[a].length;h++){var w=h+d.getLength()-s[a].length;s[a][h]=w>=0?d.get(w):0}}for(var T=0,O=0;O<t.length;O++)T+=t[O].totalCount;for(var A=new Array(T),P=0,g=0;g<o;g++)for(var b=0;b<t.length;b++)g<i[b].length&&(A[P++]=i[b][g]);for(var S=0;S<n;S++)for(var I=0;I<t.length;I++)S<s[I].length&&(A[P++]=s[I][S]);return A};Aa.exports=$e});var Pa=ue((Bp,Ra)=>{var Yl=ba(),xa=No(),Xl="\x1B[40m \x1B[0m",Dr="\x1B[47m \x1B[0m",ql=function(e){return e?Xl:Dr},Do=function(e){return{times:function(t){return new Array(t).join(e)}}},Ql=function(e,t){for(var r=new Array(e),o=0;o<e;o++)r[o]=t;return r};Ra.exports={error:xa.L,generate:function(e,t,r){typeof t=="function"&&(r=t,t={});var o=new Yl(-1,this.error);o.addData(e),o.make();var n="";if(t&&t.small){var i=!0,s=!1,a=o.getModuleCount(),c=o.modules.slice(),l=a%2===1;l&&c.push(Ql(a,s));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=Do(u.BLACK_WHITE).times(a+3),p=Do(u.WHITE_BLACK).times(a+3);n+=f+`
|
|
6
|
+
Right-click to open / quit`}function Ys(){let{port:e,tunnelUrl:t}=dn,r=process.platform==="win32",o=t?`9Remote (Port ${e}) \u2022 Tunnel ON`:`9Remote (Port ${e}) \u2022 Local only`;return{icon:Cl(),title:r?`9Remote - Port ${e}`:"",tooltip:Vs(),items:[{title:o,tooltip:t||`http://localhost:${e}`,checked:!1,enabled:!1},{title:"Open Web UI",tooltip:`Open http://localhost:${e} in your browser`,checked:!1,enabled:!0},{title:"Shutdown",tooltip:"Stop 9Remote server, tunnel and quit",checked:!1,enabled:!0}]}}function $l(){try{let e=require($e.default.join(js,"systray2"));return e.default?.default||e.default||e}catch{return null}}function Nl({port:e,onQuit:t,onOpenUI:r}){let o=Fs(Gs),n=Fs(_l);if(!o||!n)return null;let i;try{i=(0,Xe.spawn)("powershell.exe",["-NoProfile","-ExecutionPolicy","Bypass","-WindowStyle","Hidden","-InputFormat","Text","-OutputFormat","Text","-File",n,"-IconPath",o,"-Tooltip",`9Remote - Port ${e}`],{windowsHide:!0,stdio:["pipe","pipe","pipe"]})}catch{return null}let s=c=>{try{i.stdin.writable&&i.stdin.write(`${JSON.stringify(c)}
|
|
7
|
+
`,"utf8")}catch{}};return Ks.default.createInterface({input:i.stdout}).on("line",c=>{try{let l=JSON.parse(c);if(l.type!=="click")return;l.index===0?r?.():l.index===1&&(t?.(),Pt(),setTimeout(()=>process.exit(0),500))}catch{}}),i.on("error",()=>{}),i.stderr.on("data",()=>{}),["Open Web UI","Shutdown"].forEach((c,l)=>s({action:"add-item",index:l,title:c,enabled:!0})),{_isWin:!0,_setTooltip(c){s({action:"set-tooltip",text:c})},sendAction(){},kill(){try{s({action:"kill"})}catch{}setTimeout(()=>{try{i&&!i.killed&&i.kill()}catch{}},300)}}}async function zn({port:e,onQuit:t,onOpenUI:r}){if(!Ml())return null;if(process.platform==="win32")return dn={port:e,tunnelUrl:"",running:!0},ne=Nl({port:e,onQuit:t,onOpenUI:r}),ne;try{let o=$l();if(!o)return null;let i={darwin:"tray_darwin_release",win32:"tray_windows_release.exe",linux:"tray_linux_release"}[process.platform];if(!i)return null;let s=$e.default.join(js,"systray2","traybin",i);if(!pn.default.existsSync(s))return null;if(process.platform!=="win32")try{pn.default.chmodSync(s,493)}catch{}if(dn={port:e,tunnelUrl:"",running:!0},ne=new o({menu:Ys(),debug:!1,copyDir:!0}),ne.onClick(a=>{let c=a.item?.title||a.item;c==="Open Web UI"?r?.():c==="Shutdown"&&(t?.(),Pt(),setTimeout(()=>process.exit(0),500))}),typeof ne.ready=="function")try{await ne.ready()}catch{return ne=null,null}else ne.onReady(()=>{}),ne.onError(()=>{});return ne}catch{return null}}function mn({tunnelUrl:e,running:t}={}){if(e!==void 0&&(dn.tunnelUrl=e),t!==void 0&&(dn.running=t),!!ne){if(ne._isWin){ne._setTooltip?.(Vs());return}try{ne.sendAction({type:"update-menu",menu:Ys(),seq_id:-1})?.catch?.(()=>{})}catch{}}}function Pt(){let e=ne;if(ne=null,e)try{e.kill(!0)}catch{}}function _o({title:e="9Remote",message:t}){let r=process.platform;if(t){if(r==="win32"){let o=c=>String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),n=c=>String(c).replace(/'/g,"''"),i="9Remote",s=`<toast><visual><binding template="ToastText02"><text id="1">${o(e)}</text><text id="2">${o(t)}</text></binding></visual></toast>`,a=["try {","[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType=WindowsRuntime] > $null;","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType=WindowsRuntime] > $null;","$xml = New-Object Windows.Data.Xml.Dom.XmlDocument;",`$xml.LoadXml('${n(s)}');`,"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml);",`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${n(i)}').Show($toast);`,"} catch {","Add-Type -AssemblyName System.Windows.Forms;","$n = New-Object System.Windows.Forms.NotifyIcon;","$n.Icon = [System.Drawing.SystemIcons]::Information;",`$n.BalloonTipTitle = '${n(e)}';`,`$n.BalloonTipText = '${n(t)}';`,"$n.Visible = $true;","$n.ShowBalloonTip(5000);","Start-Sleep -Seconds 6;","$n.Dispose();","}"].join(" ");try{(0,Xe.spawn)("powershell.exe",["-NoProfile","-WindowStyle","Hidden","-Command",a],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(r==="darwin"){try{let o=s=>String(s).replace(/"/g,'\\"'),n=`display notification "${o(t)}" with title "${o(e)}"`;(0,Xe.spawn)("osascript",["-e",n],{detached:!0,stdio:"ignore"}).unref()}catch{}return}try{(0,Xe.spawn)("notify-send",[e,t],{detached:!0,stdio:"ignore"}).unref()}catch{}}}function kt(e){let t=process.platform;if(t==="win32"){try{(0,Xe.spawn)("rundll32.exe",["url.dll,FileProtocolHandler",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref();return}catch{}try{(0,Xe.spawn)("cmd.exe",["/d","/s","/c","start","",e],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}catch{}return}if(t==="darwin"){try{(0,Xe.spawn)("open",[e],{detached:!0,stdio:"ignore"}).unref()}catch{}return}let r=[["setsid",["--fork","xdg-open",e]],["setsid",["xdg-open",e]],["xdg-open",[e]],["gio",["open",e]],["sensible-browser",[e]],["x-www-browser",[e]]];for(let[o,n]of r)try{(0,Xe.spawn)(o,n,{detached:!0,stdio:"ignore",env:{...process.env}}).unref();return}catch{}}var Xe,Ks,pn,$e,Hs,Ws,js,ne,dn,Dr,Us,Gs,_l,Ot=za(()=>{Xe=require("child_process"),Ks=R(require("readline"),1),pn=R(require("fs"),1),$e=R(require("path"),1),Hs=R(require("os"),1),Ws=require("url"),js=(0,$e.join)(Hs.default.homedir(),".9remote","runtime","node_modules"),ne=null,dn={port:0,tunnelUrl:"",running:!1},Dr=$e.default.dirname((0,Ws.fileURLToPath)(__importMetaUrl)),Us="iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAAEsAAAAAQA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..","assets","tray.ps1")]});var Ko=me((Lp,ua)=>{ua.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var da=me((_p,pa)=>{var Yl=Ko();function fa(e){this.mode=Yl.MODE_8BIT_BYTE,this.data=e}fa.prototype={getLength:function(){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};pa.exports=fa});var Ho=me((Cp,ma)=>{var xe={glog:function(e){if(e<1)throw new Error("glog("+e+")");return xe.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return xe.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(j=0;j<8;j++)xe.EXP_TABLE[j]=1<<j;var j;for(j=8;j<256;j++)xe.EXP_TABLE[j]=xe.EXP_TABLE[j-4]^xe.EXP_TABLE[j-5]^xe.EXP_TABLE[j-6]^xe.EXP_TABLE[j-8];var j;for(j=0;j<255;j++)xe.LOG_TABLE[xe.EXP_TABLE[j]]=j;var j;ma.exports=xe});var Wo=me((Mp,ha)=>{var Mt=Ho();function Hr(e,t){if(e.length===void 0)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+t);for(var o=0;o<e.length-r;o++)this.num[o]=e[o+r]}Hr.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<e.getLength();o++)t[r+o]^=Mt.gexp(Mt.glog(this.get(r))+Mt.glog(e.get(o)));return new Hr(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=Mt.glog(this.get(0))-Mt.glog(e.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(var n=0;n<e.getLength();n++)r[n]^=Mt.gexp(Mt.glog(e.get(n))+t);return new Hr(r,0).mod(e)}};ha.exports=Hr});var ya=me(($p,ga)=>{ga.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var Ea=me((Np,va)=>{var we=Ko(),wa=Wo(),Xl=Ho(),ht=ya(),z={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;z.getBCHDigit(t)-z.getBCHDigit(z.G15)>=0;)t^=z.G15<<z.getBCHDigit(t)-z.getBCHDigit(z.G15);return(e<<10|t)^z.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;z.getBCHDigit(t)-z.getBCHDigit(z.G18)>=0;)t^=z.G18<<z.getBCHDigit(t)-z.getBCHDigit(z.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!==0;)t++,e>>>=1;return t},getPatternPosition:function(e){return z.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case ht.PATTERN000:return(t+r)%2===0;case ht.PATTERN001:return t%2===0;case ht.PATTERN010:return r%3===0;case ht.PATTERN011:return(t+r)%3===0;case ht.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case ht.PATTERN101:return t*r%2+t*r%3===0;case ht.PATTERN110:return(t*r%2+t*r%3)%2===0;case ht.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new wa([1],0),r=0;r<e;r++)t=t.multiply(new wa([1,Xl.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case we.MODE_NUMBER:return 10;case we.MODE_ALPHA_NUM:return 9;case we.MODE_8BIT_BYTE:return 8;case we.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case we.MODE_NUMBER:return 12;case we.MODE_ALPHA_NUM:return 11;case we.MODE_8BIT_BYTE:return 16;case we.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case we.MODE_NUMBER:return 14;case we.MODE_ALPHA_NUM:return 13;case we.MODE_8BIT_BYTE:return 16;case we.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){var t=e.getModuleCount(),r=0,o=0,n=0;for(o=0;o<t;o++)for(n=0;n<t;n++){for(var i=0,s=e.isDark(o,n),a=-1;a<=1;a++)if(!(o+a<0||t<=o+a))for(var c=-1;c<=1;c++)n+c<0||t<=n+c||a===0&&c===0||s===e.isDark(o+a,n+c)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<t-1;o++)for(n=0;n<t-1;n++){var l=0;e.isDark(o,n)&&l++,e.isDark(o+1,n)&&l++,e.isDark(o,n+1)&&l++,e.isDark(o+1,n+1)&&l++,(l===0||l===4)&&(r+=3)}for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(o,n)&&!e.isDark(o,n+1)&&e.isDark(o,n+2)&&e.isDark(o,n+3)&&e.isDark(o,n+4)&&!e.isDark(o,n+5)&&e.isDark(o,n+6)&&(r+=40);for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(o,n)&&!e.isDark(o+1,n)&&e.isDark(o+2,n)&&e.isDark(o+3,n)&&e.isDark(o+4,n)&&!e.isDark(o+5,n)&&e.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;n<t;n++)for(o=0;o<t;o++)e.isDark(o,n)&&u++;var f=Math.abs(100*u/t/t-50)/5;return r+=f*10,r}};va.exports=z});var jo=me((Dp,Sa)=>{Sa.exports={L:1,M:0,Q:3,H:2}});var ba=me((Bp,Ta)=>{var Wr=jo();function Ne(e,t){this.totalCount=e,this.dataCount=t}Ne.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Ne.getRSBlocks=function(e,t){var r=Ne.getRsBlockTable(e,t);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var s=r[i*3+0],a=r[i*3+1],c=r[i*3+2],l=0;l<s;l++)n.push(new Ne(a,c));return n};Ne.getRsBlockTable=function(e,t){switch(t){case Wr.L:return Ne.RS_BLOCK_TABLE[(e-1)*4+0];case Wr.M:return Ne.RS_BLOCK_TABLE[(e-1)*4+1];case Wr.Q:return Ne.RS_BLOCK_TABLE[(e-1)*4+2];case Wr.H:return Ne.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};Ta.exports=Ne});var Ra=me((Up,xa)=>{function Aa(){this.buffer=[],this.length=0}Aa.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};xa.exports=Aa});var Ia=me((Fp,Oa)=>{var Ql=da(),gt=Ea(),ql=Wo(),Pa=ba(),ka=Ra();function De(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}De.prototype={addData:function(e){var t=new Ql(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=Pa.getRSBlocks(e,this.errorCorrectLevel),r=new ka,o=0,n=0;n<t.length;n++)o+=t[n].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];r.put(s.mode,4),r.put(s.getLength(),gt.getLengthInBits(s.mode,e)),s.write(r)}if(r.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache===null&&(this.dataCache=De.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var o=-1;o<=7;o++)t+o<=-1||this.moduleCount<=t+o||(0<=r&&r<=6&&(o===0||o===6)||0<=o&&o<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=o&&o<=4?this.modules[e+r][t+o]=!0:this.modules[e+r][t+o]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=gt.getLostPoint(this);(r===0||e>o)&&(e=o,t=r)}return t},createMovieClip:function(e,t,r){var o=e.createEmptyMovieClip(t,r),n=1;this.make();for(var i=0;i<this.modules.length;i++)for(var s=i*n,a=0;a<this.modules[i].length;a++){var c=a*n,l=this.modules[i][a];l&&(o.beginFill(0,100),o.moveTo(c,s),o.lineTo(c+n,s),o.lineTo(c+n,s+n),o.lineTo(c,s+n),o.endFill())}return o},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]===null&&(this.modules[e][6]=e%2===0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]===null&&(this.modules[6][t]=t%2===0)},setupPositionAdjustPattern:function(){for(var e=gt.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var o=e[t],n=e[r];if(this.modules[o][n]===null)for(var i=-2;i<=2;i++)for(var s=-2;s<=2;s++)Math.abs(i)===2||Math.abs(s)===2||i===0&&s===0?this.modules[o+i][n+s]=!0:this.modules[o+i][n+s]=!1}},setupTypeNumber:function(e){for(var t=gt.getBCHTypeNumber(this.typeNumber),r,o=0;o<18;o++)r=!e&&(t>>o&1)===1,this.modules[Math.floor(o/3)][o%3+this.moduleCount-8-3]=r;for(var n=0;n<18;n++)r=!e&&(t>>n&1)===1,this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,o=gt.getBCHTypeInfo(r),n,i=0;i<15;i++)n=!e&&(o>>i&1)===1,i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;for(var s=0;s<15;s++)n=!e&&(o>>s&1)===1,s<8?this.modules[8][this.moduleCount-s-1]=n:s<9?this.modules[8][15-s-1+1]=n:this.modules[8][15-s-1]=n;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,o=this.moduleCount-1,n=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(s===6&&s--;;){for(var a=0;a<2;a++)if(this.modules[o][s-a]===null){var c=!1;i<e.length&&(c=(e[i]>>>n&1)===1);var l=gt.getMask(t,o,s-a);l&&(c=!c),this.modules[o][s-a]=c,n--,n===-1&&(i++,n=7)}if(o+=r,o<0||this.moduleCount<=o){o-=r,r=-r;break}}}};De.PAD0=236;De.PAD1=17;De.createData=function(e,t,r){for(var o=Pa.getRSBlocks(e,t),n=new ka,i=0;i<r.length;i++){var s=r[i];n.put(s.mode,4),n.put(s.getLength(),gt.getLengthInBits(s.mode,e)),s.write(n)}for(var a=0,c=0;c<o.length;c++)a+=o[c].dataCount;if(n.getLengthInBits()>a*8)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+a*8+")");for(n.getLengthInBits()+4<=a*8&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(!1);for(;!(n.getLengthInBits()>=a*8||(n.put(De.PAD0,8),n.getLengthInBits()>=a*8));)n.put(De.PAD1,8);return De.createBytes(n,o)};De.createBytes=function(e,t){for(var r=0,o=0,n=0,i=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,l=t[a].totalCount-c;o=Math.max(o,c),n=Math.max(n,l),i[a]=new Array(c);for(var u=0;u<i[a].length;u++)i[a][u]=255&e.buffer[u+r];r+=c;var f=gt.getErrorCorrectPolynomial(l),p=new ql(i[a],f.getLength()-1),d=p.mod(f);s[a]=new Array(f.getLength()-1);for(var h=0;h<s[a].length;h++){var w=h+d.getLength()-s[a].length;s[a][h]=w>=0?d.get(w):0}}for(var E=0,O=0;O<t.length;O++)E+=t[O].totalCount;for(var T=new Array(E),A=0,P=0;P<o;P++)for(var M=0;M<t.length;M++)P<i[M].length&&(T[A++]=i[M][P]);for(var g=0;g<n;g++)for(var b=0;b<t.length;b++)g<s[b].length&&(T[A++]=s[b][g]);return T};Oa.exports=De});var Ca=me((Kp,_a)=>{var Jl=Ia(),La=jo(),Zl="\x1B[40m \x1B[0m",jr="\x1B[47m \x1B[0m",zl=function(e){return e?Zl:jr},Go=function(e){return{times:function(t){return new Array(t).join(e)}}},eu=function(e,t){for(var r=new Array(e),o=0;o<e;o++)r[o]=t;return r};_a.exports={error:La.L,generate:function(e,t,r){typeof t=="function"&&(r=t,t={});var o=new Jl(-1,this.error);o.addData(e),o.make();var n="";if(t&&t.small){var i=!0,s=!1,a=o.getModuleCount(),c=o.modules.slice(),l=a%2===1;l&&c.push(eu(a,s));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=Go(u.BLACK_WHITE).times(a+3),p=Go(u.WHITE_BLACK).times(a+3);n+=f+`
|
|
8
8
|
`;for(var d=0;d<a;d+=2){n+=u.WHITE_ALL;for(var h=0;h<a;h++)c[d][h]===s&&c[d+1][h]===s?n+=u.WHITE_ALL:c[d][h]===s&&c[d+1][h]===i?n+=u.WHITE_BLACK:c[d][h]===i&&c[d+1][h]===s?n+=u.BLACK_WHITE:n+=u.BLACK_ALL;n+=u.WHITE_ALL+`
|
|
9
|
-
`}l||(n+=p)}else{var w=
|
|
10
|
-
`,o.modules.forEach(function(
|
|
11
|
-
`}),n+=w}r?r(n):console.log(n)},setErrorLevel:function(e){this.error=
|
|
12
|
-
`)){let r=t.trim();if(!r||r.startsWith("#"))continue;let o=r.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*"?(.*?)"?$/);o&&!process.env[o[1]]&&(process.env[o[1]]=o[2])}}for(let e of
|
|
13
|
-
`)}catch{}}function
|
|
14
|
-
=== SESSION ${new Date().toISOString()} pid=${process.pid} argv=${process.argv.slice(2).join(" ")} ===`),
|
|
15
|
-
`).filter(Boolean).slice(-e)}catch{return[]}}var
|
|
9
|
+
`}l||(n+=p)}else{var w=Go(jr).times(o.getModuleCount()+3);n+=w+`
|
|
10
|
+
`,o.modules.forEach(function(E){n+=jr,n+=E.map(zl).join(""),n+=jr+`
|
|
11
|
+
`}),n+=w}r?r(n):console.log(n)},setErrorLevel:function(e){this.error=La[e]||this.error}}});var ur=require("fs"),kn=require("path"),ii=require("url"),si=R(require("os"),1);var lr=R(require("dns"),1),Ee=R(require("path"),1),Zo=R(require("os"),1),se="9remote",Qr=process.env.NREMOTE_REGISTRY||`https://registry.npmjs.org/${se}/latest`,Ue=`${se}@latest`,Pe=process.env.NREMOTE_HOME||Ee.default.join(Zo.default.homedir(),".9remote"),G={ROOT:Pe,LOGS:Ee.default.join(Pe,"logs"),STATE:Ee.default.join(Pe,"state"),CONFIG:Ee.default.join(Pe,"config"),BIN:Ee.default.join(Pe,"bin"),PIDS:Ee.default.join(Pe,"pids"),BUFFERS:Ee.default.join(Pe,"buffers"),DAEMON:Ee.default.join(Pe,"daemon"),AI_SESSIONS:Ee.default.join(Pe,"ai-sessions"),BACKGROUNDS:Ee.default.join(Pe,"backgrounds")},Rn=new lr.default.promises.Resolver;Rn.setServers(["1.1.1.1","1.0.0.1","8.8.8.8"]);var Xr=lr.default.lookup,nc=/^(\d{1,3}\.){3}\d{1,3}$|^::1$|^[0-9a-f:]+$/i;lr.default.lookup=(e,t,r)=>{if(typeof t=="function"&&(r=t,t={}),e==="localhost"||nc.test(e))return Xr(e,t,r);(async()=>{if(t.family===6)return{addrs:await Rn.resolve6(e),family:6};if(t.family===4)return{addrs:await Rn.resolve4(e),family:4};let[n,i]=await Promise.allSettled([Rn.resolve4(e),Rn.resolve6(e)]);return n.status==="fulfilled"&&n.value?.length?{addrs:n.value,family:4}:i.status==="fulfilled"&&i.value?.length?{addrs:i.value,family:6}:null})().then(n=>{if(!n?.addrs?.length)return Xr(e,t,r);t.all?r(null,n.addrs.map(i=>({address:i,family:n.family}))):r(null,n.addrs[0],n.family)}).catch(()=>Xr(e,t,r))};var k=2208,zo=process.execPath,ei=(e=process.env)=>process.versions.electron?{...e,ELECTRON_RUN_AS_NODE:"1"}:{...e};var qo=5173,Jo=3e3;var Su=[`http://localhost:${k}`,`http://127.0.0.1:${k}`,`http://localhost:${qo}`,`http://127.0.0.1:${qo}`,`http://localhost:${Jo}`,`http://127.0.0.1:${Jo}`],Pn={fileName:"agent.log",rotatedName:"agent.log.1",maxBytes:2*1024*1024,cleanupAfterDays:7},ti=60,I={STOPPED:0,PREPARING:1,CONNECTING:2,TUNNELING:3,VERIFYING:4,READY:5},ni={showTunnelUrlInMenu:!1};var ri={CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN:"1"};var oi={checkIntervalMs:3e4,requestTimeoutMs:5e3},fe={server:{strategy:"exp",baseMs:1e3,maxMs:6e4},tunnelRestart:{strategy:"exp",baseMs:2e3,maxMs:3e5},tunnelSpawn:{strategy:"linear",baseMs:5e3,maxMs:6e4},tunnelRateLimit:{strategy:"exp",baseMs:6e4,maxMs:9e5},internet:{strategy:"linear",baseMs:3e3,maxMs:6e4},sse:{strategy:"linear",baseMs:2e3,maxMs:2e3},urlSync:{strategy:"linear",baseMs:5e3,maxMs:6e4}},rc={Accept:"application/json, text/plain, */*","Accept-Language":"en-US,en;q=0.9","Cache-Control":"no-cache",Pragma:"no-cache","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"};function H(e,t={}){return fetch(e,{...t,headers:{...rc,...t.headers}})}var oc=(0,kn.dirname)((0,ii.fileURLToPath)(__importMetaUrl)),ic=[(0,kn.join)(si.default.homedir(),".9remote",".env"),(0,kn.join)(oc,"..",".env")];function sc(e){for(let t of e.split(`
|
|
12
|
+
`)){let r=t.trim();if(!r||r.startsWith("#"))continue;let o=r.match(/^([A-Z_][A-Z0-9_]*)\s*=\s*"?(.*?)"?$/);o&&!process.env[o[1]]&&(process.env[o[1]]=o[2])}}for(let e of ic)if((0,ur.existsSync)(e))try{sc((0,ur.readFileSync)(e,"utf8"))}catch{}for(let[e,t]of Object.entries(ri))process.env[e]||(process.env[e]=t);var zr=R(require("path"),1),vi=R(require("fs"),1),Ei=require("url");var ci=R(ai(),1),Jr=R(require("crypto"),1),{machineIdSync:ac}=ci.default;async function Ut(e=null){let t=e||process.env.MACHINE_ID_SALT||"9remote-salt";try{let r=ac();return Jr.default.createHash("sha256").update(r+t).digest("hex").substring(0,16)}catch(r){return console.error("Error getting machine ID:",r),Jr.default.randomUUID().replace(/-/g,"").substring(0,16)}}var fi=R(require("crypto"),1),li="abcdefghijklmnpqrstuvwxyz123456789",cc=8;function ui(){let e="";for(let t=0;t<cc;t++)e+=li[fi.default.randomInt(li.length)];return e}function Ft(e){return`sk-${(e||"").slice(0,8).toLowerCase()}-${ui()}-${ui()}`}function lc(e){return/^sk-[a-z0-9]{8}-[a-np-z1-9]{8}-[a-np-z1-9]{8}$/.test(e||"")}function V(e){if(!lc(e))return e||null;let t=e.split("-");return`${t[0]}-${t[1]}-${t[2]}`}function fr(e){return!e||e.length<8?"sk-***":`${e.slice(0,3)}***${e.slice(-4)}`}var ae=R(require("fs"),1),Ln=R(require("path"),1);var pe=require("fs"),pi=require("path"),uc=0;function Fe(e,t,r={}){let{mode:o=384,spaces:n=2}=r;(0,pe.mkdirSync)((0,pi.dirname)(e),{recursive:!0});let i=`${e}.${process.pid}.${++uc}.tmp`;try{(0,pe.writeFileSync)(i,JSON.stringify(t,null,n),{mode:o}),(0,pe.renameSync)(i,e)}catch(s){try{(0,pe.existsSync)(i)&&(0,pe.unlinkSync)(i)}catch{}throw s}}function di(e,t=null){try{return(0,pe.existsSync)(e)?JSON.parse((0,pe.readFileSync)(e,"utf8")):t}catch{return t}}var Ou=G.STATE,In=Ln.default.join(G.STATE,"state.json"),Zr=Ln.default.join(G.ROOT,"keys.json"),pr=Ln.default.join(G.STATE,"cmd.json"),mi=Ln.default.join(G.STATE,"settings.json");function Kt(){for(let e of[G.ROOT,G.STATE])ae.default.existsSync(e)||ae.default.mkdirSync(e,{recursive:!0})}function hi(){try{return Kt(),ae.default.existsSync(In)?JSON.parse(ae.default.readFileSync(In,"utf8")):null}catch{return null}}function _n(e){try{Kt(),Fe(In,e)}catch(t){console.error("Error saving state:",t)}}function gi(){try{ae.default.existsSync(In)&&ae.default.unlinkSync(In)}catch{}}function X(){try{return Kt(),ae.default.existsSync(mi)?JSON.parse(ae.default.readFileSync(mi,"utf8"))||{}:{}}catch{return{}}}function dr(){try{return Kt(),ae.default.existsSync(Zr)?JSON.parse(ae.default.readFileSync(Zr,"utf8")):{machineId:null,key:null,name:"Default",createdAt:null}}catch{return{machineId:null,key:null,name:"Default",createdAt:null}}}function Ht(e){try{Kt(),Fe(pr,{cmd:e,ts:Date.now()},{spaces:0})}catch{}}function yi(){try{if(!ae.default.existsSync(pr))return null;let e=JSON.parse(ae.default.readFileSync(pr,"utf8"));return ae.default.unlinkSync(pr),e.cmd}catch{return null}}function Et(e,t,r="Default"){try{Kt();let o={machineId:e,key:t,name:r,createdAt:new Date().toISOString()};return Fe(Zr,o),o}catch(o){return console.error("Error saving key:",o),null}}function wi(){return process.env.CODESPACES==="true"}var fc=zr.default.dirname((0,Ei.fileURLToPath)(__importMetaUrl));async function nt(){let e=await Ut();if(wi()&&process.env.NREMOTE_API_KEY)return Et(e,process.env.NREMOTE_API_KEY,"Codespace");let t=dr();if(!t.key){let r=Ft(e);t=Et(e,r,"Default")}return t}function ke(){return"3.0.24"}var Oe=R(require("fs"),1),eo=R(require("path"),1);var hr=G.LOGS,Cn=eo.default.join(hr,Pn.fileName),gr=eo.default.join(hr,Pn.rotatedName),Si=!1,Ti=null;function pc(){Oe.default.existsSync(hr)||Oe.default.mkdirSync(hr,{recursive:!0})}function dc(){try{if(Oe.default.statSync(Cn).size<Pn.maxBytes)return;try{Oe.default.rmSync(gr,{force:!0})}catch{}Oe.default.renameSync(Cn,gr)}catch{}}function mc(){try{let e=Oe.default.statSync(gr);Date.now()-e.mtimeMs>Pn.cleanupAfterDays*864e5&&Oe.default.rmSync(gr,{force:!0})}catch{}}function to(e){try{dc(),Oe.default.appendFileSync(Cn,e+`
|
|
13
|
+
`)}catch{}}function mr(e){return e.map(t=>{if(t instanceof Error)return t.stack||t.message;if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)}).join(" ")}function bi(){let e=new Date,t=(r,o=2)=>String(r).padStart(o,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}`}var hc=/\x1b\[[0-9;]*m/g,gc=/https?:\/\/[^\s]+/g;function yc(e){return String(e).replace(hc,"").replace(gc,"").replace(/\s+$/g,"")}function Wt(e,t,r){let o=yc(r);if(!o)return;let n=t==="info"?e:`${e}:${t}`,i=`${bi()} [${n}] ${o}`;if(to(i),Ti)try{Ti(i)}catch{}}function wc(){process.on("uncaughtException",e=>Wt("crash","error",`uncaughtException: ${e?.stack||e?.message||e}`)),process.on("unhandledRejection",e=>{let t=e instanceof Error?e.stack||e.message:String(e);Wt("crash","error",`unhandledRejection: ${t}`)}),process.on("exit",e=>to(`${bi()} [exit] code=${e} pid=${process.pid}`))}function Ai(){Si||(Si=!0,pc(),mc(),to(`
|
|
14
|
+
=== SESSION ${new Date().toISOString()} pid=${process.pid} argv=${process.argv.slice(2).join(" ")} ===`),wc())}function xi(e=60){try{return Oe.default.readFileSync(Cn,"utf8").split(`
|
|
15
|
+
`).filter(Boolean).slice(-e)}catch{return[]}}var vc=process.env.NODE_ENV==="development"||process.env.AGENT_DEBUG==="1";function B(e){return{debug:(...t)=>{vc&&Wt(e,"debug",mr(t))},info:(...t)=>Wt(e,"info",mr(t)),warn:(...t)=>Wt(e,"warn",mr(t)),error:(...t)=>Wt(e,"error",mr(t))}}var Mn=Cn;var Ri=(e=0)=>t=>`\x1B[${t+e}m`,Pi=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ki=(e=0)=>(t,r,o)=>`\x1B[${38+e};2;${t};${r};${o}m`,U={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Uu=Object.keys(U.modifier),Ec=Object.keys(U.color),Sc=Object.keys(U.bgColor),Fu=[...Ec,...Sc];function Tc(){let e=new Map;for(let[t,r]of Object.entries(U)){for(let[o,n]of Object.entries(r))U[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[o]=U[o],e.set(n[0],n[1]);Object.defineProperty(U,t,{value:r,enumerable:!1})}return Object.defineProperty(U,"codes",{value:e,enumerable:!1}),U.color.close="\x1B[39m",U.bgColor.close="\x1B[49m",U.color.ansi=Ri(),U.color.ansi256=Pi(),U.color.ansi16m=ki(),U.bgColor.ansi=Ri(10),U.bgColor.ansi256=Pi(10),U.bgColor.ansi16m=ki(10),Object.defineProperties(U,{rgbToAnsi256:{value(t,r,o){return t===r&&r===o?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[o]=r;o.length===3&&(o=[...o].map(i=>i+i).join(""));let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>U.rgbToAnsi256(...U.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,o,n;if(t>=232)r=((t-232)*10+8)/255,o=r,n=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,o=Math.floor(a/6)/5,n=a%6/5}let i=Math.max(r,o,n)*2;if(i===0)return 30;let s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,o)=>U.ansi256ToAnsi(U.rgbToAnsi256(t,r,o)),enumerable:!1},hexToAnsi:{value:t=>U.ansi256ToAnsi(U.hexToAnsi256(t)),enumerable:!1}}),U}var bc=Tc(),Se=bc;var wr=R(require("node:process"),1),Ii=R(require("node:os"),1),no=R(require("node:tty"),1);function he(e,t=globalThis.Deno?globalThis.Deno.args:wr.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",o=t.indexOf(r+e),n=t.indexOf("--");return o!==-1&&(n===-1||o<n)}var{env:F}=wr.default,yr;he("no-color")||he("no-colors")||he("color=false")||he("color=never")?yr=0:(he("color")||he("colors")||he("color=true")||he("color=always"))&&(yr=1);function Ac(){if("FORCE_COLOR"in F)return F.FORCE_COLOR==="true"?1:F.FORCE_COLOR==="false"?0:F.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(F.FORCE_COLOR,10),3)}function xc(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Rc(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let o=Ac();o!==void 0&&(yr=o);let n=r?yr:o;if(n===0)return 0;if(r){if(he("color=16m")||he("color=full")||he("color=truecolor"))return 3;if(he("color=256"))return 2}if("TF_BUILD"in F&&"AGENT_NAME"in F)return 1;if(e&&!t&&n===void 0)return 0;let i=n||0;if(F.TERM==="dumb")return i;if(wr.default.platform==="win32"){let s=Ii.default.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in F)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in F)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in F)||F.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in F)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(F.TEAMCITY_VERSION)?1:0;if(F.COLORTERM==="truecolor"||F.TERM==="xterm-kitty"||F.TERM==="xterm-ghostty"||F.TERM==="wezterm")return 3;if("TERM_PROGRAM"in F){let s=Number.parseInt((F.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(F.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(F.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(F.TERM)||"COLORTERM"in F?1:i}function Oi(e,t={}){let r=Rc(e,{streamIsTTY:e&&e.isTTY,...t});return xc(r)}var Pc={stdout:Oi({isTTY:no.default.isatty(1)}),stderr:Oi({isTTY:no.default.isatty(2)})},Li=Pc;function _i(e,t,r){let o=e.indexOf(t);if(o===-1)return e;let n=t.length,i=0,s="";do s+=e.slice(i,o)+t+r,i=o+n,o=e.indexOf(t,i);while(o!==-1);return s+=e.slice(i),s}function Ci(e,t,r,o){let n=0,i="";do{let s=e[o-1]==="\r";i+=e.slice(n,s?o-1:o)+t+(s?`\r
|
|
16
16
|
`:`
|
|
17
17
|
`)+r,n=o+1,o=e.indexOf(`
|
|
18
|
-
`,n)}while(o!==-1);return i+=e.slice(n),i}var{stdout:
|
|
19
|
-
`);return i!==-1&&(t=
|
|
20
|
-
`),(0,
|
|
18
|
+
`,n)}while(o!==-1);return i+=e.slice(n),i}var{stdout:Mi,stderr:$i}=Li,ro=Symbol("GENERATOR"),jt=Symbol("STYLER"),$n=Symbol("IS_EMPTY"),Ni=["ansi","ansi","ansi256","ansi16m"],Gt=Object.create(null),kc=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Mi?Mi.level:0;e.level=t.level===void 0?r:t.level};var Oc=e=>{let t=(...r)=>r.join(" ");return kc(t,e),Object.setPrototypeOf(t,Nn.prototype),t};function Nn(e){return Oc(e)}Object.setPrototypeOf(Nn.prototype,Function.prototype);for(let[e,t]of Object.entries(Se))Gt[e]={get(){let r=vr(this,io(t.open,t.close,this[jt]),this[$n]);return Object.defineProperty(this,e,{value:r}),r}};Gt.visible={get(){let e=vr(this,this[jt],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var oo=(e,t,r,...o)=>e==="rgb"?t==="ansi16m"?Se[r].ansi16m(...o):t==="ansi256"?Se[r].ansi256(Se.rgbToAnsi256(...o)):Se[r].ansi(Se.rgbToAnsi(...o)):e==="hex"?oo("rgb",t,r,...Se.hexToRgb(...o)):Se[r][e](...o),Ic=["rgb","hex","ansi256"];for(let e of Ic){Gt[e]={get(){let{level:r}=this;return function(...o){let n=io(oo(e,Ni[r],"color",...o),Se.color.close,this[jt]);return vr(this,n,this[$n])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Gt[t]={get(){let{level:r}=this;return function(...o){let n=io(oo(e,Ni[r],"bgColor",...o),Se.bgColor.close,this[jt]);return vr(this,n,this[$n])}}}}var Lc=Object.defineProperties(()=>{},{...Gt,level:{enumerable:!0,get(){return this[ro].level},set(e){this[ro].level=e}}}),io=(e,t,r)=>{let o,n;return r===void 0?(o=e,n=t):(o=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:o,closeAll:n,parent:r}},vr=(e,t,r)=>{let o=(...n)=>_c(o,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(o,Lc),o[ro]=e,o[jt]=t,o[$n]=r,o},_c=(e,t)=>{if(e.level<=0||!t)return e[$n]?"":t;let r=e[jt];if(r===void 0)return t;let{openAll:o,closeAll:n}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=_i(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
|
|
19
|
+
`);return i!==-1&&(t=Ci(t,n,o,i)),o+t+n};Object.defineProperties(Nn.prototype,Gt);var Cc=Nn(),Yu=Nn({level:$i?$i.level:0});var m=Cc;var q=require("fs"),zi=require("url"),Un=require("child_process"),_e=R(require("path"),1),Qt=R(require("os"),1);var Vt=R(require("fs"),1),so=R(require("path"),1),Di=R(require("os"),1),Bi=require("child_process"),Er=so.default.join(Di.default.homedir(),".9remote","pids");function Mc(){try{Vt.default.existsSync(Er)||Vt.default.mkdirSync(Er,{recursive:!0})}catch{}}function ao(e){return so.default.join(Er,`${e}.pid`)}function Ie(e,t){if(t)try{Mc(),Vt.default.writeFileSync(ao(e),String(t))}catch{}}function Dn(e){try{let t=Vt.default.readFileSync(ao(e),"utf8").trim(),r=parseInt(t,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function Ke(e){try{Vt.default.unlinkSync(ao(e))}catch{}}function co(e){if(!e)return!1;try{return process.kill(e,0),!0}catch{return!1}}function $c(e){let t=Dn(e);if(Ke(e),!t)return!1;try{process.platform==="win32"?(0,Bi.execSync)(`taskkill /F /T /PID ${t}`,{stdio:"ignore",windowsHide:!0}):process.kill(t,"SIGKILL")}catch{}return!0}var Nc=["cloudflared","agent"];function Ui(){for(let e of Nc)$c(e)}function Fi(){return Er}var bt=require("child_process"),N=require("fs"),St=require("path"),uo=R(require("os"),1),Tt=R(require("path"),1),Hi=require("url");var Tr=(0,St.join)(G.LOGS,"autostart.log"),Sr="cc.9remote.agent",br="9Remote",Ar=["--tray","--skip-update","--start"],Bn=uo.default.homedir(),Ki=Tt.default.dirname((0,Hi.fileURLToPath)(__importMetaUrl)),te={darwin:(0,St.join)(Bn,"Library","LaunchAgents",`${Sr}.plist`),linux:(0,St.join)(Bn,".config","autostart",`${Sr}.desktop`),linuxSystemd:(0,St.join)(Bn,".config","systemd","user",`${Sr}.service`),win:(0,St.join)(process.env.APPDATA||"","Microsoft","Windows","Start Menu","Programs","Startup",`${br}.vbs`)};function rt(){for(let e=Ki,t=null;e!==t;t=e,e=Tt.default.dirname(e)){let r=Tt.default.join(e,"package.json");if((0,N.existsSync)(r)){try{let o=JSON.parse((0,N.readFileSync)(r,"utf8"));if(o.name!==se)continue;let n=typeof o.bin=="string"?o.bin:o.bin?.[se];if(n){let i=Tt.default.resolve(e,n);if((0,N.existsSync)(i))return i}}catch{}break}}return process.argv[1]||Tt.default.resolve(Ki,"..","index.js")}function Le(){return process.execPath}function Wi(){return process.versions.electron?"env ELECTRON_RUN_AS_NODE=1 ":""}function ji(e){let t=Le(),r=rt();if(process.platform==="win32"){let n=e.join(" "),i=(0,St.join)(uo.default.tmpdir(),`${se}-launch.vbs`);return(0,N.writeFileSync)(i,`CreateObject("WScript.Shell").Run """${t}"" ""${r}"" ${n}", 0, False
|
|
20
|
+
`),(0,bt.execFile)("wscript.exe",[i],{windowsHide:!0}).unref?.(),null}let o=(0,bt.spawn)(t,[r,...e],{detached:!0,stdio:"ignore"});return o.unref(),o.pid||null}function Gi(){let e=Tt.default.dirname(Le()),t=["/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin","/opt/homebrew/bin"];return t.includes(e)||t.unshift(e),t.join(":")}function lo(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Dc(e,t){let r=[e,t,...Ar].map(o=>` <string>${lo(o)}</string>`).join(`
|
|
21
21
|
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
22
22
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
23
23
|
<plist version="1.0">
|
|
24
24
|
<dict>
|
|
25
25
|
<key>Label</key>
|
|
26
|
-
<string>${
|
|
26
|
+
<string>${Sr}</string>
|
|
27
27
|
<key>ProgramArguments</key>
|
|
28
28
|
<array>
|
|
29
29
|
${r}
|
|
@@ -35,43 +35,43 @@ ${r}
|
|
|
35
35
|
<key>EnvironmentVariables</key>
|
|
36
36
|
<dict>
|
|
37
37
|
<key>PATH</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${lo(Gi())}</string>
|
|
39
39
|
<key>HOME</key>
|
|
40
|
-
<string>${
|
|
40
|
+
<string>${lo(Bn)}</string>
|
|
41
41
|
</dict>
|
|
42
42
|
<key>StandardOutPath</key>
|
|
43
|
-
<string>${
|
|
43
|
+
<string>${Tr}</string>
|
|
44
44
|
<key>StandardErrorPath</key>
|
|
45
|
-
<string>${
|
|
45
|
+
<string>${Tr}</string>
|
|
46
46
|
</dict>
|
|
47
47
|
</plist>
|
|
48
|
-
`}function
|
|
49
|
-
WshShell.Run """${
|
|
50
|
-
`}function
|
|
48
|
+
`}function Bc(){return(0,N.existsSync)(te.darwin)}function Uc(){let e=Ar.join(" ");return`Set WshShell = CreateObject("WScript.Shell")
|
|
49
|
+
WshShell.Run """${Le()}"" ""${rt()}"" ${e}", 0, False
|
|
50
|
+
`}function Fc(){try{(0,bt.execFileSync)("reg",["DELETE","HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run","/V",br,"/F"],{windowsHide:!0,stdio:"ignore"})}catch{}}function Kc(){return(0,N.existsSync)(te.win)}function Hc(){let e=`${Le()} ${rt()} ${Ar.join(" ")}`;return`[Desktop Entry]
|
|
51
51
|
Type=Application
|
|
52
|
-
Name=${
|
|
52
|
+
Name=${br}
|
|
53
53
|
Exec=${e}
|
|
54
54
|
X-GNOME-Autostart-enabled=true
|
|
55
55
|
NoDisplay=false
|
|
56
56
|
Terminal=false
|
|
57
|
-
`}function
|
|
58
|
-
Description=${
|
|
57
|
+
`}function Wc(){let e=Ar.map(t=>`'${t}'`).join(" ");return`[Unit]
|
|
58
|
+
Description=${br} Agent
|
|
59
59
|
After=network-online.target
|
|
60
60
|
Wants=network-online.target
|
|
61
61
|
|
|
62
62
|
[Service]
|
|
63
63
|
Type=simple
|
|
64
|
-
ExecStart=${
|
|
64
|
+
ExecStart=${Le()} ${rt()} ${e}
|
|
65
65
|
Restart=always
|
|
66
66
|
RestartSec=10
|
|
67
|
-
Environment=PATH=${
|
|
68
|
-
Environment=HOME=${
|
|
69
|
-
StandardOutput=append:${
|
|
70
|
-
StandardError=append:${
|
|
67
|
+
Environment=PATH=${Gi()}
|
|
68
|
+
Environment=HOME=${Bn}
|
|
69
|
+
StandardOutput=append:${Tr}
|
|
70
|
+
StandardError=append:${Tr}
|
|
71
71
|
|
|
72
72
|
[Install]
|
|
73
73
|
WantedBy=default.target
|
|
74
|
-
`}function
|
|
74
|
+
`}function jc(e){try{return(0,bt.execFileSync)("systemctl",["--user",...e],{stdio:"ignore"}),!0}catch{return!1}}function Gc(){return(0,N.existsSync)(te.linux)||(0,N.existsSync)(te.linuxSystemd)}async function Vc(){try{if(process.platform==="darwin")return Bc();if(process.platform==="win32")return await Kc();if(process.platform==="linux")return Gc()}catch{}return!1}async function Vi(){try{if(process.platform==="win32"&&Fc(),!await Vc())return!1;if(process.platform==="darwin"){let e=Dc(Le(),rt());return((0,N.existsSync)(te.darwin)?(0,N.readFileSync)(te.darwin,"utf8"):"")===e?!1:((0,N.writeFileSync)(te.darwin,e),!0)}if(process.platform==="win32"){let e=Uc();return((0,N.existsSync)(te.win)?(0,N.readFileSync)(te.win,"utf8"):"")===e?!1:((0,N.writeFileSync)(te.win,e),!0)}if(process.platform==="linux"){if((0,N.existsSync)(te.linuxSystemd)){let e=Wc();return(0,N.readFileSync)(te.linuxSystemd,"utf8")===e?!1:((0,N.writeFileSync)(te.linuxSystemd,e),jc(["daemon-reload"]),!0)}if((0,N.existsSync)(te.linux)){let e=Hc();return(0,N.readFileSync)(te.linux,"utf8")===e?!1:((0,N.writeFileSync)(te.linux,e),!0)}}}catch{}return!1}var zu=process.env.NODE_ENV==="development";var _=process.env.NREMOTE_WORKER_URL||"https://9remote.cc",Yi=3e4,Xi=500,fo=300,Te={cmdMs:1e3,pendingApprovalMs:3e3,statsMs:5e3,serverReadyIntervalMs:200,serverReadyTimeoutMs:5e3,bgServerReadyTimeoutMs:15e3,bgServerReadyIntervalMs:300},ot={intervalMs:2e3,timeoutMs:12e4,fetchTimeoutMs:5e3,dnsTimeoutMs:2e3,maxLogEntries:80,postReadyHoldMs:2e3},ge={killCloudflaredMs:500,killCloudflaredTuiMs:300,serverBootMs:2e3,trayReadyMs:1e3,postReadyHoldMs:2e3,bgSpawnFlushMs:400};var He={maxLogLines:200,headerWidth:44},Yt={checkIntervalMs:36e5,connectCheckDebounceMs:9e5,maxRetry:3,retryDelayMs:3e3,verifyTimeoutMs:15e3,lockTtlMs:3e5,lockFile:"update.lock"},Qi=5e3,po=12e4,xr=1500,qi=2,Ji=3e4,ce={orange:m.rgb(230,138,110),orangeDim:m.rgb(200,120,95)};var Xt=B("update"),Yc=_e.default.dirname((0,zi.fileURLToPath)(__importMetaUrl)),es=8e3;var Pr=2208,mo=_e.default.join(Qt.default.homedir(),".9remote","cloudflared.pid");function Xc(){try{Ui()}catch{}try{if((0,q.existsSync)(mo)){let e=parseInt((0,q.readFileSync)(mo,"utf8"));if(Number.isFinite(e))try{process.kill(e)}catch{}try{(0,q.unlinkSync)(mo)}catch{}}}catch{}try{process.platform==="win32"?(0,Un.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${Pr}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,Un.execSync)(`lsof -ti:${Pr} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}if(process.platform==="win32"){let e=Date.now()+1500;for(;Date.now()<e;);}}function ts(){return"3.0.24"}function ns(e,t){let r=e.split(".").map(Number),o=t.split(".").map(Number);for(let n=0;n<3;n++){if(o[n]>r[n])return!0;if(o[n]<r[n])return!1}return!1}function Qc(){return process.env.CODESPACES==="true"||process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN?"GitHub Codespaces":(0,q.existsSync)("/.dockerenv")?"Docker":null}function kr(){Xc()}async function rs(){try{let e=ts();if(!e)return null;let t=await H(Qr,{signal:AbortSignal.timeout(es)});if(!t.ok)return null;let{version:r}=await t.json();return r&&ns(e,r)?{current:e,latest:r}:null}catch{return null}}var Rr=_e.default.join(G.STATE,Yt.lockFile);function qc(){try{if((0,q.existsSync)(Rr)){let{pid:e,ts:t}=JSON.parse((0,q.readFileSync)(Rr,"utf8")),r=Date.now()-t<Yt.lockTtlMs,o=!1;try{process.kill(e,0),o=!0}catch{}if(r&&o)return!1}}catch{}try{(0,q.writeFileSync)(Rr,JSON.stringify({pid:process.pid,ts:Date.now()}))}catch{}return!0}async function Jc(){try{let e=await H(Qr,{signal:AbortSignal.timeout(es)});if(!e.ok)return null;let{version:t}=await e.json();return t||null}catch{return null}}function Zc(){try{if(process.env.NREMOTE_REGISTRY)return`--registry ${new URL(process.env.NREMOTE_REGISTRY).origin}`}catch{}return""}function zc(){let e=rt(),t=_e.default.sep,r=`${t}lib${t}node_modules${t}`,o=e.indexOf(r);return o>0?{global:"-g",prefix:`--prefix "${e.slice(0,o)}"`}:(o=e.indexOf(`${t}node_modules${t}`),o>0?{global:"",prefix:`--prefix "${e.slice(0,o)}"`}:{global:"-g",prefix:""})}function Zi(){let e=process.argv.slice(2).filter(n=>n!=="--skip-update"),r=e.includes("ui")||e.includes("start")||e.some(n=>["--tray","--auto","--start"].includes(n))?e.join(" "):"--tray";return`${r.includes("--start")||r.includes("start")?r:`${r} --start`} --skip-update`}function el(){let e=process.env.NREMOTE_NPM_CLI;return e&&(0,q.existsSync)(e)?process.platform==="win32"?`"${Le()}" "${e}"`:`env ELECTRON_RUN_AS_NODE=1 "${Le()}" "${e}"`:"npm"}function tl({currentVersion:e,latest:t,agentPid:r}){let o=Fi(),n=Zc(),i=Le(),s=Wi(),a=rt(),c=Rr,{global:l,prefix:u}=zc(),f=`${l} --prefer-online --no-audit --no-fund ${n} ${u}`.trim(),p=el();if(process.platform==="win32"){let w=_e.default.join(Qt.default.tmpdir(),`${se}-restart.vbs`),E=`@echo off
|
|
75
75
|
setlocal EnableDelayedExpansion
|
|
76
76
|
set "NODE=${i}"
|
|
77
77
|
set "CLI=${a}"
|
|
@@ -90,16 +90,16 @@ for %%N in (cloudflared agent) do (
|
|
|
90
90
|
del /f /q "${o}\\%%N.pid" >nul 2>&1
|
|
91
91
|
)
|
|
92
92
|
)
|
|
93
|
-
for /f "tokens=5" %%a in ('netstat -aon ^| findstr :${
|
|
93
|
+
for /f "tokens=5" %%a in ('netstat -aon ^| findstr :${Pr}') do taskkill /F /PID %%a >nul 2>&1
|
|
94
94
|
timeout /t 3 /nobreak >nul
|
|
95
95
|
|
|
96
96
|
set ATTEMPT=0
|
|
97
97
|
:installloop
|
|
98
98
|
set /a ATTEMPT+=1
|
|
99
|
-
call ${p} install ${
|
|
99
|
+
call ${p} install ${Ue} ${f} >nul 2>&1
|
|
100
100
|
if !ERRORLEVEL! EQU 0 goto verify
|
|
101
|
-
if !ATTEMPT! GEQ ${
|
|
102
|
-
call ${p} install ${
|
|
101
|
+
if !ATTEMPT! GEQ ${Yt.maxRetry} (
|
|
102
|
+
call ${p} install ${Ue} ${f} --omit=optional >nul 2>&1
|
|
103
103
|
goto verify
|
|
104
104
|
)
|
|
105
105
|
timeout /t 3 /nobreak >nul
|
|
@@ -107,7 +107,7 @@ goto installloop
|
|
|
107
107
|
|
|
108
108
|
:verify
|
|
109
109
|
set "NEWVER="
|
|
110
|
-
set "VERFILE=%TEMP%\\${
|
|
110
|
+
set "VERFILE=%TEMP%\\${se}-ver.txt"
|
|
111
111
|
"%NODE%" "%CLI%" --version > "%VERFILE%" 2>nul
|
|
112
112
|
REM Read first line + strip surrounding whitespace/CR via for/f tokens
|
|
113
113
|
for /f "usebackq tokens=* delims= " %%V in ("%VERFILE%") do (
|
|
@@ -118,15 +118,15 @@ for /f "usebackq tokens=* delims= " %%V in ("%VERFILE%") do (
|
|
|
118
118
|
del /f /q "%VERFILE%" >nul 2>&1
|
|
119
119
|
if defined NEWVER set "NEWVER=!NEWVER: =!"
|
|
120
120
|
if not "!NEWVER!"=="${t}" (
|
|
121
|
-
call ${p} install ${
|
|
121
|
+
call ${p} install ${se}@${e} ${f} >nul 2>&1
|
|
122
122
|
)
|
|
123
123
|
del /f /q "${c}" >nul 2>&1
|
|
124
124
|
|
|
125
125
|
wscript "${w}"
|
|
126
126
|
exit /b 0
|
|
127
|
-
`,O=
|
|
128
|
-
`);let
|
|
129
|
-
`),{shellCmd:["wscript.exe",[
|
|
127
|
+
`,O=_e.default.join(Qt.default.tmpdir(),`${se}-update.bat`);(0,q.writeFileSync)(O,E),(0,q.writeFileSync)(w,`CreateObject("WScript.Shell").Run """%NODE%"" ""%CLI%"" ${Zi()}", 0, False`.replace("%NODE%",i).replace("%CLI%",a)+`
|
|
128
|
+
`);let T=_e.default.join(Qt.default.tmpdir(),`${se}-update.vbs`);return(0,q.writeFileSync)(T,`CreateObject("WScript.Shell").Run "cmd /c ""${O}""", 0, False
|
|
129
|
+
`),{shellCmd:["wscript.exe",[T]],windowsVerbatim:!1}}let d=`#!/bin/bash
|
|
130
130
|
# Wait for agent to exit so it releases the cli.cjs file lock
|
|
131
131
|
while kill -0 ${r} 2>/dev/null; do sleep 1; done
|
|
132
132
|
|
|
@@ -139,16 +139,16 @@ for name in cloudflared agent; do
|
|
|
139
139
|
rm -f "$f"
|
|
140
140
|
fi
|
|
141
141
|
done
|
|
142
|
-
lsof -ti:${
|
|
142
|
+
lsof -ti:${Pr} | xargs kill -9 2>/dev/null || true
|
|
143
143
|
sleep 2
|
|
144
144
|
|
|
145
145
|
attempt=0
|
|
146
|
-
while [ $attempt -lt ${
|
|
146
|
+
while [ $attempt -lt ${Yt.maxRetry} ]; do
|
|
147
147
|
attempt=$((attempt+1))
|
|
148
148
|
echo "Installing (attempt $attempt)..."
|
|
149
|
-
if ${p} install ${
|
|
150
|
-
if [ $attempt -eq ${
|
|
151
|
-
${p} install ${
|
|
149
|
+
if ${p} install ${Ue} ${f}; then break; fi
|
|
150
|
+
if [ $attempt -eq ${Yt.maxRetry} ]; then
|
|
151
|
+
${p} install ${Ue} ${f} --omit=optional || true
|
|
152
152
|
fi
|
|
153
153
|
sleep 3
|
|
154
154
|
done
|
|
@@ -158,99 +158,102 @@ done
|
|
|
158
158
|
NEWVER=$(${s}"${i}" "${a}" --version 2>/dev/null | head -1 | sed 's/\x1B[[0-9;?]*[a-zA-Z]//g' | tr -d '[:space:]')
|
|
159
159
|
if [ "$NEWVER" != "${t}" ]; then
|
|
160
160
|
echo "Verify failed (got $NEWVER, want ${t}), rolling back to ${e}..."
|
|
161
|
-
${p} install ${
|
|
161
|
+
${p} install ${se}@${e} ${f} || true
|
|
162
162
|
fi
|
|
163
163
|
|
|
164
164
|
rm -f "${c}"
|
|
165
|
-
${
|
|
166
|
-
|
|
167
|
-
`)}function
|
|
165
|
+
${process.env.NREMOTE_REGISTRY?`export NREMOTE_REGISTRY="${process.env.NREMOTE_REGISTRY}"
|
|
166
|
+
`:""}${s}"${i}" "${a}" ${Zi()}
|
|
167
|
+
`,h=_e.default.join(Qt.default.tmpdir(),`${se}-update.sh`);return(0,q.writeFileSync)(h,d,{mode:493}),{shellCmd:["sh",[h]],windowsVerbatim:!1}}async function os(){let e=ts();if(!e)return Xt.warn("update skipped: no version (source run?)"),!1;let t=Qc();if(t)return Xt.warn(`update skipped: restricted env (${t})`),!1;let r=await Jc();if(!r)return Xt.warn("update skipped: registry unreachable"),!1;if(!ns(e,r))return Xt.info(`update skipped: ${e} >= registry ${r}`),!1;if(!qc())return Xt.warn("update skipped: lock held by another run"),!1;Xt.info(`update go: ${e} -> ${r}`);let{shellCmd:o,windowsVerbatim:n}=tl({currentVersion:e,latest:r,agentPid:process.pid});return(0,Un.spawn)(o[0],o[1],{detached:!0,stdio:"ignore",windowsHide:!0,windowsVerbatimArguments:n}).unref(),setTimeout(()=>process.exit(0),500),!0}var ys=R(require("os"),1);var Cr=R(require("readline"),1),ss=R(require("http"),1);var ho=require("child_process"),nl={screenRecording:"x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture",accessibility:"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"};function Or(e){let t=nl[e];t&&process.platform==="darwin"&&(0,ho.exec)(`open "${t}"`,()=>{})}function be({strategy:e,baseMs:t,maxMs:r},o){let n=Math.max(1,o),i=e==="exp"?t*Math.pow(2,n-1):t*n;return Math.min(i,r)}async function Ir({config:e,task:t,label:r="task",log:o=()=>{},ctx:n={}}){let i=0;for(;!n.cancelled;){i++;try{if(await t(i))return!0}catch(a){o(`\u274C ${r} attempt ${i} error: ${a?.message||a}`)}if(n.cancelled)return!1;let s=be(e,i);o(`\u{1F504} ${r} retry in ${s}ms (attempt ${i})`),await new Promise(a=>setTimeout(a,s))}return!1}var S={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",orange:"\x1B[38;2;230;138;110m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",white:"\x1B[37m"},as=()=>Math.min(44,process.stdout.columns||44);function yo(e,t=null){let o=as()-2,n=(a="")=>{let c=a.replace(/\x1b\[[0-9;]*m/g,""),l=Math.max(0,o-c.length);return S.orange+"\u2551"+S.reset+a+" ".repeat(l)+S.orange+"\u2551"+S.reset},i=(a,c=l=>l)=>{let l=a.replace(/\x1b\[[0-9;]*m/g,""),u=Math.floor((o-l.length)/2),f=o-l.length-u;return S.orange+"\u2551"+S.reset+" ".repeat(u)+c(a)+" ".repeat(f)+S.orange+"\u2551"+S.reset},s=["",S.orange+"\u2554"+"\u2550".repeat(o)+"\u2557"+S.reset,n(),i(`\u{1F680} 9Remote v${e}`,a=>S.bold+S.orange+a+S.reset),i("Remote terminal access from anywhere",a=>S.dim+a+S.reset),n()];return t&&(s.push(i(`\u2B06 New version v${t} available!`,a=>S.yellow+S.bold+a+S.reset)),s.push(i(`Run: npm i -g ${Ue}`,a=>S.dim+a+S.reset)),s.push(n())),s.push(S.orange+"\u255A"+"\u2550".repeat(o)+"\u255D"+S.reset),s.push(""),s.join(`
|
|
168
|
+
`)}function Jt(e,t=null){console.log(yo(e,t))}var is=["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"],go=[{label:"Preparing",desc:"Checking dependencies"},{label:"Connecting",desc:"Creating session"},{label:"Starting tunnel",desc:"Spawning tunnel"},{label:"Verifying tunnel",desc:"Health check"},{label:"Ready",desc:"Tunnel is live"}],rl=process.platform==="win32",ol=rl?120:80;process.on("exit",()=>process.stdout.write("\x1B[?25h"));var cs=(e,t)=>{process.stdout.write("\x1B[?25h"),process.listenerCount(e)<=1&&process.exit(t)};process.on("SIGINT",()=>cs("SIGINT",130));process.on("SIGTERM",()=>cs("SIGTERM",143));var We=0,At=null,Lr=0,Ce=-1,Fn=null,qt=null,_r=!1;function ls(){let e=[],t=Ce===go.length-1;return go.forEach((r,o)=>{let n=o===Ce&&Fn?Fn:r.desc;if(o<Ce||t&&o===Ce)e.push(` ${S.green}\u2713${S.reset} ${S.dim}${r.label}${S.reset}`),qt&&o===qt.afterIdx&&e.push(` ${S.green}\u2713${S.reset} ${S.cyan}${qt.text}${S.reset}`);else if(o===Ce){let i=is[Lr%is.length];e.push(` ${S.orange}${i}${S.reset} ${S.bold}${r.label}${S.reset} ${S.dim}${n}${S.reset}`)}else e.push(` ${S.dim}\u25CB ${r.label}${S.reset}`)}),e}function us(){let e=ls();We>0&&process.stdout.write(`\x1B[${We}A\x1B[0J`),process.stdout.write(e.join(`
|
|
168
169
|
`)+`
|
|
169
|
-
`),
|
|
170
|
-
`))process.stdout.write(
|
|
171
|
-
`);e&&process.stdout.write(`${
|
|
170
|
+
`),We=e.length}function fs(){if(We===0||Ce<0)return;let e=ls();if(e.length!==We){us();return}let t=Ce+(qt&&qt.afterIdx<Ce?1:0),r=We-t;process.stdout.write(`\x1B[${r}A\r\x1B[2K${e[t]}\x1B[${r}B\r`)}function il(){_r||(process.stdout.write("\x1B[?25l"),_r=!0)}function ps(){_r&&(process.stdout.write("\x1B[?25h"),_r=!1)}function ds(e,t=!1,r=null){At&&(clearInterval(At),At=null),Ce=e,Fn=r,Lr=0,t||(We=0),us(),e>=0&&e<go.length-1?(il(),At=setInterval(()=>{Lr++,fs()},ol)):ps()}function Zt(e){Fn=e,We>0&&fs()}function ms(){At&&(clearInterval(At),At=null),ps(),We=0,Ce=-1,Fn=null,qt=null,Lr=0}function Me(e,t,r=0,o="",n=null,i=null){return new Promise(s=>{let a=r,c=!0,l=!0,u=process.platform==="win32",f=()=>{if(!c)return;process.stdout.write(l?"\x1B[2J\x1B[H":"\x1B[H"),l=!1;let w=typeof o=="function"?o():o;if(w)for(let E of w.split(`
|
|
171
|
+
`))process.stdout.write(E+`\x1B[K
|
|
172
|
+
`);e&&process.stdout.write(`${S.dim}${e}${S.reset}\x1B[K
|
|
172
173
|
\x1B[K
|
|
173
|
-
`),t.forEach((
|
|
174
|
-
`)}),process.stdout.write("\x1B[J")},p=()=>{if(c){if(c=!1,process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.removeListener("keypress",d),process.stdin.pause()}},d=(w,
|
|
174
|
+
`),t.forEach((E,O)=>{let T=O===a?u?">":"\u2605":u?" ":"\u2606",A=O===a?` \x1B[7m${S.bold}${T} ${E.label}${S.reset}`:` ${T} ${E.label}`;process.stdout.write(A+`\x1B[K
|
|
175
|
+
`)}),process.stdout.write("\x1B[J")},p=()=>{if(c){if(c=!1,process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.removeListener("keypress",d),process.stdin.pause()}},d=(w,E)=>{!c||!E||(E.name==="up"?(a=(a-1+t.length)%t.length,f()):E.name==="down"?(a=(a+1)%t.length,f()):E.name==="return"?(p(),s(a)):E.name==="escape"?(p(),s(-1)):E.ctrl&&E.name==="c"&&(p(),i&&i(),process.exit(0)))};if(process.stdin.removeAllListeners("keypress"),Cr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{s(-1);return}process.stdin.on("keypress",d),process.stdin.resume(),f(),n&&n(f,()=>{c&&(p(),s(-2))})})}function wo(e){return new Promise(t=>{if(process.stdin.removeAllListeners("keypress"),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}if(process.stdin.pause(),process.stdout.write(`${e} (y/N): `),Cr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume();let r=(o,n)=>{if(!n)return;if(process.stdin.removeListener("keypress",r),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),n.ctrl&&n.name==="c"&&(process.stdout.write(`
|
|
175
176
|
`),process.exit(0));let i=(n.name||"").toLowerCase()==="y";process.stdout.write((i?"y":"n")+`
|
|
176
|
-
`),t(i)};process.stdin.on("keypress",r)})}function
|
|
177
|
+
`),t(i)};process.stdin.on("keypress",r)})}function hs(e,t){return new Promise(r=>{let o=e?e.slice(0,8):"unknown",n=as(),i=process.stdin.listeners("keypress").slice();if(process.stdin.removeAllListeners("keypress"),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause();let s=`${S.orange}${"\u2550".repeat(n)}${S.reset}`;if(process.stdout.write(`\x1B[2J\x1B[H
|
|
177
178
|
${s}
|
|
178
|
-
${
|
|
179
|
+
${S.orange}${S.bold} \u{1F514} New Device Connection${S.reset}
|
|
179
180
|
${s}
|
|
180
|
-
Device: ${
|
|
181
|
-
IP: ${
|
|
181
|
+
Device: ${S.cyan}${o}...${S.reset}
|
|
182
|
+
IP: ${S.cyan}${t}${S.reset}
|
|
182
183
|
${s}
|
|
183
184
|
|
|
184
|
-
Allow this device? ${
|
|
185
|
+
Allow this device? ${S.dim}(y/n)${S.reset} `),Cr.default.emitKeypressEvents(process.stdin),process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume();let a=()=>{for(let l of i)process.stdin.on("keypress",l);if(i.length>0){if(process.stdin.isTTY)try{process.stdin.setRawMode(!0)}catch{}process.stdin.resume()}},c=(l,u)=>{if(!u)return;let f=(u.name||"").toLowerCase(),p=f==="y"||u.name==="return",d=f==="n"||u.name==="escape",h=u.ctrl&&u.name==="c";if(!p&&!d&&!h)return;try{if(process.stdin.removeListener("keypress",c),process.stdin.isTTY)try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause()}catch{}h&&process.exit(0);let w=p,E=w?`${S.green}y${S.reset}
|
|
185
186
|
|
|
186
|
-
${
|
|
187
|
-
`:`${
|
|
187
|
+
${S.green}\u2713 Device approved${S.reset}
|
|
188
|
+
`:`${S.red}n${S.reset}
|
|
188
189
|
|
|
189
|
-
${
|
|
190
|
-
`;process.stdout.write(
|
|
191
|
-
`);u=p.pop();let d="";for(let h of p)if(h.startsWith("data: "))d=h.slice(6);else if(h===""&&d){try{let w=JSON.parse(d);Promise.resolve(t(w.type,w)).catch(()=>{})}catch{}d=""}}),l.on("end",()=>{n&&clearTimeout(n),o||setTimeout(a,
|
|
192
|
-
`).find(c=>c.includes(r));if(!n){
|
|
193
|
-
`,"utf8");let s=!1,a=()=>{if(!s){s=!0;try{W.default.rmSync(n,{recursive:!0,force:!0})}catch{}}},c=(0,
|
|
194
|
-
`).slice(-5).join(" | ");
|
|
195
|
-
`).flatMap(t=>{let r=t.match(/^\s*(\d+)\s+(.+)$/);return r?[{pid:Number(r[1]),args:r[2].trim()}]:[]}):[]}function
|
|
196
|
-
`).map(o=>+o.trim()).filter(Boolean);for(let r of new Set(t))kr(r)}catch{}}function Te(){if(!Eo){Eo=!0;try{try{if(W.default.existsSync(So)){let t=parseInt(W.default.readFileSync(So,"utf8"));Number.isFinite(t)&&(Kn=!0,kr(t)),W.default.unlinkSync(So)}}catch{}let e=In("cloudflared");Kn=!0,Jt=null,e&&(kr(e),Fe("cloudflared")),Al(k)}finally{setTimeout(()=>{Eo=!1},2e3)}}}function Os(){if(!me)return!1;let e=In("cloudflared");return!!e&&eo(e)}function Is(){Bn=0,en=!1,Wn=null,zt=null,me=null,je=0,jn=0,Zt=null,Rl()}var bl=/^(utun|awdl|llw|anpi|bridge|gif|stf|ipsec|ap|tun|tap|vmnet|veth|docker)/i;function As(){let e=ot.default.networkInterfaces(),t=[];for(let[r,o]of Object.entries(e))if(o&&!bl.test(r))for(let n of o)!n.internal&&n.family==="IPv4"&&t.push(`${r}:${n.address}`);return t.sort().join("|")}function xl(){Fn||(Pr=As(),wo=Date.now(),Fn=setInterval(async()=>{try{let e=Date.now(),t=e-wo;if(wo=e,To||en||!Wn||zt==null)return;if(t>ll){if(Q.info(`Sleep/wake detected (gap=${t}ms)`),me){let s=!1;for(let a=0;a<3;a++){if((await Yt(me)).ok){s=!0;break}a<2&&await new Promise(l=>setTimeout(l,3e3))}if(s)return;Q.info("tunnel unresponsive after sleep \u2192 restarting")}bt("unreachable"),Te(),Hn(zt,"woke from sleep");return}let r=As(),o=r!==Pr;Pr=r;let n=In("cloudflared"),i=!n||!eo(n);if(!o&&!i){if(me&&tn&&Date.now()-tn>Ss&&e-jn>=We.edgeProbeIntervalMs){jn=e;let s=await Yt(me);if(s.ok)je=0;else if(++je>=We.edgeProbeFailureThreshold){let a=await al(We.readyTimeoutMs);if(a>0){Q.info(`edge probe failing but cloudflared holds ${a} connection(s) \u2014 not restarting`),je=0;return}Q.warn(`tunnel unreachable but cloudflared alive \u2014 edge lost after ${je} probes (ready=${a??"unknown"}), restarting`),je=0,bt("unreachable"),Te(),Hn(zt,"tunnel unreachable (edge lost)")}else Q.debug(`edge probe failed (${je}/${We.edgeProbeFailureThreshold}) \u2014 ${s.dnsCode??s.httpStatus??"no response"}`)}return}if(o&&!i&&tn&&Date.now()-tn<Ss||(o&&Q.info("Network change detected"),i&&Q.warn("cloudflared not alive \u2014 watchdog"),bt("unreachable"),await new Promise(s=>setTimeout(s,We.networkRestoreDelayMs)),!await Rs()))return;if(o&&!i&&me){let s=!1;for(let a=0;a<2;a++){if((await Yt(me)).ok){s=!0;break}a===0&&await new Promise(l=>setTimeout(l,2e3))}if(s){Q.info("Tunnel survived network change, skip restart");return}}o&&!i&&Te(),Hn(zt,o?"network change":"liveness watchdog")}catch(e){Q.error(`network monitor tick failed: ${e?.message||e}`)}},We.networkCheckIntervalMs))}function Rl(){Fn&&(clearInterval(Fn),Fn=null),Pr=null}sn();var it=R(require("crypto"),1),cn=require("fs");var Ks=require("path");var If=Buffer.from("302a300506032b656e","hex");var Lr=(0,Ks.join)(G.CONFIG,"hostKey.json"),Df=Buffer.from("302a300506032b6570032100","hex"),an=null;function Ro(){if(an)return an;try{if((0,cn.existsSync)(Lr)){let s=JSON.parse((0,cn.readFileSync)(Lr,"utf8")),a=Buffer.from(s.publicKey,"base64");if(!s.x25519PrivateKey){let l=it.default.generateKeyPairSync("x25519");s.x25519PrivateKey=l.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),s.x25519PublicKey=l.publicKey.export({type:"spki",format:"der"}).toString("base64"),Ue(Lr,s)}let c=Buffer.from(s.x25519PublicKey,"base64");return an={privateKey:it.default.createPrivateKey({key:Buffer.from(s.privateKey,"base64"),format:"der",type:"pkcs8"}),publicKey:it.default.createPublicKey({key:a,format:"der",type:"spki"}),publicKeyB64:a.subarray(-32).toString("base64"),x25519PrivateKey:it.default.createPrivateKey({key:Buffer.from(s.x25519PrivateKey,"base64"),format:"der",type:"pkcs8"}),x25519PublicKeyB64:c.subarray(-32).toString("base64")},an}}catch{}(0,cn.mkdirSync)(G.CONFIG,{recursive:!0});let{privateKey:e,publicKey:t}=it.default.generateKeyPairSync("ed25519"),r=t.export({type:"spki",format:"der"}).toString("base64"),o=e.export({type:"pkcs8",format:"der"}).toString("base64"),n=it.default.generateKeyPairSync("x25519"),i=n.publicKey.export({type:"spki",format:"der"}).toString("base64");return Ue(Lr,{privateKey:o,publicKey:r,x25519PrivateKey:n.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),x25519PublicKey:i}),an={privateKey:e,publicKey:t,publicKeyB64:Buffer.from(r,"base64").subarray(-32).toString("base64"),x25519PrivateKey:n.privateKey,x25519PublicKeyB64:Buffer.from(i,"base64").subarray(-32).toString("base64")},an}function st(){return Ro().publicKeyB64}function at(){return Ro().x25519PublicKeyB64}var _l="9remote-session-v1";function Cl({apiKey:e,tunnelUrl:t,localIp:r,expiryMinutes:o,ts:n}){let i=a=>{let c=a==null?"":String(a);return`${c.length}:${c}`},s=`${_l}|${i(e)}${i(t)}${i(r)}${i(o)}${i(n)}`;return it.default.sign(null,Buffer.from(s,"utf8"),Ro().privateKey).toString("base64")}function xt(e){let t=Date.now();return{ts:t,sig:Cl({...e,ts:t})}}async function ct(e,t={}){let r=t.intervalMs??tt.intervalMs,o=t.timeoutMs??tt.timeoutMs,n=`${e}/api/health`,i=(()=>{try{return new URL(e).hostname}catch{return null}})(),s=Date.now(),a=0,c=[];await F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:[]}});let l=u=>{c.push(u);let f=c.length>tt.maxLogEntries?c.slice(-tt.maxLogEntries):c;F({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:f}})};for(;Date.now()-s<o;){if(a++,Vt(),i){let f=await mo(i,tt.dnsTimeoutMs);if(!f.ok){let p=f.code==="ENOTFOUND"||f.code==="ETIMEOUT"||f.code==="ESERVFAIL",d=p?"connecting...":f.code;jt(`#${a} \u2192 ${d}`),l({attempt:a,status:d,elapsedMs:f.elapsedMs,ok:!1,waiting:p,time:Date.now()}),await new Promise(h=>setTimeout(h,r));continue}}let u=Date.now();try{let f=await K(n,{signal:AbortSignal.timeout(tt.fetchTimeoutMs)}),p=Date.now()-u;if(jt(`#${a} \u2192 ${f.status}`),l({attempt:a,status:String(f.status),elapsedMs:p,ok:f.ok,time:Date.now()}),f.ok)return await F({healthCheck:{running:!1,timeoutMs:0,startedAt:null,logs:[]}}),await new Promise(d=>setTimeout(d,tt.postReadyHoldMs)),!0}catch(f){let p=Date.now()-u,d=f.cause?.code||f.code||f.message,h=d==="ENOTFOUND",w=h?"connecting...":d;jt(`#${a} \u2192 ${w}`),l({attempt:a,status:w,elapsedMs:p,ok:!1,waiting:h,time:Date.now()})}await new Promise(f=>setTimeout(f,r))}return await F({healthCheck:{running:!1,timeoutMs:o,startedAt:s,logs:c}}),!1}var lt=H("tunnel"),Po=null,Hs=null,Ws=0;async function Rt(e,t){if(lt.debug(`updateTunnelUrl: key=${e?.slice(0,8)} url=${t}`),Ml(e),t&&t===Hs&&Date.now()-Ws<Fi){lt.debug("updateTunnelUrl: skipped (debounce, same URL)");return}Po&&(Po.cancelled=!0);let r={cancelled:!1};Po=r;let o=ps();Tr({config:ce.urlSync,label:`urlSync ${t}`,log:n=>lt.warn(n),ctx:r,task:async()=>{let n=await K(`${C}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let s={apiKey:V(e),tunnelUrl:t,localIp:o?`${o}:${k}`:null};return{...s,...xt(s)}})())});if(r.cancelled)return!0;if(n.ok)return Hs=t,Ws=Date.now(),lt.debug(`urlSync OK: pushed ${t} to server`),$l(t),!0;let i=await n.text().catch(()=>"");return lt.warn(`urlSync HTTP ${n.status}: ${i.slice(0,200)}`),!1}}),t&&ys(t)}var ln=null,un=null,ko=!1,Io=0;async function js(e,t){let r={apiKey:e,online:t},o=await K(`${C}/api/session/heartbeat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...xt(r)})});return o.ok||lt.warn(`heartbeat online=${t} HTTP ${o.status}`),o.ok}async function Oo(){if(!(ko||!un)){ko=!0;try{await js(un,!0),Io=Date.now()}catch(e){lt.debug(`heartbeat failed: ${e?.message||e}`)}finally{ko=!1}}}function Ml(e){let t=V(e);if(t){if(ln&&un===t){Date.now()-Io>=oo&&Oo();return}Lo(),un=t,Oo(),ln=setInterval(Oo,oo),ln.unref?.()}}function Lo({offline:e=!1}={}){ln&&(clearInterval(ln),ln=null);let t=un;return un=null,Io=0,!e||!t?null:js(t,!1).catch(r=>lt.debug(`goodbye failed: ${r?.message||r}`))}var Xn=null;async function $l(e){if(Xn?.url===e)return;let t={url:e};Xn=t,ws();try{let r=await ct(e,{timeoutMs:Wi});if(Xn!==t)return;r&&bt("healthy")}catch{}finally{Xn===t&&(Xn=null),vs()}}var Xe=H("server"),Xs=Qn.default.dirname((0,Ys.fileURLToPath)(__importMetaUrl)),Nl=Qn.default.resolve(Xs,"./server.cjs"),Gs=Qn.default.resolve(Xs,"../../index.js");function _r(e){try{process.platform==="win32"?(0,qn.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${e}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,qn.execSync)(`lsof -ti:${e} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}}function ut(e,t,r){let o=null,n=!1,i=!1,s=!0,a=0,c=null,l=()=>{s&&(_r(k),s=!1);let u=process.env.NODE_ENV==="development"&&_o.default.existsSync(Gs),f=u?Gs:Nl;_o.default.existsSync(f)||(Xe.error(`Server not found: ${f}`),process.exit(1));let p={...process.env,PORT:String(k)};u||delete p.NODE_ENV,o=(0,qn.spawn)(Go,[f],{cwd:Qn.default.dirname(f),stdio:["ignore","inherit","inherit"],detached:!1,windowsHide:!0,env:Vo(p)}),c&&clearTimeout(c),c=setTimeout(()=>{a=0},Bi),o.on("exit",(d,h)=>{if(c&&(clearTimeout(c),c=null),n)return;if(i){i=!1,Xe.info("Restarting server (requested)..."),setTimeout(()=>{l(),r?.()},500);return}Xe.error(`Server exited unexpectedly (code: ${d}, signal: ${h})`),a++;let w=Se(ce.server,a);Xe.warn(`Restarting server in ${w}ms (fail#${a})`),t&&t(),setTimeout(()=>{l(),r?.()},w)}),o.on("error",d=>{Xe.error(`Server error: ${d.message}`)}),e?.(o)};return l(),{getProcess:()=>o,shutdown:()=>{if(n=!0,!!o){try{o.kill("SIGTERM")}catch{}setTimeout(()=>{try{o&&o.kill("SIGKILL")}catch{}},2e3)}},restart:()=>{if(!o)return!1;i=!0;try{o.kill("SIGTERM")}catch{}return setTimeout(()=>{try{o&&i&&o.kill("SIGKILL")}catch{}},2e3),!0}}}function qs(e){return e?.restart?e.restart():!1}function Pt({serverManager:e,tunnelProcess:t,exit:r=!0,code:o=0}={}){try{Dn()}catch{}try{e?.shutdown?.()}catch{}try{t?.kill?.()}catch{}try{Te()}catch{}try{Vn()}catch{}try{_r(k)}catch{}try{Is()}catch{}try{ai()}catch{}try{Fe("agent")}catch{}try{Fe("cloudflared")}catch{}let n=Lo({offline:!0});if(r){let i=new Promise(a=>setTimeout(a,Ui)),s=n?Promise.race([n,new Promise(a=>setTimeout(a,Ki))]):null;Promise.all([i,s]).finally(()=>process.exit(o))}}var Vs=!1;function ft(e,t){if(Vs)return;Vs=!0;let r=!1,o=n=>{r||(r=!0,Xe.info(`Stopping 9Remote (${n})...`),Pt({serverManager:e,tunnelProcess:t}),Xe.info("Server stopped"))};if(process.on("SIGINT",()=>o("SIGINT")),process.on("SIGTERM",()=>o("SIGTERM")),process.on("SIGHUP",()=>o("SIGHUP")),process.platform==="win32"){process.on("SIGBREAK",()=>o("SIGBREAK"));try{import("readline").then(({createInterface:n})=>{n({input:process.stdin,output:process.stdout}).on("SIGINT",()=>o("SIGINT")),process.stdin.isTTY&&process.stdin.unref?.()}).catch(()=>{})}catch{}}process.on("uncaughtException",n=>{Xe.error(`Uncaught exception: ${n?.stack||n?.message||n}`),o("uncaughtException"),setTimeout(()=>process.exit(1),ro)}),process.on("unhandledRejection",n=>{Xe.error(`Unhandled rejection: ${n?.stack||n?.message||n}`),o("unhandledRejection"),setTimeout(()=>process.exit(1),ro)})}sn();var Js=R(require("crypto"),1),Zs=require("path");var Dl=H("pairing"),zs=(0,Zs.join)(G.STATE,"pairing.json"),Qs="ABCDEFGHIJKLMNPQRSTUVWXYZ123456789",Bl=2;function ea(){let e="";for(let t=0;t<Bl;t++)e+=Qs[Js.default.randomInt(Qs.length)];return e}function Ul(){let e=ii(zs,null);return!e||Date.now()>e.expiresAt?null:e}function Fl(e){try{Ue(zs,e)}catch(t){Dl.error(`persist pairing state: ${t.message}`)}}function ta(e,t,r,o=null){Fl({tempKey:e,tail:t,expiresAt:r,workerUrl:o})}function na(){let e=Ul();return e?{tempKey:e.tempKey,tail:e.tail,expiresAt:e.expiresAt}:null}var ra=H("session"),Kl=10;async function Jn(e,t){try{let r=await K(`${t}/api/temp-key/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let i={apiKey:V(e),expiryMinutes:Kl};return{...i,...xt(i)}})())});if(!r.ok){let i=await r.json().catch(()=>null);throw new Error(i?.error||`HTTP ${r.status}`)}let o=await r.json(),n=ea();return ta(o.tempKey,n,o.expiresAt,t),{...o,oneTimeKey:`${o.tempKey}${n}`}}catch(r){return ra.error(`Temp key creation failed: ${r?.message||r}`),null}}function Zn(e,t){return t?.tempKey?`${e}/login?k=${t.tempKey}#${t.oneTimeKey}`:`${e}/login`}async function Cr(e,t,r,o){try{let n=await K(`${t}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:st(),hostX25519Key:at(),tempKey:na()?.tempKey||void 0})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return r&&await K(`${t}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),tunnelUrl:r,...xt({apiKey:V(e),tunnelUrl:r})})}).catch(()=>{}),o&&V(o)!==V(e)&&await K(`${t}/api/session/delete`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(o),...xt({apiKey:V(o)})})}).catch(()=>{}),!0}catch(n){return ra.error(`Session registration failed: ${n?.message||n}`),!1}}var kt=H("tunnel");async function Hl(e,t,r,o){let n=0;for(;;){n++;try{return await Ve(e,t,r)}catch(i){let s=Se(ce.tunnelSpawn,n);kt.warn(`spawn attempt ${n} failed: ${i?.message||i} \u2014 retry in ${s}ms`),o?.({attempt:n,delay:s}),await new Promise(a=>setTimeout(a,s))}}}function qe({onUrlUpdate:e,setTunnel:t,onRetry:r}){return async o=>{try{let n=await Hl(o,e,null,r);Qe(),t(n.child),await e(n.tunnelUrl),kt.info(`Tunnel restarted: ${n.tunnelUrl}`)}catch(n){kt.error(`Tunnel restart failed: ${n?.message||n}`)}}}var Mr=null;function Qe(){Mr&&(Mr.cancelled=!0,Mr=null)}function fn(e,{onUrlUpdate:t,onRestart:r,setActiveTunnel:o,onReady:n}){Qe();let i={cancelled:!1};return Mr=i,Tr({config:ce.tunnelRateLimit,task:async()=>{if(i.cancelled)return!0;if(Os())return kt.info("bg-tunnel: a tunnel is already live \u2014 standing down"),!0;let s=await Ve(e,t,r);if(i.cancelled){try{Te()}catch{}return!0}try{o?.(s.child),await t?.(s.tunnelUrl),await n?.(s),kt.info(`bg tunnel up: ${s.tunnelUrl}`)}catch(a){kt.error(`bg tunnel post-spawn failed: ${a?.message||a}`)}return!0},label:"bg-tunnel",log:s=>kt.info(s),ctx:i}),i}var Bo=R(Pa(),1);var Jl=H("session");function Zl(e,t="\u{1F4F1} Scan QR to connect:"){console.log(ie.orange(`
|
|
197
|
-
${t}`)),
|
|
198
|
-
`+r.trim())})})}async function
|
|
199
|
-
\u274C Failed to create one-time key \u2014 generate a new one from the menu`)),console.log(
|
|
190
|
+
${S.red}\u2717 Device rejected${S.reset}
|
|
191
|
+
`;process.stdout.write(E),setTimeout(()=>{try{a()}catch{}r(w)},500)};process.stdin.on("keypress",c)})}function gs(e,t){let r=null,o=!1,n=null,i=45e3,s=()=>{n&&clearTimeout(n),n=setTimeout(()=>{try{r?.destroy()}catch{}},i)},a=async()=>{if(o)return;let c=await zt();r=ss.default.get(`http://${c}:${e}/api/ui/events`,l=>{let u="";s(),l.on("data",f=>{s(),u+=f.toString();let p=u.split(`
|
|
192
|
+
`);u=p.pop();let d="";for(let h of p)if(h.startsWith("data: "))d=h.slice(6);else if(h===""&&d){try{let w=JSON.parse(d);Promise.resolve(t(w.type,w)).catch(()=>{})}catch{}d=""}}),l.on("end",()=>{n&&clearTimeout(n),o||setTimeout(a,be(fe.sse,1))})}),r.on("error",()=>{n&&clearTimeout(n),o||setTimeout(a,be(fe.sse,1))})};return a(),()=>{o=!0,n&&clearTimeout(n),r?.destroy()}}var vo=!1;function ws(e){vo=e}var Kn=null;async function zt(){if(Kn)return Kn;let e=o=>fetch(`http://${o}:${k}/api/health`,{signal:AbortSignal.timeout(2e3)}).then(n=>n.ok?o:Promise.reject()),r=(await Promise.allSettled(["localhost","127.0.0.1"].map(e))).map((o,n)=>o.status==="fulfilled"?["localhost","127.0.0.1"][n]:null);return Kn=r.find(o=>o==="localhost")||r.find(Boolean)||null,Kn||"127.0.0.1"}function vs(){Kn=null}async function Q(e,t){let r=await zt();try{return await fetch(`http://${r}:${k}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return vs(),null}}async function J(e){let t=await zt();try{let r=await fetch(`http://${t}:${k}${e}`);return r.ok?await r.json():null}catch{return vs(),null}}async function K(e){await Q("/api/ui/state",e)}async function C(e,t={}){vo&&ds(e-1,e>I.PREPARING),await K({step:e,stepDesc:"",...t})}function Mr({phase:e,percent:t}){let r=e==="download"?`Downloading tunnel binary ${t??0}%`:"Extracting tunnel binary";vo&&Zt(r),K({stepDesc:r})}async function le(){return!!await J("/api/health")}async function Eo(){let[e,t,r,o]=await Promise.all([J("/api/ui/state"),J("/api/device/auto-approve"),J("/api/autostart"),J("/api/sleep-inhibit")]);return{desktopEnabled:!!e?.desktopEnabled,remoteAvailable:!!e?.remoteAvailable,autoApprove:!!t?.enabled,autoStart:!!r?.enabled,sleepInhibitMode:o?.mode||"never",sleepInhibitActive:!!o?.active,sleepInhibitPresets:Array.isArray(o?.presets)?o.presets:[]}}function Es(){let e=ys.default.networkInterfaces();for(let t of Object.values(e))for(let r of t)if(r.family==="IPv4"&&!r.internal)return r.address;return null}var tr=require("child_process"),nr=R(require("path"),1),Uo=R(require("fs"),1),ea=require("url");var W=R(require("fs"),1),st=R(require("path"),1),Lo=R(require("https"),1),at=R(require("os"),1),_s=R(require("net"),1),Ve=require("child_process");var Ss=R(require("dns"),1),Ts=require("child_process");var sl=2e3,al=5e3,So=new Ss.default.promises.Resolver;So.setServers(["1.1.1.1","1.0.0.1","8.8.8.8"]);function en(){process.platform==="win32"&&(0,Ts.execFile)("ipconfig",["/flushdns"],{windowsHide:!0},()=>{})}async function To(e,t=sl){let r=Date.now();try{let o=async()=>{let[i,s]=await Promise.allSettled([So.resolve4(e),So.resolve6(e)]);if(i.status==="fulfilled"&&i.value?.length)return i.value;if(s.status==="fulfilled"&&s.value?.length)return s.value;throw i.reason||s.reason||Object.assign(new Error("DNS query failed"),{code:"ENOTFOUND"})};return{ok:!0,addrs:await Promise.race([o(),new Promise((i,s)=>setTimeout(()=>s(Object.assign(new Error("DNS timeout"),{code:"ETIMEOUT"})),t))]),elapsedMs:Date.now()-r}}catch(o){return{ok:!1,code:o.code||o.message,elapsedMs:Date.now()-r}}}async function tn(e,{flushDns:t=!1}={}){let r=Date.now(),o=null;try{o=new URL(e).hostname}catch{}if(t&&en(),o){let n=await To(o);if(!n.ok)return en(),{ok:!1,dnsCode:n.code,elapsedMs:Date.now()-r}}try{let n=await H(`${e}/api/health`,{signal:AbortSignal.timeout(al)});return{ok:n.ok,httpStatus:n.status,elapsedMs:Date.now()-r}}catch(n){return{ok:!1,dnsCode:n.cause?.code||n.code||n.message,elapsedMs:Date.now()-r}}}var cl=B("tunnel"),Hn=null,Wn=null,nn=null,xt=null,it=0,Ao=!1;async function xo(e){try{let t=await zt();await fetch(`http://${t}:${k}/api/ui/state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch{}}var bo=!1;async function bs(){if(!(!Wn||Ao||bo)){bo=!0;try{await ll()}finally{bo=!1}}}async function ll(){let e=await tn(Wn),t=e.ok?"healthy":"unreachable";if(t===nn){xt=null,it=0;return}if(t!==xt){xt=t,it=1;return}it++,!(it<qi)&&(cl.info(`${nn??"init"} \u2192 ${t}${e.ok?"":` (http=${e.httpStatus??"-"} dns=${e.dnsCode??"-"})`}`),nn=t,xt=null,it=0,await xo({tunnelHealth:{status:t,checkedAt:Date.now()}}))}function As(e){if(!e)return jn();e!==Wn&&(Wn=e,nn=null,xt=null,it=0,en(),Hn||(Hn=setInterval(bs,oi.checkIntervalMs)),bs())}var xs=As,rn=As;function Rs(){Ao=!0}function Ps(){Ao=!1}function Rt(e){nn=e,xt=null,it=0,xo({tunnelHealth:{status:e,checkedAt:Date.now()}})}function jn(){Hn&&(clearInterval(Hn),Hn=null),Wn=null,nn=null,xt=null,it=0,xo({tunnelHealth:{status:"unknown",checkedAt:null}})}var Z=B("tunnel"),je={networkCheckIntervalMs:5e3,networkRestoreDelayMs:2500,internetCheckTimeoutMs:3e3,internetCheckHost:"1.1.1.1",internetCheckPort:443,edgeProbeIntervalMs:15e3,edgeProbeFailureThreshold:3,readyTimeoutMs:1500},ul=[20241,20242,20243,20244,20245],an=null;async function fl(e,t){try{let o=await(await fetch(`http://localhost:${e}/ready`,{signal:AbortSignal.timeout(t)})).json();return typeof o?.readyConnections=="number"?o:null}catch{return null}}async function ks(e,t){let r=await fl(e,t);if(!r)return null;let o=await dl(e,t);return o&&ye&&!ye.includes(o)?null:r.readyConnections}async function pl(e){if(an!==null){let o=await ks(an,e);if(o!==null)return o;an=null}let r=(await Promise.all(ul.map(async o=>({port:o,conns:await ks(o,e)})))).find(o=>o.conns!==null);return r?(an=r.port,r.conns):null}async function dl(e,t){try{return(await(await fetch(`http://localhost:${e}/quicktunnel`,{signal:AbortSignal.timeout(t)})).json())?.hostname||null}catch{return null}}var ml=3e4,Ro=0,Yn=null,$r=null,cn=null,qn=null,ln=!1,Gn=0,Io=!1,ye=null,un=0,Po=0,ko=!1,Jn=0,Ge=0,Os=3e4,hl=5e3,Vn=st.default.join(at.default.homedir(),".9remote","bin"),Is="cloudflared",fn=at.default.platform()==="win32",gl=fn?`${Is}.exe`:Is,on=st.default.join(Vn,gl),Oo=st.default.join(at.default.homedir(),".9remote","cloudflared.pid"),Xn=!1,sn=null,yl="2026.6.1",Cs=`https://github.com/cloudflare/cloudflared/releases/download/${yl}`;function Ms(){return new Promise(e=>{let t=new _s.default.Socket,r=!1,o=n=>{if(!r){r=!0;try{t.destroy()}catch{}e(n)}};t.setTimeout(je.internetCheckTimeoutMs),t.once("connect",()=>o(!0)),t.once("timeout",()=>o(!1)),t.once("error",()=>o(!1));try{t.connect(je.internetCheckPort,je.internetCheckHost)}catch{o(!1)}})}async function wl(){Io=!0;try{let e=0;for(;;){if(e++,await Ms())return;await new Promise(t=>setTimeout(t,be(fe.internet,e)))}}finally{Io=!1}}async function Qn(e,t){if(!qn){Z.warn("No restartCallback registered \u2014 skip");return}if(!ln&&!(Date.now()-Po<hl)){Po=Date.now(),ln=!0;try{await wl();let r=be(fe.tunnelRestart,Gn+1);await new Promise(o=>setTimeout(o,r)),await qn(e),Gn=0,Po=0}catch(r){Gn++,Z.error(`restart failed (#${Gn}): ${r?.message||r}`),setImmediate(()=>{ln=!1,Qn(e,"retry after fail")});return}finally{ln=!1}}}var vl={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-arm64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}};function El(){let e=at.default.platform(),t=at.default.arch(),r=vl[e];if(!r)throw new Error(`Unsupported platform: ${e}`);let o=r[t];if(!o)throw new Error(`Unsupported architecture: ${t} for platform ${e}`);return`${Cs}/${o}`}var Sl=150;async function $s(e,t,r){return new Promise((o,n)=>{let i=W.default.createWriteStream(t);Lo.default.get(e,s=>{if([301,302].includes(s.statusCode)){i.close(),W.default.unlinkSync(t),$s(s.headers.location,t,r).then(o).catch(n);return}if(s.statusCode!==200){i.close(),W.default.unlinkSync(t),n(new Error(`Download failed with status ${s.statusCode}`));return}let a=parseInt(s.headers["content-length"]||"0",10),c=0,l=0,u=-1;s.on("data",f=>{if(c+=f.length,!r||!a)return;let p=Date.now(),d=Math.min(100,Math.floor(c/a*100));d!==u&&p-l>=Sl&&(l=p,u=d,r(d))}),s.pipe(i),i.on("finish",()=>{r&&a&&r(100),i.close(()=>o(t))}),i.on("error",f=>{i.close(),W.default.unlinkSync(t),n(f)})}).on("error",s=>{i.close(),W.default.existsSync(t)&&W.default.unlinkSync(t),n(s)})})}async function Zn(e){if(W.default.existsSync(Vn)||W.default.mkdirSync(Vn,{recursive:!0}),W.default.existsSync(on))return fn||W.default.chmodSync(on,"755"),on;let t=El(),r=t.endsWith(".tgz"),o=r?st.default.join(Vn,"cloudflared.tgz"):on;try{return e?.({phase:"download",percent:0}),await $s(t,o,n=>{e?.({phase:"download",percent:n})}),await Tl(t,o),r&&(e?.({phase:"extract"}),(0,Ve.execSync)(`tar -xzf "${o}" -C "${Vn}"`,{stdio:"pipe",windowsHide:!0}),W.default.unlinkSync(o)),fn||W.default.chmodSync(on,"755"),on}catch(n){try{W.default.existsSync(o)&&W.default.unlinkSync(o)}catch{}throw console.error("Failed to download cloudflared:",n.message),n}}function Ns(e){return new Promise((t,r)=>{Lo.default.get(e,o=>{if([301,302].includes(o.statusCode))return Ns(o.headers.location).then(t).catch(r);if(o.statusCode!==200)return r(new Error(`HTTP ${o.statusCode}`));let n="";o.on("data",i=>n+=i),o.on("end",()=>t(n))}).on("error",r)})}async function Tl(e,t){let r=st.default.basename(e),o;try{o=await Ns(`${Cs}/sha256sum.txt`)}catch(c){Z.warn(`sha256 manifest unavailable (${c.message}), skipping verify`);return}let n=o.split(`
|
|
193
|
+
`).find(c=>c.includes(r));if(!n){Z.warn(`No sha256 entry for ${r}, skipping verify`);return}let i=n.trim().split(/\s+/)[0],{createHash:s}=await import("crypto"),a=s("sha256").update(W.default.readFileSync(t)).digest("hex");if(a!==i)throw new Error(`Integrity check failed: SHA256 mismatch (expected ${i}, got ${a})`)}function bl(e){let t=/https:\/\/([a-z0-9-]+)\.trycloudflare\.com/gi,r=[];for(let o of e.matchAll(t))o[1]!=="api"&&r.push(`https://${o[1]}.trycloudflare.com`);return r.length?r[r.length-1]:null}async function Ye(e,t=null,r=null){let o=await Zn();Pl(o),r&&(qn=r),cn=e;let n=W.default.mkdtempSync(st.default.join(at.default.tmpdir(),"9remote-quick-")),i=st.default.join(n,"config.yml");W.default.writeFileSync(i,`# quick-tunnel
|
|
194
|
+
`,"utf8");let s=!1,a=()=>{if(!s){s=!0;try{W.default.rmSync(n,{recursive:!0,force:!0})}catch{}}},c=(0,Ve.spawn)(o,["tunnel","--url",`http://localhost:${e}`,"--config",i,"--no-autoupdate","--protocol","http2"],{detached:!1,windowsHide:!0,stdio:["ignore","pipe","pipe"]});return Ie("cloudflared",c.pid),sn=c.pid,Xn=!1,new Promise((l,u)=>{let f=!1,p=null,d="",h=setTimeout(()=>{if(!f){f=!0,a(),sn===c.pid&&(sn=null);try{c.kill("SIGKILL")}catch{}Ke("cloudflared"),u(new Error("Quick tunnel timed out after 90s"))}},9e4),w=E=>{let O=E.toString();d+=O,d.length>4096&&(d=d.slice(-4096));let T=bl(O);if(T){if(!f){f=!0,p=T,ye=T,un=Date.now(),Ge=0,Jn=0,an=null,clearTimeout(h),a(),Il(),Z.info(`tunnel ready: ${T}`),l({child:c,tunnelUrl:T});return}T!==p&&(Z.info(`URL rotated: ${T}`),p=T,ye=T,un=Date.now(),Ge=0,Jn=0,t?.(T))}};c.stdout.on("data",w),c.stderr.on("data",w),c.on("error",E=>{f||(f=!0,clearTimeout(h),a(),u(E))}),c.on("exit",(E,O)=>{a();let T=sn!==c.pid,A=Xn||T;if(Z.info(`cloudflared exited (intentional=${Xn} superseded=${T})`),A||Rt("unreachable"),!f){f=!0,clearTimeout(h);let P=d.trim().split(`
|
|
195
|
+
`).slice(-5).join(" | ");sn=null,u(new Error(`cloudflared exited (code=${E}, signal=${O}) output: ${P||"(empty)"}`));return}A||Qn(e,`quick tunnel exit code ${E}`)})})}function Nr(e){if(fn)try{(0,Ve.execSync)(`taskkill /PID ${e} /T /F`,{windowsHide:!0,stdio:"ignore"})}catch{}else try{process.kill(e,"SIGKILL")}catch{}}function Al(e){return e?e.split(`
|
|
196
|
+
`).flatMap(t=>{let r=t.match(/^\s*(\d+)\s+(.+)$/);return r?[{pid:Number(r[1]),args:r[2].trim()}]:[]}):[]}function xl(e,t){return Array.isArray(e)?e.filter(r=>{if(!r?.args||typeof r.pid!="number")return!1;let o=r.args.split(/\s+/);return o.includes(t)&&o.includes("tunnel")}).map(r=>r.pid):[]}function Rl(e){try{let t=fn?(0,Ve.execSync)(`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter 'Name=\\'cloudflared.exe\\'' | ForEach-Object { \\"$($_.ProcessId) $($_.CommandLine)\\"" }"`,{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}):(0,Ve.execSync)("ps -eo pid=,args=",{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return xl(Al(t),e)}catch{return[]}}function Pl(e){let t=Rl(e);for(let r of t)r!==process.pid&&(Z.info(`killing leftover cloudflared pid=${r}`),Nr(r));return t}function kl(e){try{let t=[];if(fn){let r=`Get-NetTCPConnection -LocalPort ${e} -State Established -ErrorAction SilentlyContinue | Where-Object { (Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Name -eq 'cloudflared' } | Select-Object -ExpandProperty OwningProcess -Unique`;t=(0,Ve.execSync)(`powershell -NoProfile -Command "${r}"`,{encoding:"utf8",windowsHide:!0,stdio:["ignore","pipe","ignore"]}).split(/\r?\n/).map(n=>+n.trim()).filter(Boolean)}else t=(0,Ve.execSync)(`lsof -nP -iTCP:${e} -sTCP:ESTABLISHED 2>/dev/null | awk '/cloudflar/ {print $2}' | sort -u`,{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
197
|
+
`).map(o=>+o.trim()).filter(Boolean);for(let r of new Set(t))Nr(r)}catch{}}function Ae(){if(!ko){ko=!0;try{try{if(W.default.existsSync(Oo)){let t=parseInt(W.default.readFileSync(Oo,"utf8"));Number.isFinite(t)&&(Xn=!0,Nr(t)),W.default.unlinkSync(Oo)}}catch{}let e=Dn("cloudflared");Xn=!0,sn=null,e&&(Nr(e),Ke("cloudflared")),kl(k)}finally{setTimeout(()=>{ko=!1},2e3)}}}function Ds(){if(!ye)return!1;let e=Dn("cloudflared");return!!e&&co(e)}function Bs(){Gn=0,ln=!1,qn=null,cn=null,ye=null,Ge=0,Jn=0,an=null,Ll()}var Ol=/^(utun|awdl|llw|anpi|bridge|gif|stf|ipsec|ap|tun|tap|vmnet|veth|docker)/i;function Ls(){let e=at.default.networkInterfaces(),t=[];for(let[r,o]of Object.entries(e))if(o&&!Ol.test(r))for(let n of o)!n.internal&&n.family==="IPv4"&&t.push(`${r}:${n.address}`);return t.sort().join("|")}function Il(){Yn||($r=Ls(),Ro=Date.now(),Yn=setInterval(async()=>{try{let e=Date.now(),t=e-Ro;if(Ro=e,Io||ln||!qn||cn==null)return;if(t>ml){if(Z.info(`Sleep/wake detected (gap=${t}ms)`),ye){let s=!1;for(let a=0;a<3;a++){if((await tn(ye)).ok){s=!0;break}a<2&&await new Promise(l=>setTimeout(l,3e3))}if(s)return;Z.info("tunnel unresponsive after sleep \u2192 restarting")}Rt("unreachable"),Ae(),Qn(cn,"woke from sleep");return}let r=Ls(),o=r!==$r;$r=r;let n=Dn("cloudflared"),i=!n||!co(n);if(!o&&!i){if(ye&&un&&Date.now()-un>Os&&e-Jn>=je.edgeProbeIntervalMs){Jn=e;let s=await tn(ye);if(s.ok)Ge=0;else if(++Ge>=je.edgeProbeFailureThreshold){let a=await pl(je.readyTimeoutMs);if(a>0){Z.info(`edge probe failing but cloudflared holds ${a} connection(s) \u2014 not restarting`),Ge=0;return}Z.warn(`tunnel unreachable but cloudflared alive \u2014 edge lost after ${Ge} probes (ready=${a??"unknown"}), restarting`),Ge=0,Rt("unreachable"),Ae(),Qn(cn,"tunnel unreachable (edge lost)")}else Z.debug(`edge probe failed (${Ge}/${je.edgeProbeFailureThreshold}) \u2014 ${s.dnsCode??s.httpStatus??"no response"}`)}return}if(o&&!i&&un&&Date.now()-un<Os||(o&&Z.info("Network change detected"),i&&Z.warn("cloudflared not alive \u2014 watchdog"),Rt("unreachable"),await new Promise(s=>setTimeout(s,je.networkRestoreDelayMs)),!await Ms()))return;if(o&&!i&&ye){let s=!1;for(let a=0;a<2;a++){if((await tn(ye)).ok){s=!0;break}a===0&&await new Promise(l=>setTimeout(l,2e3))}if(s){Z.info("Tunnel survived network change, skip restart");return}}o&&!i&&Ae(),Qn(cn,o?"network change":"liveness watchdog")}catch(e){Z.error(`network monitor tick failed: ${e?.message||e}`)}},je.networkCheckIntervalMs))}function Ll(){Yn&&(clearInterval(Yn),Yn=null),$r=null}Ot();var ct=R(require("crypto"),1),gn=require("fs");var Qs=require("path");var Cf=Buffer.from("302a300506032b656e","hex");var Br=(0,Qs.join)(G.CONFIG,"hostKey.json"),Uf=Buffer.from("302a300506032b6570032100","hex"),hn=null;function Co(){if(hn)return hn;try{if((0,gn.existsSync)(Br)){let s=JSON.parse((0,gn.readFileSync)(Br,"utf8")),a=Buffer.from(s.publicKey,"base64");if(!s.x25519PrivateKey){let l=ct.default.generateKeyPairSync("x25519");s.x25519PrivateKey=l.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),s.x25519PublicKey=l.publicKey.export({type:"spki",format:"der"}).toString("base64"),Fe(Br,s)}let c=Buffer.from(s.x25519PublicKey,"base64");return hn={privateKey:ct.default.createPrivateKey({key:Buffer.from(s.privateKey,"base64"),format:"der",type:"pkcs8"}),publicKey:ct.default.createPublicKey({key:a,format:"der",type:"spki"}),publicKeyB64:a.subarray(-32).toString("base64"),x25519PrivateKey:ct.default.createPrivateKey({key:Buffer.from(s.x25519PrivateKey,"base64"),format:"der",type:"pkcs8"}),x25519PublicKeyB64:c.subarray(-32).toString("base64")},hn}}catch{}(0,gn.mkdirSync)(G.CONFIG,{recursive:!0});let{privateKey:e,publicKey:t}=ct.default.generateKeyPairSync("ed25519"),r=t.export({type:"spki",format:"der"}).toString("base64"),o=e.export({type:"pkcs8",format:"der"}).toString("base64"),n=ct.default.generateKeyPairSync("x25519"),i=n.publicKey.export({type:"spki",format:"der"}).toString("base64");return Fe(Br,{privateKey:o,publicKey:r,x25519PrivateKey:n.privateKey.export({type:"pkcs8",format:"der"}).toString("base64"),x25519PublicKey:i}),hn={privateKey:e,publicKey:t,publicKeyB64:Buffer.from(r,"base64").subarray(-32).toString("base64"),x25519PrivateKey:n.privateKey,x25519PublicKeyB64:Buffer.from(i,"base64").subarray(-32).toString("base64")},hn}function lt(){return Co().publicKeyB64}function ut(){return Co().x25519PublicKeyB64}var Dl="9remote-session-v1";function Bl({apiKey:e,tunnelUrl:t,localIp:r,expiryMinutes:o,ts:n}){let i=a=>{let c=a==null?"":String(a);return`${c.length}:${c}`},s=`${Dl}|${i(e)}${i(t)}${i(r)}${i(o)}${i(n)}`;return ct.default.sign(null,Buffer.from(s,"utf8"),Co().privateKey).toString("base64")}function It(e){let t=Date.now();return{ts:t,sig:Bl({...e,ts:t})}}async function ft(e,t={}){let r=t.intervalMs??ot.intervalMs,o=t.timeoutMs??ot.timeoutMs,n=`${e}/api/health`,i=(()=>{try{return new URL(e).hostname}catch{return null}})(),s=Date.now(),a=0,c=[];await K({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:[]}});let l=u=>{c.push(u);let f=c.length>ot.maxLogEntries?c.slice(-ot.maxLogEntries):c;K({healthCheck:{running:!0,timeoutMs:o,startedAt:s,logs:f}})};for(;Date.now()-s<o;){if(a++,en(),i){let f=await To(i,ot.dnsTimeoutMs);if(!f.ok){let p=f.code==="ENOTFOUND"||f.code==="ETIMEOUT"||f.code==="ESERVFAIL",d=p?"connecting...":f.code;Zt(`#${a} \u2192 ${d}`),l({attempt:a,status:d,elapsedMs:f.elapsedMs,ok:!1,waiting:p,time:Date.now()}),await new Promise(h=>setTimeout(h,r));continue}}let u=Date.now();try{let f=await H(n,{signal:AbortSignal.timeout(ot.fetchTimeoutMs)}),p=Date.now()-u;if(Zt(`#${a} \u2192 ${f.status}`),l({attempt:a,status:String(f.status),elapsedMs:p,ok:f.ok,time:Date.now()}),f.ok)return await K({healthCheck:{running:!1,timeoutMs:0,startedAt:null,logs:[]}}),await new Promise(d=>setTimeout(d,ot.postReadyHoldMs)),!0}catch(f){let p=Date.now()-u,d=f.cause?.code||f.code||f.message,h=d==="ENOTFOUND",w=h?"connecting...":d;Zt(`#${a} \u2192 ${w}`),l({attempt:a,status:w,elapsedMs:p,ok:!1,waiting:h,time:Date.now()})}await new Promise(f=>setTimeout(f,r))}return await K({healthCheck:{running:!1,timeoutMs:o,startedAt:s,logs:c}}),!1}var Qe=B("tunnel"),Mo=null,qs=null,Js=0;async function Lt(e,t){if(Qe.debug(`updateTunnelUrl: key=${e?.slice(0,8)} url=${t}`),X().remoteEnabled===!1)return;if(_t(e),t&&t===qs&&Date.now()-Js<Qi){Qe.debug("updateTunnelUrl: skipped (debounce, same URL)");return}Mo&&(Mo.cancelled=!0);let r={cancelled:!1};Mo=r;let o=Es();Ir({config:fe.urlSync,label:`urlSync ${t}`,log:n=>Qe.warn(n),ctx:r,task:async()=>{let n=await H(`${_}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let s={apiKey:V(e),tunnelUrl:t,localIp:o?`${o}:${k}`:null};return{...s,...It(s)}})())});if(r.cancelled)return!0;if(n.ok)return qs=t,Js=Date.now(),Qe.debug(`urlSync OK: pushed ${t} to server`),Ul(t),!0;let i=await n.text().catch(()=>"");return Qe.warn(`urlSync HTTP ${n.status}: ${i.slice(0,200)}`),!1}}),t&&xs(t)}var yn=null,wn=null,$o=!1,Do=0;async function Bo(e,t){let r={apiKey:e,online:t},o=await H(`${_}/api/session/heartbeat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...It(r)})});return o.ok||Qe.warn(`heartbeat online=${t} HTTP ${o.status}`),o.ok}async function No(){if(!($o||!wn)){$o=!0;try{await Bo(wn,!0),Do=Date.now()}catch(e){Qe.debug(`heartbeat failed: ${e?.message||e}`)}finally{$o=!1}}}function _t(e){let t=V(e);if(t&&X().remoteEnabled!==!1){if(yn&&wn===t){Date.now()-Do>=po&&No();return}Ur(),wn=t,No(),yn=setInterval(No,po),yn.unref?.()}}function Ur({offline:e=!1}={}){yn&&(clearInterval(yn),yn=null);let t=wn;return wn=null,Do=0,!e||!t?null:Bo(t,!1).catch(r=>Qe.debug(`goodbye failed: ${r?.message||r}`))}function pt(e){let t=V(e);if(!t)return Promise.resolve(!1);Ur();let r=Bo(t,!1).catch(o=>(Qe.debug(`offline mark failed: ${o?.message||o}`),!1));return Promise.race([r,new Promise(o=>setTimeout(()=>o(!1),xr))])}var er=null;async function Ul(e){if(er?.url===e)return;let t={url:e};er=t,Rs();try{let r=await ft(e,{timeoutMs:Ji});if(er!==t)return;r&&Rt("healthy")}catch{}finally{er===t&&(er=null),Ps()}}var qe=B("server"),ta=nr.default.dirname((0,ea.fileURLToPath)(__importMetaUrl)),Fl=nr.default.resolve(ta,"./server.cjs"),Zs=nr.default.resolve(ta,"../../index.js");function Fr(e){try{process.platform==="win32"?(0,tr.execSync)(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${e}') do taskkill /F /PID %a`,{stdio:"ignore",windowsHide:!0}):(0,tr.execSync)(`lsof -ti:${e} | xargs kill -9 2>/dev/null || true`,{stdio:"ignore"})}catch{}}function dt(e,t,r){let o=null,n=!1,i=!1,s=!0,a=0,c=null,l=()=>{s&&(Fr(k),s=!1);let u=process.env.NODE_ENV==="development"&&Uo.default.existsSync(Zs),f=u?Zs:Fl;Uo.default.existsSync(f)||(qe.error(`Server not found: ${f}`),process.exit(1));let p={...process.env,PORT:String(k)};u||delete p.NODE_ENV,o=(0,tr.spawn)(zo,[f],{cwd:nr.default.dirname(f),stdio:["ignore","inherit","inherit"],detached:!1,windowsHide:!0,env:ei(p)}),c&&clearTimeout(c),c=setTimeout(()=>{a=0},Yi),o.on("exit",(d,h)=>{if(c&&(clearTimeout(c),c=null),n)return;if(i){i=!1,qe.info("Restarting server (requested)..."),setTimeout(()=>{l(),r?.()},500);return}qe.error(`Server exited unexpectedly (code: ${d}, signal: ${h})`),a++;let w=be(fe.server,a);qe.warn(`Restarting server in ${w}ms (fail#${a})`),t&&t(),setTimeout(()=>{l(),r?.()},w)}),o.on("error",d=>{qe.error(`Server error: ${d.message}`)}),e?.(o)};return l(),{getProcess:()=>o,shutdown:()=>{if(n=!0,!!o){try{o.kill("SIGTERM")}catch{}setTimeout(()=>{try{o&&o.kill("SIGKILL")}catch{}},2e3)}},restart:()=>{if(!o)return!1;i=!0;try{o.kill("SIGTERM")}catch{}return setTimeout(()=>{try{o&&i&&o.kill("SIGKILL")}catch{}},2e3),!0}}}function na(e){return e?.restart?e.restart():!1}function Je({serverManager:e,tunnelProcess:t,exit:r=!0,code:o=0}={}){try{jn()}catch{}try{e?.shutdown?.()}catch{}try{t?.kill?.()}catch{}try{Ae()}catch{}try{Pt()}catch{}try{Fr(k)}catch{}try{Bs()}catch{}try{gi()}catch{}try{Ke("agent")}catch{}try{Ke("cloudflared")}catch{}let n=Ur({offline:!0});if(r){let i=new Promise(a=>setTimeout(a,Xi)),s=n?Promise.race([n,new Promise(a=>setTimeout(a,xr))]):null;Promise.all([i,s]).finally(()=>process.exit(o))}}var zs=!1;function mt(e,t){if(zs)return;zs=!0;let r=!1,o=n=>{r||(r=!0,qe.info(`Stopping 9Remote (${n})...`),Je({serverManager:e,tunnelProcess:t}),qe.info("Server stopped"))};if(process.on("SIGINT",()=>o("SIGINT")),process.on("SIGTERM",()=>o("SIGTERM")),process.on("SIGHUP",()=>o("SIGHUP")),process.platform==="win32"){process.on("SIGBREAK",()=>o("SIGBREAK"));try{import("readline").then(({createInterface:n})=>{n({input:process.stdin,output:process.stdout}).on("SIGINT",()=>o("SIGINT")),process.stdin.isTTY&&process.stdin.unref?.()}).catch(()=>{})}catch{}}process.on("uncaughtException",n=>{qe.error(`Uncaught exception: ${n?.stack||n?.message||n}`),o("uncaughtException"),setTimeout(()=>process.exit(1),fo)}),process.on("unhandledRejection",n=>{qe.error(`Unhandled rejection: ${n?.stack||n?.message||n}`),o("unhandledRejection"),setTimeout(()=>process.exit(1),fo)})}Ot();var oa=R(require("crypto"),1),ia=require("path");var Kl=B("pairing"),sa=(0,ia.join)(G.STATE,"pairing.json"),ra="ABCDEFGHIJKLMNPQRSTUVWXYZ123456789",Hl=2;function aa(){let e="";for(let t=0;t<Hl;t++)e+=ra[oa.default.randomInt(ra.length)];return e}function Wl(){let e=di(sa,null);return!e||Date.now()>e.expiresAt?null:e}function jl(e){try{Fe(sa,e)}catch(t){Kl.error(`persist pairing state: ${t.message}`)}}function ca(e,t,r,o=null){jl({tempKey:e,tail:t,expiresAt:r,workerUrl:o})}function la(){let e=Wl();return e?{tempKey:e.tempKey,tail:e.tail,expiresAt:e.expiresAt}:null}var Fo=B("session"),Gl=10;async function rr(e,t){let r=async()=>{let o=await H(`${t}/api/temp-key/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((()=>{let n={apiKey:V(e),expiryMinutes:Gl};return{...n,...It(n)}})())});if(!o.ok){let n=await o.json().catch(()=>null);throw new Error(n?.error||`HTTP ${o.status}`)}return o.json()};try{let o;try{o=await r()}catch(i){if(Fo.warn(`Temp key creation failed (${i.message}) \u2014 re-registering session`),!await ir(e,t))throw i;o=await r()}let n=aa();return ca(o.tempKey,n,o.expiresAt,t),{...o,oneTimeKey:`${o.tempKey}${n}`}}catch(o){return Fo.error(`Temp key creation failed: ${o?.message||o}`),null}}function or(e,t){return t?.tempKey?`${e}/login?k=${t.tempKey}#${t.oneTimeKey}`:`${e}/login`}async function ir(e,t,r,o){try{let n=await H(`${t}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:lt(),hostX25519Key:ut(),tempKey:la()?.tempKey||void 0})});if(!n.ok)throw new Error(`HTTP ${n.status}`);return r&&await H(`${t}/api/session/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),tunnelUrl:r,...It({apiKey:V(e),tunnelUrl:r})})}).catch(()=>{}),o&&V(o)!==V(e)&&await H(`${t}/api/session/delete`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(o),...It({apiKey:V(o)})})}).catch(()=>{}),!0}catch(n){return Fo.error(`Session registration failed: ${n?.message||n}`),!1}}var Ct=B("tunnel");async function Vl(e,t,r,o){let n=0;for(;;){n++;try{return await Ye(e,t,r)}catch(i){let s=be(fe.tunnelSpawn,n);Ct.warn(`spawn attempt ${n} failed: ${i?.message||i} \u2014 retry in ${s}ms`),o?.({attempt:n,delay:s}),await new Promise(a=>setTimeout(a,s))}}}function Ze({onUrlUpdate:e,setTunnel:t,onRetry:r}){return async o=>{try{let n=await Vl(o,e,null,r);ze(),t(n.child),await e(n.tunnelUrl),Ct.info(`Tunnel restarted: ${n.tunnelUrl}`)}catch(n){Ct.error(`Tunnel restart failed: ${n?.message||n}`)}}}var Kr=null;function ze(){Kr&&(Kr.cancelled=!0,Kr=null)}function vn(e,{onUrlUpdate:t,onRestart:r,setActiveTunnel:o,onReady:n}){ze();let i={cancelled:!1};return Kr=i,Ir({config:fe.tunnelRateLimit,task:async()=>{if(i.cancelled)return!0;if(Ds())return Ct.info("bg-tunnel: a tunnel is already live \u2014 standing down"),!0;let s=await Ye(e,t,r);if(i.cancelled){try{Ae()}catch{}return!0}try{o?.(s.child),await t?.(s.tunnelUrl),await n?.(s),Ct.info(`bg tunnel up: ${s.tunnelUrl}`)}catch(a){Ct.error(`bg tunnel post-spawn failed: ${a?.message||a}`)}return!0},label:"bg-tunnel",log:s=>Ct.info(s),ctx:i}),i}var Vo=R(Ca(),1);var tu=B("session");function nu(e,t="\u{1F4F1} Scan QR to connect:"){console.log(ce.orange(`
|
|
198
|
+
${t}`)),Vo.default.generate(e,{small:!0,type:"terminal",margin:0},r=>{console.log(r.trim())})}function ru(e){return new Promise(t=>{Vo.default.generate(e,{small:!0,type:"terminal",margin:0},r=>{t(ce.orangeDim("\u{1F4F1} Scan QR to connect:")+`
|
|
199
|
+
`+r.trim())})})}async function Gr(e,t){let r=await rr(e,_),o=Math.min(He.headerWidth,process.stdout.columns||55);if(!r){tu.warn("Temp key creation failed \u2014 showing UI without a QR"),await C(I.READY,{tunnelUrl:t,permanentKey:e,workerUrl:_}),console.log(m.red(`
|
|
200
|
+
\u274C Failed to create one-time key \u2014 generate a new one from the menu`)),console.log(ce.orange("\u2550".repeat(o))),console.log(m.white("App URL".padEnd(14))+m.gray(`${_}/login`)),console.log(m.white("Key".padEnd(14))+m.gray(e)),console.log(ce.orange("\u2550".repeat(o)));return}let n=or(_,r);await C(I.READY,{tunnelUrl:t,oneTimeKey:r.oneTimeKey,oneTimeKeyExpiresAt:r.expiresAt,permanentKey:e,qrUrl:n,workerUrl:_}),nu(n),console.log(m.gray(`
|
|
200
201
|
QR will expire in 10 minutes (one-time use)
|
|
201
|
-
`)),console.log(
|
|
202
|
+
`)),console.log(ce.orange("\u2550".repeat(o))),console.log(m.white("App URL".padEnd(14))+m.gray(`${_}/login`)),console.log(m.white("One-Time Key".padEnd(14))+ce.orange.bold(r.oneTimeKey)),console.log(m.white("Key".padEnd(14))+m.gray(e)),console.log(ce.orange("\u2550".repeat(o)))}async function En(e,t,r,o=""){let n=Math.min(He.headerWidth,process.stdout.columns||He.headerWidth),i=[];return e&&r?(i.push(await ru(r)),i.push(m.gray(`
|
|
202
203
|
QR expires in 30 minutes (one-time use)
|
|
203
204
|
`))):i.push(m.gray(`
|
|
204
205
|
(One-time key used \u2014 generate a new one from menu)
|
|
205
|
-
`)),i.push(
|
|
206
|
-
`)}var
|
|
207
|
-
\u{1F310} UI ready at ${i}`));let s=null;await
|
|
208
|
-
\u274C Failed to launch background: ${c.message}`)),process.exit(1)}let i=Date.now()+
|
|
206
|
+
`)),i.push(ce.orange("\u2550".repeat(n)),m.white("App URL".padEnd(14))+m.gray(`${_}/login`)),ni.showTunnelUrlInMenu&&i.push(m.white("Tunnel".padEnd(14))+(o?m.cyan(o):m.gray("\u2014"))),i.push(m.white("One-Time Key".padEnd(14))+(e?ce.orange.bold(e)+m.dim(" (expires in 30m)"):m.gray("\u2014")),m.white("Key".padEnd(14))+m.dim(t),ce.orange("\u2550".repeat(n))),i.join(`
|
|
207
|
+
`)}var de=B("cmd");function yt(e,t,r,o){let n=!1;setInterval(async()=>{if(n)return;let i=yi();if(i){n=!0;try{if(i==="stop-tunnel")await Ma(e,t,r);else if(i==="restart-tunnel")await Ma(e,t,r),await $a(e,t,r);else if(i==="start-tunnel"){if(await $a(e,t,r)==="alreadyRunning"){n=!1;return}}else if(i==="regenerate-key")await ou();else if(i==="shutdown")iu(e,t);else if(i==="update"){let s=await os();de.info(`cmd update -> ${s?"started":"SKIPPED (see reasons above)"}`)}else i==="restart"&&na(o?.())}catch(s){de.error(`cmd "${i}" failed: ${s?.message||s}`)}finally{n=!1}}},Te.cmdMs)}async function Ma(e,t,r){ze(),jn();let o=e();o&&(o.kill(),t(null),de.info("Tunnel stopped")),r&&await pt(r),await C(I.STOPPED,{tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:""}),mn({tunnelUrl:"",running:!0})}async function $a(e,t,r){if(X().remoteEnabled===!1){de.info("Start skipped \u2014 remote is disabled");return}let o=e();if(o)if(o.killed||o.exitCode!=null)t(null);else{let n=await J("/api/ui/state");return await C(I.READY,{tunnelUrl:n?.tunnelUrl||""}),"alreadyRunning"}ze(),de.info("Starting...");try{await C(I.PREPARING),await Zn(Mr),await C(I.CONNECTING);let n=await H(`${_}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(r),hostPublicKey:lt(),hostX25519Key:ut()})});if(!n.ok)throw new Error(`Session create failed: ${n.status}`);await Q("/api/signaling/retry",{}),_t(r),await C(I.TUNNELING);let i=async l=>{await Lt(r,l),await K({tunnelUrl:l}),rn(l),mn({tunnelUrl:l,running:!0})},s=({attempt:l,delay:u})=>{K({tunnelRetry:{attempt:l,delay:u,at:Date.now()}})},a=null;try{a=await Ye(k,i,Ze({onUrlUpdate:i,setTunnel:l=>t(l),onRetry:s}))}catch(l){de.error(`Tunnel spawn failed: ${l?.message||l} \u2014 QR RTC-only, bg retry`)}K({tunnelRetry:null});let c="";a&&(t(a.child),c=a.tunnelUrl,await C(I.VERIFYING),await ft(c)||(de.warn("Tunnel health check timed out \u2014 bg reconnect"),c="",t(null),a=null)),await Gr(r,c),await C(I.READY,{tunnelUrl:c}),a||vn(k,{onUrlUpdate:i,onRestart:Ze({onUrlUpdate:i,setTunnel:l=>t(l),onRetry:s}),setActiveTunnel:t,onReady:async l=>{await C(I.READY,{tunnelUrl:l.tunnelUrl})}})}catch(n){de.error(`Failed to start: ${n.message}`),await C(I.STOPPED)}}async function ou(){if(X().remoteEnabled===!1){de.info("Key regeneration skipped \u2014 remote is disabled");return}let e=await Ut(),t=Ft(e),r=dr();if(!await ir(t,_,hi()?.tunnelUrl,r?.key)){de.error("Key regeneration aborted \u2014 could not register the new key");return}Et(e,t,r?.name||"Default"),await K({permanentKey:t,oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:"",pairingUsed:!0}),de.info(`Key regenerated: ${fr(t)}`)}function iu(e,t){ze(),de.info("Shutting down 9Remote completely...");let r=e();t(null),Je({tunnelProcess:r}),de.info("9Remote stopped")}Ot();async function Na(){Ie("agent",process.pid),Jt(ke());let e=await nt(),t=process.argv.find(c=>c.startsWith("--theme=")),r=t?t.split("=")[1]:null,o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(c=>setTimeout(c,ge.serverBootMs));let i=`http://localhost:${k}`;console.log(m.green(`
|
|
208
|
+
\u{1F310} UI ready at ${i}`));let s=null;X().remoteEnabled===!1&&await pt(e.key),await K({permanentKey:e.key,step:I.STOPPED,theme:r}),mt(n,null),yt(()=>s,c=>{s=c},e.key,()=>n),await zn({port:k,onQuit:()=>{let c=s;s=null,Je({serverManager:n,tunnelProcess:c,exit:!1}),Pt(),setTimeout(()=>process.exit(0),500)},onOpenUI:()=>kt(i)}),mn({tunnelUrl:"",running:!0}),(process.argv.includes("--start")||process.argv.includes("--skip-update"))&&X().remoteEnabled!==!1&&Ht("start-tunnel"),await new Promise(()=>{})}Ot();async function Da(){Ie("agent",process.pid),Vi().catch(()=>{});let e=await nt(),t=process.argv.find(u=>u.startsWith("--theme=")),r=t?t.split("=")[1]:null,o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(u=>setTimeout(u,ge.serverBootMs));let i=`http://localhost:${k}`,s=null;await K({permanentKey:e.key,step:I.STOPPED,theme:r});let a=()=>{let u=s;s=null,Je({serverManager:n,tunnelProcess:u,exit:!1})};mt(n,null),yt(()=>s,u=>{s=u},e.key,()=>n);try{Ke("cloudflared")}catch{}(process.argv.includes("--start")||process.argv.includes("--skip-update"))&&X().remoteEnabled!==!1&&Ht("start-tunnel"),await zn({port:k,onQuit:a,onOpenUI:()=>kt(i)})&&_o({title:"9Remote is running",message:`Open ${i} or use the tray icon to manage.`}),await new Promise(()=>{})}var $t=B("mode");async function su(e){$t.info("Starting server..."),await C(I.PREPARING);try{Ae(),await new Promise(l=>setTimeout(l,ge.killCloudflaredMs))}catch{}let t=X().remoteEnabled===!1,r=!t;if(t&&await pt(e),r)try{let l=await H(`${_}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e),hostPublicKey:lt(),hostX25519Key:ut()})});if(!l.ok)throw new Error(`Session create failed: ${l.status}`);_t(e)}catch(l){$t.error(`Session create failed: ${l.message} \u2014 local-only, retry from Web UI`),r=!1}let o=await le(),n=o?{getProcess:()=>null,shutdown:()=>{}}:dt(null,null);o||await new Promise(l=>setTimeout(l,ge.serverBootMs)),$t.info("Starting tunnel..."),await C(I.CONNECTING);let i={current:null},s="",a=async l=>{$t.info(`Tunnel URL rotated: ${l}`),await Lt(e,l),K({tunnelUrl:l}),rn(l)},c=null;if(r)try{c=await Ye(k,a,Ze({onUrlUpdate:a,setTunnel:l=>{i.current=l}}))}catch(l){$t.error(`Tunnel spawn failed: ${l.message} \u2014 RTC-only, bg retry`)}return c&&(i.current=c.child,s=c.tunnelUrl,await ft(s)||($t.warn("Tunnel health check timed out \u2014 bg reconnect"),i.current=null,s="",c=null)),!c&&r&&vn(k,{onUrlUpdate:a,onRestart:Ze({onUrlUpdate:a,setTunnel:l=>{i.current=l}}),setActiveTunnel:l=>{i.current=l},onReady:async l=>{await C(I.READY,{tunnelUrl:l.tunnelUrl})}}),s&&await Lt(e,s),r?await C(I.READY,{tunnelUrl:s}):await C(I.STOPPED,{tunnelUrl:""}),_n({apiKey:e,tunnelUrl:s,serverPid:n.getProcess()?.pid,tunnelPid:i.current?.pid}),{serverManager:n,tunnelRef:i,tunnelUrl:s,remoteOnline:r}}async function Ba(){Jt(ke());let e=await nt();$t.info(`Using key: ${fr(e.key)} (${e.name})`);let{serverManager:t,tunnelRef:r,tunnelUrl:o,remoteOnline:n}=await su(e.key);n?await Gr(e.key,o):console.log(`\u26A0 ${X().remoteEnabled===!1?"Remote is disabled \u2014 enable it in Web UI settings":'Remote not connected \u2014 tap "remote \xB7 offline" in the Web UI to retry'}. Local mode.`),mt(t,r.current),yt(()=>r.current,s=>{r.current=s},e.key);let i=Date.now();setInterval(()=>{let s=Math.floor((Date.now()-i)/1e3),a=Math.floor(s/3600),c=Math.floor(s%3600/60),l=s%60;K({uptime:`${a}:${String(c).padStart(2,"0")}:${String(l).padStart(2,"0")}`})},Te.statsMs),await new Promise(()=>{})}var Ua=R(require("path"),1),Fa=R(require("fs"),1);Ot();async function Ka(){let e=`http://localhost:${k}`;await le()&&(Fr(k),await new Promise(c=>setTimeout(c,500)));let t=["--tray"],r=process.argv.find(c=>c.startsWith("--theme="));r&&t.push(r);let o=Mn;try{Fa.default.mkdirSync(Ua.default.dirname(o),{recursive:!0})}catch{}let n=null;try{n=ji(t),n&&Ie("agent",n)}catch(c){console.log(m.red(`
|
|
209
|
+
\u274C Failed to launch background: ${c.message}`)),process.exit(1)}let i=Date.now()+Te.bgServerReadyTimeoutMs,s=!1;for(;Date.now()<i;){if(await le()){s=!0;break}await new Promise(c=>setTimeout(c,Te.bgServerReadyIntervalMs))}s||(console.log(m.red(`
|
|
209
210
|
\u274C Background server failed to start.`)),console.log(m.gray(` Check log: ${o}
|
|
210
|
-
`)),process.exit(1))
|
|
211
|
+
`)),process.exit(1)),Ht("start-tunnel"),kt(e);let a=n?` (PID: ${n})`:"";console.log(m.green(`
|
|
211
212
|
\u{1F310} 9Remote running at ${e}${a}`)),console.log(m.gray(`\u{1F4A1} Log: ${o}
|
|
212
|
-
`)),await new Promise(c=>setTimeout(c,
|
|
213
|
+
`)),await new Promise(c=>setTimeout(c,ge.bgSpawnFlushMs)),process.exit(0)}var Ha=R(require("readline"),1);var Vr=B("mode"),Sn=null;async function Wa(){Ie("agent",process.pid),console.clear(),ms(),ws(!0),await C(I.PREPARING);let e=await nt(),t=null,r={getProcess:()=>null,shutdown:()=>{}};if(!await le()){r=dt(null,null,()=>{if(process.stdin.isTTY){try{process.stdin.setRawMode(!1)}catch{}try{process.stdin.setRawMode(!0),process.stdin.resume()}catch{}}try{Ha.default.emitKeypressEvents(process.stdin)}catch{}t?.()});let g=Date.now()+Te.serverReadyTimeoutMs;for(;Date.now()<g&&!await le();)await new Promise(b=>setTimeout(b,Te.serverReadyIntervalMs))}try{Ae(),await new Promise(g=>setTimeout(g,ge.killCloudflaredTuiMs))}catch{}try{await Zn(Mr)}catch(g){Vr.error(`cloudflared setup failed: ${g?.message||g} \u2014 retry from Web UI`)}await C(I.CONNECTING);let n=X().remoteEnabled===!1,i=!n;if(n&&await pt(e.key),i)try{let g=await H(`${_}/api/session/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:V(e.key),hostPublicKey:lt(),hostX25519Key:ut()})});if(!g.ok)throw new Error(`Session create failed: ${g.status}`);await Q("/api/signaling/retry",{}),_t(e.key)}catch(g){Vr.error(`Failed to connect: ${g.message}`),i=!1}await C(I.TUNNELING);let s=i?await rr(e.key,_):null,a=or(_,s),c=s?.oneTimeKey||"",l=a,u="",f=null,p={current:null},d=async g=>{u=g,await Lt(e.key,g),await K({tunnelUrl:g}),rn(g),f!==null&&(f=await En(c,e.key,l,u),t?.())},h=null;if(i)try{h=await Ye(k,d,Ze({onUrlUpdate:d,setTunnel:g=>{p.current=g}}))}catch(g){Vr.error(`Tunnel spawn failed: ${g?.message||g} \u2014 QR RTC-only, bg retry`)}h&&(p.current=h.child,u=h.tunnelUrl,_n({apiKey:e.key,tunnelUrl:h.tunnelUrl,tunnelPid:h.child?.pid}),await C(I.VERIFYING),await ft(h.tunnelUrl)?await d(h.tunnelUrl):(Vr.warn("Tunnel health check timed out \u2014 bg reconnect"),p.current=null,u="",h=null)),!h&&i&&vn(k,{onUrlUpdate:d,onRestart:Ze({onUrlUpdate:d,setTunnel:g=>{p.current=g}}),setActiveTunnel:g=>{p.current=g},onReady:async g=>{_n({apiKey:e.key,tunnelUrl:g.tunnelUrl,tunnelPid:g.child?.pid}),await C(I.READY,{tunnelUrl:g.tunnelUrl})}}),i?await C(I.READY,{tunnelUrl:u,oneTimeKey:s?.oneTimeKey||"",oneTimeKeyExpiresAt:s?.expiresAt||null,permanentKey:e.key,qrUrl:a,workerUrl:_}):(await C(I.STOPPED,{tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,permanentKey:e.key,qrUrl:"",workerUrl:_}),console.log(m.red(`
|
|
214
|
+
\u26A0 ${n?"Remote is disabled \u2014 enable it in Web UI settings":'Remote not connected \u2014 tap "remote \xB7 offline" in the Web UI to retry'}. Local mode.
|
|
215
|
+
`))),await new Promise(g=>setTimeout(g,ge.trayReadyMs)),f=await En(c,e.key,l,u);let w=[],E=!1,O=()=>{E||t?.()},T=async(g,b,L)=>{if(!E){E=!0;try{let $=await hs(b,L);await Q(`/api/device/${$?"approve":"reject"}`,{socketId:g})}catch{}finally{E=!1,t?.()}}},A=gs(k,async(g,b)=>{if(g==="log"&&b.message)w.push(b.message),w.length>He.maxLogLines&&w.shift();else if(g==="state"){let L=b.permanentKey||e.key,$=b.oneTimeKey!==void 0?b.oneTimeKey:c,Y=b.qrUrl!==void 0?b.qrUrl:l,re=b.tunnelUrl!==void 0?b.tunnelUrl:u;($!==c||L!==e.key||re!==u)&&(c=$,l=Y,u=re,b.permanentKey&&(e={...e,key:b.permanentKey}),f=await En(c,e.key,l,u),O())}else g==="permissions"?(E||Promise.resolve(Sn?.()).catch(()=>{}),O()):g==="autostart"||g==="sleepInhibit"?(E||Promise.resolve(Sn?.()).catch(()=>{}),O()):g==="deviceApproval"&&b.action==="pending"&&await T(b.socketId,b.deviceId,b.ip)}),P=setInterval(async()=>{if(!E)try{let b=(await J("/api/device/pending"))?.pending?.[0];b&&await T(b.socketId,b.deviceId,b.ip)}catch{}},Te.pendingApprovalMs);mt({getProcess:r.getProcess,shutdown:()=>{ze(),r.shutdown();try{p.current?.kill()}catch{}A(),clearInterval(P)}}),yt(()=>p.current,g=>{p.current=g},e.key,()=>r),await au(e,u,()=>f,g=>{f=g},g=>{t=g},()=>{ze();try{A()}catch{}try{clearInterval(P)}catch{}Je({serverManager:r,tunnelProcess:p.current,exit:!1})},w)}async function au(e,t,r,o,n,i,s){for(;;){let{desktopEnabled:a,remoteAvailable:c,autoApprove:l}=await Eo(),u=[{label:"Open Web UI",action:"webui"}];X().remoteEnabled!==!1&&u.push({label:"Keys \u25B6",action:"keys"}),c&&u.push({label:`Remote Desktop: ${a?m.green("ON"):m.gray("OFF")} \u25B6`,action:"desktop"}),u.push({label:`Manage Devices \u25B6 ${m.dim("(Auto-approve:")} ${l?m.green("ON"):m.gray("OFF")}${m.dim(")")}`,action:"devices"},{label:"Settings \u25B6",action:"settings"},{label:"View Logs",action:"logs"},{label:m.gray("Exit"),action:"exit"});let f=null;n(()=>f?.());let p=await Me("",u,0,r,h=>{f=h},i),d=p>=0?u[p].action:"exit";if(d==="webui"){let h=`http://localhost:${k}`,{openBrowser:w}=await Promise.resolve().then(()=>(Ot(),Xs));w(h),console.log(m.green(`
|
|
213
216
|
\u{1F310} Opening ${h}
|
|
214
|
-
`))}else if(d==="keys")await
|
|
217
|
+
`))}else if(d==="keys")await cu(e,t,o,r);else if(d==="desktop")await fu();else if(d==="devices")await pu();else if(d==="settings")await uu();else if(d==="logs")await du();else{try{i?.()}catch{}console.log(m.gray(`
|
|
215
218
|
Goodbye!
|
|
216
|
-
`)),process.exit(0)}}}async function
|
|
219
|
+
`)),process.exit(0)}}}async function cu(e,t,r,o){let n=X().remoteEnabled===!1?[{label:m.gray("Remote access is off \u2014 enable it in the Web UI"),action:"back"}]:[{label:"New One-Time Key",action:"otk"},{label:"Regenerate Permanent Key",action:"regen"},{label:m.gray("\u2190 Back"),action:"back"}],i=await Me("Keys",n,0,o),s=i>=0?n[i].action:"back";if(s==="otk"){let a=await rr(e.key,_);if(a){let c=or(_,a);r(await En(a.oneTimeKey,e.key,c,t)),await K({oneTimeKey:a.oneTimeKey,oneTimeKeyExpiresAt:a.expiresAt,qrUrl:c})}}else if(s==="regen"&&await wo(m.yellow("Replace current key and disconnect all sessions? Continue?"))){let c=await Ut(),l=Ft(c);if(!await ir(l,_,t,e.key)){r(m.red("Key regeneration failed \u2014 could not reach the server"));return}let u=Et(c,l,e.name||"Default");Object.assign(e,u),r(await En("",e.key,"",t)),await K({permanentKey:e.key,oneTimeKey:"",oneTimeKeyExpiresAt:null,qrUrl:"",pairingUsed:!0})}}var Yo={none:"Off","30m":"Off after 30 min idle","1h":"Off after 1 hour idle","2h":"Off after 2 hours idle","4h":"Off after 4 hours idle","24h":"Off after 24 hours idle",never:"Never off"};async function lu(e,t){let r=t.map(s=>({label:Yo[s]||s,action:s}));r.push({label:m.gray("\u2190 Back"),action:"back"});let o=Math.max(0,t.indexOf(e)),n=await Me("Prevent sleep",r,o),i=n>=0?r[n].action:"back";i!=="back"&&await Q("/api/sleep-inhibit",{mode:i})}async function uu(){for(;;){let e=!1,t="never",r=[],o=()=>[{label:`Launch on system startup: ${e?m.green("ON"):m.gray("OFF")}`,action:"autostart"},{label:`Prevent sleep: ${t==="none"?m.gray(Yo.none):m.green(Yo[t]||t)} \u25B6`,action:"sleep"},{label:m.gray("\u2190 Back"),action:"back"}],n=o(),i=null,s=async()=>{let l=await Eo();e=!!l.autoStart,t=l.sleepInhibitMode||"never",r=l.sleepInhibitPresets||[],n=o(),i?.()};await s(),Sn=s;let a=await Me("Settings",n,0,"",l=>{i=l});Sn=null;let c=a>=0?n[a].action:"back";if(c==="autostart")await Q("/api/autostart",{enabled:!e});else if(c==="sleep")await lu(t,r);else return}}async function fu(){for(;;){let e=!1,t={screenRecording:!1,accessibility:!1},r=()=>({toggle:`Toggle: ${e?m.green("ON \u2192 turn OFF"):m.gray("OFF \u2192 turn ON")}`,sr:`Screen Recording ${t.screenRecording?m.green("\u2713"):m.red("\u2717 (click to grant)")}`,ax:`Mouse & Keyboard control ${t.accessibility?m.green("\u2713"):m.red("\u2717 (click to grant)")}`}),o=[{label:""},{label:""},{label:""},{label:m.gray("\u2190 Back")}],n=null,i=async()=>{let a=await J("/api/ui/state")||{};e=!!a.desktopEnabled,t={screenRecording:!!a.screenRecording,accessibility:!!a.accessibility};let c=r();o[0].label=c.toggle,o[1].label=c.sr,o[2].label=c.ax,n?.()};await i(),Sn=i;let s=await Me("Remote Desktop",o,0,"",a=>{n=a});if(Sn=null,s===0)await Q("/api/desktop/toggle",{enabled:!e});else if(s===1&&!t.screenRecording)await Q("/api/permissions/request",{type:"screenRecording"})||Or("screenRecording");else if(s===2&&!t.accessibility)await Q("/api/permissions/request",{type:"accessibility"})||Or("accessibility");else if(s===3||s===-1)return}}async function pu(){for(;;){let[e,t]=await Promise.all([J("/api/device/approved"),J("/api/device/auto-approve")]),r=e?.devices||[],o=!!t?.enabled,n=[{label:`Auto-approve new devices: ${o?m.green("ON"):m.gray("OFF")}`,action:"toggle"},...r.map(a=>{let c=a.deviceId.slice(0,8),l=a.approvedAt?new Date(a.approvedAt).toLocaleString():"unknown";return{label:`${c}... ${m.dim(l)}`,action:"remove",deviceId:a.deviceId}}),{label:m.gray("\u2190 Back"),action:"back"}],i=await Me(`Approved Devices (${r.length})`,n,0);if(i===-1)return;let s=n[i];if(s.action==="back")return;if(s.action==="toggle"){await Q("/api/device/auto-approve",{enabled:!o});continue}s.action==="remove"&&await wo(m.yellow(`Remove device ${s.deviceId.slice(0,8)}...?`))&&await Q("/api/device/remove",{deviceId:s.deviceId})}}async function du(){let e=xi(ti),t=e.length?e.join(`
|
|
217
220
|
`):m.gray(" No logs yet"),r=`
|
|
218
|
-
${m.dim("Log file:")} ${m.cyan(
|
|
219
|
-
${m.dim(`Tail: tail -f ${
|
|
221
|
+
${m.dim("Log file:")} ${m.cyan(Mn)}
|
|
222
|
+
${m.dim(`Tail: tail -f ${Mn}`)}`;await Me("Logs",[{label:m.gray("\u2190 Back")}],0,t+r)}async function ja(){let e=ke(),t=await rs(),r=yo(e,t?.latest??null),o=[];t?.latest&&o.push({label:m.yellow(`Update to v${t.latest}`),action:"update"}),o.push({label:"Open Web UI (background)",action:"ui"},{label:"Terminal UI",action:"tui"},{label:m.gray("Exit"),action:"exit"});let n=await Me("",o,0,r),i=n>=0?o[n].action:"exit";if(i==="update"){let s=Math.min(He.headerWidth,process.stdout.columns||He.headerWidth);kr(),console.log(ce.orange(`
|
|
220
223
|
`+"\u2550".repeat(s))),console.log(m.gray(` \u2713 Stopped running instances
|
|
221
224
|
`)),console.log(m.yellow(` \u2B06 Run this command to update:
|
|
222
|
-
`)),console.log(m.white.bold(` npm i -g ${
|
|
223
|
-
`)),console.log(
|
|
224
|
-
`),process.exit(0)}else i==="ui"?await
|
|
225
|
+
`)),console.log(m.white.bold(` npm i -g ${Ue}
|
|
226
|
+
`)),console.log(ce.orange("\u2550".repeat(s))+`
|
|
227
|
+
`),process.exit(0)}else i==="ui"?await Ka():i==="tui"?await Wa():process.exit(0)}var Ga=[["9remote","Interactive menu (TUI). Falls back to help with no TTY."],["9remote start","Run server + tunnel in foreground (headless)."],["9remote key","Show permanent key + connect URL."],["9remote key --new","Regenerate the permanent key."],["9remote otk","Create a fresh one-time connect key + URL."],["9remote devices","List approved devices."],["9remote auto-approve <on|off>","Toggle device auto-approve."],["9remote approve <socketId>","Approve a pending device."],["9remote help","Show this help."]];function Xo(){Jt(ke()),console.log(m.white.bold(`
|
|
225
228
|
Usage:
|
|
226
|
-
`));let e=Math.max(...
|
|
229
|
+
`));let e=Math.max(...Ga.map(([t])=>t.length))+2;for(let[t,r]of Ga)console.log(" "+m.cyan(t.padEnd(e))+m.gray(r));console.log()}async function sr(){return await le()?!0:(console.log(m.red(`
|
|
227
230
|
\u2717 Server not running. Start it first: `)+m.cyan("9remote start")+`
|
|
228
|
-
`),!1)}async function
|
|
231
|
+
`),!1)}async function mu(e){if(!await sr())return;if(e){let r=await Q("/api/key/regenerate"),o=r&&r.ok?await r.json():null;if(!o?.permanentKey){console.log(m.red(`
|
|
229
232
|
\u2717 Regenerate failed
|
|
230
233
|
`));return}console.log(m.green(`
|
|
231
234
|
\u2713 New key: `)+m.white.bold(o.permanentKey)+`
|
|
232
|
-
`);return}let t=await
|
|
235
|
+
`);return}let t=await J("/api/ui/state")||{};if(!t.permanentKey){console.log(m.red(`
|
|
233
236
|
\u2717 No key yet. Run: `)+m.cyan("9remote start")+`
|
|
234
237
|
`);return}console.log(m.white(`
|
|
235
|
-
Key`.padEnd(14))+m.white.bold(t.permanentKey)),t.qrUrl&&console.log(m.white("Connect URL".padEnd(14))+m.cyan(t.qrUrl)),console.log(m.white("App URL".padEnd(14))+m.gray(`${
|
|
236
|
-
`)}async function
|
|
238
|
+
Key`.padEnd(14))+m.white.bold(t.permanentKey)),t.qrUrl&&console.log(m.white("Connect URL".padEnd(14))+m.cyan(t.qrUrl)),console.log(m.white("App URL".padEnd(14))+m.gray(`${_}/login`)+`
|
|
239
|
+
`)}async function hu(){if(!await sr())return;let e=await Q("/api/key/one-time"),t=e&&e.ok?await e.json():null;if(!t?.qrUrl){console.log(m.red(`
|
|
237
240
|
\u2717 Failed to create one-time key
|
|
238
241
|
`));return}console.log(m.green(`
|
|
239
242
|
\u2713 One-time key (30 min): `)+m.white.bold(t.oneTimeKey)),console.log(m.white("Connect URL ")+m.cyan(t.qrUrl)+`
|
|
240
|
-
`)}async function
|
|
243
|
+
`)}async function gu(){if(!await sr())return;let t=(await J("/api/device/approved")||{}).devices||[],r=await J("/api/device/auto-approve")||{};if(console.log(m.white(`
|
|
241
244
|
Auto-approve: `)+(r.enabled?m.green("ON"):m.gray("OFF"))),!t.length){console.log(m.gray(`No approved devices
|
|
242
|
-
`));return}console.log(m.white(`Approved devices (${t.length}):`));for(let o of t)console.log(" "+m.cyan(o.deviceId));console.log()}async function
|
|
245
|
+
`));return}console.log(m.white(`Approved devices (${t.length}):`));for(let o of t)console.log(" "+m.cyan(o.deviceId));console.log()}async function yu(e){if(!await sr())return;let t=e==="on";if(e!=="on"&&e!=="off"){console.log(m.red(`
|
|
243
246
|
\u2717 Usage: 9remote auto-approve <on|off>
|
|
244
|
-
`));return}let r=await
|
|
247
|
+
`));return}let r=await Q("/api/device/auto-approve",{enabled:t}),o=r&&r.ok?await r.json():null;console.log(m.green(`
|
|
245
248
|
\u2713 Auto-approve: `)+(o?.enabled?m.green("ON"):m.gray("OFF"))+`
|
|
246
|
-
`)}async function
|
|
249
|
+
`)}async function wu(e){if(!await sr())return;if(!e){let n=(await J("/api/device/pending")||{}).pending||[];if(!n.length){console.log(m.gray(`
|
|
247
250
|
No pending devices
|
|
248
251
|
`));return}console.log(m.white(`
|
|
249
252
|
Pending devices (${n.length}):`));for(let i of n)console.log(" "+m.cyan(i.socketId)+m.gray(` ${i.deviceId?.slice(0,8)||""} ${i.ip||""}`));console.log(m.gray(`
|
|
250
253
|
Approve with: `)+m.cyan("9remote approve <socketId>")+`
|
|
251
|
-
`);return}let t=await
|
|
254
|
+
`);return}let t=await Q("/api/device/approve",{socketId:e}),r=t&&t.ok?await t.json():null;console.log(r?.ok?m.green(`
|
|
252
255
|
\u2713 Approved
|
|
253
256
|
`):m.red(`
|
|
254
257
|
\u2717 Approve failed (invalid socketId?)
|
|
255
|
-
`))}async function
|
|
256
|
-
`),process.exit(0));
|
|
258
|
+
`))}async function Va(e){let t=e[2],r=e.slice(3);switch(t){case"help":case"-h":case"--help":return Xo(),!0;case"key":return await mu(r.includes("--new")),!0;case"otk":return await hu(),!0;case"devices":return await gu(),!0;case"auto-approve":return await yu(r[0]),!0;case"approve":return await wu(r[0]),!0;default:return!1}}var Qo=process.argv[2];(Qo==="version"||Qo==="--version"||Qo==="-v")&&(process.stdout.write(ke()+`
|
|
259
|
+
`),process.exit(0));Ai();async function vu(){let e=process.argv[2];if(await Va(process.argv))return;process.argv.includes("--tray")||process.argv.includes("--auto")||process.argv.includes("--start")||kr(),e==="ui"?await Na():e==="start"||process.argv.includes("--auto")?await Ba():process.argv.includes("--tray")||process.argv.includes("--start")?await Da():process.stdin.isTTY?await ja():Xo()}vu().catch(console.error);
|