phirepass-widgets 0.0.46 → 0.0.48

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 (37) hide show
  1. package/dist/cjs/{index-DTAHGGCM.js → index-DqslB2R4.js} +85 -2
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +202 -20
  4. package/dist/cjs/phirepass-terminal.cjs.entry.js +3 -3
  5. package/dist/cjs/phirepass-widgets.cjs.js +2 -2
  6. package/dist/cjs/{protocol-C0YjPrve.js → protocol-BDROfN76.js} +2 -1
  7. package/dist/collection/common/protocol.js +1 -0
  8. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.chevron.svg +6 -0
  9. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +482 -119
  10. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.download.svg +7 -0
  11. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.file.svg +6 -0
  12. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.folder.svg +6 -0
  13. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.go_up.svg +6 -0
  14. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +206 -19
  15. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.refresh.svg +8 -0
  16. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.upload.svg +7 -0
  17. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
  18. package/dist/components/index.js +1 -1
  19. package/dist/{phirepass-widgets/p-rdgKcesn.js → components/p-BcIhGXR0.js} +1 -1
  20. package/dist/components/phirepass-sftp-client.js +1 -1
  21. package/dist/components/phirepass-terminal.js +2 -2
  22. package/dist/esm/{index-D6RLmr6w.js → index-jdexunMF.js} +85 -2
  23. package/dist/esm/loader.js +3 -3
  24. package/dist/esm/phirepass-sftp-client.entry.js +202 -20
  25. package/dist/esm/phirepass-terminal.entry.js +3 -3
  26. package/dist/esm/phirepass-widgets.js +3 -3
  27. package/dist/esm/{protocol-rdgKcesn.js → protocol-BcIhGXR0.js} +1 -0
  28. package/dist/phirepass-widgets/p-764392dc.entry.js +1 -0
  29. package/dist/{components/p-rdgKcesn.js → phirepass-widgets/p-BcIhGXR0.js} +1 -1
  30. package/dist/phirepass-widgets/{p-f8e6ba02.entry.js → p-d8e588a3.entry.js} +2 -2
  31. package/dist/phirepass-widgets/p-jdexunMF.js +2 -0
  32. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  33. package/dist/types/common/protocol.d.ts +37 -13
  34. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +28 -1
  35. package/package.json +1 -1
  36. package/dist/phirepass-widgets/p-5e9ce2ac.entry.js +0 -1
  37. package/dist/phirepass-widgets/p-D6RLmr6w.js +0 -2
@@ -1,11 +1,23 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-D6RLmr6w.js';
2
- import { _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-rdgKcesn.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-jdexunMF.js';
2
+ import { _ as __wbg_init, E as ErrorType, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-BcIhGXR0.js';
3
3
 
4
4
  const phirepassSftpClientLogoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==';
5
5
 
6
6
  const phirepassSftpClientMaxSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K';
7
7
 
8
- const phirepassSftpClientCss = () => `:host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--muted-foreground:220 10% 50%;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;.listing{flex:1;display:flex;flex-direction:column;justify-content:space-between;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))}}}}footer{height:25px;background:rgba(28, 31, 38, 0.6);border-top:1px solid hsl(var(--border))}}.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)}.form{display:flex;flex-direction:column;background:hsl(var(--card));width:200px;position:relative;background-color:rgba(21, 24, 30, 0.95);border:1px solid hsl(var(--border));padding:20px;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}}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}`;
8
+ const phirepassSftpClientChevronSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K';
9
+
10
+ const phirepassSftpClientFolderSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K';
11
+
12
+ const phirepassSftpClientFileSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==';
13
+
14
+ const phirepassSftpClientGoUpSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==';
15
+
16
+ const phirepassSftpClientRefreshSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==';
17
+
18
+ const phirepassSftpClientUploadSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==';
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;.listing{flex:1;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{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;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:20px;min-width:20px;padding:0 10px}&:hover{&.action-col{color:blue;background-color:red;stroke:red}}}}tbody{padding:10px 10px;tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&.action-col{width:20px;min-width:20px;text-align:center;padding-left:1px;padding-right:1px;.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))}}}.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)}}}}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}`;
9
21
 
10
22
  const PhirepassSftpClient = class {
11
23
  constructor(hostRef) {
@@ -17,8 +29,9 @@ const PhirepassSftpClient = class {
17
29
  domReady = false;
18
30
  runtimeReady = false;
19
31
  connected = false;
32
+ uploadInputEl;
20
33
  // private inputMode: InputMode = InputMode.Default;
21
- // private session_id?: number;
34
+ session_id;
22
35
  // private usernameBuffer = "";
23
36
  // private passwordBuffer = "";
24
37
  name = 'SFTP';
@@ -44,6 +57,7 @@ const PhirepassSftpClient = class {
44
57
  if (newValue) {
45
58
  this.open_comms();
46
59
  this.channel.connect();
60
+ this.status = 'Connecting...';
47
61
  }
48
62
  }
49
63
  serverId;
@@ -61,7 +75,18 @@ const PhirepassSftpClient = class {
61
75
  max = false;
62
76
  show_login_screen = false;
63
77
  show_login_screen_username = false;
78
+ show_error = false;
79
+ error_message = '';
64
80
  show_login_screen_password = false;
81
+ show_navigation = false;
82
+ breadcrumbs = [];
83
+ current_dir = '.';
84
+ listing = [];
85
+ show_content = false;
86
+ show_loader = false;
87
+ version = '';
88
+ status = 'Disconnected';
89
+ selected_item = null;
65
90
  toggle_max() {
66
91
  this.maximizeEvent?.emit(!this.max);
67
92
  }
@@ -98,6 +123,7 @@ const PhirepassSftpClient = class {
98
123
  connect() {
99
124
  this.connected = true;
100
125
  this.channel.connect();
126
+ this.status = 'Connecting...';
101
127
  // const container = this.containerEl;
102
128
  // console.log('Attempting to connect terminal to container:', container);
103
129
  // if (container) {
@@ -131,22 +157,63 @@ const PhirepassSftpClient = class {
131
157
  }
132
158
  return `${protocol}://${this.serverHost}:${this.serverPort}`;
133
159
  }
134
- handle_error(_error_) {
135
- //
160
+ handle_error(error) {
161
+ switch (error.kind) {
162
+ case ErrorType.Generic:
163
+ case ErrorType.Authentication:
164
+ this.error_message = error.message || 'An unknown error occurred.';
165
+ break;
166
+ case ErrorType.RequiresUsername:
167
+ this.show_login_screen_username = true;
168
+ this.show_login_screen_password = false;
169
+ this.show_login_screen = true;
170
+ break;
171
+ case ErrorType.RequiresPassword:
172
+ this.show_login_screen_username = false;
173
+ this.show_login_screen_password = true;
174
+ this.show_login_screen = true;
175
+ break;
176
+ case ErrorType.RequiresUsernamePassword:
177
+ this.show_login_screen_username = true;
178
+ this.show_login_screen_password = true;
179
+ this.show_login_screen = true;
180
+ break;
181
+ }
182
+ setTimeout(() => {
183
+ this.show_loader = false;
184
+ }, 1_000);
136
185
  }
137
- handle_auth_success(_auth_) {
186
+ handle_auth_success(auth) {
138
187
  this.clear_creds_buffer();
188
+ this.version = auth.version;
139
189
  this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
140
190
  this.channel.open_sftp_tunnel(this.nodeId);
191
+ this.status = 'Connected';
141
192
  }
142
- handle_tunnel_opened(_web_) {
143
- // this.session_id = web.sid;
193
+ handle_tunnel_opened(web) {
194
+ this.session_id = web.sid;
144
195
  // this.terminal.reset();
145
196
  // this.fit_terminal_safely();
146
197
  // this.send_ssh_terminal_resize();
198
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, this.current_dir);
147
199
  }
148
- handle_tunnel_data(_web_) {
149
- // TODO
200
+ handle_sftp_list_items(web) {
201
+ setTimeout(() => {
202
+ this.show_loader = false;
203
+ }, 500);
204
+ this.listing = web.dir.items;
205
+ this.current_dir = web.path;
206
+ this.breadcrumbs = web.path.split('/').map((path, index, arr) => {
207
+ if (path === '' && index === 0) {
208
+ return { label: '/', path: '/' };
209
+ }
210
+ return { label: path, path: arr.slice(0, index + 1).join('/') };
211
+ });
212
+ this.show_content = true;
213
+ this.show_navigation = true;
214
+ }
215
+ handle_tunnel_data(web) {
216
+ console.log('received tunnel data:', web);
150
217
  }
151
218
  handle_tunnel_closed(_web_) {
152
219
  // this.session_id = undefined;
@@ -166,16 +233,18 @@ const PhirepassSftpClient = class {
166
233
  this.channel.on_connection_open(() => {
167
234
  this.connectionStateChanged.emit([ConnectionState.Connected]);
168
235
  this.channel.authenticate(this.token, this.nodeId);
236
+ this.status = 'Authenticating...';
169
237
  });
170
238
  this.channel.on_connection_close(() => {
171
239
  this.connectionStateChanged.emit([ConnectionState.Disconnected]);
172
- // this.terminal.reset();
240
+ this.status = 'Disconnected';
173
241
  });
174
242
  this.channel.on_connection_error((err) => {
175
243
  this.connectionStateChanged.emit([ConnectionState.Error, err]);
244
+ this.status = 'Error ' + err.message;
176
245
  });
177
246
  this.channel.on_connection_message((_raw_) => {
178
- // console.log('>> raw message received', raw);
247
+ //
179
248
  });
180
249
  this.channel.on_protocol_message((msg) => {
181
250
  const { web } = msg.data;
@@ -195,8 +264,11 @@ const PhirepassSftpClient = class {
195
264
  case ProtocolMessageType.TunnelData:
196
265
  this.handle_tunnel_data(web);
197
266
  break;
267
+ case ProtocolMessageType.SFTPListItems:
268
+ this.handle_sftp_list_items(web);
269
+ break;
198
270
  default:
199
- console.warn('Unknown protocol message type:', web);
271
+ console.warn('Unhandled protocol message type:', web);
200
272
  }
201
273
  });
202
274
  }
@@ -213,15 +285,125 @@ const PhirepassSftpClient = class {
213
285
  // this.inputMode = InputMode.Default;
214
286
  this.clear_creds_buffer();
215
287
  }
288
+ list_breadcrumb(path) {
289
+ this.show_loader = true;
290
+ this.selected_item = null;
291
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, path);
292
+ }
293
+ go_to_parent_directory() {
294
+ if (!this.session_id) {
295
+ return;
296
+ }
297
+ if (this.current_dir === '/') {
298
+ return;
299
+ }
300
+ const parent = this.breadcrumbs[this.breadcrumbs.length - 2]?.path || '/';
301
+ this.list_breadcrumb(parent);
302
+ }
303
+ refresh_directory() {
304
+ if (!this.session_id) {
305
+ return;
306
+ }
307
+ this.list_breadcrumb(this.current_dir);
308
+ }
309
+ disconnect_session() {
310
+ this.close_comms();
311
+ this.session_id = undefined;
312
+ this.show_loader = false;
313
+ this.show_content = false;
314
+ this.breadcrumbs = [];
315
+ this.current_dir = '.';
316
+ this.listing = [];
317
+ this.show_navigation = false;
318
+ this.show_login_screen_username = false;
319
+ this.show_login_screen_password = false;
320
+ this.show_login_screen = false;
321
+ this.version = '';
322
+ this.status = 'Disconnected';
323
+ }
324
+ on_file_row_action(item, event) {
325
+ event.preventDefault();
326
+ event.stopPropagation();
327
+ this.selected_item = item;
328
+ window.alert(`Download for "${item.name}" is not available yet.`);
329
+ }
330
+ open_upload_picker() {
331
+ this.uploadInputEl?.click();
332
+ }
333
+ on_upload_selected(event) {
334
+ const input = event.target;
335
+ const file = input.files?.[0];
336
+ if (!file) {
337
+ return;
338
+ }
339
+ this.show_error = true;
340
+ this.error_message = 'Upload is not available yet in this widget.';
341
+ setTimeout(() => {
342
+ this.show_error = false;
343
+ }, 2_000);
344
+ input.value = '';
345
+ }
346
+ is_selected(item) {
347
+ if (!this.selected_item) {
348
+ return false;
349
+ }
350
+ return this.selected_item.path === item.path &&
351
+ this.selected_item.name === item.name;
352
+ }
353
+ list_directory(entry) {
354
+ if (!this.session_id) {
355
+ console.warn('No active session. Cannot list directory.');
356
+ return;
357
+ }
358
+ if (entry.kind === 'File') {
359
+ console.warn('Cannot list directory of a file. Ignoring click.');
360
+ this.selected_item = entry;
361
+ return;
362
+ }
363
+ const path = [entry.path, entry.name].join('/');
364
+ if (path === this.current_dir) {
365
+ console.warn('Already in this directory. Ignoring click.');
366
+ return;
367
+ }
368
+ this.show_loader = true;
369
+ this.selected_item = null;
370
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, path);
371
+ }
372
+ get_full_path(item) {
373
+ return [item.path, item.name].join('/');
374
+ }
216
375
  render() {
217
- return (h(Host, { key: 'ac63e2c701cd09a605d0aaa7396eaec16ff9c3bc', class: {
376
+ return (h(Host, { key: '84b1bd4b89e4e18be8165b2501af5fcf7bb09b68', class: {
218
377
  'default': !this.max,
219
378
  'max': this.max,
220
- } }, h("section", { key: '253dfc510c62ee57a96d574af993e8017475a0c2', class: "listing" }, !this.hideHeader &&
221
- h("header", { key: '215ddf76ba55641892fc9a758077ba8d1f3a6671' }, h("section", { key: '49541a8d31d8c61e2df84c60348f7426fddec67c', class: "title" }, h("img", { key: '1a86ba6b3de92b35cbd5b1bacfdfee2da6fa6766', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), h("div", { key: '38d90384978acc8b323ca4c396db7bda54320059', class: "text" }, h("div", { key: 'a94b3fd21025000b620b2bb85aec87198e575bfa', class: "name" }, this.name), h("div", { key: '072c41dc8d05faf77929f8c128bb97b64d8835bf', class: "description" }, this.description))), h("section", { key: '46e575f4ce5f2da0913d2f3aebe025540f1f3688', class: "actions" }, h("div", { key: 'f92d66ab7ab5e9c25a29037c60709c54623194be', class: "action", onClick: () => this.toggle_max() }, h("img", { key: 'e115204a83336fc4b49a30551208b727c3f33be9', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), h("main", { key: 'c6bf5ab4e5aa46dcba8e50ec1a9c2feb1f55ea02' }), h("footer", { key: 'ac67a3e0966e3f04bee019162f8174aae58cbf1a' })), h("section", { key: '07e83117470f7f226328703b18f836bd4358cfe9', class: {
222
- 'creds': true,
223
- 'blurred': this.show_login_screen,
224
- } }, this.show_login_screen && h("form", { key: '808209eaba50f10a8ef96163972ad36ea9e3d3e2', class: "form" }, h("div", { key: '9e26efeac2f17d6b4168e1a77da6ef61d325f6e3' }, "SFTP Connection"), h("div", { key: 'f9badb92d4434a16916429a2bedb6e38d2ae647c' }, h("div", { key: '9fb267ba7828cd950b327a17e0ee803dc399c80b' }, "Username"), h("input", { key: '65b34c14292b0bde408861e791f3baa99c4c9a02', type: "text", placeholder: "" })), h("div", { key: 'f1f9def8290dfcde9beff0f61092f6020580b72c' }, h("div", { key: '1c89b71c4126299b7e8e421b05761d2b0424d4ed' }, "Password"), h("input", { key: '17364976158ddaacbb55ed17ee09ec242bcbdce7', type: "password", placeholder: "" })), h("div", { key: '9362acdf153ceeba3c8e8cee0518cf2baeec27e0' }, h("button", { key: 'ebf6c205276a7c3ff34c13e148978be61044ff7a' }, "Connect"))))));
379
+ } }, h("section", { key: 'fd8e39bc72055158a7a1daac5f536e4d34393db9', class: "listing" }, !this.hideHeader &&
380
+ h("header", { key: '5f223331f9e2b5c6570ce80313c121c94ce36805' }, h("section", { key: '1314b571f73bbdc07dd46f5015f75789793461e5', class: "title" }, h("img", { key: 'e582af1a23c051ddc9e0a44737f4c53a048b85be', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), h("div", { key: 'f43bd6e4409b0e353b1224866b0d6ebe55e37705', class: "text" }, h("div", { key: 'f84ec4ed31f44b6216cf98fedda2eee3f6d3fae0', class: "name" }, this.name), h("div", { key: 'ad6b56a1f9e69b70be8e1906d26538ecf5e81369', class: "description" }, this.description))), h("section", { key: '4cc95044e4d7ea1bacb8de579c6d22a29530a124', class: "actions" }, h("div", { key: 'fb85bf224c56e874ee7b4c0818ba35bcc06b4c35', class: "action", onClick: () => this.toggle_max() }, h("img", { key: '5cfbeafc5bbce5e5b87d75b23113a93c83d48f3b', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), h("main", { key: 'f0ed3ecc82981b8352b4908df9bcc7706c07c111' }, this.show_navigation && h("nav", { key: '8b790eab0adc12e592b73e6757c1663db88f5a49', class: "navigation" }, h("div", { key: '85c62f8b0e15d7aa77572028665d51705f9ef453', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index, breadcrumbs) => (h(h.Fragment, null, 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: '9e1f1b406f3ac7b1a4fdda4081f310bdc054e125', class: "actions", "aria-label": "SFTP actions" }, h("button", { key: '1f95decb5addbd8c7c1b48b811e72231afb01491', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: '888341d92e55f79037ccb8eca6b0eec69ff2f406', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), h("button", { key: '41d8256a3c8e7e6810c6f979537be3556de3611a', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: 'e7e2d8feef73e5a77580f311d3248baaa62a44ec', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), h("button", { key: '4a1453249181827600e980bfcc5eef10b94c4bd7', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: '66dc18510465e05509ea966b0d48a92dabc5a00d', src: phirepassSftpClientUploadSvg, alt: "Upload" })), h("button", { key: 'cbc12df3cb223cf650a12980f2b10db5114b2bff', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: '8b472b4b82995d286127f60e394f6f83b88d05bd', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: '9f4517dfb33071e1d1702c73fcbaaa812049c012', class: "content" }, h("table", { key: '841b90ae73e52083478dcccb54d75ef52b208d74' }, h("thead", { key: '96f9129791c51bae1f1693b4a77c3866cefe7ada' }, h("tr", { key: 'd5d5e032d059751a65305577670f1370c8cb0be5' }, h("th", { key: '06a796b795813f286c1823eb053bc21211c7a6c2' }, "Name"), h("th", { key: '4ce88c6ceb13af2d9e80a5c733a02ac7a15558ba' }, "Size"), h("th", { key: 'b4746be62c9c882f3c335b433486bc094b0fe6c3' }, "Permissions"), h("th", { key: '8ab7d1bab01ce229b236d9aceb3ca166b84b2551' }, "Owner"), h("th", { key: 'baaf0986f2851903e22d8bb8c5a2aff8c4762bf1' }, "Modified"), h("th", { key: 'be874212a04f3e6f9764fb664837e11cacfc9b32', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: 'd14243b3467786b08a3cd8d53b4e365c7c9d644d' }, this.listing.map((item, index) => (h("tr", { key: index, class: {
381
+ 'selected': this.is_selected(item),
382
+ }, 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.attributes.size), h("td", null, item.attributes.permissions ?? '-'), h("td", null, item.attributes.user ?? '-'), h("td", null, new Date(item.attributes.mtime * 1000).toLocaleString()), h("td", { class: "action-col" }, item.kind === 'File' &&
383
+ 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" })))))))))), this.show_loader && h("div", { key: 'ee78459b85c3ffaf2583fd79edadc1398a96aa81', class: "loader" }, "Loading..."), this.show_error && h("div", { key: 'f658bc7e5fd922d9a9499f2b6402ca3a6453adb8', class: "error" }, this.error_message)), h("footer", { key: '8928750efac3a300348a0c2cfd97c735820351c7' }, h("section", { key: '2c72adc84a24cf9255219125ad617578d9d4e50d', class: "status" }, h("span", { key: '192c7f26e2372e22b8d48d3ce0d6697d20c1ad4a' }, this.status), this.selected_item && h("span", { key: '01d1d92290b47332e014b010be7575d9976a61d6', class: "selected-item" }, this.get_full_path(this.selected_item))), h("section", { key: '32951e5b9ae53f2d84d90b43820801d1a2caeb65', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
384
+ h("section", { key: '46ea29aafbc1b4392d5a368534b1fd1f5ca8446a', class: {
385
+ 'creds': true,
386
+ 'blurred': this.show_login_screen,
387
+ } }, h("form", { key: 'c70ab635c91947a722dd203a346ed40b76471a25', class: "auth", onSubmit: (event) => {
388
+ const formData = new FormData(event.target);
389
+ let username = undefined;
390
+ if (this.show_login_screen_username) {
391
+ username = formData.get('username');
392
+ }
393
+ let password = undefined;
394
+ if (this.show_login_screen_password) {
395
+ password = formData.get('password');
396
+ }
397
+ this.channel.open_sftp_tunnel(this.nodeId, username, password);
398
+ this.show_login_screen_username = false;
399
+ this.show_login_screen_password = false;
400
+ this.show_login_screen = false;
401
+ this.show_loader = true;
402
+ event.stopPropagation();
403
+ event.preventDefault();
404
+ } }, h("div", { key: '498d0374665f404fac6feef40ddcb7bc386e749b', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
405
+ h("div", { key: '2ff0c7b6bce0dabde50cc73de23ca3068951ef3d' }, h("label", { key: 'b6b6fb3d1c645e0ba7f55c420db3077a785cac48', htmlFor: "username" }, "Username"), h("input", { key: '42e5c54dcf9ee40fc35c84b44be942b4775a82b4', id: "username", autoComplete: 'off', name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
406
+ h("div", { key: 'ef4861042d2b239766add5185e8f4d46af526232' }, h("label", { key: '901716f1f0f61d9116bdac51cc96581778bf2ebb', htmlFor: "password" }, "Password"), h("input", { key: 'da97e27113dfc2e9bb0c0a32e9b94140db1defa7', id: "password", autoComplete: 'off', name: "password", type: "password", placeholder: "" })), h("div", { key: 'd8c497d4072f7b3940b483f02a722058c0b8a843' }, h("button", { key: 'bd9a920f46b0c48a15936a2249dadc4f04cdcc0f', type: "submit" }, "Connect"))))));
225
407
  }
226
408
  static get watchers() { return {
227
409
  "nodeId": [{
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-D6RLmr6w.js';
2
- import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-rdgKcesn.js';
1
+ import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-jdexunMF.js';
2
+ import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-BcIhGXR0.js';
3
3
 
4
4
  /**
5
5
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -692,7 +692,7 @@ const PhirepassTerminal = class {
692
692
  this.usernameBuffer = "";
693
693
  }
694
694
  render() {
695
- return (h$1(Host, { key: '274fd3f8db8cb3f48bd956ba40d5aacb8ec15e1f' }, h$1("div", { key: '644c586e190c63651d9e521793611a83d372d0ad', id: "ccc", ref: el => (this.containerEl = el) })));
695
+ return (h$1(Host, { key: 'e0e73c834bdcafc1bc00cf27a1846893deeafdc6' }, h$1("div", { key: '8db965a7a3356deb0f672470d92521b755f2f165', id: "ccc", ref: el => (this.containerEl = el) })));
696
696
  }
697
697
  static get watchers() { return {
698
698
  "nodeId": [{
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-D6RLmr6w.js';
2
- export { s as setNonce } from './index-D6RLmr6w.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-jdexunMF.js';
2
+ export { s as setNonce } from './index-jdexunMF.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  /*
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"],"max":[32],"show_login_screen":[32],"show_login_screen_username":[32],"show_login_screen_password":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
20
+ return bootstrapLazy([["phirepass-sftp-client",[[513,"phirepass-sftp-client",{"name":[1],"description":[1],"hideHeader":[4,"hide-header"],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"],"max":[32],"show_login_screen":[32],"show_login_screen_username":[32],"show_error":[32],"error_message":[32],"show_login_screen_password":[32],"show_navigation":[32],"breadcrumbs":[32],"current_dir":[32],"listing":[32],"show_content":[32],"show_loader":[32],"version":[32],"status":[32],"selected_item":[32],"maximize":[64],"minimize":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
21
21
  });
@@ -779,6 +779,7 @@ var ProtocolMessageType;
779
779
  ProtocolMessageType["TunnelOpened"] = "TunnelOpened";
780
780
  ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
781
781
  ProtocolMessageType["TunnelData"] = "TunnelData";
782
+ ProtocolMessageType["SFTPListItems"] = "SFTPListItems";
782
783
  })(ProtocolMessageType || (ProtocolMessageType = {}));
783
784
  var InputMode;
784
785
  (function (InputMode) {
@@ -0,0 +1 @@
1
+ import{r as e,c as i,h as t,H as a}from"./p-jdexunMF.js";import{_ as s,E as o,C as r,a as c,P as d}from"./p-BcIhGXR0.js";const l=class{constructor(t){e(this,t),this.maximizeEvent=i(this,"maximize"),this.connectionStateChanged=i(this,"connectionStateChanged")}channel;domReady=!1;runtimeReady=!1;connected=!1;uploadInputEl;session_id;name="SFTP";description="Client";hideHeader=!1;serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;token;onNodeIdChange(e,i){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),e&&(this.open_comms(),this.channel.connect(),this.status="Connecting...")}serverId;onServerIdChange(e,i){this.onNodeIdChange(this.nodeId,this.nodeId)}maximizeEvent;async maximize(){this.max=!this.max}async minimize(){this.max=!1}connectionStateChanged;max=!1;show_login_screen=!1;show_login_screen_username=!1;show_error=!1;error_message="";show_login_screen_password=!1;show_navigation=!1;breadcrumbs=[];current_dir=".";listing=[];show_content=!1;show_loader=!1;version="";status="Disconnected";selected_item=null;toggle_max(){this.maximizeEvent?.emit(!this.max)}async connectedCallback(){await s(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}connect(){this.connected=!0,this.channel.connect(),this.status="Connecting..."}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.channel&&this.connect()}create_web_socket_endpoint(){const e=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${e}://${this.serverHost}`:`${e}://${this.serverHost}:${this.serverPort}`:`${e}://${this.serverHost}`}handle_error(e){switch(e.kind){case o.Generic:case o.Authentication:this.error_message=e.message||"An unknown error occurred.";break;case o.RequiresUsername:this.show_login_screen_username=!0,this.show_login_screen_password=!1,this.show_login_screen=!0;break;case o.RequiresPassword:this.show_login_screen_username=!1,this.show_login_screen_password=!0,this.show_login_screen=!0;break;case o.RequiresUsernamePassword:this.show_login_screen_username=!0,this.show_login_screen_password=!0,this.show_login_screen=!0}setTimeout((()=>{this.show_loader=!1}),1e3)}handle_auth_success(e){this.clear_creds_buffer(),this.version=e.version,this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_sftp_tunnel(this.nodeId),this.status="Connected"}handle_tunnel_opened(e){this.session_id=e.sid,this.channel.send_sftp_list_data(this.nodeId,this.session_id,this.current_dir)}handle_sftp_list_items(e){setTimeout((()=>{this.show_loader=!1}),500),this.listing=e.dir.items,this.current_dir=e.path,this.breadcrumbs=e.path.split("/").map(((e,i,t)=>""===e&&0===i?{label:"/",path:"/"}:{label:e,path:t.slice(0,i+1).join("/")})),this.show_content=!0,this.show_navigation=!0}handle_tunnel_data(e){console.log("received tunnel data:",e)}handle_tunnel_closed(e){this.clear_creds_buffer(),this.close_comms()}open_comms(){this.channel=this.serverId?new r(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new r(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([c.Connected]),this.channel.authenticate(this.token,this.nodeId),this.status="Authenticating..."})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([c.Disconnected]),this.status="Disconnected"})),this.channel.on_connection_error((e=>{this.connectionStateChanged.emit([c.Error,e]),this.status="Error "+e.message})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((e=>{const{web:i}=e.data;switch(i.type){case d.Error:this.handle_error(i);break;case d.AuthSuccess:this.handle_auth_success(i);break;case d.TunnelOpened:this.handle_tunnel_opened(i);break;case d.TunnelClosed:this.handle_tunnel_closed(i);break;case d.TunnelData:this.handle_tunnel_data(i);break;case d.SFTPListItems:this.handle_sftp_list_items(i);break;default:console.warn("Unhandled protocol message type:",i)}}))}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}clear_creds_buffer(){}reset_session_state(){this.clear_creds_buffer()}list_breadcrumb(e){this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,e)}go_to_parent_directory(){this.session_id&&"/"!==this.current_dir&&this.list_breadcrumb(this.breadcrumbs[this.breadcrumbs.length-2]?.path||"/")}refresh_directory(){this.session_id&&this.list_breadcrumb(this.current_dir)}disconnect_session(){this.close_comms(),this.session_id=void 0,this.show_loader=!1,this.show_content=!1,this.breadcrumbs=[],this.current_dir=".",this.listing=[],this.show_navigation=!1,this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.version="",this.status="Disconnected"}on_file_row_action(e,i){i.preventDefault(),i.stopPropagation(),this.selected_item=e,window.alert(`Download for "${e.name}" is not available yet.`)}open_upload_picker(){this.uploadInputEl?.click()}on_upload_selected(e){const i=e.target,t=i.files?.[0];t&&(this.show_error=!0,this.error_message="Upload is not available yet in this widget.",setTimeout((()=>{this.show_error=!1}),2e3),i.value="")}is_selected(e){return!!this.selected_item&&this.selected_item.path===e.path&&this.selected_item.name===e.name}list_directory(e){if(!this.session_id)return void console.warn("No active session. Cannot list directory.");if("File"===e.kind)return console.warn("Cannot list directory of a file. Ignoring click."),void(this.selected_item=e);const i=[e.path,e.name].join("/");i!==this.current_dir?(this.show_loader=!0,this.selected_item=null,this.channel.send_sftp_list_data(this.nodeId,this.session_id,i)):console.warn("Already in this directory. Ignoring click.")}get_full_path(e){return[e.path,e.name].join("/")}render(){return t(a,{key:"84b1bd4b89e4e18be8165b2501af5fcf7bb09b68",class:{default:!this.max,max:this.max}},t("section",{key:"fd8e39bc72055158a7a1daac5f536e4d34393db9",class:"listing"},!this.hideHeader&&t("header",{key:"5f223331f9e2b5c6570ce80313c121c94ce36805"},t("section",{key:"1314b571f73bbdc07dd46f5015f75789793461e5",class:"title"},t("img",{key:"e582af1a23c051ddc9e0a44737f4c53a048b85be",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==",alt:"SFTP Client"}),t("div",{key:"f43bd6e4409b0e353b1224866b0d6ebe55e37705",class:"text"},t("div",{key:"f84ec4ed31f44b6216cf98fedda2eee3f6d3fae0",class:"name"},this.name),t("div",{key:"ad6b56a1f9e69b70be8e1906d26538ecf5e81369",class:"description"},this.description))),t("section",{key:"4cc95044e4d7ea1bacb8de579c6d22a29530a124",class:"actions"},t("div",{key:"fb85bf224c56e874ee7b4c0818ba35bcc06b4c35",class:"action",onClick:()=>this.toggle_max()},t("img",{key:"5cfbeafc5bbce5e5b87d75b23113a93c83d48f3b",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K",alt:"Maximize"})))),t("main",{key:"f0ed3ecc82981b8352b4908df9bcc7706c07c111"},this.show_navigation&&t("nav",{key:"8b790eab0adc12e592b73e6757c1663db88f5a49",class:"navigation"},t("div",{key:"85c62f8b0e15d7aa77572028665d51705f9ef453",class:"breadcrumbs"},this.breadcrumbs.map(((e,i,a)=>t(t.Fragment,null,t("span",{key:i,onClick:()=>this.list_breadcrumb(e.path),class:"breadcrumb"},e.label),i<a.length-1&&t("img",{class:"arrow",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K"}))))),t("section",{key:"9e1f1b406f3ac7b1a4fdda4081f310bdc054e125",class:"actions","aria-label":"SFTP actions"},t("button",{key:"1f95decb5addbd8c7c1b48b811e72231afb01491",type:"button",class:"action",onClick:()=>this.go_to_parent_directory(),title:"Go to parent directory","aria-label":"Go to parent directory"},t("img",{key:"888341d92e55f79037ccb8eca6b0eec69ff2f406",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Go up"})),t("button",{key:"41d8256a3c8e7e6810c6f979537be3556de3611a",type:"button",class:"action",onClick:()=>this.refresh_directory(),title:"Refresh","aria-label":"Refresh"},t("img",{key:"e7e2d8feef73e5a77580f311d3248baaa62a44ec",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"Refresh"})),t("button",{key:"4a1453249181827600e980bfcc5eef10b94c4bd7",type:"button",class:"action",onClick:()=>this.open_upload_picker(),title:"Upload","aria-label":"Upload"},t("img",{key:"66dc18510465e05509ea966b0d48a92dabc5a00d",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==",alt:"Upload"})),t("button",{key:"cbc12df3cb223cf650a12980f2b10db5114b2bff",type:"button",class:"action disconnect",onClick:()=>this.disconnect_session(),title:"Disconnect","aria-label":"Disconnect"},"DISCONNECT"))),t("input",{key:"8b472b4b82995d286127f60e394f6f83b88d05bd",type:"file",ref:e=>this.uploadInputEl=e,onChange:e=>this.on_upload_selected(e),style:{display:"none"}}),this.show_content&&t("div",{key:"9f4517dfb33071e1d1702c73fcbaaa812049c012",class:"content"},t("table",{key:"841b90ae73e52083478dcccb54d75ef52b208d74"},t("thead",{key:"96f9129791c51bae1f1693b4a77c3866cefe7ada"},t("tr",{key:"d5d5e032d059751a65305577670f1370c8cb0be5"},t("th",{key:"06a796b795813f286c1823eb053bc21211c7a6c2"},"Name"),t("th",{key:"4ce88c6ceb13af2d9e80a5c733a02ac7a15558ba"},"Size"),t("th",{key:"b4746be62c9c882f3c335b433486bc094b0fe6c3"},"Permissions"),t("th",{key:"8ab7d1bab01ce229b236d9aceb3ca166b84b2551"},"Owner"),t("th",{key:"baaf0986f2851903e22d8bb8c5a2aff8c4762bf1"},"Modified"),t("th",{key:"be874212a04f3e6f9764fb664837e11cacfc9b32",class:"action-col","aria-label":"Actions"}))),t("tbody",{key:"d14243b3467786b08a3cd8d53b4e365c7c9d644d"},this.listing.map(((e,i)=>t("tr",{key:i,class:{selected:this.is_selected(e)},onClick:()=>this.list_directory(e)},t("td",null,t("img","Folder"===e.kind?{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K",alt:"Folder"}:{class:"kind",src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==",alt:"File"}),t("span",{class:`name ${e.kind.toLowerCase()}`},e.name)),t("td",null,e.attributes.size),t("td",null,e.attributes.permissions??"-"),t("td",null,e.attributes.user??"-"),t("td",null,new Date(1e3*e.attributes.mtime).toLocaleString()),t("td",{class:"action-col"},"File"===e.kind&&t("button",{type:"button",class:"file-action",onClick:i=>this.on_file_row_action(e,i),title:"Download","aria-label":"Download"},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},t("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t("polyline",{points:"7 10 12 15 17 10"}),t("line",{x1:"12",x2:"12",y1:"15",y2:"3"})))))))))),this.show_loader&&t("div",{key:"ee78459b85c3ffaf2583fd79edadc1398a96aa81",class:"loader"},"Loading..."),this.show_error&&t("div",{key:"f658bc7e5fd922d9a9499f2b6402ca3a6453adb8",class:"error"},this.error_message)),t("footer",{key:"8928750efac3a300348a0c2cfd97c735820351c7"},t("section",{key:"2c72adc84a24cf9255219125ad617578d9d4e50d",class:"status"},t("span",{key:"192c7f26e2372e22b8d48d3ce0d6697d20c1ad4a"},this.status),this.selected_item&&t("span",{key:"01d1d92290b47332e014b010be7575d9976a61d6",class:"selected-item"},this.get_full_path(this.selected_item))),t("section",{key:"32951e5b9ae53f2d84d90b43820801d1a2caeb65",class:"version"},this.version?`Version: ${this.version}`:""))),this.show_login_screen&&t("section",{key:"46ea29aafbc1b4392d5a368534b1fd1f5ca8446a",class:{creds:!0,blurred:this.show_login_screen}},t("form",{key:"c70ab635c91947a722dd203a346ed40b76471a25",class:"auth",onSubmit:e=>{const i=new FormData(e.target);let t,a;this.show_login_screen_username&&(t=i.get("username")),this.show_login_screen_password&&(a=i.get("password")),this.channel.open_sftp_tunnel(this.nodeId,t,a),this.show_login_screen_username=!1,this.show_login_screen_password=!1,this.show_login_screen=!1,this.show_loader=!0,e.stopPropagation(),e.preventDefault()}},t("div",{key:"498d0374665f404fac6feef40ddcb7bc386e749b",class:"title"},"SFTP Connection"),this.show_login_screen_username&&t("div",{key:"2ff0c7b6bce0dabde50cc73de23ca3068951ef3d"},t("label",{key:"b6b6fb3d1c645e0ba7f55c420db3077a785cac48",htmlFor:"username"},"Username"),t("input",{key:"42e5c54dcf9ee40fc35c84b44be942b4775a82b4",id:"username",autoComplete:"off",name:"username",type:"text",placeholder:""})),this.show_login_screen_password&&t("div",{key:"ef4861042d2b239766add5185e8f4d46af526232"},t("label",{key:"901716f1f0f61d9116bdac51cc96581778bf2ebb",htmlFor:"password"},"Password"),t("input",{key:"da97e27113dfc2e9bb0c0a32e9b94140db1defa7",id:"password",autoComplete:"off",name:"password",type:"password",placeholder:""})),t("div",{key:"d8c497d4072f7b3940b483f02a722058c0b8a843"},t("button",{key:"bd9a920f46b0c48a15936a2249dadc4f04cdcc0f",type:"submit"},"Connect")))))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};l.style=":host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;.listing{flex:1;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{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;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:20px;min-width:20px;padding:0 10px}&:hover{&.action-col{color:blue;background-color:red;stroke:red}}}}tbody{padding:10px 10px;tr{border-bottom:1px solid hsl(var(--border) / 0.4);td{padding:10px 10px 9px;color:hsl(var(--muted-foreground));&.action-col{width:20px;min-width:20px;text-align:center;padding-left:1px;padding-right:1px;.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))}}}.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)}}}}}:host(.max){height:100vh;width:100vw;position:fixed;top:0;left:0;z-index:9999}";export{l as phirepass_sftp_client}
@@ -1 +1 @@
1
- class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();E.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=S(n,E.__wbindgen_export,E.__wbindgen_export2),o=I,c=S(t,E.__wbindgen_export,E.__wbindgen_export2);E.channel_authenticate(this.__wbg_ptr,r,o,c,I,A(e)?4294967297:e>>>0)}connect(){E.channel_connect(this.__wbg_ptr)}disconnect(){E.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==E.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==E.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=S(n,E.__wbindgen_export,E.__wbindgen_export2),o=I,c=S(t,E.__wbindgen_export,E.__wbindgen_export2),i=I;var s=A(e)?0:S(e,E.__wbindgen_export,E.__wbindgen_export2);const u=E.channel_new(r,o,c,i,s,I);return this.__wbg_ptr=u>>>0,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){E.channel_on_connection_close(this.__wbg_ptr,A(n)?0:u(n))}on_connection_error(n){E.channel_on_connection_error(this.__wbg_ptr,A(n)?0:u(n))}on_connection_message(n){E.channel_on_connection_message(this.__wbg_ptr,A(n)?0:u(n))}on_connection_open(n){E.channel_on_connection_open(this.__wbg_ptr,A(n)?0:u(n))}on_protocol_message(n){E.channel_on_protocol_message(this.__wbg_ptr,A(n)?0:u(n))}open_sftp_tunnel(n,t,e,r){const o=S(n,E.__wbindgen_export,E.__wbindgen_export2),c=I;var i=A(t)?0:S(t,E.__wbindgen_export,E.__wbindgen_export2),s=I,_=A(e)?0:S(e,E.__wbindgen_export,E.__wbindgen_export2);E.channel_open_sftp_tunnel(this.__wbg_ptr,o,c,i,s,_,I,A(r)?4294967297:r>>>0)}open_ssh_tunnel(n,t,e,r){const o=S(n,E.__wbindgen_export,E.__wbindgen_export2),c=I;var i=A(t)?0:S(t,E.__wbindgen_export,E.__wbindgen_export2),s=I,_=A(e)?0:S(e,E.__wbindgen_export,E.__wbindgen_export2);E.channel_open_ssh_tunnel(this.__wbg_ptr,o,c,i,s,_,I,A(r)?4294967297:r>>>0)}send_sftp_delete(n,t,e,r,o){const c=S(n,E.__wbindgen_export,E.__wbindgen_export2),i=I,s=S(e,E.__wbindgen_export,E.__wbindgen_export2),_=I,u=S(r,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,I,A(o)?4294967297:o>>>0)}send_sftp_download_chunk(n,t,e,r,o){const c=S(n,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_sftp_download_chunk(this.__wbg_ptr,c,I,t,e,r,A(o)?4294967297:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=S(n,E.__wbindgen_export,E.__wbindgen_export2),i=I,s=S(e,E.__wbindgen_export,E.__wbindgen_export2),_=I,u=S(r,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,I,A(o)?4294967297:o>>>0)}send_sftp_list_data(n,t,e,r){const o=S(n,E.__wbindgen_export,E.__wbindgen_export2),c=I,i=S(e,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,I,A(r)?4294967297:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=S(n,E.__wbindgen_export,E.__wbindgen_export2),_=I,u=function(n){const t=(0,E.__wbindgen_export)(1*n.length,1)>>>0;return h().set(n,t/1),I=n.length,t}(c);E.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,I,A(i)?4294967297:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=S(n,E.__wbindgen_export,E.__wbindgen_export2),_=I,u=S(e,E.__wbindgen_export,E.__wbindgen_export2),a=I,f=S(r,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,I,o,c,A(i)?4294967297:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=S(n,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,I,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=S(n,E.__wbindgen_export,E.__wbindgen_export2),o=I,c=S(e,E.__wbindgen_export,E.__wbindgen_export2);E.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,I)}start_heartbeat(n){E.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){E.channel_stop_heartbeat(this.__wbg_ptr)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_960c155d3d49e4c2:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=S(String(y(t)),E.__wbindgen_export,E.__wbindgen_export2),r=I;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_ab4b34d23d6778bd:function(n,t){const e=S(f(y(t)),E.__wbindgen_export,E.__wbindgen_export2),r=I;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_7ed5322991caaec5:function(n,t){const e=y(t),r="string"==typeof e?e:void 0;var o=A(r)?0:S(r,E.__wbindgen_export,E.__wbindgen_export2),c=I;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_6b64449b9b9ed33c:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_b46c9b5a9f08ec37:function(n){y(n)._wbg_cb_unref()},__wbg_call_14b169f759b26747:function(){return p((function(n,t){return u(y(n).call(y(t)))}),arguments)},__wbg_call_a24592a6f349a97e:function(){return p((function(n,t,e){return u(y(n).call(y(t),y(e)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(j(n)))},__wbg_close_88106990eea7f544:function(){return p((function(n){y(n).close()}),arguments)},__wbg_data_bb9dffdd1e99cf2d:function(n){return u(y(n).data)},__wbg_from_0dbf29f09e7fb200:function(n){return u(Array.from(y(n)))},__wbg_info_4f09735f023f7fae:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3:function(n){let t;try{t=y(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_9f1775224cf1d815:function(n){return y(n).length},__wbg_new_0c7403db6e782f19:function(n){return u(new Uint8Array(y(n)))},__wbg_new_682678e2f47e32bc:function(){return u(new Array)},__wbg_new_aa8d0fa9762c29bd:function(){return u(new Object)},__wbg_new_with_str_sequence_6453b755acdcc2e7:function(){return p((function(n,t,e){return u(new WebSocket(w(n,t),y(e)))}),arguments)},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),y(e))},__wbg_push_471a5b068a5295f6:function(n,t){return y(n).push(y(t))},__wbg_readyState_c78e609c7de3b381:function(n){return y(n).readyState},__wbg_send_186c85704c7f2d00:function(){return p((function(n,t,e){y(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return p((function(n,t){return u(setInterval(y(n),t))}),arguments)},__wbg_set_3bf1de9fab0cd644:function(n,t,e){y(n)[t>>>0]=j(e)},__wbg_set_6be42768c690e380:function(n,t,e){y(n)[j(t)]=j(e)},__wbg_set_binaryType_770e68648ca5e83d:function(n,t){y(n).binaryType=s[t]},__wbg_set_onclose_17fa3bbcc4ba3541:function(n,t){y(n).onclose=y(t)},__wbg_set_onerror_da99c4232662a084:function(n,t){y(n).onerror=y(t)},__wbg_set_onmessage_c1db358b9c38e3f1:function(n,t){y(n).onmessage=y(t)},__wbg_set_onopen_cd47b8fb1d92dee9:function(n,t){y(n).onopen=y(t)},__wbg_warn_938671953d9be936:function(n,t){console.warn(w(n,t))},__wbindgen_cast_0000000000000001:function(n,t){return u(R(n,t,o))},__wbindgen_cast_0000000000000002:function(n,t){return u(R(n,t,c))},__wbindgen_cast_0000000000000003:function(n,t){return u(R(n,t,i))},__wbindgen_cast_0000000000000004:function(n,t){return u(R(n,t,r))},__wbindgen_cast_0000000000000005:function(n){return u(n)},__wbindgen_cast_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_cast_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_cast_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(y(n))},__wbindgen_object_drop_ref:function(n){j(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){E.__wasm_bindgen_func_elem_39(n,t)}function o(n,t,e){E.__wasm_bindgen_func_elem_41(n,t,u(e))}function c(n,t,e){E.__wasm_bindgen_func_elem_41_1(n,t,u(e))}function i(n,t,e){E.__wasm_bindgen_func_elem_41_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>E.__wbg_channel_free(n>>>0,1)));function u(n){v===m.length&&m.push(m.length+1);const t=v;return v=m[t],m[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>E.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==E.memory.buffer)&&(l=new DataView(E.memory.buffer)),l}function w(n,t){return function(n,t){return q+=t,q>=U&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),q=t),O.decode(h().subarray(n,n+t))}(n>>>=0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(E.memory.buffer)),g}function y(n){return m[n]}function p(n,t){try{return n.apply(this,t)}catch(n){E.__wbindgen_export3(u(n))}}let m=new Array(1024).fill(void 0);m.push(void 0,null,!0,!1);let v=m.length;function A(n){return null==n}function R(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(E.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t,e){if(void 0===e){const e=W.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),I=e.length,r}let r=n.length,o=t(r,1)>>>0;const c=h();let i=0;for(;i<r;i++){const t=n.charCodeAt(i);if(t>127)break;c[o+i]=t}if(i!==r){0!==i&&(n=n.slice(i)),o=e(o,r,r=i+3*n.length,1)>>>0;const t=h().subarray(o+i,o+r);i+=W.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return I=i,o}function j(n){const t=y(n);return function(n){n<1028||(m[n]=v,v=n)}(n),t}let O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();const U=2146435072;let q=0;const W=new TextEncoder;"encodeInto"in W||(W.encodeInto=function(n,t){const e=W.encode(n);return t.set(e),{read:n.length,written:e.length}});let E,I=0;async function T(n){if(void 0!==E)return E;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!n.ok||!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return E=n.exports,l=null,g=null,E}(r)}var F,$,z;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData"}(F||(F={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}($||($={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}(z||(z={}));export{n as C,t as E,$ as I,F as P,T as _,z as a}
1
+ class n{__destroy_into_raw(){const n=this.__wbg_ptr;return this.__wbg_ptr=0,_.unregister(this),n}free(){const n=this.__destroy_into_raw();T.__wbg_channel_free(n,0)}authenticate(n,t,e){const r=S(n,T.__wbindgen_export,T.__wbindgen_export2),o=W,c=S(t,T.__wbindgen_export,T.__wbindgen_export2);T.channel_authenticate(this.__wbg_ptr,r,o,c,W,A(e)?4294967297:e>>>0)}connect(){T.channel_connect(this.__wbg_ptr)}disconnect(){T.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==T.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==T.channel_is_disconnected(this.__wbg_ptr)}constructor(n,t,e){const r=S(n,T.__wbindgen_export,T.__wbindgen_export2),o=W,c=S(t,T.__wbindgen_export,T.__wbindgen_export2),i=W;var s=A(e)?0:S(e,T.__wbindgen_export,T.__wbindgen_export2);const u=T.channel_new(r,o,c,i,s,W);return this.__wbg_ptr=u>>>0,_.register(this,this.__wbg_ptr,this),this}on_connection_close(n){T.channel_on_connection_close(this.__wbg_ptr,A(n)?0:u(n))}on_connection_error(n){T.channel_on_connection_error(this.__wbg_ptr,A(n)?0:u(n))}on_connection_message(n){T.channel_on_connection_message(this.__wbg_ptr,A(n)?0:u(n))}on_connection_open(n){T.channel_on_connection_open(this.__wbg_ptr,A(n)?0:u(n))}on_protocol_message(n){T.channel_on_protocol_message(this.__wbg_ptr,A(n)?0:u(n))}open_sftp_tunnel(n,t,e,r){const o=S(n,T.__wbindgen_export,T.__wbindgen_export2),c=W;var i=A(t)?0:S(t,T.__wbindgen_export,T.__wbindgen_export2),s=W,_=A(e)?0:S(e,T.__wbindgen_export,T.__wbindgen_export2);T.channel_open_sftp_tunnel(this.__wbg_ptr,o,c,i,s,_,W,A(r)?4294967297:r>>>0)}open_ssh_tunnel(n,t,e,r){const o=S(n,T.__wbindgen_export,T.__wbindgen_export2),c=W;var i=A(t)?0:S(t,T.__wbindgen_export,T.__wbindgen_export2),s=W,_=A(e)?0:S(e,T.__wbindgen_export,T.__wbindgen_export2);T.channel_open_ssh_tunnel(this.__wbg_ptr,o,c,i,s,_,W,A(r)?4294967297:r>>>0)}send_sftp_delete(n,t,e,r,o){const c=S(n,T.__wbindgen_export,T.__wbindgen_export2),i=W,s=S(e,T.__wbindgen_export,T.__wbindgen_export2),_=W,u=S(r,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_delete(this.__wbg_ptr,c,i,t,s,_,u,W,A(o)?4294967297:o>>>0)}send_sftp_download_chunk(n,t,e,r,o){const c=S(n,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_download_chunk(this.__wbg_ptr,c,W,t,e,r,A(o)?4294967297:o>>>0)}send_sftp_download_start(n,t,e,r,o){const c=S(n,T.__wbindgen_export,T.__wbindgen_export2),i=W,s=S(e,T.__wbindgen_export,T.__wbindgen_export2),_=W,u=S(r,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_download_start(this.__wbg_ptr,c,i,t,s,_,u,W,A(o)?4294967297:o>>>0)}send_sftp_list_data(n,t,e,r){const o=S(n,T.__wbindgen_export,T.__wbindgen_export2),c=W,i=S(e,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_list_data(this.__wbg_ptr,o,c,t,i,W,A(r)?4294967297:r>>>0)}send_sftp_upload_chunk(n,t,e,r,o,c,i){const s=S(n,T.__wbindgen_export,T.__wbindgen_export2),_=W,u=function(n){const t=(0,T.__wbindgen_export)(1*n.length,1)>>>0;return h().set(n,t/1),W=n.length,t}(c);T.channel_send_sftp_upload_chunk(this.__wbg_ptr,s,_,t,e,r,o,u,W,A(i)?4294967297:i>>>0)}send_sftp_upload_start(n,t,e,r,o,c,i){const s=S(n,T.__wbindgen_export,T.__wbindgen_export2),_=W,u=S(e,T.__wbindgen_export,T.__wbindgen_export2),a=W,f=S(r,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_sftp_upload_start(this.__wbg_ptr,s,_,t,u,a,f,W,o,c,A(i)?4294967297:i>>>0)}send_ssh_terminal_resize(n,t,e,r,o,c){const i=S(n,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_ssh_terminal_resize(this.__wbg_ptr,i,W,t,e,r,o,c)}send_ssh_tunnel_data(n,t,e){const r=S(n,T.__wbindgen_export,T.__wbindgen_export2),o=W,c=S(e,T.__wbindgen_export,T.__wbindgen_export2);T.channel_send_ssh_tunnel_data(this.__wbg_ptr,r,o,t,c,W)}start_heartbeat(n){T.channel_start_heartbeat(this.__wbg_ptr,n)}stop_heartbeat(){T.channel_stop_heartbeat(this.__wbg_ptr)}}Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);const t=Object.freeze({Generic:0,0:"Generic",Authentication:10,10:"Authentication",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword",RequiresUsernamePassword:120,120:"RequiresUsernamePassword"});function e(){const n={__proto__:null,__wbg_Error_960c155d3d49e4c2:function(n,t){return u(Error(w(n,t)))},__wbg_String_8564e559799eccda:function(n,t){const e=S(String(y(t)),T.__wbindgen_export,T.__wbindgen_export2),r=W;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_debug_string_ab4b34d23d6778bd:function(n,t){const e=S(f(y(t)),T.__wbindgen_export,T.__wbindgen_export2),r=W;d().setInt32(n+4,r,!0),d().setInt32(n+0,e,!0)},__wbg___wbindgen_string_get_7ed5322991caaec5:function(n,t){const e=y(t),r="string"==typeof e?e:void 0;var o=A(r)?0:S(r,T.__wbindgen_export,T.__wbindgen_export2),c=W;d().setInt32(n+4,c,!0),d().setInt32(n+0,o,!0)},__wbg___wbindgen_throw_6b64449b9b9ed33c:function(n,t){throw new Error(w(n,t))},__wbg__wbg_cb_unref_b46c9b5a9f08ec37:function(n){y(n)._wbg_cb_unref()},__wbg_call_14b169f759b26747:function(){return p((function(n,t){return u(y(n).call(y(t)))}),arguments)},__wbg_call_a24592a6f349a97e:function(){return p((function(n,t,e){return u(y(n).call(y(t),y(e)))}),arguments)},__wbg_clearInterval_26ba580547547579:function(n){return u(clearInterval(j(n)))},__wbg_close_88106990eea7f544:function(){return p((function(n){y(n).close()}),arguments)},__wbg_data_bb9dffdd1e99cf2d:function(n){return u(y(n).data)},__wbg_from_0dbf29f09e7fb200:function(n){return u(Array.from(y(n)))},__wbg_info_4f09735f023f7fae:function(n,t){console.info(w(n,t))},__wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3:function(n){let t;try{t=y(n)instanceof ArrayBuffer}catch(n){t=!1}return t},__wbg_length_9f1775224cf1d815:function(n){return y(n).length},__wbg_new_0c7403db6e782f19:function(n){return u(new Uint8Array(y(n)))},__wbg_new_682678e2f47e32bc:function(){return u(new Array)},__wbg_new_aa8d0fa9762c29bd:function(){return u(new Object)},__wbg_new_with_str_sequence_6453b755acdcc2e7:function(){return p((function(n,t,e){return u(new WebSocket(w(n,t),y(e)))}),arguments)},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(n,t,e){Uint8Array.prototype.set.call(b(n,t),y(e))},__wbg_push_471a5b068a5295f6:function(n,t){return y(n).push(y(t))},__wbg_readyState_c78e609c7de3b381:function(n){return y(n).readyState},__wbg_send_186c85704c7f2d00:function(){return p((function(n,t,e){y(n).send(b(t,e))}),arguments)},__wbg_setInterval_cbf1c35c6a692d37:function(){return p((function(n,t){return u(setInterval(y(n),t))}),arguments)},__wbg_set_3bf1de9fab0cd644:function(n,t,e){y(n)[t>>>0]=j(e)},__wbg_set_6be42768c690e380:function(n,t,e){y(n)[j(t)]=j(e)},__wbg_set_binaryType_770e68648ca5e83d:function(n,t){y(n).binaryType=s[t]},__wbg_set_onclose_17fa3bbcc4ba3541:function(n,t){y(n).onclose=y(t)},__wbg_set_onerror_da99c4232662a084:function(n,t){y(n).onerror=y(t)},__wbg_set_onmessage_c1db358b9c38e3f1:function(n,t){y(n).onmessage=y(t)},__wbg_set_onopen_cd47b8fb1d92dee9:function(n,t){y(n).onopen=y(t)},__wbg_warn_938671953d9be936:function(n,t){console.warn(w(n,t))},__wbindgen_cast_0000000000000001:function(n,t){return u(R(n,t,o))},__wbindgen_cast_0000000000000002:function(n,t){return u(R(n,t,c))},__wbindgen_cast_0000000000000003:function(n,t){return u(R(n,t,i))},__wbindgen_cast_0000000000000004:function(n,t){return u(R(n,t,r))},__wbindgen_cast_0000000000000005:function(n){return u(n)},__wbindgen_cast_0000000000000006:function(n,t){return u(b(n,t))},__wbindgen_cast_0000000000000007:function(n,t){return u(w(n,t))},__wbindgen_cast_0000000000000008:function(n){return u(BigInt.asUintN(64,n))},__wbindgen_object_clone_ref:function(n){return u(y(n))},__wbindgen_object_drop_ref:function(n){j(n)}};return{__proto__:null,"./phirepass-channel_bg.js":n}}function r(n,t){T.__wasm_bindgen_func_elem_39(n,t)}function o(n,t,e){T.__wasm_bindgen_func_elem_41(n,t,u(e))}function c(n,t,e){T.__wasm_bindgen_func_elem_41_1(n,t,u(e))}function i(n,t,e){T.__wasm_bindgen_func_elem_41_2(n,t,u(e))}const s=["blob","arraybuffer"],_="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>T.__wbg_channel_free(n>>>0,1)));function u(n){v===m.length&&m.push(m.length+1);const t=v;return v=m[t],m[t]=n,t}const a="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((n=>T.__wbindgen_export4(n.a,n.b)));function f(n){const t=typeof n;if("number"==t||"boolean"==t||null==n)return`${n}`;if("string"==t)return`"${n}"`;if("symbol"==t){const t=n.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=n.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(n)){const t=n.length;let e="[";t>0&&(e+=f(n[0]));for(let r=1;r<t;r++)e+=", "+f(n[r]);return e+="]",e}const e=/\[object ([^\]]+)\]/.exec(toString.call(n));let r;if(!(e&&e.length>1))return toString.call(n);if(r=e[1],"Object"==r)try{return"Object("+JSON.stringify(n)+")"}catch(n){return"Object"}return n instanceof Error?`${n.name}: ${n.message}\n${n.stack}`:r}function b(n,t){return n>>>=0,h().subarray(n/1,n/1+t)}let l=null;function d(){return(null===l||!0===l.buffer.detached||void 0===l.buffer.detached&&l.buffer!==T.memory.buffer)&&(l=new DataView(T.memory.buffer)),l}function w(n,t){return function(n,t){return q+=t,q>=U&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),q=t),O.decode(h().subarray(n,n+t))}(n>>>=0,t)}let g=null;function h(){return null!==g&&0!==g.byteLength||(g=new Uint8Array(T.memory.buffer)),g}function y(n){return m[n]}function p(n,t){try{return n.apply(this,t)}catch(n){T.__wbindgen_export3(u(n))}}let m=new Array(1024).fill(void 0);m.push(void 0,null,!0,!1);let v=m.length;function A(n){return null==n}function R(n,t,e){const r={a:n,b:t,cnt:1},o=(...n)=>{r.cnt++;const t=r.a;r.a=0;try{return e(t,r.b,...n)}finally{r.a=t,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{0==--r.cnt&&(T.__wbindgen_export4(r.a,r.b),r.a=0,a.unregister(r))},a.register(o,r,r),o}function S(n,t,e){if(void 0===e){const e=I.encode(n),r=t(e.length,1)>>>0;return h().subarray(r,r+e.length).set(e),W=e.length,r}let r=n.length,o=t(r,1)>>>0;const c=h();let i=0;for(;i<r;i++){const t=n.charCodeAt(i);if(t>127)break;c[o+i]=t}if(i!==r){0!==i&&(n=n.slice(i)),o=e(o,r,r=i+3*n.length,1)>>>0;const t=h().subarray(o+i,o+r);i+=I.encodeInto(n,t).written,o=e(o,r,i,1)>>>0}return W=i,o}function j(n){const t=y(n);return function(n){n<1028||(m[n]=v,v=n)}(n),t}let O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();const U=2146435072;let q=0;const I=new TextEncoder;"encodeInto"in I||(I.encodeInto=function(n,t){const e=I.encode(n);return t.set(e),{read:n.length,written:e.length}});let T,W=0;async function E(n){if(void 0!==T)return T;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?({module_or_path:n}=n):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===n&&(n=new URL("phirepass-channel_bg.wasm",import.meta.url));const t=e();("string"==typeof n||"function"==typeof Request&&n instanceof Request||"function"==typeof URL&&n instanceof URL)&&(n=fetch(n));const{instance:r}=await async function(n,t){if("function"==typeof Response&&n instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(n,t)}catch(t){if(!n.ok||!function(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}(n.type)||"application/wasm"===n.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const e=await n.arrayBuffer();return await WebAssembly.instantiate(e,t)}{const e=await WebAssembly.instantiate(n,t);return e instanceof WebAssembly.Instance?{instance:e,module:n}:e}}(await n,t);return function(n){return T=n.exports,l=null,g=null,T}(r)}var F,P,$;!function(n){n.Error="Error",n.AuthSuccess="AuthSuccess",n.TunnelOpened="TunnelOpened",n.TunnelClosed="TunnelClosed",n.TunnelData="TunnelData",n.SFTPListItems="SFTPListItems"}(F||(F={})),function(n){n[n.Username=0]="Username",n[n.Password=1]="Password",n[n.Default=2]="Default"}(P||(P={})),function(n){n.Disconnected="disconnected",n.Connected="connected",n.Error="error"}($||($={}));export{n as C,t as E,P as I,F as P,E as _,$ as a}