@bonsae/nrg 0.25.1 → 0.26.0

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/package.json +6 -4
  2. package/server/index.cjs +1413 -2
  3. package/server/resources/nrg-client.js +10 -0
  4. package/test/client/component/config.js +9 -9
  5. package/test/client/component/index.js +230 -42
  6. package/test/client/component/nrg.css +1 -0
  7. package/test/client/component/schemas.js +37 -0
  8. package/test/client/component/setup.js +1473 -198
  9. package/test/client/e2e/index.js +33 -35
  10. package/test/client/unit/index.js +17 -2
  11. package/test/server/integration/index.js +1222 -11
  12. package/test/server/unit/index.js +184 -2
  13. package/types/client.d.ts +1 -1
  14. package/types/server.d.ts +8 -2
  15. package/types/shims/components.d.ts +8 -8
  16. package/types/shims/{client → core/client}/types.d.ts +2 -2
  17. package/types/shims/core/schema-options.d.ts +24 -0
  18. package/types/shims/schema-options.d.ts +17 -17
  19. package/types/test-client-component-schemas.d.ts +73 -0
  20. package/types/test-client-component.d.ts +153 -7
  21. package/types/test-client-unit.d.ts +105 -4
  22. package/types/test-server-integration.d.ts +64 -63
  23. package/types/test-server-unit.d.ts +2 -1
  24. package/vite/index.js +33 -35
  25. /package/types/shims/{client → core/client}/form/components/node-red-config-input.vue.d.ts +0 -0
  26. /package/types/shims/{client → core/client}/form/components/node-red-editor-input.vue.d.ts +0 -0
  27. /package/types/shims/{client → core/client}/form/components/node-red-input-label.vue.d.ts +0 -0
  28. /package/types/shims/{client → core/client}/form/components/node-red-input.vue.d.ts +0 -0
  29. /package/types/shims/{client → core/client}/form/components/node-red-json-schema-form.vue.d.ts +0 -0
  30. /package/types/shims/{client → core/client}/form/components/node-red-select-input.vue.d.ts +0 -0
  31. /package/types/shims/{client → core/client}/form/components/node-red-toggle.vue.d.ts +0 -0
  32. /package/types/shims/{client → core/client}/form/components/node-red-typed-input.vue.d.ts +0 -0
  33. /package/types/shims/{constants.d.ts → core/constants.d.ts} +0 -0
  34. /package/types/shims/{brands.d.ts → core/types.d.ts} +0 -0
@@ -1,63 +1,1338 @@
1
- import { config as h } from "vitest-browser-vue";
2
- import { NodeRedJsonSchemaForm as E, NodeRedEditorInput as S, NodeRedSelectInput as I, NodeRedConfigInput as v, NodeRedTypedInput as T, NodeRedInput as k, NodeRedToggle as w, NodeRedInputLabel as M } from "@bonsae/nrg-runtime/internal/client/components";
3
- import { beforeEach as L } from "vitest";
4
- function m() {
5
- const t = {
6
- get(r) {
7
- return t[r];
8
- },
9
- set(r, s) {
10
- return t[r] = s, s;
11
- },
12
- remove(r) {
13
- const s = t[r];
14
- return delete t[r], s;
1
+ import { config as D } from "vitest-browser-vue";
2
+ import { defineComponent as V, openBlock as l, createElementBlock as c, normalizeClass as N, createCommentVNode as f, renderSlot as k, createTextVNode as W, toDisplayString as E, resolveComponent as g, createBlock as v, createElementVNode as m, shallowRef as q, withDirectives as H, vShow as J, Teleport as K, Fragment as _, renderList as L, createVNode as R } from "vue";
3
+ import { beforeEach as Q } from "vitest";
4
+ const Y = V({
5
+ name: "NodeRedInputLabel",
6
+ props: {
7
+ label: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ icon: {
12
+ type: String,
13
+ default: ""
14
+ },
15
+ required: {
16
+ type: Boolean,
17
+ default: !1
18
+ }
19
+ },
20
+ computed: {
21
+ iconClass() {
22
+ return this.icon ? `fa ${this.icon.startsWith("fa-") ? this.icon : `fa-${this.icon}`}` : "";
23
+ }
24
+ }
25
+ }), T = (e, t) => {
26
+ const n = e.__vccOpts || e;
27
+ for (const [r, s] of t)
28
+ n[r] = s;
29
+ return n;
30
+ }, Z = { class: "nrg-label" }, G = {
31
+ key: 1,
32
+ class: "nrg-required"
33
+ };
34
+ function X(e, t, n, r, s, d) {
35
+ return l(), c("span", Z, [
36
+ e.icon ? (l(), c(
37
+ "i",
38
+ {
39
+ key: 0,
40
+ class: N(e.iconClass)
41
+ },
42
+ null,
43
+ 2
44
+ /* CLASS */
45
+ )) : f("v-if", !0),
46
+ k(e.$slots, "default", {}, () => [
47
+ W(
48
+ E(e.label),
49
+ 1
50
+ /* TEXT */
51
+ )
52
+ ], !0),
53
+ e.required ? (l(), c("span", G, "*")) : f("v-if", !0)
54
+ ]);
55
+ }
56
+ const w = /* @__PURE__ */ T(Y, [["render", X], ["__scopeId", "data-v-864b02f2"]]), j = "*************", x = V({
57
+ components: { NodeRedInputLabel: w },
58
+ props: {
59
+ modelValue: {
60
+ type: [String, Number],
61
+ default: void 0
62
+ },
63
+ value: {
64
+ type: [String, Number],
65
+ default: ""
66
+ },
67
+ type: {
68
+ type: String,
69
+ default: "text"
70
+ },
71
+ placeholder: {
72
+ type: String,
73
+ default: ""
74
+ },
75
+ label: {
76
+ type: String,
77
+ default: ""
78
+ },
79
+ icon: {
80
+ type: String,
81
+ default: ""
82
+ },
83
+ required: {
84
+ type: Boolean,
85
+ default: !1
86
+ },
87
+ error: {
88
+ type: String,
89
+ default: ""
90
+ }
91
+ },
92
+ emits: ["update:modelValue", "update:value", "input"],
93
+ data() {
94
+ return {
95
+ internalValue: ""
96
+ };
97
+ },
98
+ computed: {
99
+ effectiveValue() {
100
+ return this.modelValue !== void 0 ? this.modelValue : this.value;
101
+ }
102
+ },
103
+ beforeMount() {
104
+ this.internalValue = this.effectiveValue, this.onBlur();
105
+ },
106
+ methods: {
107
+ onInput(e) {
108
+ this.internalValue = e.target.value, this.$emit("update:modelValue", this.internalValue), this.$emit("update:value", this.internalValue), this.$emit("input", this.internalValue);
109
+ },
110
+ onFocus() {
111
+ this.type === "password" && this.internalValue === j && (this.internalValue = "");
112
+ },
113
+ onBlur() {
114
+ this.type === "password" && this.effectiveValue === "__PWD__" && (this.internalValue = j);
115
+ }
116
+ }
117
+ }), ee = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, te = ["type", "value", "placeholder"], ne = {
118
+ key: 0,
119
+ class: "node-red-vue-input-error-message"
120
+ };
121
+ function re(e, t, n, r, s, d) {
122
+ const a = g("NodeRedInputLabel");
123
+ return l(), c("div", ee, [
124
+ k(e.$slots, "label", {}, () => [
125
+ e.label ? (l(), v(a, {
126
+ key: 0,
127
+ label: e.label,
128
+ icon: e.icon,
129
+ required: e.required
130
+ }, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
131
+ ]),
132
+ m("input", {
133
+ ref: "inputField",
134
+ type: e.type,
135
+ value: e.internalValue,
136
+ placeholder: e.placeholder,
137
+ style: { width: "100%" },
138
+ onInput: t[0] || (t[0] = (...h) => e.onInput && e.onInput(...h)),
139
+ onFocus: t[1] || (t[1] = (...h) => e.onFocus && e.onFocus(...h)),
140
+ onBlur: t[2] || (t[2] = (...h) => e.onBlur && e.onBlur(...h))
141
+ }, null, 40, te),
142
+ e.error ? (l(), c(
143
+ "div",
144
+ ne,
145
+ E(e.error),
146
+ 1
147
+ /* TEXT */
148
+ )) : f("v-if", !0)
149
+ ]);
150
+ }
151
+ const B = /* @__PURE__ */ T(x, [["render", re]]), oe = [
152
+ "msg",
153
+ "flow",
154
+ "global",
155
+ "str",
156
+ "num",
157
+ "bool",
158
+ "json",
159
+ "bin",
160
+ "re",
161
+ "jsonata",
162
+ "date",
163
+ "env",
164
+ "node",
165
+ "cred"
166
+ ], ie = ["errorPort", "completePort", "statusPort"], se = V({
167
+ components: { NodeRedInputLabel: w },
168
+ props: {
169
+ modelValue: {
170
+ type: Object,
171
+ default: void 0,
172
+ validator: function(e) {
173
+ if (e === void 0) return !0;
174
+ if (typeof e != "object" || e === null)
175
+ return console.warn(
176
+ "[WARN] Invalid modelValue for TypedInput. It must be an object."
177
+ ), !1;
178
+ const t = typeof e.value == "string" && typeof e.type == "string";
179
+ return t || console.warn(
180
+ "[WARN] Invalid modelValue for TypedInput. It must be an object with 'value' and 'type' properties being strings.",
181
+ e
182
+ ), t;
183
+ }
184
+ },
185
+ value: {
186
+ type: Object,
187
+ default: void 0,
188
+ validator: function(e) {
189
+ if (e === void 0) return !0;
190
+ if (typeof e != "object" || e === null)
191
+ return console.warn(
192
+ "[WARN] Invalid value for TypedInput. It must be an object."
193
+ ), !1;
194
+ const t = typeof e.value == "string" && typeof e.type == "string";
195
+ return t || console.warn(
196
+ "[WARN] Invalid value for TypedInput. It must be an object with 'value' and 'type' properties being strings.",
197
+ e
198
+ ), t;
199
+ }
200
+ },
201
+ types: {
202
+ type: Array,
203
+ default: () => oe
204
+ },
205
+ label: {
206
+ type: String,
207
+ default: ""
208
+ },
209
+ icon: {
210
+ type: String,
211
+ default: ""
212
+ },
213
+ required: {
214
+ type: Boolean,
215
+ default: !1
216
+ },
217
+ error: {
218
+ type: String,
219
+ default: ""
220
+ }
221
+ },
222
+ emits: ["update:modelValue", "update:value"],
223
+ setup() {
224
+ return {
225
+ inputWidget: q(null),
226
+ mutationObserver: q(null)
227
+ };
228
+ },
229
+ computed: {
230
+ effectiveValue() {
231
+ return this.modelValue !== void 0 ? this.modelValue : this.value;
232
+ },
233
+ isProvidedValueTypeValid() {
234
+ const e = this.effectiveValue.type;
235
+ return this.types.includes(e);
236
+ }
237
+ },
238
+ watch: {
239
+ isProvidedValueTypeValid: {
240
+ handler(e) {
241
+ e || console.warn(
242
+ `Validation failed: type (${this.effectiveValue.type}) must be one of the provided types (${this.types}).`
243
+ );
244
+ },
245
+ immediate: !0
246
+ },
247
+ error(e) {
248
+ this.$nextTick(() => {
249
+ const t = this.$el.querySelector(
250
+ ".red-ui-typedInput-container"
251
+ );
252
+ t && (e ? t.classList.add("input-error") : t.classList.remove("input-error"));
253
+ });
254
+ }
255
+ },
256
+ mounted() {
257
+ const e = this.$refs.typedInput;
258
+ this.inputWidget = $(e), this.inputWidget.typedInput({
259
+ default: this.effectiveValue.type || this.types[0],
260
+ types: this.types
261
+ }), this.inputWidget.typedInput("value", this.effectiveValue.value || ""), this.inputWidget.typedInput(
262
+ "type",
263
+ this.effectiveValue.type || this.types[0]
264
+ ), this.$nextTick(() => {
265
+ const t = new MutationObserver((n) => {
266
+ for (const r of n)
267
+ r.attributeName === "value" && this.onChange();
268
+ });
269
+ t.observe(e, {
270
+ attributes: !0,
271
+ attributeFilter: ["value"]
272
+ }), this.mutationObserver = t;
273
+ }), this.inputWidget.on("change", () => {
274
+ this.onChange();
275
+ });
276
+ },
277
+ beforeUnmount() {
278
+ this.mutationObserver && (this.mutationObserver.disconnect(), this.mutationObserver = null);
279
+ },
280
+ methods: {
281
+ onChange() {
282
+ const e = this.inputWidget.typedInput("value"), t = this.inputWidget.typedInput("type");
283
+ if (this.effectiveValue.value !== e || this.effectiveValue.type !== t) {
284
+ const n = { value: e, type: t };
285
+ this.$emit("update:modelValue", n), this.$emit("update:value", n);
286
+ }
287
+ }
288
+ }
289
+ }), ae = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, le = {
290
+ ref: "typedInput",
291
+ type: "text",
292
+ class: "node-red-typed-input",
293
+ style: { flex: "1", width: "100%" }
294
+ }, ue = {
295
+ key: 0,
296
+ class: "node-red-vue-input-error-message"
297
+ };
298
+ function de(e, t, n, r, s, d) {
299
+ const a = g("NodeRedInputLabel");
300
+ return l(), c("div", ae, [
301
+ k(e.$slots, "label", {}, () => [
302
+ e.label ? (l(), v(a, {
303
+ key: 0,
304
+ label: e.label,
305
+ icon: e.icon,
306
+ required: e.required
307
+ }, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
308
+ ]),
309
+ m(
310
+ "input",
311
+ le,
312
+ null,
313
+ 512
314
+ /* NEED_PATCH */
315
+ ),
316
+ e.error ? (l(), c(
317
+ "div",
318
+ ue,
319
+ E(e.error),
320
+ 1
321
+ /* TEXT */
322
+ )) : f("v-if", !0)
323
+ ]);
324
+ }
325
+ const U = /* @__PURE__ */ T(se, [["render", de]]), pe = V({
326
+ components: { NodeRedInputLabel: w },
327
+ props: {
328
+ modelValue: {
329
+ type: String,
330
+ default: void 0
331
+ },
332
+ value: {
333
+ type: String,
334
+ default: ""
335
+ },
336
+ type: {
337
+ type: String,
338
+ required: !0
339
+ },
340
+ node: {
341
+ type: Object,
342
+ required: !0
343
+ },
344
+ propName: {
345
+ type: String,
346
+ required: !0
347
+ },
348
+ label: {
349
+ type: String,
350
+ default: ""
351
+ },
352
+ icon: {
353
+ type: String,
354
+ default: ""
355
+ },
356
+ required: {
357
+ type: Boolean,
358
+ default: !1
359
+ },
360
+ error: {
361
+ type: String,
362
+ default: ""
363
+ }
364
+ },
365
+ emits: ["update:modelValue", "update:value"],
366
+ setup() {
367
+ return {
368
+ jqInput: q(null)
369
+ };
370
+ },
371
+ computed: {
372
+ inputId() {
373
+ return "node-input-" + this.propName;
374
+ },
375
+ effectiveValue() {
376
+ return this.modelValue !== void 0 ? this.modelValue : this.value;
377
+ }
378
+ },
379
+ mounted() {
380
+ RED.editor.prepareConfigNodeSelect(
381
+ this.node,
382
+ this.propName,
383
+ this.type,
384
+ "node-input"
385
+ );
386
+ const e = $("#" + this.inputId);
387
+ this.jqInput = e, e.on("change", () => {
388
+ const t = e.val(), n = t === "_ADD_" ? "" : t;
389
+ this.$emit("update:modelValue", n), this.$emit("update:value", n);
390
+ }), e.val(this.effectiveValue || "_ADD_");
391
+ },
392
+ beforeUnmount() {
393
+ this.jqInput && (this.jqInput.off("change"), this.jqInput = null);
394
+ }
395
+ }), ce = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, ye = ["id"], fe = {
396
+ key: 0,
397
+ class: "node-red-vue-input-error-message"
398
+ };
399
+ function me(e, t, n, r, s, d) {
400
+ const a = g("NodeRedInputLabel");
401
+ return l(), c("div", ce, [
402
+ k(e.$slots, "label", {}, () => [
403
+ e.label ? (l(), v(a, {
404
+ key: 0,
405
+ label: e.label,
406
+ icon: e.icon,
407
+ required: e.required
408
+ }, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
409
+ ]),
410
+ m("input", {
411
+ id: e.inputId,
412
+ type: "text",
413
+ style: { width: "100%" }
414
+ }, null, 8, ye),
415
+ e.error ? (l(), c(
416
+ "div",
417
+ fe,
418
+ E(e.error),
419
+ 1
420
+ /* TEXT */
421
+ )) : f("v-if", !0)
422
+ ]);
423
+ }
424
+ const M = /* @__PURE__ */ T(pe, [["render", me]]), he = V({
425
+ components: { NodeRedInputLabel: w },
426
+ props: {
427
+ modelValue: {
428
+ type: [String, Array],
429
+ default: void 0
430
+ },
431
+ value: {
432
+ type: [String, Array],
433
+ default: () => ""
434
+ },
435
+ options: {
436
+ type: Array,
437
+ required: !0,
438
+ validator: function(e) {
439
+ if (!Array.isArray(e))
440
+ return console.warn(
441
+ "[WARN] Invalid value for 'options' property. It must be an array."
442
+ ), !1;
443
+ const t = e.every(
444
+ (n) => typeof n == "object" && n !== null && typeof n.value == "string" && typeof n.label == "string" && Object.prototype.hasOwnProperty.call(n, "value") && Object.prototype.hasOwnProperty.call(n, "label")
445
+ );
446
+ return t || console.warn(
447
+ "[WARN] Invalid value for 'options' property. Each item must be an object with 'value' and 'label' properties being strings.",
448
+ e
449
+ ), t;
450
+ }
451
+ },
452
+ multiple: {
453
+ type: Boolean,
454
+ default: !1
455
+ },
456
+ label: {
457
+ type: String,
458
+ default: ""
459
+ },
460
+ icon: {
461
+ type: String,
462
+ default: ""
463
+ },
464
+ required: {
465
+ type: Boolean,
466
+ default: !1
467
+ },
468
+ error: {
469
+ type: String,
470
+ default: ""
471
+ }
472
+ },
473
+ emits: ["update:modelValue", "update:value"],
474
+ setup() {
475
+ return {
476
+ selectWidget: q(null)
477
+ };
478
+ },
479
+ computed: {
480
+ effectiveValue() {
481
+ return this.modelValue !== void 0 ? this.modelValue : this.value;
482
+ }
483
+ },
484
+ mounted() {
485
+ const e = this.$refs.selectInput, t = $(e);
486
+ this.selectWidget = t, t.typedInput({
487
+ types: [
488
+ {
489
+ multiple: this.multiple,
490
+ options: this.options
491
+ }
492
+ ]
493
+ }), t.typedInput(
494
+ "value",
495
+ Array.isArray(this.effectiveValue) ? this.effectiveValue.join(",") : this.effectiveValue
496
+ ), t.on("change", () => {
497
+ var r;
498
+ const n = this.multiple ? ((r = t.typedInput("value")) == null ? void 0 : r.split(",").filter(Boolean)) ?? [] : t.typedInput("value");
499
+ this.$emit("update:modelValue", n), this.$emit("update:value", n);
500
+ });
501
+ },
502
+ beforeUnmount() {
503
+ this.selectWidget && (this.selectWidget.off("change"), this.selectWidget = null);
504
+ }
505
+ }), ge = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, ve = {
506
+ ref: "selectInput",
507
+ type: "text",
508
+ class: "node-input-select",
509
+ style: { width: "100%" }
510
+ }, be = {
511
+ key: 0,
512
+ class: "node-red-vue-input-error-message"
513
+ };
514
+ function $e(e, t, n, r, s, d) {
515
+ const a = g("NodeRedInputLabel");
516
+ return l(), c("div", ge, [
517
+ k(e.$slots, "label", {}, () => [
518
+ e.label ? (l(), v(a, {
519
+ key: 0,
520
+ label: e.label,
521
+ icon: e.icon,
522
+ required: e.required
523
+ }, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
524
+ ]),
525
+ m(
526
+ "input",
527
+ ve,
528
+ null,
529
+ 512
530
+ /* NEED_PATCH */
531
+ ),
532
+ e.error ? (l(), c(
533
+ "div",
534
+ be,
535
+ E(e.error),
536
+ 1
537
+ /* TEXT */
538
+ )) : f("v-if", !0)
539
+ ]);
540
+ }
541
+ const F = /* @__PURE__ */ T(he, [["render", $e]]), Ie = V({
542
+ components: { NodeRedInputLabel: w },
543
+ props: {
544
+ modelValue: {
545
+ type: String,
546
+ default: void 0
547
+ },
548
+ value: {
549
+ type: String,
550
+ default: ""
551
+ },
552
+ language: {
553
+ type: String,
554
+ default: "json",
555
+ validator: function(e) {
556
+ const t = [
557
+ "abap",
558
+ "apex",
559
+ "azcli",
560
+ "bat",
561
+ "bicep",
562
+ "cameligo",
563
+ "clojure",
564
+ "coffee",
565
+ "cpp",
566
+ "csharp",
567
+ "csp",
568
+ "css",
569
+ "cypher",
570
+ "dart",
571
+ "dockerfile",
572
+ "ecl",
573
+ "elixir",
574
+ "flow9",
575
+ "freemarker2",
576
+ "fsharp",
577
+ "go",
578
+ "graphql",
579
+ "handlebars",
580
+ "hcl",
581
+ "html",
582
+ "ini",
583
+ "java",
584
+ "javascript",
585
+ "json",
586
+ "julia",
587
+ "kotlin",
588
+ "less",
589
+ "lexon",
590
+ "liquid",
591
+ "lua",
592
+ "m3",
593
+ "markdown",
594
+ "mdx",
595
+ "mips",
596
+ "msdax",
597
+ "mysql",
598
+ "objective-c",
599
+ "pascal",
600
+ "pascaligo",
601
+ "perl",
602
+ "pgsql",
603
+ "php",
604
+ "pla",
605
+ "postiats",
606
+ "powerquery",
607
+ "powershell",
608
+ "protobuf",
609
+ "pub",
610
+ "python",
611
+ "qsharp",
612
+ "r",
613
+ "razor",
614
+ "redis",
615
+ "redshift",
616
+ "restructuredtext",
617
+ "ruby",
618
+ "rust",
619
+ "sb",
620
+ "scala",
621
+ "scheme",
622
+ "scss",
623
+ "shell",
624
+ "solidity",
625
+ "sophia",
626
+ "sparql",
627
+ "sql",
628
+ "st",
629
+ "swift",
630
+ "systemverilog",
631
+ "tcl",
632
+ "twig",
633
+ "typescript",
634
+ "typespec",
635
+ "vb",
636
+ "wgsl",
637
+ "xml",
638
+ "yaml"
639
+ ], n = t.includes(e);
640
+ return n || console.warn(
641
+ `[WARN]: Invalid value for 'type' property: "${e}". Expected one of: ${t.join(", ")}`
642
+ ), n;
643
+ }
644
+ },
645
+ label: {
646
+ type: String,
647
+ default: ""
648
+ },
649
+ icon: {
650
+ type: String,
651
+ default: ""
652
+ },
653
+ required: {
654
+ type: Boolean,
655
+ default: !1
656
+ },
657
+ error: {
658
+ type: String,
659
+ default: ""
660
+ }
661
+ },
662
+ emits: [
663
+ "update:modelValue",
664
+ "update:value",
665
+ "editor-ready",
666
+ "tray-open",
667
+ "tray-close"
668
+ ],
669
+ setup() {
670
+ return {
671
+ // NOTE: must not be named "editor" — the template's ref="editor" would
672
+ // overwrite this with the DOM element on every re-render.
673
+ editorInstance: q(null),
674
+ expandedEditorTray: q(null)
675
+ };
676
+ },
677
+ data() {
678
+ const e = Math.random().toString(36).substring(2, 9);
679
+ return {
680
+ editorId: "node-red-editor-" + e,
681
+ stateId: e,
682
+ trayElement: null
683
+ };
684
+ },
685
+ computed: {
686
+ effectiveValue() {
687
+ return this.modelValue !== void 0 ? this.modelValue : this.value;
688
+ }
689
+ },
690
+ mounted() {
691
+ const e = $(this.$refs["expand-button"]);
692
+ RED.popover.tooltip(e, RED._("node-red:common.label.expand")), this.mountEditor(), this.createExpandeEditorTray();
693
+ },
694
+ beforeUnmount() {
695
+ if (this.editorInstance) {
696
+ try {
697
+ this.editorInstance.destroy();
698
+ } catch (e) {
699
+ console.error(`Error destroying editor for ID ${this.editorId}:`, e);
700
+ }
701
+ this.editorInstance = null;
702
+ }
703
+ },
704
+ methods: {
705
+ mountEditor() {
706
+ this.$nextTick(() => {
707
+ const e = this.$refs.container, t = this.$refs.editor;
708
+ if (e && t)
709
+ try {
710
+ const n = e.style.height, r = e.style.width;
711
+ n ? t.style.height = n : t.style.height = "200px", r ? t.style.width = r : t.style.width = "100%", this.createEditorInstance();
712
+ } catch (n) {
713
+ console.error(
714
+ "[NodeRedEditorInput] Error setting initial editor style:",
715
+ n
716
+ ), this.createEditorInstance();
717
+ }
718
+ else
719
+ console.error(
720
+ "[NodeRedEditorInput] Container or Editor div refs not found on mount."
721
+ );
722
+ });
723
+ },
724
+ createEditorInstance() {
725
+ this.editorInstance = RED.editor.createEditor({
726
+ id: this.editorId,
727
+ mode: this.language,
728
+ value: this.effectiveValue
729
+ }), this.editorInstance.getSession().on("change", () => {
730
+ const e = this.editorInstance.getValue();
731
+ e !== this.effectiveValue && (this.$emit("update:modelValue", e), this.$emit("update:value", e));
732
+ }), this.$emit("editor-ready", this.editorInstance);
733
+ },
734
+ createExpandeEditorTray() {
735
+ let e;
736
+ const t = () => {
737
+ setTimeout(() => {
738
+ var r;
739
+ (r = this.editorInstance) == null || r.focus();
740
+ }, 250), RED.tray.close();
741
+ }, n = () => {
742
+ var r;
743
+ e.saveView(), (r = this.editorInstance) == null || r.setValue(e.getValue(), -1), setTimeout(() => {
744
+ var s, d;
745
+ (s = this.editorInstance) == null || s.restoreView(), (d = this.editorInstance) == null || d.focus();
746
+ }, 250), RED.tray.close();
747
+ };
748
+ this.expandedEditorTray = {
749
+ title: "Editor",
750
+ focusElement: !0,
751
+ width: "Infinity",
752
+ buttons: [
753
+ {
754
+ id: "node-dialog-cancel",
755
+ text: RED._("common.label.cancel"),
756
+ click: t
757
+ },
758
+ {
759
+ id: "node-dialog-ok",
760
+ text: RED._("common.label.done"),
761
+ class: "primary",
762
+ click: n
763
+ }
764
+ ],
765
+ open: (r) => {
766
+ const s = $(
767
+ '<form id="dialog-form" class="form-horizontal" autocomplete="off"></form>'
768
+ ).appendTo(r.find(".red-ui-tray-body"));
769
+ s.html(
770
+ '<div id="expanded-editor-input" style="height: 100%"></div>'
771
+ ), e = RED.editor.createEditor({
772
+ id: "expanded-editor-input",
773
+ stateId: this.stateId,
774
+ mode: this.language,
775
+ focus: !0,
776
+ value: this.effectiveValue
777
+ }), s.i18n();
778
+ const d = r.find(".red-ui-tray-body")[0], a = document.createElement("div");
779
+ a.className = "red-ui-tray-footer", d.insertAdjacentElement("afterend", a), this.trayElement = a, this.$emit("tray-open", this.trayElement);
780
+ },
781
+ close: () => {
782
+ this.$emit("tray-close"), this.trayElement && (this.trayElement.remove(), this.trayElement = null), e.destroy();
783
+ }
784
+ };
785
+ },
786
+ onClickExpand() {
787
+ RED.tray.show(this.expandedEditorTray);
788
+ }
789
+ }
790
+ }), Ve = {
791
+ ref: "container",
792
+ class: "container"
793
+ }, Ee = { class: "editor-wrapper" }, Te = ["id"];
794
+ function ke(e, t, n, r, s, d) {
795
+ const a = g("NodeRedInputLabel");
796
+ return l(), c(
797
+ "div",
798
+ Ve,
799
+ [
800
+ k(e.$slots, "label", {}, () => [
801
+ e.label ? (l(), v(a, {
802
+ key: 0,
803
+ label: e.label,
804
+ icon: e.icon,
805
+ required: e.required
806
+ }, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
807
+ ], !0),
808
+ m("div", Ee, [
809
+ m(
810
+ "button",
811
+ {
812
+ ref: "expand-button",
813
+ class: "red-ui-button red-ui-button-small expand-button",
814
+ onClick: t[0] || (t[0] = (...h) => e.onClickExpand && e.onClickExpand(...h))
815
+ },
816
+ [...t[1] || (t[1] = [
817
+ m(
818
+ "i",
819
+ { class: "fa fa-expand" },
820
+ null,
821
+ -1
822
+ /* CACHED */
823
+ )
824
+ ])],
825
+ 512
826
+ /* NEED_PATCH */
827
+ ),
828
+ m("div", {
829
+ id: e.editorId,
830
+ ref: "editor"
831
+ }, null, 8, Te)
832
+ ]),
833
+ H(m(
834
+ "div",
835
+ { class: "node-red-vue-input-error-message" },
836
+ E(e.error),
837
+ 513
838
+ /* TEXT, NEED_PATCH */
839
+ ), [
840
+ [J, e.error]
841
+ ]),
842
+ e.trayElement ? (l(), v(K, {
843
+ key: 0,
844
+ to: e.trayElement
845
+ }, [
846
+ k(e.$slots, "tray-footer", {}, void 0, !0)
847
+ ], 8, ["to"])) : f("v-if", !0)
848
+ ],
849
+ 512
850
+ /* NEED_PATCH */
851
+ );
852
+ }
853
+ const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"]]), we = V({
854
+ name: "NodeRedToggle",
855
+ props: {
856
+ modelValue: {
857
+ type: Boolean,
858
+ default: !1
859
+ },
860
+ label: {
861
+ type: String,
862
+ default: ""
863
+ },
864
+ icon: {
865
+ type: String,
866
+ default: ""
867
+ }
868
+ },
869
+ emits: ["update:modelValue"],
870
+ computed: {
871
+ iconClass() {
872
+ return this.icon ? `fa ${this.icon.startsWith("fa-") ? this.icon : `fa-${this.icon}`}` : "";
873
+ }
874
+ }
875
+ }), Se = { class: "nrg-toggle-wrapper" }, qe = ["checked"], Re = {
876
+ key: 0,
877
+ class: "nrg-toggle__label"
878
+ };
879
+ function Ne(e, t, n, r, s, d) {
880
+ return l(), c("div", Se, [
881
+ m(
882
+ "label",
883
+ {
884
+ class: N(["nrg-toggle", { "nrg-toggle--checked": e.modelValue }])
885
+ },
886
+ [
887
+ m("input", {
888
+ type: "checkbox",
889
+ checked: e.modelValue,
890
+ class: "nrg-toggle__input",
891
+ onChange: t[0] || (t[0] = (a) => e.$emit(
892
+ "update:modelValue",
893
+ a.target.checked
894
+ ))
895
+ }, null, 40, qe),
896
+ e.icon || e.label ? (l(), c("span", Re, [
897
+ e.icon ? (l(), c(
898
+ "i",
899
+ {
900
+ key: 0,
901
+ class: N(e.iconClass)
902
+ },
903
+ null,
904
+ 2
905
+ /* CLASS */
906
+ )) : f("v-if", !0),
907
+ W(
908
+ " " + E(e.label),
909
+ 1
910
+ /* TEXT */
911
+ )
912
+ ])) : f("v-if", !0),
913
+ t[1] || (t[1] = m(
914
+ "span",
915
+ { class: "nrg-toggle__slider" },
916
+ null,
917
+ -1
918
+ /* CACHED */
919
+ ))
920
+ ],
921
+ 2
922
+ /* CLASS */
923
+ )
924
+ ]);
925
+ }
926
+ const z = /* @__PURE__ */ T(we, [["render", Ne], ["__scopeId", "data-v-724dcae4"]]), _e = /* @__PURE__ */ new Set([
927
+ "id",
928
+ "type",
929
+ "x",
930
+ "y",
931
+ "z",
932
+ "g",
933
+ "wires",
934
+ "credentials",
935
+ "_users",
936
+ "validateInput",
937
+ "validateOutputs",
938
+ "outputs",
939
+ "outputContextModes",
940
+ "outputReturnProperties",
941
+ ...ie
942
+ ]);
943
+ function Le(e) {
944
+ return e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).trim();
945
+ }
946
+ function je(e) {
947
+ var t, n;
948
+ return e.type === "object" && !!((t = e.properties) != null && t.value) && !!((n = e.properties) != null && n.type);
949
+ }
950
+ function C(e, t, n, r) {
951
+ var b;
952
+ const s = r || t.title || Le(e), d = t["x-nrg-form"] ?? {}, a = d.icon || "";
953
+ if (t["x-nrg-node-type"])
954
+ return {
955
+ key: e,
956
+ label: s,
957
+ icon: a,
958
+ inputType: "config",
959
+ required: n,
960
+ configType: t["x-nrg-node-type"]
961
+ };
962
+ if (je(t))
963
+ return {
964
+ key: e,
965
+ label: s,
966
+ icon: a,
967
+ inputType: "typed",
968
+ required: n,
969
+ // serialized schemas carry plain strings; trust them as typed-input type names
970
+ types: d.typedInputTypes
971
+ };
972
+ if (t.type === "array" && ((b = t.items) != null && b.enum))
973
+ return {
974
+ key: e,
975
+ label: s,
976
+ icon: a,
977
+ inputType: "select",
978
+ required: n,
979
+ multiple: !0,
980
+ options: t.items.enum.map((i) => ({
981
+ value: String(i),
982
+ label: String(i)
983
+ }))
984
+ };
985
+ if (t.enum)
986
+ return {
987
+ key: e,
988
+ label: s,
989
+ icon: a,
990
+ inputType: "select",
991
+ required: n,
992
+ multiple: !1,
993
+ options: t.enum.map((i) => ({
994
+ value: String(i),
995
+ label: String(i)
996
+ }))
997
+ };
998
+ if (t.anyOf && t.anyOf.every((i) => i.const !== void 0))
999
+ return {
1000
+ key: e,
1001
+ label: s,
1002
+ icon: a,
1003
+ inputType: "select",
1004
+ required: n,
1005
+ multiple: !1,
1006
+ options: t.anyOf.map((i) => ({
1007
+ value: String(i.const),
1008
+ label: String(i.const)
1009
+ }))
1010
+ };
1011
+ switch (Array.isArray(t.type) ? t.type[0] : t.type) {
1012
+ case "boolean":
1013
+ return {
1014
+ key: e,
1015
+ label: s,
1016
+ icon: a,
1017
+ inputType: "boolean",
1018
+ required: n,
1019
+ toggle: d.toggle
1020
+ };
1021
+ case "number":
1022
+ case "integer":
1023
+ return {
1024
+ key: e,
1025
+ label: s,
1026
+ icon: a,
1027
+ inputType: "number",
1028
+ required: n,
1029
+ htmlType: "number"
1030
+ };
1031
+ case "array":
1032
+ return d.editorLanguage ? {
1033
+ key: e,
1034
+ label: s,
1035
+ icon: a,
1036
+ inputType: "editor",
1037
+ required: n,
1038
+ language: d.editorLanguage
1039
+ } : { key: e, label: s, icon: a, inputType: "array-text", required: n };
1040
+ case "object":
1041
+ return d.editorLanguage ? {
1042
+ key: e,
1043
+ label: s,
1044
+ icon: a,
1045
+ inputType: "editor",
1046
+ required: n,
1047
+ language: d.editorLanguage
1048
+ } : {
1049
+ key: e,
1050
+ label: s,
1051
+ icon: a,
1052
+ inputType: "text",
1053
+ required: n,
1054
+ htmlType: "text"
1055
+ };
1056
+ default:
1057
+ return d.editorLanguage ? {
1058
+ key: e,
1059
+ label: s,
1060
+ icon: a,
1061
+ inputType: "editor",
1062
+ required: n,
1063
+ language: d.editorLanguage
1064
+ } : {
1065
+ key: e,
1066
+ label: s,
1067
+ icon: a,
1068
+ inputType: "text",
1069
+ required: n,
1070
+ htmlType: t.format === "password" ? "password" : "text"
1071
+ };
1072
+ }
1073
+ }
1074
+ const Ce = V({
1075
+ name: "NodeRedJsonSchemaForm",
1076
+ components: {
1077
+ NodeRedInputLabel: w,
1078
+ NodeRedToggle: z,
1079
+ NodeRedInput: B,
1080
+ NodeRedSelectInput: F,
1081
+ NodeRedTypedInput: U,
1082
+ NodeRedConfigInput: M,
1083
+ NodeRedEditorInput: P
1084
+ },
1085
+ props: {
1086
+ node: {
1087
+ type: Object,
1088
+ required: !0
1089
+ },
1090
+ schema: {
1091
+ type: Object,
1092
+ required: !0
1093
+ },
1094
+ errors: {
1095
+ type: Object,
1096
+ default: () => ({})
1097
+ }
1098
+ },
1099
+ computed: {
1100
+ configFields() {
1101
+ var t;
1102
+ if (!((t = this.schema) != null && t.properties)) return [];
1103
+ const e = new Set(this.schema.required ?? []);
1104
+ return Object.entries(this.schema.properties).filter(([n]) => !_e.has(n)).map(
1105
+ ([n, r]) => C(
1106
+ n,
1107
+ r,
1108
+ e.has(n),
1109
+ this.resolveI18n("configs", n)
1110
+ )
1111
+ );
1112
+ },
1113
+ credentialFields() {
1114
+ var n, r;
1115
+ const e = (r = (n = this.schema) == null ? void 0 : n.properties) == null ? void 0 : r.credentials;
1116
+ if (!(e != null && e.properties)) return [];
1117
+ const t = new Set(e.required ?? []);
1118
+ return Object.entries(e.properties).map(([s, d]) => {
1119
+ const a = C(
1120
+ s,
1121
+ d,
1122
+ t.has(s),
1123
+ this.resolveI18n("credentials", s)
1124
+ );
1125
+ return a.inputType !== "text" ? {
1126
+ ...a,
1127
+ inputType: "text",
1128
+ htmlType: d.format === "password" ? "password" : "text"
1129
+ } : a;
1130
+ });
1131
+ }
1132
+ },
1133
+ methods: {
1134
+ resolveI18n(e, t) {
1135
+ const n = this.$i18n(`${e}.${t}`), r = `${this.node.type}.${e}.${t}`;
1136
+ if (n && n !== r && n !== `${e}.${t}`)
1137
+ return n;
1138
+ }
1139
+ }
1140
+ }), Ae = { key: 1 }, Oe = { key: 2 }, De = ["checked", "onChange"], We = { key: 6 }, Be = ["value", "onInput"], Ue = {
1141
+ key: 0,
1142
+ class: "node-red-vue-input-error-message"
1143
+ };
1144
+ function Me(e, t, n, r, s, d) {
1145
+ const a = g("NodeRedInput"), h = g("NodeRedToggle"), b = g("NodeRedInputLabel"), i = g("NodeRedSelectInput"), u = g("NodeRedTypedInput"), y = g("NodeRedConfigInput"), I = g("NodeRedEditorInput");
1146
+ return l(), c("div", null, [
1147
+ (l(!0), c(
1148
+ _,
1149
+ null,
1150
+ L(e.configFields, (o) => (l(), c("div", {
1151
+ key: o.key,
1152
+ class: "form-row"
1153
+ }, [
1154
+ o.inputType === "text" || o.inputType === "number" ? (l(), v(a, {
1155
+ key: 0,
1156
+ value: e.node[o.key],
1157
+ "onUpdate:value": (p) => e.node[o.key] = p,
1158
+ type: o.htmlType,
1159
+ label: o.label,
1160
+ icon: o.icon,
1161
+ required: o.required,
1162
+ error: e.errors[`node.${o.key}`]
1163
+ }, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])) : o.inputType === "boolean" && o.toggle ? (l(), c("div", Ae, [
1164
+ R(h, {
1165
+ "model-value": e.node[o.key],
1166
+ label: o.label,
1167
+ icon: o.icon,
1168
+ "onUpdate:modelValue": (p) => e.node[o.key] = p
1169
+ }, null, 8, ["model-value", "label", "icon", "onUpdate:modelValue"])
1170
+ ])) : o.inputType === "boolean" ? (l(), c("div", Oe, [
1171
+ R(b, {
1172
+ label: o.label,
1173
+ icon: o.icon,
1174
+ required: o.required
1175
+ }, null, 8, ["label", "icon", "required"]),
1176
+ m("input", {
1177
+ type: "checkbox",
1178
+ checked: e.node[o.key],
1179
+ style: { width: "auto", margin: "0" },
1180
+ onChange: (p) => {
1181
+ e.node[o.key] = p.target.checked;
1182
+ }
1183
+ }, null, 40, De)
1184
+ ])) : o.inputType === "select" ? (l(), v(i, {
1185
+ key: 3,
1186
+ value: e.node[o.key],
1187
+ "onUpdate:value": (p) => e.node[o.key] = p,
1188
+ options: o.options,
1189
+ multiple: o.multiple,
1190
+ label: o.label,
1191
+ icon: o.icon,
1192
+ required: o.required,
1193
+ error: e.errors[`node.${o.key}`]
1194
+ }, null, 8, ["value", "onUpdate:value", "options", "multiple", "label", "icon", "required", "error"])) : o.inputType === "typed" ? (l(), v(u, {
1195
+ key: 4,
1196
+ value: e.node[o.key],
1197
+ "onUpdate:value": (p) => e.node[o.key] = p,
1198
+ types: o.types,
1199
+ label: o.label,
1200
+ icon: o.icon,
1201
+ required: o.required,
1202
+ error: e.errors[`node.${o.key}`]
1203
+ }, null, 8, ["value", "onUpdate:value", "types", "label", "icon", "required", "error"])) : o.inputType === "config" ? (l(), v(y, {
1204
+ key: 5,
1205
+ value: e.node[o.key],
1206
+ "onUpdate:value": (p) => e.node[o.key] = p,
1207
+ type: o.configType,
1208
+ node: e.node,
1209
+ "prop-name": o.key,
1210
+ label: o.label,
1211
+ icon: o.icon,
1212
+ required: o.required,
1213
+ error: e.errors[`node.${o.key}`]
1214
+ }, null, 8, ["value", "onUpdate:value", "type", "node", "prop-name", "label", "icon", "required", "error"])) : o.inputType === "array-text" ? (l(), c("div", We, [
1215
+ R(b, {
1216
+ label: o.label,
1217
+ icon: o.icon,
1218
+ required: o.required
1219
+ }, null, 8, ["label", "icon", "required"]),
1220
+ t[0] || (t[0] = m(
1221
+ "span",
1222
+ { style: { display: "block", "font-size": "11px", color: "var(--red-ui-text-color-disabled, #999)", "margin-bottom": "4px" } },
1223
+ " One entry per line ",
1224
+ -1
1225
+ /* CACHED */
1226
+ )),
1227
+ m("textarea", {
1228
+ value: Array.isArray(e.node[o.key]) ? e.node[o.key].join(`
1229
+ `) : e.node[o.key] ?? "",
1230
+ rows: "4",
1231
+ style: { width: "100%", resize: "vertical", "font-family": "monospace", "font-size": "13px" },
1232
+ onInput: (p) => e.node[o.key] = p.target.value.split(`
1233
+ `).filter(Boolean)
1234
+ }, null, 40, Be),
1235
+ e.errors[`node.${o.key}`] ? (l(), c(
1236
+ "span",
1237
+ Ue,
1238
+ E(e.errors[`node.${o.key}`]),
1239
+ 1
1240
+ /* TEXT */
1241
+ )) : f("v-if", !0)
1242
+ ])) : o.inputType === "editor" ? (l(), v(I, {
1243
+ key: 7,
1244
+ value: e.node[o.key],
1245
+ "onUpdate:value": (p) => e.node[o.key] = p,
1246
+ language: o.language,
1247
+ label: o.label,
1248
+ icon: o.icon,
1249
+ required: o.required,
1250
+ error: e.errors[`node.${o.key}`]
1251
+ }, null, 8, ["value", "onUpdate:value", "language", "label", "icon", "required", "error"])) : f("v-if", !0)
1252
+ ]))),
1253
+ 128
1254
+ /* KEYED_FRAGMENT */
1255
+ )),
1256
+ (l(!0), c(
1257
+ _,
1258
+ null,
1259
+ L(e.credentialFields, (o) => (l(), c("div", {
1260
+ key: `cred-${o.key}`,
1261
+ class: "form-row"
1262
+ }, [
1263
+ R(a, {
1264
+ value: e.node.credentials[o.key],
1265
+ "onUpdate:value": (p) => e.node.credentials[o.key] = p,
1266
+ type: o.htmlType,
1267
+ label: o.label,
1268
+ icon: o.icon,
1269
+ required: o.required,
1270
+ error: e.errors[`node.credentials.${o.key}`]
1271
+ }, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])
1272
+ ]))),
1273
+ 128
1274
+ /* KEYED_FRAGMENT */
1275
+ ))
1276
+ ]);
1277
+ }
1278
+ const Fe = /* @__PURE__ */ T(Ce, [["render", Me]]);
1279
+ function A() {
1280
+ const e = {
1281
+ get(t) {
1282
+ return e[t];
1283
+ },
1284
+ set(t, n) {
1285
+ return e[t] = n, n;
1286
+ },
1287
+ remove(t) {
1288
+ const n = e[t];
1289
+ return delete e[t], n;
15
1290
  }
16
1291
  };
17
- return t;
1292
+ return e;
18
1293
  }
19
- function R(t, r) {
20
- if (t === r) return !0;
21
- const s = t.split("/"), n = r.split("/");
22
- for (let o = 0; o < s.length; o++) {
23
- if (s[o] === "#") return !0;
24
- if (o >= n.length || s[o] !== "+" && s[o] !== n[o]) return !1;
1294
+ function Pe(e, t) {
1295
+ if (e === t) return !0;
1296
+ const n = e.split("/"), r = t.split("/");
1297
+ for (let s = 0; s < n.length; s++) {
1298
+ if (n[s] === "#") return !0;
1299
+ if (s >= r.length || n[s] !== "+" && n[s] !== r[s]) return !1;
25
1300
  }
26
- return s.length === n.length;
1301
+ return n.length === r.length;
27
1302
  }
28
- function _(t) {
29
- var r;
30
- (r = t.__reset) == null || r.call(t);
1303
+ function ze(e) {
1304
+ var t;
1305
+ (t = e.__reset) == null || t.call(e);
31
1306
  }
32
- function N() {
33
- const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = [], n = {}, o = [];
34
- let c = !1, l = 0;
35
- const b = () => {
36
- const e = {
1307
+ function He() {
1308
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], r = {}, s = [];
1309
+ let d = !1, a = 0;
1310
+ const h = () => {
1311
+ const i = {
37
1312
  element: null,
38
- open: () => e,
39
- close: () => e,
40
- setContent: () => e,
1313
+ open: () => i,
1314
+ close: () => i,
1315
+ setContent: () => i,
41
1316
  move: () => {
42
1317
  }
43
1318
  };
44
- return e;
45
- }, y = {
46
- _: (e) => e,
1319
+ return i;
1320
+ }, b = {
1321
+ _: (i) => i,
47
1322
  editor: {
48
- createEditor(e) {
49
- let i = (e == null ? void 0 : e.value) || "";
50
- const u = {}, f = {
51
- on(d, p) {
52
- (u[d] ?? (u[d] = [])).push(p);
1323
+ createEditor(i) {
1324
+ let u = (i == null ? void 0 : i.value) || "";
1325
+ const y = {}, I = {
1326
+ on(o, p) {
1327
+ (y[o] ?? (y[o] = [])).push(p);
53
1328
  }
54
1329
  };
55
1330
  return {
56
- getValue: () => i,
57
- setValue: (d) => {
58
- i = d, (u.change ?? []).forEach((p) => p());
1331
+ getValue: () => u,
1332
+ setValue: (o) => {
1333
+ u = o, (y.change ?? []).forEach((p) => p());
59
1334
  },
60
- getSession: () => f,
1335
+ getSession: () => I,
61
1336
  focus: () => {
62
1337
  },
63
1338
  destroy: () => {
@@ -79,13 +1354,13 @@ function N() {
79
1354
  }
80
1355
  },
81
1356
  popover: {
82
- create: () => b(),
1357
+ create: () => h(),
83
1358
  tooltip: () => {
84
- const e = {
1359
+ const i = {
85
1360
  element: null,
86
- open: () => e,
87
- close: () => e,
88
- setContent: () => e,
1361
+ open: () => i,
1362
+ close: () => i,
1363
+ setContent: () => i,
89
1364
  move: () => {
90
1365
  },
91
1366
  delete: () => {
@@ -93,91 +1368,91 @@ function N() {
93
1368
  setAction: () => {
94
1369
  }
95
1370
  };
96
- return e;
1371
+ return i;
97
1372
  }
98
1373
  },
99
1374
  nodes: {
100
- registerType(e, i) {
101
- r.set(e, i);
1375
+ registerType(i, u) {
1376
+ t.set(i, u);
102
1377
  },
103
- getType(e) {
104
- return r.get(e) ?? null;
1378
+ getType(i) {
1379
+ return t.get(i) ?? null;
105
1380
  },
106
- node(e) {
107
- return t.get(e) ?? null;
1381
+ node(i) {
1382
+ return e.get(i) ?? null;
108
1383
  },
109
- add(e) {
110
- return t.set(e.id, e), e;
1384
+ add(i) {
1385
+ return e.set(i.id, i), i;
111
1386
  },
112
- remove(e) {
113
- const i = t.get(e);
114
- return t.delete(e), { links: [], nodes: i ? [i] : [] };
1387
+ remove(i) {
1388
+ const u = e.get(i);
1389
+ return e.delete(i), { links: [], nodes: u ? [u] : [] };
115
1390
  },
116
1391
  clear() {
117
- t.clear();
1392
+ e.clear();
118
1393
  },
119
1394
  // The mock keeps a single registry: eachNode and eachConfig iterate the
120
1395
  // same entries. Register whatever your component expects to find.
121
- eachNode(e) {
122
- for (const i of t.values())
123
- if (e(i) === !1) break;
1396
+ eachNode(i) {
1397
+ for (const u of e.values())
1398
+ if (i(u) === !1) break;
124
1399
  },
125
- eachConfig(e) {
126
- for (const i of t.values())
127
- if (e(i) === !1) break;
1400
+ eachConfig(i) {
1401
+ for (const u of e.values())
1402
+ if (i(u) === !1) break;
128
1403
  },
129
- filterNodes(e) {
130
- return [...t.values()].filter(
131
- (i) => (e.type === void 0 || i.type === e.type) && (e.z === void 0 || i.z === e.z)
1404
+ filterNodes(i) {
1405
+ return [...e.values()].filter(
1406
+ (u) => (i.type === void 0 || u.type === i.type) && (i.z === void 0 || u.z === i.z)
132
1407
  );
133
1408
  },
134
- filterLinks(e) {
135
- return s.filter(
136
- (i) => {
137
- var u, f, d, p;
138
- return (e.source === void 0 || i.source === e.source || ((u = i.source) == null ? void 0 : u.id) === ((f = e.source) == null ? void 0 : f.id)) && (e.target === void 0 || i.target === e.target || ((d = i.target) == null ? void 0 : d.id) === ((p = e.target) == null ? void 0 : p.id));
1409
+ filterLinks(i) {
1410
+ return n.filter(
1411
+ (u) => {
1412
+ var y, I, o, p;
1413
+ return (i.source === void 0 || u.source === i.source || ((y = u.source) == null ? void 0 : y.id) === ((I = i.source) == null ? void 0 : I.id)) && (i.target === void 0 || u.target === i.target || ((o = u.target) == null ? void 0 : o.id) === ((p = i.target) == null ? void 0 : p.id));
139
1414
  }
140
1415
  );
141
1416
  },
142
- addLink(e) {
143
- s.push(e);
1417
+ addLink(i) {
1418
+ n.push(i);
144
1419
  },
145
- dirty(e) {
146
- if (e === void 0) return c;
147
- c = e;
1420
+ dirty(i) {
1421
+ if (i === void 0) return d;
1422
+ d = i;
148
1423
  },
149
1424
  id() {
150
- return (++l).toString(16).padStart(16, "0");
1425
+ return (++a).toString(16).padStart(16, "0");
151
1426
  }
152
1427
  },
153
1428
  events: {
154
- on(e, i) {
155
- (n[e] ?? (n[e] = [])).push(i);
1429
+ on(i, u) {
1430
+ (r[i] ?? (r[i] = [])).push(u);
156
1431
  },
157
- off(e, i) {
158
- n[e] && (i ? n[e] = n[e].filter(
159
- (u) => u !== i
160
- ) : delete n[e]);
1432
+ off(i, u) {
1433
+ r[i] && (u ? r[i] = r[i].filter(
1434
+ (y) => y !== u
1435
+ ) : delete r[i]);
161
1436
  },
162
- emit(e, ...i) {
163
- [...n[e] ?? []].forEach((u) => u(...i));
1437
+ emit(i, ...u) {
1438
+ [...r[i] ?? []].forEach((y) => y(...u));
164
1439
  }
165
1440
  },
166
1441
  comms: {
167
- subscribe(e, i) {
168
- o.push({ topic: e, callback: i });
1442
+ subscribe(i, u) {
1443
+ s.push({ topic: i, callback: u });
169
1444
  },
170
- unsubscribe(e, i) {
171
- const u = o.findIndex(
172
- (f) => f.topic === e && f.callback === i
1445
+ unsubscribe(i, u) {
1446
+ const y = s.findIndex(
1447
+ (I) => I.topic === i && I.callback === u
173
1448
  );
174
- u !== -1 && o.splice(u, 1);
1449
+ y !== -1 && s.splice(y, 1);
175
1450
  },
176
- publish(e, i) {
177
- [...o].filter((u) => R(u.topic, e)).forEach((u) => u.callback(e, i));
1451
+ publish(i, u) {
1452
+ [...s].filter((y) => Pe(y.topic, i)).forEach((y) => y.callback(i, u));
178
1453
  }
179
1454
  },
180
- settings: m(),
1455
+ settings: A(),
181
1456
  notify: () => ({
182
1457
  update: () => {
183
1458
  },
@@ -185,153 +1460,153 @@ function N() {
185
1460
  }
186
1461
  })
187
1462
  };
188
- return Object.defineProperty(y, "__reset", {
1463
+ return Object.defineProperty(b, "__reset", {
189
1464
  enumerable: !1,
190
1465
  value: () => {
191
- t.clear(), r.clear(), s.length = 0;
192
- for (const e of Object.keys(n))
193
- delete n[e];
194
- o.length = 0, c = !1, y.settings = m();
1466
+ e.clear(), t.clear(), n.length = 0;
1467
+ for (const i of Object.keys(r))
1468
+ delete r[i];
1469
+ s.length = 0, d = !1, b.settings = A();
195
1470
  }
196
- }), y;
1471
+ }), b;
197
1472
  }
198
- function g() {
1473
+ function O() {
199
1474
  return { typedInput: { value: "", type: "" }, listeners: {} };
200
1475
  }
201
- function C(t) {
202
- return t && !t.__jqState && (t.__jqState = g()), t ? t.__jqState : g();
1476
+ function Je(e) {
1477
+ return e && !e.__jqState && (e.__jqState = O()), e ? e.__jqState : O();
203
1478
  }
204
- function a(t) {
205
- const r = C(t), s = {
206
- 0: t,
207
- length: t ? 1 : 0,
208
- typedInput(n, o) {
209
- if (typeof n == "object")
210
- return r.typedInput = {
1479
+ function S(e) {
1480
+ const t = Je(e), n = {
1481
+ 0: e,
1482
+ length: e ? 1 : 0,
1483
+ typedInput(r, s) {
1484
+ if (typeof r == "object")
1485
+ return t.typedInput = {
211
1486
  value: "",
212
- type: n.default || "",
213
- types: n.types
214
- }, s;
215
- if (n === "value") {
216
- if (o !== void 0) {
217
- r.typedInput.value = String(o), t && t.setAttribute("value", String(o));
1487
+ type: r.default || "",
1488
+ types: r.types
1489
+ }, n;
1490
+ if (r === "value") {
1491
+ if (s !== void 0) {
1492
+ t.typedInput.value = String(s), e && e.setAttribute("value", String(s));
218
1493
  return;
219
1494
  }
220
- return r.typedInput.value;
1495
+ return t.typedInput.value;
221
1496
  }
222
- if (n === "type") {
223
- if (o !== void 0) {
224
- r.typedInput.type = String(o);
1497
+ if (r === "type") {
1498
+ if (s !== void 0) {
1499
+ t.typedInput.type = String(s);
225
1500
  return;
226
1501
  }
227
- return r.typedInput.type;
1502
+ return t.typedInput.type;
228
1503
  }
229
- if (n === "types") {
230
- r.typedInput.types = o;
1504
+ if (r === "types") {
1505
+ t.typedInput.types = s;
231
1506
  return;
232
1507
  }
233
- if (n === "validate")
1508
+ if (r === "validate")
234
1509
  return !0;
235
- if (n === "disable") {
236
- r.typedInput.disabled = o !== !1;
1510
+ if (r === "disable") {
1511
+ t.typedInput.disabled = s !== !1;
237
1512
  return;
238
1513
  }
239
- if (n === "enable") {
240
- r.typedInput.disabled = !1;
1514
+ if (r === "enable") {
1515
+ t.typedInput.disabled = !1;
241
1516
  return;
242
1517
  }
243
- if (n === "hide") {
244
- r.typedInput.hidden = !0;
1518
+ if (r === "hide") {
1519
+ t.typedInput.hidden = !0;
245
1520
  return;
246
1521
  }
247
- if (n === "show") {
248
- r.typedInput.hidden = !1;
1522
+ if (r === "show") {
1523
+ t.typedInput.hidden = !1;
249
1524
  return;
250
1525
  }
251
- if (n === "width") {
252
- r.typedInput.width = o;
1526
+ if (r === "width") {
1527
+ t.typedInput.width = s;
253
1528
  return;
254
1529
  }
255
- if (n !== "focus")
256
- return s;
1530
+ if (r !== "focus")
1531
+ return n;
257
1532
  },
258
- on(n, o) {
259
- return r.listeners[n] || (r.listeners[n] = []), r.listeners[n].push(o), s;
1533
+ on(r, s) {
1534
+ return t.listeners[r] || (t.listeners[r] = []), t.listeners[r].push(s), n;
260
1535
  },
261
- off(n) {
262
- if (n)
263
- delete r.listeners[n];
1536
+ off(r) {
1537
+ if (r)
1538
+ delete t.listeners[r];
264
1539
  else
265
- for (const o of Object.keys(r.listeners))
266
- delete r.listeners[o];
267
- return s;
1540
+ for (const s of Object.keys(t.listeners))
1541
+ delete t.listeners[s];
1542
+ return n;
268
1543
  },
269
- val(n) {
270
- return n !== void 0 ? ((t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement) && (t.value = String(n)), s) : t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.value : "";
1544
+ val(r) {
1545
+ return r !== void 0 ? ((e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && (e.value = String(r)), n) : e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement ? e.value : "";
271
1546
  },
272
- find(n) {
273
- return a((t == null ? void 0 : t.querySelector(n)) ?? null);
1547
+ find(r) {
1548
+ return S((e == null ? void 0 : e.querySelector(r)) ?? null);
274
1549
  },
275
- append(n) {
276
- const o = (n == null ? void 0 : n[0]) || n;
277
- return t && o instanceof Element && t.appendChild(o), s;
1550
+ append(r) {
1551
+ const s = (r == null ? void 0 : r[0]) || r;
1552
+ return e && s instanceof Element && e.appendChild(s), n;
278
1553
  },
279
- appendTo(n) {
280
- const o = (n == null ? void 0 : n[0]) || n;
281
- return o instanceof Element && t && o.appendChild(t), s;
1554
+ appendTo(r) {
1555
+ const s = (r == null ? void 0 : r[0]) || r;
1556
+ return s instanceof Element && e && s.appendChild(e), n;
282
1557
  },
283
- html(n) {
284
- return t && (t.innerHTML = n), s;
1558
+ html(r) {
1559
+ return e && (e.innerHTML = r), n;
285
1560
  },
286
1561
  empty() {
287
- return t && (t.innerHTML = ""), s;
1562
+ return e && (e.innerHTML = ""), n;
288
1563
  },
289
1564
  i18n() {
290
- return s;
1565
+ return n;
291
1566
  },
292
- addClass(n) {
293
- return t == null || t.classList.add(n), s;
1567
+ addClass(r) {
1568
+ return e == null || e.classList.add(r), n;
294
1569
  },
295
- removeClass(n) {
296
- return t == null || t.classList.remove(n), s;
1570
+ removeClass(r) {
1571
+ return e == null || e.classList.remove(r), n;
297
1572
  },
298
- __trigger(n) {
299
- (r.listeners[n] || []).forEach((o) => o());
1573
+ __trigger(r) {
1574
+ (t.listeners[r] || []).forEach((s) => s());
300
1575
  }
301
1576
  };
302
- return s;
1577
+ return n;
303
1578
  }
304
- function j() {
305
- return function(r, s) {
306
- if (typeof r == "string") {
307
- if (r.trim().startsWith("<")) {
308
- const n = document.createElement("template");
309
- n.innerHTML = r.trim();
310
- const o = n.content.firstElementChild;
311
- if (o && s)
312
- for (const [c, l] of Object.entries(s))
313
- c === "html" ? o.innerHTML = String(l) : o.setAttribute(c, String(l));
314
- return a(o);
1579
+ function Ke() {
1580
+ return function(t, n) {
1581
+ if (typeof t == "string") {
1582
+ if (t.trim().startsWith("<")) {
1583
+ const r = document.createElement("template");
1584
+ r.innerHTML = t.trim();
1585
+ const s = r.content.firstElementChild;
1586
+ if (s && n)
1587
+ for (const [d, a] of Object.entries(n))
1588
+ d === "html" ? s.innerHTML = String(a) : s.setAttribute(d, String(a));
1589
+ return S(s);
315
1590
  }
316
- return a(document.querySelector(r));
1591
+ return S(document.querySelector(t));
317
1592
  }
318
- return r instanceof Element || r && typeof r == "object" && r.nodeType ? a(r) : a(null);
1593
+ return t instanceof Element || t && typeof t == "object" && t.nodeType ? S(t) : S(null);
319
1594
  };
320
1595
  }
321
- function H() {
322
- window.$ = j(), window.RED = N(), L(() => {
323
- _(window.RED);
1596
+ function Qe() {
1597
+ window.$ = Ke(), window.RED = He(), Q(() => {
1598
+ ze(window.RED);
324
1599
  });
325
1600
  }
326
- h.global.mocks.$i18n = (t) => t;
327
- h.global.components = {
328
- NodeRedInputLabel: M,
329
- NodeRedToggle: w,
330
- NodeRedInput: k,
331
- NodeRedTypedInput: T,
332
- NodeRedConfigInput: v,
333
- NodeRedSelectInput: I,
334
- NodeRedEditorInput: S,
335
- NodeRedJsonSchemaForm: E
1601
+ D.global.mocks.$i18n = (e) => e;
1602
+ D.global.components = {
1603
+ NodeRedInputLabel: w,
1604
+ NodeRedToggle: z,
1605
+ NodeRedInput: B,
1606
+ NodeRedTypedInput: U,
1607
+ NodeRedConfigInput: M,
1608
+ NodeRedSelectInput: F,
1609
+ NodeRedEditorInput: P,
1610
+ NodeRedJsonSchemaForm: Fe
336
1611
  };
337
- H();
1612
+ Qe();