phirepass-widgets 0.0.112 → 0.0.113

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.
Files changed (89) hide show
  1. package/README.md +33 -0
  2. package/dist/cjs/{index-B8w6l0VL.js → index-CurErEK7.js} +101 -30
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/phirepass-downloader_3.cjs.entry.js +3696 -0
  5. package/dist/cjs/phirepass-rdp.cjs.entry.js +18 -6
  6. package/dist/cjs/phirepass-terminal.cjs.entry.js +6 -5
  7. package/dist/cjs/phirepass-widgets.cjs.js +3 -3
  8. package/dist/cjs/{protocol-COvteaUJ.js → protocol-DCBMfc2u.js} +557 -360
  9. package/dist/collection/collection-manifest.json +3 -1
  10. package/dist/collection/common/channel.js +21 -1
  11. package/dist/collection/common/fetch.js +40 -0
  12. package/dist/collection/components/phirepass-downloader/form.js +69 -0
  13. package/dist/collection/components/phirepass-downloader/format.js +105 -0
  14. package/dist/collection/components/phirepass-downloader/jobs.js +370 -0
  15. package/dist/collection/components/phirepass-downloader/phirepass-downloader.css +1109 -0
  16. package/dist/collection/components/phirepass-downloader/phirepass-downloader.js +1455 -0
  17. package/dist/collection/components/phirepass-downloader/source.js +106 -0
  18. package/dist/collection/components/phirepass-downloader/views/dialogs.js +34 -0
  19. package/dist/collection/components/phirepass-downloader/views/fetch-form.js +65 -0
  20. package/dist/collection/components/phirepass-downloader/views/icons.js +33 -0
  21. package/dist/collection/components/phirepass-downloader/views/job-row.js +91 -0
  22. package/dist/collection/components/phirepass-downloader/views/notices.js +15 -0
  23. package/dist/collection/components/phirepass-downloader/views/states.js +19 -0
  24. package/dist/collection/components/phirepass-media-player/phirepass-media-player.css +216 -0
  25. package/dist/collection/components/phirepass-media-player/phirepass-media-player.js +473 -0
  26. package/dist/collection/components/phirepass-media-player/player.js +94 -0
  27. package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +36 -13
  28. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +122 -0
  29. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.fetch.js +35 -0
  30. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +181 -31
  31. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +2 -2
  32. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  33. package/dist/collection/testing/fixtures.js +219 -0
  34. package/dist/collection/testing/mock-channel.js +410 -0
  35. package/dist/components/index.js +1 -1
  36. package/dist/components/p-C4cmk3bS.js +1 -0
  37. package/dist/components/p-CsYQJXY2.js +1 -0
  38. package/dist/components/p-D6Geq8Rn.js +1 -0
  39. package/dist/components/phirepass-downloader.d.ts +11 -0
  40. package/dist/components/phirepass-downloader.js +1 -0
  41. package/dist/components/phirepass-media-player.d.ts +11 -0
  42. package/dist/components/phirepass-media-player.js +1 -0
  43. package/dist/components/phirepass-rdp.js +1 -1
  44. package/dist/components/phirepass-sftp-client.js +1 -1
  45. package/dist/components/phirepass-terminal.js +2 -2
  46. package/dist/esm/{index-DGq2b7rM.js → index-B9qUl6FW.js} +101 -30
  47. package/dist/esm/loader.js +3 -3
  48. package/dist/esm/phirepass-downloader_3.entry.js +3692 -0
  49. package/dist/esm/phirepass-rdp.entry.js +18 -6
  50. package/dist/esm/phirepass-terminal.entry.js +6 -5
  51. package/dist/esm/phirepass-widgets.js +4 -4
  52. package/dist/esm/{protocol-Dur4cBX7.js → protocol-CsYQJXY2.js} +556 -359
  53. package/dist/phirepass-widgets/p-1b84c526.entry.js +1 -0
  54. package/dist/phirepass-widgets/{p-1fef5b5f.entry.js → p-41dd1ac9.entry.js} +2 -2
  55. package/dist/phirepass-widgets/p-614ab3de.entry.js +1 -0
  56. package/dist/phirepass-widgets/p-B9qUl6FW.js +3 -0
  57. package/dist/phirepass-widgets/p-CsYQJXY2.js +1 -0
  58. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  59. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  60. package/dist/types/common/channel.d.ts +30 -0
  61. package/dist/types/common/fetch.d.ts +161 -0
  62. package/dist/types/components/phirepass-downloader/form.d.ts +54 -0
  63. package/dist/types/components/phirepass-downloader/format.d.ts +17 -0
  64. package/dist/types/components/phirepass-downloader/jobs.d.ts +115 -0
  65. package/dist/types/components/phirepass-downloader/phirepass-downloader.d.ts +231 -0
  66. package/dist/types/components/phirepass-downloader/source.d.ts +61 -0
  67. package/dist/types/components/phirepass-downloader/views/dialogs.d.ts +52 -0
  68. package/dist/types/components/phirepass-downloader/views/fetch-form.d.ts +31 -0
  69. package/dist/types/components/phirepass-downloader/views/icons.d.ts +5 -0
  70. package/dist/types/components/phirepass-downloader/views/job-row.d.ts +21 -0
  71. package/dist/types/components/phirepass-downloader/views/notices.d.ts +18 -0
  72. package/dist/types/components/phirepass-downloader/views/states.d.ts +38 -0
  73. package/dist/types/components/phirepass-media-player/phirepass-media-player.d.ts +67 -0
  74. package/dist/types/components/phirepass-media-player/player.d.ts +43 -0
  75. package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +10 -0
  76. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +30 -0
  77. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.fetch.d.ts +40 -0
  78. package/dist/types/components.d.ts +426 -34
  79. package/dist/types/stencil-public-runtime.d.ts +1 -1
  80. package/dist/types/testing/fixtures.d.ts +25 -0
  81. package/dist/types/testing/mock-channel.d.ts +132 -0
  82. package/package.json +26 -12
  83. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +0 -1469
  84. package/dist/components/p-Dur4cBX7.js +0 -1
  85. package/dist/esm/phirepass-sftp-client.entry.js +0 -1467
  86. package/dist/phirepass-widgets/p-8eb3ec24.entry.js +0 -1
  87. package/dist/phirepass-widgets/p-9a1f9b9f.entry.js +0 -1
  88. package/dist/phirepass-widgets/p-DGq2b7rM.js +0 -3
  89. package/dist/phirepass-widgets/p-Dur4cBX7.js +0 -1
@@ -0,0 +1 @@
1
+ import{h as e,r as t,c as i,g as s,H as o}from"./p-B9qUl6FW.js";import{_ as a,C as n,P as r,E as l,a as d}from"./p-CsYQJXY2.js";const h=["send_download_start","send_download_stop","send_download_resume","send_download_set_order","send_download_delete","send_download_subscribe","send_download_where"];function c(e){return!(!e||"object"!=typeof e)&&h.every((t=>"function"==typeof e[t]))}const p=1073741824,u=new Set(["DownloadProgress","DownloadAccepted","DownloadWhereAnswer","DownloadCaps","DownloadFoldersAnswer"]);function b(e){return u.has(e.type)}const g=new Set(["host","content-length","range","if-range","transfer-encoding","connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","upgrade"]),f=["B","KB","MB","GB","TB"];function m(e){if(null==e||!Number.isFinite(e)||e<0)return"—";let t=e,i=0;for(;t>=1e3&&i<f.length-1;)t/=1e3,i++;if(0===i)return`${Math.round(t)} B`;const s=t>=100?0:t>=10?1:i>=3?2:1,o=t.toFixed(s);return`${s?o.replace(/\.?0+$/,""):o} ${f[i]}`}function y(e,t="↓"){return!e||e<=0?"":`${t} ${m(e)}/s`}function v(e){const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const i=Math.floor(t/60);if(i<10){const e=t%60;return e?`${i}m ${e}s`:`${i}m`}if(i<60)return`${i}m`;const s=Math.floor(i/60),o=i%60;return s<24?o?`${s}h ${o}m`:`${s}h`:`${Math.floor(s/24)}d ${s%24}h`}function x(e){if(!Number.isFinite(e)||e<0)return"0:00";const t=Math.floor(e),i=Math.floor(t/3600),s=Math.floor(t%3600/60),o=String(t%60).padStart(2,"0");return i?`${i}:${String(s).padStart(2,"0")}:${o}`:`${s}:${o}`}function w(e){const t=e.trim();if(!t)return{kind:"empty"};if(/^magnet:\?/i.test(t)){const e=t.slice(t.indexOf("?")+1),i=new URLSearchParams(e),s=i.getAll("xt").find((e=>/^urn:btih:/i.test(e)));if(!s)return{kind:"invalid"};const o=s.slice(9),a=i.get("dn")?.trim();return{kind:"magnet",uri:t,infoHash:o,...a?{name:a}:{}}}let i;try{i=new URL(t)}catch{return{kind:"invalid"}}if("http:"!==i.protocol&&"https:"!==i.protocol)return{kind:"invalid"};if(!i.hostname)return{kind:"invalid"};if(i.username||i.password)return{kind:"invalid"};const s="https:"===i.protocol?"HTTPS":"HTTP",o=function(e){const t=e.split("/").filter(Boolean),i=t[t.length-1]??"";try{return decodeURIComponent(i)}catch{return i}}(i.pathname)||"download";return{kind:/\.torrent$/i.test(i.pathname)?"torrent-url":"http",url:t,host:i.hostname,name:o,scheme:s}}function k(e){switch(e.mode){case"none":return{auth:null};case"basic":return e.username?{auth:{Basic:{username:e.username,password:e.password}}}:{auth:null,error:"Enter a username."};case"bearer":return e.token.trim()?{auth:{Bearer:{token:e.token.trim()}}}:{auth:null,error:"Enter a token."};case"header":{const t=e.headerName.trim();return/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/.test(t)?g.has(t.toLowerCase())?{auth:null,error:`${t} cannot be set here.`}:{auth:{Header:{name:t,value:e.headerValue}}}:{auth:null,error:"Enter a valid header name."}}}}const C={text:"",saveAs:"",torrent:null,order:null,auth:{mode:"none",username:"",password:"",token:"",headerName:"",headerValue:""},authOpen:!1};function I(e,t,i){const s=e.torrent?{kind:"empty"}:w(e.text),o=!!e.torrent||"magnet"===s.kind,a=o&&!!t&&!t.torrents,n="http"===s.kind||"torrent-url"===s.kind;let r=null;"too-large"===e.torrent?.error?r={tone:"err",title:"Too large",body:"A .torrent file can be up to 2 MB. Use its magnet link instead."}:"not-torrent"===e.torrent?.error?r={tone:"err",title:"Not a .torrent",body:"Choose a file that ends in .torrent."}:"invalid"===s.kind?r={tone:"err",title:"Not a link",body:"Use http://, https:// or magnet:"}:a&&(r={tone:"warn",title:"Torrents are off",body:"This node only allows ordinary links. Its owner can allow torrents in the node's settings."});const l=k(e.auth),d=o&&!a,h=i&&!!t&&(n||"magnet"===s.kind||!!e.torrent&&!e.torrent.error&&!!e.torrent.contents)&&!r&&(!d||null!==e.order)&&(!n||!e.authOpen||!l.error);let c;return n?c=e.saveAs.trim()||s.name:"magnet"===s.kind&&(c=s.name),{detected:s,isTorrent:o,needsOrder:d,showSaveAs:"http"===s.kind,showAuth:n,note:r,canStart:h,askedName:c,authError:n&&e.authOpen&&(e.auth.username||e.auth.token||e.auth.headerName||e.auth.headerValue)?l.error:void 0}}const M=new Set(["Completed","Seeding"]);function _(e){return M.has(e)}const D=new Set(["Queued","Scheduled","Resolving","FetchingMetadata","Downloading","Verifying","Paused","Stopped","Unknown"]);function S(e){return["Queued","Scheduled","Resolving","FetchingMetadata","Downloading","Verifying","Paused"].includes(e.state)}function z(e){return("Completed"===e.state||"Cancelled"===e.state)&&!e.deleting}const $={Downloading:0,Verifying:1,FetchingMetadata:2,Resolving:3,Paused:4,Queued:5,Scheduled:6,Retrying:7,Stopped:8,Seeding:9,Completed:10,Cancelled:11,Deleted:12,Unknown:13};function A(e){const t=e.filter(S),i=t.reduce(((e,t)=>e+(t.down_bps||0)),0),s=t.filter((e=>e.total_bytes)),o=s.reduce(((e,t)=>e+t.done_bytes),0),a=s.reduce(((e,t)=>e+(t.total_bytes??0)),0);return{active:t.length,downBps:i,done:o,total:a,percent:a?o/a*100:null}}const P=/\.(mp4|m4v|webm|mkv|mov|mp3|m4a|flac|ogg|oga|opus|wav)$/i;function N(e){return P.test(e)}function T(e){const t=function(e){const t=e.files.filter((e=>e.media||N(e.name)));return t.length?t.reduce(((e,t)=>t.size>e.size?t:e)):!e.files.length&&N(e.name)?{index:0,name:e.name,size:e.total_bytes??0,done_bytes:e.done_bytes,media:!0,ready_from_start:e.in_order?e.done_bytes:0}:null}(e);return!t||e.deleting?{play:!1,file:null,switchToInOrder:!1}:_(e.state)?{play:!0,file:t,switchToInOrder:!1}:["Downloading","Verifying","Paused","Stopped","Retrying"].includes(e.state)&&t.size?e.in_order?{play:!0,file:t,switchToInOrder:!1}:{play:!1,file:null,switchToInOrder:"Torrent"===e.kind}:{play:!1,file:null,switchToInOrder:!1}}function R(...e){const t=e.filter((e=>!!e)).join("/").replace(/\/{2,}/g,"/");return t.length>1?t.replace(/\/+$/,""):t}function j(e){return R(e.dest_root,e.sub_dir)}function F(e,t,i){return e.agent_supported?"Organisation"===e.lock?{id:"blocked",title:"Blocked",body:`Your organisation does not allow downloads on ${t}.`,secondary:"An owner or admin of the organisation can change this under Organisation → Downloads."}:e.http?"NoFolder"===e.lock?{id:"no-folder",title:"No download folder",body:"The download folder on this node is missing or can't be written.",secondary:"Someone who can configure the node can pick another one.",action:i?"Open node settings":void 0}:null:{id:"off",title:"Downloads are off",body:`Downloads are turned off for ${t}.`,secondary:i?"You can turn them on in the node's settings.":"Ask the node's owner to turn them on.",action:i?"Open node settings":void 0}:{id:"too-old",title:"Too old",body:`${t} runs an agent that cannot download. Update the agent on that machine, then try again.`}}const W={fetch:()=>[e("path",{d:"M17.5 19a4.5 4.5 0 1 0-1.4-8.8A6 6 0 0 0 4.3 12.7 4 4 0 0 0 6 19.9"}),e("path",{d:"M12 12v8"}),e("path",{d:"m8.5 16.5 3.5 3.5 3.5-3.5"})],magnet:()=>[e("path",{d:"M6 3v8a6 6 0 0 0 12 0V3"}),e("path",{d:"M6 7h4M14 7h4"}),e("path",{d:"M10 3v8a2 2 0 0 0 4 0V3"})],globe:()=>[e("circle",{cx:"12",cy:"12",r:"9"}),e("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"})],torrent:()=>[e("path",{d:"M6 3h8l4 4v14H6z"}),e("path",{d:"M14 3v4h4"}),e("path",{d:"M9.5 11.5 12 14l2.5-2.5M12 14v3"})],node:()=>[e("rect",{x:"3",y:"4",width:"18",height:"7",rx:"1.5"}),e("rect",{x:"3",y:"13",width:"18",height:"7",rx:"1.5"}),e("path",{d:"M7 7.5h.01M7 16.5h.01"})],x:()=>[e("path",{d:"M6 6l12 12M18 6 6 18"})],retry:()=>[e("path",{d:"M3 12a9 9 0 0 0 15.4 6.4L21 16"}),e("path",{d:"M21 21v-5h-5"}),e("path",{d:"M21 12A9 9 0 0 0 5.6 5.6L3 8"}),e("path",{d:"M3 3v5h5"})],check:()=>[e("circle",{cx:"12",cy:"12",r:"9.5"}),e("path",{d:"m8 12.5 2.7 2.7L16.5 9.5"})],locate:()=>[e("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z"}),e("path",{d:"m11 13 2 2 3-3"})],file:()=>[e("path",{d:"M6 3h8l4 4v14H6z"}),e("path",{d:"M14 3v4h4"})],folder:()=>[e("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2h8.4A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5z"})],warn:()=>[e("path",{d:"M12 3 2.5 20h19z"}),e("path",{d:"M12 10v4.5"}),e("path",{d:"M12 17.5v.01"})],trash:()=>[e("path",{d:"M3 6h18"}),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"})],chevron:()=>[e("path",{d:"m6 9 6 6 6-6"})],up:()=>[e("path",{d:"m6 15 6-6 6 6"})],cast:()=>[e("path",{d:"M3 8V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-5"}),e("path",{d:"M3 12a8 8 0 0 1 8 8"}),e("path",{d:"M3 16a4 4 0 0 1 4 4"}),e("path",{d:"M3 20h.01"})],lock:()=>[e("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2"}),e("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})],signal:()=>[e("path",{d:"M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 4v16"})],plus:()=>[e("path",{d:"M12 5v14M5 12h14"})]},B={pause:()=>[e("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),e("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})],play:()=>[e("path",{d:"M7 5v14l12-7z"})]},Z=({name:t,size:i=16,label:s})=>{const o=B[t];return e("svg",{xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:o?"currentColor":"none",stroke:o?"none":"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":s?void 0:"true",role:s?"img":void 0,"aria-label":s},(o??W[t])?.()??null)},H=({label:t,onClose:i,wide:s},o)=>e("div",{class:"overlay",onClick:e=>{e.target===e.currentTarget&&i()}},e("div",{class:{modal:!0,wide:!!s},role:"dialog","aria-modal":"true","aria-label":t,tabindex:-1,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),i())}},o)),E=({cancel:t,confirm:i,danger:s,onCancel:o,onConfirm:a})=>e("div",{class:"dlg-f"},e("button",{type:"button",class:"btn",onClick:o},t),e("button",{type:"button",class:{btn:!0,pri:!s,dng:!!s},onClick:a},i)),L=({row:t,discard:i,onDiscard:s,...o})=>e(H,{label:"Stop this download?",onClose:o.onCancel},e("div",{class:"dlg"},e("h4",null,"Stop this download?"),e("div",{class:"filechip"},e(Z,{name:"file",size:20}),e("div",null,e("b",null,t.name),e("span",null,t.total_bytes?`${m(t.done_bytes)} of ${m(t.total_bytes)} downloaded`:`${m(t.done_bytes)} downloaded`))),e("label",{class:"checkline"},e("input",{type:"checkbox",checked:i,onChange:e=>s(e.target.checked)}),e("span",null,"Also delete the part already downloaded",e("span",{class:"hint block"},"Leave this off and Resume continues from here."))),e(E,{cancel:"Keep downloading",confirm:"Stop download",danger:!0,...o}))),U=({row:t,deleteFile:i,onDeleteFile:s,nodeName:o,...a})=>{const n=_(t.state),r=t.files.length>1?`${t.files.length} files · ${m(t.total_bytes??t.done_bytes)}`:m(t.total_bytes??t.done_bytes);return e(H,{label:"Delete this download?",onClose:a.onCancel},e("div",{class:"dlg"},e("h4",null,"Delete this download?"),e("div",{class:"filechip"},e(Z,{name:"file",size:20}),e("div",null,e("b",null,t.name),e("span",null,"Seeding"===t.state?"Seeding · ":"",r," in ",j(t)))),"Seeding"===t.state&&e("p",{class:"dtx"},o," stops sharing it with peers."),n?e("label",{class:"checkline"},e("input",{type:"checkbox",checked:i,onChange:e=>s(e.target.checked)}),e("span",null,"Also delete the files",e("span",{class:"hint block"},"Off: the files stay in ",j(t)," and only the download is removed."))):e("p",{class:"dtx"},"The part already downloaded is deleted."),e(E,{cancel:"Cancel",confirm:"Delete",danger:!0,...a})))},G=({row:t,...i})=>e(H,{label:"Switch to fastest?",onClose:i.onCancel},e("div",{class:"dlg"},e("h4",null,"Switch to fastest?"),e("p",{class:"dtx"},e("b",null,t.name)," is playing. Fastest downloads pieces in any order, so playback stops until it finishes or you switch back."),e(E,{cancel:"Keep in order",confirm:"Switch and stop playback",danger:!0,...i}))),J=({nodeName:t,dontAsk:i,onDontAsk:s,...o})=>e(H,{label:`Start a torrent on ${t}?`,onClose:o.onCancel},e("div",{class:"dlg"},e("h4",null,"Start a torrent on ",t,"?"),e("div",{class:"note warn"},e(Z,{name:"warn",size:14}),e("div",null,"The node will connect to public peers. They can see its internet address, and it uploads to them while it downloads.")),e("p",{class:"dtx"},"When it finishes, ",t," keeps sharing it with other peers until you delete it."),e("label",{class:"checkline"},e("input",{type:"checkbox",checked:i,onChange:e=>s(e.target.checked)}),e("span",null,"Do not ask again on this browser")),e(E,{cancel:"Cancel",confirm:"Start torrent",...o}))),O=({reason:t,onClose:i})=>e(H,{label:"Not enough space",onClose:i},e("div",{class:"dlg"},e("h4",null,"Not enough space"),e("p",{class:"dtx"},t),e("div",{class:"dlg-f"},e("button",{type:"button",class:"btn pri",onClick:i},"OK")))),V=t=>e(H,{label:"Save downloads to",onClose:t.onCancel,wide:!0},e("div",{class:"dlg"},e("h4",null,"Save downloads to"),e("nav",{class:"crumbs","aria-label":"Folder"},e("button",{type:"button",class:"lnk",onClick:()=>t.onUp(0)},t.root),t.path.map(((i,s)=>[e("span",{class:"sep"},"/"),e("button",{type:"button",class:"lnk",onClick:()=>t.onUp(s+1)},i)]))),e("div",{class:"folders",role:"list"},null===t.folders&&e("div",{class:"muted"},"Loading…"),0===t.folders?.length&&e("div",{class:"muted"},"No folders here."),t.folders?.map((i=>e("button",{type:"button",class:"folder-row",role:"listitem",onClick:()=>t.onOpen(i)},e(Z,{name:"folder",size:14}),e("span",null,i))))),t.error&&e("div",{class:"note err"},t.error),null!==t.newName&&e("input",{class:"inp",type:"text","aria-label":"New folder name",placeholder:"New folder name",value:t.newName,onInput:e=>t.onNewName(e.target.value)}),e("p",{class:"hint"},"Folders only, and only inside the node's download folder. A new folder is created by the node when the first download lands in it."),e("div",{class:"dlg-f"},e("button",{type:"button",class:"btn left",onClick:()=>t.onNewName(null===t.newName?"":null)},e(Z,{name:"plus",size:12})," New folder"),e("button",{type:"button",class:"btn",onClick:t.onCancel},"Cancel"),e("button",{type:"button",class:"btn pri",disabled:null!==t.newName&&!/^[^/\\\0]+$/.test(t.newName.trim()),onClick:t.onSave},"Save here")))),Y=({note:t})=>e("div",{class:`note ${t.tone}`,role:"err"===t.tone?"alert":"status"},e(Z,{name:"warn",size:14}),e("div",null,e("b",null,t.title)," ",t.body));function K({model:t}){const i=t.detected;return"http"===i.kind||"torrent-url"===i.kind?e("div",{class:"detect","data-kind":i.kind},e("span",{class:"pill meta"},"torrent-url"===i.kind?".torrent link":i.scheme),e("span",{class:"host"},i.host)):"magnet"===i.kind?e("div",{class:"detect","data-kind":"magnet"},e("span",{class:"pill meta"},"Magnet"),e("span",{class:"host"},i.name??"name arrives with the metadata")):e("div",{class:"detect"})}const X=({auth:t,onChange:i})=>{const s=i,o=(i,o,a="text")=>e("label",{class:"fld"},e("span",null,i),e("input",{class:"inp",type:a,autocomplete:"off",spellcheck:!1,value:t[o],onInput:e=>s({[o]:e.target.value})}));return e("div",{class:"auth"},e("div",{class:"seg",role:"radiogroup","aria-label":"Login for the link"},[["none","No login"],["basic","Username and password"],["bearer","Bearer token"],["header","Custom header"]].map((([i,o])=>e("label",{class:{on:t.mode===i}},e("input",{type:"radio",name:"auth-mode",checked:t.mode===i,onChange:()=>s({mode:i})}),o)))),"basic"===t.mode&&[o("Username","username"),o("Password","password","password")],"bearer"===t.mode&&o("Token","token","password"),"header"===t.mode&&[o("Header name","headerName"),o("Value","headerValue","password")],"none"!==t.mode&&e("p",{class:"hint"},"Sent only to this link's own site, and dropped if it redirects elsewhere. The node seals it and deletes it when the download finishes."))},Q=({order:t,onChange:i})=>e("fieldset",{class:"order"},e("legend",null,"How should it download? (required for torrents)"),e("label",{class:{opt:!0,on:"in"===t}},e("input",{type:"radio",name:"order",value:"in",checked:"in"===t,onChange:()=>i("in")}),e("span",null,e("b",null,"In order")," · watch while it downloads, a little slower")),e("label",{class:{opt:!0,on:"fast"===t}},e("input",{type:"radio",name:"order",value:"fast",checked:"fast"===t,onChange:()=>i("fast")}),e("span",null,e("b",null,"Fastest")," · any order; switch to in order later if you want to watch"))),q=t=>{const{form:i,model:s,caps:o}=t;let a;const n=!!o?.torrents,r="dialog"===t.layout,l=e("input",{type:"file",accept:".torrent,application/x-bittorrent",class:"hidden-input",ref:e=>a=e,onChange:e=>{const i=e.target,s=i.files?.[0];s&&t.onPickTorrent(s),i.value=""}}),d=i.torrent?e("div",{class:{filechip:!0,bad:!!i.torrent.error}},e(Z,{name:"torrent",size:20}),e("div",null,e("b",null,i.torrent.name),e("span",null,m(i.torrent.size)," · from this computer")),e("button",{type:"button",class:"ib","aria-label":"Remove the .torrent file",title:"Remove",onClick:()=>t.onChange({torrent:null,order:null})},e(Z,{name:"x",size:14}))):e("div",{class:"fld"},e("label",{htmlFor:"fetch-link"},"Link or magnet"),e("div",{class:"inline-row"},e("input",{id:"fetch-link",class:"inp",type:"text",inputMode:"url",autocomplete:"off",autocapitalize:"none",spellcheck:!1,placeholder:"https://… or magnet:?xt=…",value:i.text,disabled:t.starting,onInput:e=>t.onChange({text:e.target.value}),onKeyDown:e=>{"Enter"===e.key&&s.canStart&&(e.preventDefault(),t.onStart())}}),!r&&n&&e("button",{type:"button",class:"btn",onClick:()=>a?.click()},".torrent…"),!r&&e("button",{type:"button",class:"btn pri",disabled:!s.canStart||t.starting,onClick:()=>t.onStart()},t.starting?"Starting…":"Download")),e(K,{model:s}));return e("form",{class:{"fetch-form":!0,[t.layout]:!0},onSubmit:e=>{e.preventDefault(),s.canStart&&t.onStart()},onDragOver:e=>n&&e.preventDefault(),onDrop:e=>n&&(e=>{e.preventDefault();const i=e.dataTransfer?.files?.[0];i&&t.onPickTorrent(i)})(e)},r&&e("div",{class:"dlg-h"},e(Z,{name:"fetch"}),e("h4",null,t.title)),l,d,s.note&&e(Y,{note:s.note}),t.refusal&&e(Y,{note:t.refusal}),s.showSaveAs&&e("div",{class:"fld"},e("label",{htmlFor:"fetch-save-as"},"Save as"),e("input",{id:"fetch-save-as",class:"inp",type:"text",autocomplete:"off",spellcheck:!1,placeholder:s.askedName,value:i.saveAs,disabled:t.starting,onInput:e=>t.onChange({saveAs:e.target.value})}),e("span",{class:"hint"},"Taken from the server's filename when it sends one. An existing file is never overwritten; the new one gets “(1)” added.")),s.showAuth&&e("div",{class:"login"},e("button",{type:"button",class:"lnk","aria-expanded":i.authOpen?"true":"false",onClick:()=>t.onChange({authOpen:!i.authOpen})},e(Z,{name:i.authOpen?"up":"chevron",size:12})," This link needs a login"),i.authOpen&&e(X,{auth:i.auth,onChange:t.onAuth}),s.authError&&e("span",{class:"hint err",role:"alert"},s.authError)),s.needsOrder&&e(Q,{order:i.order,onChange:e=>t.onChange({order:e})}),("http"===s.detected.kind||"torrent-url"===s.detected.kind)&&e("p",{class:"hint"},"A link always downloads in order, so you can watch while it arrives."),r&&n&&!i.torrent&&[e("div",{class:"or"},"or"),e("button",{type:"button",class:"drop",onClick:()=>a?.click()},e(Z,{name:"torrent",size:22}),e("span",null,e("b",null,"Choose a .torrent file")," or drop it here",e("br",null),e("span",{class:"hint"},"Up to 2 MB, read in the browser and sent to the node")))],t.destination&&e("div",{class:"fld"},r&&e("label",null,"Destination"),e("div",{class:"dest-row"},e("div",{class:"dest",title:t.destination.path},e(Z,{name:"folder",size:14}),e("span",null,t.destination.path)),t.onChooseFolder&&e("button",{type:"button",class:"btn",onClick:()=>t.onChooseFolder?.()},"Choose folder…")),t.destination.hint&&e("span",{class:"hint where"},t.destination.hint)),r&&e("div",{class:"dlg-f"},e("button",{type:"button",class:"btn",onClick:()=>t.onCancel?.()},"Cancel"),e("button",{type:"submit",class:"btn pri",disabled:!s.canStart||t.starting},t.starting?"Starting…":"Start download")))};function ee(e){return"FetchingMetadata"===e.state||"Resolving"===e.state?"bar indet":"Retrying"===e.state||"Paused"===e.state?"bar moving":"Stopped"===e.state||"Queued"===e.state||"Scheduled"===e.state||e.deleting?"bar paused":"Cancelled"===e.state?"bar fail":"Seeding"===e.state?"bar seed":"bar"}const te=({icon:t,label:i,onClick:s,primary:o})=>e("button",{type:"button",class:{ib:!0,new:!!o},title:i,"aria-label":i,onClick:s},e(Z,{name:t,size:14})),ie=({row:t,actions:i,running:s,source:o,compact:a})=>{const{icon:n,tone:r}=function(e){return"Torrent"===e.kind?{icon:e.name.startsWith("magnet:")?"magnet":"torrent",tone:"t"}:"Node"===e.kind?{icon:"node",tone:"n"}:{icon:"globe",tone:"h"}}(t),l=function(e){if(e.deleting)return{text:"Deleting…",tone:"ps"};if(e.waitingForNode)return{text:"Waiting for the node",tone:"q"};switch(e.state){case"Queued":return{text:"Queued",tone:"q"};case"Scheduled":return{text:"Scheduled",tone:"q"};case"Resolving":return{text:"Connecting",tone:"meta"};case"FetchingMetadata":return{text:"Fetching metadata",tone:"meta"};case"Downloading":return{text:"Downloading",tone:"dl"};case"Verifying":return{text:"Checking pieces",tone:"meta"};case"Paused":return{text:"DiskFull"===e.pause_reason?"Paused · disk almost full":"Paused",tone:"mv"};case"Retrying":return{text:"Retrying",tone:"mv"};case"Seeding":return{text:"Seeding",tone:"sd"};case"Completed":return{text:"Completed",tone:"ok"};case"Stopped":return{text:"Stopped",tone:"ps"};case"Cancelled":return{text:"Cancelled",tone:"err"};default:return{text:e.state,tone:"ps"}}}(t),d=function(e){return"Torrent"===e.kind&&["Downloading","Verifying","Paused"].includes(e.state)?e.in_order?"In order":"Fastest":null}(t),h=T(t),c=function(e,t={}){const i=t.now??Date.now(),s=function(e,t){if(!t||t<=0)return"";const i=Math.min(100,e/t*100);return i>=100?"100%":`${i.toFixed(1)}%`}(e.done_bytes,e.total_bytes),o=e.total_bytes?`${m(e.done_bytes)} of ${m(e.total_bytes)}`:e.done_bytes?m(e.done_bytes):"",a=[],n=(e,t={})=>e&&a.push({text:e,...t});if(e.deleting)return n("Waiting for the node to confirm"),a;if(e.waitingForNode)return n("Starts when the node reports in"),n("It keeps going after you close this tab"),a;switch(e.state){case"Queued":n("Waiting for a free slot"),t.running&&n(`${t.running} ${1===t.running?"is":"are"} running`);break;case"Scheduled":n("Waits for the download window"),e.next_attempt_at&&e.next_attempt_at>i&&n(`starts in ${v((e.next_attempt_at-i)/1e3)}`);break;case"Resolving":n(t.source?`Contacting ${t.source}`:"Contacting the server");break;case"FetchingMetadata":n("Asking peers for the torrent info"),n(`${e.peers} ${1===e.peers?"peer":"peers"}`),n(x((i-e.started_at)/1e3));break;case"Downloading":n(s,{strong:!0}),n(o),n(y(e.down_bps)),"Torrent"===e.kind&&(n(y(e.up_bps,"↑")),n(`${e.peers} ${1===e.peers?"peer":"peers"}`)),n((r=e.done_bytes,d=e.down_bps,!(l=e.total_bytes)||!d||d<=0||r>=l?"":`${v((l-r)/d)} left`)),e.restarted_from_zero&&n("The file changed on the server, so it started over"),t.source&&n(t.source);break;case"Verifying":n(s,{strong:!0}),n("Checking downloaded pieces after a restart"),n(`${m(e.done_bytes)} already on disk`);break;case"Paused":"DiskFull"===e.pause_reason?(n(e.reason??"Free space is below the floor"),n("Resumes by itself when there is room")):(n(s,{strong:!0}),n("Outside the download window"),n("Resumes by itself"));break;case"Retrying":n(e.retry_reason??e.reason??"Something went wrong",{error:!0}),n(`attempt ${e.attempt}`),e.next_attempt_at&&n(e.next_attempt_at>i?`Next try in ${v((e.next_attempt_at-i)/1e3)}`:"Trying again now"),e.done_bytes&&n(`${m(e.done_bytes)} kept`);break;case"Seeding":n(y(e.up_bps,"↑")),n(`${m(e.up_total)} uploaded`),n(`${e.peers} ${1===e.peers?"peer":"peers"}`),e.seeding_since&&n(`seeding for ${v((i-e.seeding_since)/1e3).replace(/ \d+[hm]$/,"")}, until you delete it`);break;case"Completed":if(n("100%",{strong:!0}),n(e.files.length>1?`${e.files.length} files · ${m(e.total_bytes??e.done_bytes)}`:m(e.total_bytes??e.done_bytes)),e.finished_at&&e.started_at){const t=(e.finished_at-e.started_at)/1e3;n(`took ${v(t)}`),t>0&&(e.total_bytes??e.done_bytes)&&n(`avg ${m((e.total_bytes??e.done_bytes)/t)}/s`)}break;case"Stopped":n(s,{strong:!0}),n(e.reason??"Stopped by you"),n("Resume continues from here");break;case"Cancelled":n(e.reason??"Stopped and its part deleted",{error:!!e.reason}),n("Resume starts from zero")}var r,l,d;return a}(t,{running:s,source:o}),p="Completed"===t.state||"Seeding"===t.state?100:!(u=t.total_bytes)||u<=0?0:Math.max(0,Math.min(100,t.done_bytes/u*100));var u;const b=[];if(!t.deleting)switch(h.play&&b.push(e(te,{icon:"play",label:_(t.state)?"Play":"Play while downloading",primary:!0,onClick:()=>i.play(t)})),t.state){case"Downloading":case"Verifying":case"Resolving":case"FetchingMetadata":case"Queued":"Downloading"!==t.state&&"Verifying"!==t.state||b.push(e(te,{icon:"pause",label:"Pause",onClick:()=>i.pause(t)})),b.push(e(te,{icon:"x",label:"Stop",onClick:()=>i.stop(t)}));break;case"Scheduled":case"Paused":"Scheduled"!==t.state&&"Window"!==t.pause_reason||b.push(e(te,{icon:"play",label:"Start now",onClick:()=>i.resume(t,!0)})),b.push(e(te,{icon:"x",label:"Stop",onClick:()=>i.stop(t)}));break;case"Retrying":b.push(e(te,{icon:"retry",label:"Try now",onClick:()=>i.resume(t)})),b.push(e(te,{icon:"x",label:"Stop",onClick:()=>i.stop(t)}));break;case"Stopped":b.push(e(te,{icon:"play",label:"Resume",onClick:()=>i.resume(t)})),b.push(e(te,{icon:"trash",label:"Delete",onClick:()=>i.remove(t)}));break;case"Seeding":b.push(e(te,{icon:"pause",label:"Pause seeding",onClick:()=>i.pause(t)})),b.push(e(te,{icon:"locate",label:"Show in folder",onClick:()=>i.showInFolder(t)})),b.push(e(te,{icon:"trash",label:"Delete",onClick:()=>i.remove(t)}));break;case"Completed":b.push(e(te,{icon:"locate",label:"Show in folder",onClick:()=>i.showInFolder(t)})),b.push(e(te,{icon:"x",label:"Remove from list",onClick:()=>i.remove(t)}));break;case"Cancelled":b.push(e(te,{icon:"retry",label:"Start again",onClick:()=>i.resume(t)})),b.push(e(te,{icon:"x",label:"Remove from list",onClick:()=>i.remove(t)}))}return e("div",{key:t.download_id,class:{job:!0,compact:!!a},"data-state":t.deleting?"Deleting":t.state,"data-id":t.download_id,role:"listitem","aria-label":`${t.name}, ${l.text}`},e("span",{class:`kind ${r}`},e(Z,{name:n,size:15})),e("div",{class:"title"},e("span",{class:"nm",title:t.name},t.name),e("span",{class:`pill ${l.tone}`},l.text),d&&e("span",{class:"pill meta"},d)),e("div",{class:"acts"},b),e("div",{class:ee(t),role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(p),"aria-label":`${t.name} progress`},e("i",{style:{width:`${p}%`}})),e("div",{class:"stats"},c.map((t=>t.strong?e("b",null,t.text):e("span",{class:{err:!!t.error}},t.text))),!h.play&&h.switchToInOrder&&e("button",{type:"button",class:"lnk inline",onClick:()=>i.setOrder(t,!0)},"Switch to in order to watch"),h.play&&"Torrent"===t.kind&&t.in_order&&!_(t.state)&&e("button",{type:"button",class:"lnk inline",onClick:()=>i.setOrder(t,!1)},"Switch to fastest")))},se={started:"fetch",queued:"fetch",stuck:"warn",renamed:"file",completed:"check",error:"warn"},oe=({notices:t,onDismiss:i})=>t.length?e("div",{class:"toasts","aria-live":"polite"},t.map((t=>e("div",{class:{toast:!0,bad:"stuck"===t.kind||"error"===t.kind},"data-notice":t.kind,key:t.id},e(Z,{name:se[t.kind],size:18}),e("div",{class:"t"},e("b",null,t.title),e("span",{title:t.detail},t.detail)),t.action&&e("button",{type:"button",class:"btn",onClick:()=>{t.action.run(),i(t.id)}},t.action.label),e("button",{type:"button",class:"ib","aria-label":"Dismiss",onClick:()=>i(t.id)},e(Z,{name:"x",size:12})))))):null,ae=({icon:t,title:i,body:s,action:o})=>e("div",{class:"empty",role:"status"},e(Z,{name:t,size:28}),e("b",null,i),e("span",null,s),o&&e("button",{type:"button",class:"btn pri",onClick:o.onClick},o.label)),ne=()=>e(ae,{icon:"fetch",title:"No downloads yet",body:"Press Fetch and paste a link. Downloads keep running after you close this tab, and they show here when you come back."}),re=({nodeName:t,folder:i})=>e(ae,{icon:"fetch",title:"Nothing downloading",body:`Paste a link above. It downloads onto ${t}${i?`, into ${i}`:""}.`}),le=({onSignIn:t})=>e(ae,{icon:"lock",title:"Sign in to PhirePass",body:"Your downloads are tied to your account and the nodes you can reach.",action:{label:"Sign in",onClick:t}}),de=({nodeName:t,onRetry:i})=>e(ae,{icon:"signal",title:`Can't reach ${t}`,body:"If the machine is still running, its downloads carry on. They will show here when it reconnects.",action:i?{label:"Try again",onClick:i}:void 0}),he=()=>e(ae,{icon:"warn",title:"Downloads are not available here",body:"This page's connection library is too old to start downloads. Reload after the site updates."}),ce=()=>e("div",{class:"empty",role:"status"},e("span",{class:"spin","aria-hidden":"true"}),e("span",null,"Loading downloads…")),pe=({blocker:t,onAction:i,onClose:s})=>e("div",{class:"blocker","data-blocker":t.id},e("div",{class:"note "+("off"===t.id?"info":"warn"),role:"status"},e(Z,{name:"off"===t.id?"fetch":"warn",size:14}),e("div",null,e("b",null,t.title)," ",t.body)),t.secondary&&e("p",{class:"hint"},t.secondary),(s||t.action&&i)&&e("div",{class:"dlg-f"},s&&e("button",{type:"button",class:"btn",onClick:s},"Close"),t.action&&i&&e("button",{type:"button",class:"btn pri",onClick:i},t.action))),ue="phirepass.downloader.torrent-ack",be=class{constructor(e){new.target===be&&t(this,e),this.fetchCompleted=i(this,"phirepassFetchCompleted"),this.play=i(this,"phirepassPlay"),this.activeCount=i(this,"phirepassActiveCount"),this.showInFolder=i(this,"phirepassShowInFolder"),this.openNodeSettings=i(this,"phirepassOpenNodeSettings"),this.signIn=i(this,"phirepassSignIn")}get el(){return s(this)}ownChannel=!1;msgId=p;noticeId=1;seenNotices=new Set;torrentAcked=function(){try{return"1"===window.localStorage.getItem(ue)}catch{return!1}}();noticeTimers=new Map;whereMsgId;nodeId;nodeLabel;token;channel;connected=!1;channelFactory;browsingService;browsingPath;compact=!1;streamBase;canConfigure=!1;inlinePlayer=!0;serverHost="phirepass.com";serverPort=443;serverId;allowInsecure=!1;heartbeatInterval=3e4;fetchCompleted;play;activeCount;showInFolder;openNodeSettings;signIn;connection="connecting";caps=null;jobs={};tab="active";drawerOpen=!1;dialogOpen=!1;unread=0;form=C;where=null;starting=null;refusal=null;confirm=null;notices=[];subDir=null;picker=null;player=null;get name(){return this.nodeLabel||this.nodeId}get ch(){return this.channel??this.ownedChannel}ownedChannel;async componentWillLoad(){this.channel?this.adoptChannel():await this.openOwnChannel()}disconnectedCallback(){this.noticeTimers.forEach((e=>window.clearTimeout(e))),this.noticeTimers.clear(),this.starting?.silence&&window.clearTimeout(this.starting.silence),this.ownChannel&&this.ownedChannel&&(this.ownedChannel.stop_heartbeat(),this.ownedChannel.disconnect())}onChannel(){this.channel&&this.adoptChannel()}onConnected(e,t){this.channel&&(e&&!t?this.subscribe():!e&&t&&(this.connection="unreachable"))}onBrowsing(){this.where=null,this.dialogOpen&&this.askWhere()}onNode(e,t){e!==t&&(this.jobs={},this.caps=null,this.where=null,this.channel?this.connected&&this.subscribe():this.ownedChannel&&(this.ownedChannel.disconnect(),this.openOwnChannel()))}adoptChannel(){this.ownChannel=!1,c(this.channel)?(this.connection="connecting",this.connected&&this.subscribe()):this.connection="unsupported"}endpoint(){return`${this.allowInsecure?"ws":"wss"}://${this.serverHost}${!this.allowInsecure&&443===this.serverPort||this.allowInsecure&&80===this.serverPort?"":`:${this.serverPort}`}/api/web/ws`}defaultStreamBase(){return`${this.allowInsecure?"http":"https"}://${this.serverHost}${!this.allowInsecure&&443===this.serverPort||this.allowInsecure&&80===this.serverPort?"":`:${this.serverPort}`}`}async openOwnChannel(){if(this.ownChannel=!0,!this.token)return void(this.connection="signed-out");if(!this.nodeId)return;this.channelFactory||await a();const e=this.channelFactory?this.channelFactory(this.endpoint(),this.nodeId,this.serverId):this.serverId?new n(this.endpoint(),this.nodeId,this.serverId):new n(this.endpoint(),this.nodeId);this.ownedChannel=e,c(e)?(e.on_connection_open((()=>e.authenticate(this.token,this.nodeId))),e.on_connection_close((()=>{"signed-out"!==this.connection&&(this.connection="unreachable")})),e.on_connection_error((()=>{"signed-out"!==this.connection&&(this.connection="unreachable")})),e.on_connection_message((()=>{})),e.on_protocol_message((e=>this.dispatch(e.data.web))),this.connection="connecting",e.connect()):this.connection="unsupported"}reconnect(){this.ownChannel?(this.ownedChannel?.disconnect(),this.openOwnChannel()):this.connected&&this.subscribe()}async receive(e){this.dispatch(e.data.web)}dispatch(e){if(e.type===r.AuthSuccess)return this.ownedChannel?.start_heartbeat(Math.max(3e4,this.heartbeatInterval)),void this.subscribe();if(e.type!==r.Error){if(b(e))switch(e.type){case"DownloadCaps":e.node_id===this.nodeId&&(this.caps=e.caps,this.connection="ready");break;case"DownloadProgress":e.node_id===this.nodeId&&this.onProgress(e.job);break;case"DownloadAccepted":this.onAccepted(e.msg_id,e.download_id);break;case"DownloadWhereAnswer":e.msg_id===this.whereMsgId&&(this.where={saves_to:e.saves_to,mapped:e.mapped});break;case"DownloadFoldersAnswer":this.picker&&e.msg_id===this.picker.msgId&&(this.picker={...this.picker,folders:[...e.folders].sort(((e,t)=>e.localeCompare(t)))})}}else this.handleError(e)}handleError(e){if(void 0!==e.msg_id&&e.msg_id===this.starting?.msgId)return this.clearStarting(),void(this.refusal={tone:"err",title:"Refused",body:e.message||"The server refused this download."});this.picker&&e.msg_id===this.picker.msgId?this.picker={...this.picker,folders:[],error:e.message}:void 0!==e.msg_id&&e.msg_id>=p?this.notify("error","That did not work",e.message||"The server refused it."):this.ownChannel&&e.kind===l.Authentication&&(this.connection="signed-out")}subscribe(){const e=this.ch;c(e)?(this.jobs={},e.send_download_subscribe({Node:this.nodeId}),this.dialogOpen&&this.askWhere()):this.connection="unsupported"}onProgress(e){const t=this.jobs[e.download_id],{jobs:i,completed:s}=function(e,t){const i=e[t.download_id];if("Deleted"===t.state){if(!i)return{jobs:e,first:!1};const{[t.download_id]:s,...o}=e;return{jobs:o,first:!1}}return{jobs:{...e,[t.download_id]:{...t,deleting:i?.deleting}},completed:i&&!_(i.state)&&_(t.state)?t:void 0,first:!i}}(this.jobs,e);this.jobs=i,this.emitCount(),this.starting?.downloadId!==e.download_id||t||this.onFirstProgress(e),s&&(this.fetchCompleted.emit({download_id:e.download_id,dest_root:e.dest_root,sub_dir:e.sub_dir,name:e.name}),!this.drawerOpen&&this.compact&&this.unread++,this.notify("completed","Download complete",`${e.name} → ${j(e)}`,{label:"Show",run:()=>this.showInFolder.emit({path:j(e),name:e.name})}));const o=this.jobs[e.download_id];o&&function(e,t=3600){return"Retrying"===e.state&&function(e,t=3600){let i=0;for(let s=0;s<e;s++)i+=Math.min(10*2**s,t);return i}(e.attempt,t)>=86400}(o)&&!this.seenNotices.has(`stuck:${e.download_id}`)&&(this.seenNotices.add(`stuck:${e.download_id}`),this.notify("stuck","Still retrying after a day",`${e.name} · ${e.retry_reason??"no answer"}`,{label:"Show",run:()=>this.showRetrying()},!0))}onAccepted(e,t){if(!this.starting||this.starting.msgId!==e)return;if(this.jobs[t])return void this.onFirstProgress(this.jobs[t]);const i=window.setTimeout((()=>this.nodeSilent(t)),8e3);this.starting={...this.starting,downloadId:t,silence:i}}nodeSilent(e){if(this.starting?.downloadId!==e||this.jobs[e])return;const t=this.starting.askedName??"Download",i=Date.now(),s={download_id:e,kind:"Unknown",name:t,dest_root:this.where?.saves_to??this.caps?.folder??"",sub_dir:null,state:"Queued",done_bytes:0,total_bytes:null,down_bps:0,up_bps:0,peers:0,in_order:!0,started_at:i,finished_at:null,reason:null,requested_by:null,files:[],up_total:0,pause_reason:null,seeding_since:null,info_hash:null,retry_reason:null,attempt:0,next_attempt_at:null,restarted_from_zero:!1,waitingForNode:!0};this.jobs={...this.jobs,[e]:s},this.clearStarting(),this.closeDialog(!0),this.notify("queued",`Waiting for ${this.name}`,`${t} starts when the node reports in.`)}onFirstProgress(e){const t=this.starting?.askedName;if(this.clearStarting(),"Cancelled"!==e.state){if(this.closeDialog(!0),"Queued"===e.state){const e=Object.values(this.jobs).filter((e=>"Downloading"===e.state)).length;this.notify("queued","Added to the queue",`${e} ${1===e?"download is":"downloads are"} already running on this node`)}else this.notify("started","Download started",`${e.name} → ${j(e)}`);(function(e,t){return!!e&&e!==t&&/ \(\d+\)(\.[^.]*)?$/.test(t)})(t,e.name)&&this.notify("renamed",`Saved as ${e.name}`,`A file named ${t} was already in ${j(e)}`)}else{const t=e.reason??"The node refused this download.";!function(e){return!!e&&/not enough (disk )?space|disk (is )?full|needs [\d.]+ ?[kmgt]?b\b.*\bfree\b/i.test(e)}(t)?!this.dialogOpen&&this.compact||(this.refusal={tone:"err",title:"Refused",body:t}):this.confirm={kind:"space",reason:t}}}clearStarting(){this.starting?.silence&&window.clearTimeout(this.starting.silence),this.starting=null}emitCount(){this.activeCount.emit({n:Object.values(this.jobs).filter(S).length})}notify(e,t,i,s,o=!1){const a=this.noticeId++;this.notices=[...this.notices.slice(-2),{id:a,kind:e,title:t,detail:i,action:s,sticky:o}],o||this.noticeTimers.set(a,window.setTimeout((()=>this.dismiss(a)),6e3))}dismiss(e){const t=this.noticeTimers.get(e);t&&(window.clearTimeout(t),this.noticeTimers.delete(e)),this.notices=this.notices.filter((t=>t.id!==e))}showRetrying(){this.tab="retrying",this.drawerOpen=!0}async openFetch(e){void 0!==e&&e!==this.browsingPath&&(this.browsingPath=e),this.drawerOpen=!0,this.unread=0,this.dialogOpen=!0,this.refusal=null,this.askWhere()}async toggleDrawer(e){this.drawerOpen=e??!this.drawerOpen,this.drawerOpen&&(this.unread=0)}async jobForPath(e){const t=Object.values(this.jobs).find((t=>!_(t.state)&&"Cancelled"!==t.state&&function(e){return`${R(j(e),e.name)}.phirepass-part`}(t)===e));return t?{download_id:t.download_id,name:t.name}:null}async deleteDownload(e,t=!1){const i=this.jobs[e];i&&this.sendDelete(i,t)}async torrentPathFor(e){const t=this.caps?.folder;if(!t||!this.caps?.torrents||!/\.torrent$/i.test(e)||F(this.caps,this.name,this.canConfigure))return null;const i=t.endsWith("/")?t:`${t}/`;return e.startsWith(i)?e.slice(i.length):null}async startTorrentPath(e,t=!1){const i=await this.torrentPathFor(e),s=this.ch;if(null===i||!c(s))return!1;const o=this.nextMsgId();this.starting={msgId:o,askedName:i.split("/").pop()?.replace(/\.torrent$/i,"")};const a=i.includes("/")?i.slice(0,i.lastIndexOf("/")):null;return s.send_download_start(this.nodeId,{TorrentPath:{path:i}},a,null,t,{source_auth:null,ignore_window:!1},o),this.drawerOpen=!0,!0}nextMsgId(){return this.msgId=this.msgId>=4294967280?p:this.msgId+1,this.msgId}browsing(){return this.compact&&this.browsingService&&this.browsingPath?{service_id:this.browsingService,path:this.browsingPath}:null}askWhere(){const e=this.browsing(),t=this.ch;e&&c(t)&&"ready"===this.connection&&(this.whereMsgId=this.nextMsgId(),t.send_download_where(this.nodeId,e,this.whereMsgId))}destination(){if(this.browsing())return this.where?this.where.mapped?{path:this.where.saves_to}:{path:this.where.saves_to,hint:`This folder is outside ${this.name}'s download folder. The file will be saved to ${this.where.saves_to}.`}:{path:this.browsingPath,hint:"Asking the node where this lands…"};const e=this.caps?.folder;return e?{path:R(e,this.subDir)}:null}formReady(){return!(this.starting||"ready"!==this.connection||this.browsing()&&!this.where)}async pickTorrent(e){const t=function(e){const t=function(e){return/\.torrent$/i.test(e.name)?e.size>2097152?{ok:!1,reason:"too-large"}:{ok:!0}:{ok:!1,reason:"not-torrent"}}(e);return t.ok?{name:e.name,size:e.size}:{name:e.name,size:e.size,error:t.reason}}(e);t.error||(t.contents=new Uint8Array(await e.arrayBuffer())),this.form={...this.form,torrent:t,text:"",order:null},this.refusal=null}start(e=!1){const t=I(this.form,this.caps,this.formReady()),i=function(e){const t={source_auth:null,ignore_window:!1};if(e.torrent)return!e.torrent.contents||e.torrent.error?null:{source:{TorrentFile:{name:e.torrent.name,contents:e.torrent.contents}},inOrder:"in"===e.order,options:t};const i=w(e.text);if("magnet"===i.kind)return{source:{Magnet:{uri:i.uri}},inOrder:"in"===e.order,options:t};if("http"===i.kind||"torrent-url"===i.kind){const s=e.authOpen?k(e.auth):{auth:null};if("error"in s&&s.error)return null;const o=e.saveAs.trim();return{source:{Http:{url:i.url,save_as:o||null}},inOrder:!0,options:{...t,source_auth:s.auth}}}return null}(this.form),s=this.ch;if(!t.canStart||!i||!c(s))return;if(t.isTorrent&&!this.torrentAcked&&!e)return void(this.confirm={kind:"torrent",dontAsk:!1});const o=this.nextMsgId(),a=t.askedName??(this.form.torrent?this.form.torrent.name.replace(/\.torrent$/i,""):"magnet"===t.detected.kind?function(e){const t=/urn:btih:([a-z0-9]+)/i.exec(e);if(!t)return e.length>40?`${e.slice(0,37)}…`:e;const i=t[1];return`magnet:?xt=urn:btih:${i.slice(0,4)}…${i.slice(-4)}`}(t.detected.uri):void 0);this.starting={msgId:o,askedName:a},this.refusal=null;const n=this.browsing();s.send_download_start(this.nodeId,i.source,n?null:this.subDir,n,i.inOrder,i.options,o)}closeDialog(e=!1){this.dialogOpen=!1,this.refusal=null,e&&(this.form=C,this.drawerOpen=!0)}sendStop(e,t){const i=this.ch;c(i)&&i.send_download_stop(e.download_id,t,this.nextMsgId())}sendDelete(e,t){const i=this.ch;c(i)&&(i.send_download_delete(e.download_id,t,this.nextMsgId()),this.jobs={...this.jobs,[e.download_id]:{...e,deleting:!0}})}actions={play:e=>this.playRow(e),pause:e=>this.sendStop(e,!1),resume:(e,t=!1)=>{const i=this.ch;c(i)&&i.send_download_resume(e.download_id,t,this.nextMsgId())},stop:e=>this.confirm={kind:"stop",row:e,discard:!1},remove:e=>{"Completed"===e.state||"Seeding"===e.state||"Stopped"===e.state?this.confirm={kind:"delete",row:e,deleteFile:!1}:this.sendDelete(e,!1)},setOrder:(e,t)=>{t||this.player?.downloadId!==e.download_id?this.sendOrder(e,t):this.confirm={kind:"fastest",row:e}},showInFolder:e=>this.showInFolder.emit({path:j(e),name:e.name})};sendOrder(e,t){const i=this.ch;c(i)&&i.send_download_set_order(e.download_id,t,this.nextMsgId())}playRow(e){const t=T(e);if(!t.play||!t.file)return;const i=(s=this.streamBase||this.defaultStreamBase(),o=this.nodeId,a=e.download_id,n=t.file.index,`${s.replace(/\/+$/,"")}/api/web/stream/${encodeURIComponent(o)}/${encodeURIComponent(a)}/${n}`);var s,o,a,n;!this.play.emit({src:i,name:t.file.name,downloadId:e.download_id}).defaultPrevented&&this.inlinePlayer&&(this.player={src:i,name:t.file.name,downloadId:e.download_id})}clearFinished(){Object.values(this.jobs).filter(z).forEach((e=>this.sendDelete(e,!1)))}canPickFolder(){return!!this.caps?.folder&&"function"==typeof this.ch?.send_download_folders}listFolders(e){const t=this.nextMsgId();this.picker={path:e,folders:null,msgId:t,newName:null},this.ch?.send_download_folders?.(this.nodeId,e.length?e.join("/"):null,t)}savePicker(){if(!this.picker)return;const e=[...this.picker.path],t=this.picker.newName?.trim();t&&e.push(t),this.subDir=e.length?e.join("/"):null,this.picker=null}renderConfirm(){const t=this.confirm;if(!t)return null;const i=()=>this.confirm=null;switch(t.kind){case"stop":return e(L,{row:t.row,discard:t.discard,onDiscard:e=>this.confirm={...t,discard:e},onCancel:i,onConfirm:()=>{this.sendStop(t.row,t.discard),this.confirm=null}});case"delete":return e(U,{row:t.row,nodeName:this.name,deleteFile:t.deleteFile,onDeleteFile:e=>this.confirm={...t,deleteFile:e},onCancel:i,onConfirm:()=>{this.sendDelete(t.row,t.deleteFile),this.confirm=null}});case"fastest":return e(G,{row:t.row,onCancel:i,onConfirm:()=>{this.player=null,this.sendOrder(t.row,!1),this.confirm=null}});case"torrent":return e(J,{nodeName:this.name,dontAsk:t.dontAsk,onDontAsk:e=>this.confirm={...t,dontAsk:e},onCancel:i,onConfirm:()=>{t.dontAsk&&(function(){try{window.localStorage.setItem(ue,"1")}catch{}}(),this.torrentAcked=!0),this.confirm=null,this.start(!0)}});case"space":return e(O,{reason:t.reason,onClose:i})}}renderForm(t){const i=this.caps?F(this.caps,this.name,this.canConfigure):null,s=()=>this.openNodeSettings.emit({nodeId:this.nodeId});if(i)return"dialog"===t?e("div",{class:"dlg"},e("div",{class:"dlg-h"},e(Z,{name:"fetch"}),e("h4",null,"Fetch into this folder")),e(pe,{blocker:i,onAction:s,onClose:()=>this.closeDialog()})):e(pe,{blocker:i,onAction:s});const o=I(this.form,this.caps,this.formReady());return e(q,{form:this.form,model:o,caps:this.caps,layout:t,title:this.browsing()?"Fetch into this folder":"Add download",destination:"dialog"===t||this.browsing()?this.destination():null,starting:!!this.starting,refusal:this.refusal,onChange:e=>{this.form={...this.form,...e},("text"in e||"torrent"in e)&&(this.refusal=null)},onAuth:e=>this.form={...this.form,auth:{...this.form.auth,...e}},onPickTorrent:e=>{this.pickTorrent(e)},onStart:()=>this.start(),onCancel:()=>this.closeDialog()})}renderRows(t){const i=t.filter((e=>"Downloading"===e.state)).length;return e("div",{class:"jobs",role:"list"},function(e){return[...e].sort(((e,t)=>$[e.state]-$[t.state]||(t.finished_at??t.started_at)-(e.finished_at??e.started_at)))}(t).map((t=>e(ie,{row:t,actions:this.actions,running:i,compact:this.compact}))))}renderStatus(){switch(this.connection){case"unsupported":return e(he,null);case"signed-out":return e(le,{onSignIn:()=>this.signIn.emit()});case"unreachable":return e(de,{nodeName:this.name,onRetry:()=>this.reconnect()});case"connecting":return e(ce,null);default:return null}}renderCompact(){const t=Object.values(this.jobs),i=A(t),s=this.renderStatus();if("unsupported"===this.connection)return null;const o=t.some(z),a=!this.drawerOpen&&(i.active>0||this.unread>0),n=[`${i.active} active`,null===i.percent||this.drawerOpen?"":`${Math.round(i.percent)}%`,y(i.downBps)].filter(Boolean).join(" · ");return[this.drawerOpen&&e("section",{class:"drawer","aria-label":"Transfers"},e("div",{class:"drawer-h"},e("h4",null,"Transfers"),e("span",{class:"sum"},n),e("span",{class:"sp"}),o&&e("button",{type:"button",class:"lnk",onClick:()=>this.clearFinished()},"Clear finished"),e("button",{type:"button",class:"ib","aria-label":"Collapse transfers",title:"Collapse",onClick:()=>this.drawerOpen=!1},e(Z,{name:"chevron",size:12}))),e("div",{class:"drawer-b"},s??(t.length?this.renderRows(t):e(ne,null)))),a&&e("button",{type:"button",class:"strip","aria-label":"Show transfers",onClick:()=>this.toggleDrawer(!0)},e("h4",null,"Transfers"),e("span",{class:"bar"},e("i",{style:{width:`${i.percent??0}%`}})),e("span",{class:"sum"},this.unread&&!i.active?`${this.unread} finished`:n),e(Z,{name:"up",size:12})),this.dialogOpen&&e(H,{label:"Fetch into this folder",onClose:()=>this.closeDialog()},s&&"ready"!==this.connection?e("div",{class:"dlg"},s,e("div",{class:"dlg-f"},e("button",{type:"button",class:"btn",onClick:()=>this.closeDialog()},"Close"))):this.renderForm("dialog"))]}renderStandalone(){const t=this.renderStatus(),i=Object.values(this.jobs),s={active:[],finished:[],retrying:[]};i.forEach((e=>{return s[(t=e,"Retrying"===t.state?"retrying":D.has(t.state)?"active":"finished")].push(e);var t}));const o=A(i),a=s[this.tab],n=this.caps?.folder?R(this.caps.folder,this.subDir):null;return e("section",{class:"standalone"},e("header",{class:"sa-head"},e("div",{class:"sa-title"},e("h3",null,"Downloads"),e("span",{class:"node"},this.name),o.downBps>0&&e("span",{class:"sum"},y(o.downBps))),n&&e("span",{class:"saving"},"saving to ",e("code",null,n),this.caps&&this.caps.folder_free_bytes>0&&e("span",{class:"free"}," · ",m(this.caps.folder_free_bytes)," free"))),t??[e("div",{class:"sa-add"},this.renderForm("inline"),n&&!F(this.caps,this.name,this.canConfigure)&&e("div",{class:"sa-dest"},e("span",{class:"dest"},e(Z,{name:"folder",size:14}),e("span",null,n)),this.canPickFolder()&&e("button",{type:"button",class:"btn",onClick:()=>this.listFolders(this.subDir?this.subDir.split("/"):[])},"Choose folder…"))),e("div",{class:"tabs",role:"tablist","aria-label":"Downloads"},[["active","Active"],["finished","Finished"],["retrying","Retrying"]].map((([t,i])=>e("button",{type:"button",role:"tab","aria-selected":this.tab===t?"true":"false",class:{on:this.tab===t},onClick:()=>this.tab=t},i,e("b",null,s[t].length))))),"finished"===this.tab&&s.finished.length>0&&e("div",{class:"tab-h"},e("span",null,s.finished.length," finished"),s.finished.some(z)&&e("button",{type:"button",class:"lnk",onClick:()=>this.clearFinished()},"Clear finished")),a.length?this.renderRows(a):0===i.length?e(re,{nodeName:this.name,folder:n}):e("div",{class:"muted pad"},"retrying"===this.tab?"Nothing is retrying.":"finished"===this.tab?"Nothing has finished yet.":"Nothing is running.")])}render(){return e(o,{key:"6a7316df730c5bc4bc588f7d05e19033d98a9d0a",class:{compact:this.compact,standalone:!this.compact}},this.compact?this.renderCompact():this.renderStandalone(),this.renderConfirm(),this.picker&&e(V,{key:"412dc8107ea30420f022a49f188ea020eabd46f5",root:this.caps?.folder??"",path:this.picker.path,folders:this.picker.folders,error:this.picker.error,newName:this.picker.newName,onOpen:e=>this.listFolders([...this.picker.path,e]),onUp:e=>this.listFolders(this.picker.path.slice(0,e)),onNewName:e=>this.picker={...this.picker,newName:e},onCancel:()=>this.picker=null,onSave:()=>this.savePicker()}),this.player&&e("div",{key:"61bc6c3ab32346d87c0ed02280182fdae234eb71",class:"overlay player"},e("phirepass-media-player",{key:"59d99ac6289a146ba106e9cb8682d5f7b4383e26",src:this.player.src,name:this.player.name,status:this.playerStatus(),ready:this.playerReady(),positionKey:`dl:${this.player.downloadId}`,onPhirepassPlayerClose:()=>this.player=null})),e(oe,{key:"fa27f16c8f72435939e51b48d92b6f10b0535d80",notices:this.notices,onDismiss:e=>this.dismiss(e)}))}playerRow(){return this.player?this.jobs[this.player.downloadId]:void 0}playerStatus(){const e=this.playerRow();if(!e)return this.player?"On the node":void 0;if(_(e.state))return"On the node";const t=e.total_bytes?` · ${(e.done_bytes/e.total_bytes*100).toFixed(1)}%`:"";return`${"Downloading"===e.state?"Downloading":e.state}${t}`}playerReady(){const e=this.playerRow();if(!e||_(e.state))return;const t=T(e);return t.file?.ready_from_start}static get watchers(){return{channel:[{onChannel:0}],connected:[{onConnected:0}],browsingPath:[{onBrowsing:0}],browsingService:[{onBrowsing:0}],nodeId:[{onNode:0}]}}};be.style=":host{--card:220 18% 10%;--bg:216 18% 7%;--border:220 15% 18%;--primary:160 60% 45%;--primary-foreground:220 20% 7%;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:215 10% 52%;--foreground:210 20% 90%;--amber:38 75% 55%;--blue:206 72% 63%;--radius:0.375rem;display:block;color:hsl(var(--foreground));font-family:ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;font-size:13px;line-height:1.45;container-type:inline-size}:host(.standalone){position:relative;height:100%;background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:var(--radius);overflow:auto}:host(.compact){flex:none}*{box-sizing:border-box}button{font:inherit;color:inherit;cursor:pointer}button:disabled{cursor:not-allowed}:focus-visible{outline:2px solid hsl(var(--primary));outline-offset:2px}.hidden-input{display:none}.mono,code,.stats,.sum,.inp,.dest,.detect .host{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace}code{font-size:12px}.muted{color:hsl(var(--muted-foreground))}.pad{padding:18px 14px}.ib{width:28px;height:28px;display:inline-grid;place-items:center;border-radius:4px;border:1px solid transparent;background:transparent;color:hsl(var(--muted-foreground));flex:none;padding:0}.ib:hover:not(:disabled){background:hsl(var(--muted));color:hsl(var(--foreground))}.ib:disabled{opacity:0.4}.ib.new{color:hsl(var(--primary));border-color:hsl(var(--primary) / 0.55);background:hsl(var(--primary) / 0.12)}.btn{border-radius:4px;padding:7px 14px;font-size:12px;font-weight:600;border:1px solid hsl(var(--border));background:hsl(var(--muted));white-space:nowrap;display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:hsl(var(--foreground))}.btn:hover:not(:disabled){border-color:hsl(var(--muted-foreground))}.btn.pri{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground))}.btn.dng{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:#fff}.btn:disabled{opacity:0.45}.lnk{background:none;border:0;color:hsl(var(--muted-foreground));font-size:11px;padding:2px 4px;display:inline-flex;align-items:center;gap:4px}.lnk:hover{color:hsl(var(--foreground))}.lnk.inline{color:hsl(var(--primary));padding:0}.pill{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;padding:2px 7px;border-radius:3px;white-space:nowrap;flex:none}.pill.dl{background:hsl(var(--primary) / 0.18);color:hsl(var(--primary))}.pill.meta,.pill.sd{background:hsl(var(--blue) / 0.18);color:hsl(var(--blue))}.pill.mv{background:hsl(var(--amber) / 0.18);color:hsl(var(--amber))}.pill.ok{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}.pill.err{background:hsl(var(--destructive) / 0.2);color:hsl(var(--destructive))}.pill.ps,.pill.q{background:hsl(var(--muted));color:hsl(var(--muted-foreground))}.bar{display:block;height:5px;border-radius:3px;background:hsl(var(--muted));overflow:hidden;position:relative}.bar i{display:block;height:100%;background:hsl(var(--primary));border-radius:3px;transition:width 0.6s linear}.bar.indet i{width:30% !important;animation:slide 1.3s ease-in-out infinite;background:hsl(var(--blue))}.bar.paused i{background:hsl(var(--muted-foreground))}.bar.fail i{background:hsl(var(--destructive))}.bar.moving i{background:hsl(var(--amber))}.bar.seed i{background:hsl(var(--blue))}@keyframes slide{0%{transform:translateX(-100%)}100%{transform:translateX(340%)}}.jobs{display:flex;flex-direction:column}.job{display:grid;grid-template-columns:28px minmax(0, 1fr) auto;gap:4px 10px;padding:10px 12px;border-bottom:1px solid hsl(var(--border) / 0.6);align-items:center}.job:last-child{border-bottom:0}.job .kind{grid-row:span 3;align-self:start;width:28px;height:28px;border-radius:6px;display:grid;place-items:center;background:hsl(var(--muted));color:hsl(var(--muted-foreground))}.job .kind.t{color:hsl(var(--blue))}.job .kind.h{color:hsl(var(--primary))}.job .kind.n{color:hsl(var(--amber))}.job .title{display:flex;gap:8px;align-items:center;min-width:0}.job .title .nm{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.job .acts{display:flex;gap:2px;grid-row:1;grid-column:3}.job .bar,.job .stats{grid-column:2 / 4}.stats{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:11px;color:hsl(var(--muted-foreground));font-variant-numeric:tabular-nums}.stats b{color:hsl(var(--foreground));font-weight:500}.stats .err{color:hsl(var(--destructive))}.job[data-state='Deleting']{opacity:0.6}.drawer{border-top:1px solid hsl(var(--border));background:hsl(var(--bg));display:flex;flex-direction:column;max-height:min(46vh, 380px)}.drawer-h{display:flex;align-items:center;gap:10px;padding:6px 12px;border-bottom:1px solid hsl(var(--border));flex:none}.drawer-h h4,.strip h4{margin:0;font-size:12px;font-weight:600;letter-spacing:0.04em;text-transform:uppercase}.sum{color:hsl(var(--muted-foreground));font-size:11px;font-variant-numeric:tabular-nums}.sp{flex:1}.drawer-b{overflow:auto;min-height:0}.strip{display:flex;align-items:center;gap:10px;padding:7px 12px;border:0;border-top:1px solid hsl(var(--border));background:hsl(var(--bg));width:100%;text-align:left}.strip .bar{flex:1 1 120px}.overlay{position:absolute;inset:0;background:rgba(5, 7, 9, 0.6);display:grid;place-items:center;padding:14px;z-index:20}:host(.standalone) .overlay{position:fixed}.modal{width:min(100%, 420px);max-height:100%;overflow:auto;background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:8px;box-shadow:0 20px 50px -10px rgba(0, 0, 0, 0.7)}.modal.wide{width:min(100%, 480px)}.dlg,.fetch-form.dialog{padding:16px;display:flex;flex-direction:column;gap:14px}.dlg h4,.dlg-h h4{margin:0;font-size:14px;font-weight:600}.dlg-h{display:flex;align-items:center;gap:10px;color:hsl(var(--primary))}.dlg-h h4{color:hsl(var(--foreground))}.dlg-f{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}.dlg-f .left{margin-right:auto}.dtx{margin:0;font-size:13px}.hint{font-size:11px;color:hsl(var(--muted-foreground));margin:0}.hint.block{display:block;margin-top:2px}.hint.err{color:hsl(var(--destructive))}.hint.where{color:hsl(var(--amber))}.fld{display:flex;flex-direction:column;gap:6px;min-width:0}.fld>label,.fld>span:first-child,legend{font-size:11px;text-transform:uppercase;letter-spacing:0.05em;color:hsl(var(--muted-foreground))}.inp{width:100%;min-width:0;background:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:4px;color:hsl(var(--foreground));padding:8px 10px;font-size:12px}.inp:focus{outline:none;border-color:hsl(var(--primary))}.inline-row{display:flex;gap:8px;align-items:stretch}.detect{display:flex;align-items:center;gap:8px;font-size:12px;color:hsl(var(--muted-foreground));min-height:20px;min-width:0}.detect .host{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.note{display:flex;gap:8px;align-items:flex-start;font-size:12px;line-height:1.45;padding:8px 10px;border-radius:4px;border:1px solid hsl(var(--border));background:hsl(var(--muted))}.note svg{flex:none;margin-top:2px}.note.err{border-color:hsl(var(--destructive) / 0.5)}.note.err svg{color:hsl(var(--destructive))}.note.warn{border-color:hsl(var(--amber) / 0.5)}.note.warn svg{color:hsl(var(--amber))}.note.info svg{color:hsl(var(--primary))}.or{display:flex;align-items:center;gap:10px;color:hsl(var(--muted-foreground));font-size:11px;text-transform:uppercase;letter-spacing:0.06em}.or::before,.or::after{content:'';flex:1;height:1px;background:hsl(var(--border))}.drop{border:1px dashed hsl(var(--border));border-radius:6px;padding:14px;display:flex;align-items:center;gap:12px;color:hsl(var(--muted-foreground));font-size:12px;background:transparent;text-align:left}.drop svg{color:hsl(var(--blue));flex:none}.drop b{color:hsl(var(--foreground));font-weight:500}.filechip{display:flex;gap:10px;align-items:center;padding:10px;border:1px solid hsl(var(--border));border-radius:4px;background:hsl(var(--muted))}.filechip>svg{color:hsl(var(--blue));flex:none}.filechip>div{flex:1;min-width:0}.filechip b{display:block;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filechip span{color:hsl(var(--muted-foreground));font-size:11px}.filechip.bad{border-color:hsl(var(--destructive) / 0.55)}.filechip.bad>svg{color:hsl(var(--destructive))}.dest-row,.sa-dest{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.dest{display:flex;align-items:center;gap:8px;background:hsl(var(--bg));border:1px solid hsl(var(--border));border-radius:4px;padding:7px 10px;font-size:12px;min-width:0;flex:1 1 200px}.dest span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dest svg{color:hsl(var(--primary));flex:none}fieldset.order{border:0;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}fieldset.order legend{margin-bottom:6px}.opt{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border:1px solid hsl(var(--border));border-radius:4px;font-size:12px;cursor:pointer}.opt.on{border-color:hsl(var(--primary));background:hsl(var(--primary) / 0.08)}.opt input,.checkline input,.seg input{accent-color:hsl(var(--primary));margin:2px 0 0}.checkline{display:flex;gap:8px;align-items:flex-start;font-size:12px;cursor:pointer}.login{display:flex;flex-direction:column;gap:8px}.login>.lnk{align-self:flex-start;padding-left:0}.auth{display:flex;flex-direction:column;gap:10px;padding:10px;border:1px solid hsl(var(--border));border-radius:4px}.seg{display:flex;flex-wrap:wrap;gap:6px}.seg label{display:flex;gap:6px;align-items:center;font-size:11px;padding:4px 8px;border:1px solid hsl(var(--border));border-radius:999px;cursor:pointer}.seg label.on{border-color:hsl(var(--primary));color:hsl(var(--primary))}.seg input{margin:0}.crumbs{display:flex;flex-wrap:wrap;align-items:center;gap:2px;font-family:ui-monospace, SFMono-Regular, Menlo, monospace}.crumbs .lnk{font-size:12px}.crumbs .sep{color:hsl(var(--muted-foreground))}.folders{display:flex;flex-direction:column;border:1px solid hsl(var(--border));border-radius:4px;max-height:220px;overflow:auto}.folders .muted{padding:10px}.folder-row{display:flex;align-items:center;gap:8px;padding:7px 10px;border:0;border-bottom:1px solid hsl(var(--border) / 0.6);background:transparent;text-align:left;font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:12px}.folder-row:hover{background:hsl(var(--muted))}.folder-row svg{color:hsl(var(--primary))}.blocker{display:flex;flex-direction:column;gap:10px}.empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:30px 20px}.empty>svg{color:hsl(var(--muted-foreground))}.empty b{font-size:14px;font-weight:600}.empty span{color:hsl(var(--muted-foreground));font-size:12px;max-width:44ch}.spin{width:22px;height:22px;border-radius:50%;border:3px solid hsl(var(--border));border-top-color:hsl(var(--primary));animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.standalone{display:flex;flex-direction:column;min-height:100%}.sa-head{padding:14px 16px 10px;display:flex;flex-direction:column;gap:4px}.sa-title{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}.sa-title h3{margin:0;font-size:16px;font-weight:600}.sa-title .node{color:hsl(var(--muted-foreground))}.saving{font-size:12px;color:hsl(var(--muted-foreground))}.sa-add{padding:0 16px 14px;display:flex;flex-direction:column;gap:10px;border-bottom:1px solid hsl(var(--border))}.fetch-form.inline{display:flex;flex-direction:column;gap:10px}.tabs{display:flex;gap:4px;padding:0 10px;border-bottom:1px solid hsl(var(--border));overflow-x:auto}.tabs button{padding:9px 10px;font-size:12px;color:hsl(var(--muted-foreground));border:0;border-bottom:2px solid transparent;background:none;white-space:nowrap}.tabs button.on{color:hsl(var(--foreground));border-bottom-color:hsl(var(--primary))}.tabs b{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-weight:500;color:hsl(var(--muted-foreground));margin-left:6px}.tab-h{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;font-size:12px;color:hsl(var(--muted-foreground));border-bottom:1px solid hsl(var(--border) / 0.6)}.toasts{position:absolute;left:12px;right:12px;bottom:12px;display:flex;flex-direction:column;gap:8px;z-index:30;pointer-events:none;align-items:flex-end}:host(.standalone) .toasts{position:sticky;margin:12px}.toast{pointer-events:auto;display:flex;gap:10px;align-items:center;padding:10px 12px;background:hsl(var(--bg));border:1px solid hsl(var(--primary) / 0.5);border-radius:6px;width:min(100%, 420px);box-shadow:0 12px 30px -12px rgba(0, 0, 0, 0.7)}.toast>svg{color:hsl(var(--primary));flex:none}.toast.bad{border-color:hsl(var(--destructive) / 0.55)}.toast.bad>svg{color:hsl(var(--destructive))}.toast .t{flex:1;min-width:0}.toast .t b{display:block;font-weight:600}.toast .t span{color:hsl(var(--muted-foreground));font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}.overlay.player{padding:10px}.overlay.player phirepass-media-player{width:min(100%, 880px)}@container (max-width: 480px){.job{padding:9px 10px}.job .title .pill.meta{display:none}.inline-row{flex-wrap:wrap}.inline-row .inp{flex-basis:100%}.inline-row .btn.pri{flex:1;justify-content:center}.stats{gap:2px 10px}}@media (prefers-reduced-motion: reduce){.bar i{transition:none}.bar.indet i{animation:none;width:100% !important;opacity:0.5}.spin{animation:none}}";const ge={mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",mkv:"video/x-matroska",mov:"video/quicktime",mp3:"audio/mpeg",m4a:"audio/mp4",flac:"audio/flac",ogg:"audio/ogg",oga:"audio/ogg",opus:"audio/ogg",wav:"audio/wav"};function fe(e){return ge[function(e){const t=/\.([a-z0-9]+)$/i.exec(e);return t?t[1].toLowerCase():""}(e)]??"application/octet-stream"}function me(e,t){return function(e,t){return!(!Number.isFinite(t)||t<=0)&&(e>=.95*t||t-e<=120)}(e,t)?"clear":e<30?"skip":"save"}const ye="phirepass.player.position.",ve={async get(e){try{const t=window.localStorage.getItem(ye+e);if(!t)return null;const i=JSON.parse(t);return"number"==typeof i?.secs?i:null}catch{return null}},async set(e,t,i){try{window.localStorage.setItem(ye+e,JSON.stringify({secs:t,duration:i,at:Date.now()}))}catch{}},async clear(e){try{window.localStorage.removeItem(ye+e)}catch{}}},xe=class{constructor(e){new.target===xe&&t(this,e),this.playerClose=i(this,"phirepassPlayerClose")}get el(){return s(this)}media;lastSave=0;resumeAt=0;everPlayed=!1;positionPrompted=!1;availabilityId;onRemoteConnect=()=>this.phase="casting";onRemoteDisconnect=()=>{"casting"===this.phase&&(this.phase=this.everPlayed?"playing":"buffering")};src;name;mime;status;ready;positionStore;positionKey;remotePlayback;castDevice;playerClose;phase="buffering";stored=null;castAvailable=!1;currentTime=0;duration=0;get store(){return this.positionStore??ve}get audio(){return(this.mime??fe(this.name)).startsWith("audio/")}async componentWillLoad(){if(this.positionKey){const e=await this.store.get(this.positionKey).catch((()=>null));e&&"save"===me(e.secs,e.duration)&&(this.stored=e,this.positionPrompted=!0,this.phase="prompt")}}componentDidLoad(){this.watchRemote()}disconnectedCallback(){this.savePosition(!0);const e=this.remote();e&&(e.removeEventListener("connect",this.onRemoteConnect),e.removeEventListener("disconnect",this.onRemoteDisconnect),void 0!==this.availabilityId&&e.cancelWatchAvailability(this.availabilityId).catch((()=>{})))}onSrc(){this.everPlayed=!1,this.phase="buffering"}async close(){await this.savePosition(!0),this.media?.pause?.(),this.playerClose.emit()}remote(){return this.remotePlayback??this.media?.remote}async watchRemote(){const e=this.remote();if(e&&!this.audio){e.addEventListener("connect",this.onRemoteConnect),e.addEventListener("disconnect",this.onRemoteDisconnect),"connected"===e.state&&(this.phase="casting");try{this.availabilityId=await e.watchAvailability((e=>this.castAvailable=e))}catch{this.castAvailable=!0}}}async savePosition(e=!1){const t=this.media;if(!t||!this.positionKey||!this.everPlayed)return;const i=Date.now();if(!e&&i-this.lastSave<1e4)return;this.lastSave=i;const s=me(t.currentTime,t.duration);"save"===s?await this.store.set(this.positionKey,t.currentTime,t.duration).catch((()=>{})):"clear"===s&&await(this.store.clear?.(this.positionKey).catch((()=>{})))}startAt(e){this.stored=null,this.phase="buffering",this.resumeAt=e;const t=this.media;t&&(e>0&&(t.currentTime=e),t.play?.()?.catch?.((()=>{})))}retry(){const e=this.media,t=e?.currentTime||this.resumeAt;this.phase="buffering",e&&(e.load?.(),this.startAt(t))}onError(){const e=this.media?.error?.code;this.phase=2===e?"stopped":"unsupported"}bindMedia(e){e&&e!==this.media&&(this.media=e)}renderStage(){switch(this.phase){case"prompt":return e("div",{class:"stage-msg","data-phase":"prompt"},e("b",null,"Resume from ",x(this.stored.secs),"?"),e("span",null,"You stopped here on ",function(e){const t=new Date(e);return`${t.getDate()} ${t.toLocaleString("en-GB",{month:"short"})}`}(this.stored.at),". ",x(this.stored.duration)," in total."),e("div",{class:"row"},e("button",{type:"button",class:"btn",onClick:()=>this.startAt(0)},"Start over"),e("button",{type:"button",class:"btn pri",onClick:()=>this.startAt(this.stored.secs)},"Resume")));case"buffering":return e("div",{class:"stage-msg overlay-msg","data-phase":"buffering"},e("span",{class:"spin","aria-hidden":"true"}),e("b",null,"Buffering"),void 0!==this.ready&&e("span",null,m(this.ready)," ready from the start"));case"waiting":return e("div",{class:"stage-msg overlay-msg","data-phase":"waiting"},e("span",{class:"spin","aria-hidden":"true"}),e("b",null,"Waiting for this part to download"),e("span",null,"You skipped ahead of what the node has. Playback resumes by itself."));case"unsupported":return e("div",{class:"stage-msg","data-phase":"unsupported"},e(Z,{name:"warn",size:28}),e("b",null,"This browser cannot play this format"),e("span",null,"The download is not affected. Download the file to play it in another app."),e("a",{class:"btn pri",href:this.src,download:this.name},"Download file"));case"stopped":return e("div",{class:"stage-msg","data-phase":"stopped"},e(Z,{name:"signal",size:28}),e("b",null,"Playback stopped"),e("span",null,"The connection to the node was lost."),e("button",{type:"button",class:"btn pri",onClick:()=>this.retry()},"Try again"));case"casting":return e("div",{class:"stage-msg","data-phase":"casting"},e(Z,{name:"cast",size:28}),e("b",null,"Playing on ",this.castDevice??"your TV"),e("span",null,"The TV reads the file from the node. You can close this tab."),e("span",{class:"clock"},x(this.currentTime)," / ",x(this.duration)),e("button",{type:"button",class:"btn",onClick:()=>{this.remote()?.prompt().catch((()=>{}))}},"Stop casting"));default:return null}}render(){const t=this.audio,i=function(e,t){const i=t??fe(e);return"video/x-matroska"===i?"TVs cannot play MKV files. Download it and play it with VLC.":"video/quicktime"===i?"TVs cannot play MOV files.":null}(this.name,this.mime),s="function"==typeof this.media?.webkitShowPlaybackTargetPicker,a={ref:e=>this.bindMedia(e),src:this.src,controls:!0,preload:"prompt"===this.phase?"metadata":"auto",autoplay:!this.positionPrompted,playsInline:!0,class:{hidden:"prompt"===this.phase||"unsupported"===this.phase||"stopped"===this.phase||"casting"===this.phase},onCanPlay:()=>{"buffering"!==this.phase&&"waiting"!==this.phase||(this.phase="playing")},onPlaying:()=>{this.everPlayed=!0,"casting"!==this.phase&&(this.phase="playing")},onWaiting:()=>{"playing"===this.phase&&(this.phase=this.everPlayed?"waiting":"buffering")},onTimeUpdate:e=>{this.currentTime=e.target.currentTime,this.savePosition()},onDurationChange:e=>this.duration=e.target.duration||0,onPause:()=>{this.savePosition(!0)},onError:()=>this.onError()};return e(o,{key:"941b4e81590e1144fc0bd424f4a5156ca047624d",class:{audio:t}},e("header",{key:"c1866c6dce284c49a17918c6d0e86d132ea9824a",class:"bar"},e("span",{key:"645cf1ec23df722e4b479e2d0b9f78aad9c339f1",class:"nm",title:this.name},this.name),this.status&&e("span",{key:"db77564456be6b4b52b78c709041924b97b930fc",class:"pill"},this.status),e("span",{key:"4f3203babb8f002bf3b783947a01ff6b06cfdb13",class:"sp"}),!t&&(this.castAvailable||i)&&e("button",{key:"3174885867db39af25d328d1bf69879e2e9e5ea5",type:"button",class:"ib",disabled:!!i,title:i??"Cast","aria-label":i?`Cast unavailable: ${i}`:"Cast",onClick:()=>{this.remote()?.prompt().catch((()=>{}))}},e(Z,{key:"c36b4847aa20e6b37da23b8b124bc5a679fcfdf1",name:"cast",size:15})),!t&&s&&e("button",{key:"7f1932ac452b57518c608e4723329dac0b9c5698",type:"button",class:"ib",title:"AirPlay","aria-label":"AirPlay",onClick:()=>this.media.webkitShowPlaybackTargetPicker()},e(Z,{key:"6814c32ae5b0276260164131f7d017ce24c5063d",name:"cast",size:15})),e("button",{key:"dfcf1c345b01bd30f8274e637e03a0a7e97a0bb8",type:"button",class:"ib","aria-label":"Close player",title:"Close",onClick:()=>{this.close()}},e(Z,{key:"2d056a662ae56d4e70ff90cd08ab05cb6c2cf386",name:"x",size:14}))),e("div",{key:"bd610362589f488b395081ae4d12b06da92e8372",class:{stage:!0,audio:t},"data-phase":this.phase},e(t?"audio":"video",{...a}),this.renderStage()))}static get watchers(){return{src:[{onSrc:0}]}}};function we(e){return e.endsWith(".phirepass-part")}xe.style=":host{--card:220 18% 10%;--bg:216 18% 7%;--border:220 15% 18%;--primary:160 60% 45%;--primary-foreground:220 20% 7%;--muted:220 15% 13%;--muted-foreground:215 10% 52%;--foreground:210 20% 90%;--amber:38 75% 55%;display:flex;flex-direction:column;background:hsl(var(--card));color:hsl(var(--foreground));border:1px solid hsl(var(--border));border-radius:8px;overflow:hidden;font-family:ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;font-size:13px;line-height:1.45;box-shadow:0 20px 50px -10px rgba(0, 0, 0, 0.7)}*{box-sizing:border-box}button,a.btn{font:inherit;color:inherit;cursor:pointer}:focus-visible{outline:2px solid hsl(var(--primary));outline-offset:2px}.bar{display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid hsl(var(--border));min-width:0}.nm{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.pill{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;padding:2px 7px;border-radius:3px;white-space:nowrap;background:hsl(var(--primary) / 0.18);color:hsl(var(--primary));flex:none}.sp{flex:1}.ib{width:28px;height:28px;display:inline-grid;place-items:center;border-radius:4px;border:1px solid transparent;background:transparent;color:hsl(var(--muted-foreground));padding:0;flex:none}.ib:hover:not(:disabled){background:hsl(var(--muted));color:hsl(var(--foreground))}.ib:disabled{opacity:0.4;cursor:not-allowed}.btn{border-radius:4px;padding:7px 14px;font-size:12px;font-weight:600;border:1px solid hsl(var(--border));background:hsl(var(--muted));text-decoration:none;display:inline-flex;align-items:center}.btn.pri{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground))}.stage{position:relative;background:#000;min-height:220px;display:grid}.stage.audio{min-height:0;background:hsl(var(--bg));padding:14px}.stage>video,.stage>audio{grid-area:1 / 1;width:100%;max-height:70vh;display:block}.stage>audio{align-self:center}.stage>.hidden{visibility:hidden}.stage-msg{grid-area:1 / 1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:8px;padding:22px;z-index:1}.stage.audio .stage-msg{padding:8px}.overlay-msg{background:rgba(0, 0, 0, 0.55);pointer-events:none}.stage-msg>svg{color:hsl(var(--amber))}.stage-msg[data-phase='casting']>svg{color:hsl(var(--primary))}.stage-msg b{font-size:14px;font-weight:600}.stage-msg span{color:hsl(var(--muted-foreground));font-size:12px;max-width:44ch}.stage-msg .clock{font-family:ui-monospace, SFMono-Regular, Menlo, monospace;font-variant-numeric:tabular-nums}.stage-msg .row{display:flex;gap:8px;margin-top:4px}.spin{width:26px;height:26px;border-radius:50%;border:3px solid hsl(var(--border));border-top-color:hsl(var(--primary));animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion: reduce){.spin{animation:none}}";const ke=/\.(mp4|m4v|webm|mkv|mov|mp3|m4a|flac|ogg|oga|opus|wav)$/i;function Ce(e){const t=e.replace(/\/{2,}/g,"/");return t.length>1?t.replace(/\/+$/,""):t}function Ie(e,t){return Ce(e)===Ce(t)}const Me=({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(Z,{name:"fetch",size:14}),t>0&&e("span",{class:"badge","aria-label":`${t} active`},t)),_e=({name:t,busy:i,onCancel:s,onConfirm:o})=>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:o,disabled:i},"Delete download")))),De=({menu:t,onFetch:i,onDownload:s,onRename:o,onDelete:a,onClose:n})=>e("div",{class:"context-backdrop",onClick:n,onContextMenu:e=>(e.preventDefault(),n())},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(Z,{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:o},"Rename"),e("button",{type:"button",role:"menuitem",class:"danger",onClick:a},"Delete"))),Se=class{constructor(e){new.target===Se&&t(this,e),this.maximizeEvent=i(this,"maximize"),this.connectionStateChanged=i(this,"connectionStateChanged")}get el_host(){return s(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 c(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){Ie(function(e){return Ce(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],Ie(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 new 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 a(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.cancel_active_upload(),this.cancel_active_download(),this.clear_pending_operations(),this.close_comms()}next_msg_id(){const e=this.msgId;return this.msgId+=1,e}clear_pending_operations(){this.pendingUploadStarts.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Upload start aborted"))})),this.pendingUploadStarts.clear(),this.pendingUploadAcks.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Upload chunk aborted"))})),this.pendingUploadAcks.clear(),this.pendingDownloadStarts.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error("Download start aborted"))})),this.pendingDownloadStarts.clear(),this.pendingOps.forEach((e=>{window.clearTimeout(e.timeout),e.reject(new Error(`Could not ${e.verb}: the session ended.`))})),this.pendingOps.clear(),this.activeDownloads.clear()}cancel_active_upload(){this.activeUploadToken+=1,this.upload_progress=0,this.upload_finished=!1,this.upload_speed="--"}cancel_active_download(){void 0!==this.activeDownloadMsgId&&this.activeDownloads.delete(this.activeDownloadMsgId),this.activeDownloadMsgId=void 0,this.download_progress=0,this.download_finished=!1,this.download_speed="--"}format_duration(e){if(!Number.isFinite(e)||e<0)return"--";if(e<60)return`${e.toFixed(0)}s`;const t=Math.floor(e/60),i=Math.floor(e%60);return t<60?`${t}m ${i}s`:`${Math.floor(t/60)}h ${t%60}m`}format_percent(e){return`${(Number.isFinite(e)?e:0).toFixed(2)}%`}format_transfer_rate(e){return!Number.isFinite(e)||e<=0?"--":`${this.format_size(e)}/s`}update_upload_progress(e,t,i){if(this.upload_progress=Math.max(0,Math.min(100,t>0?e/t*100:0)),e>=t)return this.upload_finished=!0,void(this.upload_speed="--");const s=(performance.now()-i)/1e3,o=s>0?e/s:0;this.upload_speed=this.format_transfer_rate(o);const a=o>0?(t-e)/o:NaN;this.status=`Uploading ${this.format_size(e)} / ${this.format_size(t)} (ETA ${this.format_duration(a)})`}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,o=s>0?e/s:0;this.download_speed=this.format_transfer_rate(o);const a=o>0?(t-e)/o:NaN;this.status=`Downloading ${this.format_size(e)} / ${this.format_size(t)} (ETA ${this.format_duration(a)})`}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const e=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${e}://${this.serverHost}`:`${e}://${this.serverHost}:${this.serverPort}`:`${e}://${this.serverHost}`}handle_error(e){if(void 0!==e.msg_id){const t=this.pendingUploadStarts.get(e.msg_id);t&&(window.clearTimeout(t.timeout),t.reject(new Error(e.message||"Upload start failed")),this.pendingUploadStarts.delete(e.msg_id));const i=this.pendingDownloadStarts.get(e.msg_id);i&&(window.clearTimeout(i.timeout),i.reject(new Error(e.message||"Download start failed")),this.pendingDownloadStarts.delete(e.msg_id)),this.activeDownloads.has(e.msg_id)&&(this.activeDownloads.delete(e.msg_id),this.activeDownloadMsgId===e.msg_id&&(this.activeDownloadMsgId=void 0),this.download_finished=!1);const s=this.pendingOps.get(e.msg_id);if(s)return window.clearTimeout(s.timeout),this.pendingOps.delete(e.msg_id),s.reject(new Error(e.message||`Could not ${s.verb}.`)),void(this.show_loader=!1)}switch(e.kind){case l.Generic:case l.Authentication:this.error_message=e.message||"An unknown error occurred.",this.show_error=!0;break;case l.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case l.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case l.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"}),o=URL.createObjectURL(s),a=document.createElement("a");a.href=o,a.download=t.filename,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o),this.activeDownloads.delete(e),this.activeDownloadMsgId===e&&(this.activeDownloadMsgId=void 0),this.download_finished=!0,this.status="Connected"}handle_download_chunk(e){if(void 0===e.msg_id)return;const t=this.activeDownloads.get(e.msg_id);if(!t||!this.session_id)return;const i=new Uint8Array(e.chunk.data);t.chunks.set(e.chunk.chunk_index,i);const s=Array.from(t.chunks.values()).reduce(((e,t)=>e+t.length),0);this.update_download_progress(s,t.total_size,t.startTime),this.channel.send_sftp_download_ack(this.nodeId,this.session_id,t.download_id,e.chunk.chunk_index),t.chunks.size>=t.total_chunks&&this.finalize_download(e.msg_id)}async start_download(e){if(!this.session_id)return;this.selected_item=e,this.download_file_name=e.name,this.download_progress=0,this.download_finished=!1,this.download_speed="--",this.show_download_modal=!0,this.show_error=!1;const t=this.next_msg_id();this.activeDownloadMsgId=t,this.activeDownloads.set(t,{filename:e.name,chunks:new Map,total_chunks:0,total_size:0,download_id:0,startTime:Date.now()});const i=new Promise(((e,i)=>{const s=window.setTimeout((()=>{this.pendingDownloadStarts.delete(t),i(new Error("Download start timeout"))}),1e4);this.pendingDownloadStarts.set(t,{timeout:s,resolve:e,reject:i})}));try{this.channel.send_sftp_download_start(this.nodeId,this.session_id,e.path,e.name,t);const{download_id:s,total_chunks:o,total_size:a}=await i,n=this.activeDownloads.get(t);if(!n)return;n.download_id=s,n.total_chunks=o,n.total_size=a}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)),o=this.next_msg_id(),a=new Promise(((e,t)=>{const i=window.setTimeout((()=>{this.pendingUploadStarts.delete(o),t(new Error("Upload start timeout"))}),1e4);this.pendingUploadStarts.set(o,{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),o);const n=await a;let r=0;const l=performance.now();for(let o=0;o<s;o+=1){if(t!==this.activeUploadToken)throw new Error("Upload cancelled");const s=o*i,a=Math.min(s+i,e.size),d=new Uint8Array(await e.slice(s,a).arrayBuffer());await new Promise(((e,t)=>{const i=`${n}_${o}`,s=window.setTimeout((()=>{this.pendingUploadAcks.delete(i),t(new Error(`Upload chunk ${o+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,n,o,d.length,d,null)})),r+=d.length,this.update_upload_progress(r,e.size,l)}this.upload_progress=100,this.upload_finished=!0,this.status="Connected",this.refresh_directory()}catch(e){"Upload cancelled"!==e.message&&(this.show_error=!0,this.error_message=e instanceof Error?e.message:"Upload failed"),this.upload_finished=!1,this.status="Connected"}}handle_op_result(e){if(void 0===e.msg_id)return;const t=this.pendingOps.get(e.msg_id);t&&(window.clearTimeout(t.timeout),this.pendingOps.delete(e.msg_id),t.resolve(e.result))}run_op(e,t,i=3e4){if(!this.session_id)return Promise.reject(new Error("No active SFTP session."));const s=this.next_msg_id();return new Promise(((o,a)=>{const n=window.setTimeout((()=>{this.pendingOps.delete(s),a(new Error(`Timed out trying to ${e}. This node's agent may be too old to support it.`))}),i);this.pendingOps.set(s,{verb:e,timeout:n,resolve:o,reject:a});try{t(s)}catch(e){window.clearTimeout(n),this.pendingOps.delete(s),a(e instanceof Error?e:new Error(String(e)))}}))}error_text(e){return e instanceof Error?e.message:String(e)}item_path(e){return this.join_path(e.path,e.name)}join_path(e,t){return e&&"/"!==e?e.endsWith("/")?`${e}${t}`:`${e}/${t}`:`/${t}`}invalid_name(e){return e?"."===e||".."===e?"That name is reserved.":e.includes("/")?'A name cannot contain "/".':e.includes("\0")?"A name cannot contain a null byte.":"":"Enter a name."}handle_tunnel_data(e){console.log("received tunnel data:",e)}handle_tunnel_closed(e){this.clear_creds_buffer(),this.close_comms()}open_comms(){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 n(e,this.nodeId,this.serverId):new n(e,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([d.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([d.Disconnected]),this.status="Disconnected",this.channel_ready=!1})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([d.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:t}=e.data;if(b(t)||t.type===r.Error&&(t.msg_id??0)>=p)this.downloaderEl?.receive(e);else switch(t.type){case r.Error:this.handle_error(t);break;case r.AuthSuccess:this.handle_auth_success(t);break;case r.TunnelOpened:this.handle_tunnel_opened(t);break;case r.TunnelClosed:this.handle_tunnel_closed(t);break;case r.TunnelData:this.handle_tunnel_data(t);break;case r.SFTPListItems:this.handle_sftp_list_items(t);break;case r.SFTPUploadStartResponse:this.handle_upload_start_response(t);break;case r.SFTPUploadChunkAck:this.handle_upload_chunk_ack(t);break;case r.SFTPDownloadStartResponse:this.handle_download_start_response(t);break;case r.SFTPDownloadChunk:this.handle_download_chunk(t);break;case r.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&&we(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 new Error("The agent answered without any file contents.");const t=this.decode_text(e.contents instanceof Uint8Array?e.contents:new Uint8Array(e.contents));this.editor_text=t,this.editor_saved_text=t,this.editor_loaded=!0,this.editor_busy="",this.status="Connected"}catch(e){this.editor_busy="",this.editor_error=this.error_text(e),this.status="Connected"}}decode_text(e){if(e.includes(0))throw new Error("This looks like a binary file. Download it instead of editing it here.");try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{throw new Error("This file is not valid UTF-8. Download it instead of editing it here.")}}editor_is_dirty(){return this.editor_loaded&&this.editor_text!==this.editor_saved_text}close_editor(e=!1){"saving"!==this.editor_busy&&(e||!this.editor_is_dirty()?(this.show_editor=!1,this.editor_confirm_discard=!1,this.editor_loaded=!1,this.editorPath="",this.editor_name="",this.editor_text="",this.editor_saved_text="",this.editor_error="",this.editor_busy="",this.editorTextEl=void 0):this.editor_confirm_discard=!0)}async save_editor(){if(this.editor_busy||!this.session_id||!this.editorPath)return;const e=this.editorPath,t=this.editor_text;this.editor_busy="saving",this.editor_error="",this.show_error=!1,this.status=`Saving ${this.editor_name}...`;try{await this.run_op("save the file",(i=>this.channel.send_sftp_write_file(this.nodeId,this.session_id,e,(new TextEncoder).encode(t),i)),6e4),this.editor_saved_text=t,this.editor_busy="",this.status="Connected",this.refresh_directory()}catch(e){this.editor_busy="",this.editor_error=this.error_text(e),this.status="Connected"}}toggle_sort(e){this.sort_key!==e?(this.sort_key=e,this.sort_asc=!0):this.sort_asc=!this.sort_asc}visible_listing(){const e=this.filter.trim().toLowerCase(),t=e?this.listing.filter((t=>t.name.toLowerCase().includes(e))):[...this.listing],i=this.sort_asc?1:-1;return t.sort(((e,t)=>{if(e.kind!==t.kind)return"Folder"===e.kind?-1:1;switch(this.sort_key){case"size":return i*((e.attributes.size??0)-(t.attributes.size??0));case"modified":return i*((e.attributes.modified??0)-(t.attributes.modified??0));default:return i*e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"})}}))}sort_indicator(e){return this.sort_key!==e?"":this.sort_asc?" ▲":" ▼"}on_listing_keydown(e){if(this.prompt_kind||this.chmod_target||this.show_editor||this.show_delete_modal)return;const t=this.selected_item;switch(e.key){case"Backspace":e.preventDefault(),this.go_to_parent_directory();break;case"F5":e.preventDefault(),this.refresh_directory();break;case"F2":t&&(e.preventDefault(),this.on_rename_action(t,e));break;case"Delete":t&&(e.preventDefault(),this.on_file_delete_action(t,e));break;case"Enter":t&&(e.preventDefault(),this.list_directory(t))}}on_modal_keydown(e,t){"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),t())}focus_once(e,t,i){e&&e!==t&&(i(e),requestAnimationFrame((()=>e.focus())))}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(e){const t=e.target,i=t.files?.[0];i&&(this.upload_file(i),t.value="")}cancel_upload(){this.cancel_active_upload(),this.show_upload_modal=!1,this.upload_file_name="",this.upload_speed="--",this.status="Connected",this.refresh_directory()}cancel_download(){this.cancel_active_download(),this.show_download_modal=!1,this.download_file_name="",this.download_speed="--",this.status="Connected",this.refresh_directory()}is_selected(e){return!!this.selected_item&&this.selected_item.path===e.path&&this.selected_item.name===e.name}list_directory(e){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===e.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=e);const t=this.item_path(e);t!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,t)):console.warn("Already in this directory. Ignoring click.")}format_size(e){if(void 0===e||Number.isNaN(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB","PB"];let i=e,s=-1;for(;i>=1024&&s<t.length-1;)i/=1024,s+=1;return`${i.toFixed(i>=10?1:2)} ${t[s]}`}mode_type_to_char(e,t){switch(61440&e){case 49152:return"s";case 40960:return"l";case 32768:return"-";case 24576:return"b";case 16384:return"d";case 8192:return"c";case 4096:return"p";default:return"Folder"===t?"d":"-"}}format_permissions(e,t){if(null==e)return"-";if("string"==typeof e){const i=e.trim();if(/^[bcdlps-][rwxStTs-]{9}$/.test(i))return i;if(/^[0-7]{3,4}$/.test(i)){const e=parseInt(i,8);return this.format_permissions(e,t)}if(/^\d+$/.test(i)){const e=parseInt(i,10);return this.format_permissions(e,t)}return i||"-"}const i=e,s=this.mode_type_to_char(i,t),o=[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&&(o[2]="x"===o[2]?"s":"S"),1024&i&&(o[5]="x"===o[5]?"s":"S"),512&i&&(o[8]="x"===o[8]?"t":"T"),`${s}${o.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(Me,{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)=>{return e("tr",{key:i,class:{selected:this.is_selected(t),part:"File"===t.kind&&we(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&&ke.test(s=t.name)&&!we(s)&&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"}))))));var s})),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(_e,{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(De,{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}]}}};Se.style=":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;container-type:inline-size;.listing{height:100%;display:flex;flex-direction:column;justify-content:space-between;min-height:0;header{height:30px;background:rgba(28, 31, 38, 0.6);border-bottom:1px solid hsl(var(--border));display:flex;align-items:center;justify-content:space-between;.actions{display:flex;align-items:center;.action{cursor:pointer;padding:4px;display:flex;align-items:center;z-index:1;img{height:14px;padding:4px;border-radius:4px}&:hover{background-color:hsl(var(--border) / 0.6)}}}.title{color:hsl(var(--primary));height:14px;padding:0 12px;display:flex;align-items:center;font-size:0.75rem;line-height:1rem;img{height:14px;margin-right:5px}.text{display:flex;flex-direction:row;justify-content:center;margin-top:2px;.name{margin-right:10px}.description{color:hsl(var(--muted-foreground))}}}}main{flex:1;display:flex;flex-direction:column;position:relative;min-height:0;overflow:hidden;.loader{color:hsl(var(--muted-foreground));font-size:13px;animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;width:100%;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.error{font-size:13px;text-align:center;color:hsl(var(--destructive));height:100%;display:flex;align-items:center;justify-content:center}.navigation{height:25px;padding:10px;font-size:0.75rem;line-height:1rem;background-color:hsl(var(--card));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid hsl(var(--border));position:sticky;top:0;z-index:3;.breadcrumbs{display:flex;align-items:center;margin-right:10px;.breadcrumb-container{white-space:nowrap;.breadcrumb{color:hsl(var(--primary));margin-right:4px;cursor:pointer;&:after{margin-left:4px}&:hover{color:rgb(189, 219, 209)}&:last-child{margin-right:0;color:rgb(189, 219, 209);cursor:default}}}.arrow{height:12px;width:12px;opacity:0.6;top:2px;margin-right:4px;position:relative}}.actions{display:flex;align-items:center;gap:8px}.filter{height:1.5rem;width:110px;padding:0 6px;font:inherit;font-size:0.68rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&::placeholder{color:hsl(var(--muted-foreground))}&:focus{border-color:hsl(var(--primary))}}.action{border:none;background:transparent;color:rgb(189, 219, 209);font-size:1.1rem;line-height:1;padding:2px 4px;border-radius:4px;cursor:pointer;&:hover{background-color:hsl(var(--border) / 0.6)}img{height:14px;width:14px;display:block}}.action.disconnect{color:#ff4d5f;font-size:0.65rem;letter-spacing:0.08em;padding:4px 8px;&:hover{color:#ff6b7a;background-color:hsl(var(--destructive) / 0.12)}}}.content{flex:1;min-height:0;outline:none;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&:focus-visible{box-shadow:inset 0 0 0 1px hsl(var(--primary) / 0.5)}&::-webkit-scrollbar{width:10px;height:10px}&::-webkit-scrollbar-track{background:hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb{background:hsl(var(--scroll-thumb));border-radius:999px;border:2px solid hsl(var(--scroll-track))}&::-webkit-scrollbar-thumb:hover{background:hsl(var(--scroll-thumb-hover))}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:auto;thead{background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));th.sortable{cursor:pointer;user-select:none;&:hover{color:hsl(var(--primary))}}th{padding:8px 10px;text-align:left;color:hsl(var(--muted-foreground));position:sticky;top:0;z-index:2;background-color:hsl(var(--muted));border-bottom:1px solid hsl(var(--border));line-height:0.95rem;&.action-col{width:58px;min-width:58px;padding:0 10px}&:first-child{width:30%;min-width:180px;max-width:195px}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap;width:1%}}}tbody{padding:10px 10px;tr.empty{cursor:default;td{color:hsl(var(--muted-foreground));text-align:center;padding:18px 8px}&:hover{background:transparent}}tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&:first-child{min-width:180px;max-width:195px;white-space:nowrap;.name{display:inline-block;max-width:calc(100% - 26px);overflow:hidden;text-overflow:ellipsis;vertical-align:middle}}&:nth-child(2),&:nth-child(3),&:nth-child(4),&:nth-child(5){white-space:nowrap}&.action-col{width:58px;min-width:58px;text-align:center;padding-left:1px;padding-right:1px;.file-actions{display:flex;align-items:center;justify-content:center;gap:8px}.file-action{border:none;background:transparent;color:hsl(var(--muted-foreground));width:16px;height:16px;border-radius:3px;cursor:pointer;opacity:0;visibility:hidden;pointer-events:none;transition:opacity 120ms ease;padding:0;svg{width:12px;height:12px;display:block;margin:0 auto}&:hover{color:hsl(var(--primary))}&.delete:hover{color:hsl(var(--destructive))}}}.name{&.file{color:rgb(189, 219, 209)}&.folder{color:hsl(var(--primary))}}.kind{height:14px;width:14px;margin-right:5px;top:3px;position:relative}}&:hover{cursor:pointer;background-color:hsl(var(--muted) / 0.4);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;color:hsl(var(--primary))}}&.selected{background-color:hsl(var(--primary) / 0.3);td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto}&:hover{background-color:hsl(var(--primary) / 0.4)}}}}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border));font-size:0.75rem;line-height:1rem;display:flex;align-items:center;justify-content:space-between;padding:0 10px;.status{font-size:0.65rem;color:hsl(var(--muted-foreground));.selected-item{margin-left:10px;color:hsl(var(--primary))}}.version{font-size:0.65rem;color:hsl(var(--muted-foreground))}}}.creds{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;justify-content:center;align-items:center;;&.blurred{background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px)}.auth{display:flex;flex-direction:column;background:hsl(var(--card));position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:30px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;border-radius:var(--radius);.title{margin-bottom:12px;color:hsl(var(--primary))}label{font-size:0.75rem;line-height:1rem;margin-bottom:1rem;color:hsl(var(--muted-foreground))}input{font-size:0.875rem;line-height:1.25rem;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;background-color:rgb(28, 31, 38);border-color:rgb(39, 44, 53);border-width:1px;border-radius:calc(var(--radius) - 2px);width:100%;margin-bottom:12px;color:rgb(189, 219, 209);box-sizing:border-box;&:focus{outline:none;border-color:hsl(var(--primary));box-shadow:0 0 0 1px hsl(var(--primary))}}button[type='submit']{margin-top:12px;width:100%;background-color:hsl(var(--primary));color:hsl(var(--primary-foreground));letter-spacing:0.05em;font-size:13px;font-weight:500;padding:0.5rem 1rem;border-radius:calc(var(--radius) - 2px);height:2rem;cursor:pointer;border:none;&:hover{background-color:hsl(var(--primary) / 0.9)}}}}.upload-modal,.download-modal,.delete-modal,.prompt-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:6;&.visible{display:flex}.upload-dialog,.download-dialog,.delete-dialog,.prompt-dialog{width:min(360px, calc(100% - 24px));background-color:rgba(21, 24, 30, 0.96);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px}.file-name{color:rgb(189, 219, 209);font-size:0.72rem;line-height:1rem;margin-bottom:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.progress-track{width:100%;height:10px;border-radius:999px;background-color:hsl(var(--muted));overflow:hidden;border:1px solid hsl(var(--border));.progress-fill{height:100%;width:0;background:linear-gradient(90deg, hsl(var(--primary) / 0.7), hsl(var(--primary)));transition:width 140ms ease}}.progress-meta{margin-top:8px;margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:10px}.progress-speed{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:left}.progress-value{color:hsl(var(--muted-foreground));font-size:0.75rem;font-variant-numeric:tabular-nums;line-height:1.4;text-align:right}.cancel{margin-top:14px;width:100%;height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);background:hsl(var(--muted));color:rgb(189, 219, 209);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}&.finished{background-color:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover{background-color:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9);color:hsl(var(--primary-foreground))}}}.message{color:rgb(189, 219, 209);font-size:0.74rem;line-height:1rem;margin-bottom:8px}.modal-actions{margin-top:14px;display:grid;grid-template-columns:1fr 1fr;gap:8px;.btn{height:2rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover{border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white;&:hover{background:hsl(var(--destructive) / 0.9);border-color:hsl(var(--destructive) / 0.9)}}}.dialog-input{width:100%;box-sizing:border-box;height:2rem;padding:0 8px;font:inherit;font-size:0.75rem;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary))}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.hint{margin-top:4px;font-size:0.66rem;line-height:0.9rem;color:hsl(var(--muted-foreground))}.checkline{margin-top:8px;display:flex;align-items:center;gap:6px;font-size:0.72rem;color:rgb(189, 219, 209);cursor:pointer;input{accent-color:hsl(var(--primary));margin:0}}.perm-grid{margin-top:10px;width:100%;border-collapse:collapse;font-size:0.68rem;th{color:hsl(var(--muted-foreground));font-weight:normal;text-align:center;padding:2px 0}th[scope='row']{text-align:left;color:rgb(189, 219, 209)}td{text-align:center;padding:2px 0}input{accent-color:hsl(var(--primary));margin:0}}.perm-special{margin-top:4px;display:flex;gap:12px;.checkline{margin-top:4px;font-size:0.66rem}}.perm-octal{margin-top:10px;display:flex;align-items:center;gap:8px;label{font-size:0.68rem;color:hsl(var(--muted-foreground))}.dialog-input{width:4.5rem;text-align:center;letter-spacing:0.1em}.perm-preview{font-size:0.7rem;color:hsl(var(--primary))}}.modal-actions .btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}.delete-loader{margin-top:4px;display:flex;justify-content:center;.spinner{width:16px;height:16px;border:2px solid hsl(var(--muted-foreground) / 0.35);border-top-color:hsl(var(--primary));border-radius:50%;animation:spin 0.7s linear infinite}}}}.editor-modal{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(28, 31, 38, 0);backdrop-filter:blur(4px);z-index:7;&.visible{display:flex}.editor-dialog{width:min(860px, calc(100% - 24px));height:min(620px, calc(100% - 24px));display:flex;flex-direction:column;background-color:rgba(21, 24, 30, 0.98);border:1px solid hsl(var(--border));border-radius:var(--radius);padding:16px;box-shadow:rgba(0, 0, 0, 0.5) 0px 25px 50px -12px;outline:none;.editor-head{display:flex;align-items:center;justify-content:space-between;gap:8px;.title{color:hsl(var(--primary));font-size:0.8rem;margin-bottom:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.editor-close{border:none;background:transparent;color:hsl(var(--muted-foreground));font-size:0.85rem;line-height:1;padding:2px 6px;border-radius:4px;cursor:pointer;&:hover:not(:disabled){color:hsl(var(--primary));background-color:hsl(var(--border) / 0.6)}&:disabled{opacity:0.5;cursor:not-allowed}}}.editor-loading{flex:1;display:flex;align-items:center;justify-content:center;font-size:0.75rem;color:hsl(var(--muted-foreground))}.editor-text{flex:1;min-height:0;width:100%;box-sizing:border-box;resize:none;padding:10px;font:inherit;font-size:0.75rem;line-height:1.15rem;tab-size:4;white-space:pre;overflow:auto;color:rgb(189, 219, 209);background-color:hsl(var(--muted));border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);outline:none;&:focus{border-color:hsl(var(--primary) / 0.6)}&:disabled{opacity:0.65}}.dialog-error{margin-top:8px;font-size:0.7rem;line-height:0.95rem;color:#ff6b7a}.modal-actions{margin-top:14px;display:flex;justify-content:flex-end;gap:8px;.btn{height:2rem;min-width:6rem;border:1px solid hsl(var(--border));border-radius:calc(var(--radius) - 2px);font-size:0.75rem;letter-spacing:0.03em;cursor:pointer;&:disabled{opacity:0.65;cursor:not-allowed}}.btn.secondary{background:hsl(var(--muted));color:rgb(189, 219, 209);&:hover:not(:disabled){border-color:hsl(var(--primary));color:hsl(var(--primary))}}.btn.destructive{background:hsl(var(--destructive));border-color:hsl(var(--destructive));color:white}.btn.primary{background:hsl(var(--primary));border-color:hsl(var(--primary));color:hsl(var(--primary-foreground));&:hover:not(:disabled){background:hsl(var(--primary) / 0.9);border-color:hsl(var(--primary) / 0.9)}}}}}}@keyframes spin{to{transform:rotate(360deg)}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}@container (max-width: 699px){:host .listing main .content table thead th:nth-child(4),:host .listing main .content table tbody td:nth-child(4){display:none}}@container (max-width: 635px){:host .listing main .content table thead th:nth-child(3),:host .listing main .content table tbody td:nth-child(3){display:none}}@container (max-width: 530px){:host .listing main .content table thead th:nth-child(5),:host .listing main .content table tbody td:nth-child(5){display:none}:host .listing footer .status{display:none}}@container (max-width: 370px){:host .listing main .content table thead th:nth-child(2),:host .listing main .content table tbody td:nth-child(2){display:none}:host .listing main .content table thead th:first-child,:host .listing main .content table tbody td:first-child{width:100%;min-width:0;max-width:none}:host .listing main .content table tbody td:first-child .name{max-width:100%}}@container (max-width: 295px){:host .listing main .content table tbody td:first-child .name{max-width:120px}}@container (max-width: 635px){:host .listing main .content table tbody tr td.action-col .file-action{opacity:1;visibility:visible;pointer-events:auto;width:36px;height:36px;border-radius:8px}:host .listing main .content table tbody tr td.action-col .file-action svg{width:17px;height:17px}:host .listing main .content table thead th.action-col,:host .listing main .content table tbody td.action-col{width:92px;min-width:92px}:host .listing main .content table tbody td.action-col .file-actions{gap:4px}:host .listing main .content table tbody tr:hover{background-color:transparent}:host .listing main .content table tbody tr.selected:hover{background-color:hsl(var(--primary) / 0.3)}:host .listing main .content table tbody td{padding:13px 10px 12px}:host .listing main .content table thead th{padding:12px 10px}:host .listing main .navigation{height:auto;min-height:44px;padding:6px 8px}:host .listing main .navigation .action{padding:10px;border-radius:8px}:host .listing main .navigation .action img{height:17px;width:17px}:host .listing main .navigation .action.disconnect{padding:10px 12px}:host .listing main .navigation .filter{height:2.25rem;font-size:16px;width:8rem}:host .listing header .actions .action{padding:8px}:host .listing header .actions .action img{height:17px}:host .modal .upload-dialog .cancel,:host .modal .download-dialog .cancel,:host .modal .delete-dialog .cancel,:host .modal .prompt-dialog .cancel,:host .modal .upload-dialog .modal-actions .btn,:host .modal .download-dialog .modal-actions .btn,:host .modal .delete-dialog .modal-actions .btn,:host .modal .prompt-dialog .modal-actions .btn{height:2.75rem}:host .modal .prompt-dialog .dialog-input,:host .auth input{height:2.5rem;font-size:16px}:host .modal .prompt-dialog .perm-grid input,:host .modal .prompt-dialog .perm-special input{width:20px;height:20px}:host .modal .prompt-dialog .perm-grid td,:host .modal .prompt-dialog .perm-grid th{padding:7px 0}}: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)}}";export{be as phirepass_downloader,xe as phirepass_media_player,Se as phirepass_sftp_client}
@@ -0,0 +1,3 @@
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],i=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);i&&Object.defineProperty(e,o,{get(){return i.get.call(this)},set(t){i.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>{e&&(t.__stencil__getHostRef=()=>e,e.i=t,512&e.o.u&&n(t,e))},i=(t,e)=>e in t,s=(t,e)=>(0,console.error)(t,e),r=new Map,c=new Map,u=new Map,f="http://www.w3.org/1999/xlink",a="undefined"!=typeof window?window:{},d={u:0,p:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},p=t=>Promise.resolve(t),h=(()=>{try{return!!a.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),v=!!h&&(()=>!!a.document&&Object.getOwnPropertyDescriptor(a.document.adoptedStyleSheets,"length").writable)(),m=!1,y=[],b=[],w=()=>{var t;return(null==(t=a.document)?void 0:t.hidden)?setTimeout(j,16):d.raf(j)},g=(t,e)=>n=>{t.push(n),m||(m=!0,e&&4&d.u?O(j):w())},$=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},j=()=>{$(y),$(b),(m=y.length>0)&&w()},O=t=>p().then(t),S=g(b,!0);function k(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(v?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}function E(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}var M,C=new WeakMap,x=t=>"sc-"+t.h,N=t=>"object"==(t=typeof t)||"function"===t,T=(t,e,...n)=>{let o=null,l=null,i=!1,r=!1;const c=[],u=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))u(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!N(o))o+="";else if("function"!=typeof t&&void 0===o.u){s("Invalid vNode child");continue}i&&r?c[c.length-1].v+=o:c.push(i?A(null,o):o),r=i}};if(u(n),e){e.key&&(l=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}if("function"==typeof t)return t(null===e?{}:e,c,P);const f=A(t,null);return f.m=e,c.length>0&&(f.$=c),f.j=l,f},A=(t,e)=>({u:0,O:t,v:null!=e?e:null,S:null,$:null,m:null,j:null}),L={},P={forEach:(t,e)=>t.map(R).forEach(e),map:(t,e)=>t.map(R).map(e).map(D)},R=t=>({vattrs:t.m,vchildren:t.$,vkey:t.j,vname:t.k,vtag:t.O,vtext:t.v}),D=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),T(t.vtag,e,...t.vchildren||[])}const e=A(t.vtag,t.vtext);return e.m=t.vattrs,e.$=t.vchildren,e.j=t.vkey,e.k=t.vname,e},H=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=!1;for(const o of e){if(n)break;for(const e of t[o])if("string"==typeof e){n=!0;break}}if(!n)return t;const o={};for(const n of e)o[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return o},U=(t,e)=>null==t||N(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,W=t=>{var e;return null==(e=o(t))?void 0:e.$hostElement$},z=(t,e)=>{const n=W(t);return{emit:t=>F(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},F=(t,e,n)=>{const o=d.ce(e,n);return t.dispatchEvent(o),o},V=(t,e,n,l,s,r)=>{if(n===l)return;let c=i(t,e),u=e.toLowerCase();if("class"===e){const e=t.classList,o=I(n);let i=I(l);{let t=o.filter((t=>t&&!i.includes(t)));e.remove(...t),e.add(...i.filter((t=>t&&!o.includes(t))))}}else if("style"===e){for(const e in n)l&&null!=l[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in l)n&&l[e]===n[e]||(e.includes("-")?t.style.setProperty(e,l[e]):t.style[e]=l[e])}else if("key"===e);else if("ref"===e)l&&rt(l,t);else if(c||"o"!==e[0]||"n"!==e[1]){if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let i;{const e=o(t);if(e&&e.o&&e.o.t){const t=e.o.t[n];t&&t[1]&&(i=t[1])}}return i||(i=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==l||!1===l?!1===l&&""!==t.getAttribute(i)||t.removeAttribute(i):t.setAttribute(i,!0===l?"":l))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=l}catch(t){}return}{const o=N(l);if((c||o&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const o=null==l?"":l;"list"===e?c=!1:null!=n&&t[e]===o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}let i=!1;u!==(u=u.replace(/^xlink\:?/,""))&&(e=u,i=!0),null==l||!1===l?(!1!==l||""===t.getAttribute(e)||4&r&&!B(e))&&(i?t.removeAttributeNS(f,e):t.removeAttribute(e)):(!c||4&r||s)&&!o&&1===t.nodeType&&(l=!0===l?"":l,i?t.setAttributeNS(f,e,l):t.setAttribute(e,l))}}else if(e="-"===e[2]?e.slice(3):i(a,u)?u.slice(2):u[2]+e.slice(3),n||l){const o=e.endsWith(Y);e=e.replace(Z,""),n&&d.rel(t,e,n,o),l&&d.ael(t,e,l,o)}},q=new Set(["draggable","contenteditable","spellcheck"]),B=t=>q.has(t)||t.startsWith("aria-"),G=/\s/,I=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(G):[]),Y="Capture",Z=RegExp(Y+"$"),_=(t,e,n)=>{const o=11===e.S.nodeType&&e.S.host?e.S.host:e.S,l=t&&t.m||{},i=e.m||{};for(const t of J(Object.keys(l)))t in i||V(o,t,l[t],void 0,n,e.u);for(const t of J(Object.keys(i)))V(o,t,l[t],i[t],n,e.u)};function J(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var K=!1,Q=!1,X=[],tt=[],et=(t,e,n)=>{const o=e.$[n];let l,i,s=0;if(null!=o.v)l=o.S=a.document.createTextNode(o.v);else{if(Q||(Q="svg"===o.O),!a.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.S=a.document.createElementNS(Q?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.O),Q&&"foreignObject"===o.O&&(Q=!1),_(null,o,Q),o.$){const e="template"===o.O?l.content:l;for(s=0;s<o.$.length;++s)i=et(t,o,s),i&&e.appendChild(i)}"svg"===o.O?Q=!1:"foreignObject"===l.tagName&&(Q=!0)}return l["s-hn"]=M,l},nt=(t,e,n,o,l,i)=>{let s,r=t;for(r.shadowRoot&&r.tagName===M&&(r=r.shadowRoot),"template"===n.O&&(r=r.content);l<=i;++l)o[l]&&(s=et(null,n,l),s&&(o[l].S=s,ct(r,s,e)))},ot=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.S;st(e),t&&t.remove()}}},lt=(t,e,n=!1)=>t.O===e.O&&(n?(n&&!t.j&&e.j&&(t.j=e.j),!0):t.j===e.j),it=(t,e,n=!1)=>{const o=e.S=t.S,l=t.$,i=e.$,s=e.O,r=e.v;null==r?(Q="svg"===s||"foreignObject"!==s&&Q,"slot"!==s||K||t.k!==e.k&&(e.S["s-sn"]=e.k||"",(t=>{d.u|=1;const e=t.closest(M.toLowerCase());if(null!=e){const n=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),o=Array.from(t.__childNodes||t.childNodes);for(const t of n?o.reverse():o)null!=t["s-sh"]&&(ct(e,t,null!=n?n:null),t["s-sh"]=void 0)}d.u&=-2})(e.S.parentElement)),_(t,e,Q),null!==l&&null!==i?((t,e,n,o,l=!1)=>{let i,s,r=0,c=0,u=0,f=0,a=e.length-1,d=e[0],p=e[a],h=o.length-1,v=o[0],m=o[h];const y="template"===n.O?t.content:t;for(;r<=a&&c<=h;)if(null==d)d=e[++r];else if(null==p)p=e[--a];else if(null==v)v=o[++c];else if(null==m)m=o[--h];else if(lt(d,v,l))it(d,v,l),d=e[++r],v=o[++c];else if(lt(p,m,l))it(p,m,l),p=e[--a],m=o[--h];else if(lt(d,m,l))it(d,m,l),ct(y,d.S,p.S.nextSibling),d=e[++r],m=o[--h];else if(lt(p,v,l))it(p,v,l),ct(y,p.S,d.S),p=e[--a],v=o[++c];else{for(u=-1,f=r;f<=a;++f)if(e[f]&&null!==e[f].j&&e[f].j===v.j){u=f;break}u>=0?(s=e[u],s.O!==v.O?i=et(e&&e[c],n,c):(it(s,v,l),e[u]=void 0,i=s.S),v=o[++c]):(i=et(e&&e[c],n,c),v=o[++c]),i&&ct(d.S.parentNode,i,d.S)}r>a?nt(t,null==o[h+1]?null:o[h+1].S,n,o,c,h):c>h&&ot(e,r,a)})(o,l,e,i,n):null!==i?(null!==t.v&&(o.textContent=""),nt(o,null,e,i,0,i.length-1)):!n&&null!==l&&ot(l,0,l.length-1),Q&&"svg"===s&&(Q=!1)):t.v!==r&&(o.data=r)},st=t=>{t.m&&t.m.ref&&X.push((()=>t.m.ref(null))),t.$&&t.$.map(st)},rt=(t,e)=>{tt.push((()=>t(e)))},ct=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),ut=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.M=()=>{e["s-p"].splice(n-1,1),o()})))}},ft=(t,e)=>{if(t.u|=16,4&t.u)return void(t.u|=512);ut(t,t.C);const n=()=>at(t,e);if(!e)return S(n);queueMicrotask((()=>{n()}))},at=(t,e)=>{const n=t.$hostElement$,o=t.i;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return e?(t.N.length&&t.N.forEach((t=>t(n))),l=bt(o,"componentWillLoad",void 0,n)):l=bt(o,"componentWillUpdate",void 0,n),l=dt(l,(()=>bt(o,"componentWillRender",void 0,n))),dt(l,(()=>ht(t,o,e)))},dt=(t,e)=>pt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),pt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,ht=async(t,e,n)=>{var o;const l=t.$hostElement$,i=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.u,l=((t,e)=>{var n,o,l;const i=x(e),s=u.get(i);if(!a.document)return i;if(t=11===t.nodeType?t:a.document,s)if("string"==typeof s){let l,r=C.get(t=t.head||t);if(r||C.set(t,r=new Set),!r.has(i)){l=a.document.createElement("style"),l.textContent=s;const c=null!=(n=d.T)?n:E(a.document);if(null!=c&&l.setAttribute("nonce",c),!(1&e.u))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(h){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(s),v?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=s+e.textContent:t.prepend(l)}else t.append(l);1&e.u&&t.insertBefore(l,null),4&e.u&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),r&&r.add(i)}}else{let e=C.get(t);if(e||C.set(t,e=new Set),!e.has(i)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(s.constructor===n.CSSStyleSheet)o=s;else{o=new n.CSSStyleSheet;for(let t=0;t<s.cssRules.length;t++)o.insertRule(s.cssRules[t].cssText,t)}v?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(i)}}return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);vt(t,e,l,n),i&&(i.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>mt(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.u|=4,e.length=0)}},vt=(t,e,n,o)=>{try{e=e.render(),t.u&=-17,t.u|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.o,i=t.A||A(null,null),s=(t=>t&&t.O===L)(e)?e:T(null,null,e);if(M=o.tagName,l.L&&(s.m=s.m||{},l.L.forEach((([t,e])=>{s.m[e]=o[t]}))),n&&s.m)for(const t of Object.keys(s.m))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.m[t]=o[t]);s.O=null,s.u|=4,t.A=s,s.S=i.S=o.shadowRoot||o,K=!(!(1&l.u)||128&l.u),it(i,s,n),X.forEach((t=>t())),X.length=0,tt.forEach((t=>t())),tt.length=0})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},mt=t=>{const e=t.$hostElement$,n=t.i,o=t.C;bt(n,"componentDidRender",void 0,e),64&t.u?bt(n,"componentDidUpdate",void 0,e):(t.u|=64,wt(e),bt(n,"componentDidLoad",void 0,e),t.P(e),o||yt()),t.R(e),t.M&&(t.M(),t.M=void 0),512&t.u&&O((()=>ft(t,!1))),t.u&=-517},yt=()=>{O((()=>F(a,"appload",{detail:{namespace:"phirepass-widgets"}})))},bt=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t,o)}},wt=t=>t.classList.add("hydrated"),gt=(t,e)=>o(t).l.get(e),$t=(t,e,n,l)=>{const i=o(t);if(!i)return;if(!i)throw Error(`Couldn't find host element for "${l.h}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const r=i.$hostElement$,c=i.l.get(e),u=i.u,f=i.i;if(n=U(n,l.t[e][0]),!(8&u&&void 0!==c||n===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.l.set(e,n),l.D){const t=l.D[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&u||1&l)&&(f?f[o](n,c,e):i.N.push((()=>{i.i[o](n,c,e)})))}catch(t){s(t,r)}}))}if(2&u){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(n,c,e)&&!(16&u))return;16&u||ft(i,!1)}}},jt=(e,n,l)=>{var i,s;const r=e.prototype;{e.watchers&&!n.D&&(n.D=H(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.U&&(n.U=e.serializers);const c=Object.entries(null!=(i=n.t)?i:{});if(c.map((([e,[i]])=>{if(31&i||2&l&&32&i){const{get:s,set:c}=t(r,e)||{};s&&(n.t[e][0]|=2048),c&&(n.t[e][0]|=4096),(1&l||!s)&&Object.defineProperty(r,e,{get(){{if(!(2048&n.t[e][0]))return gt(this,e);const t=o(this);return t?t.i?t.i[e]:gt(this,e):r[e]}},configurable:!0,enumerable:!0}),Object.defineProperty(r,e,{set(t){const s=o(this);if(s){if(c)return void 0===(32&i?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),c.call(this,U(t,i)),void $t(this,e,t=32&i?this[e]:s.$hostElement$[e],n);{if(!(1&l&&4096&n.t[e][0]))return void $t(this,e,t,n);const o=U(t,i);if(s.i){const t=s.i[e];!s.l.get(e)&&t&&s.l.set(e,t),s.i[e]=o,$t(this,e,s.i[e],n)}else s.l.set(e,o)}}}})}else 1&l&&64&i&&Object.defineProperty(r,e,{value(...t){var n;const l=o(this);return null==(n=null==l?void 0:l.W)?void 0:n.then((()=>{var n;return null==(n=l.i)?void 0:n[e](...t)}))}})})),1&l){const t=new Map;r.attributeChangedCallback=function(e,l,i){d.jmp((()=>{var s;const u=t.get(e),f=o(this);if(this.hasOwnProperty(u)&&(i=this[u],delete this[u]),r.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==i)return;if(null==u){const t=null==f?void 0:f.u;if(f&&t&&!(8&t)&&i!==l){const o=f.i,r=null==(s=n.D)?void 0:s[e];null==r||r.forEach((n=>{const[[s,r]]=Object.entries(n);null!=(null==o?void 0:o[s])&&(128&t||1&r)&&o[s].call(o,i,l,e)}))}return}const a=c.find((([t])=>t===u)),d=a?a[1][0]:0,p=4&d;if(512&d&&8&d&&!N(this[u])&&(t=>null==t||!1===t?null:!0===t?"":t+"")(this[u])===i)return;const h=p&&null===i&&void 0===this[u];p&&(i=null!==i&&"false"!==i);const v=Object.getOwnPropertyDescriptor(r,u);h||i===this[u]||null==i&&null==this[u]||v.get&&!v.set||(this[u]=i)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n.D)?s:{}),...c.filter((([t,e])=>31&e[0])).map((([e,o])=>{var l;const i=o[1]||e;return t.set(i,e),512&o[0]&&(null==(l=n.L)||l.push([e,i])),i}))]))}}return e},Ot=async(t,e,n)=>{var o;let l;try{if(!(32&e.u)){if(e.u|=32,e.u&=-1025,n.F){const i=((t,e)=>{var n;const o=t.h.replace(/-/g,"_"),l=t.F;if(!l)return;const i=r.get(l);if(i)return i[o];const u=null!=(n=c.get(l))?n:0,f=[u>0?"s-retry="+u:"",""].filter(Boolean).join("&");
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
3
+ return import(`./${l}.entry.js${f?"?"+f:""}`).then((t=>(c.delete(l),r.set(l,t),t[o])),(t=>{c.set(l,u+1),s(t,e.$hostElement$)}))})(n,e);if(i&&"then"in i){const t=()=>{};l=await i,t()}else l=i;if(!l)throw e.u&=-33,e.V=(null!=(o=e.V)?o:0)+1,e.V<3&&(e.u|=1024),Error(`Constructor for "${n.h}#${e.q}" was not found`);l.isProxied||(n.D=H(l.watchers),n.U=l.serializers,n.H=l.deserializers,jt(l,n,2),l.isProxied=!0);const u=()=>{};e.u|=8;try{new l(e)}catch(e){s(e,t)}e.u&=-9,((t,e)=>{var n;const o=t.i;if(o)for(const[l,[i]]of Object.entries(null!=(n=e.t)?n:{}))if(4096&i&&t.l.has(l)){const e=t.l.get(l);o[l]!==e&&(o[l]=e)}})(e,n),e.u|=128,u(),St(e.i,t)}else l=t.constructor,customElements.whenDefined(t.localName).then((()=>e.u|=128));if(l&&l.style){let t;"string"==typeof l.style&&(t=l.style);const e=x(n);if(!u.has(e)){const o=()=>{};((t,e,n)=>{let o=u.get(t);h&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,u.set(t,o)})(e,t,!!(1&n.u)),o()}}}const i=e.C,f=()=>ft(e,!0);i&&i["s-rc"]?i["s-rc"].push(f):f()}catch(n){s(n,t),e.M&&(e.M(),e.M=void 0),!e.P||1024&e.u||e.P(t)}},St=(t,e)=>{bt(t,"connectedCallback",void 0,e)},kt=(t,e)=>{bt(t,"disconnectedCallback",void 0,e||t)},Et=(t,e={})=>{var n;if(!a.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const l=[],i=e.exclude||[],s=a.customElements,r=a.document.head,c=r.querySelector("meta[charset]"),u=a.document.createElement("style"),f=[];let p,h=!0;if(Object.assign(d,e),d.p=new URL(e.resourcesUrl||"./",a.document.baseURI).href,t.map((t=>{t[1].map((e=>{var n,r;const c={u:e[0],h:e[1],t:e[2],B:e[3]};c.t=e[2],c.L=[],c.D=H(e[4]),c.U=null!=(n=e[5])?n:{},c.H=null!=(r=e[6])?r:{};const u=c.h,a=class extends HTMLElement{"s-p";"s-rc";hasRegisteredEventListeners=!1;constructor(t){if(super(t),((t,e)=>{const n={u:0,$hostElement$:t,o:e,l:new Map,G:new Map};n.W=new Promise((t=>n.R=t)),n.I=new Promise((t=>n.P=t)),t["s-p"]=[],t["s-rc"]=[],n.N=[];const o=n;t.__stencil__getHostRef=()=>o})(t=this,c),1&c.u)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.h}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else k.call(t,c)}connectedCallback(){o(this)&&(this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),p&&(clearTimeout(p),p=null),h?f.push(this):d.jmp((()=>(t=>{if(!(1&d.u)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.u)(null==e?void 0:e.i)?St(e.i,t):1024&e.u?setTimeout((()=>Ot(t,e,n)),1e3):(null==e?void 0:e.I)&&e.I.then((()=>St(e.i,t)));else{e.u|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){ut(e,e.C=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),Ot(t,e,n)}l()}})(this))))}disconnectedCallback(){d.jmp((()=>(async t=>{if(!(1&d.u)){const e=o(t);(null==e?void 0:e.i)?kt(e.i,t):(null==e?void 0:e.I)&&e.I.then((()=>kt(e.i,t)))}C.has(t)&&C.delete(t),t.shadowRoot&&C.has(t.shadowRoot)&&C.delete(t.shadowRoot)})(this))),O((()=>{var t;const e=o(this);if(!e)return;const n=f.findIndex((t=>t===this));n>-1&&f.splice(n,1),(null==(t=null==e?void 0:e.A)?void 0:t.S)instanceof Node&&!e.A.S.isConnected&&delete e.A.S}))}componentOnReady(){var t;return null==(t=o(this))?void 0:t.I}};c.F=t[0],i.includes(u)||s.get(u)||(l.push(u),s.define(u,jt(a,c,1)))}))})),l.length>0&&(u.textContent+=l.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",u.innerHTML.length)){u.setAttribute("data-styles","");const t=null!=(n=d.T)?n:E(a.document);null!=t&&u.setAttribute("nonce",t),r.insertBefore(u,c?c.nextSibling:r.firstChild)}h=!1,f.length?f.map((t=>t.connectedCallback())):d.jmp((()=>p=setTimeout(yt,30)))},Mt=t=>d.T=t;export{L as H,Et as b,z as c,W as g,T as h,p,l as r,Mt as s}
@@ -0,0 +1 @@
1
+ class t{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,s.unregister(this),t}free(){const t=this.__destroy_into_raw();T.__wbg_channel_free(t,0)}authenticate(t,n,e){const r=+(y(e)?Number.MAX_SAFE_INTEGER:e>>>0);let c,o,i,s;try{c=v(t,T.__wbindgen_export,T.__wbindgen_export2),o=F,i=v(n,T.__wbindgen_export,T.__wbindgen_export2),s=F}catch(t){throw i&&T.__wbindgen_export3(i,1*s,1),c&&T.__wbindgen_export3(c,1*o,1),t}T.channel_authenticate(this.__wbg_ptr,c,o,i,s,r)}connect(){T.channel_connect(this.__wbg_ptr)}create_service(t,n,e,r,c,o,i,s,_){const u=+c,a=+(y(_)?Number.MAX_SAFE_INTEGER:_>>>0);let f,b,l,d,h,w,g,p,m,R,A,N,S,O;try{f=v(t,T.__wbindgen_export,T.__wbindgen_export2),b=F,l=v(n,T.__wbindgen_export,T.__wbindgen_export2),d=F,h=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),w=F,g=v(r,T.__wbindgen_export,T.__wbindgen_export2),p=F,m=y(o)?0:v(o,T.__wbindgen_export,T.__wbindgen_export2),R=F,A=y(i)?0:v(i,T.__wbindgen_export,T.__wbindgen_export2),N=F,S=y(s)?0:v(s,T.__wbindgen_export,T.__wbindgen_export2),O=F}catch(t){throw S&&T.__wbindgen_export3(S,1*O,1),A&&T.__wbindgen_export3(A,1*N,1),m&&T.__wbindgen_export3(m,1*R,1),g&&T.__wbindgen_export3(g,1*p,1),h&&T.__wbindgen_export3(h,1*w,1),l&&T.__wbindgen_export3(l,1*d,1),f&&T.__wbindgen_export3(f,1*b,1),t}T.channel_create_service(this.__wbg_ptr,f,b,l,d,h,w,g,p,u,m,R,A,N,S,O,a)}delete_service(t,n,e){const r=+(y(e)?Number.MAX_SAFE_INTEGER:e>>>0);let c,o,i,s;try{c=v(t,T.__wbindgen_export,T.__wbindgen_export2),o=F,i=v(n,T.__wbindgen_export,T.__wbindgen_export2),s=F}catch(t){throw i&&T.__wbindgen_export3(i,1*s,1),c&&T.__wbindgen_export3(c,1*o,1),t}T.channel_delete_service(this.__wbg_ptr,c,o,i,s,r)}disconnect(){T.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==T.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==T.channel_is_disconnected(this.__wbg_ptr)}constructor(t,n,e){let r,c,o,i,_,u;try{r=v(t,T.__wbindgen_export,T.__wbindgen_export2),c=F,o=v(n,T.__wbindgen_export,T.__wbindgen_export2),i=F,_=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),u=F}catch(t){throw _&&T.__wbindgen_export3(_,1*u,1),o&&T.__wbindgen_export3(o,1*i,1),r&&T.__wbindgen_export3(r,1*c,1),t}const a=T.channel_new(r,c,o,i,_,u);return this.__wbg_ptr=a,s.register(this,this.__wbg_ptr,this),this}on_connection_close(t){T.channel_on_connection_close(this.__wbg_ptr,y(t)?0:_(t))}on_connection_error(t){T.channel_on_connection_error(this.__wbg_ptr,y(t)?0:_(t))}on_connection_message(t){T.channel_on_connection_message(this.__wbg_ptr,y(t)?0:_(t))}on_connection_open(t){T.channel_on_connection_open(this.__wbg_ptr,y(t)?0:_(t))}on_protocol_message(t){T.channel_on_protocol_message(this.__wbg_ptr,y(t)?0:_(t))}on_protocol_message_type(t,n){const e=v(t,T.__wbindgen_export,T.__wbindgen_export2);T.channel_on_protocol_message_type(this.__wbg_ptr,e,F,y(n)?0:_(n))}open_rdp_tunnel(t,n,e,r,c){const o=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let i,s,_,u,a,f,b,l;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(n,T.__wbindgen_export,T.__wbindgen_export2),u=F,a=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),f=F,b=y(r)?0:v(r,T.__wbindgen_export,T.__wbindgen_export2),l=F}catch(t){throw b&&T.__wbindgen_export3(b,1*l,1),a&&T.__wbindgen_export3(a,1*f,1),_&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_open_rdp_tunnel(this.__wbg_ptr,i,s,_,u,a,f,b,l,o)}open_sftp_tunnel(t,n,e,r,c){const o=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let i,s,_,u,a,f,b,l;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(n,T.__wbindgen_export,T.__wbindgen_export2),u=F,a=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),f=F,b=y(r)?0:v(r,T.__wbindgen_export,T.__wbindgen_export2),l=F}catch(t){throw b&&T.__wbindgen_export3(b,1*l,1),a&&T.__wbindgen_export3(a,1*f,1),_&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_open_sftp_tunnel(this.__wbg_ptr,i,s,_,u,a,f,b,l,o)}open_ssh_tunnel(t,n,e,r,c){const o=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let i,s,_,u,a,f,b,l;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(n,T.__wbindgen_export,T.__wbindgen_export2),u=F,a=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),f=F,b=y(r)?0:v(r,T.__wbindgen_export,T.__wbindgen_export2),l=F}catch(t){throw b&&T.__wbindgen_export3(b,1*l,1),a&&T.__wbindgen_export3(a,1*f,1),_&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_open_ssh_tunnel(this.__wbg_ptr,i,s,_,u,a,f,b,l,o)}send_sftp_chmod(t,n,e,r,c){const o=+n,i=+r,s=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let _,u,a,f;try{_=v(t,T.__wbindgen_export,T.__wbindgen_export2),u=F,a=v(e,T.__wbindgen_export,T.__wbindgen_export2),f=F}catch(t){throw a&&T.__wbindgen_export3(a,1*f,1),_&&T.__wbindgen_export3(_,1*u,1),t}T.channel_send_sftp_chmod(this.__wbg_ptr,_,u,o,a,f,i,s)}send_sftp_delete(t,n,e,r,c){const o=+n,i=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let s,_,u,a,f,b;try{s=v(t,T.__wbindgen_export,T.__wbindgen_export2),_=F,u=v(e,T.__wbindgen_export,T.__wbindgen_export2),a=F,f=v(r,T.__wbindgen_export,T.__wbindgen_export2),b=F}catch(t){throw f&&T.__wbindgen_export3(f,1*b,1),u&&T.__wbindgen_export3(u,1*a,1),s&&T.__wbindgen_export3(s,1*_,1),t}T.channel_send_sftp_delete(this.__wbg_ptr,s,_,o,u,a,f,b,i)}send_sftp_download_ack(t,n,e,r){const c=+n,o=+e,i=+r,s=v(t,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_download_ack(this.__wbg_ptr,s,F,c,o,i)}send_sftp_download_chunk(t,n,e,r,c){const o=+n,i=+e,s=+r,_=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0),u=v(t,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_download_chunk(this.__wbg_ptr,u,F,o,i,s,_)}send_sftp_download_start(t,n,e,r,c){const o=+n,i=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let s,_,u,a,f,b;try{s=v(t,T.__wbindgen_export,T.__wbindgen_export2),_=F,u=v(e,T.__wbindgen_export,T.__wbindgen_export2),a=F,f=v(r,T.__wbindgen_export,T.__wbindgen_export2),b=F}catch(t){throw f&&T.__wbindgen_export3(f,1*b,1),u&&T.__wbindgen_export3(u,1*a,1),s&&T.__wbindgen_export3(s,1*_,1),t}T.channel_send_sftp_download_start(this.__wbg_ptr,s,_,o,u,a,f,b,i)}send_sftp_list_data(t,n,e,r){const c=+n,o=+(y(r)?Number.MAX_SAFE_INTEGER:r>>>0);let i,s,_,u;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(e,T.__wbindgen_export,T.__wbindgen_export2),u=F}catch(t){throw _&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_send_sftp_list_data(this.__wbg_ptr,i,s,c,_,u,o)}send_sftp_mkdir(t,n,e,r){const c=+n,o=+(y(r)?Number.MAX_SAFE_INTEGER:r>>>0);let i,s,_,u;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(e,T.__wbindgen_export,T.__wbindgen_export2),u=F}catch(t){throw _&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_send_sftp_mkdir(this.__wbg_ptr,i,s,c,_,u,o)}send_sftp_read_file(t,n,e,r){const c=+n,o=+(y(r)?Number.MAX_SAFE_INTEGER:r>>>0);let i,s,_,u;try{i=v(t,T.__wbindgen_export,T.__wbindgen_export2),s=F,_=v(e,T.__wbindgen_export,T.__wbindgen_export2),u=F}catch(t){throw _&&T.__wbindgen_export3(_,1*u,1),i&&T.__wbindgen_export3(i,1*s,1),t}T.channel_send_sftp_read_file(this.__wbg_ptr,i,s,c,_,u,o)}send_sftp_remove(t,n,e,r,c){const o=+n,i=+r,s=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let _,u,a,f;try{_=v(t,T.__wbindgen_export,T.__wbindgen_export2),u=F,a=v(e,T.__wbindgen_export,T.__wbindgen_export2),f=F}catch(t){throw a&&T.__wbindgen_export3(a,1*f,1),_&&T.__wbindgen_export3(_,1*u,1),t}T.channel_send_sftp_remove(this.__wbg_ptr,_,u,o,a,f,i,s)}send_sftp_rename(t,n,e,r,c){const o=+n,i=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let s,_,u,a,f,b;try{s=v(t,T.__wbindgen_export,T.__wbindgen_export2),_=F,u=v(e,T.__wbindgen_export,T.__wbindgen_export2),a=F,f=v(r,T.__wbindgen_export,T.__wbindgen_export2),b=F}catch(t){throw f&&T.__wbindgen_export3(f,1*b,1),u&&T.__wbindgen_export3(u,1*a,1),s&&T.__wbindgen_export3(s,1*_,1),t}T.channel_send_sftp_rename(this.__wbg_ptr,s,_,o,u,a,f,b,i)}send_sftp_upload_chunk(t,n,e,r,c,o,i){const s=+n,_=+e,u=+r,a=+c,f=+(y(i)?Number.MAX_SAFE_INTEGER:i>>>0);let b,l,d,h;try{b=v(t,T.__wbindgen_export,T.__wbindgen_export2),l=F,d=m(o,T.__wbindgen_export),h=F}catch(t){throw d&&T.__wbindgen_export3(d,1*h,1),b&&T.__wbindgen_export3(b,1*l,1),t}T.channel_send_sftp_upload_chunk(this.__wbg_ptr,b,l,s,_,u,a,d,h,f)}send_sftp_upload_start(t,n,e,r,c,o,i){const s=+n,_=+c,u=BigInt.asIntN(64,o),a=+(y(i)?Number.MAX_SAFE_INTEGER:i>>>0);let f,b,l,d,h,w;try{f=v(t,T.__wbindgen_export,T.__wbindgen_export2),b=F,l=v(e,T.__wbindgen_export,T.__wbindgen_export2),d=F,h=v(r,T.__wbindgen_export,T.__wbindgen_export2),w=F}catch(t){throw h&&T.__wbindgen_export3(h,1*w,1),l&&T.__wbindgen_export3(l,1*d,1),f&&T.__wbindgen_export3(f,1*b,1),t}T.channel_send_sftp_upload_start(this.__wbg_ptr,f,b,s,l,d,h,w,_,u,a)}send_sftp_write_file(t,n,e,r,c){const o=+n,i=+(y(c)?Number.MAX_SAFE_INTEGER:c>>>0);let s,_,u,a,f,b;try{s=v(t,T.__wbindgen_export,T.__wbindgen_export2),_=F,u=v(e,T.__wbindgen_export,T.__wbindgen_export2),a=F,f=m(r,T.__wbindgen_export),b=F}catch(t){throw f&&T.__wbindgen_export3(f,1*b,1),u&&T.__wbindgen_export3(u,1*a,1),s&&T.__wbindgen_export3(s,1*_,1),t}T.channel_send_sftp_write_file(this.__wbg_ptr,s,_,o,u,a,f,b,i)}send_ssh_terminal_resize(t,n,e,r,c,o){const i=+n,s=+e,_=+r,u=+c,a=+o,f=v(t,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_ssh_terminal_resize(this.__wbg_ptr,f,F,i,s,_,u,a)}send_ssh_tunnel_data(t,n,e){const r=+n;let c,o,i,s;try{c=v(t,T.__wbindgen_export,T.__wbindgen_export2),o=F,i=v(e,T.__wbindgen_export,T.__wbindgen_export2),s=F}catch(t){throw i&&T.__wbindgen_export3(i,1*s,1),c&&T.__wbindgen_export3(c,1*o,1),t}T.channel_send_ssh_tunnel_data(this.__wbg_ptr,c,o,r,i,s)}start_heartbeat(t){T.channel_start_heartbeat(this.__wbg_ptr,t)}stop_heartbeat(){T.channel_stop_heartbeat(this.__wbg_ptr)}update_service(t,n,e,r,c,o,i,s,_,u){const a=+o,f=+(y(u)?Number.MAX_SAFE_INTEGER:u>>>0);let b,l,d,h,w,g,p,m,R,A,N,S,O,P,U,j;try{b=v(t,T.__wbindgen_export,T.__wbindgen_export2),l=F,d=v(n,T.__wbindgen_export,T.__wbindgen_export2),h=F,w=v(e,T.__wbindgen_export,T.__wbindgen_export2),g=F,p=y(r)?0:v(r,T.__wbindgen_export,T.__wbindgen_export2),m=F,R=v(c,T.__wbindgen_export,T.__wbindgen_export2),A=F,N=y(i)?0:v(i,T.__wbindgen_export,T.__wbindgen_export2),S=F,O=y(s)?0:v(s,T.__wbindgen_export,T.__wbindgen_export2),P=F,U=y(_)?0:v(_,T.__wbindgen_export,T.__wbindgen_export2),j=F}catch(t){throw U&&T.__wbindgen_export3(U,1*j,1),O&&T.__wbindgen_export3(O,1*P,1),N&&T.__wbindgen_export3(N,1*S,1),R&&T.__wbindgen_export3(R,1*A,1),p&&T.__wbindgen_export3(p,1*m,1),w&&T.__wbindgen_export3(w,1*g,1),d&&T.__wbindgen_export3(d,1*h,1),b&&T.__wbindgen_export3(b,1*l,1),t}T.channel_update_service(this.__wbg_ptr,b,l,d,h,w,g,p,m,R,A,a,N,S,O,P,U,j,f)}}Symbol.dispose&&(t.prototype[Symbol.dispose]=t.prototype.free);const n=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(t,n){T.__wasm_bindgen_func_elem_67(t,n)}function r(t,n,e){T.__wasm_bindgen_func_elem_63(t,n,e)}function c(t,n,e){T.__wasm_bindgen_func_elem_63_37(t,n,e)}function o(t,n,e){T.__wasm_bindgen_func_elem_63_38(t,n,e)}const i=["blob","arraybuffer"],s="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>T.__wbg_channel_free(t,1)));function _(t){const n=T.__wbindgen_export5();return T.__wbindgen_externrefs.set(n,t),n}const u="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>T.__wbindgen_export6(t.a,t.b)));function a(t){switch(typeof t){case"number":case"boolean":case"undefined":return`${t}`;case"string":return JSON.stringify(t);case"bigint":return`${t}n`;case"symbol":return void 0!==t.description?`Symbol(${t.description})`:"Symbol";case"function":return"string"==typeof t.name&&""!==t.name?`Function(${t.name})`:"Function";case"object":{if(null===t)return"null";if(Array.isArray(t))return"["+Array.from(t,a).join(", ")+"]";if(t instanceof Error)return`${t.name}: ${t.message}\n${t.stack}`;const n=toString.call(t),e=/\[object ([^\]]+)\]/.exec(n)?.[1];if(void 0===e)return n;if("Object"===e)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return e}}}function f(t,n){return t>>>=0,w().subarray(t/1,t/1+n)}let b=null;function l(){return(null===b||!0===b.buffer.detached||void 0===b.buffer.detached&&b.buffer!==T.memory.buffer)&&(b=new DataView(T.memory.buffer)),b}function d(t,n){return t>>>=0,e=w().subarray(t,t+n),N+=e.length,N>=A&&(R=new TextDecoder("utf-8",{ignoreBOM:!0}),R.decode(),N=e.length),R.decode(e);var e}let h=null;function w(){return null!==h&&0!==h.byteLength||(h=new Uint8Array(T.memory.buffer)),h}function g(t,n){try{return t.apply(this,n)}catch(t){const n=_(t);T.__wbindgen_export4(n)}}function y(t){return null==t}function p(t,n,e){const r={a:t,b:n,cnt:1},c=(...t)=>{r.cnt++;const n=r.a;r.a=0;try{return e(n,r.b,...t)}finally{r.a=n,c._wbg_cb_unref()}};return c._wbg_cb_unref=()=>{0==--r.cnt&&(T.__wbindgen_export6(r.a,r.b),r.a=0,u.unregister(r))},u.register(c,r,r),c}function m(t,n){const e=n(1*t.length,1)>>>0;return w().set(t,e/1),F=t.length,e}function v(t,n,e){if(void 0===e){const e=S.encode(t),r=n(e.length,1)>>>0;return w().subarray(r,r+e.length).set(e),F=e.length,r}let r=t.length,c=n(r,1)>>>0;const o=w();let i=0;for(;i<r;i++){const n=t.charCodeAt(i);if(n>127)break;o[c+i]=n}if(i!==r){0!==i&&(t=t.slice(i)),c=e(c,r,r=i+3*t.length,1)>>>0;const n=w().subarray(c+i,c+r);i+=S.encodeInto(t,n).written,c=e(c,r,i,1)>>>0}return F=i,c}let R=new TextDecoder("utf-8",{ignoreBOM:!0});R.decode();const A=2146435072;let N=0;const S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(t,n){const e=S.encode(t);return n.set(e),{read:t.length,written:e.length}});let T,O,F=0;async function P(t){return void 0!==T?T:(void 0===O&&(O=async function(t){void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module_or_path:t}=t):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("phirepass-channel_bg.wasm",import.meta.url));const n=function(){const t={__proto__:null,__wbg_Error_208446807d0d1e30:function(t,n){return Error(d(t,n))},__wbg_String_8564e559799eccda:function(t,n){const e=v(String(n),T.__wbindgen_export,T.__wbindgen_export2),r=F;l().setInt32(4+(t>>>0),r,!0),l().setInt32(0+(t>>>0),e,!0)},__wbg___wbindgen_debug_string_f249a2a76caa9a55:function(t,n){const e=v(a(n),T.__wbindgen_export,T.__wbindgen_export2),r=F;l().setInt32(4+(t>>>0),r,!0),l().setInt32(0+(t>>>0),e,!0)},__wbg___wbindgen_string_get_7ce8eee7fd327545:function(t,n){const e="string"==typeof n?n:void 0;var r=y(e)?0:v(e,T.__wbindgen_export,T.__wbindgen_export2),c=F;l().setInt32(4+(t>>>0),c,!0),l().setInt32(0+(t>>>0),r,!0)},__wbg___wbindgen_throw_4c88d8bf264fd984:function(t,n){throw new Error(d(t,n))},__wbg__wbg_cb_unref_09736879a3f67559:function(t){t._wbg_cb_unref()},__wbg_call_40b008ba32f73991:function(){return g((function(t,n){return t.call(n)}),arguments)},__wbg_call_a410eb4b59ed5965:function(){return g((function(t,n,e){return t.call(n,e)}),arguments)},__wbg_call_fc92fee6137d452d:function(){return g((function(t,n,e,r){return t.call(n,e,r)}),arguments)},__wbg_clearInterval_26ba580547547579:function(t){return clearInterval(t)},__wbg_close_5ee9c5fe4e8754a4:function(){return g((function(t){t.close()}),arguments)},__wbg_data_c7e5e8500f1bca2f:function(t){return t.data},__wbg_from_eac91875c8a5ffa4:function(t){return Array.from(t)},__wbg_getRandomValues_5d8c030b527203a6:function(){return g((function(t,n){globalThis.crypto.getRandomValues(f(t,n))}),arguments)},__wbg_get_2080c49015e35254:function(){return g((function(t,n){return Reflect.get(t,n)}),arguments)},__wbg_info_2b8ee6588e4c6072:function(t,n){console.info(d(t,n))},__wbg_instanceof_ArrayBuffer_12cdaa4161423e6b:function(t){let n;try{n=t instanceof ArrayBuffer}catch(t){n=!1}return n},__wbg_length_186163212ffe79c3:function(t){return t.length},__wbg_new_13de428334042d26:function(t){return new Uint8Array(t)},__wbg_new_37eb45aaf5eeb820:function(){return new Array},__wbg_new_cd4348290afae586:function(){return new Object},__wbg_new_with_str_sequence_75b26d88172889d0:function(){return g((function(t,n,e){return new WebSocket(d(t,n),e)}),arguments)},__wbg_prototypesetcall_13162965d1fe7aa3:function(t,n,e){Uint8Array.prototype.set.call(f(t,n),e)},__wbg_push_c9f4893fc209f768:function(t,n){return t.push(n)},__wbg_readyState_039bc047141a5f6d:function(t){return t.readyState},__wbg_send_d83d0891cf698779:function(){return g((function(t,n,e){t.send(f(n,e))}),arguments)},__wbg_setInterval_d933acbf2578adfa:function(){return g((function(t,n){return setInterval(t,n)}),arguments)},__wbg_set_binaryType_d5b4dafd0f127fb2:function(t,n){t.binaryType=i[n]},__wbg_set_d2d33b52458e984a:function(t,n,e){t[n>>>0]=e},__wbg_set_e4b9a833d288759a:function(t,n,e){t[n]=e},__wbg_set_onclose_078935cf8d0fb024:function(t,n){t.onclose=n},__wbg_set_onerror_f7f089f7f059501c:function(t,n){t.onerror=n},__wbg_set_onmessage_26abc49cfa5f9ffc:function(t,n){t.onmessage=n},__wbg_set_onopen_757be120cc7b1ea6:function(t,n){t.onopen=n},__wbg_warn_b0df9a9e7105e74b:function(t,n){console.warn(d(t,n))},__wbindgen_generic_0000000000000001:function(t,n){return p(t,n,r)},__wbindgen_generic_0000000000000002:function(t,n){return p(t,n,c)},__wbindgen_generic_0000000000000003:function(t,n){return p(t,n,o)},__wbindgen_generic_0000000000000004:function(t,n){return p(t,n,e)},__wbindgen_generic_0000000000000005:function(t){return t},__wbindgen_generic_0000000000000006:function(t,n){return f(t,n)},__wbindgen_generic_0000000000000007:function(t,n){return d(t,n)},__wbindgen_generic_0000000000000008:function(t){return BigInt.asUintN(64,t)},__wbindgen_init_externref_table:function(){const t=T.__wbindgen_externrefs;t.set(0,void 0),t.set(1024,void 0),t.set(1025,null),t.set(1026,!0),t.set(1027,!1)}};return{__proto__:null,"./phirepass-channel_bg.js":t}}();("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t));const{instance:s}=await async function(t,n){if("function"==typeof Response&&t instanceof Response){if(!t.ok)throw new Error(`failed to fetch Wasm: ${t.status} ${t.statusText} fetching '${t.url}'`);if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(t,n)}catch(n){if(!function(t){switch(t){case"basic":case"cors":case"default":return!0}return!1}(t.type)||"application/wasm"===t.headers.get("Content-Type"))throw n;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n)}const e=await t.arrayBuffer();return await WebAssembly.instantiate(e,n)}{const e=await WebAssembly.instantiate(t,n);return e instanceof WebAssembly.Instance?{instance:e,module:t}:e}}(await t,n);return function(t){return T=t.exports,b=null,h=null,T.__wbindgen_start(),T}(s)}(t),O.catch((()=>{O=void 0}))),O)}var U,j,k;!function(t){t.Error="Error",t.AuthSuccess="AuthSuccess",t.TunnelOpened="TunnelOpened",t.TunnelClosed="TunnelClosed",t.TunnelData="TunnelData",t.RDPAuthorized="RDPAuthorized",t.SFTPListItems="SFTPListItems",t.SFTPDownloadStartResponse="SFTPDownloadStartResponse",t.SFTPDownloadChunk="SFTPDownloadChunk",t.SFTPUploadStartResponse="SFTPUploadStartResponse",t.SFTPUploadChunkAck="SFTPUploadChunkAck",t.SFTPOpResult="SFTPOpResult"}(U||(U={})),function(t){t[t.Username=0]="Username",t[t.Password=1]="Password",t[t.Default=2]="Default"}(j||(j={})),function(t){t.Disconnected="disconnected",t.Connected="connected",t.Error="error"}(k||(k={}));export{t as C,n as E,j as I,U as P,P as _,k as a}
@@ -1 +1 @@
1
- import{p as e,b as r}from"./p-DGq2b7rM.js";export{s as setNonce}from"./p-DGq2b7rM.js";import{g as o}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,o={};return""!==r&&(o.resourcesUrl=new URL(".",r).href),e(o)})().then((async e=>(await o(),r([["p-9a1f9b9f",[[769,"phirepass-rdp",{serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],username:[1],password:[1],destination:[1],scale:[1],dynamicResize:[4,"dynamic-resize"],captureKeyboard:[4,"capture-keyboard"],clipboard:[4],serverId:[1,"server-id"],credentialsPrompt:[32],statusMessage:[32],toggleFullscreen:[64],keyboardLockSupported:[64],focusDesktop:[64],sendCtrlAltDel:[64],sendMetaKey:[64]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-8eb3ec24",[[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],maximize:[64],minimize:[64]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-1fef5b5f",[[513,"phirepass-terminal",{terminalOptions:[16],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],keyBar:[1,"key-bar"],serverId:[1,"server-id"],channelFactory:[16],ctrlArmed:[32],altArmed:[32]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]]],e))));
1
+ import{p as e,b as r}from"./p-B9qUl6FW.js";export{s as setNonce}from"./p-B9qUl6FW.js";import{g as o}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,o={};return""!==r&&(o.resourcesUrl=new URL(".",r).href),e(o)})().then((async e=>(await o(),r([["p-1b84c526",[[769,"phirepass-rdp",{serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],username:[1],password:[1],destination:[1],scale:[1],dynamicResize:[4,"dynamic-resize"],captureKeyboard:[4,"capture-keyboard"],clipboard:[4],serverId:[1,"server-id"],channelFactory:[16],credentialsPrompt:[32],statusMessage:[32],toggleFullscreen:[64],keyboardLockSupported:[64],focusDesktop:[64],sendCtrlAltDel:[64],sendMetaKey:[64]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-41dd1ac9",[[513,"phirepass-terminal",{terminalOptions:[16],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serviceId:[1,"service-id"],token:[1],keyBar:[1,"key-bar"],serverId:[1,"server-id"],channelFactory:[16],ctrlArmed:[32],altArmed:[32]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]],["p-614ab3de",[[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]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}],[513,"phirepass-downloader",{nodeId:[1,"node-id"],nodeLabel:[1,"node-label"],token:[1],channel:[16],connected:[4],channelFactory:[16],browsingService:[1,"browsing-service"],browsingPath:[1025,"browsing-path"],compact:[516],streamBase:[1,"stream-base"],canConfigure:[4,"can-configure"],inlinePlayer:[4,"inline-player"],serverHost:[1,"server-host"],serverPort:[2,"server-port"],serverId:[1,"server-id"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],connection:[32],caps:[32],jobs:[32],tab:[32],drawerOpen:[32],dialogOpen:[32],unread:[32],form:[32],where:[32],starting:[32],refusal:[32],confirm:[32],notices:[32],subDir:[32],picker:[32],player:[32],receive:[64],openFetch:[64],toggleDrawer:[64],jobForPath:[64],deleteDownload:[64],torrentPathFor:[64],startTorrentPath:[64]},null,{channel:[{onChannel:0}],connected:[{onConnected:0}],browsingPath:[{onBrowsing:0}],browsingService:[{onBrowsing:0}],nodeId:[{onNode:0}]}],[513,"phirepass-media-player",{src:[1],name:[1],mime:[1],status:[1],ready:[2],positionStore:[16],positionKey:[1,"position-key"],remotePlayback:[16],castDevice:[1,"cast-device"],phase:[32],stored:[32],castAvailable:[32],currentTime:[32],duration:[32],close:[64]},null,{src:[{onSrc:0}]}]]]],e))));
@@ -1,4 +1,5 @@
1
1
  import type { Channel } from 'phirepass-channel';
2
+ import type { Browsing, FetchOptions, FetchSource, SubscribeScope } from './fetch';
2
3
  /**
3
4
  * The part of `phirepass-channel`'s `Channel` the widgets actually call.
4
5
  *
@@ -17,3 +18,32 @@ export type ChannelLike = Pick<Channel, 'connect' | 'disconnect' | 'is_connected
17
18
  * the WASM module is never initialised, since nothing would use it.
18
19
  */
19
20
  export type ChannelFactory = (endpoint: string, nodeId: string, serverId?: string) => ChannelLike;
21
+ /**
22
+ * The Remote Fetch methods (plan task T1.10). They are not in the published
23
+ * `phirepass-channel` yet, so they are written out here rather than picked:
24
+ * once the WASM build carries them, replace this with a `Pick` like the one
25
+ * above so the two can never drift.
26
+ *
27
+ * Every id is the server-minted `download_id` (a uuid string). Each method that
28
+ * expects an answer takes the `msg_id` the answer (or an `Error`) echoes.
29
+ */
30
+ export interface DownloadChannelMethods {
31
+ send_download_start(node_id: string, source: FetchSource, sub_dir: string | null, browsing: Browsing | null, in_order: boolean, options: FetchOptions, msg_id?: number | null): void;
32
+ send_download_stop(download_id: string, discard: boolean, msg_id?: number | null): void;
33
+ send_download_resume(download_id: string, ignore_window: boolean, msg_id?: number | null): void;
34
+ send_download_set_order(download_id: string, in_order: boolean, msg_id?: number | null): void;
35
+ send_download_delete(download_id: string, delete_file: boolean, msg_id?: number | null): void;
36
+ send_download_subscribe(scope: SubscribeScope): void;
37
+ send_download_where(node_id: string, browsing: Browsing, msg_id?: number | null): void;
38
+ send_download_folders(node_id: string, sub_dir: string | null, msg_id?: number | null): void;
39
+ }
40
+ /** What `<phirepass-downloader>` needs from a channel: the connection plumbing plus the download events. */
41
+ export type DownloadChannelLike = Pick<ChannelLike, 'connect' | 'disconnect' | 'is_connected' | 'authenticate' | 'start_heartbeat' | 'stop_heartbeat' | 'on_connection_open' | 'on_connection_close' | 'on_connection_error' | 'on_connection_message' | 'on_protocol_message'> & Partial<DownloadChannelMethods>;
42
+ export type DownloadChannelFactory = (endpoint: string, nodeId: string, serverId?: string) => DownloadChannelLike;
43
+ /**
44
+ * Whether this channel can speak Remote Fetch. A channel built from a
45
+ * `phirepass-channel` release older than T1.10 cannot, and the widgets then
46
+ * keep the feature out of sight instead of offering buttons that do nothing.
47
+ * The folder picker's method is optional (phase 4) and checked where used.
48
+ */
49
+ export declare function supportsDownloads(channel: unknown): channel is DownloadChannelLike & DownloadChannelMethods;