phirepass-widgets 0.0.101 → 0.0.102

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