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
@@ -8,6 +8,10 @@ const BUILD = /* phirepass-widgets */ { hotModuleReplacement: false, hydratedSel
8
8
  */
9
9
 
10
10
 
11
+ // src/utils/constants.ts
12
+ var SVG_NS = "http://www.w3.org/2000/svg";
13
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
14
+
11
15
  // src/utils/get-prop-descriptor.ts
12
16
  function getPropertyDescriptor(obj, memberName, getOnly) {
13
17
  const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
@@ -392,6 +396,13 @@ var h = (nodeName, vnodeData, ...children) => {
392
396
  }
393
397
  }
394
398
  }
399
+ if (typeof nodeName === "function") {
400
+ return nodeName(
401
+ vnodeData === null ? {} : vnodeData,
402
+ vNodeChildren,
403
+ vdomFnUtils
404
+ );
405
+ }
395
406
  const vnode = newVNode(nodeName, null);
396
407
  vnode.$attrs$ = vnodeData;
397
408
  if (vNodeChildren.length > 0) {
@@ -421,6 +432,36 @@ var newVNode = (tag, text) => {
421
432
  };
422
433
  var Host = {};
423
434
  var isHost = (node) => node && node.$tag$ === Host;
435
+ var vdomFnUtils = {
436
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
437
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
438
+ };
439
+ var convertToPublic = (node) => ({
440
+ vattrs: node.$attrs$,
441
+ vchildren: node.$children$,
442
+ vkey: node.$key$,
443
+ vname: node.$name$,
444
+ vtag: node.$tag$,
445
+ vtext: node.$text$
446
+ });
447
+ var convertToPrivate = (node) => {
448
+ if (typeof node.vtag === "function") {
449
+ const vnodeData = { ...node.vattrs };
450
+ if (node.vkey) {
451
+ vnodeData.key = node.vkey;
452
+ }
453
+ if (node.vname) {
454
+ vnodeData.name = node.vname;
455
+ }
456
+ return h(node.vtag, vnodeData, ...node.vchildren || []);
457
+ }
458
+ const vnode = newVNode(node.vtag, node.vtext);
459
+ vnode.$attrs$ = node.vattrs;
460
+ vnode.$children$ = node.vchildren;
461
+ vnode.$key$ = node.vkey;
462
+ vnode.$name$ = node.vname;
463
+ return vnode;
464
+ };
424
465
 
425
466
  // src/runtime/normalize-watchers.ts
426
467
  var normalizeWatchers = (raw) => {
@@ -503,6 +544,27 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
503
544
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
504
545
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
505
546
  }
547
+ } else if (memberName === "style") {
548
+ {
549
+ for (const prop in oldValue) {
550
+ if (!newValue || newValue[prop] == null) {
551
+ if (prop.includes("-")) {
552
+ elm.style.removeProperty(prop);
553
+ } else {
554
+ elm.style[prop] = "";
555
+ }
556
+ }
557
+ }
558
+ }
559
+ for (const prop in newValue) {
560
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
561
+ if (prop.includes("-")) {
562
+ elm.style.setProperty(prop, newValue[prop]);
563
+ } else {
564
+ elm.style[prop] = newValue[prop];
565
+ }
566
+ }
567
+ }
506
568
  } else if (memberName === "key") ; else if (memberName === "ref") {
507
569
  if (newValue) {
508
570
  queueRefAttachment(newValue, elm);
@@ -652,12 +714,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
652
714
  if (newVNode2.$text$ != null) {
653
715
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
654
716
  } else {
717
+ if (!isSvgMode) {
718
+ isSvgMode = newVNode2.$tag$ === "svg";
719
+ }
655
720
  if (!win.document) {
656
721
  throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
657
722
  }
658
- elm = newVNode2.$elm$ = win.document.createElement(
723
+ elm = newVNode2.$elm$ = win.document.createElementNS(
724
+ isSvgMode ? SVG_NS : HTML_NS,
659
725
  newVNode2.$tag$
660
- );
726
+ ) ;
727
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
728
+ isSvgMode = false;
729
+ }
661
730
  {
662
731
  updateElement(null, newVNode2, isSvgMode);
663
732
  }
@@ -670,6 +739,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
670
739
  }
671
740
  }
672
741
  }
742
+ {
743
+ if (newVNode2.$tag$ === "svg") {
744
+ isSvgMode = false;
745
+ } else if (elm.tagName === "foreignObject") {
746
+ isSvgMode = true;
747
+ }
748
+ }
673
749
  }
674
750
  elm["s-hn"] = hostTagName;
675
751
  return elm;
@@ -806,8 +882,12 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
806
882
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
807
883
  const oldChildren = oldVNode.$children$;
808
884
  const newChildren = newVNode2.$children$;
885
+ const tag = newVNode2.$tag$;
809
886
  const text = newVNode2.$text$;
810
887
  if (text == null) {
888
+ {
889
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
890
+ }
811
891
  {
812
892
  updateElement(oldVNode, newVNode2, isSvgMode);
813
893
  }
@@ -824,6 +904,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
824
904
  ) {
825
905
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
826
906
  } else ;
907
+ if (isSvgMode && tag === "svg") {
908
+ isSvgMode = false;
909
+ }
827
910
  } else if (oldVNode.$text$ !== text) {
828
911
  elm.data = text;
829
912
  }
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DTAHGGCM.js');
3
+ var index = require('./index-DqslB2R4.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[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.cjs",[[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);
9
+ return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[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.cjs",[[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);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1,13 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DTAHGGCM.js');
4
- var protocol = require('./protocol-C0YjPrve.js');
3
+ var index = require('./index-DqslB2R4.js');
4
+ var protocol = require('./protocol-BDROfN76.js');
5
5
 
6
6
  const phirepassSftpClientLogoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==';
7
7
 
8
8
  const phirepassSftpClientMaxSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtbWF4aW1pemUyIHctMyBoLTMiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+CiAgICA8cG9seWxpbmUgcG9pbnRzPSI5IDIxIDMgMjEgMyAxNSI+PC9wb2x5bGluZT4KICAgIDxsaW5lIHgxPSIyMSIgeDI9IjE0IiB5MT0iMyIgeTI9IjEwIj48L2xpbmU+CiAgICA8bGluZSB4MT0iMyIgeDI9IjEwIiB5MT0iMjEiIHkyPSIxNCI+PC9saW5lPgo8L3N2Zz4K';
9
9
 
10
- 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}`;
10
+ const phirepassSftpClientChevronSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogICAgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIKICAgIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWNoZXZyb24tcmlnaHQgdy0zIGgtMyB0ZXh0LW11dGVkLWZvcmVncm91bmQvNTAgc2hyaW5rLTAiPgogICAgPHBhdGggZD0ibTkgMTggNi02LTYtNiI+PC9wYXRoPgo8L3N2Zz4K';
11
+
12
+ const phirepassSftpClientFolderSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS1mb2xkZXIgdy0zLjUgaC0zLjUgdGV4dC1wcmltYXJ5IHNocmluay0wIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTIwIDIwYTIgMiAwIDAgMCAyLTJWOGEyIDIgMCAwIDAtMi0yaC03LjlhMiAyIDAgMCAxLTEuNjktLjlMOS42IDMuOUEyIDIgMCAwIDAgNy45MyAzSDRhMiAyIDAgMCAwLTIgMnYxM2EyIDIgMCAwIDAgMiAyWiI+PC9wYXRoPgo8L3N2Zz4K';
13
+
14
+ const phirepassSftpClientFileSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTE1LCAxMjMsIDE0MCkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtZmlsZSB3LTMuNSBoLTMuNSB0ZXh0LW11dGVkLWZvcmVncm91bmQgc2hyaW5rLTAiPgogICAgPHBhdGggZD0iTTE1IDJINmEyIDIgMCAwIDAtMiAydjE2YTIgMiAwIDAgMCAyIDJoMTJhMiAyIDAgMCAwIDItMlY3WiI+PC9wYXRoPgogICAgPHBhdGggZD0iTTE0IDJ2NGEyIDIgMCAwIDAgMiAyaDQiPjwvcGF0aD4KPC9zdmc+Cg==';
15
+
16
+ const phirepassSftpClientGoUpSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtYXJyb3ctdXAgdy0zLjUgaC0zLjUiPgogICAgPHBhdGggZD0ibTUgMTIgNy03IDcgNyI+PC9wYXRoPgogICAgPHBhdGggZD0iTTEyIDE5VjUiPjwvcGF0aD4KPC9zdmc+Cg==';
17
+
18
+ const phirepassSftpClientRefreshSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtcmVmcmVzaC1jdyB3LTMuNSBoLTMuNSI+CiAgICA8cGF0aCBkPSJNMyAxMmE5IDkgMCAwIDEgOS05IDkuNzUgOS43NSAwIDAgMSA2Ljc0IDIuNzRMMjEgOCI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDN2NWgtNSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIxIDEyYTkgOSAwIDAgMS05IDkgOS43NSA5Ljc1IDAgMCAxLTYuNzQtMi43NEwzIDE2Ij48L3BhdGg+CiAgICA8cGF0aCBkPSJNOCAxNkgzdjUiPjwvcGF0aD4KPC9zdmc+Cg==';
19
+
20
+ const phirepassSftpClientUploadSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoMTg5LCAyMTksIDIwOSkiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIgogICAgY2xhc3M9Imx1Y2lkZSBsdWNpZGUtdXBsb2FkIHctMy41IGgtMy41Ij4KICAgIDxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+CiAgICA8cG9seWxpbmUgcG9pbnRzPSIxNyA4IDEyIDMgNyA4Ij48L3BvbHlsaW5lPgogICAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSIzIiB5Mj0iMTUiPjwvbGluZT4KPC9zdmc+Cg==';
21
+
22
+ const phirepassSftpClientCss = () => `:host{--radius:0.375rem;--card:220 18% 10%;--border:220 15% 18%;--primary:160 60% 45%;--radius:0.375rem;--destructive:0 70% 50%;--muted:220 15% 13%;--muted-foreground:220 10% 50%;--primary-foreground:220 20% 7%;--scroll-track:220 16% 12%;--scroll-thumb:220 12% 34%;--scroll-thumb-hover:160 45% 44%;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;height:100%;width:100%;border:1px solid hsl(var(--border));background-color:hsl(var(--card));border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;position:relative;.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}`;
11
23
 
12
24
  const PhirepassSftpClient = class {
13
25
  constructor(hostRef) {
@@ -19,8 +31,9 @@ const PhirepassSftpClient = class {
19
31
  domReady = false;
20
32
  runtimeReady = false;
21
33
  connected = false;
34
+ uploadInputEl;
22
35
  // private inputMode: InputMode = InputMode.Default;
23
- // private session_id?: number;
36
+ session_id;
24
37
  // private usernameBuffer = "";
25
38
  // private passwordBuffer = "";
26
39
  name = 'SFTP';
@@ -46,6 +59,7 @@ const PhirepassSftpClient = class {
46
59
  if (newValue) {
47
60
  this.open_comms();
48
61
  this.channel.connect();
62
+ this.status = 'Connecting...';
49
63
  }
50
64
  }
51
65
  serverId;
@@ -63,7 +77,18 @@ const PhirepassSftpClient = class {
63
77
  max = false;
64
78
  show_login_screen = false;
65
79
  show_login_screen_username = false;
80
+ show_error = false;
81
+ error_message = '';
66
82
  show_login_screen_password = false;
83
+ show_navigation = false;
84
+ breadcrumbs = [];
85
+ current_dir = '.';
86
+ listing = [];
87
+ show_content = false;
88
+ show_loader = false;
89
+ version = '';
90
+ status = 'Disconnected';
91
+ selected_item = null;
67
92
  toggle_max() {
68
93
  this.maximizeEvent?.emit(!this.max);
69
94
  }
@@ -100,6 +125,7 @@ const PhirepassSftpClient = class {
100
125
  connect() {
101
126
  this.connected = true;
102
127
  this.channel.connect();
128
+ this.status = 'Connecting...';
103
129
  // const container = this.containerEl;
104
130
  // console.log('Attempting to connect terminal to container:', container);
105
131
  // if (container) {
@@ -133,22 +159,63 @@ const PhirepassSftpClient = class {
133
159
  }
134
160
  return `${protocol}://${this.serverHost}:${this.serverPort}`;
135
161
  }
136
- handle_error(_error_) {
137
- //
162
+ handle_error(error) {
163
+ switch (error.kind) {
164
+ case protocol.ErrorType.Generic:
165
+ case protocol.ErrorType.Authentication:
166
+ this.error_message = error.message || 'An unknown error occurred.';
167
+ break;
168
+ case protocol.ErrorType.RequiresUsername:
169
+ this.show_login_screen_username = true;
170
+ this.show_login_screen_password = false;
171
+ this.show_login_screen = true;
172
+ break;
173
+ case protocol.ErrorType.RequiresPassword:
174
+ this.show_login_screen_username = false;
175
+ this.show_login_screen_password = true;
176
+ this.show_login_screen = true;
177
+ break;
178
+ case protocol.ErrorType.RequiresUsernamePassword:
179
+ this.show_login_screen_username = true;
180
+ this.show_login_screen_password = true;
181
+ this.show_login_screen = true;
182
+ break;
183
+ }
184
+ setTimeout(() => {
185
+ this.show_loader = false;
186
+ }, 1_000);
138
187
  }
139
- handle_auth_success(_auth_) {
188
+ handle_auth_success(auth) {
140
189
  this.clear_creds_buffer();
190
+ this.version = auth.version;
141
191
  this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
142
192
  this.channel.open_sftp_tunnel(this.nodeId);
193
+ this.status = 'Connected';
143
194
  }
144
- handle_tunnel_opened(_web_) {
145
- // this.session_id = web.sid;
195
+ handle_tunnel_opened(web) {
196
+ this.session_id = web.sid;
146
197
  // this.terminal.reset();
147
198
  // this.fit_terminal_safely();
148
199
  // this.send_ssh_terminal_resize();
200
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, this.current_dir);
149
201
  }
150
- handle_tunnel_data(_web_) {
151
- // TODO
202
+ handle_sftp_list_items(web) {
203
+ setTimeout(() => {
204
+ this.show_loader = false;
205
+ }, 500);
206
+ this.listing = web.dir.items;
207
+ this.current_dir = web.path;
208
+ this.breadcrumbs = web.path.split('/').map((path, index, arr) => {
209
+ if (path === '' && index === 0) {
210
+ return { label: '/', path: '/' };
211
+ }
212
+ return { label: path, path: arr.slice(0, index + 1).join('/') };
213
+ });
214
+ this.show_content = true;
215
+ this.show_navigation = true;
216
+ }
217
+ handle_tunnel_data(web) {
218
+ console.log('received tunnel data:', web);
152
219
  }
153
220
  handle_tunnel_closed(_web_) {
154
221
  // this.session_id = undefined;
@@ -168,16 +235,18 @@ const PhirepassSftpClient = class {
168
235
  this.channel.on_connection_open(() => {
169
236
  this.connectionStateChanged.emit([protocol.ConnectionState.Connected]);
170
237
  this.channel.authenticate(this.token, this.nodeId);
238
+ this.status = 'Authenticating...';
171
239
  });
172
240
  this.channel.on_connection_close(() => {
173
241
  this.connectionStateChanged.emit([protocol.ConnectionState.Disconnected]);
174
- // this.terminal.reset();
242
+ this.status = 'Disconnected';
175
243
  });
176
244
  this.channel.on_connection_error((err) => {
177
245
  this.connectionStateChanged.emit([protocol.ConnectionState.Error, err]);
246
+ this.status = 'Error ' + err.message;
178
247
  });
179
248
  this.channel.on_connection_message((_raw_) => {
180
- // console.log('>> raw message received', raw);
249
+ //
181
250
  });
182
251
  this.channel.on_protocol_message((msg) => {
183
252
  const { web } = msg.data;
@@ -197,8 +266,11 @@ const PhirepassSftpClient = class {
197
266
  case protocol.ProtocolMessageType.TunnelData:
198
267
  this.handle_tunnel_data(web);
199
268
  break;
269
+ case protocol.ProtocolMessageType.SFTPListItems:
270
+ this.handle_sftp_list_items(web);
271
+ break;
200
272
  default:
201
- console.warn('Unknown protocol message type:', web);
273
+ console.warn('Unhandled protocol message type:', web);
202
274
  }
203
275
  });
204
276
  }
@@ -215,15 +287,125 @@ const PhirepassSftpClient = class {
215
287
  // this.inputMode = InputMode.Default;
216
288
  this.clear_creds_buffer();
217
289
  }
290
+ list_breadcrumb(path) {
291
+ this.show_loader = true;
292
+ this.selected_item = null;
293
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, path);
294
+ }
295
+ go_to_parent_directory() {
296
+ if (!this.session_id) {
297
+ return;
298
+ }
299
+ if (this.current_dir === '/') {
300
+ return;
301
+ }
302
+ const parent = this.breadcrumbs[this.breadcrumbs.length - 2]?.path || '/';
303
+ this.list_breadcrumb(parent);
304
+ }
305
+ refresh_directory() {
306
+ if (!this.session_id) {
307
+ return;
308
+ }
309
+ this.list_breadcrumb(this.current_dir);
310
+ }
311
+ disconnect_session() {
312
+ this.close_comms();
313
+ this.session_id = undefined;
314
+ this.show_loader = false;
315
+ this.show_content = false;
316
+ this.breadcrumbs = [];
317
+ this.current_dir = '.';
318
+ this.listing = [];
319
+ this.show_navigation = false;
320
+ this.show_login_screen_username = false;
321
+ this.show_login_screen_password = false;
322
+ this.show_login_screen = false;
323
+ this.version = '';
324
+ this.status = 'Disconnected';
325
+ }
326
+ on_file_row_action(item, event) {
327
+ event.preventDefault();
328
+ event.stopPropagation();
329
+ this.selected_item = item;
330
+ window.alert(`Download for "${item.name}" is not available yet.`);
331
+ }
332
+ open_upload_picker() {
333
+ this.uploadInputEl?.click();
334
+ }
335
+ on_upload_selected(event) {
336
+ const input = event.target;
337
+ const file = input.files?.[0];
338
+ if (!file) {
339
+ return;
340
+ }
341
+ this.show_error = true;
342
+ this.error_message = 'Upload is not available yet in this widget.';
343
+ setTimeout(() => {
344
+ this.show_error = false;
345
+ }, 2_000);
346
+ input.value = '';
347
+ }
348
+ is_selected(item) {
349
+ if (!this.selected_item) {
350
+ return false;
351
+ }
352
+ return this.selected_item.path === item.path &&
353
+ this.selected_item.name === item.name;
354
+ }
355
+ list_directory(entry) {
356
+ if (!this.session_id) {
357
+ console.warn('No active session. Cannot list directory.');
358
+ return;
359
+ }
360
+ if (entry.kind === 'File') {
361
+ console.warn('Cannot list directory of a file. Ignoring click.');
362
+ this.selected_item = entry;
363
+ return;
364
+ }
365
+ const path = [entry.path, entry.name].join('/');
366
+ if (path === this.current_dir) {
367
+ console.warn('Already in this directory. Ignoring click.');
368
+ return;
369
+ }
370
+ this.show_loader = true;
371
+ this.selected_item = null;
372
+ this.channel.send_sftp_list_data(this.nodeId, this.session_id, path);
373
+ }
374
+ get_full_path(item) {
375
+ return [item.path, item.name].join('/');
376
+ }
218
377
  render() {
219
- return (index.h(index.Host, { key: 'ac63e2c701cd09a605d0aaa7396eaec16ff9c3bc', class: {
378
+ return (index.h(index.Host, { key: '84b1bd4b89e4e18be8165b2501af5fcf7bb09b68', class: {
220
379
  'default': !this.max,
221
380
  'max': this.max,
222
- } }, index.h("section", { key: '253dfc510c62ee57a96d574af993e8017475a0c2', class: "listing" }, !this.hideHeader &&
223
- index.h("header", { key: '215ddf76ba55641892fc9a758077ba8d1f3a6671' }, index.h("section", { key: '49541a8d31d8c61e2df84c60348f7426fddec67c', class: "title" }, index.h("img", { key: '1a86ba6b3de92b35cbd5b1bacfdfee2da6fa6766', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), index.h("div", { key: '38d90384978acc8b323ca4c396db7bda54320059', class: "text" }, index.h("div", { key: 'a94b3fd21025000b620b2bb85aec87198e575bfa', class: "name" }, this.name), index.h("div", { key: '072c41dc8d05faf77929f8c128bb97b64d8835bf', class: "description" }, this.description))), index.h("section", { key: '46e575f4ce5f2da0913d2f3aebe025540f1f3688', class: "actions" }, index.h("div", { key: 'f92d66ab7ab5e9c25a29037c60709c54623194be', class: "action", onClick: () => this.toggle_max() }, index.h("img", { key: 'e115204a83336fc4b49a30551208b727c3f33be9', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), index.h("main", { key: 'c6bf5ab4e5aa46dcba8e50ec1a9c2feb1f55ea02' }), index.h("footer", { key: 'ac67a3e0966e3f04bee019162f8174aae58cbf1a' })), index.h("section", { key: '07e83117470f7f226328703b18f836bd4358cfe9', class: {
224
- 'creds': true,
225
- 'blurred': this.show_login_screen,
226
- } }, this.show_login_screen && index.h("form", { key: '808209eaba50f10a8ef96163972ad36ea9e3d3e2', class: "form" }, index.h("div", { key: '9e26efeac2f17d6b4168e1a77da6ef61d325f6e3' }, "SFTP Connection"), index.h("div", { key: 'f9badb92d4434a16916429a2bedb6e38d2ae647c' }, index.h("div", { key: '9fb267ba7828cd950b327a17e0ee803dc399c80b' }, "Username"), index.h("input", { key: '65b34c14292b0bde408861e791f3baa99c4c9a02', type: "text", placeholder: "" })), index.h("div", { key: 'f1f9def8290dfcde9beff0f61092f6020580b72c' }, index.h("div", { key: '1c89b71c4126299b7e8e421b05761d2b0424d4ed' }, "Password"), index.h("input", { key: '17364976158ddaacbb55ed17ee09ec242bcbdce7', type: "password", placeholder: "" })), index.h("div", { key: '9362acdf153ceeba3c8e8cee0518cf2baeec27e0' }, index.h("button", { key: 'ebf6c205276a7c3ff34c13e148978be61044ff7a' }, "Connect"))))));
381
+ } }, index.h("section", { key: 'fd8e39bc72055158a7a1daac5f536e4d34393db9', class: "listing" }, !this.hideHeader &&
382
+ index.h("header", { key: '5f223331f9e2b5c6570ce80313c121c94ce36805' }, index.h("section", { key: '1314b571f73bbdc07dd46f5015f75789793461e5', class: "title" }, index.h("img", { key: 'e582af1a23c051ddc9e0a44737f4c53a048b85be', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), index.h("div", { key: 'f43bd6e4409b0e353b1224866b0d6ebe55e37705', class: "text" }, index.h("div", { key: 'f84ec4ed31f44b6216cf98fedda2eee3f6d3fae0', class: "name" }, this.name), index.h("div", { key: 'ad6b56a1f9e69b70be8e1906d26538ecf5e81369', class: "description" }, this.description))), index.h("section", { key: '4cc95044e4d7ea1bacb8de579c6d22a29530a124', class: "actions" }, index.h("div", { key: 'fb85bf224c56e874ee7b4c0818ba35bcc06b4c35', class: "action", onClick: () => this.toggle_max() }, index.h("img", { key: '5cfbeafc5bbce5e5b87d75b23113a93c83d48f3b', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), index.h("main", { key: 'f0ed3ecc82981b8352b4908df9bcc7706c07c111' }, this.show_navigation && index.h("nav", { key: '8b790eab0adc12e592b73e6757c1663db88f5a49', class: "navigation" }, index.h("div", { key: '85c62f8b0e15d7aa77572028665d51705f9ef453', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index$1, breadcrumbs) => (index.h(index.h.Fragment, null, index.h("span", { key: index$1, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index$1 < breadcrumbs.length - 1 && index.h("img", { class: "arrow", src: phirepassSftpClientChevronSvg }))))), index.h("section", { key: '9e1f1b406f3ac7b1a4fdda4081f310bdc054e125', class: "actions", "aria-label": "SFTP actions" }, index.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" }, index.h("img", { key: '888341d92e55f79037ccb8eca6b0eec69ff2f406', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), index.h("button", { key: '41d8256a3c8e7e6810c6f979537be3556de3611a', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, index.h("img", { key: 'e7e2d8feef73e5a77580f311d3248baaa62a44ec', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), index.h("button", { key: '4a1453249181827600e980bfcc5eef10b94c4bd7', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, index.h("img", { key: '66dc18510465e05509ea966b0d48a92dabc5a00d', src: phirepassSftpClientUploadSvg, alt: "Upload" })), index.h("button", { key: 'cbc12df3cb223cf650a12980f2b10db5114b2bff', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), index.h("input", { key: '8b472b4b82995d286127f60e394f6f83b88d05bd', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && index.h("div", { key: '9f4517dfb33071e1d1702c73fcbaaa812049c012', class: "content" }, index.h("table", { key: '841b90ae73e52083478dcccb54d75ef52b208d74' }, index.h("thead", { key: '96f9129791c51bae1f1693b4a77c3866cefe7ada' }, index.h("tr", { key: 'd5d5e032d059751a65305577670f1370c8cb0be5' }, index.h("th", { key: '06a796b795813f286c1823eb053bc21211c7a6c2' }, "Name"), index.h("th", { key: '4ce88c6ceb13af2d9e80a5c733a02ac7a15558ba' }, "Size"), index.h("th", { key: 'b4746be62c9c882f3c335b433486bc094b0fe6c3' }, "Permissions"), index.h("th", { key: '8ab7d1bab01ce229b236d9aceb3ca166b84b2551' }, "Owner"), index.h("th", { key: 'baaf0986f2851903e22d8bb8c5a2aff8c4762bf1' }, "Modified"), index.h("th", { key: 'be874212a04f3e6f9764fb664837e11cacfc9b32', class: "action-col", "aria-label": "Actions" }))), index.h("tbody", { key: 'd14243b3467786b08a3cd8d53b4e365c7c9d644d' }, this.listing.map((item, index$1) => (index.h("tr", { key: index$1, class: {
383
+ 'selected': this.is_selected(item),
384
+ }, onClick: () => this.list_directory(item) }, index.h("td", null, item.kind === 'Folder' ? index.h("img", { class: "kind", src: phirepassSftpClientFolderSvg, alt: "Folder" }) : index.h("img", { class: "kind", src: phirepassSftpClientFileSvg, alt: "File" }), index.h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), index.h("td", null, item.attributes.size), index.h("td", null, item.attributes.permissions ?? '-'), index.h("td", null, item.attributes.user ?? '-'), index.h("td", null, new Date(item.attributes.mtime * 1000).toLocaleString()), index.h("td", { class: "action-col" }, item.kind === 'File' &&
385
+ index.h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), index.h("polyline", { points: "7 10 12 15 17 10" }), index.h("line", { x1: "12", x2: "12", y1: "15", y2: "3" })))))))))), this.show_loader && index.h("div", { key: 'ee78459b85c3ffaf2583fd79edadc1398a96aa81', class: "loader" }, "Loading..."), this.show_error && index.h("div", { key: 'f658bc7e5fd922d9a9499f2b6402ca3a6453adb8', class: "error" }, this.error_message)), index.h("footer", { key: '8928750efac3a300348a0c2cfd97c735820351c7' }, index.h("section", { key: '2c72adc84a24cf9255219125ad617578d9d4e50d', class: "status" }, index.h("span", { key: '192c7f26e2372e22b8d48d3ce0d6697d20c1ad4a' }, this.status), this.selected_item && index.h("span", { key: '01d1d92290b47332e014b010be7575d9976a61d6', class: "selected-item" }, this.get_full_path(this.selected_item))), index.h("section", { key: '32951e5b9ae53f2d84d90b43820801d1a2caeb65', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
386
+ index.h("section", { key: '46ea29aafbc1b4392d5a368534b1fd1f5ca8446a', class: {
387
+ 'creds': true,
388
+ 'blurred': this.show_login_screen,
389
+ } }, index.h("form", { key: 'c70ab635c91947a722dd203a346ed40b76471a25', class: "auth", onSubmit: (event) => {
390
+ const formData = new FormData(event.target);
391
+ let username = undefined;
392
+ if (this.show_login_screen_username) {
393
+ username = formData.get('username');
394
+ }
395
+ let password = undefined;
396
+ if (this.show_login_screen_password) {
397
+ password = formData.get('password');
398
+ }
399
+ this.channel.open_sftp_tunnel(this.nodeId, username, password);
400
+ this.show_login_screen_username = false;
401
+ this.show_login_screen_password = false;
402
+ this.show_login_screen = false;
403
+ this.show_loader = true;
404
+ event.stopPropagation();
405
+ event.preventDefault();
406
+ } }, index.h("div", { key: '498d0374665f404fac6feef40ddcb7bc386e749b', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
407
+ index.h("div", { key: '2ff0c7b6bce0dabde50cc73de23ca3068951ef3d' }, index.h("label", { key: 'b6b6fb3d1c645e0ba7f55c420db3077a785cac48', htmlFor: "username" }, "Username"), index.h("input", { key: '42e5c54dcf9ee40fc35c84b44be942b4775a82b4', id: "username", autoComplete: 'off', name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
408
+ index.h("div", { key: 'ef4861042d2b239766add5185e8f4d46af526232' }, index.h("label", { key: '901716f1f0f61d9116bdac51cc96581778bf2ebb', htmlFor: "password" }, "Password"), index.h("input", { key: 'da97e27113dfc2e9bb0c0a32e9b94140db1defa7', id: "password", autoComplete: 'off', name: "password", type: "password", placeholder: "" })), index.h("div", { key: 'd8c497d4072f7b3940b483f02a722058c0b8a843' }, index.h("button", { key: 'bd9a920f46b0c48a15936a2249dadc4f04cdcc0f', type: "submit" }, "Connect"))))));
227
409
  }
228
410
  static get watchers() { return {
229
411
  "nodeId": [{
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DTAHGGCM.js');
4
- var protocol = require('./protocol-C0YjPrve.js');
3
+ var index = require('./index-DqslB2R4.js');
4
+ var protocol = require('./protocol-BDROfN76.js');
5
5
 
6
6
  /**
7
7
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
@@ -694,7 +694,7 @@ const PhirepassTerminal = class {
694
694
  this.usernameBuffer = "";
695
695
  }
696
696
  render() {
697
- return (index.h(index.Host, { key: '274fd3f8db8cb3f48bd956ba40d5aacb8ec15e1f' }, index.h("div", { key: '644c586e190c63651d9e521793611a83d372d0ad', id: "ccc", ref: el => (this.containerEl = el) })));
697
+ return (index.h(index.Host, { key: 'e0e73c834bdcafc1bc00cf27a1846893deeafdc6' }, index.h("div", { key: '8db965a7a3356deb0f672470d92521b755f2f165', id: "ccc", ref: el => (this.containerEl = el) })));
698
698
  }
699
699
  static get watchers() { return {
700
700
  "nodeId": [{
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DTAHGGCM.js');
3
+ var index = require('./index-DqslB2R4.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[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.cjs",[[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);
22
+ return index.bootstrapLazy([["phirepass-sftp-client.cjs",[[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.cjs",[[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);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -762,7 +762,7 @@ async function __wbg_init(module_or_path) {
762
762
  }
763
763
 
764
764
  if (module_or_path === undefined) {
765
- module_or_path = new URL('phirepass-channel_bg.wasm', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('protocol-C0YjPrve.js', document.baseURI).href)));
765
+ module_or_path = new URL('phirepass-channel_bg.wasm', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('protocol-BDROfN76.js', document.baseURI).href)));
766
766
  }
767
767
  const imports = __wbg_get_imports();
768
768
 
@@ -782,6 +782,7 @@ exports.ProtocolMessageType = void 0;
782
782
  ProtocolMessageType["TunnelOpened"] = "TunnelOpened";
783
783
  ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
784
784
  ProtocolMessageType["TunnelData"] = "TunnelData";
785
+ ProtocolMessageType["SFTPListItems"] = "SFTPListItems";
785
786
  })(exports.ProtocolMessageType || (exports.ProtocolMessageType = {}));
786
787
  exports.InputMode = void 0;
787
788
  (function (InputMode) {
@@ -6,6 +6,7 @@ export var ProtocolMessageType;
6
6
  ProtocolMessageType["TunnelOpened"] = "TunnelOpened";
7
7
  ProtocolMessageType["TunnelClosed"] = "TunnelClosed";
8
8
  ProtocolMessageType["TunnelData"] = "TunnelData";
9
+ ProtocolMessageType["SFTPListItems"] = "SFTPListItems";
9
10
  })(ProtocolMessageType || (ProtocolMessageType = {}));
10
11
  export var InputMode;
11
12
  (function (InputMode) {
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
2
+ stroke="rgb(189, 219, 209)" stroke-width="2" stroke-linecap="round"
3
+ stroke-linejoin="round"
4
+ class="lucide lucide-chevron-right w-3 h-3 text-muted-foreground/50 shrink-0">
5
+ <path d="m9 18 6-6-6-6"></path>
6
+ </svg>