phirepass-widgets 0.0.81 → 0.0.82

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 (34) hide show
  1. package/dist/cjs/{index-D-l8xaCI.js → index-Dtiw2goq.js} +28 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/phirepass-rdp.cjs.entry.js +296 -8
  4. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +17 -17
  5. package/dist/cjs/phirepass-terminal.cjs.entry.js +2 -2
  6. package/dist/cjs/phirepass-widgets.cjs.js +2 -2
  7. package/dist/collection/components/phirepass-rdp/phirepass-rdp.css +16 -5
  8. package/dist/collection/components/phirepass-rdp/phirepass-rdp.js +216 -6
  9. package/dist/collection/components/phirepass-rdp/phirepass-rdp.keyboard.js +88 -0
  10. package/dist/collection/components/phirepass-rdp/phirepass-rdp.viewport.js +85 -0
  11. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +16 -16
  12. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +1 -1
  13. package/dist/components/index.js +1 -1
  14. package/dist/components/phirepass-rdp.js +1 -1
  15. package/dist/components/phirepass-sftp-client.js +1 -1
  16. package/dist/components/phirepass-terminal.js +1 -1
  17. package/dist/esm/{index-DovZQ7sb.js → index-Buu-IaNK.js} +28 -0
  18. package/dist/esm/loader.js +3 -3
  19. package/dist/esm/phirepass-rdp.entry.js +296 -8
  20. package/dist/esm/phirepass-sftp-client.entry.js +17 -17
  21. package/dist/esm/phirepass-terminal.entry.js +2 -2
  22. package/dist/esm/phirepass-widgets.js +3 -3
  23. package/dist/phirepass-widgets/p-306c47c5.entry.js +1 -0
  24. package/dist/phirepass-widgets/{p-19789356.entry.js → p-8dca9e3a.entry.js} +1 -1
  25. package/dist/phirepass-widgets/p-Buu-IaNK.js +2 -0
  26. package/dist/phirepass-widgets/{p-2478a6eb.entry.js → p-b74a5300.entry.js} +2 -2
  27. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
  28. package/dist/types/components/phirepass-rdp/phirepass-rdp.d.ts +65 -0
  29. package/dist/types/components/phirepass-rdp/phirepass-rdp.keyboard.d.ts +42 -0
  30. package/dist/types/components/phirepass-rdp/phirepass-rdp.viewport.d.ts +33 -0
  31. package/dist/types/components.d.ts +34 -0
  32. package/package.json +1 -1
  33. package/dist/phirepass-widgets/p-DovZQ7sb.js +0 -2
  34. package/dist/phirepass-widgets/p-a5528005.entry.js +0 -1
@@ -1,7 +1,182 @@
1
- import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-DovZQ7sb.js';
1
+ import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-Buu-IaNK.js';
2
2
  import { _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-CWIhN33k.js';
3
3
 
4
- const phirepassRdpCss = () => `:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%}.screen iron-remote-desktop{display:block;width:100%;height:100%}.screen canvas{max-width:100%;display:block}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{margin-top:0.5rem;padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}`;
4
+ /**
5
+ * RDP's display-control PDU describes a monitor in whole, even pixels within
6
+ * these bounds. A layout outside them is refused by the host rather than
7
+ * negotiated down, and the client reports nothing when that happens — so the
8
+ * clamping has to be done here, before the request leaves.
9
+ */
10
+ const MIN_DIMENSION = 200;
11
+ const MAX_DIMENSION = 8192;
12
+ /** How long a drag has to settle before the host is asked for a new size. */
13
+ const RESIZE_DEBOUNCE_MS = 250;
14
+ function clamp(value) {
15
+ if (!Number.isFinite(value) || value <= 0) {
16
+ return MIN_DIMENSION;
17
+ }
18
+ return Math.min(MAX_DIMENSION, Math.max(MIN_DIMENSION, Math.floor(value)));
19
+ }
20
+ function even(value) {
21
+ return value - (value % 2);
22
+ }
23
+ function clamp_desktop_size(width, height) {
24
+ return { width: even(clamp(width)), height: even(clamp(height)) };
25
+ }
26
+ /** The size the remote desktop would need to be to fill `element` exactly. */
27
+ function measure_desktop_size(element) {
28
+ const rect = element.getBoundingClientRect();
29
+ return clamp_desktop_size(rect.width, rect.height);
30
+ }
31
+ function same_desktop_size(a, b) {
32
+ return !!a && !!b && a.width === b.width && a.height === b.height;
33
+ }
34
+ /**
35
+ * Reports the widget's size to whoever can act on it, as the widget is resized.
36
+ *
37
+ * Two behaviours are deliberate. It **debounces**, because dragging a panel
38
+ * edge emits a resize per frame while every report costs a display-control
39
+ * round trip to the host — and a host that is still applying one layout ignores
40
+ * the next. And it **drops repeats**, because a resize observer also fires for
41
+ * changes that do not move the desktop at all (a scrollbar appearing, the
42
+ * canvas being re-laid-out in response to the resize this class just asked for,
43
+ * which would otherwise loop).
44
+ */
45
+ class ViewportSync {
46
+ onResize;
47
+ debounceMs;
48
+ observer;
49
+ handle;
50
+ reported;
51
+ constructor(onResize, debounceMs = RESIZE_DEBOUNCE_MS) {
52
+ this.onResize = onResize;
53
+ this.debounceMs = debounceMs;
54
+ }
55
+ /**
56
+ * Starts watching `element`. The current size is reported immediately, so a
57
+ * widget that was resized while disconnected catches up on reconnect.
58
+ */
59
+ observe(element) {
60
+ this.disconnect();
61
+ this.report(measure_desktop_size(element));
62
+ // Absent under the spec test environment, and on nothing else worth
63
+ // supporting — a missing observer costs the dynamic resize, not the
64
+ // session.
65
+ if (typeof ResizeObserver === 'undefined') {
66
+ return;
67
+ }
68
+ this.observer = new ResizeObserver(() => {
69
+ clearTimeout(this.handle);
70
+ this.handle = setTimeout(() => this.report(measure_desktop_size(element)), this.debounceMs);
71
+ });
72
+ this.observer.observe(element);
73
+ }
74
+ disconnect() {
75
+ clearTimeout(this.handle);
76
+ this.handle = undefined;
77
+ this.observer?.disconnect();
78
+ this.observer = undefined;
79
+ this.reported = undefined;
80
+ }
81
+ report(size) {
82
+ if (same_desktop_size(size, this.reported)) {
83
+ return;
84
+ }
85
+ this.reported = size;
86
+ this.onResize(size);
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Keyboard capture for the RDP widget, in two layers.
92
+ *
93
+ * **Ordinary keys** are IronRDP's own doing: it listens on `window` and
94
+ * forwards a key event only while its element is `document.activeElement`. That
95
+ * check is why the client element is mounted in the widget's *light* DOM — see
96
+ * the note on `mount_client` in the component — and why it has to be focused,
97
+ * which `focus_client` below is for.
98
+ *
99
+ * **Keys the browser reserves** (Ctrl+W, Ctrl+T, Ctrl+N, Alt+Tab, F11, Escape)
100
+ * never reach the page at all, so no amount of focus will forward them. The
101
+ * only way to have them is the Keyboard Lock API, and browsers grant that only
102
+ * to a document that is already fullscreen. So "capture my keyboard" is really
103
+ * "go fullscreen, then lock" — hence `toggle_fullscreen`.
104
+ */
105
+ function keyboard_api() {
106
+ return navigator.keyboard;
107
+ }
108
+ /** Chromium-only at the time of writing; Firefox and Safari have no equivalent. */
109
+ function keyboard_lock_supported() {
110
+ return typeof keyboard_api()?.lock === 'function';
111
+ }
112
+ /** Strictly this element — what deciding whether to enter or exit turns on. */
113
+ function is_fullscreen(element) {
114
+ return document.fullscreenElement === element;
115
+ }
116
+ /**
117
+ * This element *or* something around it. The lock is granted per document, so
118
+ * a host app that made a whole panel fullscreen should get it too.
119
+ */
120
+ function shown_fullscreen(element) {
121
+ return document.fullscreenElement?.contains(element) ?? false;
122
+ }
123
+ /**
124
+ * Takes every key the browser is willing to give up. Called with no arguments
125
+ * `lock()` claims the lot, including Escape — which is also the key that leaves
126
+ * fullscreen, so the browser substitutes a press-and-hold gesture for it.
127
+ */
128
+ async function lock_keyboard(element) {
129
+ // There is no capability query, and the request rejects outside fullscreen,
130
+ // so the caller's state is the only guard available.
131
+ if (!keyboard_lock_supported() || !shown_fullscreen(element)) {
132
+ return;
133
+ }
134
+ try {
135
+ await keyboard_api().lock();
136
+ }
137
+ catch (err) {
138
+ console.warn('Failed to lock the keyboard for the RDP session:', err);
139
+ }
140
+ }
141
+ function unlock_keyboard() {
142
+ if (!keyboard_lock_supported()) {
143
+ return;
144
+ }
145
+ try {
146
+ keyboard_api().unlock();
147
+ }
148
+ catch (err) {
149
+ console.warn('Failed to release the keyboard lock:', err);
150
+ }
151
+ }
152
+ /** Returns whether `element` is fullscreen once the request has settled. */
153
+ async function toggle_fullscreen(element) {
154
+ try {
155
+ if (is_fullscreen(element)) {
156
+ await document.exitFullscreen();
157
+ return false;
158
+ }
159
+ await element.requestFullscreen({ navigationUI: 'hide' });
160
+ return true;
161
+ }
162
+ catch (err) {
163
+ console.warn('Failed to change the fullscreen state of the RDP session:', err);
164
+ return is_fullscreen(element);
165
+ }
166
+ }
167
+ /**
168
+ * Gives the client element focus so IronRDP starts forwarding keys.
169
+ *
170
+ * The element's shadow root is opened with `delegatesFocus`, so focusing the
171
+ * host lands on the canvas inside it; the canvas is what IronRDP watches. Doing
172
+ * this on connect saves the user the mouse-over that would otherwise be needed
173
+ * before the first keystroke lands.
174
+ */
175
+ function focus_client(element) {
176
+ element?.focus({ preventScroll: true });
177
+ }
178
+
179
+ const phirepassRdpCss = () => `:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{margin-top:0.5rem;padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}`;
5
180
 
6
181
  const PhirepassRdp = class {
7
182
  constructor(hostRef) {
@@ -12,10 +187,12 @@ const PhirepassRdp = class {
12
187
  containerEl;
13
188
  ironEl;
14
189
  userInteraction;
190
+ viewport;
15
191
  domReady = false;
16
192
  runtimeReady = false;
17
193
  connected = false;
18
194
  session_id;
195
+ onFullscreenChange = () => this.sync_keyboard_lock();
19
196
  /** Credentials in force for this session, from props or from the prompt. */
20
197
  credentials;
21
198
  credentialsPrompt = false;
@@ -50,6 +227,26 @@ const PhirepassRdp = class {
50
227
  destination;
51
228
  /** `fit` scales the desktop to the widget, `real` keeps 1:1 pixels. */
52
229
  scale = 'fit';
230
+ /**
231
+ * Ask the remote host to change its resolution to match the widget whenever
232
+ * the widget is resized, so the desktop is rendered at native size rather
233
+ * than scaled.
234
+ *
235
+ * The host has the last word: this needs the display-control channel, and a
236
+ * host that does not offer it simply keeps the resolution it started with —
237
+ * which `scale` then fits into the widget, as before.
238
+ */
239
+ dynamicResize = true;
240
+ /**
241
+ * While the widget is fullscreen, take the keys the browser normally keeps
242
+ * for itself (Ctrl+W, Ctrl+T, Alt+Tab, F11) and send them to the remote
243
+ * host instead. Escape is taken too, so leaving fullscreen becomes a
244
+ * press-and-hold.
245
+ *
246
+ * Ordinary keys do not depend on this — they are forwarded whenever the
247
+ * desktop has focus.
248
+ */
249
+ captureKeyboard = true;
53
250
  onNodeIdChange(newValue, _oldValue) {
54
251
  this.reset_session_state();
55
252
  if (this.channel && this.channel.is_connected()) {
@@ -76,6 +273,7 @@ const PhirepassRdp = class {
76
273
  return `${protocol}://${this.serverHost}:${this.serverPort}`;
77
274
  }
78
275
  async connectedCallback() {
276
+ document.addEventListener('fullscreenchange', this.onFullscreenChange);
79
277
  await __wbg_init();
80
278
  this.open_comms();
81
279
  this.runtimeReady = true;
@@ -90,11 +288,31 @@ const PhirepassRdp = class {
90
288
  this.try_connect();
91
289
  }
92
290
  async disconnectedCallback() {
291
+ document.removeEventListener('fullscreenchange', this.onFullscreenChange);
93
292
  this.connected = false;
94
293
  this.domReady = false;
95
294
  this.runtimeReady = false;
96
295
  this.close_comms();
97
296
  }
297
+ /**
298
+ * Puts the widget in and out of fullscreen, returning the state it settled
299
+ * in. Fullscreen is also what makes `captureKeyboard` possible, so a host
300
+ * app wanting the browser's own shortcuts to reach the remote desktop has
301
+ * to come through here.
302
+ */
303
+ async toggleFullscreen() {
304
+ const fullscreen = await toggle_fullscreen(this.el);
305
+ this.focus_desktop();
306
+ return fullscreen;
307
+ }
308
+ /** Whether the browser can hand over its reserved keys at all. */
309
+ async keyboardLockSupported() {
310
+ return keyboard_lock_supported();
311
+ }
312
+ /** Directs keystrokes at the remote desktop without waiting for a click. */
313
+ async focusDesktop() {
314
+ this.focus_desktop();
315
+ }
98
316
  try_connect() {
99
317
  if (this.connected || !this.domReady || !this.runtimeReady) {
100
318
  return;
@@ -221,23 +439,46 @@ const PhirepassRdp = class {
221
439
  void this.start_session(detail.irgUserInteraction, web.ticket, backend.enableCredssp(true));
222
440
  });
223
441
  this.ironEl = element;
224
- this.containerEl.appendChild(element);
442
+ this.mount_client(element);
443
+ }
444
+ /**
445
+ * Mounts the client in the widget's **light** DOM, slotted into `.screen`,
446
+ * rather than as a child of the shadow root.
447
+ *
448
+ * This is what makes the keyboard work. IronRDP forwards a key event only
449
+ * while `document.activeElement` is its own element, and `activeElement`
450
+ * retargets focus to the outermost shadow host: with the client inside this
451
+ * widget's shadow root the answer is always `<phirepass-rdp>`, the check
452
+ * never passes, and not one keystroke reaches the remote host — while the
453
+ * mouse, which is bound to the canvas directly, works fine. Slotting the
454
+ * client leaves it in the document tree, so `activeElement` resolves to the
455
+ * client itself.
456
+ */
457
+ mount_client(element) {
458
+ this.el.appendChild(element);
225
459
  }
226
460
  async start_session(userInteraction, ticket, credssp) {
227
461
  this.userInteraction = userInteraction;
228
- const config = userInteraction
462
+ const builder = userInteraction
229
463
  .configBuilder()
230
464
  .withUsername(this.credentials?.username ?? '')
231
465
  .withPassword(this.credentials?.password ?? '')
232
466
  .withDestination(this.destination ?? this.nodeId)
233
467
  .withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`)
234
468
  .withAuthToken(ticket)
235
- .withExtension(credssp)
236
- .build();
469
+ .withExtension(credssp);
470
+ // Asking for the widget's size up front costs nothing and saves the
471
+ // remote host a resolution change immediately after logon.
472
+ if (this.dynamicResize) {
473
+ builder.withDesktopSize(measure_desktop_size(this.el));
474
+ }
237
475
  try {
238
- const session = await userInteraction.connect(config);
476
+ const session = await userInteraction.connect(builder.build());
239
477
  userInteraction.setVisibility(true);
240
478
  this.statusMessage = undefined;
479
+ this.focus_desktop();
480
+ this.start_viewport_sync();
481
+ void this.sync_keyboard_lock();
241
482
  const termination = await session.run();
242
483
  this.statusMessage = termination.reason();
243
484
  }
@@ -247,6 +488,51 @@ const PhirepassRdp = class {
247
488
  this.connectionStateChanged.emit([ConnectionState.Error, err]);
248
489
  }
249
490
  }
491
+ /**
492
+ * Keeps the remote resolution equal to the widget's size.
493
+ *
494
+ * `setVisibility(true)` is what gives the widget its layout, so the first
495
+ * measurement has to happen after it — measuring earlier reads a hidden,
496
+ * zero-sized box.
497
+ */
498
+ start_viewport_sync() {
499
+ if (!this.dynamicResize) {
500
+ return;
501
+ }
502
+ this.viewport = new ViewportSync((size) => this.resize_desktop(size));
503
+ this.viewport.observe(this.el);
504
+ }
505
+ stop_viewport_sync() {
506
+ this.viewport?.disconnect();
507
+ this.viewport = undefined;
508
+ }
509
+ resize_desktop(size) {
510
+ try {
511
+ this.userInteraction?.resize(size.width, size.height);
512
+ }
513
+ catch (err) {
514
+ // A host without the display-control channel refuses the request;
515
+ // the session carries on at the resolution it already has.
516
+ console.warn('The remote host would not resize its desktop:', err);
517
+ }
518
+ }
519
+ focus_desktop() {
520
+ focus_client(this.ironEl);
521
+ }
522
+ /**
523
+ * Holds the keyboard lock exactly while the widget is fullscreen. Both
524
+ * edges matter: the browser drops the lock on its own when fullscreen ends,
525
+ * but not when the session does, and a lock left behind would keep
526
+ * swallowing shortcuts for the rest of the page.
527
+ */
528
+ async sync_keyboard_lock() {
529
+ if (!this.captureKeyboard || !shown_fullscreen(this.el)) {
530
+ unlock_keyboard();
531
+ return;
532
+ }
533
+ await lock_keyboard(this.el);
534
+ this.focus_desktop();
535
+ }
250
536
  /** IronRDP rejects with its own error shape rather than an `Error`. */
251
537
  describe_error(err) {
252
538
  const iron = err;
@@ -266,6 +552,8 @@ const PhirepassRdp = class {
266
552
  this.connectionStateChanged.emit([ConnectionState.Error, error]);
267
553
  }
268
554
  teardown_client() {
555
+ this.stop_viewport_sync();
556
+ unlock_keyboard();
269
557
  if (this.userInteraction) {
270
558
  try {
271
559
  this.userInteraction.shutdown();
@@ -290,7 +578,7 @@ const PhirepassRdp = class {
290
578
  this.request_tunnel();
291
579
  }
292
580
  render() {
293
- return (h(Host, { key: '97b198af30e4e4b7ae8cbd0d497dc4f4812615f8' }, h("div", { key: 'f7d01492909a0f3cb6c639345eb70a8e1fbf1b90', class: "screen", ref: (el) => (this.containerEl = el) }), this.credentialsPrompt && (h("form", { key: '1dcfeaa956999dc882943e0d0b49ead8d12840bc', class: "prompt", onSubmit: (event) => this.submit_credentials(event) }, h("label", { key: 'a62e96bfb6b947167f731020c7ab00a1d9a82652', htmlFor: "rdp-username" }, "Windows username"), h("input", { key: '3135d24b62b2b612a11d3cbfd2c19f3cf381e74b', id: "rdp-username", type: "text", autocomplete: "username", autofocus: true, onInput: (event) => (this.usernameBuffer = event.target.value) }), h("label", { key: 'd8b901e0fe81de30e6426f80179d5e8da542effc', htmlFor: "rdp-password" }, "Password"), h("input", { key: '0bfad07c7f5355a8693856b1e6b51df59944a339', id: "rdp-password", type: "password", autocomplete: "current-password", onInput: (event) => (this.passwordBuffer = event.target.value) }), h("button", { key: 'e1cbab525870c34fe85299a8ce883d7069cb4bb8', type: "submit" }, "Connect"))), this.statusMessage && !this.credentialsPrompt && (h("div", { key: '4144cff9e5d6fb637655203bf67a13adaa7feede', class: "status" }, this.statusMessage))));
581
+ return (h(Host, { key: '140e8f813403dad27cbbe3b0d3e3099e90c9e08d' }, h("div", { key: '0f695b83c808a678b9bff3434ac1ff65a6765e1e', class: "screen", ref: (el) => (this.containerEl = el) }, h("slot", { key: 'b382a47294606909074c8b64983419645cda438b' })), this.credentialsPrompt && (h("form", { key: '18606a269f254c5bffc81c6c45a4e85473fff557', class: "prompt", onSubmit: (event) => this.submit_credentials(event) }, h("label", { key: 'f4c2bf9aaa483e323b38d12774728e3a687962a4', htmlFor: "rdp-username" }, "Windows username"), h("input", { key: 'ba766990c9fc089b1aa9d894ac5d7032f0c87edf', id: "rdp-username", type: "text", autocomplete: "username", autofocus: true, onInput: (event) => (this.usernameBuffer = event.target.value) }), h("label", { key: '885ee563e3537712d3ad85e47485f44f2de576c5', htmlFor: "rdp-password" }, "Password"), h("input", { key: '19cfa162b515e6b230b19a3f2f8fd267ff5388ec', id: "rdp-password", type: "password", autocomplete: "current-password", onInput: (event) => (this.passwordBuffer = event.target.value) }), h("button", { key: '04b428b4947f1d0f957399961c5196d5bbc6b5a7', type: "submit" }, "Connect"))), this.statusMessage && !this.credentialsPrompt && (h("div", { key: 'eb66cd3974a3aa8a563bd54599912bc735007214', class: "status" }, this.statusMessage))));
294
582
  }
295
583
  static get watchers() { return {
296
584
  "nodeId": [{
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-DovZQ7sb.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-Buu-IaNK.js';
2
2
  import { _ as __wbg_init, E as ErrorType, C as Channel, a as ConnectionState, P as ProtocolMessageType } from './protocol-CWIhN33k.js';
3
3
 
4
4
  const phirepassSftpClientLogoSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIgogICAgc3Ryb2tlPSJyZ2IoNDYsIDE4NCwgMTM4KSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiCiAgICBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10ZXJtaW5hbCB3LTMuNSBoLTMuNSB0ZXh0LXByaW1hcnkiPgogICAgPHBvbHlsaW5lIHBvaW50cz0iNCAxNyAxMCAxMSA0IDUiPjwvcG9seWxpbmU+CiAgICA8bGluZSB4MT0iMTIiIHgyPSIyMCIgeTE9IjE5IiB5Mj0iMTkiPjwvbGluZT4KPC9zdmc+Cg==';
@@ -924,18 +924,18 @@ const PhirepassSftpClient = class {
924
924
  return `${typeChar}${chars.join('')}`;
925
925
  }
926
926
  render() {
927
- return (h(Host, { key: '682152b79b8d22bd7c81299225fb9d1bb0da72db', class: {
927
+ return (h(Host, { key: '6f830eb2cea173cb081eabdd7d3d418e8c831b4a', class: {
928
928
  'default': !this.max,
929
929
  'max': this.max,
930
- } }, h("section", { key: '5be263e7b380fc61ab70856c6650b5dfb0901795', class: "listing" }, !this.hideHeader &&
931
- h("header", { key: 'fee0627ccb716ef560e8723496087e1b565f759f' }, h("section", { key: 'b112ebbe9ff73bc80ce84bb47e50769ae45a4ce2', class: "title" }, h("img", { key: '3a0ec7d30cf4cab69ec5f2e236b8e162ea4c2ce5', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), h("div", { key: '433b5063ca30b4cc04544ff6ef29d94e9dc0a703', class: "text" }, h("div", { key: 'dd354e0b38c4e3d8cc5f9588bbeb2cbb32d476fc', class: "name" }, this.name), h("div", { key: '523829c5a164d755211bc35caf8fdeb44ca8a15e', class: "description" }, this.description))), h("section", { key: '9dd9e2c1f7e43c72d284a67332320f736a81a809', class: "actions" }, h("div", { key: '40a2744abdfadf699cd631684e083ec0dc829a7d', class: "action", onClick: () => this.toggle_max() }, h("img", { key: '3ad551f84dbf56da3d47bd0045748a94c285bc72', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), h("main", { key: '770b9372cdb761efb233f73d70afb83f5d5d2c01' }, this.show_navigation && h("nav", { key: 'b9c318e991b2523497e1c6e1cc55d540215fa848', class: "navigation" }, h("div", { key: '9f9e8e06ba65e47979980fc52cdcc73ae494df24', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index, breadcrumbs) => (h("span", { key: index, class: "breadcrumb-container" }, h("span", { key: index, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index < breadcrumbs.length - 1 && h("img", { class: "arrow", src: phirepassSftpClientChevronSvg }))))), h("section", { key: '21eda2e694e98f40b40e0421c333e8fa582731ff', class: "actions", "aria-label": "SFTP actions" }, h("button", { key: 'e74fdf11191b0d80ba286c4d6a7f613bd7c9d5bb', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: '2785ac1d0ae7c33123fb924ad030efc4d5e03da0', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), h("button", { key: '08b3880df69db41a7bad0278971308e5bbdb5813', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: '2b00f26ae3b5fc3a923b337a7f2a0a6e641874fa', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), h("button", { key: '4b05f7d304f5a89642dccfa499ab1421890d67c8', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: 'a95624e723f28b04ab277b82650a2334bd2aa679', src: phirepassSftpClientUploadSvg, alt: "Upload" })), h("button", { key: '3277414b28f178d1ba3d6f147ed79bc951a5df29', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: '5c248ba2c5c001aa2e0196f41f278f70412b5c1b', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: 'afff360eecca86b4c66a799e8938108a310ccbab', class: "content" }, h("table", { key: '31e9223fab1a5d6a3f797b44efbd6f735551757a' }, h("thead", { key: '16662bfc34dc06207c7d131f067ac257c27c4ed0' }, h("tr", { key: '8a6d2344ae8c71c6ef99fd7c19acf508d1b887d2' }, h("th", { key: 'f7f8759feb03389fe61b1d63394c8557c3d0b209' }, "Name"), h("th", { key: '1342f11d5132c84447f32099661d08723eb62ef7' }, "Size"), h("th", { key: '7e041ba0b6515d8c734ebddd418f17173f9361f1' }, "Permissions"), h("th", { key: '05921d3c7bf7e4dd320d1116f451730346a0a148' }, "Owner"), h("th", { key: '0e7b65094f59b7219f2ef4e9ac1ba87969c6078e' }, "Modified"), h("th", { key: '261be85a5ccbce865b09d0cf8276df408af49e14', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: '04043d8e6d3151d5d1dcf72b67208967dfcd9dfd' }, this.listing.map((item, index) => (h("tr", { key: index, class: {
930
+ } }, h("section", { key: '0c028222f80a6783f4f457dd9dbb4f276c7e75cc', class: "listing" }, !this.hideHeader &&
931
+ h("header", { key: 'bf4260a4f13173ff003885c39167177c17fb138f' }, h("section", { key: '6025f57ee11cda79928158fc86be88588aeda5c1', class: "title" }, h("img", { key: '1a1fc770118c2d1c027248b65c110ad948ce5860', src: phirepassSftpClientLogoSvg, alt: "SFTP Client" }), h("div", { key: '5c71b597edfd27b5d79966281cada602604ed849', class: "text" }, h("div", { key: '600e8073d2d240cb599a76426a296a396201f70e', class: "name" }, this.name), h("div", { key: '6d40ba59e26818071ab0f110651c8da1cbe8794c', class: "description" }, this.description))), h("section", { key: 'a90afbb3729ac3dc40cc16eda959a5b9028a14f3', class: "actions" }, h("div", { key: '97b8b948b8bbe521cfbc91279e84ccc9e9c5b151', class: "action", onClick: () => this.toggle_max() }, h("img", { key: '6f7881d837d5b5e4f79d1dead0d53df733205899', src: phirepassSftpClientMaxSvg, alt: "Maximize" })))), h("main", { key: '58db45bcafab4c55e257831e9693591724fc9848' }, this.show_navigation && h("nav", { key: '9b0c06d3afd36a32845334375c0ec0f0f4e363ea', class: "navigation" }, h("div", { key: '5b84ca2d3a55afb383fe27ed9b955d24560b0283', class: "breadcrumbs" }, this.breadcrumbs.map((crumb, index, breadcrumbs) => (h("span", { key: index, class: "breadcrumb-container" }, h("span", { key: index, onClick: () => this.list_breadcrumb(crumb.path), class: "breadcrumb" }, crumb.label), index < breadcrumbs.length - 1 && h("img", { class: "arrow", src: phirepassSftpClientChevronSvg }))))), h("section", { key: '66dd6ce5d4d85c089a869a371208c98582a33e87', class: "actions", "aria-label": "SFTP actions" }, h("button", { key: '105c5d93be38f4ceb1da058f5f57855decf3aa8f', type: "button", class: "action", onClick: () => this.go_to_parent_directory(), title: "Go to parent directory", "aria-label": "Go to parent directory" }, h("img", { key: '8b425e80e9aa707607822b9e4ae3828ae01e4202', src: phirepassSftpClientGoUpSvg, alt: "Go up" })), h("button", { key: 'd0f01c462c3e6f52155e1307f048c5027202819b', type: "button", class: "action", onClick: () => this.refresh_directory(), title: "Refresh", "aria-label": "Refresh" }, h("img", { key: '11e66f738f80032018bbe796eb8f7f42001f4b5f', src: phirepassSftpClientRefreshSvg, alt: "Refresh" })), h("button", { key: 'a39aed27376480e5e2dc68fc4b1ef57b8c4b0b40', type: "button", class: "action", onClick: () => this.open_upload_picker(), title: "Upload", "aria-label": "Upload" }, h("img", { key: 'fac80ba8c1283eed058e017efc45904658f91f43', src: phirepassSftpClientUploadSvg, alt: "Upload" })), h("button", { key: '281854c1ac21ac8be51a22da7a5e6ac7f902f74b', type: "button", class: "action disconnect", onClick: () => this.disconnect_session(), title: "Disconnect", "aria-label": "Disconnect" }, "DISCONNECT"))), h("input", { key: '9daf263acc61a2241c10817056cdb3cd8da81c9e', type: "file", ref: (el) => this.uploadInputEl = el, onChange: (event) => this.on_upload_selected(event), style: { display: 'none' } }), this.show_content && h("div", { key: '6611808a8f69b06bb66e2b7e82bb06e0c6469d18', class: "content" }, h("table", { key: '46d758f6b01f1e48acf99d0b797c5ec538717ea0' }, h("thead", { key: '7f3b4f05a2538d20efd43d21ec2d425a286d1b35' }, h("tr", { key: 'b9c8584bc98a5e9d24fd17346e325ccf511a109c' }, h("th", { key: '93220b4f6a1f7a7ca79978f8a98fb7218eb4a353' }, "Name"), h("th", { key: 'a25c5948ab02ed467ba4f71314f5ebb0756e7678' }, "Size"), h("th", { key: '27f32a431f5e20b4331b79ae358d7a077681a548' }, "Permissions"), h("th", { key: 'a3ae189c7161a3237dd2f07c50a965a0b5a51058' }, "Owner"), h("th", { key: 'ddc31efb5d7d3746875590ef4e52dd61375f963c' }, "Modified"), h("th", { key: '590b952ac4c16a9abdb4bcce432818ef9ddb1687', class: "action-col", "aria-label": "Actions" }))), h("tbody", { key: '5a35c2357ad4ff9e99dcd499ec894bc89466b4ba' }, this.listing.map((item, index) => (h("tr", { key: index, class: {
932
932
  'selected': this.is_selected(item),
933
933
  }, onClick: () => this.list_directory(item) }, h("td", null, item.kind === 'Folder' ? h("img", { class: "kind", src: phirepassSftpClientFolderSvg, alt: "Folder" }) : h("img", { class: "kind", src: phirepassSftpClientFileSvg, alt: "File" }), h("span", { class: `name ${item.kind.toLowerCase()}` }, item.name)), h("td", null, this.format_size(item.attributes.size)), h("td", null, this.format_permissions(item.attributes.permissions, item.kind)), h("td", null, item.attributes.user ?? '-'), h("td", null, new Date(item.attributes.modified * 1000).toLocaleString()), h("td", { class: "action-col" }, item.kind === 'File' &&
934
- h("div", { class: "file-actions" }, h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("polyline", { points: "7 10 12 15 17 10" }), h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": "Delete" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("polyline", { points: "3 6 5 6 21 6" }), h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), h("line", { x1: "14", x2: "14", y1: "11", y2: "17" }))))))))))), this.show_loader && h("div", { key: 'a69008f418c1d9afa2e980ada402a80382ea7fec', class: "loader" }, "Loading..."), this.show_error && h("div", { key: '29875e65941130d5fe0f842ebec0685f69769ecf', class: "error" }, this.error_message)), h("footer", { key: '6dc5eff60f9b6acedff8996aa688b450dcaa2eeb' }, h("section", { key: 'cf1dadc5e03c3480b5c3d7c7fe0547ec087d1ce9', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
935
- h("section", { key: '0d8b86d8b48fee55504f65f3938fa81b59f8b18f', class: {
934
+ h("div", { class: "file-actions" }, h("button", { type: "button", class: "file-action", onClick: (event) => this.on_file_row_action(item, event), title: "Download", "aria-label": "Download" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("polyline", { points: "7 10 12 15 17 10" }), h("line", { x1: "12", x2: "12", y1: "15", y2: "3" }))), h("button", { type: "button", class: "file-action delete", onClick: (event) => this.on_file_delete_action(item, event), title: "Delete", "aria-label": "Delete" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("polyline", { points: "3 6 5 6 21 6" }), h("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }), h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }), h("line", { x1: "10", x2: "10", y1: "11", y2: "17" }), h("line", { x1: "14", x2: "14", y1: "11", y2: "17" }))))))))))), this.show_loader && h("div", { key: '137cf80c05c6fa389cf9bd3bd9003d8f4796419b', class: "loader" }, "Loading..."), this.show_error && h("div", { key: '1ba1fad888b61e18f6dfb2bcbd7bd22e0f911c6c', class: "error" }, this.error_message)), h("footer", { key: '247a9ed330ff6f465cca3cae91dd045f1183d6d4' }, h("section", { key: '16691e17293b7f2181d080ecb68f283110b5a887', class: "version" }, this.version ? `Version: ${this.version}` : ''))), this.show_login_screen &&
935
+ h("section", { key: '8df665b59da590cd5a4c684a9eb3a772f9265cbb', class: {
936
936
  'creds': true,
937
937
  'blurred': this.show_login_screen,
938
- } }, h("form", { key: 'a5e8c4a877b696edad3b4808c2d325c78d1ff169', class: "auth", onSubmit: (event) => {
938
+ } }, h("form", { key: 'efffd5be69a1ac3f2df26c174be2ebb6aa989850', class: "auth", onSubmit: (event) => {
939
939
  const formData = new FormData(event.target);
940
940
  let username = undefined;
941
941
  if (this.show_login_screen_username) {
@@ -952,28 +952,28 @@ const PhirepassSftpClient = class {
952
952
  this.show_loader = true;
953
953
  event.stopPropagation();
954
954
  event.preventDefault();
955
- } }, h("div", { key: '1d2790cefa333a230e01b564673d8d1ce76942ca', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
956
- h("div", { key: 'a2a43e259b11a526cf288dd2ae49c532440d33b4' }, h("label", { key: '95165a92cb5246188fedce9ba20b0f670bd877e5', htmlFor: "username" }, "Username"), h("input", { key: 'ccf925451b36456f24cdbc13fac1b8575a23a804', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
957
- h("div", { key: '2a3c49b4f0b2a34b6585ef1cf9a4baa52ef7970c' }, h("label", { key: '4c581797a2d16396a1cf1ab2c65cb5a23572f876', htmlFor: "password" }, "Password"), h("input", { key: '757fa564b1097339c84259e1615f03e0511990a5', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), h("div", { key: '219ed5d8d9c13ec4c0e47218170528e8ae0e9b81' }, h("button", { key: 'ea52ade9fef73f167246c437f37e5ee44d8aa881', type: "submit" }, "Connect")))), this.show_upload_modal &&
958
- h("section", { key: '91be9acc6c829b65a2cb602884a98add1847b915', class: {
955
+ } }, h("div", { key: '6ece35409f1cb33e953857e908b5c251265f9b7a', class: "title" }, "SFTP Connection"), this.show_login_screen_username &&
956
+ h("div", { key: 'd2e6a109f1d68ffb21fd709f9f761b7a097973ce' }, h("label", { key: 'df54f92649e1e3535b368bcbdb53e2061e008d9d', htmlFor: "username" }, "Username"), h("input", { key: '09724a6b262408825babdf1855daf97dd6e48274', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "username", name: "username", type: "text", placeholder: "" })), this.show_login_screen_password &&
957
+ h("div", { key: 'b67d7fdf364616217cf0fe7493db87f368a0e00b' }, h("label", { key: '1a4f81e403e8048980848a22753dff7922a25eb8', htmlFor: "password" }, "Password"), h("input", { key: 'd7a806e065f81c07a682d0ace085dd80f96bb2e2', autocorrect: "off", autocapitalize: "none", autoComplete: "off", id: "password", name: "password", type: "password", placeholder: "" })), h("div", { key: 'eb184e90d5a99411c0c68c63c0f58b74e2b3a454' }, h("button", { key: '92014931e757553af1fc785fa89dc859fed6421d', type: "submit" }, "Connect")))), this.show_upload_modal &&
958
+ h("section", { key: 'b730e0680f0e5325f506104438e30e9f3dc6ec18', class: {
959
959
  'upload-modal': true,
960
960
  'visible': this.show_upload_modal,
961
- } }, h("div", { key: '526462f6a166512cbcaeca9acdf02c7352abf720', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, h("div", { key: '1093b566e4103d84c0537ad0a4eee820dff77d5e', class: "title" }, "Uploading File"), h("div", { key: '1f2c1fcaa97653693162073267db16363f578a5e', class: "file-name", title: this.upload_file_name }, this.upload_file_name), h("div", { key: 'c1ee1c778fda4336c462adce90bf194a021af91f', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, h("div", { key: 'ab1a29dc9134eb917e34df41b38e0b936cd7a1dd', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), h("div", { key: 'a84c897deec8cf324c3a29667989b8aaa3540266', class: "progress-meta" }, h("div", { key: '66447fa44ae2cb5995b3fc08c1411aaffd65102a', class: "progress-speed" }, this.upload_speed), h("div", { key: '66d5b6b40e67af836ff61955d46c63033a663305', class: "progress-value" }, this.format_percent(this.upload_progress))), h("button", { key: '1ea99f4cbd0ab4a9972180029865fc99975511fd', type: "button", class: {
961
+ } }, h("div", { key: '80205240d2af805bede0d6d42ffefad176d0b6f6', class: "upload-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Upload progress" }, h("div", { key: 'ee11974c49a3597eaee6b588c328c5d77659c2b4', class: "title" }, "Uploading File"), h("div", { key: 'cf24d8f350325bf9cd6f128dc5ad2b2467ff4adb', class: "file-name", title: this.upload_file_name }, this.upload_file_name), h("div", { key: 'e36c4cf5785166c1d9b5121066210d87cc09d4e5', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.upload_progress }, h("div", { key: 'f1db022f2d3fb92fb9686d50e4aa0366e80da8ca', class: "progress-fill", style: { width: `${this.upload_progress}%` } })), h("div", { key: '515bdf6caf6a3d0c04badc923bc8a1f24d388cfe', class: "progress-meta" }, h("div", { key: '00935d340635aaa36004444b627e25732f7c17ab', class: "progress-speed" }, this.upload_speed), h("div", { key: '369e5c294ac99e1f25fceb3575838e50ce5c0cb4', class: "progress-value" }, this.format_percent(this.upload_progress))), h("button", { key: 'c9694acf8f7cb316a9e60bf33c80279fba7f3676', type: "button", class: {
962
962
  'cancel': true,
963
963
  'finished': this.upload_finished,
964
964
  }, onClick: () => this.cancel_upload() }, this.upload_finished ? 'Close' : 'Cancel'))), this.show_download_modal &&
965
- h("section", { key: '0da9656501ff93d682a48a8ae58a72555aa6b713', class: {
965
+ h("section", { key: 'c54157cf02112940304bd5d107e442626cbc3a3a', class: {
966
966
  'download-modal': true,
967
967
  'visible': this.show_download_modal,
968
- } }, h("div", { key: '17d3737bd24412e7bd6d35bfb97f53bb5849bb53', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, h("div", { key: '991c82ce3f4fb403f0f308a66a93763df7c840d4', class: "title" }, "Downloading File"), h("div", { key: '0988219f6118e701570a4829e15f1547dd5df3fd', class: "file-name", title: this.download_file_name }, this.download_file_name), h("div", { key: 'afb70a6f0b2215975e21db7258aec3b7cabbbbde', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, h("div", { key: '4223ef43e1b92db4d9b0af4583f545239f8161ca', class: "progress-fill", style: { width: `${this.download_progress}%` } })), h("div", { key: 'e2fbb4ffe05614e3876e4d5ea7d93f677356f43f', class: "progress-meta" }, h("div", { key: 'b20cdf67680d6ecc7590455700506160e0c85cb9', class: "progress-speed" }, this.download_speed), h("div", { key: '7d174465abaf4f384cba6bfa3a5c10adbcc917b7', class: "progress-value" }, this.format_percent(this.download_progress))), h("button", { key: 'ce0c262e02e9295223308c962e923acff8027561', type: "button", class: {
968
+ } }, h("div", { key: '51cc07975f3cb4d8d5dd29a457a2cb56d58c2bc3', class: "download-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Download progress" }, h("div", { key: 'fa15597119c5656530b136a0796ba498d05f7ba3', class: "title" }, "Downloading File"), h("div", { key: 'a12e3b257a91a30323c018dcd0117ddcfde7ec9d', class: "file-name", title: this.download_file_name }, this.download_file_name), h("div", { key: '788db1afcf3506ee26dc7965060b5213b1285379', class: "progress-track", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": this.download_progress }, h("div", { key: '9842d1e20a24bcbb5185918b2373818414a86bb6', class: "progress-fill", style: { width: `${this.download_progress}%` } })), h("div", { key: '26347a189b2fc3b0594a548cb15aeaa6e1ca2901', class: "progress-meta" }, h("div", { key: 'c2acfab8ec6d6c74df299f7b7b1f8bdcb88702db', class: "progress-speed" }, this.download_speed), h("div", { key: '853c8b4b8fb5d9d13cd5c654bfdeda02b4f4e097', class: "progress-value" }, this.format_percent(this.download_progress))), h("button", { key: '40a339398d29082b1532cd1d13fec2027a5c0c84', type: "button", class: {
969
969
  'cancel': true,
970
970
  'finished': this.download_finished,
971
971
  }, onClick: () => this.cancel_download() }, this.download_finished ? 'Close' : 'Cancel'))), this.show_delete_modal &&
972
- h("section", { key: '7adae3f5add735aad8ca7e53e4e4c423ad651b93', class: {
972
+ h("section", { key: '07ca147451fe3063aa418ee46af09d5d037752cc', class: {
973
973
  'delete-modal': true,
974
974
  'visible': this.show_delete_modal,
975
- } }, h("div", { key: '3c7bad705431130db785a5ea0589b046ee031a70', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation" }, h("div", { key: '0f1136b5fd29bb9708bbaed48d0ac1e5d19ee942', class: "title" }, "Delete File"), h("div", { key: 'f32cea38c0fdcbba6753598c2bca19fc1907b44b', class: "message" }, this.delete_loading ? 'Deleting file...' : 'Are you sure you want to delete this file?'), h("div", { key: '2c11182160f49406cdf8573d107e5e9cd7690e4c', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_loading &&
976
- h("div", { key: 'bb3e1fbafffce7ea4a1c1e43b32219973b220848', class: "delete-loader", "aria-hidden": "true" }, h("span", { key: '3521881d7325c02ca6624d1f09bc5e4ab05ecdbd', class: "spinner" })), h("div", { key: 'da492d943dbc6a88f58652c1590eb4095cecc833', class: "modal-actions" }, h("button", { key: '136255109de5cd76b8d3067605f1b2214122272d', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), h("button", { key: '750c19696695c581b08b466f19c07947b637b8bf', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete'))))));
975
+ } }, h("div", { key: '5c11193b4808d43d33151cb5eebf8efa54ec75bd', class: "delete-dialog", role: "dialog", "aria-modal": "true", "aria-label": "Delete confirmation" }, h("div", { key: '858d54eddbb5ed0b72176494ac515fc4c7b16dfc', class: "title" }, "Delete File"), h("div", { key: 'df347ceded9b6e8b44285e0b4122cd363c2504a2', class: "message" }, this.delete_loading ? 'Deleting file...' : 'Are you sure you want to delete this file?'), h("div", { key: 'c547c48ba66daabb9bed82d220d87b8b0eef25b3', class: "file-name", title: this.delete_file_name }, this.delete_file_name), this.delete_loading &&
976
+ h("div", { key: 'a3fd5cf9a93a5d2937a10d8333bb2dd6abe73254', class: "delete-loader", "aria-hidden": "true" }, h("span", { key: 'ca4414ae7183139b1ff8b36630e330f05896c0fd', class: "spinner" })), h("div", { key: 'e229b2804e7cbed6edbbd1b6542b7a33ac1c0575', class: "modal-actions" }, h("button", { key: 'eedf2e90f7896fcce7db6bad995c890d79ec9361', type: "button", class: "btn secondary", onClick: () => this.cancel_delete(), disabled: this.delete_loading }, "Cancel"), h("button", { key: '010e0b6468eb7522f7131e2a37d4b25fad828837', type: "button", class: "btn destructive", onClick: () => this.confirm_delete(), disabled: this.delete_loading }, this.delete_loading ? 'Deleting...' : 'Delete'))))));
977
977
  }
978
978
  static get watchers() { return {
979
979
  "nodeId": [{
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-DovZQ7sb.js';
1
+ import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-Buu-IaNK.js';
2
2
  import { I as InputMode, _ as __wbg_init, C as Channel, a as ConnectionState, P as ProtocolMessageType, E as ErrorType } from './protocol-CWIhN33k.js';
3
3
 
4
4
  /**
@@ -693,7 +693,7 @@ const PhirepassTerminal = class {
693
693
  this.usernameBuffer = "";
694
694
  }
695
695
  render() {
696
- return (h$1(Host, { key: '502a46c25541e7b9eea5b716f3806f6045b19049' }, h$1("div", { key: 'fae18cfb592bcc346e9203f2491fc661bd7bff5a', id: "ccc", ref: el => (this.containerEl = el) })));
696
+ return (h$1(Host, { key: '5e05e1ea65ffcaa21b3e819008fa5c7d7949d15d' }, h$1("div", { key: '9b8b336caff03d4456bc072ecaaa490325089ced', id: "ccc", ref: el => (this.containerEl = el) })));
697
697
  }
698
698
  static get watchers() { return {
699
699
  "nodeId": [{
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-DovZQ7sb.js';
2
- export { s as setNonce } from './index-DovZQ7sb.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-Buu-IaNK.js';
2
+ export { s as setNonce } from './index-Buu-IaNK.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-rdp",[[513,"phirepass-rdp",{"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"username":[1],"password":[1],"destination":[1],"scale":[1],"serverId":[1,"server-id"],"credentialsPrompt":[32],"statusMessage":[32]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["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"],"serviceId":[1,"service-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],"show_upload_modal":[32],"upload_progress":[32],"upload_file_name":[32],"upload_speed":[32],"upload_finished":[32],"show_download_modal":[32],"download_progress":[32],"download_file_name":[32],"download_speed":[32],"download_finished":[32],"show_delete_modal":[32],"delete_file_name":[32],"delete_loading":[32],"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"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
20
+ return bootstrapLazy([["phirepass-rdp",[[769,"phirepass-rdp",{"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serviceId":[1,"service-id"],"token":[1],"username":[1],"password":[1],"destination":[1],"scale":[1],"dynamicResize":[4,"dynamic-resize"],"captureKeyboard":[4,"capture-keyboard"],"serverId":[1,"server-id"],"credentialsPrompt":[32],"statusMessage":[32],"toggleFullscreen":[64],"keyboardLockSupported":[64],"focusDesktop":[64]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]],["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"],"serviceId":[1,"service-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],"show_upload_modal":[32],"upload_progress":[32],"upload_file_name":[32],"upload_speed":[32],"upload_finished":[32],"show_download_modal":[32],"download_progress":[32],"download_file_name":[32],"download_speed":[32],"download_finished":[32],"show_delete_modal":[32],"delete_file_name":[32],"delete_loading":[32],"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"],"serviceId":[1,"service-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
21
21
  });
@@ -0,0 +1 @@
1
+ import{r as t,c as e,g as s,h as i,H as o}from"./p-Buu-IaNK.js";import{_ as n,C as h,a as r,P as a}from"./p-CWIhN33k.js";function c(t){return!Number.isFinite(t)||t<=0?200:Math.min(8192,Math.max(200,Math.floor(t)))}function d(t){return t-t%2}function u(t){const e=t.getBoundingClientRect();return s=e.height,{width:d(c(e.width)),height:d(c(s))};var s}class l{onResize;debounceMs;observer;handle;reported;constructor(t,e=250){this.onResize=t,this.debounceMs=e}observe(t){this.disconnect(),this.report(u(t)),"undefined"!=typeof ResizeObserver&&(this.observer=new ResizeObserver((()=>{clearTimeout(this.handle),this.handle=setTimeout((()=>this.report(u(t))),this.debounceMs)})),this.observer.observe(t))}disconnect(){clearTimeout(this.handle),this.handle=void 0,this.observer?.disconnect(),this.observer=void 0,this.reported=void 0}report(t){var e,s;s=this.reported,(e=t)&&s&&e.width===s.width&&e.height===s.height||(this.reported=t,this.onResize(t))}}function p(){return navigator.keyboard}function f(){return"function"==typeof p()?.lock}function m(t){return document.fullscreenElement===t}function b(t){return document.fullscreenElement?.contains(t)??!1}function y(){if(f())try{p().unlock()}catch(t){console.warn("Failed to release the keyboard lock:",t)}}const w=class{constructor(s){t(this,s),this.connectionStateChanged=e(this,"connectionStateChanged")}channel;containerEl;ironEl;userInteraction;viewport;domReady=!1;runtimeReady=!1;connected=!1;session_id;onFullscreenChange=()=>this.sync_keyboard_lock();credentials;credentialsPrompt=!1;statusMessage;usernameBuffer="";passwordBuffer="";get el(){return s(this)}serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;serviceId;token;username;password;destination;scale="fit";dynamicResize=!0;captureKeyboard=!0;onNodeIdChange(t,e){this.reset_session_state(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,e){this.onNodeIdChange(this.nodeId,this.nodeId)}connectionStateChanged;create_web_socket_endpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){document.addEventListener("fullscreenchange",this.onFullscreenChange),await n(),this.open_comms(),this.runtimeReady=!0,this.nodeId?this.try_connect():console.warn("Prop node_id is not set. Cannot connect to RDP.")}componentDidLoad(){this.domReady=!0,this.try_connect()}async disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.connected=!1,this.domReady=!1,this.runtimeReady=!1,this.close_comms()}async toggleFullscreen(){const t=await async function(t){try{return m(t)?(await document.exitFullscreen(),!1):(await t.requestFullscreen({navigationUI:"hide"}),!0)}catch(e){return console.warn("Failed to change the fullscreen state of the RDP session:",e),m(t)}}(this.el);return this.focus_desktop(),t}async keyboardLockSupported(){return f()}async focusDesktop(){this.focus_desktop()}try_connect(){!this.connected&&this.domReady&&this.runtimeReady&&this.containerEl&&this.channel&&this.connect()}connect(){this.connected=!0,this.channel.connect()}open_comms(){this.channel=this.serverId?new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId,this.serverId):new h(`${this.create_web_socket_endpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.connectionStateChanged.emit([r.Connected]),this.channel.authenticate(this.token,this.nodeId)})),this.channel.on_connection_close((()=>{this.connectionStateChanged.emit([r.Disconnected]),this.teardown_client()})),this.channel.on_connection_error((t=>{this.connectionStateChanged.emit([r.Error,t])})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:e}=t.data;switch(e.type){case a.Error:this.handle_error(e);break;case a.AuthSuccess:this.handle_auth_success(e);break;case a.RDPAuthorized:this.handle_rdp_authorized(e);break;case a.TunnelClosed:this.handle_tunnel_closed(e);break;default:console.warn("Unknown protocol message type:",e)}}))}close_comms(){this.teardown_client(),this.channel&&(this.channel.stop_heartbeat(),this.channel.disconnect())}reset_session_state(){this.session_id=void 0,this.credentials=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer="",this.statusMessage=void 0}handle_auth_success(t){if(this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.username&&this.password)return this.credentials={username:this.username,password:this.password},void this.request_tunnel();this.credentialsPrompt=!0}request_tunnel(){this.credentials&&(this.statusMessage=void 0,this.channel.open_rdp_tunnel(this.nodeId,this.serviceId,this.credentials.username,this.credentials.password))}async handle_rdp_authorized(t){this.session_id=t.sid,this.statusMessage="Connecting…";const[e]=await Promise.all([import("@devolutions/iron-remote-desktop-rdp"),import("@devolutions/iron-remote-desktop")]);if(!this.containerEl||this.session_id!==t.sid)return;if(await e.init("info"),!this.containerEl||this.session_id!==t.sid)return;const s=document.createElement("iron-remote-desktop");s.module=e.Backend,s.scale=this.scale,s.flexcenter=!0,s.verbose=!1,s.addEventListener("ready",(s=>{this.start_session(s.detail.irgUserInteraction,t.ticket,e.enableCredssp(!0))})),this.ironEl=s,this.mount_client(s)}mount_client(t){this.el.appendChild(t)}async start_session(t,e,s){this.userInteraction=t;const i=t.configBuilder().withUsername(this.credentials?.username??"").withPassword(this.credentials?.password??"").withDestination(this.destination??this.nodeId).withProxyAddress(`${this.create_web_socket_endpoint()}/api/web/rdp/${this.nodeId}`).withAuthToken(e).withExtension(s);this.dynamicResize&&i.withDesktopSize(u(this.el));try{const e=await t.connect(i.build());t.setVisibility(!0),this.statusMessage=void 0,this.focus_desktop(),this.start_viewport_sync(),this.sync_keyboard_lock();const s=await e.run();this.statusMessage=s.reason()}catch(t){const e=this.describe_error(t);this.statusMessage=e,this.connectionStateChanged.emit([r.Error,t])}}start_viewport_sync(){this.dynamicResize&&(this.viewport=new l((t=>this.resize_desktop(t))),this.viewport.observe(this.el))}stop_viewport_sync(){this.viewport?.disconnect(),this.viewport=void 0}resize_desktop(t){try{this.userInteraction?.resize(t.width,t.height)}catch(t){console.warn("The remote host would not resize its desktop:",t)}}focus_desktop(){var t;t=this.ironEl,t?.focus({preventScroll:!0})}async sync_keyboard_lock(){this.captureKeyboard&&b(this.el)?(await async function(t){if(f()&&b(t))try{await p().lock()}catch(t){console.warn("Failed to lock the keyboard for the RDP session:",t)}}(this.el),this.focus_desktop()):y()}describe_error(t){return t&&"function"==typeof t.backtrace?t.backtrace():t instanceof Error?t.message:"Connection failed."}handle_tunnel_closed(t){this.session_id=void 0,this.statusMessage=this.statusMessage??"Connection closed.",this.teardown_client(),this.close_comms()}handle_error(t){this.statusMessage=t.message,this.connectionStateChanged.emit([r.Error,t])}teardown_client(){if(this.stop_viewport_sync(),y(),this.userInteraction){try{this.userInteraction.shutdown()}catch(t){console.warn("Failed to shut the RDP session down cleanly:",t)}this.userInteraction=void 0}this.ironEl?.remove(),this.ironEl=void 0,this.credentialsPrompt=!1,this.usernameBuffer="",this.passwordBuffer=""}submit_credentials(t){t.preventDefault(),this.credentialsPrompt=!1,this.credentials={username:this.usernameBuffer,password:this.passwordBuffer},this.usernameBuffer="",this.passwordBuffer="",this.request_tunnel()}render(){return i(o,{key:"140e8f813403dad27cbbe3b0d3e3099e90c9e08d"},i("div",{key:"0f695b83c808a678b9bff3434ac1ff65a6765e1e",class:"screen",ref:t=>this.containerEl=t},i("slot",{key:"b382a47294606909074c8b64983419645cda438b"})),this.credentialsPrompt&&i("form",{key:"18606a269f254c5bffc81c6c45a4e85473fff557",class:"prompt",onSubmit:t=>this.submit_credentials(t)},i("label",{key:"f4c2bf9aaa483e323b38d12774728e3a687962a4",htmlFor:"rdp-username"},"Windows username"),i("input",{key:"ba766990c9fc089b1aa9d894ac5d7032f0c87edf",id:"rdp-username",type:"text",autocomplete:"username",autofocus:!0,onInput:t=>this.usernameBuffer=t.target.value}),i("label",{key:"885ee563e3537712d3ad85e47485f44f2de576c5",htmlFor:"rdp-password"},"Password"),i("input",{key:"19cfa162b515e6b230b19a3f2f8fd267ff5388ec",id:"rdp-password",type:"password",autocomplete:"current-password",onInput:t=>this.passwordBuffer=t.target.value}),i("button",{key:"04b428b4947f1d0f957399961c5196d5bbc6b5a7",type:"submit"},"Connect")),this.statusMessage&&!this.credentialsPrompt&&i("div",{key:"eb66cd3974a3aa8a563bd54599912bc735007214",class:"status"},this.statusMessage))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};w.style=':host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;position:relative;background:#0b1021}.screen{width:100%;height:100%;display:flex}::slotted(iron-remote-desktop){display:block;flex:1 1 auto;min-width:0;min-height:0;width:100%;height:100%}:host(:fullscreen){width:100vw;height:100vh;background:#000}.prompt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.5rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.875rem}.prompt input{padding:0.5rem 0.75rem;border:1px solid #334155;border-radius:0.375rem;background:#0f172a;color:inherit;font:inherit;min-width:16rem}.prompt input:focus{outline:2px solid #67e8f9;outline-offset:1px}.prompt button{margin-top:0.5rem;padding:0.5rem 1.25rem;border:0;border-radius:0.375rem;background:#67e8f9;color:#0b1021;font:inherit;font-weight:600;cursor:pointer}.status{position:absolute;inset-inline:0;bottom:0;padding:0.5rem 0.75rem;background:rgba(11, 16, 33, 0.92);color:#e2e8f0;font-family:"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace;font-size:0.8125rem;text-align:center}';export{w as phirepass_rdp}