phirepass-widgets 0.0.103 → 0.0.105
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/phirepass-rdp.cjs.entry.js +2 -2
- package/dist/cjs/phirepass-sftp-client.cjs.entry.js +2 -2
- package/dist/cjs/phirepass-terminal.cjs.entry.js +145 -3
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/cjs/{protocol-9IbZ-NTW.js → protocol-CrMtxghg.js} +3 -3
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.css +48 -0
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +132 -0
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.css +95 -2
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +169 -1
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/{phirepass-widgets/p-D4vz9Xu4.js → components/p-YZKVM0AX.js} +1 -1
- package/dist/components/phirepass-rdp.js +1 -1
- package/dist/components/phirepass-sftp-client.js +1 -1
- package/dist/components/phirepass-terminal.js +5 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-rdp.entry.js +2 -2
- package/dist/esm/phirepass-sftp-client.entry.js +2 -2
- package/dist/esm/phirepass-terminal.entry.js +145 -3
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/esm/{protocol-D4vz9Xu4.js → protocol-YZKVM0AX.js} +2 -2
- package/dist/phirepass-widgets/{p-471340b8.entry.js → p-0f7d5b4b.entry.js} +1 -1
- package/dist/phirepass-widgets/{p-dc4051cc.entry.js → p-4c11e075.entry.js} +5 -5
- package/dist/{components/p-D4vz9Xu4.js → phirepass-widgets/p-YZKVM0AX.js} +1 -1
- package/dist/phirepass-widgets/{p-ca67e389.entry.js → p-c976ff11.entry.js} +1 -1
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/components/phirepass-terminal/phirepass-terminal.d.ts +68 -0
- package/dist/types/components.d.ts +11 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();j.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_authenticate(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){j.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,i,c,s,_){const u=N(n,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(t,j.__wbindgen_export,j.__wbindgen_export2),b=k;var l=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),d=k;const w=N(r,j.__wbindgen_export,j.__wbindgen_export2),g=k;var h=R(i)?0:N(i,j.__wbindgen_export,j.__wbindgen_export2),p=k,m=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),y=k,v=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2);j.channel_create_service(this.__wbg_ptr,u,a,f,b,l,d,w,g,o,h,p,m,y,v,k,R(_)?Number.MAX_SAFE_INTEGER:_>>>0)}delete_service(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_delete_service(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){j.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==j.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==j.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2),c=k;var s=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2);const u=j.channel_new(r,o,i,c,s,k);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){j.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){j.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){j.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){j.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){j.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_on_protocol_message_type(this.__wbg_ptr,e,k,R(t)?0:u(t))}open_rdp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_rdp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_sftp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_sftp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_ssh_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_chmod(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_chmod(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_delete(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_delete(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_ack(this.__wbg_ptr,o,k,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_chunk(this.__wbg_ptr,i,k,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_start(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_list_data(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_mkdir(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_mkdir(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_read_file(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_read_file(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_remove(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_remove(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_rename(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_rename(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_upload_chunk(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(i,j.__wbindgen_export);j.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,k,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_upload_start(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,k,o,i,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_write_file(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(r,j.__wbindgen_export);j.channel_send_sftp_write_file(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_ssh_terminal_resize(n,t,e,r,o,i){const c=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_terminal_resize(this.__wbg_ptr,c,k,t,e,r,o,i)}send_ssh_tunnel_data(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,i,k)}start_heartbeat(n){j.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){j.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,i,c,s,_,u){const a=N(n,j.__wbindgen_export,j.__wbindgen_export2),f=k,b=N(t,j.__wbindgen_export,j.__wbindgen_export2),l=k,d=N(e,j.__wbindgen_export,j.__wbindgen_export2),w=k;var g=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),h=k;const p=N(o,j.__wbindgen_export,j.__wbindgen_export2),m=k;var y=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),v=k,A=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2),S=k,T=R(_)?0:N(_,j.__wbindgen_export,j.__wbindgen_export2);j.channel_update_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,p,m,i,y,v,A,S,T,k,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_67e7344beaa85059:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=N(String(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0:function(n,t){const e=N(f(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_92ab86bb19cbc12f:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),i=k;d().setInt32(n+4,i,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_5d9e815e6fdf150f:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_997e73d32238e655:function(n){p(n)._wbg_cb_unref()},__wbg_call_269c5566fbede3eb:function(){return m((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_6bcf8d3e20937e46:function(){return m((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_call_7bbd9cceba9949ad:function(){return m((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(T(n)))},__wbg_close_a009f540ff811039:function(){return m((function(n){p(n).close()}),arguments)},__wbg_data_aa7ba49b34c0d883:function(n){return u(p(n).data)},__wbg_from_a39669ce566077da:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_a608c4436c19407a:function(){return m((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_989d0a1309644f2b:function(){return m((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_1ec3bd19a05d875f:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_d4ff01f8247925ae:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_31bdaf014f5fbde2:function(n){return p(n).length},__wbg_new_1da3429bc3c4541c:function(n){return u(new Uint8Array(p(n)))},__wbg_new_bebc3f4757acf305:function(){return u(new Object)},__wbg_new_ffa92086ea89f79c:function(){return u(new Array)},__wbg_new_with_str_sequence_9ab4875494df9d99:function(){return m((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_ae9f5e7459250748:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_bfdf956ba476f65b:function(n,t){return p(n).push(p(t))},__wbg_readyState_83df235b27cf257f:function(n){return p(n).readyState},__wbg_send_af811d92e7aea5c4:function(){return m((function(n,t,e){p(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return m((function(n,t){return u(setInterval(p(n),t))}),arguments)},__wbg_set_13d25b81ab403f5e:function(n,t,e){p(n)[t>>>0]=T(e)},__wbg_set_6be42768c690e380:function(n,t,e){p(n)[T(t)]=T(e)},__wbg_set_binaryType_f88804219cea0f9e:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_97aab74a1c2662f7:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_88cb2134dca3aba2:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_0f0d391465909a45:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_e91e64af99b7966d:function(n,t){p(n).onopen=p(t)},__wbg_warn_496b1176d7c30f44:function(n,t){console.warn(w(n,t))},__wbindgen_generic_0000000000000001:function(n,t){return u(A(n,t,o))},__wbindgen_generic_0000000000000002:function(n,t){return u(A(n,t,i))},__wbindgen_generic_0000000000000003:function(n,t){return u(A(n,t,c))},__wbindgen_generic_0000000000000004:function(n,t){return u(A(n,t,r))},__wbindgen_generic_0000000000000005:function(n){return u(n)},__wbindgen_generic_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_generic_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_generic_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(p(n))},__wbindgen_object_drop_ref:function(n){T(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){j.__wasm_bindgen_func_elem_64(n,t)}function o(n,t,e){j.__wasm_bindgen_func_elem_60(n,t,u(e))}function i(n,t,e){j.__wasm_bindgen_func_elem_60_37(n,t,u(e))}function c(n,t,e){j.__wasm_bindgen_func_elem_60_38(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbg_channel_free(n,1)));function u(n){v===y.length&&y.push(y.length+1);const t=v;return v=y[t],y[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==j.memory.buffer)&&(l=new DataView(j.memory.buffer)),l}function w(n,t){return function(n,t){return P+=t,P>=O&&(F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),F.decode(),P=t),F.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(j.memory.buffer)),g}function p(n){return y[n]}function m(n,t){try{return n.apply(this,t)}catch(n){j.__wbindgen_export3(u(n))}}let y=new Array(1024).fill(void 0);y.push(void 0,null,!0,!1);let v=y.length;function R(n){return null==n}function A(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(j.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t){const e=t(1*n.length,1)>>>0;return h().set(n,e/1),k=n.length,e}function N(n,t,e){if(void 0===e){const e=U.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),k=e.length,r}let r=n.length,o=t(r,1)>>>0;const i=h();let c=0;for(;c<r;c++){const t=n.charCodeAt(c);if(t>127)break;i[o+c]=t}if(c!==r){0!==c&&(n=n.slice(c)),o=e(o,r,r=c+3*n.length,1)>>>0;const t=h().subarray(o+c,o+r);c+=U.encodeInto(n,t).written,o=e(o,r,c,1)>>>0}return k=c,o}function T(n){const t=p(n);return function(n){n<1028||(y[n]=v,v=n)}(n),t}let F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});F.decode();const O=2146435072;let P=0;const U=new TextEncoder;"encodeInto"in U||(U.encodeInto=function(n,t){const e=U.encode(n);return t.set(e),{read:n.length,written:e.length}});let j,k=0;async function W(n){if(void 0!==j)return j;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return j=n.exports,l=null,g=null,j}(r)}var $,q,E;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.RDPAuthorized="RDPAuthorized",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck",n.SFTPOpResult="SFTPOpResult"}($||($={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(q||(q={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(E||(E={}));export{n as C,t as E,q as I,$ as P,W as _,E as a}
|
|
1
|
+
class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();j.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_authenticate(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}connect(){j.channel_connect(this.__wbg_ptr)}create_service(n,t,e,r,o,i,c,s,_){const u=N(n,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(t,j.__wbindgen_export,j.__wbindgen_export2),b=k;var l=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),d=k;const w=N(r,j.__wbindgen_export,j.__wbindgen_export2),g=k;var h=R(i)?0:N(i,j.__wbindgen_export,j.__wbindgen_export2),p=k,m=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),y=k,v=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2);j.channel_create_service(this.__wbg_ptr,u,a,f,b,l,d,w,g,o,h,p,m,y,v,k,R(_)?Number.MAX_SAFE_INTEGER:_>>>0)}delete_service(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2);j.channel_delete_service(this.__wbg_ptr,r,o,i,k,R(e)?Number.MAX_SAFE_INTEGER:e>>>0)}disconnect(){j.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==j.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==j.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(t,j.__wbindgen_export,j.__wbindgen_export2),c=k;var s=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2);const u=j.channel_new(r,o,i,c,s,k);return this.__wbg_ptr=u,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){j.channel_on_connection_close(this.__wbg_ptr,R(n)?0:u(n))}on_connection_error(n){j.channel_on_connection_error(this.__wbg_ptr,R(n)?0:u(n))}on_connection_message(n){j.channel_on_connection_message(this.__wbg_ptr,R(n)?0:u(n))}on_connection_open(n){j.channel_on_connection_open(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message(n){j.channel_on_protocol_message(this.__wbg_ptr,R(n)?0:u(n))}on_protocol_message_type(n,t){const e=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_on_protocol_message_type(this.__wbg_ptr,e,k,R(t)?0:u(t))}open_rdp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_rdp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_sftp_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_sftp_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}open_ssh_tunnel(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(t,j.__wbindgen_export,j.__wbindgen_export2),_=k;var u=R(e)?0:N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_open_ssh_tunnel(this.__wbg_ptr,i,c,s,_,u,a,f,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_chmod(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_chmod(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_delete(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_delete(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_ack(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_ack(this.__wbg_ptr,o,k,t,e,r)}send_sftp_download_chunk(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_chunk(this.__wbg_ptr,i,k,t,e,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_download_start(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_download_start(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_list_data(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_list_data(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_mkdir(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_mkdir(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_read_file(n,t,e,r){const o=N(n,j.__wbindgen_export,j.__wbindgen_export2),i=k,c=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_read_file(this.__wbg_ptr,o,i,t,c,k,R(r)?Number.MAX_SAFE_INTEGER:r>>>0)}send_sftp_remove(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_remove(this.__wbg_ptr,i,c,t,s,k,r,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_rename(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_rename(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_sftp_upload_chunk(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(i,j.__wbindgen_export);j.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,k,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_upload_start(n,t,e,r,o,i,c){const s=N(n,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=N(e,j.__wbindgen_export,j.__wbindgen_export2),a=k,f=N(r,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,k,o,i,R(c)?Number.MAX_SAFE_INTEGER:c>>>0)}send_sftp_write_file(n,t,e,r,o){const i=N(n,j.__wbindgen_export,j.__wbindgen_export2),c=k,s=N(e,j.__wbindgen_export,j.__wbindgen_export2),_=k,u=S(r,j.__wbindgen_export);j.channel_send_sftp_write_file(this.__wbg_ptr,i,c,t,s,_,u,k,R(o)?Number.MAX_SAFE_INTEGER:o>>>0)}send_ssh_terminal_resize(n,t,e,r,o,i){const c=N(n,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_terminal_resize(this.__wbg_ptr,c,k,t,e,r,o,i)}send_ssh_tunnel_data(n,t,e){const r=N(n,j.__wbindgen_export,j.__wbindgen_export2),o=k,i=N(e,j.__wbindgen_export,j.__wbindgen_export2);j.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,i,k)}start_heartbeat(n){j.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){j.channel_stop_heartbeat(this.__wbg_ptr)}update_service(n,t,e,r,o,i,c,s,_,u){const a=N(n,j.__wbindgen_export,j.__wbindgen_export2),f=k,b=N(t,j.__wbindgen_export,j.__wbindgen_export2),l=k,d=N(e,j.__wbindgen_export,j.__wbindgen_export2),w=k;var g=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),h=k;const p=N(o,j.__wbindgen_export,j.__wbindgen_export2),m=k;var y=R(c)?0:N(c,j.__wbindgen_export,j.__wbindgen_export2),v=k,A=R(s)?0:N(s,j.__wbindgen_export,j.__wbindgen_export2),S=k,T=R(_)?0:N(_,j.__wbindgen_export,j.__wbindgen_export2);j.channel_update_service(this.__wbg_ptr,a,f,b,l,d,w,g,h,p,m,i,y,v,A,S,T,k,R(u)?Number.MAX_SAFE_INTEGER:u>>>0)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_67e7344beaa85059:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=N(String(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0:function(n,t){const e=N(f(p(t)),j.__wbindgen_export,j.__wbindgen_export2),r=k;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_92ab86bb19cbc12f:function(n,t){const e=p(t),r="string"==typeof e?e:void 0;var o=R(r)?0:N(r,j.__wbindgen_export,j.__wbindgen_export2),i=k;d().setInt32(n+4,i,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_5d9e815e6fdf150f:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_997e73d32238e655:function(n){p(n)._wbg_cb_unref()},__wbg_call_269c5566fbede3eb:function(){return m((function(n,t){return u(p(n).call(p(t)))}),arguments)},__wbg_call_6bcf8d3e20937e46:function(){return m((function(n,t,e){return u(p(n).call(p(t),p(e)))}),arguments)},__wbg_call_7bbd9cceba9949ad:function(){return m((function(n,t,e,r){return u(p(n).call(p(t),p(e),p(r)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(T(n)))},__wbg_close_a009f540ff811039:function(){return m((function(n){p(n).close()}),arguments)},__wbg_data_aa7ba49b34c0d883:function(n){return u(p(n).data)},__wbg_from_a39669ce566077da:function(n){return u(Array.from(p(n)))},__wbg_getRandomValues_a608c4436c19407a:function(){return m((function(n,t){globalThis.crypto.getRandomValues(b(n,t))}),arguments)},__wbg_get_989d0a1309644f2b:function(){return m((function(n,t){return u(Reflect.get(p(n),p(t)))}),arguments)},__wbg_info_c923009936ad8385:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_d4ff01f8247925ae:function(n){let t;try{t=p(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_31bdaf014f5fbde2:function(n){return p(n).length},__wbg_new_1da3429bc3c4541c:function(n){return u(new Uint8Array(p(n)))},__wbg_new_bebc3f4757acf305:function(){return u(new Object)},__wbg_new_ffa92086ea89f79c:function(){return u(new Array)},__wbg_new_with_str_sequence_9ab4875494df9d99:function(){return m((function(n,t,e){return u(new WebSocket(w(n,t),p(e)))}),arguments)},__wbg_prototypesetcall_ae9f5e7459250748:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),p(e))},__wbg_push_bfdf956ba476f65b:function(n,t){return p(n).push(p(t))},__wbg_readyState_83df235b27cf257f:function(n){return p(n).readyState},__wbg_send_af811d92e7aea5c4:function(){return m((function(n,t,e){p(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return m((function(n,t){return u(setInterval(p(n),t))}),arguments)},__wbg_set_13d25b81ab403f5e:function(n,t,e){p(n)[t>>>0]=T(e)},__wbg_set_6be42768c690e380:function(n,t,e){p(n)[T(t)]=T(e)},__wbg_set_binaryType_f88804219cea0f9e:function(n,t){p(n).binaryType=s[t]},__wbg_set_onclose_97aab74a1c2662f7:function(n,t){p(n).onclose=p(t)},__wbg_set_onerror_88cb2134dca3aba2:function(n,t){p(n).onerror=p(t)},__wbg_set_onmessage_0f0d391465909a45:function(n,t){p(n).onmessage=p(t)},__wbg_set_onopen_e91e64af99b7966d:function(n,t){p(n).onopen=p(t)},__wbg_warn_5936938922985853:function(n,t){console.warn(w(n,t))},__wbindgen_generic_0000000000000001:function(n,t){return u(A(n,t,o))},__wbindgen_generic_0000000000000002:function(n,t){return u(A(n,t,i))},__wbindgen_generic_0000000000000003:function(n,t){return u(A(n,t,c))},__wbindgen_generic_0000000000000004:function(n,t){return u(A(n,t,r))},__wbindgen_generic_0000000000000005:function(n){return u(n)},__wbindgen_generic_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_generic_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_generic_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(p(n))},__wbindgen_object_drop_ref:function(n){T(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){j.__wasm_bindgen_func_elem_64(n,t)}function o(n,t,e){j.__wasm_bindgen_func_elem_60(n,t,u(e))}function i(n,t,e){j.__wasm_bindgen_func_elem_60_37(n,t,u(e))}function c(n,t,e){j.__wasm_bindgen_func_elem_60_38(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbg_channel_free(n,1)));function u(n){v===y.length&&y.push(y.length+1);const t=v;return v=y[t],y[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>j.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==j.memory.buffer)&&(l=new DataView(j.memory.buffer)),l}function w(n,t){return function(n,t){return P+=t,P>=O&&(F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),F.decode(),P=t),F.decode(h().subarray(n,n+t))}(n>>>0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(j.memory.buffer)),g}function p(n){return y[n]}function m(n,t){try{return n.apply(this,t)}catch(n){j.__wbindgen_export3(u(n))}}let y=new Array(1024).fill(void 0);y.push(void 0,null,!0,!1);let v=y.length;function R(n){return null==n}function A(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(j.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t){const e=t(1*n.length,1)>>>0;return h().set(n,e/1),k=n.length,e}function N(n,t,e){if(void 0===e){const e=U.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),k=e.length,r}let r=n.length,o=t(r,1)>>>0;const i=h();let c=0;for(;c<r;c++){const t=n.charCodeAt(c);if(t>127)break;i[o+c]=t}if(c!==r){0!==c&&(n=n.slice(c)),o=e(o,r,r=c+3*n.length,1)>>>0;const t=h().subarray(o+c,o+r);c+=U.encodeInto(n,t).written,o=e(o,r,c,1)>>>0}return k=c,o}function T(n){const t=p(n);return function(n){n<1028||(y[n]=v,v=n)}(n),t}let F=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});F.decode();const O=2146435072;let P=0;const U=new TextEncoder;"encodeInto"in U||(U.encodeInto=function(n,t){const e=U.encode(n);return t.set(e),{read:n.length,written:e.length}});let j,k=0;async function W(n){if(void 0!==j)return j;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return j=n.exports,l=null,g=null,j}(r)}var $,q,E;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.RDPAuthorized="RDPAuthorized",n.SFTPListItems="SFTPListItems",n.SFTPDownloadStartResponse="SFTPDownloadStartResponse",n.SFTPDownloadChunk="SFTPDownloadChunk",n.SFTPUploadStartResponse="SFTPUploadStartResponse",n.SFTPUploadChunkAck="SFTPUploadChunkAck",n.SFTPOpResult="SFTPOpResult"}($||($={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(q||(q={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(E||(E={}));export{n as C,t as E,q as I,$ as P,W as _,E as a}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as s}from"./p-AP5XjS35.js";import{_ as a,E as r,C as o,a as d,P as n}from"./p-D4vz9Xu4.js";const l=class{constructor(i){e(this,i),this.maximizeEvent=t(this,"maximize"),this.connectionStateChanged=t(this,"connectionStateChanged")}channel;domReady=!1;runtimeReady=!1;connected=!1;uploadInputEl;msgId=1;activeUploadToken=0;pendingUploadStarts=new Map;pendingUploadAcks=new Map;pendingDownloadStarts=new Map;activeDownloads=new Map;activeDownloadMsgId;pendingOps=new Map;promptInputEl;editorPath="";editorTextEl;session_id;name="SFTP";description="Client";hideHeader=!1;serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;onNodeIdChange(e,t){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),e&&(this.open_comms(),this.channel.connect(),this.status="Connecting...")}serverId;onServerIdChange(e,t){this.onNodeIdChange(this.nodeId,this.nodeId)}maximizeEvent;async maximize(){this.max=!this.max}async minimize(){this.max=!1}connectionStateChanged;max=!1;show_login_screen=!1;show_login_screen_username=!1;show_error=!1;error_message="";show_login_screen_password=!1;show_navigation=!1;breadcrumbs=[];current_dir=".";listing=[];show_content=!1;show_loader=!1;version="";status="Disconnected";selected_item=null;show_upload_modal=!1;upload_progress=0;upload_file_name="";upload_speed="--";upload_finished=!1;show_download_modal=!1;download_progress=0;download_file_name="";download_speed="--";download_finished=!1;show_delete_modal=!1;delete_file_name="";delete_loading=!1;delete_is_dir=!1;delete_recursive=!1;delete_error="";prompt_kind=null;prompt_value="";prompt_error="";prompt_busy=!1;chmod_target=null;chmod_mode=0;chmod_error="";chmod_busy=!1;show_editor=!1;editor_name="";editor_text="";editor_saved_text="";editor_busy="";editor_error="";editor_confirm_discard=!1;editor_loaded=!1;filter="";sort_key="name";sort_asc=!0;toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){await a(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.cancel_active_upload(),this.cancel_active_download(),this.clear_pending_operations(),this.close_comms()}next_msg_id(){const e=this.msgId;return this.msgId+=1,e}clear_pending_operations(){this.pendingUploadStarts.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Upload start aborted"))})),this.pendingUploadStarts.clear(),this.pendingUploadAcks.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Upload chunk aborted"))})),this.pendingUploadAcks.clear(),this.pendingDownloadStarts.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Download start aborted"))})),this.pendingDownloadStarts.clear(),this.pendingOps.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error(`Could not ${e.verb}: the session ended.`))})),this.pendingOps.clear(),this.activeDownloads.clear()}cancel_active_upload(){this.activeUploadToken+=1,this.upload_progress=0,this.upload_finished=!1,this.upload_speed="--"}cancel_active_download(){void 0!==this.activeDownloadMsgId&&this.activeDownloads.delete(this.activeDownloadMsgId),this.activeDownloadMsgId=void 0,this.download_progress=0,this.download_finished=!1,this.download_speed="--"}format_duration(e){if(!Number.isFinite(e)||e<0)return"--";if(e<60)return`${e.toFixed(0)}s`;const t=Math.floor(e/60),i=Math.floor(e%60);return t<60?`${t}m ${i}s`:`${Math.floor(t/60)}h ${t%60}m`}format_percent(e){return`${(Number.isFinite(e)?e:0).toFixed(2)}%`}format_transfer_rate(e){return!Number.isFinite(e)||e<=0?"--":`${this.format_size(e)}/s`}update_upload_progress(e,t,i){if(this.upload_progress=Math.max(0,Math.min(100,t>0?e/t*100:0)),e>=t)return this.upload_finished=!0,void(this.upload_speed="--");const s=(performance.now()-i)/1e3,a=s>0?e/s:0;this.upload_speed=this.format_transfer_rate(a);const r=a>0?(t-e)/a:NaN;this.status=`Uploading ${this.format_size(e)} / ${this.format_size(t)} (ETA ${this.format_duration(r)})`}update_download_progress(e,t,i){if(this.download_progress=Math.max(0,Math.min(100,t>0?e/t*100:0)),e>=t)return this.download_finished=!0,void(this.download_speed="--");const s=(Date.now()-i)/1e3,a=s>0?e/s:0;this.download_speed=this.format_transfer_rate(a);const r=a>0?(t-e)/a:NaN;this.status=`Downloading ${this.format_size(e)} / ${this.format_size(t)} (ETA ${this.format_duration(r)})`}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const e=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${e}://${this.serverHost}`:`${e}://${this.serverHost}:${this.serverPort}`:`${e}://${this.serverHost}`}handle_error(e){if(void 0!==e.msg_id){const t=this.pendingUploadStarts.get(e.msg_id);t&&(window.clearTimeout(t.timeout),t.reject(new Error(e.message||"Upload start failed")),this.pendingUploadStarts.delete(e.msg_id));const i=this.pendingDownloadStarts.get(e.msg_id);i&&(window.clearTimeout(i.timeout),i.reject(new Error(e.message||"Download start failed")),this.pendingDownloadStarts.delete(e.msg_id)),this.activeDownloads.has(e.msg_id)&&(this.activeDownloads.delete(e.msg_id),this.activeDownloadMsgId===e.msg_id&&(this.activeDownloadMsgId=void 0),this.download_finished=!1);const s=this.pendingOps.get(e.msg_id);if(s)return window.clearTimeout(s.timeout),this.pendingOps.delete(e.msg_id),s.reject(new Error(e.message||`Could not ${s.verb}.`)),void(this.show_loader=!1)}switch(e.kind){case r.Generic:case r.Authentication:this.error_message=e.message||"An unknown error occurred.",this.show_error=!0;break;case r.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case r.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case r.RequiresUsernamePassword:this.show_login_screen_username=!0,this.show_login_screen_password=!0,this.show_login_screen=!0}setTimeout((()=>{this.show_loader=!1}),1e3)}handle_auth_success(e){this.clear_creds_buffer(),this.version=e.version,this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_sftp_tunnel(this.nodeId,this.serviceId),this.status="Connected"}handle_tunnel_opened(e){this.session_id=e.sid,this.channel.send_sftp_list_data(this.nodeId,this.session_id,this.current_dir)}handle_sftp_list_items(e){setTimeout((()=>{this.show_loader=!1}),500),e.path!==this.current_dir&&(this.filter=""),this.listing=e.dir.items,this.current_dir=e.path,this.breadcrumbs=e.path.split("/").map(((e,t,i)=>""===e&&0===t?{label:"/",path:"/"}:{label:e,path:i.slice(0,t+1).join("/")})),this.show_content=!0,this.show_navigation=!0,console.log("Received SFTP list items:",e)}handle_upload_start_response(e){if(void 0===e.msg_id)return;const t=this.pendingUploadStarts.get(e.msg_id);t&&(window.clearTimeout(t.timeout),t.resolve(e.response.upload_id),this.pendingUploadStarts.delete(e.msg_id))}handle_upload_chunk_ack(e){const t=`${e.upload_id}_${e.chunk_index}`,i=this.pendingUploadAcks.get(t);i&&(window.clearTimeout(i.timeout),i.resolve(),this.pendingUploadAcks.delete(t))}handle_download_start_response(e){if(void 0===e.msg_id)return;const t=this.pendingDownloadStarts.get(e.msg_id);t&&(window.clearTimeout(t.timeout),t.resolve({download_id:e.response.download_id,total_size:e.response.total_size,total_chunks:e.response.total_chunks}),this.pendingDownloadStarts.delete(e.msg_id))}finalize_download(e){const t=this.activeDownloads.get(e);if(!t)return;const i=Array.from(t.chunks.entries()).sort(((e,t)=>e[0]-t[0])).map((([,e])=>e)).map((e=>new Uint8Array(e))),s=new Blob(i,{type:"application/octet-stream"}),a=URL.createObjectURL(s),r=document.createElement("a");r.href=a,r.download=t.filename,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a),this.activeDownloads.delete(e),this.activeDownloadMsgId===e&&(this.activeDownloadMsgId=void 0),this.download_finished=!0,this.status="Connected"}handle_download_chunk(e){if(void 0===e.msg_id)return;const t=this.activeDownloads.get(e.msg_id);if(!t||!this.session_id)return;const i=new Uint8Array(e.chunk.data);t.chunks.set(e.chunk.chunk_index,i);const s=Array.from(t.chunks.values()).reduce(((e,t)=>e+t.length),0);this.update_download_progress(s,t.total_size,t.startTime),this.channel.send_sftp_download_ack(this.nodeId,this.session_id,t.download_id,e.chunk.chunk_index),t.chunks.size>=t.total_chunks&&this.finalize_download(e.msg_id)}async start_download(e){if(!this.session_id)return;this.selected_item=e,this.download_file_name=e.name,this.download_progress=0,this.download_finished=!1,this.download_speed="--",this.show_download_modal=!0,this.show_error=!1;const t=this.next_msg_id();this.activeDownloadMsgId=t,this.activeDownloads.set(t,{filename:e.name,chunks:new Map,total_chunks:0,total_size:0,download_id:0,startTime:Date.now()});const i=new Promise(((e,i)=>{const s=window.setTimeout((()=>{this.pendingDownloadStarts.delete(t),i(new Error("Download start timeout"))}),1e4);this.pendingDownloadStarts.set(t,{timeout:s,resolve:e,reject:i})}));try{this.channel.send_sftp_download_start(this.nodeId,this.session_id,e.path,e.name,t);const{download_id:s,total_chunks:a,total_size:r}=await i,o=this.activeDownloads.get(t);if(!o)return;o.download_id=s,o.total_chunks=a,o.total_size=r}catch(e){this.activeDownloads.delete(t),this.activeDownloadMsgId===t&&(this.activeDownloadMsgId=void 0),this.show_error=!0,this.error_message=e instanceof Error?e.message:"Failed to start download",this.cancel_download()}}async upload_file(e){if(!this.session_id)return;const t=this.activeUploadToken+1;this.activeUploadToken=t,this.upload_file_name=e.name,this.upload_progress=0,this.upload_finished=!1,this.upload_speed="--",this.show_upload_modal=!0,this.show_error=!1,this.status="Uploading...";const i=65536,s=Math.max(1,Math.ceil(e.size/i)),a=this.next_msg_id(),r=new Promise(((e,t)=>{const i=window.setTimeout((()=>{this.pendingUploadStarts.delete(a),t(new Error("Upload start timeout"))}),1e4);this.pendingUploadStarts.set(a,{timeout:i,resolve:e,reject:t})}));try{this.channel.send_sftp_upload_start(this.nodeId,this.session_id,e.name,this.current_dir,s,BigInt(e.size),a);const o=await r;let d=0;const n=performance.now();for(let a=0;a<s;a+=1){if(t!==this.activeUploadToken)throw new Error("Upload cancelled");const s=a*i,r=Math.min(s+i,e.size),l=new Uint8Array(await e.slice(s,r).arrayBuffer());await new Promise(((e,t)=>{const i=`${o}_${a}`,s=window.setTimeout((()=>{this.pendingUploadAcks.delete(i),t(new Error(`Upload chunk ${a+1} timed out`))}),3e4);this.pendingUploadAcks.set(i,{timeout:s,resolve:e,reject:t}),this.channel.send_sftp_upload_chunk(this.nodeId,this.session_id,o,a,l.length,l,null)})),d+=l.length,this.update_upload_progress(d,e.size,n)}this.upload_progress=100,this.upload_finished=!0,this.status="Connected",this.refresh_directory()}catch(e){"Upload cancelled"!==e.message&&(this.show_error=!0,this.error_message=e instanceof Error?e.message:"Upload failed"),this.upload_finished=!1,this.status="Connected"}}handle_op_result(e){if(void 0===e.msg_id)return;const t=this.pendingOps.get(e.msg_id);t&&(window.clearTimeout(t.timeout),this.pendingOps.delete(e.msg_id),t.resolve(e.result))}run_op(e,t,i=3e4){if(!this.session_id)return Promise.reject(new Error("No active SFTP session."));const s=this.next_msg_id();return new Promise(((a,r)=>{const o=window.setTimeout((()=>{this.pendingOps.delete(s),r(new Error(`Timed out trying to ${e}. This node's agent may be too old to support it.`))}),i);this.pendingOps.set(s,{verb:e,timeout:o,resolve:a,reject:r});try{t(s)}catch(e){window.clearTimeout(o),this.pendingOps.delete(s),r(e instanceof Error?e:new Error(String(e)))}}))}error_text(e){return e instanceof Error?e.message:String(e)}item_path(e){return this.join_path(e.path,e.name)}join_path(e,t){return e&&"/"!==e?e.endsWith("/")?`${e}${t}`:`${e}/${t}`:`/${t}`}invalid_name(e){return e?"."===e||".."===e?"That name is reserved.":e.includes("/")?'A name cannot contain "/".':e.includes("\0")?"A name cannot contain a null byte.":"":"Enter a name."}handle_tunnel_data(e){console.log("received tunnel data:",e)}handle_tunnel_closed(e){this.clear_creds_buffer(),this.close_comms()}open_comms(){this.channel=this.serverId?new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new o(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([d.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([d.Disconnected]),this.status="Disconnected"})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([d.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:t}=e.data;switch(t.type){case n.Error:this.handle_error(t);break;case n.AuthSuccess:this.handle_auth_success(t);break;case n.TunnelOpened:this.handle_tunnel_opened(t);break;case n.TunnelClosed:this.handle_tunnel_closed(t);break;case n.TunnelData:this.handle_tunnel_data(t);break;case n.SFTPListItems:this.handle_sftp_list_items(t);break;case n.SFTPUploadStartResponse:this.handle_upload_start_response(t);break;case n.SFTPUploadChunkAck:this.handle_upload_chunk_ack(t);break;case n.SFTPDownloadStartResponse:this.handle_download_start_response(t);break;case n.SFTPDownloadChunk:this.handle_download_chunk(t);break;case n.SFTPOpResult:this.handle_op_result(t);break;default:console.warn("Unhandled protocol message type:",t)}}))}close_comms(){this.cancel_active_upload(),this.cancel_active_download(),this.clear_pending_operations(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}clear_creds_buffer(){}reset_session_state(){this.clear_creds_buffer()}list_breadcrumb(e){this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,e)}go_to_parent_directory(){this.session_id&&"/"!==this.current_dir&&this.list_breadcrumb(this.breadcrumbs[this.breadcrumbs.length-2]?.path||"/")}refresh_directory(){this.session_id&&this.list_breadcrumb(this.current_dir)}disconnect_session(){this.close_comms(),this.session_id=void 0,this.show_loader=!1,this.show_content=!1,this.breadcrumbs=[],this.current_dir=".",this.listing=[],this.show_navigation=!1,this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_upload_modal=!1,this.show_download_modal=!1,this.show_delete_modal=!1,this.upload_progress=0,this.download_progress=0,this.upload_finished=!1,this.download_finished=!1,this.delete_loading=!1,this.delete_file_name="",this.delete_error="",this.delete_is_dir=!1,this.delete_recursive=!1,this.prompt_kind=null,this.prompt_value="",this.prompt_error="",this.prompt_busy=!1,this.chmod_target=null,this.chmod_error="",this.chmod_busy=!1,this.show_editor=!1,this.editor_busy="",this.editor_error="",this.editor_confirm_discard=!1,this.editor_loaded=!1,this.filter="",this.version="",this.status="Disconnected"}on_file_row_action(e,t){t.preventDefault(),t.stopPropagation(),"File"===e.kind&&this.start_download(e)}on_file_delete_action(e,t){t.preventDefault(),t.stopPropagation(),this.selected_item=e,this.delete_file_name=e.name,this.delete_is_dir="Folder"===e.kind,this.delete_recursive=!1,this.delete_error="",this.delete_loading=!1,this.show_delete_modal=!0}cancel_delete(){this.delete_loading||(this.show_delete_modal=!1,this.delete_file_name="",this.delete_error="",this.delete_is_dir=!1,this.delete_recursive=!1)}async confirm_delete(){if(this.delete_loading)return;const e=this.selected_item;if(!this.session_id||!e)return void(this.show_delete_modal=!1);const t=this.item_path(e),i=this.delete_is_dir&&this.delete_recursive;this.delete_loading=!0,this.delete_error="",this.show_error=!1,this.status=`Deleting ${e.name}...`;try{await this.run_op("delete",(e=>this.channel.send_sftp_remove(this.nodeId,this.session_id,t,i,e)),i?3e5:3e4),this.delete_loading=!1,this.show_delete_modal=!1,this.delete_file_name="",this.delete_is_dir=!1,this.delete_recursive=!1,this.status="Connected",this.refresh_directory()}catch(e){this.delete_loading=!1,this.delete_error=this.error_text(e),this.status="Connected"}}open_mkdir(){this.session_id&&(this.prompt_kind="mkdir",this.prompt_value="",this.prompt_error="",this.prompt_busy=!1)}on_rename_action(e,t){t.preventDefault(),t.stopPropagation(),this.session_id&&(this.selected_item=e,this.prompt_kind="rename",this.prompt_value=e.name,this.prompt_error="",this.prompt_busy=!1)}close_prompt(){this.prompt_busy||(this.prompt_kind=null,this.prompt_value="",this.prompt_error="",this.promptInputEl=void 0)}async submit_prompt(){if(this.prompt_busy||!this.session_id)return;const e=this.prompt_kind,t=this.prompt_value.trim(),i=this.invalid_name(t);if(i)return void(this.prompt_error=i);const s=this.selected_item;if("rename"===e&&s&&t===s.name)this.close_prompt();else{this.prompt_busy=!0,this.prompt_error="",this.show_error=!1;try{if("mkdir"===e){const e=this.join_path(this.current_dir,t);this.status=`Creating ${t}...`,await this.run_op("create the folder",(t=>this.channel.send_sftp_mkdir(this.nodeId,this.session_id,e,t)))}else{if("rename"!==e||!s)return this.prompt_busy=!1,void this.close_prompt();{const e=this.item_path(s),i=this.join_path(s.path,t);this.status=`Renaming ${s.name}...`,await this.run_op("rename",(t=>this.channel.send_sftp_rename(this.nodeId,this.session_id,e,i,t)))}}this.prompt_busy=!1,this.prompt_kind=null,this.prompt_value="",this.promptInputEl=void 0,this.status="Connected",this.refresh_directory()}catch(e){this.prompt_busy=!1,this.prompt_error=this.error_text(e),this.status="Connected"}}}on_chmod_action(e,t){t.preventDefault(),t.stopPropagation(),this.session_id&&(this.selected_item=e,this.chmod_target=e,this.chmod_mode=4095&(e.attributes.permissions??0),this.chmod_error="",this.chmod_busy=!1)}close_chmod(){this.chmod_busy||(this.chmod_target=null,this.chmod_error="")}toggle_chmod_bit(e){this.chmod_busy||(this.chmod_mode=4095&(this.chmod_mode^e))}on_chmod_octal_input(e){const t=e.trim();/^[0-7]{1,4}$/.test(t)?(this.chmod_error="",this.chmod_mode=4095&parseInt(t,8)):this.chmod_error="Enter up to four octal digits, 0-7."}async submit_chmod(){const e=this.chmod_target;if(this.chmod_busy||!this.session_id||!e)return;const t=this.item_path(e),i=4095&this.chmod_mode;this.chmod_busy=!0,this.chmod_error="",this.show_error=!1,this.status=`Setting permissions on ${e.name}...`;try{await this.run_op("change permissions",(e=>this.channel.send_sftp_chmod(this.nodeId,this.session_id,t,i,e))),this.chmod_busy=!1,this.chmod_target=null,this.status="Connected",this.refresh_directory()}catch(e){this.chmod_busy=!1,this.chmod_error=this.error_text(e),this.status="Connected"}}async on_edit_action(e,t){if(t.preventDefault(),t.stopPropagation(),!this.session_id||"File"!==e.kind)return;const i=this.item_path(e);this.selected_item=e,this.show_editor=!0,this.editorPath=i,this.editor_name=e.name,this.editor_text="",this.editor_saved_text="",this.editor_error="",this.editor_confirm_discard=!1,this.editor_loaded=!1,this.editor_busy="loading",this.status=`Opening ${e.name}...`;try{const e=await this.run_op("open the file",(e=>this.channel.send_sftp_read_file(this.nodeId,this.session_id,i,e)),6e4);if("FileContents"!==e.result)throw new Error("The agent answered without any file contents.");const t=this.decode_text(e.contents instanceof Uint8Array?e.contents:new Uint8Array(e.contents));this.editor_text=t,this.editor_saved_text=t,this.editor_loaded=!0,this.editor_busy="",this.status="Connected"}catch(e){this.editor_busy="",this.editor_error=this.error_text(e),this.status="Connected"}}decode_text(e){if(e.includes(0))throw new Error("This looks like a binary file. Download it instead of editing it here.");try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{throw new Error("This file is not valid UTF-8. Download it instead of editing it here.")}}editor_is_dirty(){return this.editor_loaded&&this.editor_text!==this.editor_saved_text}close_editor(e=!1){"saving"!==this.editor_busy&&(e||!this.editor_is_dirty()?(this.show_editor=!1,this.editor_confirm_discard=!1,this.editor_loaded=!1,this.editorPath="",this.editor_name="",this.editor_text="",this.editor_saved_text="",this.editor_error="",this.editor_busy="",this.editorTextEl=void 0):this.editor_confirm_discard=!0)}async save_editor(){if(this.editor_busy||!this.session_id||!this.editorPath)return;const e=this.editorPath,t=this.editor_text;this.editor_busy="saving",this.editor_error="",this.show_error=!1,this.status=`Saving ${this.editor_name}...`;try{await this.run_op("save the file",(i=>this.channel.send_sftp_write_file(this.nodeId,this.session_id,e,(new TextEncoder).encode(t),i)),6e4),this.editor_saved_text=t,this.editor_busy="",this.status="Connected",this.refresh_directory()}catch(e){this.editor_busy="",this.editor_error=this.error_text(e),this.status="Connected"}}toggle_sort(e){this.sort_key!==e?(this.sort_key=e,this.sort_asc=!0):this.sort_asc=!this.sort_asc}visible_listing(){const e=this.filter.trim().toLowerCase(),t=e?this.listing.filter((t=>t.name.toLowerCase().includes(e))):[...this.listing],i=this.sort_asc?1:-1;return t.sort(((e,t)=>{if(e.kind!==t.kind)return"Folder"===e.kind?-1:1;switch(this.sort_key){case"size":return i*((e.attributes.size??0)-(t.attributes.size??0));case"modified":return i*((e.attributes.modified??0)-(t.attributes.modified??0));default:return i*e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"})}}))}sort_indicator(e){return this.sort_key!==e?"":this.sort_asc?" ▲":" ▼"}on_listing_keydown(e){if(this.prompt_kind||this.chmod_target||this.show_editor||this.show_delete_modal)return;const t=this.selected_item;switch(e.key){case"Backspace":e.preventDefault(),this.go_to_parent_directory();break;case"F5":e.preventDefault(),this.refresh_directory();break;case"F2":t&&(e.preventDefault(),this.on_rename_action(t,e));break;case"Delete":t&&(e.preventDefault(),this.on_file_delete_action(t,e));break;case"Enter":t&&(e.preventDefault(),this.list_directory(t))}}on_modal_keydown(e,t){"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t())}focus_once(e,t,i){e&&e!==t&&(i(e),requestAnimationFrame((()=>e.focus())))}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(e){const t=e.target,i=t.files?.[0];i&&(this.upload_file(i),t.value="")}cancel_upload(){this.cancel_active_upload(),this.show_upload_modal=!1,this.upload_file_name="",this.upload_speed="--",this.status="Connected",this.refresh_directory()}cancel_download(){this.cancel_active_download(),this.show_download_modal=!1,this.download_file_name="",this.download_speed="--",this.status="Connected",this.refresh_directory()}is_selected(e){return!!this.selected_item&&this.selected_item.path===e.path&&this.selected_item.name===e.name}list_directory(e){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===e.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=e);const t=this.item_path(e);t!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,t)):console.warn("Already in this directory. Ignoring click.")}format_size(e){if(void 0===e||Number.isNaN(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB","PB"];let i=e,s=-1;for(;i>=1024&&s<t.length-1;)i/=1024,s+=1;return`${i.toFixed(i>=10?1:2)} ${t[s]}`}mode_type_to_char(e,t){switch(61440&e){case 49152:return"s";case 40960:return"l";case 32768:return"-";case 24576:return"b";case 16384:return"d";case 8192:return"c";case 4096:return"p";default:return"Folder"===t?"d":"-"}}format_permissions(e,t){if(null==e)return"-";if("string"==typeof e){const i=e.trim();if(/^[bcdlps-][rwxStTs-]{9}$/.test(i))return i;if(/^[0-7]{3,4}$/.test(i)){const e=parseInt(i,8);return this.format_permissions(e,t)}if(/^\d+$/.test(i)){const e=parseInt(i,10);return this.format_permissions(e,t)}return i||"-"}const i=e,s=this.mode_type_to_char(i,t),a=[256&i?"r":"-",128&i?"w":"-",64&i?"x":"-",32&i?"r":"-",16&i?"w":"-",8&i?"x":"-",4&i?"r":"-",2&i?"w":"-",1&i?"x":"-"];return 2048&i&&(a[2]="x"===a[2]?"s":"S"),1024&i&&(a[5]="x"===a[5]?"s":"S"),512&i&&(a[8]="x"===a[8]?"t":"T"),`${s}${a.join("")}`}render(){return i(s,{key:"94f75760ff9d2f6e2852cdabd109f58bbdc21826",class:{default:!this.max,max:this.max}},i("section",{key:"9d2b388a11fb9a4b1ccf8fac1d926c0451fcba3f",class:"listing"},!this.hideHeader&&i("header",{key:"24e3f95b1ff48553e5e8bb150ee7d7ef60f74d73"},i("section",{key:"1023558093761f93f32f58083b56f8385e6eecff",class:"title"},i("img",{key:"dbac57cd459cb6ebca477e85eb9fdeae51b9b8b2",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),i("div",{key:"bab01697a1a84f05fbad8b15b75ba39962408c95",class:"text"},i("div",{key:"e3a29b907e3eef0e7240c13ee50d8e77ffd9a29c",class:"name"},this.name),i("div",{key:"ccdb117f874649914e4bc6fab0257d888a396ff5",class:"description"},this.description))),i("section",{key:"eda0da6fdca162f3414ba0802dad3088b00d9ab1",class:"actions"},i("div",{key:"e0882533b6e2512c0f8c074b031e17b53000413d",class:"action",onClick:()=>this.toggle_max()},i("img",{key:"18d6009f7e272537863034141ed22a30d7adcdb1",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),i("main",{key:"fb9496e11a2d61d73052a735793931c6c262956a"},this.show_navigation&&i("nav",{key:"be8098657ee5bd6335f3e37bb45c19818b3ed354",class:"navigation"},i("div",{key:"c689b18ab1c5ff8c2e06b050d9eb55253f064496",class:"breadcrumbs"},this.breadcrumbs.map(((e,t,s)=>i("span",{key:t,class:"breadcrumb-container"},i("span",{key:t,onClick:()=>this.list_breadcrumb(e.path),class:"breadcrumb"},e.label),t<s.length-1&&i("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),i("section",{key:"8533b0cc60a39d5e43df3646487192d75d28eb95",class:"actions","aria-label":"SFTP actions"},i("input",{key:"a7b98422554ee133af228b18297f03c805f138e5",class:"filter",type:"search",autocorrect:"off",autocapitalize:"none",autoComplete:"off",placeholder:"Filter","aria-label":"Filter this directory",value:this.filter,onInput:e=>this.filter=e.target.value}),i("button",{key:"4ded4cb62772c4d00153c73df40f2d77946f392d",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},i("img",{key:"7c56e8a47b0bd650525dce7d1b14440e7fa5dd05",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),i("button",{key:"5f3dbe6e7bd6dbcdd9f5d08e179b96de25ddfbe4",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},i("img",{key:"fad82f885c47e8fff98fdc987888bdf28533a28d",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),i("button",{key:"5d55e71fa8eb1f2ea1f75859eef44b5a87ece401",type:"button",class:"action",onClick:()=>this.open_mkdir(),title:"New folder","aria-label":"New folder"},i("svg",{key:"58a5611574a4a862767416437d6488c3ba87a566",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{key:"b2bedcd737a0709e0f8af29cbe955acc15477081",d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),i("line",{key:"ef531e0af9df3b308d91590b15d6dfb57acbeee2",x1:"12",x2:"12",y1:"10",y2:"16"}),i("line",{key:"4b3fb7124f97bacf0e723e728a7ddeec3b534879",x1:"9",x2:"15",y1:"13",y2:"13"}))),i("button",{key:"824e0362e5a256c3848392280ea46a7f798be1c0",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},i("img",{key:"9566d040fa2856e1a39db5d16f7c9ac93af319f7",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),i("button",{key:"8f3cb1ca3f128af76d7bc33d162ead4d25df7459",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),i("input",{key:"916c345c3163ccea404fe85da708d1e5a522c8ec",type:"file",ref:e=>this.uploadInputEl=e,onChange:e=>this.on_upload_selected(e),style:{display:"none"}}),this.show_content&&i("div",{key:"c894bda7c9f05538e099335bae720c6ac032dc70",class:"content",tabindex:0,onKeyDown:e=>this.on_listing_keydown(e)},i("table",{key:"e6d162543c57e0805875d52f5de8060473023113"},i("thead",{key:"b32d8edc1cc63834dada7cd4a8a9fc0aa4e641ab"},i("tr",{key:"7ef2d28ba557ab36689066b830534aa644cd100a"},i("th",{key:"9ec3dc58c85915562618f6dfedb466e4d32d8627",class:"sortable",onClick:()=>this.toggle_sort("name"),title:"Sort by name"},"Name",this.sort_indicator("name")),i("th",{key:"75164784bfde44c0844b5ba1e790fd53476ac0e0",class:"sortable",onClick:()=>this.toggle_sort("size"),title:"Sort by size"},"Size",this.sort_indicator("size")),i("th",{key:"f4dc607bb845ee940030cd631bfb07aefda9316e"},"Permissions"),i("th",{key:"2bcbe63f98b2ec812ae0ba82e184cdc0fa1fdfe4"},"Owner"),i("th",{key:"7f3933b4191b303b99cac3a999392ea700072735",class:"sortable",onClick:()=>this.toggle_sort("modified"),title:"Sort by modified date"},"Modified",this.sort_indicator("modified")),i("th",{key:"6fc772fcb7eb31cc2684e5f50c7e0b25fc3cb11a",class:"action-col","aria-label":"Actions"}))),i("tbody",{key:"6a506bd214a34a2f4ae0e138b43226502e2cd283"},this.visible_listing().map(((e,t)=>i("tr",{key:t,class:{selected:this.is_selected(e)},onClick:()=>this.list_directory(e)},i("td",null,i("img","Folder"===e.kind?{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K",alt:"Folder"}:{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"File"}),i("span",{class:`name ${e.kind.toLowerCase()}`},e.name)),i("td",null,"Folder"===e.kind?"-":this.format_size(e.attributes.size)),i("td",null,this.format_permissions(e.attributes.permissions,e.kind)),i("td",null,e.attributes.user??"-"),i("td",null,new Date(1e3*e.attributes.modified).toLocaleString()),i("td",{class:"action-col"},i("div",{class:"file-actions"},"File"===e.kind&&i("button",{type:"button",class:"file-action",onClick:t=>this.on_edit_action(e,t),title:"Edit","aria-label":`Edit ${e.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),i("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z"}))),"File"===e.kind&&i("button",{type:"button",class:"file-action",onClick:t=>this.on_file_row_action(e,t),title:"Download","aria-label":`Download ${e.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i("polyline",{points:"7 10 12 15 17 10"}),i("line",{x1:"12",x2:"12",y1:"15",y2:"3"}))),i("button",{type:"button",class:"file-action",onClick:t=>this.on_rename_action(e,t),title:"Rename","aria-label":`Rename ${e.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"}))),i("button",{type:"button",class:"file-action",onClick:t=>this.on_chmod_action(e,t),title:"Permissions","aria-label":`Change permissions on ${e.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),i("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))),i("button",{type:"button",class:"file-action delete",onClick:t=>this.on_file_delete_action(e,t),title:"Delete","aria-label":`Delete ${e.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("polyline",{points:"3 6 5 6 21 6"}),i("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),i("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),i("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),i("line",{x1:"14",x2:"14",y1:"11",y2:"17"})))))))),0===this.visible_listing().length&&i("tr",{key:"b056d99b4df7c0217c0eeb925d7ab8b519456a5f",class:"empty"},i("td",{key:"34a0f9f9e70827e64ea9843bd0263f258fc0c20a",colSpan:6},this.filter?`Nothing here matches "${this.filter}".`:"This directory is empty."))))),this.show_loader&&i("div",{key:"980fd45f6af488bf86dbbf1211abe0ccb3422b81",class:"loader"},"Loading..."),this.show_error&&i("div",{key:"0c368db0fd65b63f64e40119ac474d74e7832b61",class:"error"},this.error_message)),i("footer",{key:"71d8b999bca0fd0a9b3a224fa370f2953abf3b5f"},i("section",{key:"911030d32f3e1fab2f0df0ab43b093626124395c",class:"status"},this.status,this.selected_item&&i("span",{key:"19d2607ce0761647eeda4b01fbea9f4a3ccc5885",class:"selected-item"},this.selected_item.name)),i("section",{key:"e6f3f2a1b3f8adf04eff1b77f2947e210302876f",class:"version"},this.version?`Version: ${this.version}`:""))),this.show_login_screen&&i("section",{key:"f08ce7f1182fffe42e7eb470e52d046095441234",class:{creds:!0,blurred:this.show_login_screen}},i("form",{key:"0fbcaaf222d20a0c5a8769d7d9614135db0971bd",class:"auth",onSubmit:e=>{const t=new FormData(e.target);let i,s;this.show_login_screen_username&&(i=t.get("username")),this.show_login_screen_password&&(s=t.get("password")),this.channel.open_sftp_tunnel(this.nodeId,this.serviceId,i,s),this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_loader=!0,e.stopPropagation(),e.preventDefault()}},i("div",{key:"25af70a09ffe30493a8416f30b367402017b7ed0",class:"title"},"SFTP Connection"),this.show_login_screen_username&&i("div",{key:"3f1064e4acfc3f599e22e9314a455db72fcfd6f2"},i("label",{key:"a353afd35a192e7b8f7f66d0168974a42921a17d",htmlFor:"username"},"Username"),i("input",{key:"bc36e4f51537a4070443f9a5a82910e48842cfec",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"username",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&i("div",{key:"e7181272416bfc7928d8e714d9c3227b5d0c1f66"},i("label",{key:"d090c64f8179378cdef09bd6b9180f5707a1e43e",htmlFor:"password"},"Password"),i("input",{key:"6359b22a3a2ba9c68c1d54ea07dae8b1c388d17a",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"password",name:"password",type:"password",placeholder:""})),i("div",{key:"778c3e57e389329fc12ad6bc90921d86aedd4e80"},i("button",{key:"ad7881537626c5242f4ff5f0ae267e4526589d0f",type:"submit"},"Connect")))),this.show_upload_modal&&i("section",{key:"75ee6bf70138d1df39eae7559e1d5358af127858",class:{"upload-modal":!0,visible:this.show_upload_modal}},i("div",{key:"87ea253eb2044c1748c9feaf1daa9c684df429f8",class:"upload-dialog",role:"dialog","aria-modal":"true","aria-label":"Upload progress"},i("div",{key:"83c64dcfc0a59c0cc76b6d0223c8fd17346849fc",class:"title"},"Uploading File"),i("div",{key:"a71a0dec4cb9d75e0a4edc5612c41238d9729f1a",class:"file-name",title:this.upload_file_name},this.upload_file_name),i("div",{key:"057c9ca8bdf18fbedd75dba33d35ef7336a1c097",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.upload_progress},i("div",{key:"7a503b29c32cc03f0491be389bd9a21b340838aa",class:"progress-fill",style:{width:`${this.upload_progress}%`}})),i("div",{key:"a9b831b1548eecfcf21ad9d3d56a22cc6e3dae84",class:"progress-meta"},i("div",{key:"f5de7e9567ed5633bb81634add297faf24d55123",class:"progress-speed"},this.upload_speed),i("div",{key:"0241bcc3c54afd1cd6e5bb802b8518bb45458659",class:"progress-value"},this.format_percent(this.upload_progress))),i("button",{key:"354fb6fa81acf2e48eaa3ef897fb0d48d9435494",type:"button",class:{cancel:!0,finished:this.upload_finished},onClick:()=>this.cancel_upload()},this.upload_finished?"Close":"Cancel"))),this.show_download_modal&&i("section",{key:"c5ae39a268ae33b4a623b576101fb524fb651a61",class:{"download-modal":!0,visible:this.show_download_modal}},i("div",{key:"38817aa1411005058ae56a9ab3acd66e7e031221",class:"download-dialog",role:"dialog","aria-modal":"true","aria-label":"Download progress"},i("div",{key:"96bebe6045d616d34b8aeef8876032fed887affc",class:"title"},"Downloading File"),i("div",{key:"9669662ca9a60bbee2764ba1b92c7d43a20106af",class:"file-name",title:this.download_file_name},this.download_file_name),i("div",{key:"66b7759dbec989dbd093a3635d312ffd78059356",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.download_progress},i("div",{key:"6ef0146a885aadfdf90de134ab8c4ad34b6a0a34",class:"progress-fill",style:{width:`${this.download_progress}%`}})),i("div",{key:"073bb8a2452515e0ea3678ed5da5e85a09df61ba",class:"progress-meta"},i("div",{key:"a401199826a0b028e26dc17155e056fa5b18b049",class:"progress-speed"},this.download_speed),i("div",{key:"a0c6170323d18d62107ea9c93405218773ef8f74",class:"progress-value"},this.format_percent(this.download_progress))),i("button",{key:"9b8beb35c26a57b42c2e1b8b96eadb875e893668",type:"button",class:{cancel:!0,finished:this.download_finished},onClick:()=>this.cancel_download()},this.download_finished?"Close":"Cancel"))),this.show_delete_modal&&i("section",{key:"acb147f3b2474a12948153992db4b105ec46c2e3",class:{"delete-modal":!0,visible:this.show_delete_modal}},i("div",{key:"1adb2b1ed0183ec136bfdaf63b4dfe880f919811",class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"Delete confirmation",tabindex:-1,onKeyDown:e=>this.on_modal_keydown(e,(()=>this.cancel_delete()))},i("div",{key:"2481008ad54e92f4abd82c8e2c36a52e34db0c7c",class:"title"},this.delete_is_dir?"Delete Folder":"Delete File"),i("div",{key:"a91a942f3b35b7886033146597bb1ff7b9998dc1",class:"message"},this.delete_loading?this.delete_recursive?"Deleting the folder and everything in it...":"Deleting...":`Are you sure you want to delete this ${this.delete_is_dir?"folder":"file"}?`),i("div",{key:"f218cfc2faa0843b7dc8715f96aff55986aeab15",class:"file-name",title:this.delete_file_name},this.delete_file_name),this.delete_is_dir&&i("label",{key:"9477429e9d929c95f8173160ea3983034a3e3849",class:"checkline"},i("input",{key:"6573ea9e9b7af1d6233ddf8328b152226b6957bb",type:"checkbox",checked:this.delete_recursive,disabled:this.delete_loading,onChange:e=>this.delete_recursive=e.target.checked}),i("span",{key:"0e2f1fed38cd99272af527a4aebeb56afaaa1c0d"},"Delete everything inside it too")),!this.delete_is_dir||this.delete_recursive?null:i("div",{class:"hint"},"Without this, the remote refuses a folder that is not empty."),this.delete_error&&i("div",{key:"837a597c00932e82be2e713badba936dcefb8b40",class:"dialog-error"},this.delete_error),this.delete_loading&&i("div",{key:"1e350abb9e5d93fff3a496797d5c53c3c2de1827",class:"delete-loader","aria-hidden":"true"},i("span",{key:"89ea233eba5a799e702944afb1c989e707497c77",class:"spinner"})),i("div",{key:"679d16bc9641e98c993bce468cf09a6cd06a345d",class:"modal-actions"},i("button",{key:"2fbcf1783b8a6aeb6f9c7d3f20a8abf3ae68d816",type:"button",class:"btn secondary",onClick:()=>this.cancel_delete(),disabled:this.delete_loading},"Cancel"),i("button",{key:"00cb2afd0df514a36c7977e800007746e8c8e73d",type:"button",class:"btn destructive",onClick:()=>this.confirm_delete(),disabled:this.delete_loading},this.delete_loading?"Deleting...":"Delete")))),this.prompt_kind&&i("section",{key:"7ac274aaa8c19e6d77c3a0be9feb68630fccb84f",class:"prompt-modal visible"},i("div",{key:"b9f9099ae61a0b518491c32e3f6aef79c28a812f",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"mkdir"===this.prompt_kind?"New folder":"Rename",tabindex:-1,onKeyDown:e=>this.on_modal_keydown(e,(()=>this.close_prompt()))},i("div",{key:"e837df12158553b576282957ba368caf977f4d2a",class:"title"},"mkdir"===this.prompt_kind?"New Folder":"Rename"),i("div",{key:"25b71e67724d98f50cb3d21722822bddf8bc2c4c",class:"message"},"mkdir"===this.prompt_kind?`Create a folder in ${this.current_dir}`:"Give it a new name. Existing names are not overwritten."),i("form",{key:"390328d2b0f27a1a315a2bc55ae520e907813068",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),this.submit_prompt()}},i("input",{key:"dc958cd778250116043d82f191c0f4fb2fcf1c91",class:"dialog-input",type:"text",autocorrect:"off",autocapitalize:"none",autoComplete:"off",spellcheck:!1,"aria-label":"Name",disabled:this.prompt_busy,value:this.prompt_value,onInput:e=>this.prompt_value=e.target.value,ref:e=>this.focus_once(e,this.promptInputEl,(e=>this.promptInputEl=e))}),this.prompt_error&&i("div",{key:"588e3aa9ec1759e24404784164a83001f1da8bb8",class:"dialog-error"},this.prompt_error),i("div",{key:"15850d8a366a2a5f87e9b10c0351d684c3c30f78",class:"modal-actions"},i("button",{key:"dbfb5831fd896fc711efe53cbfe8ed57af19a2e3",type:"button",class:"btn secondary",onClick:()=>this.close_prompt(),disabled:this.prompt_busy},"Cancel"),i("button",{key:"95c872e35e3f65f4a7f0893b45c4d258b082b020",type:"submit",class:"btn primary",disabled:this.prompt_busy},this.prompt_busy?"Working...":"mkdir"===this.prompt_kind?"Create":"Rename"))))),this.chmod_target&&i("section",{key:"52373d1f66e3db9da1d8bb3018788efbf19fc762",class:"prompt-modal visible"},i("div",{key:"887b863eb1d41d99acebbe7abe19273b202bbed2",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"Change permissions",tabindex:-1,onKeyDown:e=>this.on_modal_keydown(e,(()=>this.close_chmod()))},i("div",{key:"8c686b15eb982779633720236d3e00559ed37edd",class:"title"},"Permissions"),i("div",{key:"af9b7c128bc8bf0072c9c52de052435b3f8a6574",class:"file-name",title:this.chmod_target.name},this.chmod_target.name),i("table",{key:"996e04c071fb8bbde39a0c811d8beef052f311c5",class:"perm-grid"},i("thead",{key:"767477a3d4aacfe75fa4fa0bdc762c6d3448cebb"},i("tr",{key:"5198f4e64fa9903cfd0c5221cb9ab86d690253e3"},i("th",{key:"d6fb60c8407b19a61e0d215ca8a9a1daa228e98e","aria-label":"Class"}),i("th",{key:"9c1d18a98cd7471f6bae9f1009a2425287f60ef7"},"Read"),i("th",{key:"529584b9be0ac95104818e22b7cd515b9e0f79f8"},"Write"),i("th",{key:"9402ec30094930c53822722c17dd126949c8705e"},"Execute"))),i("tbody",{key:"6aae29e72101eab4f5191696d64d65db35361b95"},[{label:"Owner",read:256,write:128,exec:64},{label:"Group",read:32,write:16,exec:8},{label:"Other",read:4,write:2,exec:1}].map((e=>i("tr",{key:e.label},i("th",{scope:"row"},e.label),[e.read,e.write,e.exec].map((t=>i("td",{key:t},i("input",{type:"checkbox","aria-label":`${e.label} ${t}`,disabled:this.chmod_busy,checked:!!(this.chmod_mode&t),onChange:()=>this.toggle_chmod_bit(t)}))))))))),i("div",{key:"c429b0d2bff193da9b48a2802719b774899125f4",class:"perm-special"},[{label:"setuid",bit:2048},{label:"setgid",bit:1024},{label:"sticky",bit:512}].map((e=>i("label",{key:e.label,class:"checkline"},i("input",{type:"checkbox",disabled:this.chmod_busy,checked:!!(this.chmod_mode&e.bit),onChange:()=>this.toggle_chmod_bit(e.bit)}),i("span",null,e.label))))),i("div",{key:"8927030347b5a78bbc2d0c68963cfa4b50aafc7b",class:"perm-octal"},i("label",{key:"23cab841c245e4efabbf2348d0b932e70084f15d",htmlFor:"chmod-octal"},"Octal"),i("input",{key:"1db5c92a844e4458bd6b3be663d9d1c87d523cb1",id:"chmod-octal",class:"dialog-input",type:"text",autocorrect:"off",autocapitalize:"none",autoComplete:"off",spellcheck:!1,maxlength:4,disabled:this.chmod_busy,value:this.chmod_mode.toString(8).padStart(4,"0"),onInput:e=>this.on_chmod_octal_input(e.target.value)}),i("span",{key:"636db9e85c1e551e3f09882acddca4b5e00ddb3a",class:"perm-preview"},this.format_permissions(this.chmod_mode,this.chmod_target.kind))),this.chmod_error&&i("div",{key:"295b4b35efbabede3481ba87df67dd6c49d96cc4",class:"dialog-error"},this.chmod_error),i("div",{key:"c226a4e3bed1a0388ceed76813667012d1022a4b",class:"modal-actions"},i("button",{key:"716e0e6c46cbdb72872200a3ce5041212b41c63a",type:"button",class:"btn secondary",onClick:()=>this.close_chmod(),disabled:this.chmod_busy},"Cancel"),i("button",{key:"3b579eccd182089b65047280a0a8523aa62e3c74",type:"button",class:"btn primary",onClick:()=>{this.submit_chmod()},disabled:this.chmod_busy},this.chmod_busy?"Applying...":"Apply")))),this.show_editor&&i("section",{key:"c965bc02d104440f0e171a7ebbc3b63bf11b1ca7",class:"editor-modal visible"},i("div",{key:"4796d6b8b79a6a1f486109005bac2f9f76c424d2",class:"editor-dialog",role:"dialog","aria-modal":"true","aria-label":`Editing ${this.editor_name}`,tabindex:-1,onKeyDown:e=>{if((e.ctrlKey||e.metaKey)&&"s"===e.key)return e.preventDefault(),void this.save_editor();this.on_modal_keydown(e,(()=>this.close_editor()))}},i("div",{key:"9f5a55b46763e68b7a127b1b341a6a54e46628f4",class:"editor-head"},i("div",{key:"59b7d4105a5a31e66c520ff0f809bdc59e700330",class:"title"},this.editor_name,this.editor_is_dirty()?" *":""),i("button",{key:"ee74ac43364b05393e3ddbffb40f291bd855a4f8",type:"button",class:"editor-close",onClick:()=>this.close_editor(),"aria-label":"Close editor",disabled:"saving"===this.editor_busy},"x")),"loading"===this.editor_busy?i("div",{class:"editor-loading"},"Loading..."):i("textarea",{class:"editor-text",spellcheck:!1,autocorrect:"off",autocapitalize:"none",autoComplete:"off","aria-label":"File contents",disabled:"saving"===this.editor_busy||!this.editor_loaded,value:this.editor_text,onInput:e=>this.editor_text=e.target.value,ref:e=>this.focus_once(e,this.editorTextEl,(e=>this.editorTextEl=e))}),this.editor_error&&i("div",{key:"9a6c47f21cdce7cc76ce3cb9c5ca12af7215004e",class:"dialog-error"},this.editor_error),this.editor_confirm_discard&&i("div",{key:"d445399441b1411d5f2607c1bed36551e8421b39",class:"dialog-error"},"Unsaved changes. Close anyway?"),i("div",{key:"9a98131525346b0b818dc55f7f02d0be579a75c9",class:"modal-actions"},this.editor_confirm_discard?i("button",{type:"button",class:"btn destructive",onClick:()=>this.close_editor(!0)},"Discard"):i("button",{type:"button",class:"btn secondary",onClick:()=>this.close_editor(),disabled:"saving"===this.editor_busy},"Close"),i("button",{key:"23cbe88de46ef76de09c02e54074606aec5aa3e8",type:"button",class:"btn primary",onClick:()=>{this.save_editor()},disabled:!!this.editor_busy||!this.editor_is_dirty()},"saving"===this.editor_busy?"Saving...":"Save")))))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};l.style=":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;container-type:inline-size;.listing{height:100%;display:flex;flex-direction:column;justify-content:space-between;min-height:0;header{height:30px;background:rgba(28, 31, 38, 0.6);border-bottom:1px solid hsl(var(--border));display:flex;align-items:center;justify-content:space-between;.actions{display:flex;align-items:center;.action{cursor:pointer;padding:4px;display:flex;align-items:center;z-index:1;img{height:14px;padding:4px;border-radius:4px}&:hover{background-color:hsl(var(--border) / 0.6)}}}.title{color:hsl(var(--primary));height:14px;padding:0 12px;display:flex;align-items:center;font-size:0.75rem;line-height:1rem;img{height:14px;margin-right:5px}.text{display:flex;flex-direction:row;justify-content:center;margin-top:2px;.name{margin-right:10px}.description{color:hsl(var(--muted-foreground))}}}}main{flex:1;display:flex;flex-direction:column;position:relative;min-height:0;overflow:hidden;.loader{color:hsl(var(--muted-foreground));font-size:13px;animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;width:100%;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.error{font-size:13px;text-align:center;color:hsl(var(--destructive));height:100%;display:flex;align-items:center;justify-content:center}.navigation{height:25px;padding:10px;font-size:0.75rem;line-height:1rem;background-color:hsl(var(--card));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid hsl(var(--border));position:sticky;top:0;z-index:3;.breadcrumbs{display:flex;align-items:center;margin-right:10px;.breadcrumb-container{white-space:nowrap;.breadcrumb{color:hsl(var(--primary));margin-right:4px;cursor:pointer;&:after{margin-left:4px}&:hover{color:rgb(189, 219, 209)}&:last-child{margin-right:0;color:rgb(189, 219, 209);cursor:default}}}.arrow{height:12px;width:12px;opacity:0.6;top:2px;margin-right:4px;position:relative}}.actions{display:flex;align-items:center;gap:8px}.filter{height:1.5rem;width:110px;padding:0 6px;font:inherit;font-size:0.68rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&::placeholder{color:hsl(var(--muted-foreground))}&:focus{border-color:hsl(var(--primary))}}.action{border:none;background:transparent;color:rgb(189, 219, 209);font-size:1.1rem;line-height:1;padding:2px 4px;border-radius:4px;cursor:pointer;&:hover{background-color:hsl(var(--border) / 0.6)}img{height:14px;width:14px;display:block}}.action.disconnect{color:#ff4d5f;font-size:0.65rem;letter-spacing:0.08em;padding:4px 8px;&:hover{color:#ff6b7a;background-color:hsl(var(--destructive) / 0.12)}}}.content{flex:1;min-height:0;outline:none;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&:focus-visible{box-shadow:inset 0 0 0 1px hsl(var(--primary) / 0.5)}&::-webkit-scrollbar{width:10px;height:10px}&::-webkit-scrollbar-track{background:hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb{background:hsl(var(--scroll-thumb));border-radius:999px;border:2px solid hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb:hover{background:hsl(var(--scroll-thumb-hover))}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:auto;thead{background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));th.sortable{cursor:pointer;user-select:none;&:hover{color:hsl(var(--primary))}}th{padding:8px 10px;text-align:left;color:hsl(var(--muted-foreground));position:sticky;top:0;z-index:2;background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));line-height:0.95rem;&.action-col{width:58px;min-width:58px;padding:0 10px}&:first-child{width:30%;min-width:180px;max-width:195px}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap;width:1%}}}tbody{padding:10px 10px;tr.empty{cursor:default;td{color:hsl(var(--muted-foreground));text-align:center;padding:18px 8px}&:hover{background:transparent}}tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&:first-child{min-width:180px;max-width:195px;white-space:nowrap;.name{display:inline-block;max-width:calc(100% - 26px);overflow:hidden;text-overflow:ellipsis;vertical-align:middle}}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap}&.action-col{width:58px;min-width:58px;text-align:center;padding-left:1px;padding-right:1px;.file-actions{display:flex;align-items:center;justify-content:center;gap:8px}.file-action{border:none;background:transparent;color:hsl(var(--muted-foreground));width:16px;height:16px;border-radius:3px;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease;padding:0;svg{width:12px;height:12px;display:block;margin:0 auto}&:hover{color:hsl(var(--primary))}&.delete:hover{color:hsl(var(--destructive))}}}.name{&.file{color:rgb(189, 219, 209)}&.folder{color:hsl(var(--primary))}}.kind{height:14px;width:14px;margin-right:5px;top:3px;position:relative}}&:hover{cursor:pointer;background-color:hsl(var(--muted) / 0.4);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;color:hsl(var(--primary))}}&.selected{background-color:hsl(var(--primary) / 0.3);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto}&:hover{background-color:hsl(var(--primary) / 0.4)}}}}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border));font-size:0.75rem;line-height:1rem;display:flex;align-items:center;justify-content:space-between;padding:0 10px;.status{font-size:0.65rem;color:hsl(var(--muted-foreground));.selected-item{margin-left:10px;color:hsl(var(--primary))}}.version{font-size:0.65rem;color:hsl(var(--muted-foreground))}}}.creds{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;;&.blurred{background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.auth{display:flex;flex-direction:column;background:hsl(var(--card));position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:30px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;border-radius:var(--radius);.title{margin-bottom:12px;color:hsl(var(--primary))}label{font-size:0.75rem;line-height:1rem;margin-bottom:1rem;color:hsl(var(--muted-foreground))}input{font-size:0.875rem;line-height:1.25rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;background-color:rgb(28, 31, 38);border-color:rgb(39, 44, 53);border-width:1px;border-radius:calc(var(--radius) - 2px);width:100%;margin-bottom:12px;color:rgb(189, 219, 209);box-sizing:border-box;&:focus{outline:none;border-color:hsl(var(--primary));box-shadow:0 0 0 1px hsl(var(--primary))}}button[type='submit']{margin-top:12px;width:100%;background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));letter-spacing:0.05em;font-size:13px;font-weight:500;padding:0.5rem 1rem;border-radius:calc(var(--radius) - 2px);height:2rem;cursor:pointer;border:none;&:hover{background-color:hsl(var(--primary) / 0.9)}}}}.upload-modal,.download-modal,.delete-modal,.prompt-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:6;&.visible{display:flex}.upload-dialog,.download-dialog,.delete-dialog,.prompt-dialog{width:min(360px, calc(100% - 24px));background-color:rgba(21, 24, 30, 0.96);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px}.file-name{color:rgb(189, 219, 209);font-size:0.72rem;line-height:1rem;margin-bottom:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.progress-track{width:100%;height:10px;border-radius:999px;background-color:hsl(var(--muted));overflow:hidden;border:1px solid hsl(var(--border));.progress-fill{height:100%;width:0;background:linear-gradient(90deg, hsl(var(--primary) / 0.7), hsl(var(--primary)));transition:width 140ms ease}}.progress-meta{margin-top:8px;margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:10px}.progress-speed{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:left}.progress-value{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:right}.cancel{margin-top:14px;width:100%;height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);background:hsl(var(--muted));color:rgb(189, 219, 209);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}&.finished{background-color:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover{background-color:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9);color:hsl(var(--primary-foreground))}}}.message{color:rgb(189, 219, 209);font-size:0.74rem;line-height:1rem;margin-bottom:8px}.modal-actions{margin-top:14px;display:grid;grid-template-columns:1fr 1fr;gap:8px;.btn{height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white;&:hover{background:hsl(var(--destructive) / 0.9);border-color:hsl(var(--destructive) / 0.9)}}}.dialog-input{width:100%;box-sizing:border-box;height:2rem;padding:0 8px;font:inherit;font-size:0.75rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary))}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.hint{margin-top:4px;font-size:0.66rem;line-height:0.9rem;color:hsl(var(--muted-foreground))}.checkline{margin-top:8px;display:flex;align-items:center;gap:6px;font-size:0.72rem;color:rgb(189, 219, 209);cursor:pointer;input{accent-color:hsl(var(--primary));margin:0}}.perm-grid{margin-top:10px;width:100%;border-collapse:collapse;font-size:0.68rem;th{color:hsl(var(--muted-foreground));font-weight:normal;text-align:center;padding:2px 0}th[scope='row']{text-align:left;color:rgb(189, 219, 209)}td{text-align:center;padding:2px 0}input{accent-color:hsl(var(--primary));margin:0}}.perm-special{margin-top:4px;display:flex;gap:12px;.checkline{margin-top:4px;font-size:0.66rem}}.perm-octal{margin-top:10px;display:flex;align-items:center;gap:8px;label{font-size:0.68rem;color:hsl(var(--muted-foreground))}.dialog-input{width:4.5rem;text-align:center;letter-spacing:0.1em}.perm-preview{font-size:0.7rem;color:hsl(var(--primary))}}.modal-actions .btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}.delete-loader{margin-top:4px;display:flex;justify-content:center;.spinner{width:16px;height:16px;border:2px solid hsl(var(--muted-foreground) / 0.35);border-top-color:hsl(var(--primary));border-radius:50%;animation:spin 0.7s linear infinite}}}}.editor-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:7;&.visible{display:flex}.editor-dialog{width:min(860px, calc(100% - 24px));height:min(620px, calc(100% - 24px));display:flex;flex-direction:column;background-color:rgba(21, 24, 30, 0.98);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;outline:none;.editor-head{display:flex;align-items:center;justify-content:space-between;gap:8px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.editor-close{border:none;background:transparent;color:hsl(var(--muted-foreground));font-size:0.85rem;line-height:1;padding:2px 6px;border-radius:4px;cursor:pointer;&:hover:not(:disabled){color:hsl(var(--primary));background-color:hsl(var(--border) / 0.6)}&:disabled{opacity:0.5;cursor:not-allowed}}}.editor-loading{flex:1;display:flex;align-items:center;justify-content:center;font-size:0.75rem;color:hsl(var(--muted-foreground))}.editor-text{flex:1;min-height:0;width:100%;box-sizing:border-box;resize:none;padding:10px;font:inherit;font-size:0.75rem;line-height:1.15rem;tab-size:4;white-space:pre;overflow:auto;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary) / 0.6)}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.modal-actions{margin-top:14px;display:flex;justify-content:flex-end;gap:8px;.btn{height:2rem;min-width:6rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover:not(:disabled){border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white}.btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}}}}}@keyframes spin{to{transform:rotate(360deg)}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}@container (max-width: 699px){:host .listing main .content table thead th:nth-child(4),:host .listing main .content table tbody td:nth-child(4){display:none}}@container (max-width: 635px){:host .listing main .content table thead th:nth-child(3),:host .listing main .content table tbody td:nth-child(3){display:none}}@container (max-width: 530px){:host .listing main .content table thead th:nth-child(5),:host .listing main .content table tbody td:nth-child(5){display:none}:host .listing footer .status{display:none}}@container (max-width: 370px){:host .listing main .content table thead th:nth-child(2),:host .listing main .content table tbody td:nth-child(2){display:none}:host .listing main .content table thead th:first-child,:host .listing main .content table tbody td:first-child{width:100%;min-width:0;max-width:none}:host .listing main .content table tbody td:first-child .name{max-width:100%}}@container (max-width: 295px){:host .listing main .content table tbody td:first-child .name{max-width:120px}}";export{l as phirepass_sftp_client}
|
|
1
|
+
import{r as t,c as e,h as i,H as a}from"./p-AP5XjS35.js";import{_ as s,E as o,C as r,a as d,P as n}from"./p-YZKVM0AX.js";const l=class{constructor(i){t(this,i),this.maximizeEvent=e(this,"maximize"),this.connectionStateChanged=e(this,"connectionStateChanged")}channel;domReady=!1;runtimeReady=!1;connected=!1;uploadInputEl;msgId=1;activeUploadToken=0;pendingUploadStarts=new Map;pendingUploadAcks=new Map;pendingDownloadStarts=new Map;activeDownloads=new Map;activeDownloadMsgId;pendingOps=new Map;promptInputEl;editorPath="";editorTextEl;session_id;name="SFTP";description="Client";hideHeader=!1;serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;onNodeIdChange(t,e){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect(),this.status="Connecting...")}serverId;onServerIdChange(t,e){this.onNodeIdChange(this.nodeId,this.nodeId)}maximizeEvent;async maximize(){this.max=!this.max}async minimize(){this.max=!1}connectionStateChanged;max=!1;show_login_screen=!1;show_login_screen_username=!1;show_error=!1;error_message="";show_login_screen_password=!1;show_navigation=!1;breadcrumbs=[];current_dir=".";listing=[];show_content=!1;show_loader=!1;version="";status="Disconnected";selected_item=null;show_upload_modal=!1;upload_progress=0;upload_file_name="";upload_speed="--";upload_finished=!1;show_download_modal=!1;download_progress=0;download_file_name="";download_speed="--";download_finished=!1;show_delete_modal=!1;delete_file_name="";delete_loading=!1;delete_is_dir=!1;delete_recursive=!1;delete_error="";prompt_kind=null;prompt_value="";prompt_error="";prompt_busy=!1;chmod_target=null;chmod_mode=0;chmod_error="";chmod_busy=!1;show_editor=!1;editor_name="";editor_text="";editor_saved_text="";editor_busy="";editor_error="";editor_confirm_discard=!1;editor_loaded=!1;filter="";sort_key="name";sort_asc=!0;toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){await s(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.cancel_active_upload(),this.cancel_active_download(),this.clear_pending_operations(),this.close_comms()}next_msg_id(){const t=this.msgId;return this.msgId+=1,t}clear_pending_operations(){this.pendingUploadStarts.forEach((t=>{window.clearTimeout(t.timeout),t.reject(new Error("Upload start aborted"))})),this.pendingUploadStarts.clear(),this.pendingUploadAcks.forEach((t=>{window.clearTimeout(t.timeout),t.reject(new Error("Upload chunk aborted"))})),this.pendingUploadAcks.clear(),this.pendingDownloadStarts.forEach((t=>{window.clearTimeout(t.timeout),t.reject(new Error("Download start aborted"))})),this.pendingDownloadStarts.clear(),this.pendingOps.forEach((t=>{window.clearTimeout(t.timeout),t.reject(new Error(`Could not ${t.verb}: the session ended.`))})),this.pendingOps.clear(),this.activeDownloads.clear()}cancel_active_upload(){this.activeUploadToken+=1,this.upload_progress=0,this.upload_finished=!1,this.upload_speed="--"}cancel_active_download(){void 0!==this.activeDownloadMsgId&&this.activeDownloads.delete(this.activeDownloadMsgId),this.activeDownloadMsgId=void 0,this.download_progress=0,this.download_finished=!1,this.download_speed="--"}format_duration(t){if(!Number.isFinite(t)||t<0)return"--";if(t<60)return`${t.toFixed(0)}s`;const e=Math.floor(t/60),i=Math.floor(t%60);return e<60?`${e}m ${i}s`:`${Math.floor(e/60)}h ${e%60}m`}format_percent(t){return`${(Number.isFinite(t)?t:0).toFixed(2)}%`}format_transfer_rate(t){return!Number.isFinite(t)||t<=0?"--":`${this.format_size(t)}/s`}update_upload_progress(t,e,i){if(this.upload_progress=Math.max(0,Math.min(100,e>0?t/e*100:0)),t>=e)return this.upload_finished=!0,void(this.upload_speed="--");const a=(performance.now()-i)/1e3,s=a>0?t/a:0;this.upload_speed=this.format_transfer_rate(s);const o=s>0?(e-t)/s:NaN;this.status=`Uploading ${this.format_size(t)} / ${this.format_size(e)} (ETA ${this.format_duration(o)})`}update_download_progress(t,e,i){if(this.download_progress=Math.max(0,Math.min(100,e>0?t/e*100:0)),t>=e)return this.download_finished=!0,void(this.download_speed="--");const a=(Date.now()-i)/1e3,s=a>0?t/a:0;this.download_speed=this.format_transfer_rate(s);const o=s>0?(e-t)/s:NaN;this.status=`Downloading ${this.format_size(t)} / ${this.format_size(e)} (ETA ${this.format_duration(o)})`}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}handle_error(t){if(void 0!==t.msg_id){const e=this.pendingUploadStarts.get(t.msg_id);e&&(window.clearTimeout(e.timeout),e.reject(new Error(t.message||"Upload start failed")),this.pendingUploadStarts.delete(t.msg_id));const i=this.pendingDownloadStarts.get(t.msg_id);i&&(window.clearTimeout(i.timeout),i.reject(new Error(t.message||"Download start failed")),this.pendingDownloadStarts.delete(t.msg_id)),this.activeDownloads.has(t.msg_id)&&(this.activeDownloads.delete(t.msg_id),this.activeDownloadMsgId===t.msg_id&&(this.activeDownloadMsgId=void 0),this.download_finished=!1);const a=this.pendingOps.get(t.msg_id);if(a)return window.clearTimeout(a.timeout),this.pendingOps.delete(t.msg_id),a.reject(new Error(t.message||`Could not ${a.verb}.`)),void(this.show_loader=!1)}switch(t.kind){case o.Generic:case o.Authentication:this.error_message=t.message||"An unknown error occurred.",this.show_error=!0;break;case o.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case o.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case o.RequiresUsernamePassword:this.show_login_screen_username=!0,this.show_login_screen_password=!0,this.show_login_screen=!0}setTimeout((()=>{this.show_loader=!1}),1e3)}handle_auth_success(t){this.clear_creds_buffer(),this.version=t.version,this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_sftp_tunnel(this.nodeId,this.serviceId),this.status="Connected"}handle_tunnel_opened(t){this.session_id=t.sid,this.channel.send_sftp_list_data(this.nodeId,this.session_id,this.current_dir)}handle_sftp_list_items(t){setTimeout((()=>{this.show_loader=!1}),500),t.path!==this.current_dir&&(this.filter=""),this.listing=t.dir.items,this.current_dir=t.path,this.breadcrumbs=t.path.split("/").map(((t,e,i)=>""===t&&0===e?{label:"/",path:"/"}:{label:t,path:i.slice(0,e+1).join("/")})),this.show_content=!0,this.show_navigation=!0,console.log("Received SFTP list items:",t)}handle_upload_start_response(t){if(void 0===t.msg_id)return;const e=this.pendingUploadStarts.get(t.msg_id);e&&(window.clearTimeout(e.timeout),e.resolve(t.response.upload_id),this.pendingUploadStarts.delete(t.msg_id))}handle_upload_chunk_ack(t){const e=`${t.upload_id}_${t.chunk_index}`,i=this.pendingUploadAcks.get(e);i&&(window.clearTimeout(i.timeout),i.resolve(),this.pendingUploadAcks.delete(e))}handle_download_start_response(t){if(void 0===t.msg_id)return;const e=this.pendingDownloadStarts.get(t.msg_id);e&&(window.clearTimeout(e.timeout),e.resolve({download_id:t.response.download_id,total_size:t.response.total_size,total_chunks:t.response.total_chunks}),this.pendingDownloadStarts.delete(t.msg_id))}finalize_download(t){const e=this.activeDownloads.get(t);if(!e)return;const i=Array.from(e.chunks.entries()).sort(((t,e)=>t[0]-e[0])).map((([,t])=>t)).map((t=>new Uint8Array(t))),a=new Blob(i,{type:"application/octet-stream"}),s=URL.createObjectURL(a),o=document.createElement("a");o.href=s,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s),this.activeDownloads.delete(t),this.activeDownloadMsgId===t&&(this.activeDownloadMsgId=void 0),this.download_finished=!0,this.status="Connected"}handle_download_chunk(t){if(void 0===t.msg_id)return;const e=this.activeDownloads.get(t.msg_id);if(!e||!this.session_id)return;const i=new Uint8Array(t.chunk.data);e.chunks.set(t.chunk.chunk_index,i);const a=Array.from(e.chunks.values()).reduce(((t,e)=>t+e.length),0);this.update_download_progress(a,e.total_size,e.startTime),this.channel.send_sftp_download_ack(this.nodeId,this.session_id,e.download_id,t.chunk.chunk_index),e.chunks.size>=e.total_chunks&&this.finalize_download(t.msg_id)}async start_download(t){if(!this.session_id)return;this.selected_item=t,this.download_file_name=t.name,this.download_progress=0,this.download_finished=!1,this.download_speed="--",this.show_download_modal=!0,this.show_error=!1;const e=this.next_msg_id();this.activeDownloadMsgId=e,this.activeDownloads.set(e,{filename:t.name,chunks:new Map,total_chunks:0,total_size:0,download_id:0,startTime:Date.now()});const i=new Promise(((t,i)=>{const a=window.setTimeout((()=>{this.pendingDownloadStarts.delete(e),i(new Error("Download start timeout"))}),1e4);this.pendingDownloadStarts.set(e,{timeout:a,resolve:t,reject:i})}));try{this.channel.send_sftp_download_start(this.nodeId,this.session_id,t.path,t.name,e);const{download_id:a,total_chunks:s,total_size:o}=await i,r=this.activeDownloads.get(e);if(!r)return;r.download_id=a,r.total_chunks=s,r.total_size=o}catch(t){this.activeDownloads.delete(e),this.activeDownloadMsgId===e&&(this.activeDownloadMsgId=void 0),this.show_error=!0,this.error_message=t instanceof Error?t.message:"Failed to start download",this.cancel_download()}}async upload_file(t){if(!this.session_id)return;const e=this.activeUploadToken+1;this.activeUploadToken=e,this.upload_file_name=t.name,this.upload_progress=0,this.upload_finished=!1,this.upload_speed="--",this.show_upload_modal=!0,this.show_error=!1,this.status="Uploading...";const i=65536,a=Math.max(1,Math.ceil(t.size/i)),s=this.next_msg_id(),o=new Promise(((t,e)=>{const i=window.setTimeout((()=>{this.pendingUploadStarts.delete(s),e(new Error("Upload start timeout"))}),1e4);this.pendingUploadStarts.set(s,{timeout:i,resolve:t,reject:e})}));try{this.channel.send_sftp_upload_start(this.nodeId,this.session_id,t.name,this.current_dir,a,BigInt(t.size),s);const r=await o;let d=0;const n=performance.now();for(let s=0;s<a;s+=1){if(e!==this.activeUploadToken)throw new Error("Upload cancelled");const a=s*i,o=Math.min(a+i,t.size),l=new Uint8Array(await t.slice(a,o).arrayBuffer());await new Promise(((t,e)=>{const i=`${r}_${s}`,a=window.setTimeout((()=>{this.pendingUploadAcks.delete(i),e(new Error(`Upload chunk ${s+1} timed out`))}),3e4);this.pendingUploadAcks.set(i,{timeout:a,resolve:t,reject:e}),this.channel.send_sftp_upload_chunk(this.nodeId,this.session_id,r,s,l.length,l,null)})),d+=l.length,this.update_upload_progress(d,t.size,n)}this.upload_progress=100,this.upload_finished=!0,this.status="Connected",this.refresh_directory()}catch(t){"Upload cancelled"!==t.message&&(this.show_error=!0,this.error_message=t instanceof Error?t.message:"Upload failed"),this.upload_finished=!1,this.status="Connected"}}handle_op_result(t){if(void 0===t.msg_id)return;const e=this.pendingOps.get(t.msg_id);e&&(window.clearTimeout(e.timeout),this.pendingOps.delete(t.msg_id),e.resolve(t.result))}run_op(t,e,i=3e4){if(!this.session_id)return Promise.reject(new Error("No active SFTP session."));const a=this.next_msg_id();return new Promise(((s,o)=>{const r=window.setTimeout((()=>{this.pendingOps.delete(a),o(new Error(`Timed out trying to ${t}. This node's agent may be too old to support it.`))}),i);this.pendingOps.set(a,{verb:t,timeout:r,resolve:s,reject:o});try{e(a)}catch(t){window.clearTimeout(r),this.pendingOps.delete(a),o(t instanceof Error?t:new Error(String(t)))}}))}error_text(t){return t instanceof Error?t.message:String(t)}item_path(t){return this.join_path(t.path,t.name)}join_path(t,e){return t&&"/"!==t?t.endsWith("/")?`${t}${e}`:`${t}/${e}`:`/${e}`}invalid_name(t){return t?"."===t||".."===t?"That name is reserved.":t.includes("/")?'A name cannot contain "/".':t.includes("\0")?"A name cannot contain a null byte.":"":"Enter a name."}handle_tunnel_data(t){console.log("received tunnel data:",t)}handle_tunnel_closed(t){this.clear_creds_buffer(),this.close_comms()}open_comms(){this.channel=this.serverId?new r(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new r(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([d.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([d.Disconnected]),this.status="Disconnected"})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([d.Error,t]),this.status="Error "+t.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:e}=t.data;switch(e.type){case n.Error:this.handle_error(e);break;case n.AuthSuccess:this.handle_auth_success(e);break;case n.TunnelOpened:this.handle_tunnel_opened(e);break;case n.TunnelClosed:this.handle_tunnel_closed(e);break;case n.TunnelData:this.handle_tunnel_data(e);break;case n.SFTPListItems:this.handle_sftp_list_items(e);break;case n.SFTPUploadStartResponse:this.handle_upload_start_response(e);break;case n.SFTPUploadChunkAck:this.handle_upload_chunk_ack(e);break;case n.SFTPDownloadStartResponse:this.handle_download_start_response(e);break;case n.SFTPDownloadChunk:this.handle_download_chunk(e);break;case n.SFTPOpResult:this.handle_op_result(e);break;default:console.warn("Unhandled protocol message type:",e)}}))}close_comms(){this.cancel_active_upload(),this.cancel_active_download(),this.clear_pending_operations(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}clear_creds_buffer(){}reset_session_state(){this.clear_creds_buffer()}list_breadcrumb(t){this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,t)}go_to_parent_directory(){this.session_id&&"/"!==this.current_dir&&this.list_breadcrumb(this.breadcrumbs[this.breadcrumbs.length-2]?.path||"/")}refresh_directory(){this.session_id&&this.list_breadcrumb(this.current_dir)}disconnect_session(){this.close_comms(),this.session_id=void 0,this.show_loader=!1,this.show_content=!1,this.breadcrumbs=[],this.current_dir=".",this.listing=[],this.show_navigation=!1,this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_upload_modal=!1,this.show_download_modal=!1,this.show_delete_modal=!1,this.upload_progress=0,this.download_progress=0,this.upload_finished=!1,this.download_finished=!1,this.delete_loading=!1,this.delete_file_name="",this.delete_error="",this.delete_is_dir=!1,this.delete_recursive=!1,this.prompt_kind=null,this.prompt_value="",this.prompt_error="",this.prompt_busy=!1,this.chmod_target=null,this.chmod_error="",this.chmod_busy=!1,this.show_editor=!1,this.editor_busy="",this.editor_error="",this.editor_confirm_discard=!1,this.editor_loaded=!1,this.filter="",this.version="",this.status="Disconnected"}on_file_row_action(t,e){e.preventDefault(),e.stopPropagation(),"File"===t.kind&&this.start_download(t)}on_file_delete_action(t,e){e.preventDefault(),e.stopPropagation(),this.selected_item=t,this.delete_file_name=t.name,this.delete_is_dir="Folder"===t.kind,this.delete_recursive=!1,this.delete_error="",this.delete_loading=!1,this.show_delete_modal=!0}cancel_delete(){this.delete_loading||(this.show_delete_modal=!1,this.delete_file_name="",this.delete_error="",this.delete_is_dir=!1,this.delete_recursive=!1)}async confirm_delete(){if(this.delete_loading)return;const t=this.selected_item;if(!this.session_id||!t)return void(this.show_delete_modal=!1);const e=this.item_path(t),i=this.delete_is_dir&&this.delete_recursive;this.delete_loading=!0,this.delete_error="",this.show_error=!1,this.status=`Deleting ${t.name}...`;try{await this.run_op("delete",(t=>this.channel.send_sftp_remove(this.nodeId,this.session_id,e,i,t)),i?3e5:3e4),this.delete_loading=!1,this.show_delete_modal=!1,this.delete_file_name="",this.delete_is_dir=!1,this.delete_recursive=!1,this.status="Connected",this.refresh_directory()}catch(t){this.delete_loading=!1,this.delete_error=this.error_text(t),this.status="Connected"}}open_mkdir(){this.session_id&&(this.prompt_kind="mkdir",this.prompt_value="",this.prompt_error="",this.prompt_busy=!1)}on_rename_action(t,e){e.preventDefault(),e.stopPropagation(),this.session_id&&(this.selected_item=t,this.prompt_kind="rename",this.prompt_value=t.name,this.prompt_error="",this.prompt_busy=!1)}close_prompt(){this.prompt_busy||(this.prompt_kind=null,this.prompt_value="",this.prompt_error="",this.promptInputEl=void 0)}async submit_prompt(){if(this.prompt_busy||!this.session_id)return;const t=this.prompt_kind,e=this.prompt_value.trim(),i=this.invalid_name(e);if(i)return void(this.prompt_error=i);const a=this.selected_item;if("rename"===t&&a&&e===a.name)this.close_prompt();else{this.prompt_busy=!0,this.prompt_error="",this.show_error=!1;try{if("mkdir"===t){const t=this.join_path(this.current_dir,e);this.status=`Creating ${e}...`,await this.run_op("create the folder",(e=>this.channel.send_sftp_mkdir(this.nodeId,this.session_id,t,e)))}else{if("rename"!==t||!a)return this.prompt_busy=!1,void this.close_prompt();{const t=this.item_path(a),i=this.join_path(a.path,e);this.status=`Renaming ${a.name}...`,await this.run_op("rename",(e=>this.channel.send_sftp_rename(this.nodeId,this.session_id,t,i,e)))}}this.prompt_busy=!1,this.prompt_kind=null,this.prompt_value="",this.promptInputEl=void 0,this.status="Connected",this.refresh_directory()}catch(t){this.prompt_busy=!1,this.prompt_error=this.error_text(t),this.status="Connected"}}}on_chmod_action(t,e){e.preventDefault(),e.stopPropagation(),this.session_id&&(this.selected_item=t,this.chmod_target=t,this.chmod_mode=4095&(t.attributes.permissions??0),this.chmod_error="",this.chmod_busy=!1)}close_chmod(){this.chmod_busy||(this.chmod_target=null,this.chmod_error="")}toggle_chmod_bit(t){this.chmod_busy||(this.chmod_mode=4095&(this.chmod_mode^t))}on_chmod_octal_input(t){const e=t.trim();/^[0-7]{1,4}$/.test(e)?(this.chmod_error="",this.chmod_mode=4095&parseInt(e,8)):this.chmod_error="Enter up to four octal digits, 0-7."}async submit_chmod(){const t=this.chmod_target;if(this.chmod_busy||!this.session_id||!t)return;const e=this.item_path(t),i=4095&this.chmod_mode;this.chmod_busy=!0,this.chmod_error="",this.show_error=!1,this.status=`Setting permissions on ${t.name}...`;try{await this.run_op("change permissions",(t=>this.channel.send_sftp_chmod(this.nodeId,this.session_id,e,i,t))),this.chmod_busy=!1,this.chmod_target=null,this.status="Connected",this.refresh_directory()}catch(t){this.chmod_busy=!1,this.chmod_error=this.error_text(t),this.status="Connected"}}async on_edit_action(t,e){if(e.preventDefault(),e.stopPropagation(),!this.session_id||"File"!==t.kind)return;const i=this.item_path(t);this.selected_item=t,this.show_editor=!0,this.editorPath=i,this.editor_name=t.name,this.editor_text="",this.editor_saved_text="",this.editor_error="",this.editor_confirm_discard=!1,this.editor_loaded=!1,this.editor_busy="loading",this.status=`Opening ${t.name}...`;try{const t=await this.run_op("open the file",(t=>this.channel.send_sftp_read_file(this.nodeId,this.session_id,i,t)),6e4);if("FileContents"!==t.result)throw new Error("The agent answered without any file contents.");const e=this.decode_text(t.contents instanceof Uint8Array?t.contents:new Uint8Array(t.contents));this.editor_text=e,this.editor_saved_text=e,this.editor_loaded=!0,this.editor_busy="",this.status="Connected"}catch(t){this.editor_busy="",this.editor_error=this.error_text(t),this.status="Connected"}}decode_text(t){if(t.includes(0))throw new Error("This looks like a binary file. Download it instead of editing it here.");try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error("This file is not valid UTF-8. Download it instead of editing it here.")}}editor_is_dirty(){return this.editor_loaded&&this.editor_text!==this.editor_saved_text}close_editor(t=!1){"saving"!==this.editor_busy&&(t||!this.editor_is_dirty()?(this.show_editor=!1,this.editor_confirm_discard=!1,this.editor_loaded=!1,this.editorPath="",this.editor_name="",this.editor_text="",this.editor_saved_text="",this.editor_error="",this.editor_busy="",this.editorTextEl=void 0):this.editor_confirm_discard=!0)}async save_editor(){if(this.editor_busy||!this.session_id||!this.editorPath)return;const t=this.editorPath,e=this.editor_text;this.editor_busy="saving",this.editor_error="",this.show_error=!1,this.status=`Saving ${this.editor_name}...`;try{await this.run_op("save the file",(i=>this.channel.send_sftp_write_file(this.nodeId,this.session_id,t,(new TextEncoder).encode(e),i)),6e4),this.editor_saved_text=e,this.editor_busy="",this.status="Connected",this.refresh_directory()}catch(t){this.editor_busy="",this.editor_error=this.error_text(t),this.status="Connected"}}toggle_sort(t){this.sort_key!==t?(this.sort_key=t,this.sort_asc=!0):this.sort_asc=!this.sort_asc}visible_listing(){const t=this.filter.trim().toLowerCase(),e=t?this.listing.filter((e=>e.name.toLowerCase().includes(t))):[...this.listing],i=this.sort_asc?1:-1;return e.sort(((t,e)=>{if(t.kind!==e.kind)return"Folder"===t.kind?-1:1;switch(this.sort_key){case"size":return i*((t.attributes.size??0)-(e.attributes.size??0));case"modified":return i*((t.attributes.modified??0)-(e.attributes.modified??0));default:return i*t.name.localeCompare(e.name,void 0,{numeric:!0,sensitivity:"base"})}}))}sort_indicator(t){return this.sort_key!==t?"":this.sort_asc?" ▲":" ▼"}on_listing_keydown(t){if(this.prompt_kind||this.chmod_target||this.show_editor||this.show_delete_modal)return;const e=this.selected_item;switch(t.key){case"Backspace":t.preventDefault(),this.go_to_parent_directory();break;case"F5":t.preventDefault(),this.refresh_directory();break;case"F2":e&&(t.preventDefault(),this.on_rename_action(e,t));break;case"Delete":e&&(t.preventDefault(),this.on_file_delete_action(e,t));break;case"Enter":e&&(t.preventDefault(),this.list_directory(e))}}on_modal_keydown(t,e){"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),e())}focus_once(t,e,i){t&&t!==e&&(i(t),requestAnimationFrame((()=>t.focus())))}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(t){const e=t.target,i=e.files?.[0];i&&(this.upload_file(i),e.value="")}cancel_upload(){this.cancel_active_upload(),this.show_upload_modal=!1,this.upload_file_name="",this.upload_speed="--",this.status="Connected",this.refresh_directory()}cancel_download(){this.cancel_active_download(),this.show_download_modal=!1,this.download_file_name="",this.download_speed="--",this.status="Connected",this.refresh_directory()}is_selected(t){return!!this.selected_item&&this.selected_item.path===t.path&&this.selected_item.name===t.name}list_directory(t){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===t.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=t);const e=this.item_path(t);e!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,e)):console.warn("Already in this directory. Ignoring click.")}format_size(t){if(void 0===t||Number.isNaN(t))return"-";if(t<1024)return`${t} B`;const e=["KB","MB","GB","TB","PB"];let i=t,a=-1;for(;i>=1024&&a<e.length-1;)i/=1024,a+=1;return`${i.toFixed(i>=10?1:2)} ${e[a]}`}mode_type_to_char(t,e){switch(61440&t){case 49152:return"s";case 40960:return"l";case 32768:return"-";case 24576:return"b";case 16384:return"d";case 8192:return"c";case 4096:return"p";default:return"Folder"===e?"d":"-"}}format_permissions(t,e){if(null==t)return"-";if("string"==typeof t){const i=t.trim();if(/^[bcdlps-][rwxStTs-]{9}$/.test(i))return i;if(/^[0-7]{3,4}$/.test(i)){const t=parseInt(i,8);return this.format_permissions(t,e)}if(/^\d+$/.test(i)){const t=parseInt(i,10);return this.format_permissions(t,e)}return i||"-"}const i=t,a=this.mode_type_to_char(i,e),s=[256&i?"r":"-",128&i?"w":"-",64&i?"x":"-",32&i?"r":"-",16&i?"w":"-",8&i?"x":"-",4&i?"r":"-",2&i?"w":"-",1&i?"x":"-"];return 2048&i&&(s[2]="x"===s[2]?"s":"S"),1024&i&&(s[5]="x"===s[5]?"s":"S"),512&i&&(s[8]="x"===s[8]?"t":"T"),`${a}${s.join("")}`}render(){return i(a,{key:"94f75760ff9d2f6e2852cdabd109f58bbdc21826",class:{default:!this.max,max:this.max}},i("section",{key:"9d2b388a11fb9a4b1ccf8fac1d926c0451fcba3f",class:"listing"},!this.hideHeader&&i("header",{key:"24e3f95b1ff48553e5e8bb150ee7d7ef60f74d73"},i("section",{key:"1023558093761f93f32f58083b56f8385e6eecff",class:"title"},i("img",{key:"dbac57cd459cb6ebca477e85eb9fdeae51b9b8b2",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),i("div",{key:"bab01697a1a84f05fbad8b15b75ba39962408c95",class:"text"},i("div",{key:"e3a29b907e3eef0e7240c13ee50d8e77ffd9a29c",class:"name"},this.name),i("div",{key:"ccdb117f874649914e4bc6fab0257d888a396ff5",class:"description"},this.description))),i("section",{key:"eda0da6fdca162f3414ba0802dad3088b00d9ab1",class:"actions"},i("div",{key:"e0882533b6e2512c0f8c074b031e17b53000413d",class:"action",onClick:()=>this.toggle_max()},i("img",{key:"18d6009f7e272537863034141ed22a30d7adcdb1",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),i("main",{key:"fb9496e11a2d61d73052a735793931c6c262956a"},this.show_navigation&&i("nav",{key:"be8098657ee5bd6335f3e37bb45c19818b3ed354",class:"navigation"},i("div",{key:"c689b18ab1c5ff8c2e06b050d9eb55253f064496",class:"breadcrumbs"},this.breadcrumbs.map(((t,e,a)=>i("span",{key:e,class:"breadcrumb-container"},i("span",{key:e,onClick:()=>this.list_breadcrumb(t.path),class:"breadcrumb"},t.label),e<a.length-1&&i("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),i("section",{key:"8533b0cc60a39d5e43df3646487192d75d28eb95",class:"actions","aria-label":"SFTP actions"},i("input",{key:"a7b98422554ee133af228b18297f03c805f138e5",class:"filter",type:"search",autocorrect:"off",autocapitalize:"none",autoComplete:"off",placeholder:"Filter","aria-label":"Filter this directory",value:this.filter,onInput:t=>this.filter=t.target.value}),i("button",{key:"4ded4cb62772c4d00153c73df40f2d77946f392d",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},i("img",{key:"7c56e8a47b0bd650525dce7d1b14440e7fa5dd05",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),i("button",{key:"5f3dbe6e7bd6dbcdd9f5d08e179b96de25ddfbe4",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},i("img",{key:"fad82f885c47e8fff98fdc987888bdf28533a28d",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),i("button",{key:"5d55e71fa8eb1f2ea1f75859eef44b5a87ece401",type:"button",class:"action",onClick:()=>this.open_mkdir(),title:"New folder","aria-label":"New folder"},i("svg",{key:"58a5611574a4a862767416437d6488c3ba87a566",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{key:"b2bedcd737a0709e0f8af29cbe955acc15477081",d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),i("line",{key:"ef531e0af9df3b308d91590b15d6dfb57acbeee2",x1:"12",x2:"12",y1:"10",y2:"16"}),i("line",{key:"4b3fb7124f97bacf0e723e728a7ddeec3b534879",x1:"9",x2:"15",y1:"13",y2:"13"}))),i("button",{key:"824e0362e5a256c3848392280ea46a7f798be1c0",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},i("img",{key:"9566d040fa2856e1a39db5d16f7c9ac93af319f7",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),i("button",{key:"8f3cb1ca3f128af76d7bc33d162ead4d25df7459",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),i("input",{key:"916c345c3163ccea404fe85da708d1e5a522c8ec",type:"file",ref:t=>this.uploadInputEl=t,onChange:t=>this.on_upload_selected(t),style:{display:"none"}}),this.show_content&&i("div",{key:"c894bda7c9f05538e099335bae720c6ac032dc70",class:"content",tabindex:0,onKeyDown:t=>this.on_listing_keydown(t)},i("table",{key:"e6d162543c57e0805875d52f5de8060473023113"},i("thead",{key:"b32d8edc1cc63834dada7cd4a8a9fc0aa4e641ab"},i("tr",{key:"7ef2d28ba557ab36689066b830534aa644cd100a"},i("th",{key:"9ec3dc58c85915562618f6dfedb466e4d32d8627",class:"sortable",onClick:()=>this.toggle_sort("name"),title:"Sort by name"},"Name",this.sort_indicator("name")),i("th",{key:"75164784bfde44c0844b5ba1e790fd53476ac0e0",class:"sortable",onClick:()=>this.toggle_sort("size"),title:"Sort by size"},"Size",this.sort_indicator("size")),i("th",{key:"f4dc607bb845ee940030cd631bfb07aefda9316e"},"Permissions"),i("th",{key:"2bcbe63f98b2ec812ae0ba82e184cdc0fa1fdfe4"},"Owner"),i("th",{key:"7f3933b4191b303b99cac3a999392ea700072735",class:"sortable",onClick:()=>this.toggle_sort("modified"),title:"Sort by modified date"},"Modified",this.sort_indicator("modified")),i("th",{key:"6fc772fcb7eb31cc2684e5f50c7e0b25fc3cb11a",class:"action-col","aria-label":"Actions"}))),i("tbody",{key:"6a506bd214a34a2f4ae0e138b43226502e2cd283"},this.visible_listing().map(((t,e)=>i("tr",{key:e,class:{selected:this.is_selected(t)},onClick:()=>this.list_directory(t)},i("td",null,i("img","Folder"===t.kind?{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K",alt:"Folder"}:{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"File"}),i("span",{class:`name ${t.kind.toLowerCase()}`},t.name)),i("td",null,"Folder"===t.kind?"-":this.format_size(t.attributes.size)),i("td",null,this.format_permissions(t.attributes.permissions,t.kind)),i("td",null,t.attributes.user??"-"),i("td",null,new Date(1e3*t.attributes.modified).toLocaleString()),i("td",{class:"action-col"},i("div",{class:"file-actions"},"File"===t.kind&&i("button",{type:"button",class:"file-action",onClick:e=>this.on_edit_action(t,e),title:"Edit","aria-label":`Edit ${t.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),i("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z"}))),"File"===t.kind&&i("button",{type:"button",class:"file-action",onClick:e=>this.on_file_row_action(t,e),title:"Download","aria-label":`Download ${t.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i("polyline",{points:"7 10 12 15 17 10"}),i("line",{x1:"12",x2:"12",y1:"15",y2:"3"}))),i("button",{type:"button",class:"file-action",onClick:e=>this.on_rename_action(t,e),title:"Rename","aria-label":`Rename ${t.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"}))),i("button",{type:"button",class:"file-action",onClick:e=>this.on_chmod_action(t,e),title:"Permissions","aria-label":`Change permissions on ${t.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),i("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))),i("button",{type:"button",class:"file-action delete",onClick:e=>this.on_file_delete_action(t,e),title:"Delete","aria-label":`Delete ${t.name}`},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i("polyline",{points:"3 6 5 6 21 6"}),i("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),i("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),i("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),i("line",{x1:"14",x2:"14",y1:"11",y2:"17"})))))))),0===this.visible_listing().length&&i("tr",{key:"b056d99b4df7c0217c0eeb925d7ab8b519456a5f",class:"empty"},i("td",{key:"34a0f9f9e70827e64ea9843bd0263f258fc0c20a",colSpan:6},this.filter?`Nothing here matches "${this.filter}".`:"This directory is empty."))))),this.show_loader&&i("div",{key:"980fd45f6af488bf86dbbf1211abe0ccb3422b81",class:"loader"},"Loading..."),this.show_error&&i("div",{key:"0c368db0fd65b63f64e40119ac474d74e7832b61",class:"error"},this.error_message)),i("footer",{key:"71d8b999bca0fd0a9b3a224fa370f2953abf3b5f"},i("section",{key:"911030d32f3e1fab2f0df0ab43b093626124395c",class:"status"},this.status,this.selected_item&&i("span",{key:"19d2607ce0761647eeda4b01fbea9f4a3ccc5885",class:"selected-item"},this.selected_item.name)),i("section",{key:"e6f3f2a1b3f8adf04eff1b77f2947e210302876f",class:"version"},this.version?`Version: ${this.version}`:""))),this.show_login_screen&&i("section",{key:"f08ce7f1182fffe42e7eb470e52d046095441234",class:{creds:!0,blurred:this.show_login_screen}},i("form",{key:"0fbcaaf222d20a0c5a8769d7d9614135db0971bd",class:"auth",onSubmit:t=>{const e=new FormData(t.target);let i,a;this.show_login_screen_username&&(i=e.get("username")),this.show_login_screen_password&&(a=e.get("password")),this.channel.open_sftp_tunnel(this.nodeId,this.serviceId,i,a),this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_loader=!0,t.stopPropagation(),t.preventDefault()}},i("div",{key:"25af70a09ffe30493a8416f30b367402017b7ed0",class:"title"},"SFTP Connection"),this.show_login_screen_username&&i("div",{key:"3f1064e4acfc3f599e22e9314a455db72fcfd6f2"},i("label",{key:"a353afd35a192e7b8f7f66d0168974a42921a17d",htmlFor:"username"},"Username"),i("input",{key:"bc36e4f51537a4070443f9a5a82910e48842cfec",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"username",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&i("div",{key:"e7181272416bfc7928d8e714d9c3227b5d0c1f66"},i("label",{key:"d090c64f8179378cdef09bd6b9180f5707a1e43e",htmlFor:"password"},"Password"),i("input",{key:"6359b22a3a2ba9c68c1d54ea07dae8b1c388d17a",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"password",name:"password",type:"password",placeholder:""})),i("div",{key:"778c3e57e389329fc12ad6bc90921d86aedd4e80"},i("button",{key:"ad7881537626c5242f4ff5f0ae267e4526589d0f",type:"submit"},"Connect")))),this.show_upload_modal&&i("section",{key:"75ee6bf70138d1df39eae7559e1d5358af127858",class:{"upload-modal":!0,visible:this.show_upload_modal}},i("div",{key:"87ea253eb2044c1748c9feaf1daa9c684df429f8",class:"upload-dialog",role:"dialog","aria-modal":"true","aria-label":"Upload progress"},i("div",{key:"83c64dcfc0a59c0cc76b6d0223c8fd17346849fc",class:"title"},"Uploading File"),i("div",{key:"a71a0dec4cb9d75e0a4edc5612c41238d9729f1a",class:"file-name",title:this.upload_file_name},this.upload_file_name),i("div",{key:"057c9ca8bdf18fbedd75dba33d35ef7336a1c097",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.upload_progress},i("div",{key:"7a503b29c32cc03f0491be389bd9a21b340838aa",class:"progress-fill",style:{width:`${this.upload_progress}%`}})),i("div",{key:"a9b831b1548eecfcf21ad9d3d56a22cc6e3dae84",class:"progress-meta"},i("div",{key:"f5de7e9567ed5633bb81634add297faf24d55123",class:"progress-speed"},this.upload_speed),i("div",{key:"0241bcc3c54afd1cd6e5bb802b8518bb45458659",class:"progress-value"},this.format_percent(this.upload_progress))),i("button",{key:"354fb6fa81acf2e48eaa3ef897fb0d48d9435494",type:"button",class:{cancel:!0,finished:this.upload_finished},onClick:()=>this.cancel_upload()},this.upload_finished?"Close":"Cancel"))),this.show_download_modal&&i("section",{key:"c5ae39a268ae33b4a623b576101fb524fb651a61",class:{"download-modal":!0,visible:this.show_download_modal}},i("div",{key:"38817aa1411005058ae56a9ab3acd66e7e031221",class:"download-dialog",role:"dialog","aria-modal":"true","aria-label":"Download progress"},i("div",{key:"96bebe6045d616d34b8aeef8876032fed887affc",class:"title"},"Downloading File"),i("div",{key:"9669662ca9a60bbee2764ba1b92c7d43a20106af",class:"file-name",title:this.download_file_name},this.download_file_name),i("div",{key:"66b7759dbec989dbd093a3635d312ffd78059356",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.download_progress},i("div",{key:"6ef0146a885aadfdf90de134ab8c4ad34b6a0a34",class:"progress-fill",style:{width:`${this.download_progress}%`}})),i("div",{key:"073bb8a2452515e0ea3678ed5da5e85a09df61ba",class:"progress-meta"},i("div",{key:"a401199826a0b028e26dc17155e056fa5b18b049",class:"progress-speed"},this.download_speed),i("div",{key:"a0c6170323d18d62107ea9c93405218773ef8f74",class:"progress-value"},this.format_percent(this.download_progress))),i("button",{key:"9b8beb35c26a57b42c2e1b8b96eadb875e893668",type:"button",class:{cancel:!0,finished:this.download_finished},onClick:()=>this.cancel_download()},this.download_finished?"Close":"Cancel"))),this.show_delete_modal&&i("section",{key:"acb147f3b2474a12948153992db4b105ec46c2e3",class:{"delete-modal":!0,visible:this.show_delete_modal}},i("div",{key:"1adb2b1ed0183ec136bfdaf63b4dfe880f919811",class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"Delete confirmation",tabindex:-1,onKeyDown:t=>this.on_modal_keydown(t,(()=>this.cancel_delete()))},i("div",{key:"2481008ad54e92f4abd82c8e2c36a52e34db0c7c",class:"title"},this.delete_is_dir?"Delete Folder":"Delete File"),i("div",{key:"a91a942f3b35b7886033146597bb1ff7b9998dc1",class:"message"},this.delete_loading?this.delete_recursive?"Deleting the folder and everything in it...":"Deleting...":`Are you sure you want to delete this ${this.delete_is_dir?"folder":"file"}?`),i("div",{key:"f218cfc2faa0843b7dc8715f96aff55986aeab15",class:"file-name",title:this.delete_file_name},this.delete_file_name),this.delete_is_dir&&i("label",{key:"9477429e9d929c95f8173160ea3983034a3e3849",class:"checkline"},i("input",{key:"6573ea9e9b7af1d6233ddf8328b152226b6957bb",type:"checkbox",checked:this.delete_recursive,disabled:this.delete_loading,onChange:t=>this.delete_recursive=t.target.checked}),i("span",{key:"0e2f1fed38cd99272af527a4aebeb56afaaa1c0d"},"Delete everything inside it too")),!this.delete_is_dir||this.delete_recursive?null:i("div",{class:"hint"},"Without this, the remote refuses a folder that is not empty."),this.delete_error&&i("div",{key:"837a597c00932e82be2e713badba936dcefb8b40",class:"dialog-error"},this.delete_error),this.delete_loading&&i("div",{key:"1e350abb9e5d93fff3a496797d5c53c3c2de1827",class:"delete-loader","aria-hidden":"true"},i("span",{key:"89ea233eba5a799e702944afb1c989e707497c77",class:"spinner"})),i("div",{key:"679d16bc9641e98c993bce468cf09a6cd06a345d",class:"modal-actions"},i("button",{key:"2fbcf1783b8a6aeb6f9c7d3f20a8abf3ae68d816",type:"button",class:"btn secondary",onClick:()=>this.cancel_delete(),disabled:this.delete_loading},"Cancel"),i("button",{key:"00cb2afd0df514a36c7977e800007746e8c8e73d",type:"button",class:"btn destructive",onClick:()=>this.confirm_delete(),disabled:this.delete_loading},this.delete_loading?"Deleting...":"Delete")))),this.prompt_kind&&i("section",{key:"7ac274aaa8c19e6d77c3a0be9feb68630fccb84f",class:"prompt-modal visible"},i("div",{key:"b9f9099ae61a0b518491c32e3f6aef79c28a812f",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"mkdir"===this.prompt_kind?"New folder":"Rename",tabindex:-1,onKeyDown:t=>this.on_modal_keydown(t,(()=>this.close_prompt()))},i("div",{key:"e837df12158553b576282957ba368caf977f4d2a",class:"title"},"mkdir"===this.prompt_kind?"New Folder":"Rename"),i("div",{key:"25b71e67724d98f50cb3d21722822bddf8bc2c4c",class:"message"},"mkdir"===this.prompt_kind?`Create a folder in ${this.current_dir}`:"Give it a new name. Existing names are not overwritten."),i("form",{key:"390328d2b0f27a1a315a2bc55ae520e907813068",onSubmit:t=>{t.preventDefault(),t.stopPropagation(),this.submit_prompt()}},i("input",{key:"dc958cd778250116043d82f191c0f4fb2fcf1c91",class:"dialog-input",type:"text",autocorrect:"off",autocapitalize:"none",autoComplete:"off",spellcheck:!1,"aria-label":"Name",disabled:this.prompt_busy,value:this.prompt_value,onInput:t=>this.prompt_value=t.target.value,ref:t=>this.focus_once(t,this.promptInputEl,(t=>this.promptInputEl=t))}),this.prompt_error&&i("div",{key:"588e3aa9ec1759e24404784164a83001f1da8bb8",class:"dialog-error"},this.prompt_error),i("div",{key:"15850d8a366a2a5f87e9b10c0351d684c3c30f78",class:"modal-actions"},i("button",{key:"dbfb5831fd896fc711efe53cbfe8ed57af19a2e3",type:"button",class:"btn secondary",onClick:()=>this.close_prompt(),disabled:this.prompt_busy},"Cancel"),i("button",{key:"95c872e35e3f65f4a7f0893b45c4d258b082b020",type:"submit",class:"btn primary",disabled:this.prompt_busy},this.prompt_busy?"Working...":"mkdir"===this.prompt_kind?"Create":"Rename"))))),this.chmod_target&&i("section",{key:"52373d1f66e3db9da1d8bb3018788efbf19fc762",class:"prompt-modal visible"},i("div",{key:"887b863eb1d41d99acebbe7abe19273b202bbed2",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"Change permissions",tabindex:-1,onKeyDown:t=>this.on_modal_keydown(t,(()=>this.close_chmod()))},i("div",{key:"8c686b15eb982779633720236d3e00559ed37edd",class:"title"},"Permissions"),i("div",{key:"af9b7c128bc8bf0072c9c52de052435b3f8a6574",class:"file-name",title:this.chmod_target.name},this.chmod_target.name),i("table",{key:"996e04c071fb8bbde39a0c811d8beef052f311c5",class:"perm-grid"},i("thead",{key:"767477a3d4aacfe75fa4fa0bdc762c6d3448cebb"},i("tr",{key:"5198f4e64fa9903cfd0c5221cb9ab86d690253e3"},i("th",{key:"d6fb60c8407b19a61e0d215ca8a9a1daa228e98e","aria-label":"Class"}),i("th",{key:"9c1d18a98cd7471f6bae9f1009a2425287f60ef7"},"Read"),i("th",{key:"529584b9be0ac95104818e22b7cd515b9e0f79f8"},"Write"),i("th",{key:"9402ec30094930c53822722c17dd126949c8705e"},"Execute"))),i("tbody",{key:"6aae29e72101eab4f5191696d64d65db35361b95"},[{label:"Owner",read:256,write:128,exec:64},{label:"Group",read:32,write:16,exec:8},{label:"Other",read:4,write:2,exec:1}].map((t=>i("tr",{key:t.label},i("th",{scope:"row"},t.label),[t.read,t.write,t.exec].map((e=>i("td",{key:e},i("input",{type:"checkbox","aria-label":`${t.label} ${e}`,disabled:this.chmod_busy,checked:!!(this.chmod_mode&e),onChange:()=>this.toggle_chmod_bit(e)}))))))))),i("div",{key:"c429b0d2bff193da9b48a2802719b774899125f4",class:"perm-special"},[{label:"setuid",bit:2048},{label:"setgid",bit:1024},{label:"sticky",bit:512}].map((t=>i("label",{key:t.label,class:"checkline"},i("input",{type:"checkbox",disabled:this.chmod_busy,checked:!!(this.chmod_mode&t.bit),onChange:()=>this.toggle_chmod_bit(t.bit)}),i("span",null,t.label))))),i("div",{key:"8927030347b5a78bbc2d0c68963cfa4b50aafc7b",class:"perm-octal"},i("label",{key:"23cab841c245e4efabbf2348d0b932e70084f15d",htmlFor:"chmod-octal"},"Octal"),i("input",{key:"1db5c92a844e4458bd6b3be663d9d1c87d523cb1",id:"chmod-octal",class:"dialog-input",type:"text",autocorrect:"off",autocapitalize:"none",autoComplete:"off",spellcheck:!1,maxlength:4,disabled:this.chmod_busy,value:this.chmod_mode.toString(8).padStart(4,"0"),onInput:t=>this.on_chmod_octal_input(t.target.value)}),i("span",{key:"636db9e85c1e551e3f09882acddca4b5e00ddb3a",class:"perm-preview"},this.format_permissions(this.chmod_mode,this.chmod_target.kind))),this.chmod_error&&i("div",{key:"295b4b35efbabede3481ba87df67dd6c49d96cc4",class:"dialog-error"},this.chmod_error),i("div",{key:"c226a4e3bed1a0388ceed76813667012d1022a4b",class:"modal-actions"},i("button",{key:"716e0e6c46cbdb72872200a3ce5041212b41c63a",type:"button",class:"btn secondary",onClick:()=>this.close_chmod(),disabled:this.chmod_busy},"Cancel"),i("button",{key:"3b579eccd182089b65047280a0a8523aa62e3c74",type:"button",class:"btn primary",onClick:()=>{this.submit_chmod()},disabled:this.chmod_busy},this.chmod_busy?"Applying...":"Apply")))),this.show_editor&&i("section",{key:"c965bc02d104440f0e171a7ebbc3b63bf11b1ca7",class:"editor-modal visible"},i("div",{key:"4796d6b8b79a6a1f486109005bac2f9f76c424d2",class:"editor-dialog",role:"dialog","aria-modal":"true","aria-label":`Editing ${this.editor_name}`,tabindex:-1,onKeyDown:t=>{if((t.ctrlKey||t.metaKey)&&"s"===t.key)return t.preventDefault(),void this.save_editor();this.on_modal_keydown(t,(()=>this.close_editor()))}},i("div",{key:"9f5a55b46763e68b7a127b1b341a6a54e46628f4",class:"editor-head"},i("div",{key:"59b7d4105a5a31e66c520ff0f809bdc59e700330",class:"title"},this.editor_name,this.editor_is_dirty()?" *":""),i("button",{key:"ee74ac43364b05393e3ddbffb40f291bd855a4f8",type:"button",class:"editor-close",onClick:()=>this.close_editor(),"aria-label":"Close editor",disabled:"saving"===this.editor_busy},"x")),"loading"===this.editor_busy?i("div",{class:"editor-loading"},"Loading..."):i("textarea",{class:"editor-text",spellcheck:!1,autocorrect:"off",autocapitalize:"none",autoComplete:"off","aria-label":"File contents",disabled:"saving"===this.editor_busy||!this.editor_loaded,value:this.editor_text,onInput:t=>this.editor_text=t.target.value,ref:t=>this.focus_once(t,this.editorTextEl,(t=>this.editorTextEl=t))}),this.editor_error&&i("div",{key:"9a6c47f21cdce7cc76ce3cb9c5ca12af7215004e",class:"dialog-error"},this.editor_error),this.editor_confirm_discard&&i("div",{key:"d445399441b1411d5f2607c1bed36551e8421b39",class:"dialog-error"},"Unsaved changes. Close anyway?"),i("div",{key:"9a98131525346b0b818dc55f7f02d0be579a75c9",class:"modal-actions"},this.editor_confirm_discard?i("button",{type:"button",class:"btn destructive",onClick:()=>this.close_editor(!0)},"Discard"):i("button",{type:"button",class:"btn secondary",onClick:()=>this.close_editor(),disabled:"saving"===this.editor_busy},"Close"),i("button",{key:"23cbe88de46ef76de09c02e54074606aec5aa3e8",type:"button",class:"btn primary",onClick:()=>{this.save_editor()},disabled:!!this.editor_busy||!this.editor_is_dirty()},"saving"===this.editor_busy?"Saving...":"Save")))))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};l.style=":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;container-type:inline-size;.listing{height:100%;display:flex;flex-direction:column;justify-content:space-between;min-height:0;header{height:30px;background:rgba(28, 31, 38, 0.6);border-bottom:1px solid hsl(var(--border));display:flex;align-items:center;justify-content:space-between;.actions{display:flex;align-items:center;.action{cursor:pointer;padding:4px;display:flex;align-items:center;z-index:1;img{height:14px;padding:4px;border-radius:4px}&:hover{background-color:hsl(var(--border) / 0.6)}}}.title{color:hsl(var(--primary));height:14px;padding:0 12px;display:flex;align-items:center;font-size:0.75rem;line-height:1rem;img{height:14px;margin-right:5px}.text{display:flex;flex-direction:row;justify-content:center;margin-top:2px;.name{margin-right:10px}.description{color:hsl(var(--muted-foreground))}}}}main{flex:1;display:flex;flex-direction:column;position:relative;min-height:0;overflow:hidden;.loader{color:hsl(var(--muted-foreground));font-size:13px;animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;width:100%;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.error{font-size:13px;text-align:center;color:hsl(var(--destructive));height:100%;display:flex;align-items:center;justify-content:center}.navigation{height:25px;padding:10px;font-size:0.75rem;line-height:1rem;background-color:hsl(var(--card));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid hsl(var(--border));position:sticky;top:0;z-index:3;.breadcrumbs{display:flex;align-items:center;margin-right:10px;.breadcrumb-container{white-space:nowrap;.breadcrumb{color:hsl(var(--primary));margin-right:4px;cursor:pointer;&:after{margin-left:4px}&:hover{color:rgb(189, 219, 209)}&:last-child{margin-right:0;color:rgb(189, 219, 209);cursor:default}}}.arrow{height:12px;width:12px;opacity:0.6;top:2px;margin-right:4px;position:relative}}.actions{display:flex;align-items:center;gap:8px}.filter{height:1.5rem;width:110px;padding:0 6px;font:inherit;font-size:0.68rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&::placeholder{color:hsl(var(--muted-foreground))}&:focus{border-color:hsl(var(--primary))}}.action{border:none;background:transparent;color:rgb(189, 219, 209);font-size:1.1rem;line-height:1;padding:2px 4px;border-radius:4px;cursor:pointer;&:hover{background-color:hsl(var(--border) / 0.6)}img{height:14px;width:14px;display:block}}.action.disconnect{color:#ff4d5f;font-size:0.65rem;letter-spacing:0.08em;padding:4px 8px;&:hover{color:#ff6b7a;background-color:hsl(var(--destructive) / 0.12)}}}.content{flex:1;min-height:0;outline:none;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&:focus-visible{box-shadow:inset 0 0 0 1px hsl(var(--primary) / 0.5)}&::-webkit-scrollbar{width:10px;height:10px}&::-webkit-scrollbar-track{background:hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb{background:hsl(var(--scroll-thumb));border-radius:999px;border:2px solid hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb:hover{background:hsl(var(--scroll-thumb-hover))}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:auto;thead{background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));th.sortable{cursor:pointer;user-select:none;&:hover{color:hsl(var(--primary))}}th{padding:8px 10px;text-align:left;color:hsl(var(--muted-foreground));position:sticky;top:0;z-index:2;background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));line-height:0.95rem;&.action-col{width:58px;min-width:58px;padding:0 10px}&:first-child{width:30%;min-width:180px;max-width:195px}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap;width:1%}}}tbody{padding:10px 10px;tr.empty{cursor:default;td{color:hsl(var(--muted-foreground));text-align:center;padding:18px 8px}&:hover{background:transparent}}tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&:first-child{min-width:180px;max-width:195px;white-space:nowrap;.name{display:inline-block;max-width:calc(100% - 26px);overflow:hidden;text-overflow:ellipsis;vertical-align:middle}}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap}&.action-col{width:58px;min-width:58px;text-align:center;padding-left:1px;padding-right:1px;.file-actions{display:flex;align-items:center;justify-content:center;gap:8px}.file-action{border:none;background:transparent;color:hsl(var(--muted-foreground));width:16px;height:16px;border-radius:3px;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease;padding:0;svg{width:12px;height:12px;display:block;margin:0 auto}&:hover{color:hsl(var(--primary))}&.delete:hover{color:hsl(var(--destructive))}}}.name{&.file{color:rgb(189, 219, 209)}&.folder{color:hsl(var(--primary))}}.kind{height:14px;width:14px;margin-right:5px;top:3px;position:relative}}&:hover{cursor:pointer;background-color:hsl(var(--muted) / 0.4);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;color:hsl(var(--primary))}}&.selected{background-color:hsl(var(--primary) / 0.3);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto}&:hover{background-color:hsl(var(--primary) / 0.4)}}}}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border));font-size:0.75rem;line-height:1rem;display:flex;align-items:center;justify-content:space-between;padding:0 10px;.status{font-size:0.65rem;color:hsl(var(--muted-foreground));.selected-item{margin-left:10px;color:hsl(var(--primary))}}.version{font-size:0.65rem;color:hsl(var(--muted-foreground))}}}.creds{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;;&.blurred{background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.auth{display:flex;flex-direction:column;background:hsl(var(--card));position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:30px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;border-radius:var(--radius);.title{margin-bottom:12px;color:hsl(var(--primary))}label{font-size:0.75rem;line-height:1rem;margin-bottom:1rem;color:hsl(var(--muted-foreground))}input{font-size:0.875rem;line-height:1.25rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;background-color:rgb(28, 31, 38);border-color:rgb(39, 44, 53);border-width:1px;border-radius:calc(var(--radius) - 2px);width:100%;margin-bottom:12px;color:rgb(189, 219, 209);box-sizing:border-box;&:focus{outline:none;border-color:hsl(var(--primary));box-shadow:0 0 0 1px hsl(var(--primary))}}button[type='submit']{margin-top:12px;width:100%;background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));letter-spacing:0.05em;font-size:13px;font-weight:500;padding:0.5rem 1rem;border-radius:calc(var(--radius) - 2px);height:2rem;cursor:pointer;border:none;&:hover{background-color:hsl(var(--primary) / 0.9)}}}}.upload-modal,.download-modal,.delete-modal,.prompt-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:6;&.visible{display:flex}.upload-dialog,.download-dialog,.delete-dialog,.prompt-dialog{width:min(360px, calc(100% - 24px));background-color:rgba(21, 24, 30, 0.96);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px}.file-name{color:rgb(189, 219, 209);font-size:0.72rem;line-height:1rem;margin-bottom:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.progress-track{width:100%;height:10px;border-radius:999px;background-color:hsl(var(--muted));overflow:hidden;border:1px solid hsl(var(--border));.progress-fill{height:100%;width:0;background:linear-gradient(90deg, hsl(var(--primary) / 0.7), hsl(var(--primary)));transition:width 140ms ease}}.progress-meta{margin-top:8px;margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:10px}.progress-speed{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:left}.progress-value{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:right}.cancel{margin-top:14px;width:100%;height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);background:hsl(var(--muted));color:rgb(189, 219, 209);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}&.finished{background-color:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover{background-color:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9);color:hsl(var(--primary-foreground))}}}.message{color:rgb(189, 219, 209);font-size:0.74rem;line-height:1rem;margin-bottom:8px}.modal-actions{margin-top:14px;display:grid;grid-template-columns:1fr 1fr;gap:8px;.btn{height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white;&:hover{background:hsl(var(--destructive) / 0.9);border-color:hsl(var(--destructive) / 0.9)}}}.dialog-input{width:100%;box-sizing:border-box;height:2rem;padding:0 8px;font:inherit;font-size:0.75rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary))}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.hint{margin-top:4px;font-size:0.66rem;line-height:0.9rem;color:hsl(var(--muted-foreground))}.checkline{margin-top:8px;display:flex;align-items:center;gap:6px;font-size:0.72rem;color:rgb(189, 219, 209);cursor:pointer;input{accent-color:hsl(var(--primary));margin:0}}.perm-grid{margin-top:10px;width:100%;border-collapse:collapse;font-size:0.68rem;th{color:hsl(var(--muted-foreground));font-weight:normal;text-align:center;padding:2px 0}th[scope='row']{text-align:left;color:rgb(189, 219, 209)}td{text-align:center;padding:2px 0}input{accent-color:hsl(var(--primary));margin:0}}.perm-special{margin-top:4px;display:flex;gap:12px;.checkline{margin-top:4px;font-size:0.66rem}}.perm-octal{margin-top:10px;display:flex;align-items:center;gap:8px;label{font-size:0.68rem;color:hsl(var(--muted-foreground))}.dialog-input{width:4.5rem;text-align:center;letter-spacing:0.1em}.perm-preview{font-size:0.7rem;color:hsl(var(--primary))}}.modal-actions .btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}.delete-loader{margin-top:4px;display:flex;justify-content:center;.spinner{width:16px;height:16px;border:2px solid hsl(var(--muted-foreground) / 0.35);border-top-color:hsl(var(--primary));border-radius:50%;animation:spin 0.7s linear infinite}}}}.editor-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:7;&.visible{display:flex}.editor-dialog{width:min(860px, calc(100% - 24px));height:min(620px, calc(100% - 24px));display:flex;flex-direction:column;background-color:rgba(21, 24, 30, 0.98);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;outline:none;.editor-head{display:flex;align-items:center;justify-content:space-between;gap:8px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.editor-close{border:none;background:transparent;color:hsl(var(--muted-foreground));font-size:0.85rem;line-height:1;padding:2px 6px;border-radius:4px;cursor:pointer;&:hover:not(:disabled){color:hsl(var(--primary));background-color:hsl(var(--border) / 0.6)}&:disabled{opacity:0.5;cursor:not-allowed}}}.editor-loading{flex:1;display:flex;align-items:center;justify-content:center;font-size:0.75rem;color:hsl(var(--muted-foreground))}.editor-text{flex:1;min-height:0;width:100%;box-sizing:border-box;resize:none;padding:10px;font:inherit;font-size:0.75rem;line-height:1.15rem;tab-size:4;white-space:pre;overflow:auto;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary) / 0.6)}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.modal-actions{margin-top:14px;display:flex;justify-content:flex-end;gap:8px;.btn{height:2rem;min-width:6rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover:not(:disabled){border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white}.btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}}}}}@keyframes spin{to{transform:rotate(360deg)}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}@container (max-width: 699px){:host .listing main .content table thead th:nth-child(4),:host .listing main .content table tbody td:nth-child(4){display:none}}@container (max-width: 635px){:host .listing main .content table thead th:nth-child(3),:host .listing main .content table tbody td:nth-child(3){display:none}}@container (max-width: 530px){:host .listing main .content table thead th:nth-child(5),:host .listing main .content table tbody td:nth-child(5){display:none}:host .listing footer .status{display:none}}@container (max-width: 370px){:host .listing main .content table thead th:nth-child(2),:host .listing main .content table tbody td:nth-child(2){display:none}:host .listing main .content table thead th:first-child,:host .listing main .content table tbody td:first-child{width:100%;min-width:0;max-width:none}:host .listing main .content table tbody td:first-child .name{max-width:100%}}@container (max-width: 295px){:host .listing main .content table tbody td:first-child .name{max-width:120px}}@container (max-width: 635px){:host .listing main .content table tbody tr td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;width:36px;height:36px;border-radius:8px}:host .listing main .content table tbody tr td.action-col .file-action svg{width:17px;height:17px}:host .listing main .content table thead th.action-col,:host .listing main .content table tbody td.action-col{width:92px;min-width:92px}:host .listing main .content table tbody td.action-col .file-actions{gap:4px}:host .listing main .content table tbody tr:hover{background-color:transparent}:host .listing main .content table tbody tr.selected:hover{background-color:hsl(var(--primary) / 0.3)}:host .listing main .content table tbody td{padding:13px 10px 12px}:host .listing main .content table thead th{padding:12px 10px}:host .listing main .navigation{height:auto;min-height:44px;padding:6px 8px}:host .listing main .navigation .action{padding:10px;border-radius:8px}:host .listing main .navigation .action img{height:17px;width:17px}:host .listing main .navigation .action.disconnect{padding:10px 12px}:host .listing main .navigation .filter{height:2.25rem;font-size:16px;width:8rem}:host .listing header .actions .action{padding:8px}:host .listing header .actions .action img{height:17px}:host .modal .upload-dialog .cancel,:host .modal .download-dialog .cancel,:host .modal .delete-dialog .cancel,:host .modal .prompt-dialog .cancel,:host .modal .upload-dialog .modal-actions .btn,:host .modal .download-dialog .modal-actions .btn,:host .modal .delete-dialog .modal-actions .btn,:host .modal .prompt-dialog .modal-actions .btn{height:2.75rem}:host .modal .prompt-dialog .dialog-input,:host .auth input{height:2.5rem;font-size:16px}:host .modal .prompt-dialog .perm-grid input,:host .modal .prompt-dialog .perm-special input{width:20px;height:20px}:host .modal .prompt-dialog .perm-grid td,:host .modal .prompt-dialog .perm-grid th{padding:7px 0}}";export{l as phirepass_sftp_client}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as r}from"./p-AP5XjS35.js";export{s as setNonce}from"./p-AP5XjS35.js";import{g as o}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,o={};return""!==r&&(o.resourcesUrl=new URL(".",r).href),e(o)})().then((async e=>(await o(),r([["p-
|
|
1
|
+
import{p as e,b as r}from"./p-AP5XjS35.js";export{s as setNonce}from"./p-AP5XjS35.js";import{g as o}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,o={};return""!==r&&(o.resourcesUrl=new URL(".",r).href),e(o)})().then((async e=>(await o(),r([["p-0f7d5b4b",[[769,"phirepass-rdp",{serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],username:[1],password:[1],destination:[1],scale:[1],dynamicResize:[4,"dynamic-resize"],captureKeyboard:[4,"capture-keyboard"],clipboard:[4],serverId:[1,"server-id"],credentialsPrompt:[32],statusMessage:[32],toggleFullscreen:[64],keyboardLockSupported:[64],focusDesktop:[64],sendCtrlAltDel:[64],sendMetaKey:[64]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-c976ff11",[[513,"phirepass-sftp-client",{name:[1],description:[1],hideHeader:[4,"hide-header"],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],serverId:[1,"server-id"],max:[32],show_login_screen:[32],show_login_screen_username:[32],show_error:[32],error_message:[32],show_login_screen_password:[32],show_navigation:[32],breadcrumbs:[32],current_dir:[32],listing:[32],show_content:[32],show_loader:[32],version:[32],status:[32],selected_item:[32],show_upload_modal:[32],upload_progress:[32],upload_file_name:[32],upload_speed:[32],upload_finished:[32],show_download_modal:[32],download_progress:[32],download_file_name:[32],download_speed:[32],download_finished:[32],show_delete_modal:[32],delete_file_name:[32],delete_loading:[32],delete_is_dir:[32],delete_recursive:[32],delete_error:[32],prompt_kind:[32],prompt_value:[32],prompt_error:[32],prompt_busy:[32],chmod_target:[32],chmod_mode:[32],chmod_error:[32],chmod_busy:[32],show_editor:[32],editor_name:[32],editor_text:[32],editor_saved_text:[32],editor_busy:[32],editor_error:[32],editor_confirm_discard:[32],editor_loaded:[32],filter:[32],sort_key:[32],sort_asc:[32],maximize:[64],minimize:[64]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-4c11e075",[[513,"phirepass-terminal",{terminalOptions:[16],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],keyBar:[1,"key-bar"],serverId:[1,"server-id"],ctrlArmed:[32],altArmed:[32]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]]],e))));
|
|
@@ -57,6 +57,25 @@ export declare class PhirepassTerminal {
|
|
|
57
57
|
nodeId: string;
|
|
58
58
|
serviceId: string;
|
|
59
59
|
token: string;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to draw the on-screen key bar.
|
|
62
|
+
*
|
|
63
|
+
* `auto` shows it wherever the pointer is coarse, which is the whole of the
|
|
64
|
+
* decision on a phone and none of it on a desktop — so it is answered in
|
|
65
|
+
* CSS (`@media (pointer: coarse)`) rather than by sniffing the user agent
|
|
66
|
+
* here. `on` and `off` exist because an embedder may know better: a tablet
|
|
67
|
+
* with a keyboard case reports a coarse pointer and does not need this.
|
|
68
|
+
*/
|
|
69
|
+
keyBar: 'auto' | 'on' | 'off';
|
|
70
|
+
/**
|
|
71
|
+
* The sticky modifiers, armed by a tap and spent on the next key.
|
|
72
|
+
*
|
|
73
|
+
* State rather than a plain field because the bar has to show which of them
|
|
74
|
+
* is armed — a modifier you cannot see the state of is a modifier you press
|
|
75
|
+
* twice.
|
|
76
|
+
*/
|
|
77
|
+
private ctrlArmed;
|
|
78
|
+
private altArmed;
|
|
60
79
|
onNodeIdChange(newValue?: string, _oldValue?: string): void;
|
|
61
80
|
serverId?: string;
|
|
62
81
|
onServerIdChange(_newValue?: string, _oldValue?: string): void;
|
|
@@ -85,9 +104,58 @@ export declare class PhirepassTerminal {
|
|
|
85
104
|
private connect;
|
|
86
105
|
private setup_resize_observer;
|
|
87
106
|
private handle_terminal_data;
|
|
107
|
+
/**
|
|
108
|
+
* The one place input reaches the session, whatever produced it.
|
|
109
|
+
*
|
|
110
|
+
* The key bar goes through here too, which is what makes it work during the
|
|
111
|
+
* credential prompts: a tapped backspace at the password prompt is the same
|
|
112
|
+
* event as a typed one, and neither has to know which of the three modes
|
|
113
|
+
* the widget is in.
|
|
114
|
+
*/
|
|
115
|
+
private dispatch_input;
|
|
116
|
+
/**
|
|
117
|
+
* Spend whatever the key bar has armed on this keystroke.
|
|
118
|
+
*
|
|
119
|
+
* Only single characters are transformed. A paste arrives as one `onData`
|
|
120
|
+
* call carrying the whole clipboard, and control-ing the first character of
|
|
121
|
+
* it — or worse, escape-prefixing a hundred lines — is not what anybody
|
|
122
|
+
* armed the modifier for. An escape sequence the terminal generated itself
|
|
123
|
+
* (an arrow key on a hardware keyboard) is left alone for the same reason:
|
|
124
|
+
* it already encodes its own modifiers.
|
|
125
|
+
*/
|
|
126
|
+
private apply_modifiers;
|
|
127
|
+
private clear_modifiers;
|
|
128
|
+
/**
|
|
129
|
+
* A key from the bar.
|
|
130
|
+
*
|
|
131
|
+
* Focus is returned to the terminal afterwards: on a phone the soft
|
|
132
|
+
* keyboard is tied to the focused element, and a bar that dismissed it on
|
|
133
|
+
* every tap would be a bar you use once.
|
|
134
|
+
*/
|
|
135
|
+
private press;
|
|
136
|
+
/**
|
|
137
|
+
* An arrow, encoded with whatever is armed.
|
|
138
|
+
*
|
|
139
|
+
* xterm's modifier encoding is a bitfield offset by one: 1 is unmodified,
|
|
140
|
+
* +1 shift, +2 alt, +4 ctrl. Unmodified arrows keep the short form, because
|
|
141
|
+
* some remote programs only ever learned that one.
|
|
142
|
+
*/
|
|
143
|
+
private arrow;
|
|
88
144
|
private handle_username_input;
|
|
89
145
|
private submit_username;
|
|
90
146
|
private handle_password_input;
|
|
91
147
|
private submit_password;
|
|
148
|
+
/**
|
|
149
|
+
* One key on the bar.
|
|
150
|
+
*
|
|
151
|
+
* The press swallows its own default so the button never takes focus:
|
|
152
|
+
* moving focus off the terminal is what closes the soft keyboard, and a
|
|
153
|
+
* modifier bar that closes the keyboard is a modifier bar for nothing.
|
|
154
|
+
*
|
|
155
|
+
* Both events are guarded because either can be the one that moves focus —
|
|
156
|
+
* a touch fires `pointerdown` and then a compatibility `mousedown`, and it
|
|
157
|
+
* is whichever of them runs first that has to be refused.
|
|
158
|
+
*/
|
|
159
|
+
private key_button;
|
|
92
160
|
render(): any;
|
|
93
161
|
}
|
|
@@ -133,6 +133,11 @@ export namespace Components {
|
|
|
133
133
|
* @default 30_000
|
|
134
134
|
*/
|
|
135
135
|
"heartbeatInterval": number;
|
|
136
|
+
/**
|
|
137
|
+
* Whether to draw the on-screen key bar. `auto` shows it wherever the pointer is coarse, which is the whole of the decision on a phone and none of it on a desktop — so it is answered in CSS (`@media (pointer: coarse)`) rather than by sniffing the user agent here. `on` and `off` exist because an embedder may know better: a tablet with a keyboard case reports a coarse pointer and does not need this.
|
|
138
|
+
* @default 'auto'
|
|
139
|
+
*/
|
|
140
|
+
"keyBar": 'auto' | 'on' | 'off';
|
|
136
141
|
"nodeId": string;
|
|
137
142
|
/**
|
|
138
143
|
* @default "phirepass.com"
|
|
@@ -340,6 +345,11 @@ declare namespace LocalJSX {
|
|
|
340
345
|
* @default 30_000
|
|
341
346
|
*/
|
|
342
347
|
"heartbeatInterval"?: number;
|
|
348
|
+
/**
|
|
349
|
+
* Whether to draw the on-screen key bar. `auto` shows it wherever the pointer is coarse, which is the whole of the decision on a phone and none of it on a desktop — so it is answered in CSS (`@media (pointer: coarse)`) rather than by sniffing the user agent here. `on` and `off` exist because an embedder may know better: a tablet with a keyboard case reports a coarse pointer and does not need this.
|
|
350
|
+
* @default 'auto'
|
|
351
|
+
*/
|
|
352
|
+
"keyBar"?: 'auto' | 'on' | 'off';
|
|
343
353
|
"nodeId": string;
|
|
344
354
|
"onConnectionStateChanged"?: (event: PhirepassTerminalCustomEvent<[ConnectionState, unknown?]>) => void;
|
|
345
355
|
/**
|
|
@@ -397,6 +407,7 @@ declare namespace LocalJSX {
|
|
|
397
407
|
"nodeId": string;
|
|
398
408
|
"serviceId": string;
|
|
399
409
|
"token": string;
|
|
410
|
+
"keyBar": 'auto' | 'on' | 'off';
|
|
400
411
|
"serverId": string;
|
|
401
412
|
}
|
|
402
413
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phirepass-widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"description": "Phirepass widgets for the web application",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"@xterm/addon-web-links": "^0.12.0",
|
|
58
58
|
"@xterm/addon-webgl": "^0.19.0",
|
|
59
59
|
"@xterm/xterm": "^6.0.0",
|
|
60
|
-
"phirepass-channel": "^0.1.
|
|
60
|
+
"phirepass-channel": "^0.1.346"
|
|
61
61
|
}
|
|
62
62
|
}
|