phirepass-widgets 0.0.101 → 0.0.103

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 (33) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/phirepass-rdp.cjs.entry.js +1 -1
  3. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +547 -81
  4. package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
  5. package/dist/cjs/phirepass-widgets.cjs.js +1 -1
  6. package/dist/cjs/{protocol-B45sQiET.js → protocol-9IbZ-NTW.js} +155 -59
  7. package/dist/collection/common/protocol.js +1 -0
  8. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +342 -2
  9. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +568 -80
  10. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
  11. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  12. package/dist/components/p-D4vz9Xu4.js +1 -0
  13. package/dist/components/phirepass-rdp.js +1 -1
  14. package/dist/components/phirepass-sftp-client.js +1 -1
  15. package/dist/components/phirepass-terminal.js +2 -2
  16. package/dist/esm/loader.js +1 -1
  17. package/dist/esm/phirepass-rdp.entry.js +1 -1
  18. package/dist/esm/phirepass-sftp-client.entry.js +547 -81
  19. package/dist/esm/phirepass-terminal.entry.js +2 -2
  20. package/dist/esm/phirepass-widgets.js +1 -1
  21. package/dist/esm/{protocol-DFhjP92A.js → protocol-D4vz9Xu4.js} +154 -58
  22. package/dist/phirepass-widgets/{p-de23b6db.entry.js → p-471340b8.entry.js} +1 -1
  23. package/dist/phirepass-widgets/p-D4vz9Xu4.js +1 -0
  24. package/dist/phirepass-widgets/p-ca67e389.entry.js +1 -0
  25. package/dist/phirepass-widgets/{p-c4a31b26.entry.js → p-dc4051cc.entry.js} +2 -2
  26. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  27. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  28. package/dist/types/common/protocol.d.ts +22 -2
  29. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +85 -4
  30. package/package.json +2 -2
  31. package/dist/components/p-DFhjP92A.js +0 -1
  32. package/dist/phirepass-widgets/p-0e9afedb.entry.js +0 -1
  33. package/dist/phirepass-widgets/p-DFhjP92A.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-CbZdPuPQ.js');
4
- var protocol = require('./protocol-B45sQiET.js');
4
+ var protocol = require('./protocol-9IbZ-NTW.js');
5
5
 
6
6
  const phirepassSftpClientLogoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==';
7
7
 
@@ -19,7 +19,7 @@ const phirepassSftpClientRefreshSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0
19
19
 
20
20
  const phirepassSftpClientUploadSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==';
21
21
 
22
- const phirepassSftpClientCss = () => `: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}.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;overflow:auto;font-size:0.75rem;line-height:1rem;scrollbar-width:thin;scrollbar-color:hsl(var(--scroll-thumb)) hsl(var(--scroll-track));&::-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{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{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{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{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)}}}.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}}}}}@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}}`;
22
+ const phirepassSftpClientCss = () => `: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}}`;
23
23
 
24
24
  const PhirepassSftpClient = class {
25
25
  constructor(hostRef) {
@@ -32,7 +32,6 @@ const PhirepassSftpClient = class {
32
32
  runtimeReady = false;
33
33
  connected = false;
34
34
  uploadInputEl;
35
- deleteLoadingTimeout;
36
35
  msgId = 1;
37
36
  activeUploadToken = 0;
38
37
  pendingUploadStarts = new Map();
@@ -40,7 +39,10 @@ const PhirepassSftpClient = class {
40
39
  pendingDownloadStarts = new Map();
41
40
  activeDownloads = new Map();
42
41
  activeDownloadMsgId;
43
- pendingDelete;
42
+ pendingOps = new Map();
43
+ promptInputEl;
44
+ editorPath = '';
45
+ editorTextEl;
44
46
  // private inputMode: InputMode = InputMode.Default;
45
47
  session_id;
46
48
  // private usernameBuffer = "";
@@ -112,6 +114,32 @@ const PhirepassSftpClient = class {
112
114
  show_delete_modal = false;
113
115
  delete_file_name = '';
114
116
  delete_loading = false;
117
+ delete_is_dir = false;
118
+ delete_recursive = false;
119
+ delete_error = '';
120
+ /** `mkdir` and `rename` share one dialog: both take a single name. */
121
+ prompt_kind = null;
122
+ prompt_value = '';
123
+ prompt_error = '';
124
+ prompt_busy = false;
125
+ chmod_target = null;
126
+ /** Permission bits under edit, masked to 0o7777. */
127
+ chmod_mode = 0;
128
+ chmod_error = '';
129
+ chmod_busy = false;
130
+ show_editor = false;
131
+ editor_name = '';
132
+ editor_text = '';
133
+ /** What is on the remote, so the dialog knows whether it has edits. */
134
+ editor_saved_text = '';
135
+ editor_busy = '';
136
+ editor_error = '';
137
+ editor_confirm_discard = false;
138
+ /** False until the file's contents are in hand, so a failed open is read-only. */
139
+ editor_loaded = false;
140
+ filter = '';
141
+ sort_key = 'name';
142
+ sort_asc = true;
115
143
  toggle_max() {
116
144
  this.maximizeEvent?.emit(!this.max);
117
145
  }
@@ -145,16 +173,9 @@ const PhirepassSftpClient = class {
145
173
  this.cancel_active_upload();
146
174
  this.cancel_active_download();
147
175
  this.clear_pending_operations();
148
- this.clear_delete_loading_timeout();
149
176
  this.close_comms();
150
177
  // this.destroy_terminal();
151
178
  }
152
- clear_delete_loading_timeout() {
153
- if (this.deleteLoadingTimeout !== undefined) {
154
- window.clearTimeout(this.deleteLoadingTimeout);
155
- this.deleteLoadingTimeout = undefined;
156
- }
157
- }
158
179
  next_msg_id() {
159
180
  const id = this.msgId;
160
181
  this.msgId += 1;
@@ -176,15 +197,13 @@ const PhirepassSftpClient = class {
176
197
  pending.reject(new Error('Download start aborted'));
177
198
  });
178
199
  this.pendingDownloadStarts.clear();
179
- this.stop_delete_polling();
200
+ this.pendingOps.forEach((pending) => {
201
+ window.clearTimeout(pending.timeout);
202
+ pending.reject(new Error(`Could not ${pending.verb}: the session ended.`));
203
+ });
204
+ this.pendingOps.clear();
180
205
  this.activeDownloads.clear();
181
206
  }
182
- stop_delete_polling() {
183
- if (this.pendingDelete?.interval !== undefined) {
184
- window.clearInterval(this.pendingDelete.interval);
185
- }
186
- this.pendingDelete = undefined;
187
- }
188
207
  cancel_active_upload() {
189
208
  this.activeUploadToken += 1;
190
209
  this.upload_progress = 0;
@@ -314,11 +333,16 @@ const PhirepassSftpClient = class {
314
333
  }
315
334
  this.download_finished = false;
316
335
  }
317
- if (this.pendingDelete?.msgId === error.msg_id) {
318
- this.stop_delete_polling();
319
- this.delete_loading = false;
320
- this.show_delete_modal = false;
321
- this.status = 'Connected';
336
+ const pendingOp = this.pendingOps.get(error.msg_id);
337
+ if (pendingOp) {
338
+ window.clearTimeout(pendingOp.timeout);
339
+ this.pendingOps.delete(error.msg_id);
340
+ pendingOp.reject(new Error(error.message || `Could not ${pendingOp.verb}.`));
341
+ // The caller puts this message in the dialog the user is
342
+ // looking at. Raising the page-level banner as well would say
343
+ // the same thing twice, in the place they are not looking.
344
+ this.show_loader = false;
345
+ return;
322
346
  }
323
347
  }
324
348
  switch (error.kind) {
@@ -365,6 +389,11 @@ const PhirepassSftpClient = class {
365
389
  setTimeout(() => {
366
390
  this.show_loader = false;
367
391
  }, 500);
392
+ // A filter is about the directory you typed it in; carrying it into
393
+ // the next one hides most of what you just navigated to.
394
+ if (web.path !== this.current_dir) {
395
+ this.filter = '';
396
+ }
368
397
  this.listing = web.dir.items;
369
398
  this.current_dir = web.path;
370
399
  this.breadcrumbs = web.path.split('/').map((path, index, arr) => {
@@ -375,16 +404,6 @@ const PhirepassSftpClient = class {
375
404
  });
376
405
  this.show_content = true;
377
406
  this.show_navigation = true;
378
- if (this.pendingDelete && web.path === this.current_dir) {
379
- const fileStillExists = web.dir.items.some((item) => item.kind === 'File' && item.name === this.pendingDelete?.filename);
380
- if (!fileStillExists) {
381
- this.stop_delete_polling();
382
- this.delete_loading = false;
383
- this.show_delete_modal = false;
384
- this.delete_file_name = '';
385
- this.status = 'Connected';
386
- }
387
- }
388
407
  console.log('Received SFTP list items:', web);
389
408
  }
390
409
  handle_upload_start_response(web) {
@@ -594,6 +613,80 @@ const PhirepassSftpClient = class {
594
613
  this.status = 'Connected';
595
614
  }
596
615
  }
616
+ handle_op_result(web) {
617
+ if (web.msg_id === undefined) {
618
+ return;
619
+ }
620
+ const pending = this.pendingOps.get(web.msg_id);
621
+ if (!pending) {
622
+ return;
623
+ }
624
+ window.clearTimeout(pending.timeout);
625
+ this.pendingOps.delete(web.msg_id);
626
+ pending.resolve(web.result);
627
+ }
628
+ /**
629
+ * Send one filesystem operation and wait for its single answer.
630
+ *
631
+ * There are three outcomes: an `SFTPOpResult` resolves it, an `Error` frame
632
+ * carrying the same `msg_id` rejects it, and the timeout covers the case
633
+ * worth naming — an agent built before these frames existed logs the
634
+ * unknown frame and drops it, so silence usually means "too old" rather
635
+ * than "slow", and the message says so.
636
+ */
637
+ run_op(verb, send, timeoutMs = 30_000) {
638
+ if (!this.session_id) {
639
+ return Promise.reject(new Error('No active SFTP session.'));
640
+ }
641
+ const msgId = this.next_msg_id();
642
+ return new Promise((resolve, reject) => {
643
+ const timeout = window.setTimeout(() => {
644
+ this.pendingOps.delete(msgId);
645
+ reject(new Error(`Timed out trying to ${verb}. This node's agent may be too old to support it.`));
646
+ }, timeoutMs);
647
+ this.pendingOps.set(msgId, { verb, timeout, resolve, reject });
648
+ try {
649
+ send(msgId);
650
+ }
651
+ catch (err) {
652
+ window.clearTimeout(timeout);
653
+ this.pendingOps.delete(msgId);
654
+ reject(err instanceof Error ? err : new Error(String(err)));
655
+ }
656
+ });
657
+ }
658
+ error_text(err) {
659
+ return err instanceof Error ? err.message : String(err);
660
+ }
661
+ /**
662
+ * A listing entry carries its *parent* directory in `path`, so a full path
663
+ * is always the join of the two.
664
+ */
665
+ item_path(item) {
666
+ return this.join_path(item.path, item.name);
667
+ }
668
+ join_path(dir, name) {
669
+ if (!dir || dir === '/') {
670
+ return `/${name}`;
671
+ }
672
+ return dir.endsWith('/') ? `${dir}${name}` : `${dir}/${name}`;
673
+ }
674
+ /** Names the remote would reject, or that would silently mean something else. */
675
+ invalid_name(name) {
676
+ if (!name) {
677
+ return 'Enter a name.';
678
+ }
679
+ if (name === '.' || name === '..') {
680
+ return 'That name is reserved.';
681
+ }
682
+ if (name.includes('/')) {
683
+ return 'A name cannot contain "/".';
684
+ }
685
+ if (name.includes('\u0000')) {
686
+ return 'A name cannot contain a null byte.';
687
+ }
688
+ return '';
689
+ }
597
690
  handle_tunnel_data(web) {
598
691
  console.log('received tunnel data:', web);
599
692
  }
@@ -661,6 +754,9 @@ const PhirepassSftpClient = class {
661
754
  case protocol.ProtocolMessageType.SFTPDownloadChunk:
662
755
  this.handle_download_chunk(web);
663
756
  break;
757
+ case protocol.ProtocolMessageType.SFTPOpResult:
758
+ this.handle_op_result(web);
759
+ break;
664
760
  default:
665
761
  console.warn('Unhandled protocol message type:', web);
666
762
  }
@@ -727,6 +823,22 @@ const PhirepassSftpClient = class {
727
823
  this.download_finished = false;
728
824
  this.delete_loading = false;
729
825
  this.delete_file_name = '';
826
+ this.delete_error = '';
827
+ this.delete_is_dir = false;
828
+ this.delete_recursive = false;
829
+ this.prompt_kind = null;
830
+ this.prompt_value = '';
831
+ this.prompt_error = '';
832
+ this.prompt_busy = false;
833
+ this.chmod_target = null;
834
+ this.chmod_error = '';
835
+ this.chmod_busy = false;
836
+ this.show_editor = false;
837
+ this.editor_busy = '';
838
+ this.editor_error = '';
839
+ this.editor_confirm_discard = false;
840
+ this.editor_loaded = false;
841
+ this.filter = '';
730
842
  this.version = '';
731
843
  this.status = 'Disconnected';
732
844
  }
@@ -743,6 +855,9 @@ const PhirepassSftpClient = class {
743
855
  event.stopPropagation();
744
856
  this.selected_item = item;
745
857
  this.delete_file_name = item.name;
858
+ this.delete_is_dir = item.kind === 'Folder';
859
+ this.delete_recursive = false;
860
+ this.delete_error = '';
746
861
  this.delete_loading = false;
747
862
  this.show_delete_modal = true;
748
863
  }
@@ -752,49 +867,369 @@ const PhirepassSftpClient = class {
752
867
  }
753
868
  this.show_delete_modal = false;
754
869
  this.delete_file_name = '';
755
- this.delete_loading = false;
756
- this.refresh_directory();
870
+ this.delete_error = '';
871
+ this.delete_is_dir = false;
872
+ this.delete_recursive = false;
757
873
  }
758
- confirm_delete() {
874
+ async confirm_delete() {
759
875
  if (this.delete_loading) {
760
876
  return;
761
877
  }
762
- if (!this.session_id || !this.selected_item) {
878
+ const target = this.selected_item;
879
+ if (!this.session_id || !target) {
763
880
  this.show_delete_modal = false;
764
881
  return;
765
882
  }
766
- const fileToDelete = this.selected_item.name;
883
+ const path = this.item_path(target);
884
+ const recursive = this.delete_is_dir && this.delete_recursive;
767
885
  this.delete_loading = true;
768
- this.status = 'Deleting...';
886
+ this.delete_error = '';
769
887
  this.show_error = false;
770
- this.stop_delete_polling();
771
- const msgId = this.next_msg_id();
772
- this.pendingDelete = {
773
- filename: fileToDelete,
774
- msgId,
775
- startedAt: Date.now(),
776
- };
777
- const pollOnce = () => {
778
- if (!this.pendingDelete) {
779
- return;
888
+ this.status = `Deleting ${target.name}...`;
889
+ try {
890
+ // A recursive delete walks the tree one entry at a time over SSH,
891
+ // so it earns a far longer leash than the other operations.
892
+ await this.run_op('delete', (msgId) => this.channel.send_sftp_remove(this.nodeId, this.session_id, path, recursive, msgId), recursive ? 300_000 : 30_000);
893
+ this.delete_loading = false;
894
+ this.show_delete_modal = false;
895
+ this.delete_file_name = '';
896
+ this.delete_is_dir = false;
897
+ this.delete_recursive = false;
898
+ this.status = 'Connected';
899
+ this.refresh_directory();
900
+ }
901
+ catch (err) {
902
+ this.delete_loading = false;
903
+ this.delete_error = this.error_text(err);
904
+ this.status = 'Connected';
905
+ }
906
+ }
907
+ open_mkdir() {
908
+ if (!this.session_id) {
909
+ return;
910
+ }
911
+ this.prompt_kind = 'mkdir';
912
+ this.prompt_value = '';
913
+ this.prompt_error = '';
914
+ this.prompt_busy = false;
915
+ }
916
+ on_rename_action(item, event) {
917
+ event.preventDefault();
918
+ event.stopPropagation();
919
+ if (!this.session_id) {
920
+ return;
921
+ }
922
+ this.selected_item = item;
923
+ this.prompt_kind = 'rename';
924
+ this.prompt_value = item.name;
925
+ this.prompt_error = '';
926
+ this.prompt_busy = false;
927
+ }
928
+ close_prompt() {
929
+ if (this.prompt_busy) {
930
+ return;
931
+ }
932
+ this.prompt_kind = null;
933
+ this.prompt_value = '';
934
+ this.prompt_error = '';
935
+ this.promptInputEl = undefined;
936
+ }
937
+ async submit_prompt() {
938
+ if (this.prompt_busy || !this.session_id) {
939
+ return;
940
+ }
941
+ const kind = this.prompt_kind;
942
+ const name = this.prompt_value.trim();
943
+ const invalid = this.invalid_name(name);
944
+ if (invalid) {
945
+ this.prompt_error = invalid;
946
+ return;
947
+ }
948
+ const target = this.selected_item;
949
+ if (kind === 'rename' && target && name === target.name) {
950
+ this.close_prompt();
951
+ return;
952
+ }
953
+ this.prompt_busy = true;
954
+ this.prompt_error = '';
955
+ this.show_error = false;
956
+ try {
957
+ if (kind === 'mkdir') {
958
+ const path = this.join_path(this.current_dir, name);
959
+ this.status = `Creating ${name}...`;
960
+ await this.run_op('create the folder', (msgId) => this.channel.send_sftp_mkdir(this.nodeId, this.session_id, path, msgId));
780
961
  }
781
- const elapsed = Date.now() - this.pendingDelete.startedAt;
782
- if (elapsed >= 30_000) {
783
- this.stop_delete_polling();
784
- this.delete_loading = false;
785
- this.show_delete_modal = false;
786
- this.show_error = true;
787
- this.error_message = `Delete timed out for "${fileToDelete}".`;
788
- this.status = 'Connected';
962
+ else if (kind === 'rename' && target) {
963
+ // `to` is a full path, so the same call would move the entry if
964
+ // the dialog ever offered a destination directory.
965
+ const from = this.item_path(target);
966
+ const to = this.join_path(target.path, name);
967
+ this.status = `Renaming ${target.name}...`;
968
+ await this.run_op('rename', (msgId) => this.channel.send_sftp_rename(this.nodeId, this.session_id, from, to, msgId));
969
+ }
970
+ else {
971
+ this.prompt_busy = false;
972
+ this.close_prompt();
789
973
  return;
790
974
  }
791
- if (this.session_id) {
792
- this.channel.send_sftp_list_data(this.nodeId, this.session_id, this.current_dir);
975
+ this.prompt_busy = false;
976
+ this.prompt_kind = null;
977
+ this.prompt_value = '';
978
+ this.promptInputEl = undefined;
979
+ this.status = 'Connected';
980
+ this.refresh_directory();
981
+ }
982
+ catch (err) {
983
+ this.prompt_busy = false;
984
+ this.prompt_error = this.error_text(err);
985
+ this.status = 'Connected';
986
+ }
987
+ }
988
+ on_chmod_action(item, event) {
989
+ event.preventDefault();
990
+ event.stopPropagation();
991
+ if (!this.session_id) {
992
+ return;
993
+ }
994
+ this.selected_item = item;
995
+ this.chmod_target = item;
996
+ this.chmod_mode = (item.attributes.permissions ?? 0) & 0o7777;
997
+ this.chmod_error = '';
998
+ this.chmod_busy = false;
999
+ }
1000
+ close_chmod() {
1001
+ if (this.chmod_busy) {
1002
+ return;
1003
+ }
1004
+ this.chmod_target = null;
1005
+ this.chmod_error = '';
1006
+ }
1007
+ toggle_chmod_bit(bit) {
1008
+ if (this.chmod_busy) {
1009
+ return;
1010
+ }
1011
+ this.chmod_mode = (this.chmod_mode ^ bit) & 0o7777;
1012
+ }
1013
+ on_chmod_octal_input(value) {
1014
+ const digits = value.trim();
1015
+ if (!/^[0-7]{1,4}$/.test(digits)) {
1016
+ this.chmod_error = 'Enter up to four octal digits, 0-7.';
1017
+ return;
1018
+ }
1019
+ this.chmod_error = '';
1020
+ this.chmod_mode = parseInt(digits, 8) & 0o7777;
1021
+ }
1022
+ async submit_chmod() {
1023
+ const target = this.chmod_target;
1024
+ if (this.chmod_busy || !this.session_id || !target) {
1025
+ return;
1026
+ }
1027
+ const path = this.item_path(target);
1028
+ const mode = this.chmod_mode & 0o7777;
1029
+ this.chmod_busy = true;
1030
+ this.chmod_error = '';
1031
+ this.show_error = false;
1032
+ this.status = `Setting permissions on ${target.name}...`;
1033
+ try {
1034
+ await this.run_op('change permissions', (msgId) => this.channel.send_sftp_chmod(this.nodeId, this.session_id, path, mode, msgId));
1035
+ this.chmod_busy = false;
1036
+ this.chmod_target = null;
1037
+ this.status = 'Connected';
1038
+ this.refresh_directory();
1039
+ }
1040
+ catch (err) {
1041
+ this.chmod_busy = false;
1042
+ this.chmod_error = this.error_text(err);
1043
+ this.status = 'Connected';
1044
+ }
1045
+ }
1046
+ async on_edit_action(item, event) {
1047
+ event.preventDefault();
1048
+ event.stopPropagation();
1049
+ if (!this.session_id || item.kind !== 'File') {
1050
+ return;
1051
+ }
1052
+ const path = this.item_path(item);
1053
+ this.selected_item = item;
1054
+ this.show_editor = true;
1055
+ this.editorPath = path;
1056
+ this.editor_name = item.name;
1057
+ this.editor_text = '';
1058
+ this.editor_saved_text = '';
1059
+ this.editor_error = '';
1060
+ this.editor_confirm_discard = false;
1061
+ this.editor_loaded = false;
1062
+ this.editor_busy = 'loading';
1063
+ this.status = `Opening ${item.name}...`;
1064
+ try {
1065
+ const answer = await this.run_op('open the file', (msgId) => this.channel.send_sftp_read_file(this.nodeId, this.session_id, path, msgId), 60_000);
1066
+ if (answer.result !== 'FileContents') {
1067
+ throw new Error('The agent answered without any file contents.');
1068
+ }
1069
+ const text = this.decode_text(answer.contents instanceof Uint8Array ? answer.contents : new Uint8Array(answer.contents));
1070
+ this.editor_text = text;
1071
+ this.editor_saved_text = text;
1072
+ this.editor_loaded = true;
1073
+ this.editor_busy = '';
1074
+ this.status = 'Connected';
1075
+ }
1076
+ catch (err) {
1077
+ this.editor_busy = '';
1078
+ this.editor_error = this.error_text(err);
1079
+ this.status = 'Connected';
1080
+ }
1081
+ }
1082
+ /**
1083
+ * Refuse binary rather than mangle it. A lossy decode looks fine on screen
1084
+ * and then writes replacement characters over the real bytes on save, so
1085
+ * anything that is not valid UTF-8 is sent to the download button instead.
1086
+ */
1087
+ decode_text(bytes) {
1088
+ if (bytes.includes(0)) {
1089
+ throw new Error('This looks like a binary file. Download it instead of editing it here.');
1090
+ }
1091
+ try {
1092
+ return new TextDecoder('utf-8', { fatal: true }).decode(bytes);
1093
+ }
1094
+ catch {
1095
+ throw new Error('This file is not valid UTF-8. Download it instead of editing it here.');
1096
+ }
1097
+ }
1098
+ editor_is_dirty() {
1099
+ return this.editor_loaded && this.editor_text !== this.editor_saved_text;
1100
+ }
1101
+ close_editor(force = false) {
1102
+ if (this.editor_busy === 'saving') {
1103
+ return;
1104
+ }
1105
+ if (!force && this.editor_is_dirty()) {
1106
+ this.editor_confirm_discard = true;
1107
+ return;
1108
+ }
1109
+ this.show_editor = false;
1110
+ this.editor_confirm_discard = false;
1111
+ this.editor_loaded = false;
1112
+ this.editorPath = '';
1113
+ this.editor_name = '';
1114
+ this.editor_text = '';
1115
+ this.editor_saved_text = '';
1116
+ this.editor_error = '';
1117
+ this.editor_busy = '';
1118
+ this.editorTextEl = undefined;
1119
+ }
1120
+ async save_editor() {
1121
+ if (this.editor_busy || !this.session_id || !this.editorPath) {
1122
+ return;
1123
+ }
1124
+ const path = this.editorPath;
1125
+ const text = this.editor_text;
1126
+ this.editor_busy = 'saving';
1127
+ this.editor_error = '';
1128
+ this.show_error = false;
1129
+ this.status = `Saving ${this.editor_name}...`;
1130
+ try {
1131
+ await this.run_op('save the file', (msgId) => this.channel.send_sftp_write_file(this.nodeId, this.session_id, path, new TextEncoder().encode(text), msgId), 60_000);
1132
+ this.editor_saved_text = text;
1133
+ this.editor_busy = '';
1134
+ this.status = 'Connected';
1135
+ this.refresh_directory();
1136
+ }
1137
+ catch (err) {
1138
+ this.editor_busy = '';
1139
+ this.editor_error = this.error_text(err);
1140
+ this.status = 'Connected';
1141
+ }
1142
+ }
1143
+ toggle_sort(key) {
1144
+ if (this.sort_key === key) {
1145
+ this.sort_asc = !this.sort_asc;
1146
+ return;
1147
+ }
1148
+ this.sort_key = key;
1149
+ this.sort_asc = true;
1150
+ }
1151
+ /**
1152
+ * Folders stay above files whichever way the sort runs: a listing that
1153
+ * scatters directories through the files is harder to scan, not more sorted.
1154
+ */
1155
+ visible_listing() {
1156
+ const needle = this.filter.trim().toLowerCase();
1157
+ const rows = needle
1158
+ ? this.listing.filter((item) => item.name.toLowerCase().includes(needle))
1159
+ : [...this.listing];
1160
+ const direction = this.sort_asc ? 1 : -1;
1161
+ return rows.sort((a, b) => {
1162
+ if (a.kind !== b.kind) {
1163
+ return a.kind === 'Folder' ? -1 : 1;
1164
+ }
1165
+ switch (this.sort_key) {
1166
+ case 'size':
1167
+ return direction * ((a.attributes.size ?? 0) - (b.attributes.size ?? 0));
1168
+ case 'modified':
1169
+ return direction * ((a.attributes.modified ?? 0) - (b.attributes.modified ?? 0));
1170
+ default:
1171
+ return direction * a.name.localeCompare(b.name, undefined, {
1172
+ numeric: true,
1173
+ sensitivity: 'base',
1174
+ });
793
1175
  }
794
- };
795
- pollOnce();
796
- this.pendingDelete.interval = window.setInterval(pollOnce, 2_500);
797
- this.channel.send_sftp_delete(this.nodeId, this.session_id, this.current_dir, fileToDelete, msgId);
1176
+ });
1177
+ }
1178
+ sort_indicator(key) {
1179
+ if (this.sort_key !== key) {
1180
+ return '';
1181
+ }
1182
+ return this.sort_asc ? ' \u25b2' : ' \u25bc';
1183
+ }
1184
+ /** Keyboard shortcuts, scoped to the file table so the page keeps its own. */
1185
+ on_listing_keydown(event) {
1186
+ if (this.prompt_kind || this.chmod_target || this.show_editor || this.show_delete_modal) {
1187
+ return;
1188
+ }
1189
+ const item = this.selected_item;
1190
+ switch (event.key) {
1191
+ case 'Backspace':
1192
+ event.preventDefault();
1193
+ this.go_to_parent_directory();
1194
+ break;
1195
+ case 'F5':
1196
+ event.preventDefault();
1197
+ this.refresh_directory();
1198
+ break;
1199
+ case 'F2':
1200
+ if (item) {
1201
+ event.preventDefault();
1202
+ this.on_rename_action(item, event);
1203
+ }
1204
+ break;
1205
+ case 'Delete':
1206
+ if (item) {
1207
+ event.preventDefault();
1208
+ this.on_file_delete_action(item, event);
1209
+ }
1210
+ break;
1211
+ case 'Enter':
1212
+ if (item) {
1213
+ event.preventDefault();
1214
+ this.list_directory(item);
1215
+ }
1216
+ break;
1217
+ }
1218
+ }
1219
+ on_modal_keydown(event, close) {
1220
+ if (event.key === 'Escape') {
1221
+ event.preventDefault();
1222
+ event.stopPropagation();
1223
+ close();
1224
+ }
1225
+ }
1226
+ /** Focus a dialog's field as it appears, without re-focusing on every render. */
1227
+ focus_once(el, current, keep) {
1228
+ if (!el || el === current) {
1229
+ return;
1230
+ }
1231
+ keep(el);
1232
+ requestAnimationFrame(() => el.focus());
798
1233
  }
799
1234
  open_upload_picker() {
800
1235
  this.uploadInputEl?.click();
@@ -841,7 +1276,7 @@ const PhirepassSftpClient = class {
841
1276
  this.selected_item = entry;
842
1277
  return;
843
1278
  }
844
- const path = [entry.path, entry.name].join('/');
1279
+ const path = this.item_path(entry);
845
1280
  if (path === this.current_dir) {
846
1281
  console.warn('Already in this directory. Ignoring click.');
847
1282
  return;
@@ -926,18 +1361,20 @@ const PhirepassSftpClient = class {
926
1361
  return `${typeChar}${chars.join('')}`;
927
1362
  }
928
1363
  render() {
929
- return (index.h(index.Host, { key: '6f830eb2cea173cb081eabdd7d3d418e8c831b4a', class: {
1364
+ return (index.h(index.Host, { key: '94f75760ff9d2f6e2852cdabd109f58bbdc21826', class: {
930
1365
  'default': !this.max,
931
1366
  'max': this.max,
932
- } }, index.h("section", { key: '0c028222f80a6783f4f457dd9dbb4f276c7e75cc', class: "listing" }, !this.hideHeader &&
933
- index.h("header", { key: 'bf4260a4f13173ff003885c39167177c17fb138f' }, index.h("section", { key: '6025f57ee11cda79928158fc86be88588aeda5c1', class: "title" }, index.h("img", { key: '1a1fc770118c2d1c027248b65c110ad948ce5860', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), index.h("div", { key: '5c71b597edfd27b5d79966281cada602604ed849', class: "text" }, index.h("div", { key: '600e8073d2d240cb599a76426a296a396201f70e', class: "name" }, this.name), index.h("div", { key: '6d40ba59e26818071ab0f110651c8da1cbe8794c', class: "description" }, this.description))), index.h("section", { key: 'a90afbb3729ac3dc40cc16eda959a5b9028a14f3', class: "actions" }, index.h("div", { key: '97b8b948b8bbe521cfbc91279e84ccc9e9c5b151', class: "action", onClick: () => this.toggle_max() }, index.h("img", { key: '6f7881d837d5b5e4f79d1dead0d53df733205899', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), index.h("main", { key: '58db45bcafab4c55e257831e9693591724fc9848' }, this.show_navigation && index.h("nav", { key: '9b0c06d3afd36a32845334375c0ec0f0f4e363ea', class: "navigation" }, index.h("div", { key: '5b84ca2d3a55afb383fe27ed9b955d24560b0283', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index$1, breadcrumbs) => (index.h("span", { key: index$1, class: "breadcrumb-container" }, index.h("span", { key: index$1, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index$1 < breadcrumbs.length - 1 && index.h("img", { class: "arrow", src: phirepassSftpClientChevronSvg }))))), index.h("section", { key: '66dd6ce5d4d85c089a869a371208c98582a33e87', class: "actions", "aria-label": "SFTP actions" }, index.h("button", { key: '105c5d93be38f4ceb1da058f5f57855decf3aa8f', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, index.h("img", { key: '8b425e80e9aa707607822b9e4ae3828ae01e4202', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), index.h("button", { key: 'd0f01c462c3e6f52155e1307f048c5027202819b', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, index.h("img", { key: '11e66f738f80032018bbe796eb8f7f42001f4b5f', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), index.h("button", { key: 'a39aed27376480e5e2dc68fc4b1ef57b8c4b0b40', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, index.h("img", { key: 'fac80ba8c1283eed058e017efc45904658f91f43', src: phirepassSftpClientUploadSvg, alt: "Upload" })), index.h("button", { key: '281854c1ac21ac8be51a22da7a5e6ac7f902f74b', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), index.h("input", { key: '9daf263acc61a2241c10817056cdb3cd8da81c9e', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && index.h("div", { key: '6611808a8f69b06bb66e2b7e82bb06e0c6469d18', class: "content" }, index.h("table", { key: '46d758f6b01f1e48acf99d0b797c5ec538717ea0' }, index.h("thead", { key: '7f3b4f05a2538d20efd43d21ec2d425a286d1b35' }, index.h("tr", { key: 'b9c8584bc98a5e9d24fd17346e325ccf511a109c' }, index.h("th", { key: '93220b4f6a1f7a7ca79978f8a98fb7218eb4a353' }, "Name"), index.h("th", { key: 'a25c5948ab02ed467ba4f71314f5ebb0756e7678' }, "Size"), index.h("th", { key: '27f32a431f5e20b4331b79ae358d7a077681a548' }, "Permissions"), index.h("th", { key: 'a3ae189c7161a3237dd2f07c50a965a0b5a51058' }, "Owner"), index.h("th", { key: 'ddc31efb5d7d3746875590ef4e52dd61375f963c' }, "Modified"), index.h("th", { key: '590b952ac4c16a9abdb4bcce432818ef9ddb1687', class: "action-col", "aria-label": "Actions" }))), index.h("tbody", { key: '5a35c2357ad4ff9e99dcd499ec894bc89466b4ba' }, this.listing.map((item, index$1) => (index.h("tr", { key: index$1, class: {
1367
+ } }, index.h("section", { key: '9d2b388a11fb9a4b1ccf8fac1d926c0451fcba3f', class: "listing" }, !this.hideHeader &&
1368
+ index.h("header", { key: '24e3f95b1ff48553e5e8bb150ee7d7ef60f74d73' }, index.h("section", { key: '1023558093761f93f32f58083b56f8385e6eecff', class: "title" }, index.h("img", { key: 'dbac57cd459cb6ebca477e85eb9fdeae51b9b8b2', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), index.h("div", { key: 'bab01697a1a84f05fbad8b15b75ba39962408c95', class: "text" }, index.h("div", { key: 'e3a29b907e3eef0e7240c13ee50d8e77ffd9a29c', class: "name" }, this.name), index.h("div", { key: 'ccdb117f874649914e4bc6fab0257d888a396ff5', class: "description" }, this.description))), index.h("section", { key: 'eda0da6fdca162f3414ba0802dad3088b00d9ab1', class: "actions" }, index.h("div", { key: 'e0882533b6e2512c0f8c074b031e17b53000413d', class: "action", onClick: () => this.toggle_max() }, index.h("img", { key: '18d6009f7e272537863034141ed22a30d7adcdb1', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), index.h("main", { key: 'fb9496e11a2d61d73052a735793931c6c262956a' }, this.show_navigation && index.h("nav", { key: 'be8098657ee5bd6335f3e37bb45c19818b3ed354', class: "navigation" }, index.h("div", { key: 'c689b18ab1c5ff8c2e06b050d9eb55253f064496', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index$1, breadcrumbs) => (index.h("span", { key: index$1, class: "breadcrumb-container" }, index.h("span", { key: index$1, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index$1 < breadcrumbs.length - 1 && index.h("img", { class: "arrow", src: phirepassSftpClientChevronSvg }))))), index.h("section", { key: '8533b0cc60a39d5e43df3646487192d75d28eb95', class: "actions", "aria-label": "SFTP actions" }, index.h("input", { key: 'a7b98422554ee133af228b18297f03c805f138e5', class: "filter", type: "search", autocorrect: "off", autocapitalize: "none", autoComplete: "off", placeholder: "Filter", "aria-label": "Filter this directory", value: this.filter, onInput: (event) => this.filter = event.target.value }), index.h("button", { key: '4ded4cb62772c4d00153c73df40f2d77946f392d', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, index.h("img", { key: '7c56e8a47b0bd650525dce7d1b14440e7fa5dd05', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), index.h("button", { key: '5f3dbe6e7bd6dbcdd9f5d08e179b96de25ddfbe4', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, index.h("img", { key: 'fad82f885c47e8fff98fdc987888bdf28533a28d', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), index.h("button", { key: '5d55e71fa8eb1f2ea1f75859eef44b5a87ece401', type: "button", class: "action", onClick: () => this.open_mkdir(), title: "New folder", "aria-label": "New folder" }, index.h("svg", { key: '58a5611574a4a862767416437d6488c3ba87a566', xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { key: 'b2bedcd737a0709e0f8af29cbe955acc15477081', d: "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }), index.h("line", { key: 'ef531e0af9df3b308d91590b15d6dfb57acbeee2', x1: "12", x2: "12", y1: "10", y2: "16" }), index.h("line", { key: '4b3fb7124f97bacf0e723e728a7ddeec3b534879', x1: "9", x2: "15", y1: "13", y2: "13" }))), index.h("button", { key: '824e0362e5a256c3848392280ea46a7f798be1c0', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, index.h("img", { key: '9566d040fa2856e1a39db5d16f7c9ac93af319f7', src: phirepassSftpClientUploadSvg, alt: "Upload" })), index.h("button", { key: '8f3cb1ca3f128af76d7bc33d162ead4d25df7459', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), index.h("input", { key: '916c345c3163ccea404fe85da708d1e5a522c8ec', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && index.h("div", { key: 'c894bda7c9f05538e099335bae720c6ac032dc70', class: "content", tabindex: 0, onKeyDown: (event) => this.on_listing_keydown(event) }, index.h("table", { key: 'e6d162543c57e0805875d52f5de8060473023113' }, index.h("thead", { key: 'b32d8edc1cc63834dada7cd4a8a9fc0aa4e641ab' }, index.h("tr", { key: '7ef2d28ba557ab36689066b830534aa644cd100a' }, index.h("th", { key: '9ec3dc58c85915562618f6dfedb466e4d32d8627', class: "sortable", onClick: () => this.toggle_sort('name'), title: "Sort by name" }, "Name", this.sort_indicator('name')), index.h("th", { key: '75164784bfde44c0844b5ba1e790fd53476ac0e0', class: "sortable", onClick: () => this.toggle_sort('size'), title: "Sort by size" }, "Size", this.sort_indicator('size')), index.h("th", { key: 'f4dc607bb845ee940030cd631bfb07aefda9316e' }, "Permissions"), index.h("th", { key: '2bcbe63f98b2ec812ae0ba82e184cdc0fa1fdfe4' }, "Owner"), index.h("th", { key: '7f3933b4191b303b99cac3a999392ea700072735', class: "sortable", onClick: () => this.toggle_sort('modified'), title: "Sort by modified date" }, "Modified", this.sort_indicator('modified')), index.h("th", { key: '6fc772fcb7eb31cc2684e5f50c7e0b25fc3cb11a', class: "action-col", "aria-label": "Actions" }))), index.h("tbody", { key: '6a506bd214a34a2f4ae0e138b43226502e2cd283' }, this.visible_listing().map((item, index$1) => (index.h("tr", { key: index$1, class: {
934
1369
  'selected': this.is_selected(item),
935
- }, onClick: () => this.list_directory(item) }, index.h("td", null, item.kind === 'Folder' ? index.h("img", { class: "kind", src: phirepassSftpClientFolderSvg, alt: "Folder" }) : index.h("img", { class: "kind", src: phirepassSftpClientFileSvg, alt: "File" }), index.h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), index.h("td", null, this.format_size(item.attributes.size)), index.h("td", null, this.format_permissions(item.attributes.permissions, item.kind)), index.h("td", null, item.attributes.user ?? '-'), index.h("td", null, new Date(item.attributes.modified * 1000).toLocaleString()), index.h("td", { class: "action-col" }, item.kind === 'File' &&
936
- index.h("div", { class: "file-actions" }, index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, index.h("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" }, index.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), index.h("polyline", { points: "7 10 12 15 17 10" }), index.h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), index.h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": "Delete" }, index.h("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" }, index.h("polyline", { points: "3 6 5 6 21 6" }), index.h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), index.h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), index.h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), index.h("line", { x1: "14", x2: "14", y1: "11", y2: "17" }))))))))))), this.show_loader && index.h("div", { key: '137cf80c05c6fa389cf9bd3bd9003d8f4796419b', class: "loader" }, "Loading..."), this.show_error && index.h("div", { key: '1ba1fad888b61e18f6dfb2bcbd7bd22e0f911c6c', class: "error" }, this.error_message)), index.h("footer", { key: '247a9ed330ff6f465cca3cae91dd045f1183d6d4' }, index.h("section", { key: '16691e17293b7f2181d080ecb68f283110b5a887', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
937
- index.h("section", { key: '8df665b59da590cd5a4c684a9eb3a772f9265cbb', class: {
1370
+ }, onClick: () => this.list_directory(item) }, index.h("td", null, item.kind === 'Folder' ? index.h("img", { class: "kind", src: phirepassSftpClientFolderSvg, alt: "Folder" }) : index.h("img", { class: "kind", src: phirepassSftpClientFileSvg, alt: "File" }), index.h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), index.h("td", null, item.kind === 'Folder' ? '-' : this.format_size(item.attributes.size)), index.h("td", null, this.format_permissions(item.attributes.permissions, item.kind)), index.h("td", null, item.attributes.user ?? '-'), index.h("td", null, new Date(item.attributes.modified * 1000).toLocaleString()), index.h("td", { class: "action-col" }, index.h("div", { class: "file-actions" }, item.kind === 'File' &&
1371
+ index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_edit_action(item, event), title: "Edit", "aria-label": `Edit ${item.name}` }, index.h("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" }, index.h("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), index.h("path", { d: "M18.5 2.5a2.12 2.12 0 0 1 3 3L12 15l-4 1 1-4Z" }))), item.kind === 'File' &&
1372
+ index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": `Download ${item.name}` }, index.h("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" }, index.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), index.h("polyline", { points: "7 10 12 15 17 10" }), index.h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_rename_action(item, event), title: "Rename", "aria-label": `Rename ${item.name}` }, index.h("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" }, index.h("path", { d: "M12 20h9" }), index.h("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" }))), index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_chmod_action(item, event), title: "Permissions", "aria-label": `Change permissions on ${item.name}` }, index.h("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" }, index.h("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }), index.h("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" }))), index.h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": `Delete ${item.name}` }, index.h("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" }, index.h("polyline", { points: "3 6 5 6 21 6" }), index.h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), index.h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), index.h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), index.h("line", { x1: "14", x2: "14", y1: "11", y2: "17" })))))))), this.visible_listing().length === 0 &&
1373
+ index.h("tr", { key: 'b056d99b4df7c0217c0eeb925d7ab8b519456a5f', class: "empty" }, index.h("td", { key: '34a0f9f9e70827e64ea9843bd0263f258fc0c20a', colSpan: 6 }, this.filter ? `Nothing here matches "${this.filter}".` : 'This directory is empty.'))))), this.show_loader && index.h("div", { key: '980fd45f6af488bf86dbbf1211abe0ccb3422b81', class: "loader" }, "Loading..."), this.show_error && index.h("div", { key: '0c368db0fd65b63f64e40119ac474d74e7832b61', class: "error" }, this.error_message)), index.h("footer", { key: '71d8b999bca0fd0a9b3a224fa370f2953abf3b5f' }, index.h("section", { key: '911030d32f3e1fab2f0df0ab43b093626124395c', class: "status" }, this.status, this.selected_item && index.h("span", { key: '19d2607ce0761647eeda4b01fbea9f4a3ccc5885', class: "selected-item" }, this.selected_item.name)), index.h("section", { key: 'e6f3f2a1b3f8adf04eff1b77f2947e210302876f', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
1374
+ index.h("section", { key: 'f08ce7f1182fffe42e7eb470e52d046095441234', class: {
938
1375
  'creds': true,
939
1376
  'blurred': this.show_login_screen,
940
- } }, index.h("form", { key: 'efffd5be69a1ac3f2df26c174be2ebb6aa989850', class: "auth", onSubmit: (event) => {
1377
+ } }, index.h("form", { key: '0fbcaaf222d20a0c5a8769d7d9614135db0971bd', class: "auth", onSubmit: (event) => {
941
1378
  const formData = new FormData(event.target);
942
1379
  let username = undefined;
943
1380
  if (this.show_login_screen_username) {
@@ -954,28 +1391,57 @@ const PhirepassSftpClient = class {
954
1391
  this.show_loader = true;
955
1392
  event.stopPropagation();
956
1393
  event.preventDefault();
957
- } }, index.h("div", { key: '6ece35409f1cb33e953857e908b5c251265f9b7a', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
958
- index.h("div", { key: 'd2e6a109f1d68ffb21fd709f9f761b7a097973ce' }, index.h("label", { key: 'df54f92649e1e3535b368bcbdb53e2061e008d9d', htmlFor: "username" }, "Username"), index.h("input", { key: '09724a6b262408825babdf1855daf97dd6e48274', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
959
- index.h("div", { key: 'b67d7fdf364616217cf0fe7493db87f368a0e00b' }, index.h("label", { key: '1a4f81e403e8048980848a22753dff7922a25eb8', htmlFor: "password" }, "Password"), index.h("input", { key: 'd7a806e065f81c07a682d0ace085dd80f96bb2e2', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), index.h("div", { key: 'eb184e90d5a99411c0c68c63c0f58b74e2b3a454' }, index.h("button", { key: '92014931e757553af1fc785fa89dc859fed6421d', type: "submit" }, "Connect")))), this.show_upload_modal &&
960
- index.h("section", { key: 'b730e0680f0e5325f506104438e30e9f3dc6ec18', class: {
1394
+ } }, index.h("div", { key: '25af70a09ffe30493a8416f30b367402017b7ed0', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
1395
+ index.h("div", { key: '3f1064e4acfc3f599e22e9314a455db72fcfd6f2' }, index.h("label", { key: 'a353afd35a192e7b8f7f66d0168974a42921a17d', htmlFor: "username" }, "Username"), index.h("input", { key: 'bc36e4f51537a4070443f9a5a82910e48842cfec', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
1396
+ index.h("div", { key: 'e7181272416bfc7928d8e714d9c3227b5d0c1f66' }, index.h("label", { key: 'd090c64f8179378cdef09bd6b9180f5707a1e43e', htmlFor: "password" }, "Password"), index.h("input", { key: '6359b22a3a2ba9c68c1d54ea07dae8b1c388d17a', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), index.h("div", { key: '778c3e57e389329fc12ad6bc90921d86aedd4e80' }, index.h("button", { key: 'ad7881537626c5242f4ff5f0ae267e4526589d0f', type: "submit" }, "Connect")))), this.show_upload_modal &&
1397
+ index.h("section", { key: '75ee6bf70138d1df39eae7559e1d5358af127858', class: {
961
1398
  'upload-modal': true,
962
1399
  'visible': this.show_upload_modal,
963
- } }, index.h("div", { key: '80205240d2af805bede0d6d42ffefad176d0b6f6', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, index.h("div", { key: 'ee11974c49a3597eaee6b588c328c5d77659c2b4', class: "title" }, "Uploading File"), index.h("div", { key: 'cf24d8f350325bf9cd6f128dc5ad2b2467ff4adb', class: "file-name", title: this.upload_file_name }, this.upload_file_name), index.h("div", { key: 'e36c4cf5785166c1d9b5121066210d87cc09d4e5', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, index.h("div", { key: 'f1db022f2d3fb92fb9686d50e4aa0366e80da8ca', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), index.h("div", { key: '515bdf6caf6a3d0c04badc923bc8a1f24d388cfe', class: "progress-meta" }, index.h("div", { key: '00935d340635aaa36004444b627e25732f7c17ab', class: "progress-speed" }, this.upload_speed), index.h("div", { key: '369e5c294ac99e1f25fceb3575838e50ce5c0cb4', class: "progress-value" }, this.format_percent(this.upload_progress))), index.h("button", { key: 'c9694acf8f7cb316a9e60bf33c80279fba7f3676', type: "button", class: {
1400
+ } }, index.h("div", { key: '87ea253eb2044c1748c9feaf1daa9c684df429f8', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, index.h("div", { key: '83c64dcfc0a59c0cc76b6d0223c8fd17346849fc', class: "title" }, "Uploading File"), index.h("div", { key: 'a71a0dec4cb9d75e0a4edc5612c41238d9729f1a', class: "file-name", title: this.upload_file_name }, this.upload_file_name), index.h("div", { key: '057c9ca8bdf18fbedd75dba33d35ef7336a1c097', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, index.h("div", { key: '7a503b29c32cc03f0491be389bd9a21b340838aa', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), index.h("div", { key: 'a9b831b1548eecfcf21ad9d3d56a22cc6e3dae84', class: "progress-meta" }, index.h("div", { key: 'f5de7e9567ed5633bb81634add297faf24d55123', class: "progress-speed" }, this.upload_speed), index.h("div", { key: '0241bcc3c54afd1cd6e5bb802b8518bb45458659', class: "progress-value" }, this.format_percent(this.upload_progress))), index.h("button", { key: '354fb6fa81acf2e48eaa3ef897fb0d48d9435494', type: "button", class: {
964
1401
  'cancel': true,
965
1402
  'finished': this.upload_finished,
966
1403
  }, onClick: () => this.cancel_upload() }, this.upload_finished ? 'Close' : 'Cancel'))), this.show_download_modal &&
967
- index.h("section", { key: 'c54157cf02112940304bd5d107e442626cbc3a3a', class: {
1404
+ index.h("section", { key: 'c5ae39a268ae33b4a623b576101fb524fb651a61', class: {
968
1405
  'download-modal': true,
969
1406
  'visible': this.show_download_modal,
970
- } }, index.h("div", { key: '51cc07975f3cb4d8d5dd29a457a2cb56d58c2bc3', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, index.h("div", { key: 'fa15597119c5656530b136a0796ba498d05f7ba3', class: "title" }, "Downloading File"), index.h("div", { key: 'a12e3b257a91a30323c018dcd0117ddcfde7ec9d', class: "file-name", title: this.download_file_name }, this.download_file_name), index.h("div", { key: '788db1afcf3506ee26dc7965060b5213b1285379', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, index.h("div", { key: '9842d1e20a24bcbb5185918b2373818414a86bb6', class: "progress-fill", style: { width: `${this.download_progress}%` } })), index.h("div", { key: '26347a189b2fc3b0594a548cb15aeaa6e1ca2901', class: "progress-meta" }, index.h("div", { key: 'c2acfab8ec6d6c74df299f7b7b1f8bdcb88702db', class: "progress-speed" }, this.download_speed), index.h("div", { key: '853c8b4b8fb5d9d13cd5c654bfdeda02b4f4e097', class: "progress-value" }, this.format_percent(this.download_progress))), index.h("button", { key: '40a339398d29082b1532cd1d13fec2027a5c0c84', type: "button", class: {
1407
+ } }, index.h("div", { key: '38817aa1411005058ae56a9ab3acd66e7e031221', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, index.h("div", { key: '96bebe6045d616d34b8aeef8876032fed887affc', class: "title" }, "Downloading File"), index.h("div", { key: '9669662ca9a60bbee2764ba1b92c7d43a20106af', class: "file-name", title: this.download_file_name }, this.download_file_name), index.h("div", { key: '66b7759dbec989dbd093a3635d312ffd78059356', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, index.h("div", { key: '6ef0146a885aadfdf90de134ab8c4ad34b6a0a34', class: "progress-fill", style: { width: `${this.download_progress}%` } })), index.h("div", { key: '073bb8a2452515e0ea3678ed5da5e85a09df61ba', class: "progress-meta" }, index.h("div", { key: 'a401199826a0b028e26dc17155e056fa5b18b049', class: "progress-speed" }, this.download_speed), index.h("div", { key: 'a0c6170323d18d62107ea9c93405218773ef8f74', class: "progress-value" }, this.format_percent(this.download_progress))), index.h("button", { key: '9b8beb35c26a57b42c2e1b8b96eadb875e893668', type: "button", class: {
971
1408
  'cancel': true,
972
1409
  'finished': this.download_finished,
973
1410
  }, onClick: () => this.cancel_download() }, this.download_finished ? 'Close' : 'Cancel'))), this.show_delete_modal &&
974
- index.h("section", { key: '07ca147451fe3063aa418ee46af09d5d037752cc', class: {
1411
+ index.h("section", { key: 'acb147f3b2474a12948153992db4b105ec46c2e3', class: {
975
1412
  'delete-modal': true,
976
1413
  'visible': this.show_delete_modal,
977
- } }, index.h("div", { key: '5c11193b4808d43d33151cb5eebf8efa54ec75bd', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation" }, index.h("div", { key: '858d54eddbb5ed0b72176494ac515fc4c7b16dfc', class: "title" }, "Delete File"), index.h("div", { key: 'df347ceded9b6e8b44285e0b4122cd363c2504a2', class: "message" }, this.delete_loading ? 'Deleting file...' : 'Are you sure you want to delete this file?'), index.h("div", { key: 'c547c48ba66daabb9bed82d220d87b8b0eef25b3', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_loading &&
978
- index.h("div", { key: 'a3fd5cf9a93a5d2937a10d8333bb2dd6abe73254', class: "delete-loader", "aria-hidden": "true" }, index.h("span", { key: 'ca4414ae7183139b1ff8b36630e330f05896c0fd', class: "spinner" })), index.h("div", { key: 'e229b2804e7cbed6edbbd1b6542b7a33ac1c0575', class: "modal-actions" }, index.h("button", { key: 'eedf2e90f7896fcce7db6bad995c890d79ec9361', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), index.h("button", { key: '010e0b6468eb7522f7131e2a37d4b25fad828837', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete'))))));
1414
+ } }, index.h("div", { key: '1adb2b1ed0183ec136bfdaf63b4dfe880f919811', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation", tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.cancel_delete()) }, index.h("div", { key: '2481008ad54e92f4abd82c8e2c36a52e34db0c7c', class: "title" }, this.delete_is_dir ? 'Delete Folder' : 'Delete File'), index.h("div", { key: 'a91a942f3b35b7886033146597bb1ff7b9998dc1', class: "message" }, this.delete_loading
1415
+ ? (this.delete_recursive ? 'Deleting the folder and everything in it...' : 'Deleting...')
1416
+ : `Are you sure you want to delete this ${this.delete_is_dir ? 'folder' : 'file'}?`), index.h("div", { key: 'f218cfc2faa0843b7dc8715f96aff55986aeab15', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_is_dir &&
1417
+ index.h("label", { key: '9477429e9d929c95f8173160ea3983034a3e3849', class: "checkline" }, index.h("input", { key: '6573ea9e9b7af1d6233ddf8328b152226b6957bb', type: "checkbox", checked: this.delete_recursive, disabled: this.delete_loading, onChange: (event) => this.delete_recursive = event.target.checked }), index.h("span", { key: '0e2f1fed38cd99272af527a4aebeb56afaaa1c0d' }, "Delete everything inside it too")), !this.delete_is_dir || this.delete_recursive ? null :
1418
+ index.h("div", { class: "hint" }, "Without this, the remote refuses a folder that is not empty."), this.delete_error && index.h("div", { key: '837a597c00932e82be2e713badba936dcefb8b40', class: "dialog-error" }, this.delete_error), this.delete_loading &&
1419
+ index.h("div", { key: '1e350abb9e5d93fff3a496797d5c53c3c2de1827', class: "delete-loader", "aria-hidden": "true" }, index.h("span", { key: '89ea233eba5a799e702944afb1c989e707497c77', class: "spinner" })), index.h("div", { key: '679d16bc9641e98c993bce468cf09a6cd06a345d', class: "modal-actions" }, index.h("button", { key: '2fbcf1783b8a6aeb6f9c7d3f20a8abf3ae68d816', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), index.h("button", { key: '00cb2afd0df514a36c7977e800007746e8c8e73d', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete')))), this.prompt_kind &&
1420
+ index.h("section", { key: '7ac274aaa8c19e6d77c3a0be9feb68630fccb84f', class: "prompt-modal visible" }, index.h("div", { key: 'b9f9099ae61a0b518491c32e3f6aef79c28a812f', class: "prompt-dialog", role: "dialog", "aria-modal": "true", "aria-label": this.prompt_kind === 'mkdir' ? 'New folder' : 'Rename', tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.close_prompt()) }, index.h("div", { key: 'e837df12158553b576282957ba368caf977f4d2a', class: "title" }, this.prompt_kind === 'mkdir' ? 'New Folder' : 'Rename'), index.h("div", { key: '25b71e67724d98f50cb3d21722822bddf8bc2c4c', class: "message" }, this.prompt_kind === 'mkdir'
1421
+ ? `Create a folder in ${this.current_dir}`
1422
+ : 'Give it a new name. Existing names are not overwritten.'), index.h("form", { key: '390328d2b0f27a1a315a2bc55ae520e907813068', onSubmit: (event) => { event.preventDefault(); event.stopPropagation(); void this.submit_prompt(); } }, index.h("input", { key: 'dc958cd778250116043d82f191c0f4fb2fcf1c91', class: "dialog-input", type: "text", autocorrect: "off", autocapitalize: "none", autoComplete: "off", spellcheck: false, "aria-label": "Name", disabled: this.prompt_busy, value: this.prompt_value, onInput: (event) => this.prompt_value = event.target.value, ref: (el) => this.focus_once(el, this.promptInputEl, (kept) => this.promptInputEl = kept) }), this.prompt_error && index.h("div", { key: '588e3aa9ec1759e24404784164a83001f1da8bb8', class: "dialog-error" }, this.prompt_error), index.h("div", { key: '15850d8a366a2a5f87e9b10c0351d684c3c30f78', class: "modal-actions" }, index.h("button", { key: 'dbfb5831fd896fc711efe53cbfe8ed57af19a2e3', type: "button", class: "btn secondary", onClick: () => this.close_prompt(), disabled: this.prompt_busy }, "Cancel"), index.h("button", { key: '95c872e35e3f65f4a7f0893b45c4d258b082b020', type: "submit", class: "btn primary", disabled: this.prompt_busy }, this.prompt_busy ? 'Working...' : (this.prompt_kind === 'mkdir' ? 'Create' : 'Rename')))))), this.chmod_target &&
1423
+ index.h("section", { key: '52373d1f66e3db9da1d8bb3018788efbf19fc762', class: "prompt-modal visible" }, index.h("div", { key: '887b863eb1d41d99acebbe7abe19273b202bbed2', class: "prompt-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Change permissions", tabindex: -1, onKeyDown: (event) => this.on_modal_keydown(event, () => this.close_chmod()) }, index.h("div", { key: '8c686b15eb982779633720236d3e00559ed37edd', class: "title" }, "Permissions"), index.h("div", { key: 'af9b7c128bc8bf0072c9c52de052435b3f8a6574', class: "file-name", title: this.chmod_target.name }, this.chmod_target.name), index.h("table", { key: '996e04c071fb8bbde39a0c811d8beef052f311c5', class: "perm-grid" }, index.h("thead", { key: '767477a3d4aacfe75fa4fa0bdc762c6d3448cebb' }, index.h("tr", { key: '5198f4e64fa9903cfd0c5221cb9ab86d690253e3' }, index.h("th", { key: 'd6fb60c8407b19a61e0d215ca8a9a1daa228e98e', "aria-label": "Class" }), index.h("th", { key: '9c1d18a98cd7471f6bae9f1009a2425287f60ef7' }, "Read"), index.h("th", { key: '529584b9be0ac95104818e22b7cd515b9e0f79f8' }, "Write"), index.h("th", { key: '9402ec30094930c53822722c17dd126949c8705e' }, "Execute"))), index.h("tbody", { key: '6aae29e72101eab4f5191696d64d65db35361b95' }, [
1424
+ { label: 'Owner', read: 0o400, write: 0o200, exec: 0o100 },
1425
+ { label: 'Group', read: 0o040, write: 0o020, exec: 0o010 },
1426
+ { label: 'Other', read: 0o004, write: 0o002, exec: 0o001 },
1427
+ ].map((row) => (index.h("tr", { key: row.label }, index.h("th", { scope: "row" }, row.label), [row.read, row.write, row.exec].map((bit) => (index.h("td", { key: bit }, index.h("input", { type: "checkbox", "aria-label": `${row.label} ${bit}`, disabled: this.chmod_busy, checked: (this.chmod_mode & bit) !== 0, onChange: () => this.toggle_chmod_bit(bit) }))))))))), index.h("div", { key: 'c429b0d2bff193da9b48a2802719b774899125f4', class: "perm-special" }, [
1428
+ { label: 'setuid', bit: 0o4000 },
1429
+ { label: 'setgid', bit: 0o2000 },
1430
+ { label: 'sticky', bit: 0o1000 },
1431
+ ].map((special) => (index.h("label", { key: special.label, class: "checkline" }, index.h("input", { type: "checkbox", disabled: this.chmod_busy, checked: (this.chmod_mode & special.bit) !== 0, onChange: () => this.toggle_chmod_bit(special.bit) }), index.h("span", null, special.label))))), index.h("div", { key: '8927030347b5a78bbc2d0c68963cfa4b50aafc7b', class: "perm-octal" }, index.h("label", { key: '23cab841c245e4efabbf2348d0b932e70084f15d', htmlFor: "chmod-octal" }, "Octal"), index.h("input", { key: '1db5c92a844e4458bd6b3be663d9d1c87d523cb1', id: "chmod-octal", class: "dialog-input", type: "text", autocorrect: "off", autocapitalize: "none", autoComplete: "off", spellcheck: false, maxlength: 4, disabled: this.chmod_busy, value: this.chmod_mode.toString(8).padStart(4, '0'), onInput: (event) => this.on_chmod_octal_input(event.target.value) }), index.h("span", { key: '636db9e85c1e551e3f09882acddca4b5e00ddb3a', class: "perm-preview" }, this.format_permissions(this.chmod_mode, this.chmod_target.kind))), this.chmod_error && index.h("div", { key: '295b4b35efbabede3481ba87df67dd6c49d96cc4', class: "dialog-error" }, this.chmod_error), index.h("div", { key: 'c226a4e3bed1a0388ceed76813667012d1022a4b', class: "modal-actions" }, index.h("button", { key: '716e0e6c46cbdb72872200a3ce5041212b41c63a', type: "button", class: "btn secondary", onClick: () => this.close_chmod(), disabled: this.chmod_busy }, "Cancel"), index.h("button", { key: '3b579eccd182089b65047280a0a8523aa62e3c74', type: "button", class: "btn primary", onClick: () => void this.submit_chmod(), disabled: this.chmod_busy }, this.chmod_busy ? 'Applying...' : 'Apply')))), this.show_editor &&
1432
+ index.h("section", { key: 'c965bc02d104440f0e171a7ebbc3b63bf11b1ca7', class: "editor-modal visible" }, index.h("div", { key: '4796d6b8b79a6a1f486109005bac2f9f76c424d2', class: "editor-dialog", role: "dialog", "aria-modal": "true", "aria-label": `Editing ${this.editor_name}`, tabindex: -1, onKeyDown: (event) => {
1433
+ if ((event.ctrlKey || event.metaKey) && event.key === 's') {
1434
+ event.preventDefault();
1435
+ void this.save_editor();
1436
+ return;
1437
+ }
1438
+ this.on_modal_keydown(event, () => this.close_editor());
1439
+ } }, index.h("div", { key: '9f5a55b46763e68b7a127b1b341a6a54e46628f4', class: "editor-head" }, index.h("div", { key: '59b7d4105a5a31e66c520ff0f809bdc59e700330', class: "title" }, this.editor_name, this.editor_is_dirty() ? ' *' : ''), index.h("button", { key: 'ee74ac43364b05393e3ddbffb40f291bd855a4f8', type: "button", class: "editor-close", onClick: () => this.close_editor(), "aria-label": "Close editor", disabled: this.editor_busy === 'saving' }, "x")), this.editor_busy === 'loading'
1440
+ ? index.h("div", { class: "editor-loading" }, "Loading...")
1441
+ : index.h("textarea", { class: "editor-text", spellcheck: false, autocorrect: "off", autocapitalize: "none", autoComplete: "off", "aria-label": "File contents", disabled: this.editor_busy === 'saving' || !this.editor_loaded, value: this.editor_text, onInput: (event) => this.editor_text = event.target.value, ref: (el) => this.focus_once(el, this.editorTextEl, (kept) => this.editorTextEl = kept) }), this.editor_error && index.h("div", { key: '9a6c47f21cdce7cc76ce3cb9c5ca12af7215004e', class: "dialog-error" }, this.editor_error), this.editor_confirm_discard &&
1442
+ index.h("div", { key: 'd445399441b1411d5f2607c1bed36551e8421b39', class: "dialog-error" }, "Unsaved changes. Close anyway?"), index.h("div", { key: '9a98131525346b0b818dc55f7f02d0be579a75c9', class: "modal-actions" }, this.editor_confirm_discard
1443
+ ? index.h("button", { type: "button", class: "btn destructive", onClick: () => this.close_editor(true) }, "Discard")
1444
+ : index.h("button", { type: "button", class: "btn secondary", onClick: () => this.close_editor(), disabled: this.editor_busy === 'saving' }, "Close"), index.h("button", { key: '23cbe88de46ef76de09c02e54074606aec5aa3e8', type: "button", class: "btn primary", onClick: () => void this.save_editor(), disabled: !!this.editor_busy || !this.editor_is_dirty() }, this.editor_busy === 'saving' ? 'Saving...' : 'Save'))))));
979
1445
  }
980
1446
  static get watchers() { return {
981
1447
  "nodeId": [{