phirepass-widgets 0.0.114 → 0.0.115
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-downloader_3.cjs.entry.js +133 -38
- package/dist/cjs/phirepass-rdp.cjs.entry.js +1 -1
- package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/collection/components/phirepass-downloader/jobs.js +22 -2
- package/dist/collection/components/phirepass-downloader/views/icons.js +1 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +9 -0
- package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +79 -3
- package/dist/collection/components/phirepass-media-player/player.js +24 -0
- package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +1 -1
- package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +33 -33
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
- package/dist/components/p-DIf-Ru26.js +1 -0
- package/dist/components/p-DqT-qhTU.js +1 -0
- package/dist/components/phirepass-downloader.js +1 -1
- package/dist/components/phirepass-media-player.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 +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-downloader_3.entry.js +133 -38
- package/dist/esm/phirepass-rdp.entry.js +1 -1
- package/dist/esm/phirepass-terminal.entry.js +2 -2
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/phirepass-widgets/{p-a4a5e5f5.entry.js → p-2fd32ec5.entry.js} +1 -1
- package/dist/phirepass-widgets/{p-a5ce104d.entry.js → p-705501d4.entry.js} +1 -1
- package/dist/phirepass-widgets/p-b8caf9e1.entry.js +1 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/components/phirepass-downloader/jobs.d.ts +7 -0
- package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +16 -1
- package/dist/types/components/phirepass-media-player/player.d.ts +10 -0
- package/dist/types/components.d.ts +10 -2
- package/package.json +4 -4
- package/dist/components/p-C4cmk3bS.js +0 -1
- package/dist/components/p-CKnb-oeB.js +0 -1
- package/dist/phirepass-widgets/p-97d84225.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,t,p as i,H as s,c as a,a as o}from"./index.js";import{_ as r,E as n,C as d,a as l,P as c}from"./p-BtMWUitf.js";import{d as h,s as b,i as p,D as m}from"./p-CKnb-oeB.js";import{I as g,d as f}from"./p-C4cmk3bS.js";function u(e){return e.endsWith(".phirepass-part")}const y=/\.(mp4|m4v|webm|mkv|mov|mp3|m4a|flac|ogg|oga|opus|wav)$/i;function v(e){const t=e.replace(/\/{2,}/g,"/");return t.length>1?t.replace(/\/+$/,""):t}function x(e,t){return v(e)===v(t)}const w=({count:t,onClick:i})=>e("button",{type:"button",class:"action fetch",onClick:i,title:"Fetch from a link, magnet or torrent","aria-label":"Fetch from a link, magnet or torrent"},e(g,{name:"fetch",size:14}),t>0&&e("span",{class:"badge","aria-label":t+" active"},t)),k=({name:t,busy:i,onCancel:s,onConfirm:a})=>e("section",{class:"delete-modal visible"},e("div",{class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"This file is still downloading",tabindex:-1,onKeyDown:e=>{"Escape"===e.key&&s()}},e("div",{class:"title"},"This file is still downloading"),e("div",{class:"message"},"Deleting ",e("span",{class:"file-name inline"},t)," deletes its download."),e("div",{class:"modal-actions"},e("button",{type:"button",class:"btn secondary",onClick:s,disabled:i},"Keep it"),e("button",{type:"button",class:"btn destructive",onClick:a,disabled:i},"Delete download")))),I=({menu:t,onFetch:i,onDownload:s,onRename:a,onDelete:o,onClose:r})=>e("div",{class:"context-backdrop",onClick:r,onContextMenu:e=>(e.preventDefault(),r())},e("div",{class:"context-menu",role:"menu","aria-label":"Actions for "+t.name,style:{left:t.x+"px",top:t.y+"px"},onClick:e=>e.stopPropagation()},e("button",{type:"button",role:"menuitem",class:"primary",onClick:i},e(g,{name:"fetch",size:13})," Download torrent contents here"),e("hr",null),e("button",{type:"button",role:"menuitem",onClick:s},"Download"),e("button",{type:"button",role:"menuitem",onClick:a},"Rename"),e("button",{type:"button",role:"menuitem",class:"danger",onClick:o},"Delete"))),_=i(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.maximizeEvent=a(this,"maximize"),this.connectionStateChanged=a(this,"connectionStateChanged")}get el_host(){return this}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;channelFactory;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;channel_ready=!1;fetch_count=0;fresh_names=[];part_delete=null;torrent_menu=null;listing_player=null;downloaderEl;fetch_enabled(){return b(this.channel)}stream_base(){return`${this.allowInsecure?"http":"https"}://${this.serverHost}${!this.allowInsecure&&443===this.serverPort||this.allowInsecure&&80===this.serverPort?"":":"+this.serverPort}`}on_fetch_completed(e){x(function(e){return v(e.sub_dir?`${e.dest_root}/${e.sub_dir}`:e.dest_root)}(e),this.current_dir)&&(this.fresh_names=[...this.fresh_names.filter((t=>t!==e.name)),e.name],this.refresh_directory())}on_show_in_folder(e){this.fresh_names=[e.name],x(e.path,this.current_dir)||this.list_breadcrumb(e.path)}async on_row_context_menu(e,t){if("File"!==e.kind||!/\.torrent$/i.test(e.name)||!this.downloaderEl)return;const i=this.item_path(e);if(t.preventDefault(),null===await this.downloaderEl.torrentPathFor(i))return;const s=this.el_host.getBoundingClientRect();this.selected_item=e,this.torrent_menu={x:t.clientX-s.left,y:t.clientY-s.top,path:i,name:e.name}}async play_listing_file(e,t){t.preventDefault(),t.stopPropagation();const i=this.channel;if("function"!=typeof i.send_sftp_open_stream)return;const s=this.item_path(e);try{const t=await this.run_op("play",(e=>i.send_sftp_open_stream(this.nodeId,this.session_id,s,e)));if("Stream"!==t.result||!t.token)throw Error("The node did not open a stream.");this.listing_player={src:`${this.stream_base()}/api/web/stream/${encodeURIComponent(this.nodeId)}/t/${encodeURIComponent(t.token)}`,name:e.name,key:`node:${this.nodeId}:${s}`}}catch(e){this.error_message=this.error_text(e),this.show_error=!0}}listing_can_play(){return"function"==typeof this.channel?.send_sftp_open_stream}toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){this.channelFactory||await r(),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(Error("Upload start aborted"))})),this.pendingUploadStarts.clear(),this.pendingUploadAcks.forEach((e=>{window.clearTimeout(e.timeout),e.reject(Error("Upload chunk aborted"))})),this.pendingUploadAcks.clear(),this.pendingDownloadStarts.forEach((e=>{window.clearTimeout(e.timeout),e.reject(Error("Download start aborted"))})),this.pendingDownloadStarts.clear(),this.pendingOps.forEach((e=>{window.clearTimeout(e.timeout),e.reject(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);return t<60?`${t}m ${Math.floor(e%60)}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 o=a>0?(t-e)/a:NaN;this.status=`Uploading ${this.format_size(e)} / ${this.format_size(t)} (ETA ${this.format_duration(o)})`}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 o=a>0?(t-e)/a:NaN;this.status=`Downloading ${this.format_size(e)} / ${this.format_size(t)} (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 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(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(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(Error(e.message||`Could not ${s.verb}.`)),void(this.show_loader=!1)}switch(e.kind){case n.Generic:case n.Authentication:this.error_message=e.message||"An unknown error occurred.",this.show_error=!0;break;case n.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case n.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case n.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",this.channel_ready=!0}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=""),e.path!==this.current_dir&&(this.fresh_names=[]),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),o=document.createElement("a");o.href=a,o.download=t.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),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(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:o}=await i,r=this.activeDownloads.get(t);if(!r)return;r.download_id=s,r.total_chunks=a,r.total_size=o}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(),o=new Promise(((e,t)=>{const i=window.setTimeout((()=>{this.pendingUploadStarts.delete(a),t(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 r=await o;let n=0;const d=performance.now();for(let a=0;a<s;a+=1){if(t!==this.activeUploadToken)throw Error("Upload cancelled");const s=a*i,o=Math.min(s+i,e.size),l=new Uint8Array(await e.slice(s,o).arrayBuffer());await new Promise(((e,t)=>{const i=`${r}_${a}`,s=window.setTimeout((()=>{this.pendingUploadAcks.delete(i),t(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,r,a,l.length,l,null)})),n+=l.length,this.update_upload_progress(n,e.size,d)}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(Error("No active SFTP session."));const s=this.next_msg_id();return new Promise(((a,o)=>{const r=window.setTimeout((()=>{this.pendingOps.delete(s),o(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:r,resolve:a,reject:o});try{t(s)}catch(e){window.clearTimeout(r),this.pendingOps.delete(s),o(e instanceof Error?e:Error(e+""))}}))}error_text(e){return e instanceof Error?e.message: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(){const e=this.create_web_socket_endpoint()+"/api/web/ws";this.channel=this.channelFactory?this.channelFactory(e,this.nodeId,this.serverId||void 0):this.serverId?new d(e,this.nodeId,this.serverId):new d(e,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([l.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([l.Disconnected]),this.status="Disconnected",this.channel_ready=!1})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([l.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:t}=e.data;if(p(t)||t.type===c.Error&&(t.msg_id??0)>=m)this.downloaderEl?.receive(e);else switch(t.type){case c.Error:this.handle_error(t);break;case c.AuthSuccess:this.handle_auth_success(t);break;case c.TunnelOpened:this.handle_tunnel_opened(t);break;case c.TunnelClosed:this.handle_tunnel_closed(t);break;case c.TunnelData:this.handle_tunnel_data(t);break;case c.SFTPListItems:this.handle_sftp_list_items(t);break;case c.SFTPUploadStartResponse:this.handle_upload_start_response(t);break;case c.SFTPUploadChunkAck:this.handle_upload_chunk_ack(t);break;case c.SFTPDownloadStartResponse:this.handle_download_start_response(t);break;case c.SFTPDownloadChunk:this.handle_download_chunk(t);break;case c.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",this.channel_ready=!1,this.part_delete=null,this.torrent_menu=null,this.listing_player=null}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,"File"===e.kind&&u(e.name)&&this.downloaderEl?this.downloaderEl.jobForPath(this.item_path(e)).then((t=>{t?this.part_delete={download_id:t.download_id,name:e.name,busy:!1}:this.open_delete_prompt(e)})):this.open_delete_prompt(e)}open_delete_prompt(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 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 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 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";let t=e,i=-1;for(;t>=1024&&i<4;)t/=1024,i+=1;return`${t.toFixed(t>=10?1:2)} ${["KB","MB","GB","TB","PB"][i]}`}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();return/^[bcdlps-][rwxStTs-]{9}$/.test(i)?i:/^[0-7]{3,4}$/.test(i)?this.format_permissions(parseInt(i,8),t):/^\d+$/.test(i)?this.format_permissions(parseInt(i,10),t):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 e(o,{key:"1add0943926c6c6a88bc981f8a1518d65236683c",class:{default:!this.max,max:this.max}},e("section",{key:"28626f9858866d915616b2ebc085a1ce859b03f0",class:"listing"},!this.hideHeader&&e("header",{key:"f8f10d47f0b16ed1bf1967f5cf600b4c70495d70"},e("section",{key:"4ab613e910bbfed7cacb119db7edf547fbda39fa",class:"title"},e("img",{key:"2642eacb535e5aafac0e6425bc7cd0526957001d",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),e("div",{key:"6f34a92afe6d4000c6f583289a8f6217b2368900",class:"text"},e("div",{key:"456e5506271447a8d2ae276672b3a34f016417e6",class:"name"},this.name),e("div",{key:"ecb14900f1abb5d306f8fc385bf8c17f85a58d11",class:"description"},this.description))),e("section",{key:"bb30a18acda6ae3eefff0b56b393d379d0c21c06",class:"actions"},e("div",{key:"07bafaa8f7b854a997e8a90f84b757e4b78c30a7",class:"action",onClick:()=>this.toggle_max()},e("img",{key:"d302666026a736aa471b4f6c156114566d56f35c",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),e("main",{key:"0233f33b0205f6b4d6e7847e3a606d2564a61f65"},this.show_navigation&&e("nav",{key:"36c75ce35cd00479b436b7928cd121f36cfb275a",class:"navigation"},e("div",{key:"3b34fd062152edeb9e1d4de19151b209a5994211",class:"breadcrumbs"},this.breadcrumbs.map(((t,i,s)=>e("span",{key:i,class:"breadcrumb-container"},e("span",{key:i,onClick:()=>this.list_breadcrumb(t.path),class:"breadcrumb"},t.label),i<s.length-1&&e("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),e("section",{key:"6c424e6318c729acbeed5d9c1b6bef8e24dc931a",class:"actions","aria-label":"SFTP actions"},e("input",{key:"5642bb923cfae63906cef97b927dd8851cc05ebd",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}),e("button",{key:"782f09887a6e13c13a2de97eb1f6d12b12848965",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},e("img",{key:"a13174c473a0dc9ed9bd9473e37246f891e9cae0",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),e("button",{key:"07dc546a7954bd9410d817b429dc245bb54fe50d",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},e("img",{key:"de81815c636c37a6509b04e629c433d2b8c5e55b",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),e("button",{key:"11deba37930ab320b8c20da92b5b1abd5de407ee",type:"button",class:"action",onClick:()=>this.open_mkdir(),title:"New folder","aria-label":"New folder"},e("svg",{key:"5354cbb7a1a391c89616d4a0d257c4466ef3b860",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"},e("path",{key:"9547220371703834e0ed2a90ac391183c6c13a48",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"}),e("line",{key:"ee583af7f725b2dc7d8a35b051dd602f8ddd4105",x1:"12",x2:"12",y1:"10",y2:"16"}),e("line",{key:"f9aa4e2038d64a58e9a2ff5ccf3bfc03b6d048f3",x1:"9",x2:"15",y1:"13",y2:"13"}))),this.fetch_enabled()&&e(w,{key:"093626170ba4326e0ae5f4b16e043a18534fd110",count:this.fetch_count,onClick:()=>{this.downloaderEl?.openFetch(this.current_dir)}}),e("button",{key:"40dca240acdfa6c4c3e6afc3813440a5ef098c70",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},e("img",{key:"35ff0f2a46f15850e3e5fdd4cae2b6a539711cc3",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),e("button",{key:"4d4d80c880618cb4af35cdab7afd6372f69c6d55",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),e("input",{key:"cfcf588e1f5ae8b1bf860bfcb661e3dc2b8a26c7",type:"file",ref:e=>this.uploadInputEl=e,onChange:e=>this.on_upload_selected(e),style:{display:"none"}}),this.show_content&&e("div",{key:"55d94cb9a1b0e602294935f7fa09e981b8dbd6dd",class:"content",tabindex:0,onKeyDown:e=>this.on_listing_keydown(e)},e("table",{key:"4bfc73c7db0c0eb2da44365fc911a9d03b1b5819"},e("thead",{key:"df798e9fc8156b5bde598150d51c097085c3bd81"},e("tr",{key:"932c08d84c66323158f03e7b17b59b8ea0d9a7d0"},e("th",{key:"c6ff81a180383fd784b33616cbe52ce3124e446a",class:"sortable",onClick:()=>this.toggle_sort("name"),title:"Sort by name"},"Name",this.sort_indicator("name")),e("th",{key:"652645c923b13094b5149b975140f664d8a2f39c",class:"sortable",onClick:()=>this.toggle_sort("size"),title:"Sort by size"},"Size",this.sort_indicator("size")),e("th",{key:"452672f41f731bca3f0ecc2f15d730d8bb9ae408"},"Permissions"),e("th",{key:"8792a16415236c42d1d85ee71d45eb2b8bdfe71a"},"Owner"),e("th",{key:"697619d7691aebff7f58c3845d07bb14adec66ab",class:"sortable",onClick:()=>this.toggle_sort("modified"),title:"Sort by modified date"},"Modified",this.sort_indicator("modified")),e("th",{key:"332072e87b227e6b274ec728db080c2a44fe7b82",class:"action-col","aria-label":"Actions"}))),e("tbody",{key:"5bfa829bf47f0696b3aac2c67cc445a77deb31fc"},this.visible_listing().map(((t,i)=>e("tr",{key:i,class:{selected:this.is_selected(t),part:"File"===t.kind&&u(t.name),fresh:"File"===t.kind&&this.fresh_names.includes(t.name)},onClick:()=>this.list_directory(t),onContextMenu:e=>{this.on_row_context_menu(t,e)}},e("td",null,e("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"}),e("span",{class:"name "+t.kind.toLowerCase()},t.name)),e("td",null,"Folder"===t.kind?"-":this.format_size(t.attributes.size)),e("td",null,this.format_permissions(t.attributes.permissions,t.kind)),e("td",null,t.attributes.user??"-"),e("td",null,new Date(1e3*t.attributes.modified).toLocaleString()),e("td",{class:"action-col"},e("div",{class:"file-actions"},"File"===t.kind&&function(e){return y.test(e)&&!u(e)}(t.name)&&this.listing_can_play()&&e("button",{type:"button",class:"file-action",onClick:e=>{this.play_listing_file(t,e)},title:"Play","aria-label":"Play "+t.name},e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},e("path",{d:"M7 5v14l12-7z"}))),"File"===t.kind&&e("button",{type:"button",class:"file-action",onClick:e=>this.on_edit_action(t,e),title:"Edit","aria-label":"Edit "+t.name},e("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"},e("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z"}))),"File"===t.kind&&e("button",{type:"button",class:"file-action",onClick:e=>this.on_file_row_action(t,e),title:"Download","aria-label":"Download "+t.name},e("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"},e("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e("polyline",{points:"7 10 12 15 17 10"}),e("line",{x1:"12",x2:"12",y1:"15",y2:"3"}))),e("button",{type:"button",class:"file-action",onClick:e=>this.on_rename_action(t,e),title:"Rename","aria-label":"Rename "+t.name},e("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"},e("path",{d:"M12 20h9"}),e("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"}))),e("button",{type:"button",class:"file-action",onClick:e=>this.on_chmod_action(t,e),title:"Permissions","aria-label":"Change permissions on "+t.name},e("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"},e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))),e("button",{type:"button",class:"file-action delete",onClick:e=>this.on_file_delete_action(t,e),title:"Delete","aria-label":"Delete "+t.name},e("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"},e("polyline",{points:"3 6 5 6 21 6"}),e("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),e("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e("line",{x1:"14",x2:"14",y1:"11",y2:"17"})))))))),0===this.visible_listing().length&&e("tr",{key:"4482356f0cea6d59c08b94aa907118c0cd246d7a",class:"empty"},e("td",{key:"c5caefb25d955bc7978a743d395bcf825518e6f2",colSpan:6},this.filter?`Nothing here matches "${this.filter}".`:"This directory is empty."))))),this.show_loader&&e("div",{key:"fbee827272c265491cda4cf0ee551d050c28eb26",class:"loader"},"Loading..."),this.show_error&&e("div",{key:"c48be0f9bf98efae82848863ba67aab7cbe94cfa",class:"error"},this.error_message)),this.fetch_enabled()&&e("phirepass-downloader",{key:"299ca33e978ac5267a78fd554fa4cc368416ab72",ref:e=>this.downloaderEl=e,compact:!0,channel:this.channel,connected:this.channel_ready,nodeId:this.nodeId,browsingService:this.serviceId,browsingPath:this.current_dir,streamBase:this.stream_base(),onPhirepassActiveCount:e=>this.fetch_count=e.detail.n,onPhirepassFetchCompleted:e=>this.on_fetch_completed(e.detail),onPhirepassShowInFolder:e=>this.on_show_in_folder(e.detail)}),e("footer",{key:"51483dfe57fe920139a94bac637a21d9387f93bd"},e("section",{key:"4800e113635d349fb7223ba5d84c10036106471e",class:"status"},this.status,this.selected_item&&e("span",{key:"c8a2189794096852b1bf59903fcb9e4225420af3",class:"selected-item"},this.selected_item.name)),e("section",{key:"0003dd6457a61bb70f1f2beb1fe09902a9a7d9a6",class:"version"},this.version?"Version: "+this.version:""))),this.show_login_screen&&e("section",{key:"cd32e7b1357f1edfefa6f6cdef6bb1b8d3293ffd",class:{creds:!0,blurred:this.show_login_screen}},e("form",{key:"cde44856f2fb11347aadd9eedf2774383ac88818",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()}},e("div",{key:"a030e1ff396252b7aa5b9a1384ecfbb035018d81",class:"title"},"SFTP Connection"),this.show_login_screen_username&&e("div",{key:"6cec65370e2254527939d83c4214f57747eb4437"},e("label",{key:"21e7fd85d58893e44ec025896f1a4da007b33869",htmlFor:"username"},"Username"),e("input",{key:"5e3e039e5d543b1507095f1020f713c8174d73ca",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"username",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&e("div",{key:"6ea710ff7ac77e4ac015083ee44eaa5bd9f18fb2"},e("label",{key:"096fa5ca5f41ecf6de193016011f159ca3e742be",htmlFor:"password"},"Password"),e("input",{key:"b6edc254626bcdf8266c2870436d2f14f3d2dd08",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"password",name:"password",type:"password",placeholder:""})),e("div",{key:"5c0cb7f8e6e4d5277c6b026f0e47c43ec01d2739"},e("button",{key:"8b9e95c1bfda24bcdf40e9b27c80b037d30d9f94",type:"submit"},"Connect")))),this.show_upload_modal&&e("section",{key:"268de116ac02bf628d5d04b8ce0d8a844ff9c77f",class:{"upload-modal":!0,visible:this.show_upload_modal}},e("div",{key:"53e6ff8ba3a404f3575efda6fe228a11272f3799",class:"upload-dialog",role:"dialog","aria-modal":"true","aria-label":"Upload progress"},e("div",{key:"a543b63fbd0ffb0e3e2cca0e3feca09c6be19214",class:"title"},"Uploading File"),e("div",{key:"465d349e6cc1b59cb4d63222354beb83ee9b5242",class:"file-name",title:this.upload_file_name},this.upload_file_name),e("div",{key:"e809cdb7c3d0a94d49b410508582b5db0767665b",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.upload_progress},e("div",{key:"5a5bc88e8287b02b937969add54daf117d8d96a4",class:"progress-fill",style:{width:this.upload_progress+"%"}})),e("div",{key:"251e8fef171cba5912d15cbbbf93f4297527fc44",class:"progress-meta"},e("div",{key:"d8fc5f31ca6012500b413c8f8c769b2f9235cf03",class:"progress-speed"},this.upload_speed),e("div",{key:"c2c6da0c0435eb2391980c3c15029ae80e0cf09c",class:"progress-value"},this.format_percent(this.upload_progress))),e("button",{key:"3040b677c47f5d042744d9e42c3d906ea01aa28b",type:"button",class:{cancel:!0,finished:this.upload_finished},onClick:()=>this.cancel_upload()},this.upload_finished?"Close":"Cancel"))),this.show_download_modal&&e("section",{key:"9be248d46c503fca474d410beb3b5f0224fa8f01",class:{"download-modal":!0,visible:this.show_download_modal}},e("div",{key:"494342f0e61d6ecf3bdf59613234337fa03b1060",class:"download-dialog",role:"dialog","aria-modal":"true","aria-label":"Download progress"},e("div",{key:"70bf1682654a6f8992fad36efc6f674e9b0aa652",class:"title"},"Downloading File"),e("div",{key:"2d595a897f62fb305f235394a272c4e79c2cbc5a",class:"file-name",title:this.download_file_name},this.download_file_name),e("div",{key:"4876918db59b29347b53fa95598e0600e4a608e4",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.download_progress},e("div",{key:"19b49f11524f024a38c56a541d87683fbd381f2a",class:"progress-fill",style:{width:this.download_progress+"%"}})),e("div",{key:"b14e6df3c52fe9a39d3d41bc50414eea10898ec6",class:"progress-meta"},e("div",{key:"b1510407a47fc2546074b8bda19165b8ab869616",class:"progress-speed"},this.download_speed),e("div",{key:"aecf960be679c4943d3089cc1f0d3545f4cc8ce2",class:"progress-value"},this.format_percent(this.download_progress))),e("button",{key:"67b9c16ec6dbbcfabd7dd9601bef2e99a8e79387",type:"button",class:{cancel:!0,finished:this.download_finished},onClick:()=>this.cancel_download()},this.download_finished?"Close":"Cancel"))),this.show_delete_modal&&e("section",{key:"d59cef90ed1172a230e6d7698dec6426f99d9884",class:{"delete-modal":!0,visible:this.show_delete_modal}},e("div",{key:"660767440e69e1f26e62ae425cf447fcb323e01c",class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"Delete confirmation",tabindex:-1,onKeyDown:e=>this.on_modal_keydown(e,(()=>this.cancel_delete()))},e("div",{key:"93d4a9afbe2c792244d83d5d44c12daa81da29a5",class:"title"},this.delete_is_dir?"Delete Folder":"Delete File"),e("div",{key:"04a74d9f586d6c12c71295412caf76ca9001f964",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"}?`),e("div",{key:"e210a51de468e7e86ef78948f110042aff124014",class:"file-name",title:this.delete_file_name},this.delete_file_name),this.delete_is_dir&&e("label",{key:"ebe09093a817c7cee09bafc5a390eedbb6894a7d",class:"checkline"},e("input",{key:"57941f4851616517593934289a6289c28140c464",type:"checkbox",checked:this.delete_recursive,disabled:this.delete_loading,onChange:e=>this.delete_recursive=e.target.checked}),e("span",{key:"7ffce1f1c5c9b10808e571664f327a7f02d14dee"},"Delete everything inside it too")),!this.delete_is_dir||this.delete_recursive?null:e("div",{class:"hint"},"Without this, the remote refuses a folder that is not empty."),this.delete_error&&e("div",{key:"885f914bc1bd1a5a878d77501106ac33c67be1ab",class:"dialog-error"},this.delete_error),this.delete_loading&&e("div",{key:"64aa48b84fabf80d19a394c632e2f7fadf803080",class:"delete-loader","aria-hidden":"true"},e("span",{key:"a38b4b5e4825c18208872a74092905d716049c9a",class:"spinner"})),e("div",{key:"30edaa0fbdcf408de35e456ee23c50acf221120d",class:"modal-actions"},e("button",{key:"47e03980bc5189b3a08ded71cbd994241119b415",type:"button",class:"btn secondary",onClick:()=>this.cancel_delete(),disabled:this.delete_loading},"Cancel"),e("button",{key:"613d80e7607f365ac74bb878cadd2beb54161aec",type:"button",class:"btn destructive",onClick:()=>this.confirm_delete(),disabled:this.delete_loading},this.delete_loading?"Deleting...":"Delete")))),this.prompt_kind&&e("section",{key:"301de6586f5ef4df8690c589a175c27c5583c3c5",class:"prompt-modal visible"},e("div",{key:"b9b8d962d727a7634e9191ebb5c63d796a216c53",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()))},e("div",{key:"10cb310b35b4dead8d6550fb34ccb832a65fd1b2",class:"title"},"mkdir"===this.prompt_kind?"New Folder":"Rename"),e("div",{key:"e05a7a4a0a35b5be2845834eb55870842c0d17ef",class:"message"},"mkdir"===this.prompt_kind?"Create a folder in "+this.current_dir:"Give it a new name. Existing names are not overwritten."),e("form",{key:"79a3d81f678b8ccd52580e0eb972f539cbe9f30f",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),this.submit_prompt()}},e("input",{key:"9d250a5956fc6e7698490d522648fd20cf4414c7",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&&e("div",{key:"b17730b911abb499a63a993d0c3639f118590c0c",class:"dialog-error"},this.prompt_error),e("div",{key:"bbb9cede972be9ec6ec24ec2d346559a7f3351ab",class:"modal-actions"},e("button",{key:"e5e9f0b04d8cfaa0a1b4403594b50050e09fb303",type:"button",class:"btn secondary",onClick:()=>this.close_prompt(),disabled:this.prompt_busy},"Cancel"),e("button",{key:"5e5bedb0ff6b13fbf83149915863069a2d546fa8",type:"submit",class:"btn primary",disabled:this.prompt_busy},this.prompt_busy?"Working...":"mkdir"===this.prompt_kind?"Create":"Rename"))))),this.chmod_target&&e("section",{key:"5d99487be165e07de0e8b1ad614eeae7bcbc7872",class:"prompt-modal visible"},e("div",{key:"695afa14bb481bfa2577b30e6152f586360d833e",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"Change permissions",tabindex:-1,onKeyDown:e=>this.on_modal_keydown(e,(()=>this.close_chmod()))},e("div",{key:"8738d7ba896ecb2a752965cc9b1d698165598299",class:"title"},"Permissions"),e("div",{key:"649ec7e7db8046156b43e1b0d6e8d50e07e02e4f",class:"file-name",title:this.chmod_target.name},this.chmod_target.name),e("table",{key:"3f97d70594c54e602e297ab71b6d399598696498",class:"perm-grid"},e("thead",{key:"0fe7ef70c02cbac2d4ee5e746e8066245071b24d"},e("tr",{key:"af2285e351eb0228180be0bd5d7131f8e5b66cd1"},e("th",{key:"abe22f0637551c96ebf4e0a9482c50e788510b6b","aria-label":"Class"}),e("th",{key:"35a0a3f0ad80dae8028da7696d19d8d930a05e1c"},"Read"),e("th",{key:"f67ac96284ee4fd3b275cdbcee361cc6cd46ab07"},"Write"),e("th",{key:"ecab3e2a37deb94ea2fb3b922d39d46220fef1e0"},"Execute"))),e("tbody",{key:"c24e7f92cc2a95dd633858510aca3b2cdd56861b"},[{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=>e("tr",{key:t.label},e("th",{scope:"row"},t.label),[t.read,t.write,t.exec].map((i=>e("td",{key:i},e("input",{type:"checkbox","aria-label":`${t.label} ${i}`,disabled:this.chmod_busy,checked:!!(this.chmod_mode&i),onChange:()=>this.toggle_chmod_bit(i)}))))))))),e("div",{key:"8b6520714e3f16a484e798f3e8e435a4a2cdf623",class:"perm-special"},[{label:"setuid",bit:2048},{label:"setgid",bit:1024},{label:"sticky",bit:512}].map((t=>e("label",{key:t.label,class:"checkline"},e("input",{type:"checkbox",disabled:this.chmod_busy,checked:!!(this.chmod_mode&t.bit),onChange:()=>this.toggle_chmod_bit(t.bit)}),e("span",null,t.label))))),e("div",{key:"205f0ece8a0d8ea7668e367bdc9db898fb5246bc",class:"perm-octal"},e("label",{key:"98fb6673ef8d84b3be12bf88996ff8365a20de2e",htmlFor:"chmod-octal"},"Octal"),e("input",{key:"608666086fdac97e33b6f58b8eed6ebf173b44d7",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)}),e("span",{key:"84a6afb198c0a3078ff16fe0c1fc3c3546cc2f20",class:"perm-preview"},this.format_permissions(this.chmod_mode,this.chmod_target.kind))),this.chmod_error&&e("div",{key:"079368ae29a0acc2690b9b5648d035001fbb6a9f",class:"dialog-error"},this.chmod_error),e("div",{key:"cda31e7896518dfcaad7697e2e72e476d3821605",class:"modal-actions"},e("button",{key:"b904a28a3dad29ee03ea6c24036a2ff91d04da6a",type:"button",class:"btn secondary",onClick:()=>this.close_chmod(),disabled:this.chmod_busy},"Cancel"),e("button",{key:"bd7bd7c11a73d7cc1cec1405c0693f898a7b493a",type:"button",class:"btn primary",onClick:()=>{this.submit_chmod()},disabled:this.chmod_busy},this.chmod_busy?"Applying...":"Apply")))),this.show_editor&&e("section",{key:"7a195dda87e6b87ce2dfb52f87c8627e9ea6e5a7",class:"editor-modal visible"},e("div",{key:"caabc3db3d6311f34ff42be97e469ffa64e55ed5",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()))}},e("div",{key:"b5b5cffca1d0c586a9d99aa1abd95930403970cb",class:"editor-head"},e("div",{key:"3c957b920459ff3e7593ce1ac3a33096e6792063",class:"title"},this.editor_name,this.editor_is_dirty()?" *":""),e("button",{key:"d397267be9355ac675bd4503628992396e83785c",type:"button",class:"editor-close",onClick:()=>this.close_editor(),"aria-label":"Close editor",disabled:"saving"===this.editor_busy},"x")),"loading"===this.editor_busy?e("div",{class:"editor-loading"},"Loading..."):e("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&&e("div",{key:"9725a5c01bed575c4e6e047709239f629b753ee6",class:"dialog-error"},this.editor_error),this.editor_confirm_discard&&e("div",{key:"8f57947f27b8d98a4976f72308da77ad0bc0dd81",class:"dialog-error"},"Unsaved changes. Close anyway?"),e("div",{key:"699edc1344ea9f3eb8da85062f9b790bcb137a17",class:"modal-actions"},this.editor_confirm_discard?e("button",{type:"button",class:"btn destructive",onClick:()=>this.close_editor(!0)},"Discard"):e("button",{type:"button",class:"btn secondary",onClick:()=>this.close_editor(),disabled:"saving"===this.editor_busy},"Close"),e("button",{key:"98b5856690b7cfc00a8ea992ffd87ee2229a7384",type:"button",class:"btn primary",onClick:()=>{this.save_editor()},disabled:!!this.editor_busy||!this.editor_is_dirty()},"saving"===this.editor_busy?"Saving...":"Save")))),this.part_delete&&e(k,{key:"b6d85a1c323044094236f9d353c0967e37ba8a2b",name:this.part_delete.name,busy:this.part_delete.busy,onCancel:()=>this.part_delete=null,onConfirm:()=>{const e=this.part_delete;this.part_delete={...e,busy:!0},this.downloaderEl?.deleteDownload(e.download_id).finally((()=>{this.part_delete=null,this.refresh_directory()}))}}),this.torrent_menu&&e(I,{key:"ecffff22fef17b34aaaa86279a6a117ad56ff091",menu:this.torrent_menu,onClose:()=>this.torrent_menu=null,onFetch:()=>{const e=this.torrent_menu.path;this.torrent_menu=null,this.downloaderEl?.startTorrentPath(e)},onDownload:()=>{const e=this.selected_item;this.torrent_menu=null,e&&this.start_download(e)},onRename:()=>{const e=this.selected_item;this.torrent_menu=null,e&&this.on_rename_action(e,new window.Event("click"))},onDelete:()=>{const e=this.selected_item;this.torrent_menu=null,e&&this.on_file_delete_action(e,new window.Event("click"))}}),this.listing_player&&e("section",{key:"2a14b61054682ce21422d953c3997912331079ae",class:"player-modal visible"},e("phirepass-media-player",{key:"aa5dc1638310f59ec127dc915faa12e66784a7f5",src:this.listing_player.src,name:this.listing_player.name,status:"On the node",positionKey:this.listing_player.key,onPhirepassPlayerClose:()=>this.listing_player=null})))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}static get style(){return":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}}:host .listing main .navigation .action.fetch{position:relative;display:inline-grid;place-items:center;color:hsl(var(--primary))}:host .listing main .navigation .action.fetch .badge{position:absolute;top:-5px;right:-6px;min-width:15px;height:15px;padding:0 4px;border-radius:8px;background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-size:9px;font-weight:700;line-height:15px;text-align:center}:host .listing main .content table tbody tr.part td{color:hsl(var(--muted-foreground));font-style:italic}:host .listing main .content table tbody tr.fresh{background-color:hsl(var(--primary) / 0.1)}:host .listing main .content table tbody tr.fresh .name::after{content:'new';margin-left:8px;font-size:10px;padding:1px 6px;border-radius:3px;background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600;font-style:normal}:host .delete-dialog .file-name.inline{display:inline;padding:0;border:0;background:none}:host .context-backdrop{position:absolute;inset:0;z-index:8}:host .context-menu{position:absolute;min-width:220px;max-width:calc(100% - 16px);padding:4px;background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:6px;box-shadow:0 12px 30px -10px rgba(0, 0, 0, 0.7);display:flex;flex-direction:column;font-size:12px;button{display:flex;align-items:center;gap:8px;text-align:left;padding:6px 10px;border:0;border-radius:4px;background:transparent;color:rgb(189, 219, 209);font:inherit;cursor:pointer;&:hover,&:focus-visible{background:hsl(var(--muted));outline:none}&.primary{color:hsl(var(--primary))}&.danger{color:hsl(var(--destructive))}}hr{border:0;border-top:1px solid hsl(var(--border));margin:4px 0}}:host .player-modal{position:absolute;inset:0;z-index:7;display:grid;place-items:center;padding:10px;background:rgba(5, 7, 9, 0.6);phirepass-media-player{width:min(100%, 880px)}}"}},[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"],channelFactory:[16],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],channel_ready:[32],fetch_count:[32],fresh_names:[32],part_delete:[32],torrent_menu:[32],listing_player:[32],maximize:[64],minimize:[64]},void 0,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]);function C(){"undefined"!=typeof customElements&&["phirepass-sftp-client","phirepass-downloader","phirepass-media-player"].forEach((e=>{switch(e){case"phirepass-sftp-client":customElements.get(t(e))||customElements.define(t(e),_);break;case"phirepass-downloader":customElements.get(t(e))||h();break;case"phirepass-media-player":customElements.get(t(e))||f()}}))}C();const M=_,D=C;export{M as PhirepassSftpClient,D as defineCustomElement}
|
|
1
|
+
import{h as t,t as e,p as i,H as s,c as a,a as o}from"./index.js";import{_ as r,E as n,C as d,a as l,P as c}from"./p-BtMWUitf.js";import{d as h,s as b,i as p,D as m}from"./p-DqT-qhTU.js";import{I as g,d as f}from"./p-DIf-Ru26.js";function u(t){return t.endsWith(".phirepass-part")}const y=/\.(mp4|m4v|webm|mkv|mov|mp3|m4a|flac|ogg|oga|opus|wav)$/i;function v(t){const e=t.replace(/\/{2,}/g,"/");return e.length>1?e.replace(/\/+$/,""):e}function x(t,e){return v(t)===v(e)}const w=({count:e,onClick:i})=>t("button",{type:"button",class:"action fetch",onClick:i,title:"Fetch from a link, magnet or torrent","aria-label":"Fetch from a link, magnet or torrent"},t(g,{name:"fetch",size:14}),e>0&&t("span",{class:"badge","aria-label":e+" active"},e)),k=({name:e,busy:i,onCancel:s,onConfirm:a})=>t("section",{class:"delete-modal visible"},t("div",{class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"This file is still downloading",tabindex:-1,onKeyDown:t=>{"Escape"===t.key&&s()}},t("div",{class:"title"},"This file is still downloading"),t("div",{class:"message"},"Deleting ",t("span",{class:"file-name inline"},e)," deletes its download."),t("div",{class:"modal-actions"},t("button",{type:"button",class:"btn secondary",onClick:s,disabled:i},"Keep it"),t("button",{type:"button",class:"btn destructive",onClick:a,disabled:i},"Delete download")))),I=({menu:e,onFetch:i,onDownload:s,onRename:a,onDelete:o,onClose:r})=>t("div",{class:"context-backdrop",onClick:r,onContextMenu:t=>(t.preventDefault(),r())},t("div",{class:"context-menu",role:"menu","aria-label":"Actions for "+e.name,style:{left:e.x+"px",top:e.y+"px"},onClick:t=>t.stopPropagation()},t("button",{type:"button",role:"menuitem",class:"primary",onClick:i},t(g,{name:"fetch",size:13})," Download torrent contents here"),t("hr",null),t("button",{type:"button",role:"menuitem",onClick:s},"Download"),t("button",{type:"button",role:"menuitem",onClick:a},"Rename"),t("button",{type:"button",role:"menuitem",class:"danger",onClick:o},"Delete"))),_=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.maximizeEvent=a(this,"maximize"),this.connectionStateChanged=a(this,"connectionStateChanged")}get el_host(){return this}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;channelFactory;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;channel_ready=!1;fetch_count=0;fresh_names=[];part_delete=null;torrent_menu=null;listing_player=null;downloaderEl;fetch_enabled(){return b(this.channel)}stream_base(){return`${this.allowInsecure?"http":"https"}://${this.serverHost}${!this.allowInsecure&&443===this.serverPort||this.allowInsecure&&80===this.serverPort?"":":"+this.serverPort}`}on_fetch_completed(t){x(function(t){return v(t.sub_dir?`${t.dest_root}/${t.sub_dir}`:t.dest_root)}(t),this.current_dir)&&(this.fresh_names=[...this.fresh_names.filter((e=>e!==t.name)),t.name],this.refresh_directory())}on_show_in_folder(t){this.fresh_names=[t.name],x(t.path,this.current_dir)||this.list_breadcrumb(t.path)}async on_row_context_menu(t,e){if("File"!==t.kind||!/\.torrent$/i.test(t.name)||!this.downloaderEl)return;const i=this.item_path(t);if(e.preventDefault(),null===await this.downloaderEl.torrentPathFor(i))return;const s=this.el_host.getBoundingClientRect();this.selected_item=t,this.torrent_menu={x:e.clientX-s.left,y:e.clientY-s.top,path:i,name:t.name}}async play_listing_file(t,e){e.preventDefault(),e.stopPropagation();const i=this.channel;if("function"!=typeof i.send_sftp_open_stream)return;const s=this.item_path(t);try{const e=await this.run_op("play",(t=>i.send_sftp_open_stream(this.nodeId,this.session_id,s,t)));if("Stream"!==e.result||!e.token)throw Error("The node did not open a stream.");this.listing_player={src:`${this.stream_base()}/api/web/stream/${encodeURIComponent(this.nodeId)}/t/${encodeURIComponent(e.token)}`,name:t.name,key:`node:${this.nodeId}:${s}`}}catch(t){this.error_message=this.error_text(t),this.show_error=!0}}listing_can_play(){return"function"==typeof this.channel?.send_sftp_open_stream}toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){this.channelFactory||await r(),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(Error("Upload start aborted"))})),this.pendingUploadStarts.clear(),this.pendingUploadAcks.forEach((t=>{window.clearTimeout(t.timeout),t.reject(Error("Upload chunk aborted"))})),this.pendingUploadAcks.clear(),this.pendingDownloadStarts.forEach((t=>{window.clearTimeout(t.timeout),t.reject(Error("Download start aborted"))})),this.pendingDownloadStarts.clear(),this.pendingOps.forEach((t=>{window.clearTimeout(t.timeout),t.reject(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);return e<60?`${e}m ${Math.floor(t%60)}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 s=(performance.now()-i)/1e3,a=s>0?t/s:0;this.upload_speed=this.format_transfer_rate(a);const o=a>0?(e-t)/a: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 s=(Date.now()-i)/1e3,a=s>0?t/s:0;this.download_speed=this.format_transfer_rate(a);const o=a>0?(e-t)/a: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(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(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 s=this.pendingOps.get(t.msg_id);if(s)return window.clearTimeout(s.timeout),this.pendingOps.delete(t.msg_id),s.reject(Error(t.message||`Could not ${s.verb}.`)),void(this.show_loader=!1)}switch(t.kind){case n.Generic:case n.Authentication:this.error_message=t.message||"An unknown error occurred.",this.show_error=!0;break;case n.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case n.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case n.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",this.channel_ready=!0}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=""),t.path!==this.current_dir&&(this.fresh_names=[]),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))),s=new Blob(i,{type:"application/octet-stream"}),a=URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),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 s=Array.from(e.chunks.values()).reduce(((t,e)=>t+e.length),0);this.update_download_progress(s,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 s=window.setTimeout((()=>{this.pendingDownloadStarts.delete(e),i(Error("Download start timeout"))}),1e4);this.pendingDownloadStarts.set(e,{timeout:s,resolve:t,reject:i})}));try{this.channel.send_sftp_download_start(this.nodeId,this.session_id,t.path,t.name,e);const{download_id:s,total_chunks:a,total_size:o}=await i,r=this.activeDownloads.get(e);if(!r)return;r.download_id=s,r.total_chunks=a,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,s=Math.max(1,Math.ceil(t.size/i)),a=this.next_msg_id(),o=new Promise(((t,e)=>{const i=window.setTimeout((()=>{this.pendingUploadStarts.delete(a),e(Error("Upload start timeout"))}),1e4);this.pendingUploadStarts.set(a,{timeout:i,resolve:t,reject:e})}));try{this.channel.send_sftp_upload_start(this.nodeId,this.session_id,t.name,this.current_dir,s,BigInt(t.size),a);const r=await o;let n=0;const d=performance.now();for(let a=0;a<s;a+=1){if(e!==this.activeUploadToken)throw Error("Upload cancelled");const s=a*i,o=Math.min(s+i,t.size),l=new Uint8Array(await t.slice(s,o).arrayBuffer());await new Promise(((t,e)=>{const i=`${r}_${a}`,s=window.setTimeout((()=>{this.pendingUploadAcks.delete(i),e(Error(`Upload chunk ${a+1} timed out`))}),3e4);this.pendingUploadAcks.set(i,{timeout:s,resolve:t,reject:e}),this.channel.send_sftp_upload_chunk(this.nodeId,this.session_id,r,a,l.length,l,null)})),n+=l.length,this.update_upload_progress(n,t.size,d)}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(Error("No active SFTP session."));const s=this.next_msg_id();return new Promise(((a,o)=>{const r=window.setTimeout((()=>{this.pendingOps.delete(s),o(Error(`Timed out trying to ${t}. This node's agent may be too old to support it.`))}),i);this.pendingOps.set(s,{verb:t,timeout:r,resolve:a,reject:o});try{e(s)}catch(t){window.clearTimeout(r),this.pendingOps.delete(s),o(t instanceof Error?t:Error(t+""))}}))}error_text(t){return t instanceof Error?t.message: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(){const t=this.create_web_socket_endpoint()+"/api/web/ws";this.channel=this.channelFactory?this.channelFactory(t,this.nodeId,this.serverId||void 0):this.serverId?new d(t,this.nodeId,this.serverId):new d(t,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([l.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([l.Disconnected]),this.status="Disconnected",this.channel_ready=!1})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([l.Error,t]),this.status="Error "+t.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:e}=t.data;if(p(e)||e.type===c.Error&&(e.msg_id??0)>=m)this.downloaderEl?.receive(t);else switch(e.type){case c.Error:this.handle_error(e);break;case c.AuthSuccess:this.handle_auth_success(e);break;case c.TunnelOpened:this.handle_tunnel_opened(e);break;case c.TunnelClosed:this.handle_tunnel_closed(e);break;case c.TunnelData:this.handle_tunnel_data(e);break;case c.SFTPListItems:this.handle_sftp_list_items(e);break;case c.SFTPUploadStartResponse:this.handle_upload_start_response(e);break;case c.SFTPUploadChunkAck:this.handle_upload_chunk_ack(e);break;case c.SFTPDownloadStartResponse:this.handle_download_start_response(e);break;case c.SFTPDownloadChunk:this.handle_download_chunk(e);break;case c.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",this.channel_ready=!1,this.part_delete=null,this.torrent_menu=null,this.listing_player=null}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,"File"===t.kind&&u(t.name)&&this.downloaderEl?this.downloaderEl.jobForPath(this.item_path(t)).then((e=>{e?this.part_delete={download_id:e.download_id,name:t.name,busy:!1}:this.open_delete_prompt(t)})):this.open_delete_prompt(t)}open_delete_prompt(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 s=this.selected_item;if("rename"===t&&s&&e===s.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||!s)return this.prompt_busy=!1,void this.close_prompt();{const t=this.item_path(s),i=this.join_path(s.path,e);this.status=`Renaming ${s.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 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 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 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";let e=t,i=-1;for(;e>=1024&&i<4;)e/=1024,i+=1;return`${e.toFixed(e>=10?1:2)} ${["KB","MB","GB","TB","PB"][i]}`}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();return/^[bcdlps-][rwxStTs-]{9}$/.test(i)?i:/^[0-7]{3,4}$/.test(i)?this.format_permissions(parseInt(i,8),e):/^\d+$/.test(i)?this.format_permissions(parseInt(i,10),e):i||"-"}const i=t,s=this.mode_type_to_char(i,e),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 t(o,{key:"c8a576625404b5653c066c2844160c40cff71603",class:{default:!this.max,max:this.max}},t("section",{key:"87cc1357c8cba09dc857ac0035d701ee46f72ad3",class:"listing"},!this.hideHeader&&t("header",{key:"f034a4a4d6498c8f813174566ce7ff258f6d98fb"},t("section",{key:"ce24941dbd0beffe42d5fa6bad89542d25e57ff8",class:"title"},t("img",{key:"808e0b3f448e15ceb5a7daccce98f9314eb5b758",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),t("div",{key:"4b4e8244a97167010abc5ba2a518f9c7fd465b39",class:"text"},t("div",{key:"dc32511596fb480ef7fb280941b9de8099b5ff05",class:"name"},this.name),t("div",{key:"fc477ea5670b74c40f4af20022dac4f02bc8b96c",class:"description"},this.description))),t("section",{key:"35beb6cd84dea257e428cca3338db239eed37cdb",class:"actions"},t("div",{key:"7adecc9ecb0a24721fcf6e82f73b58d38946801e",class:"action",onClick:()=>this.toggle_max()},t("img",{key:"e63674064553d3809a1d563bbe6fc83ad0aceb80",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),t("main",{key:"4bef9055a683d18e391c2620ba2351282a1165ca"},this.show_navigation&&t("nav",{key:"e08ac22ec258e081195785661907d170b86bd83d",class:"navigation"},t("div",{key:"026e32148d4062a7e6be2b58192676dc0102e2dd",class:"breadcrumbs"},this.breadcrumbs.map(((e,i,s)=>t("span",{key:i,class:"breadcrumb-container"},t("span",{key:i,onClick:()=>this.list_breadcrumb(e.path),class:"breadcrumb"},e.label),i<s.length-1&&t("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),t("section",{key:"04f0111d530f2cb9a64bb0557b72820bd13832bf",class:"actions","aria-label":"SFTP actions"},t("input",{key:"fb28f1861a4dd9c83aaa4a20a5d25dde3e6337c7",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}),t("button",{key:"5e173f8426eee17b08b05547e9ba033746a5a84a",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},t("img",{key:"64ed13f7093abc57f9b73638b902b160d11c1fd3",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),t("button",{key:"e6a7d97bc089f3b023d06213852aec8e5cd83d18",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},t("img",{key:"66590858743453d7fc0fbb578e98da2a8bc762d5",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),t("button",{key:"8eca55beb0377394da8fae85546b25ee74c0f6f9",type:"button",class:"action",onClick:()=>this.open_mkdir(),title:"New folder","aria-label":"New folder"},t("svg",{key:"12d1fc50a9e325a1214462f2a06d734ab38ff1c1",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"},t("path",{key:"7148c12cc461d1778ccfb3e3129786655f780dc2",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"}),t("line",{key:"a5701765411cff983baa1c4248a383c3a3a9dca6",x1:"12",x2:"12",y1:"10",y2:"16"}),t("line",{key:"9c22835c4279619e8c8cd130007d07ed19795366",x1:"9",x2:"15",y1:"13",y2:"13"}))),this.fetch_enabled()&&t(w,{key:"259d3c2e7bdadac5d1ed77724628459e6c440e09",count:this.fetch_count,onClick:()=>{this.downloaderEl?.openFetch(this.current_dir)}}),t("button",{key:"f744681697e23f2f2892a01b625490fc66999592",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},t("img",{key:"bcb2e3f7c283f4213b0a27cb97afd3e61f8d954e",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),t("button",{key:"5348bc25576e559e7b2f05ec6378fe72fc8483f5",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),t("input",{key:"7daf75741416f3aeb759ddc6c94106167291d641",type:"file",ref:t=>this.uploadInputEl=t,onChange:t=>this.on_upload_selected(t),style:{display:"none"}}),this.show_content&&t("div",{key:"e384c122d7454b16d13066a7cc6f7f3aa1414feb",class:"content",tabindex:0,onKeyDown:t=>this.on_listing_keydown(t)},t("table",{key:"bd1b14b317290eb59cb867a2bfbf23fb63b2fa94"},t("thead",{key:"c414438b0e8f2a776643bdaaf6441b01ed7c3be3"},t("tr",{key:"fd7d0947644aa0e0eb93d56dfacb8fe545c805f3"},t("th",{key:"8e62f0daaaad938db61b85586aeb138844877ebe",class:"sortable",onClick:()=>this.toggle_sort("name"),title:"Sort by name"},"Name",this.sort_indicator("name")),t("th",{key:"f2d3e287c8f0f97e23c173c10393d0eec4e4a752",class:"sortable",onClick:()=>this.toggle_sort("size"),title:"Sort by size"},"Size",this.sort_indicator("size")),t("th",{key:"d62906a8dd76c22cfcf2c7a82d37ffe8ac3582ba"},"Permissions"),t("th",{key:"d5ce78f188629f956704a70a8d2280a1db945666"},"Owner"),t("th",{key:"42d52536f0c5daa29af06c892c5ca3f79b888216",class:"sortable",onClick:()=>this.toggle_sort("modified"),title:"Sort by modified date"},"Modified",this.sort_indicator("modified")),t("th",{key:"4b80527286d771950be9219387fb938e92f07b63",class:"action-col","aria-label":"Actions"}))),t("tbody",{key:"1959c3f04257c8c1a2e93b4717a6eef9a7999437"},this.visible_listing().map(((e,i)=>t("tr",{key:i,class:{selected:this.is_selected(e),part:"File"===e.kind&&u(e.name),fresh:"File"===e.kind&&this.fresh_names.includes(e.name)},onClick:()=>this.list_directory(e),onContextMenu:t=>{this.on_row_context_menu(e,t)}},t("td",null,t("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"}),t("span",{class:"name "+e.kind.toLowerCase()},e.name)),t("td",null,"Folder"===e.kind?"-":this.format_size(e.attributes.size)),t("td",null,this.format_permissions(e.attributes.permissions,e.kind)),t("td",null,e.attributes.user??"-"),t("td",null,new Date(1e3*e.attributes.modified).toLocaleString()),t("td",{class:"action-col"},t("div",{class:"file-actions"},"File"===e.kind&&function(t){return y.test(t)&&!u(t)}(e.name)&&this.listing_can_play()&&t("button",{type:"button",class:"file-action",onClick:t=>{this.play_listing_file(e,t)},title:"Play","aria-label":"Play "+e.name},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},t("path",{d:"M7 5v14l12-7z"}))),"File"===e.kind&&t("button",{type:"button",class:"file-action",onClick:t=>this.on_edit_action(e,t),title:"Edit","aria-label":"Edit "+e.name},t("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"},t("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t("path",{d:"M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z"}))),"File"===e.kind&&t("button",{type:"button",class:"file-action",onClick:t=>this.on_file_row_action(e,t),title:"Download","aria-label":"Download "+e.name},t("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"},t("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t("polyline",{points:"7 10 12 15 17 10"}),t("line",{x1:"12",x2:"12",y1:"15",y2:"3"}))),t("button",{type:"button",class:"file-action",onClick:t=>this.on_rename_action(e,t),title:"Rename","aria-label":"Rename "+e.name},t("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"},t("path",{d:"M12 20h9"}),t("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"}))),t("button",{type:"button",class:"file-action",onClick:t=>this.on_chmod_action(e,t),title:"Permissions","aria-label":"Change permissions on "+e.name},t("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"},t("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))),t("button",{type:"button",class:"file-action delete",onClick:t=>this.on_file_delete_action(e,t),title:"Delete","aria-label":"Delete "+e.name},t("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"},t("polyline",{points:"3 6 5 6 21 6"}),t("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),t("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),t("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),t("line",{x1:"14",x2:"14",y1:"11",y2:"17"})))))))),0===this.visible_listing().length&&t("tr",{key:"94619eb9cf5506a57c6d085ac6b91d41b7770553",class:"empty"},t("td",{key:"87161e6091cf501364eda0d0b1072a937f8c9946",colSpan:6},this.filter?`Nothing here matches "${this.filter}".`:"This directory is empty."))))),this.show_loader&&t("div",{key:"db0f871976de1f36a72fa947441e0fb1f6051438",class:"loader"},"Loading..."),this.show_error&&t("div",{key:"8870f437cfe246be74479d98f0a0d5a2bc72f781",class:"error"},this.error_message)),this.fetch_enabled()&&t("phirepass-downloader",{key:"917af582cad03523807ef641710f85bd74bb317e",ref:t=>this.downloaderEl=t,compact:!0,channel:this.channel,connected:this.channel_ready,nodeId:this.nodeId,browsingService:this.serviceId,browsingPath:this.current_dir,streamBase:this.stream_base(),onPhirepassActiveCount:t=>this.fetch_count=t.detail.n,onPhirepassFetchCompleted:t=>this.on_fetch_completed(t.detail),onPhirepassShowInFolder:t=>this.on_show_in_folder(t.detail)}),t("footer",{key:"ff3c726b1762ca1789b1f3cd795613d9e64ec445"},t("section",{key:"47e1cbc5a79ee62355136341add2b67456d1a462",class:"status"},this.status,this.selected_item&&t("span",{key:"c828889045b7d0cca91ce0703a577f9a35a708e0",class:"selected-item"},this.selected_item.name)),t("section",{key:"9e16fe486979999adadd80483542709570a5992d",class:"version"},this.version?"Version: "+this.version:""))),this.show_login_screen&&t("section",{key:"4da9c7934d550538c3bd488c7ad455af30ff4e00",class:{creds:!0,blurred:this.show_login_screen}},t("form",{key:"576cc82e5cd90978039e1e644af04194485b86d6",class:"auth",onSubmit:t=>{const e=new FormData(t.target);let i,s;this.show_login_screen_username&&(i=e.get("username")),this.show_login_screen_password&&(s=e.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,t.stopPropagation(),t.preventDefault()}},t("div",{key:"27098f0a63b4ceddd4e0bf0d84b3b3f321a3f512",class:"title"},"SFTP Connection"),this.show_login_screen_username&&t("div",{key:"2714b5b014572d4f58523ddb79bde232bf9b65f1"},t("label",{key:"8f0c73f148cc08fc8db445cd99fbab060807fe12",htmlFor:"username"},"Username"),t("input",{key:"c64fd60eb284e8a77d0943380cb3fcbacbc333fa",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"username",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&t("div",{key:"2d84bbacefcb3b4ba84a9b8ce74bd662fa62c8b3"},t("label",{key:"0ce1b8309229d45ab0f54d5e2de1e40b3fab57f0",htmlFor:"password"},"Password"),t("input",{key:"5752cbe6e72c332be94c0b9a813a66526ab06f3c",autocorrect:"off",autocapitalize:"none",autoComplete:"off",id:"password",name:"password",type:"password",placeholder:""})),t("div",{key:"e272596a07a758d008a90a2c2290e589feeb8b3f"},t("button",{key:"5ddb365a8b700a8d5051539bed3c9aafef20a099",type:"submit"},"Connect")))),this.show_upload_modal&&t("section",{key:"b4314fc5bb3ace26757d690ff4113954144362f6",class:{"upload-modal":!0,visible:this.show_upload_modal}},t("div",{key:"8d152c11c9c27528b667199e6cd66e7129506be6",class:"upload-dialog",role:"dialog","aria-modal":"true","aria-label":"Upload progress"},t("div",{key:"703aa9f78b0248f026ae168d95db2aaaea65a6ce",class:"title"},"Uploading File"),t("div",{key:"8e9bceaea052b871b2b6700684384515260c864c",class:"file-name",title:this.upload_file_name},this.upload_file_name),t("div",{key:"0c3f7be58a562e339dea87904297d0407bddb289",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.upload_progress},t("div",{key:"e003866966bdae3af7e9321b288dd23424491a16",class:"progress-fill",style:{width:this.upload_progress+"%"}})),t("div",{key:"ac5e45111e0d694b09c4af709378e827288ad418",class:"progress-meta"},t("div",{key:"63e5c77d6af531e49fe9817167d945fc6e80e1be",class:"progress-speed"},this.upload_speed),t("div",{key:"369628aa1ba577c4a4a9fa13930985716830b993",class:"progress-value"},this.format_percent(this.upload_progress))),t("button",{key:"da4984bb0fc81d65a8f2876aa1aaba5dc8ea9da8",type:"button",class:{cancel:!0,finished:this.upload_finished},onClick:()=>this.cancel_upload()},this.upload_finished?"Close":"Cancel"))),this.show_download_modal&&t("section",{key:"88a14959b710af2dcced2fc37b7c404272571084",class:{"download-modal":!0,visible:this.show_download_modal}},t("div",{key:"86bbc1dd32612e7b63c4af35b366fe0a74597ed9",class:"download-dialog",role:"dialog","aria-modal":"true","aria-label":"Download progress"},t("div",{key:"8c3edb4fc04ffaecb3fbd5b6d1aeab4211d7876c",class:"title"},"Downloading File"),t("div",{key:"4815f43687f525c0b6f598e98f9df237a4253dd9",class:"file-name",title:this.download_file_name},this.download_file_name),t("div",{key:"095ac5ffbcb3f4a1bfe5742232752baffb93308e",class:"progress-track",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":this.download_progress},t("div",{key:"6a1f3d4ddbbda2c8a4069b59c7882ddcddee5b4d",class:"progress-fill",style:{width:this.download_progress+"%"}})),t("div",{key:"db52703f7105f26aa4234eb6b623524362ced064",class:"progress-meta"},t("div",{key:"a12b2578badf08fc272f3533db2fd93fa946a4b2",class:"progress-speed"},this.download_speed),t("div",{key:"3b2b1d92c4534d6f7adf01d64a1593af504f98d0",class:"progress-value"},this.format_percent(this.download_progress))),t("button",{key:"f9a668ef58d9566ebaf66ad9219d619005294a6f",type:"button",class:{cancel:!0,finished:this.download_finished},onClick:()=>this.cancel_download()},this.download_finished?"Close":"Cancel"))),this.show_delete_modal&&t("section",{key:"cbcf699a17d748a8a7fa3daf1d96f42e47847bd6",class:{"delete-modal":!0,visible:this.show_delete_modal}},t("div",{key:"3ac99ddba7dc86a7712a4cbb1516254a62f88ef4",class:"delete-dialog",role:"dialog","aria-modal":"true","aria-label":"Delete confirmation",tabindex:-1,onKeyDown:t=>this.on_modal_keydown(t,(()=>this.cancel_delete()))},t("div",{key:"5075e7e7fda69e6941980d3bb257b30bd61d1b03",class:"title"},this.delete_is_dir?"Delete Folder":"Delete File"),t("div",{key:"a9bc63a90afc0f56caccdda8c782abf761b06fa9",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"}?`),t("div",{key:"50a72830064fc1352787d6ac761a13e8c6d2d5ce",class:"file-name",title:this.delete_file_name},this.delete_file_name),this.delete_is_dir&&t("label",{key:"528ba9b17f186d54e98fa5abe26d649721880eab",class:"checkline"},t("input",{key:"33dc78531ac4833e95460b93de7d211979a7973b",type:"checkbox",checked:this.delete_recursive,disabled:this.delete_loading,onChange:t=>this.delete_recursive=t.target.checked}),t("span",{key:"68517a96007ba248bbcac1fffaae2b048c4aafaf"},"Delete everything inside it too")),!this.delete_is_dir||this.delete_recursive?null:t("div",{class:"hint"},"Without this, the remote refuses a folder that is not empty."),this.delete_error&&t("div",{key:"fb0df28a4daa756166deec9dd18c0acae8874202",class:"dialog-error"},this.delete_error),this.delete_loading&&t("div",{key:"114fcfea0367efd1f2df2d06beeba2013058ff73",class:"delete-loader","aria-hidden":"true"},t("span",{key:"2b07a71d733ba7606fa45f0d24548b2b63dcc798",class:"spinner"})),t("div",{key:"44cfc262272484fdbd41257c39457d42de6e1f29",class:"modal-actions"},t("button",{key:"5035eb462279fb4e89036a34b5b5b64eee052706",type:"button",class:"btn secondary",onClick:()=>this.cancel_delete(),disabled:this.delete_loading},"Cancel"),t("button",{key:"f16d9f97ce99691c0cfbbad16679bb1dc3affbc9",type:"button",class:"btn destructive",onClick:()=>this.confirm_delete(),disabled:this.delete_loading},this.delete_loading?"Deleting...":"Delete")))),this.prompt_kind&&t("section",{key:"8ee05b491fbc60b2fa9115fa7a88b60960e3326a",class:"prompt-modal visible"},t("div",{key:"46622ceafa285047e2df9082251d7a02e38cb49f",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()))},t("div",{key:"1dce2a864f58590017238fc76810297190dc223f",class:"title"},"mkdir"===this.prompt_kind?"New Folder":"Rename"),t("div",{key:"556e931df541d9ca07a58882cf658572c23276fe",class:"message"},"mkdir"===this.prompt_kind?"Create a folder in "+this.current_dir:"Give it a new name. Existing names are not overwritten."),t("form",{key:"b6a5807b0208576e15468912c48bcdc314cf2d41",onSubmit:t=>{t.preventDefault(),t.stopPropagation(),this.submit_prompt()}},t("input",{key:"d7ad180a2b431046905f37ee8ba21e6933f8eb09",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&&t("div",{key:"c0afc0bc34860b1c8bcfea5087d8afca425edf6a",class:"dialog-error"},this.prompt_error),t("div",{key:"91899e1d57a82434cc859e7d90636bd9f1df2545",class:"modal-actions"},t("button",{key:"24f1d359789dbd40e8d98ddf220acf2e5cdbb1e1",type:"button",class:"btn secondary",onClick:()=>this.close_prompt(),disabled:this.prompt_busy},"Cancel"),t("button",{key:"3a5ae8f5edbbe70c226d9ec01d204b0f276607cd",type:"submit",class:"btn primary",disabled:this.prompt_busy},this.prompt_busy?"Working...":"mkdir"===this.prompt_kind?"Create":"Rename"))))),this.chmod_target&&t("section",{key:"3f5daa368a81ae49fd074c33979fad6d9dc1e79f",class:"prompt-modal visible"},t("div",{key:"a2cfc7cbecbead9ccd977e74213c48ba47d5e0f7",class:"prompt-dialog",role:"dialog","aria-modal":"true","aria-label":"Change permissions",tabindex:-1,onKeyDown:t=>this.on_modal_keydown(t,(()=>this.close_chmod()))},t("div",{key:"6db7c2771db3bf9dc4c16c506c95fbadc01b24d5",class:"title"},"Permissions"),t("div",{key:"c6fba2cffb84fd01ac51171ddedc140978652756",class:"file-name",title:this.chmod_target.name},this.chmod_target.name),t("table",{key:"fc871c448ad4ad75754256f0b4d9ce9e5188ea90",class:"perm-grid"},t("thead",{key:"b2de44bba7219257af5e16687f1f9e44b64429b8"},t("tr",{key:"b4e964c7281f8088385d1707df0c638b99c0e1e7"},t("th",{key:"a0bebfa92a96c6276a8c57bbd56555c1c8cacbd2","aria-label":"Class"}),t("th",{key:"c7618c92048861c4ee94d0fb8078c6dd719d9603"},"Read"),t("th",{key:"23d0d6cbf7de82f337d4230e0286174a5fc6bd97"},"Write"),t("th",{key:"fbbe7fafe3aa03ed29db6038157167362c736f9c"},"Execute"))),t("tbody",{key:"5468214c98eb5e6278cade8d46bcae62394d0205"},[{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=>t("tr",{key:e.label},t("th",{scope:"row"},e.label),[e.read,e.write,e.exec].map((i=>t("td",{key:i},t("input",{type:"checkbox","aria-label":`${e.label} ${i}`,disabled:this.chmod_busy,checked:!!(this.chmod_mode&i),onChange:()=>this.toggle_chmod_bit(i)}))))))))),t("div",{key:"61a09c4521472a61f3f7e71fe651cb42f125ed81",class:"perm-special"},[{label:"setuid",bit:2048},{label:"setgid",bit:1024},{label:"sticky",bit:512}].map((e=>t("label",{key:e.label,class:"checkline"},t("input",{type:"checkbox",disabled:this.chmod_busy,checked:!!(this.chmod_mode&e.bit),onChange:()=>this.toggle_chmod_bit(e.bit)}),t("span",null,e.label))))),t("div",{key:"49370f167cbe30ee221f6373d4261571b25be38b",class:"perm-octal"},t("label",{key:"f0b17a2ed4c59cbbaf02cd34cc847c773118faef",htmlFor:"chmod-octal"},"Octal"),t("input",{key:"020ec6003d98553c663cceb92502f6391c60691b",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)}),t("span",{key:"4cc7a1cbe4ddfb565f44b5ef3fd116feb879b6c0",class:"perm-preview"},this.format_permissions(this.chmod_mode,this.chmod_target.kind))),this.chmod_error&&t("div",{key:"99cc2d982aef130ea75fa61765d17921186cc2fb",class:"dialog-error"},this.chmod_error),t("div",{key:"d5796750cfa9eb9304340bb9fd091eea7781f3cc",class:"modal-actions"},t("button",{key:"dffe3756b1b4e593ff71663e931df57d53c4a842",type:"button",class:"btn secondary",onClick:()=>this.close_chmod(),disabled:this.chmod_busy},"Cancel"),t("button",{key:"cb30401112b8f500b49e6974dc67ae9065319539",type:"button",class:"btn primary",onClick:()=>{this.submit_chmod()},disabled:this.chmod_busy},this.chmod_busy?"Applying...":"Apply")))),this.show_editor&&t("section",{key:"c9be5edfe1feea95ca51495503dc0c1c3b213d70",class:"editor-modal visible"},t("div",{key:"bf7c2aec8559b42017dc7142bc8a12f0fb4f1c39",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()))}},t("div",{key:"fb6c305fc54a7c5f419a133c9477a69b489b77f0",class:"editor-head"},t("div",{key:"9b22c14a92be28cc42ea900b4907d4411f5e3c7d",class:"title"},this.editor_name,this.editor_is_dirty()?" *":""),t("button",{key:"2c800c08e12448ddf3c0f92f34257960ea0ea713",type:"button",class:"editor-close",onClick:()=>this.close_editor(),"aria-label":"Close editor",disabled:"saving"===this.editor_busy},"x")),"loading"===this.editor_busy?t("div",{class:"editor-loading"},"Loading..."):t("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&&t("div",{key:"7918d367cbe8c9a3c179a20f8083b9c4e067ad79",class:"dialog-error"},this.editor_error),this.editor_confirm_discard&&t("div",{key:"6b2ba93692a575bd2c6253dcd7c9abb65807a900",class:"dialog-error"},"Unsaved changes. Close anyway?"),t("div",{key:"879a150fdb6501ad95847a09f984f5acd9301830",class:"modal-actions"},this.editor_confirm_discard?t("button",{type:"button",class:"btn destructive",onClick:()=>this.close_editor(!0)},"Discard"):t("button",{type:"button",class:"btn secondary",onClick:()=>this.close_editor(),disabled:"saving"===this.editor_busy},"Close"),t("button",{key:"e034f852259bcf75f6ba28159706862cfefbe5fa",type:"button",class:"btn primary",onClick:()=>{this.save_editor()},disabled:!!this.editor_busy||!this.editor_is_dirty()},"saving"===this.editor_busy?"Saving...":"Save")))),this.part_delete&&t(k,{key:"e7789b9ddf6e9d7f9e479aa390e7391e61c208f7",name:this.part_delete.name,busy:this.part_delete.busy,onCancel:()=>this.part_delete=null,onConfirm:()=>{const t=this.part_delete;this.part_delete={...t,busy:!0},this.downloaderEl?.deleteDownload(t.download_id).finally((()=>{this.part_delete=null,this.refresh_directory()}))}}),this.torrent_menu&&t(I,{key:"094cd2ab17cf975825db6afefcf205855221a03b",menu:this.torrent_menu,onClose:()=>this.torrent_menu=null,onFetch:()=>{const t=this.torrent_menu.path;this.torrent_menu=null,this.downloaderEl?.startTorrentPath(t)},onDownload:()=>{const t=this.selected_item;this.torrent_menu=null,t&&this.start_download(t)},onRename:()=>{const t=this.selected_item;this.torrent_menu=null,t&&this.on_rename_action(t,new window.Event("click"))},onDelete:()=>{const t=this.selected_item;this.torrent_menu=null,t&&this.on_file_delete_action(t,new window.Event("click"))}}),this.listing_player&&t("section",{key:"f5b06ff083b4af19a7c4cc336d8be172c0e646e1",class:"player-modal visible"},t("phirepass-media-player",{key:"b2770268f3fb6af053a6a52da1e346d8ae3cdda9",src:this.listing_player.src,name:this.listing_player.name,status:"On the node",positionKey:this.listing_player.key,onPhirepassPlayerClose:()=>this.listing_player=null})))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}static get style(){return":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}}:host .listing main .navigation .action.fetch{position:relative;display:inline-grid;place-items:center;color:hsl(var(--primary))}:host .listing main .navigation .action.fetch .badge{position:absolute;top:-5px;right:-6px;min-width:15px;height:15px;padding:0 4px;border-radius:8px;background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-size:9px;font-weight:700;line-height:15px;text-align:center}:host .listing main .content table tbody tr.part td{color:hsl(var(--muted-foreground));font-style:italic}:host .listing main .content table tbody tr.fresh{background-color:hsl(var(--primary) / 0.1)}:host .listing main .content table tbody tr.fresh .name::after{content:'new';margin-left:8px;font-size:10px;padding:1px 6px;border-radius:3px;background:hsl(var(--primary));color:hsl(var(--primary-foreground));font-weight:600;font-style:normal}:host .delete-dialog .file-name.inline{display:inline;padding:0;border:0;background:none}:host .context-backdrop{position:absolute;inset:0;z-index:8}:host .context-menu{position:absolute;min-width:220px;max-width:calc(100% - 16px);padding:4px;background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:6px;box-shadow:0 12px 30px -10px rgba(0, 0, 0, 0.7);display:flex;flex-direction:column;font-size:12px;button{display:flex;align-items:center;gap:8px;text-align:left;padding:6px 10px;border:0;border-radius:4px;background:transparent;color:rgb(189, 219, 209);font:inherit;cursor:pointer;&:hover,&:focus-visible{background:hsl(var(--muted));outline:none}&.primary{color:hsl(var(--primary))}&.danger{color:hsl(var(--destructive))}}hr{border:0;border-top:1px solid hsl(var(--border));margin:4px 0}}:host .player-modal{position:absolute;inset:0;z-index:7;display:grid;place-items:center;padding:10px;background:rgba(5, 7, 9, 0.6);phirepass-media-player{width:min(100%, 880px)}}"}},[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"],channelFactory:[16],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],channel_ready:[32],fetch_count:[32],fresh_names:[32],part_delete:[32],torrent_menu:[32],listing_player:[32],maximize:[64],minimize:[64]},void 0,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]);function C(){"undefined"!=typeof customElements&&["phirepass-sftp-client","phirepass-downloader","phirepass-media-player"].forEach((t=>{switch(t){case"phirepass-sftp-client":customElements.get(e(t))||customElements.define(e(t),_);break;case"phirepass-downloader":customElements.get(e(t))||h();break;case"phirepass-media-player":customElements.get(e(t))||f()}}))}C();const M=_,D=C;export{M as PhirepassSftpClient,D as defineCustomElement}
|