phirepass-widgets 0.0.1

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 (51) hide show
  1. package/LICENSE +661 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/index-DEqYBozk.js +1399 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +13 -0
  6. package/dist/cjs/phirepass-sftp-client.cjs.entry.js +17 -0
  7. package/dist/cjs/phirepass-terminal.cjs.entry.js +1349 -0
  8. package/dist/cjs/phirepass-widgets.cjs.js +25 -0
  9. package/dist/collection/collection-manifest.json +13 -0
  10. package/dist/collection/common/protocol.js +2 -0
  11. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.css +3 -0
  12. package/dist/collection/components/phirepass-sftp-client/phirepass-sftp-client.js +18 -0
  13. package/dist/collection/components/phirepass-terminal/phirepass-terminal.css +297 -0
  14. package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +532 -0
  15. package/dist/collection/index.js +1 -0
  16. package/dist/collection/phirepass-channel_bg.wasm +0 -0
  17. package/dist/components/index.d.ts +35 -0
  18. package/dist/components/index.js +1 -0
  19. package/dist/components/phirepass-sftp-client.d.ts +11 -0
  20. package/dist/components/phirepass-sftp-client.js +1 -0
  21. package/dist/components/phirepass-terminal.d.ts +11 -0
  22. package/dist/components/phirepass-terminal.js +49 -0
  23. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  24. package/dist/esm/index-DvJqTeLJ.js +1391 -0
  25. package/dist/esm/index.js +1 -0
  26. package/dist/esm/loader.js +11 -0
  27. package/dist/esm/phirepass-sftp-client.entry.js +15 -0
  28. package/dist/esm/phirepass-terminal.entry.js +1346 -0
  29. package/dist/esm/phirepass-widgets.js +21 -0
  30. package/dist/index.cjs.js +1 -0
  31. package/dist/index.js +1 -0
  32. package/dist/phirepass-widgets/index.esm.js +0 -0
  33. package/dist/phirepass-widgets/p-5bdfe1f8.entry.js +49 -0
  34. package/dist/phirepass-widgets/p-DQuL1Twl.js +1 -0
  35. package/dist/phirepass-widgets/p-DvJqTeLJ.js +2 -0
  36. package/dist/phirepass-widgets/p-b070cf72.entry.js +1 -0
  37. package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
  38. package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -0
  39. package/dist/types/common/protocol.d.ts +31 -0
  40. package/dist/types/components/phirepass-sftp-client/phirepass-sftp-client.d.ts +3 -0
  41. package/dist/types/components/phirepass-terminal/phirepass-terminal.d.ts +75 -0
  42. package/dist/types/components.d.ts +92 -0
  43. package/dist/types/index.d.ts +10 -0
  44. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  45. package/loader/cdn.js +1 -0
  46. package/loader/index.cjs.js +1 -0
  47. package/loader/index.d.ts +24 -0
  48. package/loader/index.es2017.js +1 -0
  49. package/loader/index.js +2 -0
  50. package/package.json +61 -0
  51. package/readme.md +111 -0
@@ -0,0 +1,532 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { Terminal } from "@xterm/xterm";
3
+ import { FitAddon } from "@xterm/addon-fit";
4
+ import { WebLinksAddon } from "@xterm/addon-web-links";
5
+ import { SearchAddon } from "@xterm/addon-search";
6
+ import { WebglAddon } from "@xterm/addon-webgl";
7
+ import { SerializeAddon } from "@xterm/addon-serialize";
8
+ import { ImageAddon } from "@xterm/addon-image";
9
+ import init, { Channel as PhirepassChannel } from "phirepass-channel";
10
+ import { ProtocolMessageError } from "../../common/protocol";
11
+ var InputMode;
12
+ (function (InputMode) {
13
+ InputMode[InputMode["Username"] = 0] = "Username";
14
+ InputMode[InputMode["Password"] = 1] = "Password";
15
+ InputMode[InputMode["Default"] = 2] = "Default";
16
+ })(InputMode || (InputMode = {}));
17
+ export class PhirepassTerminal {
18
+ terminal;
19
+ fitAddon;
20
+ webLinksAddon;
21
+ searchAddon;
22
+ webglAddon;
23
+ serializeAddon;
24
+ imageAddon;
25
+ channel;
26
+ inputMode = InputMode.Default;
27
+ resizeObserver;
28
+ resizeDebounceHandle;
29
+ session_id;
30
+ usernameBuffer = "";
31
+ passwordBuffer = "";
32
+ xtermImageSettings = {
33
+ enableSizeReports: true, // whether to enable CSI t reports (see below)
34
+ pixelLimit: 16777216, // max. pixel size of a single image
35
+ sixelSupport: true, // enable sixel support
36
+ sixelScrolling: true, // whether to scroll on image output
37
+ sixelPaletteLimit: 256, // initial sixel palette size
38
+ sixelSizeLimit: 25000000, // size limit of a single sixel sequence
39
+ storageLimit: 128, // FIFO storage limit in MB
40
+ showPlaceholder: true, // whether to show a placeholder for evicted images
41
+ iipSupport: true, // enable iTerm IIP support
42
+ iipSizeLimit: 20000000 // size limit of a single IIP sequence
43
+ };
44
+ el;
45
+ terminalOptions = {
46
+ // Terminal identification
47
+ termName: 'xterm-256color',
48
+ // Rendering
49
+ rendererType: 'canvas', // Better performance
50
+ allowTransparency: false,
51
+ fontFamily: '"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace',
52
+ fontSize: 12,
53
+ // fontWeight: 'normal',
54
+ // fontWeightBold: 'bold',
55
+ letterSpacing: 0,
56
+ lineHeight: 1.0,
57
+ allowProposedApi: true, // needed for bracketed paste
58
+ // Cursor
59
+ cursorBlink: true,
60
+ // cursorStyle: 'block',
61
+ cursorWidth: 1,
62
+ // Colors
63
+ theme: {
64
+ background: "#0b1021",
65
+ foreground: "#e2e8f0",
66
+ cursor: "#67e8f9",
67
+ },
68
+ // Scrolling
69
+ scrollback: 10000,
70
+ fastScrollModifier: 'shift',
71
+ fastScrollSensitivity: 5,
72
+ // Behavior
73
+ bellStyle: 'sound', // or 'none' if you prefer
74
+ convertEol: false, // true to treat \n as \r\n
75
+ disableStdin: false,
76
+ // Selection
77
+ rightClickSelectsWord: true,
78
+ // Performance
79
+ drawBoldTextInBrightColors: true,
80
+ minimumContrastRatio: 1,
81
+ // Advanced
82
+ windowsMode: false, // Important for Linux
83
+ macOptionIsMeta: false,
84
+ altClickMovesCursor: true
85
+ };
86
+ serverHost = "phirepass.io";
87
+ serverPort = 443;
88
+ allowInsecure = false;
89
+ heartbeatInterval = 30_000;
90
+ nodeId;
91
+ onNodeIdChange(newValue, _oldValue) {
92
+ // Handle the change in node_id here
93
+ // console.log(`node_id changed from ${oldValue} to ${newValue}`);
94
+ // Always clear local session state and reset terminal view
95
+ this.resetSessionState();
96
+ this.terminal.reset();
97
+ // Close existing comms if connected
98
+ if (this.channel && this.channel.is_connected()) {
99
+ this.close_comms();
100
+ }
101
+ // Open new comms for the updated node
102
+ if (newValue) {
103
+ this.open_comms();
104
+ this.channel.connect();
105
+ }
106
+ }
107
+ createWebSocketEndpoint() {
108
+ const protocol = this.allowInsecure ? 'ws' : 'wss';
109
+ if (!this.allowInsecure && this.serverPort === 443) {
110
+ return `${protocol}://${this.serverHost}`;
111
+ }
112
+ if (this.allowInsecure && this.serverPort === 80) {
113
+ return `${protocol}://${this.serverHost}`;
114
+ }
115
+ return `${protocol}://${this.serverHost}:${this.serverPort}`;
116
+ }
117
+ async connectedCallback() {
118
+ await init();
119
+ this.setup_terminal();
120
+ this.open_comms();
121
+ if (!this.nodeId) {
122
+ console.warn('Prop node_id is not set. Cannot connect to terminal.');
123
+ return;
124
+ }
125
+ this.connect();
126
+ }
127
+ async disconnectedCallback() {
128
+ if (this.resizeObserver) {
129
+ this.resizeObserver.disconnect();
130
+ }
131
+ this.close_comms();
132
+ this.destroy_terminal();
133
+ }
134
+ setup_terminal() {
135
+ this.terminal = new Terminal(this.terminalOptions);
136
+ this.fitAddon = new FitAddon();
137
+ this.terminal.loadAddon(this.fitAddon);
138
+ this.webLinksAddon = new WebLinksAddon();
139
+ this.terminal.loadAddon(this.webLinksAddon);
140
+ this.searchAddon = new SearchAddon();
141
+ this.terminal.loadAddon(this.searchAddon);
142
+ this.serializeAddon = new SerializeAddon();
143
+ this.terminal.loadAddon(this.serializeAddon);
144
+ this.imageAddon = new ImageAddon(this.xtermImageSettings);
145
+ this.terminal.loadAddon(this.imageAddon);
146
+ try {
147
+ this.webglAddon = new WebglAddon();
148
+ this.terminal.loadAddon(this.webglAddon);
149
+ }
150
+ catch (e) {
151
+ console.warn('WebGL addon not available or failed to load:', e);
152
+ }
153
+ this.fitAddon.fit();
154
+ }
155
+ destroy_terminal() {
156
+ if (this.terminal) {
157
+ this.terminal.reset();
158
+ if (typeof this.terminal.dispose === 'function') {
159
+ this.terminal.dispose();
160
+ }
161
+ }
162
+ }
163
+ open_comms() {
164
+ this.channel = new PhirepassChannel(`${this.createWebSocketEndpoint()}/api/web/ws`);
165
+ this.channel.on_connection_open(() => {
166
+ this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
167
+ this.channel.open_ssh_tunnel(this.nodeId);
168
+ });
169
+ this.channel.on_connection_close(() => {
170
+ this.terminal.reset();
171
+ });
172
+ this.channel.on_connection_error((err) => {
173
+ console.error('>> connection error:', err);
174
+ });
175
+ this.channel.on_connection_message((_raw) => {
176
+ // console.log('>> raw message received', raw);
177
+ });
178
+ this.channel.on_protocol_message((msg) => {
179
+ const { web } = msg.data;
180
+ switch (web.type) {
181
+ case "Error":
182
+ this.handle_error(web);
183
+ break;
184
+ case "TunnelOpened":
185
+ this.session_id = web.sid;
186
+ this.terminal.reset();
187
+ this.send_ssh_terminal_resize();
188
+ break;
189
+ case "TunnelClosed":
190
+ this.handleTunnelClosed();
191
+ break;
192
+ case "TunnelData":
193
+ this.terminal.write(new Uint8Array(web.data));
194
+ break;
195
+ default:
196
+ console.warn('Unknown protocol message type:', web);
197
+ }
198
+ });
199
+ }
200
+ send_ssh_terminal_resize() {
201
+ if (!this.channel || !this.channel.is_connected() || !this.session_id) {
202
+ return;
203
+ }
204
+ const cols = this.terminal?.cols ?? 0;
205
+ const rows = this.terminal?.rows ?? 0;
206
+ if (cols <= 0 || rows <= 0) {
207
+ return;
208
+ }
209
+ try {
210
+ this.channel.send_ssh_terminal_resize(this.nodeId, this.session_id, cols, rows);
211
+ }
212
+ catch (err) {
213
+ console.error('Failed to send terminal resize:', err);
214
+ }
215
+ }
216
+ send_ssh_data(data) {
217
+ if (this.channel.is_connected() && this.session_id) {
218
+ this.channel.send_ssh_tunnel_data(this.nodeId, this.session_id, data);
219
+ }
220
+ }
221
+ handle_error(error) {
222
+ switch (error.kind) {
223
+ case ProtocolMessageError.Generic:
224
+ this.terminal.reset();
225
+ this.terminal.write(error.message + "\r\n");
226
+ this.terminal.focus();
227
+ break;
228
+ case ProtocolMessageError.RequiresUsername:
229
+ this.terminal.reset();
230
+ this.inputMode = InputMode.Username;
231
+ this.usernameBuffer = "";
232
+ this.terminal.write("Enter your username: ");
233
+ this.terminal.focus();
234
+ break;
235
+ case ProtocolMessageError.RequiresPassword:
236
+ this.terminal.reset();
237
+ this.inputMode = InputMode.Password;
238
+ this.passwordBuffer = "";
239
+ this.terminal.write("Enter your password: ");
240
+ this.terminal.focus();
241
+ break;
242
+ default:
243
+ console.warn('Unknown error kind:', error);
244
+ }
245
+ }
246
+ close_comms() {
247
+ this.channel.stop_heartbeat();
248
+ this.channel.disconnect();
249
+ }
250
+ cancelCredentialEntry() {
251
+ this.inputMode = InputMode.Default;
252
+ this.usernameBuffer = "";
253
+ this.passwordBuffer = "";
254
+ this.terminal.writeln("Authentication cancelled.");
255
+ this.terminal.reset();
256
+ }
257
+ resetSessionState() {
258
+ this.session_id = undefined;
259
+ this.inputMode = InputMode.Default;
260
+ this.usernameBuffer = "";
261
+ this.passwordBuffer = "";
262
+ }
263
+ handleTunnelClosed() {
264
+ // Clear session state
265
+ this.session_id = undefined;
266
+ this.inputMode = InputMode.Default;
267
+ // Clear credential buffers for security
268
+ this.usernameBuffer = "";
269
+ this.passwordBuffer = "";
270
+ // Reset terminal display
271
+ this.terminal.reset();
272
+ this.terminal.writeln("Connection closed.");
273
+ }
274
+ connect() {
275
+ const container = this.el.shadowRoot.getElementById('ccc');
276
+ if (container) {
277
+ this.terminal.open(container);
278
+ this.fitAddon.fit();
279
+ this.terminal.focus();
280
+ this.terminal.onData(this.handleTerminalData.bind(this));
281
+ this.channel.connect();
282
+ this.setupResizeObserver();
283
+ }
284
+ }
285
+ setupResizeObserver() {
286
+ this.resizeObserver = new ResizeObserver(() => {
287
+ if (this.resizeDebounceHandle) {
288
+ clearTimeout(this.resizeDebounceHandle);
289
+ }
290
+ this.resizeDebounceHandle = setTimeout(() => {
291
+ this.fitAddon.fit();
292
+ this.send_ssh_terminal_resize();
293
+ }, 100);
294
+ });
295
+ this.resizeObserver.observe(this.el);
296
+ }
297
+ handleTerminalData(data) {
298
+ switch (this.inputMode) {
299
+ case InputMode.Username:
300
+ this.handleUsernameInput(data);
301
+ break;
302
+ case InputMode.Password:
303
+ this.handlePasswordInput(data);
304
+ break;
305
+ case InputMode.Default:
306
+ this.send_ssh_data(data);
307
+ break;
308
+ }
309
+ }
310
+ handleUsernameInput(data) {
311
+ if (data === "\r" || data === "\n") {
312
+ this.terminal.write("\r\n");
313
+ this.submitUsername();
314
+ return;
315
+ }
316
+ if (data === "\u0003") {
317
+ this.terminal.write("^C\r\n");
318
+ this.cancelCredentialEntry();
319
+ return;
320
+ }
321
+ if (data === "\u007f") {
322
+ if (this.usernameBuffer.length) {
323
+ this.usernameBuffer = this.usernameBuffer.slice(0, -1);
324
+ this.terminal.write("\b \b");
325
+ }
326
+ return;
327
+ }
328
+ if (data >= " " && data <= "~") {
329
+ this.usernameBuffer += data;
330
+ this.terminal.write(data);
331
+ }
332
+ }
333
+ submitUsername() {
334
+ if (!this.channel.is_connected()) {
335
+ return;
336
+ }
337
+ const username = this.usernameBuffer.trim();
338
+ if (!username) {
339
+ this.terminal.writeln("");
340
+ this.terminal.write("Enter your username: ");
341
+ this.usernameBuffer = "";
342
+ return;
343
+ }
344
+ this.inputMode = InputMode.Default;
345
+ this.channel.open_ssh_tunnel(this.nodeId, username);
346
+ }
347
+ handlePasswordInput(data) {
348
+ if (data === "\r" || data === "\n") {
349
+ this.terminal.write("\r\n");
350
+ this.submitPassword();
351
+ return;
352
+ }
353
+ if (data === "\u0003") {
354
+ this.terminal.write("^C\r\n");
355
+ this.cancelCredentialEntry();
356
+ return;
357
+ }
358
+ if (data === "\u007f") {
359
+ if (this.passwordBuffer.length) {
360
+ this.passwordBuffer = this.passwordBuffer.slice(0, -1);
361
+ this.terminal.write("\b \b");
362
+ }
363
+ return;
364
+ }
365
+ if (data >= " " && data <= "~") {
366
+ this.passwordBuffer += data;
367
+ this.terminal.write("*");
368
+ }
369
+ }
370
+ submitPassword() {
371
+ if (!this.channel.is_connected()) {
372
+ return;
373
+ }
374
+ const password = this.passwordBuffer;
375
+ if (!password) {
376
+ this.terminal.writeln("");
377
+ this.terminal.write("Enter your password: ");
378
+ this.passwordBuffer = "";
379
+ return;
380
+ }
381
+ this.inputMode = InputMode.Default;
382
+ // Assuming there's a method to submit password to the channel
383
+ // You may need to adjust this based on your actual API
384
+ this.channel.open_ssh_tunnel(this.nodeId, this.usernameBuffer.trim(), password);
385
+ // Clear sensitive data
386
+ this.passwordBuffer = "";
387
+ this.usernameBuffer = "";
388
+ }
389
+ render() {
390
+ return (h(Host, { key: 'f3443a4e7b9e1a4c5377fb35d4b0cee540d03548' }, h("div", { key: 'b59a88b42d813cf991b02e755785df3a72334068', id: "ccc" })));
391
+ }
392
+ static get is() { return "phirepass-terminal"; }
393
+ static get encapsulation() { return "shadow"; }
394
+ static get originalStyleUrls() {
395
+ return {
396
+ "$": ["phirepass-terminal.css"]
397
+ };
398
+ }
399
+ static get styleUrls() {
400
+ return {
401
+ "$": ["phirepass-terminal.css"]
402
+ };
403
+ }
404
+ static get properties() {
405
+ return {
406
+ "terminalOptions": {
407
+ "type": "unknown",
408
+ "mutable": false,
409
+ "complexType": {
410
+ "original": "{ termName: string; rendererType: string; allowTransparency: boolean; fontFamily: string; fontSize: number; letterSpacing: number; lineHeight: number; allowProposedApi: boolean; cursorBlink: boolean; cursorWidth: number; theme: { background: string; foreground: string; cursor: string; }; scrollback: number; fastScrollModifier: string; fastScrollSensitivity: number; bellStyle: string; convertEol: boolean; disableStdin: boolean; rightClickSelectsWord: boolean; drawBoldTextInBrightColors: boolean; minimumContrastRatio: number; windowsMode: boolean; macOptionIsMeta: boolean; altClickMovesCursor: boolean; }",
411
+ "resolved": "{ termName: string; rendererType: string; allowTransparency: boolean; fontFamily: string; fontSize: number; letterSpacing: number; lineHeight: number; allowProposedApi: boolean; cursorBlink: boolean; cursorWidth: number; theme: { background: string; foreground: string; cursor: string; }; scrollback: number; fastScrollModifier: string; fastScrollSensitivity: number; bellStyle: string; convertEol: boolean; disableStdin: boolean; rightClickSelectsWord: boolean; drawBoldTextInBrightColors: boolean; minimumContrastRatio: number; windowsMode: boolean; macOptionIsMeta: boolean; altClickMovesCursor: boolean; }",
412
+ "references": {}
413
+ },
414
+ "required": false,
415
+ "optional": false,
416
+ "docs": {
417
+ "tags": [],
418
+ "text": ""
419
+ },
420
+ "getter": false,
421
+ "setter": false,
422
+ "defaultValue": "{\n // Terminal identification\n termName: 'xterm-256color',\n\n // Rendering\n rendererType: 'canvas', // Better performance\n allowTransparency: false,\n\n fontFamily:\n '\"Berkeley Mono\", \"Fira Code\", \"SFMono-Regular\", Menlo, monospace',\n fontSize: 12,\n // fontWeight: 'normal',\n // fontWeightBold: 'bold',\n letterSpacing: 0,\n lineHeight: 1.0,\n\n allowProposedApi: true, // needed for bracketed paste\n\n // Cursor\n cursorBlink: true,\n // cursorStyle: 'block',\n cursorWidth: 1,\n\n // Colors\n theme: {\n background: \"#0b1021\",\n foreground: \"#e2e8f0\",\n cursor: \"#67e8f9\",\n },\n\n // Scrolling\n scrollback: 10000,\n fastScrollModifier: 'shift',\n fastScrollSensitivity: 5,\n\n // Behavior\n bellStyle: 'sound', // or 'none' if you prefer\n convertEol: false, // true to treat \\n as \\r\\n\n disableStdin: false,\n\n // Selection\n rightClickSelectsWord: true,\n\n // Performance\n drawBoldTextInBrightColors: true,\n minimumContrastRatio: 1,\n\n // Advanced\n windowsMode: false, // Important for Linux\n macOptionIsMeta: false,\n altClickMovesCursor: true\n }"
423
+ },
424
+ "serverHost": {
425
+ "type": "string",
426
+ "mutable": false,
427
+ "complexType": {
428
+ "original": "string",
429
+ "resolved": "string",
430
+ "references": {}
431
+ },
432
+ "required": false,
433
+ "optional": false,
434
+ "docs": {
435
+ "tags": [],
436
+ "text": ""
437
+ },
438
+ "getter": false,
439
+ "setter": false,
440
+ "reflect": false,
441
+ "attribute": "server-host",
442
+ "defaultValue": "\"phirepass.io\""
443
+ },
444
+ "serverPort": {
445
+ "type": "number",
446
+ "mutable": false,
447
+ "complexType": {
448
+ "original": "number",
449
+ "resolved": "number",
450
+ "references": {}
451
+ },
452
+ "required": false,
453
+ "optional": false,
454
+ "docs": {
455
+ "tags": [],
456
+ "text": ""
457
+ },
458
+ "getter": false,
459
+ "setter": false,
460
+ "reflect": false,
461
+ "attribute": "server-port",
462
+ "defaultValue": "443"
463
+ },
464
+ "allowInsecure": {
465
+ "type": "boolean",
466
+ "mutable": false,
467
+ "complexType": {
468
+ "original": "boolean",
469
+ "resolved": "boolean",
470
+ "references": {}
471
+ },
472
+ "required": false,
473
+ "optional": false,
474
+ "docs": {
475
+ "tags": [],
476
+ "text": ""
477
+ },
478
+ "getter": false,
479
+ "setter": false,
480
+ "reflect": false,
481
+ "attribute": "allow-insecure",
482
+ "defaultValue": "false"
483
+ },
484
+ "heartbeatInterval": {
485
+ "type": "number",
486
+ "mutable": false,
487
+ "complexType": {
488
+ "original": "number",
489
+ "resolved": "number",
490
+ "references": {}
491
+ },
492
+ "required": false,
493
+ "optional": false,
494
+ "docs": {
495
+ "tags": [],
496
+ "text": ""
497
+ },
498
+ "getter": false,
499
+ "setter": false,
500
+ "reflect": false,
501
+ "attribute": "heartbeat-interval",
502
+ "defaultValue": "30_000"
503
+ },
504
+ "nodeId": {
505
+ "type": "string",
506
+ "mutable": false,
507
+ "complexType": {
508
+ "original": "string",
509
+ "resolved": "string",
510
+ "references": {}
511
+ },
512
+ "required": false,
513
+ "optional": true,
514
+ "docs": {
515
+ "tags": [],
516
+ "text": ""
517
+ },
518
+ "getter": false,
519
+ "setter": false,
520
+ "reflect": false,
521
+ "attribute": "node-id"
522
+ }
523
+ };
524
+ }
525
+ static get elementRef() { return "el"; }
526
+ static get watchers() {
527
+ return [{
528
+ "propName": "nodeId",
529
+ "methodName": "onNodeIdChange"
530
+ }];
531
+ }
532
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get the base path to where the assets can be found. Use "setAssetPath(path)"
3
+ * if the path needs to be customized.
4
+ */
5
+ export declare const getAssetPath: (path: string) => string;
6
+
7
+ /**
8
+ * Used to manually set the base path where assets can be found.
9
+ * If the script is used as "module", it's recommended to use "import.meta.url",
10
+ * such as "setAssetPath(import.meta.url)". Other options include
11
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
12
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
13
+ * But do note that this configuration depends on how your script is bundled, or lack of
14
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
15
+ * will have to ensure the static assets are copied to its build directory.
16
+ */
17
+ export declare const setAssetPath: (path: string) => void;
18
+
19
+ /**
20
+ * Used to specify a nonce value that corresponds with an application's CSP.
21
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
22
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
23
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
24
+ * will result in the same behavior.
25
+ */
26
+ export declare const setNonce: (nonce: string) => void
27
+
28
+ export interface SetPlatformOptions {
29
+ raf?: (c: FrameRequestCallback) => number;
30
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
31
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
32
+ }
33
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
34
+
35
+ export * from '../types';
@@ -0,0 +1 @@
1
+ var t,e=(t,e)=>{var n;Object.entries(null!=(n=e.l.t)?n:{}).map((([n,[l]])=>{if(31&l||32&l){const l=t[n],o=function(t,e){for(;t;){const n=Object.getOwnPropertyDescriptor(t,e);if(null==n?void 0:n.get)return n;t=Object.getPrototypeOf(t)}}(Object.getPrototypeOf(t),n)||Object.getOwnPropertyDescriptor(t,n);o&&Object.defineProperty(t,n,{get(){return o.get.call(this)},set(t){o.set.call(this,t)},configurable:!0,enumerable:!0}),t[n]=e.o.has(n)?e.o.get(n):l}}))},n=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>(0,console.error)(t,e),o=new Map,s="undefined"!=typeof window?window:{},i=s.HTMLElement||class{},r={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l),ce:(t,e)=>new CustomEvent(t,e)},c=(()=>{try{return!!s.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),u=!!c&&(()=>!!s.document&&Object.getOwnPropertyDescriptor(s.document.adoptedStyleSheets,"length").writable)(),f=!1,a=[],d=[],h=(t,e)=>n=>{t.push(n),f||(f=!0,e&&4&r.i?$(m):r.raf(m))},p=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},m=()=>{p(a),p(d),(f=a.length>0)&&r.raf(m)},$=t=>Promise.resolve(void 0).then(t),y=h(d,!0),b=t=>{const e=new URL(t,r.u);return e.origin!==s.location.origin?e.href:e.pathname},v=t=>r.u=t;function w(){const e=this.attachShadow({mode:"open"});void 0===t&&(t=null),t&&(u?e.adoptedStyleSheets.push(t):e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])}var j,g=new WeakMap,O=t=>"sc-"+t.h,S=t=>"object"==(t=typeof t)||"function"===t,k=(t,e,...n)=>{let l=null,o=null,s=!1,i=!1;const r=[],c=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!S(l))&&(l+=""),s&&i?r[r.length-1].p+=l:r.push(s?M(null,l):l),i=s)};c(n),e&&e.key&&(o=e.key);const u=M(t,null);return u.m=e,r.length>0&&(u.$=r),u.v=o,u},M=(t,e)=>({i:0,j:t,p:null!=e?e:null,O:null,$:null,m:null,v:null}),E={},A=(t,e)=>null==t||S(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,C=(t,e,n,l,o,s)=>{if(n===l)return;let i=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"key"===e);else{const r=S(l);if(i||r&&null!==l)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const o=null==l?"":l;"list"===e?i=!1:null!=n&&t[e]==o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&s||o)&&!r&&1===t.nodeType&&t.setAttribute(e,l=!0===l?"":l)}},N=(t,e,n)=>{const l=11===e.O.nodeType&&e.O.host?e.O.host:e.O,o=t&&t.m||{},s=e.m||{};for(const t of _(Object.keys(o)))t in s||C(l,t,o[t],void 0,n,e.i);for(const t of _(Object.keys(s)))C(l,t,o[t],s[t],n,e.i)};function _(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var x=!1,D=!1,P=(t,e,n)=>{const l=e.$[n];let o,i,r=0;if(!s.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(o=l.O=s.document.createElement(l.j),N(null,l,D),l.$){const e="template"===l.j?o.content:o;for(r=0;r<l.$.length;++r)i=P(t,l,r),i&&e.appendChild(i)}return o["s-hn"]=j,o},U=(t,e,n,l,o,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===j&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);o<=s;++o)l[o]&&(i=P(null,n,o),i&&(l[o].O=i,F(r,i,e)))},L=(t,e,n)=>{for(let l=e;l<=n;++l){const e=t[l];if(e){const t=e.O;t&&t.remove()}}},R=(t,e,n=!1)=>t.j===e.j&&(n?(n&&!t.v&&e.v&&(t.v=e.v),!0):t.v===e.v),W=(t,e,n=!1)=>{const l=e.O=t.O,o=t.$,s=e.$;"slot"!==e.j||x||t.S!==e.S&&(e.O["s-sn"]=e.S||"",(t=>{r.i|=1;const e=t.closest(j.toLowerCase());if(null!=e){const n=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),l=Array.from(t.__childNodes||t.childNodes);for(const t of n?l.reverse():l)null!=t["s-sh"]&&(F(e,t,null!=n?n:null),t["s-sh"]=void 0)}r.i&=-2})(e.O.parentElement)),N(t,e,D),null!==o&&null!==s?((t,e,n,l,o=!1)=>{let s,i,r=0,c=0,u=0,f=0,a=e.length-1,d=e[0],h=e[a],p=l.length-1,m=l[0],$=l[p];const y="template"===n.j?t.content:t;for(;r<=a&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--a];else if(null==m)m=l[++c];else if(null==$)$=l[--p];else if(R(d,m,o))W(d,m,o),d=e[++r],m=l[++c];else if(R(h,$,o))W(h,$,o),h=e[--a],$=l[--p];else if(R(d,$,o))W(d,$,o),F(y,d.O,h.O.nextSibling),d=e[++r],$=l[--p];else if(R(h,m,o))W(h,m,o),F(y,h.O,d.O),h=e[--a],m=l[++c];else{for(u=-1,f=r;f<=a;++f)if(e[f]&&null!==e[f].v&&e[f].v===m.v){u=f;break}u>=0?(i=e[u],i.j!==m.j?s=P(e&&e[c],n,u):(W(i,m,o),e[u]=void 0,s=i.O),m=l[++c]):(s=P(e&&e[c],n,c),m=l[++c]),s&&F(d.O.parentNode,s,d.O)}r>a?U(t,null==l[p+1]?null:l[p+1].O,n,l,c,p):c>p&&L(e,r,a)})(l,o,e,s,n):null!==s?U(l,null,e,s,0,s.length-1):!n&&null!==o&&L(o,0,o.length-1)},F=(t,e,n)=>t.__insertBefore?t.__insertBefore(e,n):null==t?void 0:t.insertBefore(e,n),H=(t,e,n=!1)=>{const l=t.$hostElement$,o=t.l,s=t.k||M(null,null),i=(t=>t&&t.j===E)(e)?e:k(null,null,e);if(j=l.tagName,n&&i.m)for(const t of Object.keys(i.m))l.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.m[t]=l[t]);i.j=null,i.i|=4,t.k=i,i.O=s.O=l.shadowRoot||l,x=!(!(1&o.i)||128&o.i),W(s,i,n)},q=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((l=>t.M=()=>{e["s-p"].splice(n-1,1),l()})))}},V=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);q(t,t.A);const n=()=>z(t,e);if(!e)return y(n);queueMicrotask((()=>{n()}))},z=(t,e)=>{const n=t.$hostElement$,l=n;if(!l)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let o;return o=Q(l,e?"componentWillLoad":"componentWillUpdate",void 0,n),o=Y(o,(()=>Q(l,"componentWillRender",void 0,n))),Y(o,(()=>G(t,l,e)))},Y=(t,e)=>B(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),B=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,G=async(t,e,n)=>{var l;const i=t.$hostElement$,f=i["s-rc"];n&&(t=>{const e=t.l,n=t.$hostElement$,l=e.i,i=((t,e)=>{var n,l,i;const f=O(e),a=o.get(f);if(!s.document)return f;if(t=11===t.nodeType?t:s.document,a)if("string"==typeof a){let o,i=g.get(t=t.head||t);if(i||g.set(t,i=new Set),!i.has(f)){o=s.document.createElement("style"),o.textContent=a;const d=null!=(n=r.C)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=s.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=d&&o.setAttribute("nonce",d),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(o,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(c){const e=new(null!=(l=t.defaultView)?l:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(a),u?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=a+e.textContent:t.prepend(o)}else t.append(o);1&e.i&&t.insertBefore(o,null),4&e.i&&(o.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),i&&i.add(f)}}else{let e=g.get(t);if(e||g.set(t,e=new Set),!e.has(f)){const n=null!=(i=t.defaultView)?i:t.ownerDocument.defaultView;let l;if(a.constructor===n.CSSStyleSheet)l=a;else{l=new n.CSSStyleSheet;for(let t=0;t<a.cssRules.length;t++)l.insertRule(a.cssRules[t].cssText,t)}u?t.adoptedStyleSheets.push(l):t.adoptedStyleSheets=[...t.adoptedStyleSheets,l],e.add(f)}}return f})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&l&&(n["s-sc"]=i,n.classList.add(i+"-h"))})(t);I(t,e,i,n),f&&(f.map((t=>t())),i["s-rc"]=void 0);{const e=null!=(l=i["s-p"])?l:[],n=()=>J(t);0===e.length?n():(Promise.all(e).then(n),t.i|=4,e.length=0)}},I=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,H(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},J=t=>{const e=t.$hostElement$,n=e,l=t.A;Q(n,"componentDidRender",void 0,e),64&t.i?Q(n,"componentDidUpdate",void 0,e):(t.i|=64,T(e),Q(n,"componentDidLoad",void 0,e),t.N(e),l||K()),t.M&&(t.M(),t.M=void 0),512&t.i&&$((()=>V(t,!1))),t.i&=-517},K=()=>{$((()=>(t=>{const e=r.ce("appload",{detail:{namespace:"phirepass-widgets"}});return t.dispatchEvent(e),e})(s)))},Q=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},T=t=>t.classList.add("hydrated"),X=(t,e,o,s)=>{const i=n(t);if(!i)return;const r=t,c=i.o.get(e),u=i.i,f=r;if(!((o=A(o,s.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(o))){if(i.o.set(e,o),s._){const t=s._[e];t&&t.map((t=>{try{const[[n,l]]=Object.entries(t);(128&u||1&l)&&(f?f[n](o,c,e):i.D.push((()=>{i.P[n](o,c,e)})))}catch(t){l(t,r)}}))}if(2==(18&u)){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(o,c,e))return;V(i,!1)}}},Z=(t,e)=>{var l,o;const s=t.prototype;{t.watchers&&!e._&&(e._=t.watchers),t.deserializers&&!e.U&&(e.U=t.deserializers),t.serializers&&!e.L&&(e.L=t.serializers);const i=Object.entries(null!=(l=e.t)?l:{});i.map((([t,[l]])=>{if(31&l||32&l){const{get:o,set:i}=Object.getOwnPropertyDescriptor(s,t)||{};o&&(e.t[t][0]|=2048),i&&(e.t[t][0]|=4096),Object.defineProperty(s,t,{get(){return o?o.apply(this):((t,e)=>n(this).o.get(e))(0,t)},configurable:!0,enumerable:!0}),Object.defineProperty(s,t,{set(o){const s=n(this);if(s){if(i)return void 0===(32&l?this[t]:s.$hostElement$[t])&&s.o.get(t)&&(o=s.o.get(t)),i.call(this,A(o,l)),void X(this,t,o=32&l?this[t]:s.$hostElement$[t],e);X(this,t,o,e)}}})}}));{const l=new Map;s.attributeChangedCallback=function(t,o,c){r.jmp((()=>{var r;const u=l.get(t),f=n(this);if(this.hasOwnProperty(u),s.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==c)return;if(null==u){const n=null==f?void 0:f.i;if(f&&n&&!(8&n)&&c!==o){const l=this,s=null==(r=e._)?void 0:r[t];null==s||s.forEach((e=>{const[[s,i]]=Object.entries(e);null!=l[s]&&(128&n||1&i)&&l[s].call(l,c,o,t)}))}return}const a=i.find((([t])=>t===u));a&&4&a[1][0]&&(c=null!==c&&"false"!==c);const d=Object.getOwnPropertyDescriptor(s,u);c==this[u]||d.get&&!d.set||(this[u]=c)}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(o=e._)?o:{}),...i.filter((([t,e])=>31&e[0])).map((([t,e])=>{const n=e[1]||t;return l.set(n,t),n}))]))}}return t},tt=(t,l)=>{const s={i:l[0],h:l[1]};s.t=l[2],s._=t._,s.U=t.U,s.L=t.L;const i=t.prototype.connectedCallback,u=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,n)=>{const l={i:0,$hostElement$:t,l:n,o:new Map,R:new Map};l.W=new Promise((t=>l.N=t)),t["s-p"]=[],t["s-rc"]=[];const o=l;t.__stencil__getHostRef=()=>o,512&n.i&&e(t,l)})(this,s)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!n(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&r.i)){const e=n(t);if(!e)return;const l=e.l,s=()=>{};if(1&e.i)(null==e?void 0:e.P)||(null==e?void 0:e.W)&&e.W.then((()=>{}));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){q(e,e.A=n);break}}l.t&&Object.entries(l.t).map((([e,[n]])=>{if(31&n&&e in t&&t[e]!==Object.prototype[e]){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let l;if(!(32&e.i)&&(e.i|=32,l=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),l&&l.style)){let t;"string"==typeof l.style&&(t=l.style);const e=O(n);if(!o.has(e)){const l=()=>{};((t,e,n)=>{let l=o.get(t);c&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=e:l.replaceSync(e)):l=e,o.set(t,l)})(e,t,!!(1&n.i)),l()}}const s=e.A,i=()=>V(e,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(t,e,l)}s()}})(this),i&&i.call(this)},disconnectedCallback(){(async t=>{g.has(t)&&g.delete(t),t.shadowRoot&&g.has(t.shadowRoot)&&g.delete(t.shadowRoot)})(this),u&&u.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${s.h}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else w.call(this,s)}}),t.is=s.h,Z(t,s)},et=t=>r.C=t,nt=t=>Object.assign(r,t);function lt(t,e){H({l:{i:0,h:e.tagName},$hostElement$:e},t)}function ot(t){return t}export{i as H,E as a,b as getAssetPath,k as h,tt as p,lt as render,v as setAssetPath,et as setNonce,nt as setPlatformOptions,ot as t}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PhirepassSftpClient extends Components.PhirepassSftpClient, HTMLElement {}
4
+ export const PhirepassSftpClient: {
5
+ prototype: PhirepassSftpClient;
6
+ new (): PhirepassSftpClient;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{t as e,p as s,H as t,h as c,a as n}from"./index.js";const o=s(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}render(){return c(n,{key:"d03ff09e3636f79d699c7462e121abe7d08c6683"},c("slot",{key:"bd7285e70384558e4cbf0600b89a57fa4ec3406d"}))}static get style(){return":host{display:block}"}},[257,"phirepass-sftp-client"]);function p(){"undefined"!=typeof customElements&&["phirepass-sftp-client"].forEach((s=>{"phirepass-sftp-client"===s&&(customElements.get(e(s))||customElements.define(e(s),o))}))}p();const r=o,i=p;export{r as PhirepassSftpClient,i as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PhirepassTerminal extends Components.PhirepassTerminal, HTMLElement {}
4
+ export const PhirepassTerminal: {
5
+ prototype: PhirepassTerminal;
6
+ new (): PhirepassTerminal;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;