@ixon-cdk/iframe-adapter 1.3.0 → 1.4.0-next.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.
package/dist/index.js ADDED
@@ -0,0 +1,829 @@
1
+ var k = Object.defineProperty;
2
+ var B = (t, e, a) => e in t ? k(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
+ var u = (t, e, a) => (B(t, typeof e != "symbol" ? e + "" : e, a), a);
4
+ const l = "cdk:cmpctx:", s = {
5
+ // Lifecycle
6
+ Create: `${l}create`,
7
+ Created: `${l}created`,
8
+ Destroy: `${l}destroy`,
9
+ // BackendComponentClient
10
+ BackendComponentClientCreate: `${l}bcc:create`,
11
+ BackendComponentClientDestroy: `${l}bcc:destroy`,
12
+ BackendComponentClientCall: `${l}bcc:call`,
13
+ BackendComponentClientCallResult: `${l}bcc:callresult`,
14
+ // LoggingDataClient
15
+ LoggingDataClientCreate: `${l}ldc:create`,
16
+ LoggingDataClientDestroy: `${l}ldc:destroy`,
17
+ LoggingDataClientQuery: `${l}ldc:query`,
18
+ LoggingDataClientQueryResult: `${l}ldc:queryresult`,
19
+ // ResourceDataClient
20
+ ResourceDataClientCreate: `${l}rdc:create`,
21
+ ResourceDataClientDestroy: `${l}rdc:destroy`,
22
+ ResourceDataClientQuery: `${l}rdc:query`,
23
+ ResourceDataClientQueryResult: `${l}rdc:queryresult`,
24
+ ResourceDataClientRender: `${l}rdc:render`,
25
+ ResourceDataClientRenderResult: `${l}rdc:renderresult`,
26
+ ResourceDataClientUpdate: `${l}rdc:update`,
27
+ ResourceDataClientUpdated: `${l}rdc:updated`,
28
+ // ActionBottomSheet
29
+ OpenActionBottomSheet: `${l}openactionbottomsheet`,
30
+ OpenActionBottomSheetResult: `${l}openactionbottomsheetresult`,
31
+ // Dialogs
32
+ OpenAlertDialog: `${l}openalertdialog`,
33
+ OpenAlertDialogResult: `${l}openalertdialogresult`,
34
+ OpenConfirmDialog: `${l}openconfirmdialog`,
35
+ OpenConfirmDialogResult: `${l}openconfirmdialogresult`,
36
+ OpenFormDialog: `${l}openformdialog`,
37
+ OpenFormDialogResult: `${l}openformdialogresult`,
38
+ // VPN
39
+ ShowVpnStatusDetails: `${l}showvpnstatusdetails`,
40
+ ToggleVpn: `${l}togglevpn`,
41
+ VpnClientStatusChange: `${l}vpnclientstatuschange`,
42
+ // Miscellaneous
43
+ NavigateByUrl: `${l}navigatebyurl`,
44
+ SetTimeRange: `${l}settimerange`,
45
+ TimeRangeChange: `${l}timerangechange`
46
+ };
47
+ function at({ iframe: t, context: e }) {
48
+ return window.addEventListener("message", n, !1), e.ontimerangechange = (...r) => {
49
+ t.contentWindow && t.contentWindow.postMessage(
50
+ {
51
+ type: s.TimeRangeChange,
52
+ payload: r
53
+ },
54
+ "*"
55
+ );
56
+ }, e.onvpnclientstatuschange = (...r) => {
57
+ t.contentWindow && t.contentWindow.postMessage(
58
+ {
59
+ type: s.VpnClientStatusChange,
60
+ payload: r
61
+ },
62
+ "*"
63
+ );
64
+ }, {
65
+ destroy() {
66
+ window.removeEventListener("message", n, !1);
67
+ }
68
+ };
69
+ function a(r) {
70
+ return {
71
+ _apiLinkEntries: [...r._getApiLinks().entries()],
72
+ appData: r.appData,
73
+ componentBaseUrl: r.componentBaseUrl,
74
+ destroyed: r.destroyed,
75
+ mode: r.mode,
76
+ inputs: r.inputs,
77
+ timeRange: r.timeRange,
78
+ timeRangeIsAdjustable: r.timeRangeIsAdjustable,
79
+ vpnClientStatus: r.vpnClientStatus
80
+ };
81
+ }
82
+ function n(r) {
83
+ if (n._clients = n._clients || /* @__PURE__ */ new Map([]), r.source === t.contentWindow)
84
+ switch (r.data.type) {
85
+ case s.Create:
86
+ t.contentWindow.postMessage(
87
+ {
88
+ type: s.Created,
89
+ payload: a(e)
90
+ },
91
+ "*"
92
+ );
93
+ break;
94
+ case s.Destroy:
95
+ e.destroy();
96
+ break;
97
+ case s.BackendComponentClientCreate: {
98
+ const { clientId: o } = r.data.payload, i = e.createBackendComponentClient(o);
99
+ n._clients.set(o, i);
100
+ break;
101
+ }
102
+ case s.BackendComponentClientDestroy: {
103
+ const { clientId: o } = r.data.payload;
104
+ n._clients.has(o) && (n._clients.get(o).destroy(), n._clients.delete(o));
105
+ break;
106
+ }
107
+ case s.BackendComponentClientCall: {
108
+ const { clientId: o, callId: i, functionName: c, functionArguments: d } = r.data.payload;
109
+ let p = n._clients.get(o);
110
+ p && !p._destroyed && p.call(c, d).then((b) => {
111
+ p && !p.destroyed && t.contentWindow.postMessage(
112
+ {
113
+ type: s.BackendComponentClientCallResult,
114
+ payload: { callId: i, result: b }
115
+ },
116
+ "*"
117
+ );
118
+ });
119
+ break;
120
+ }
121
+ case s.LoggingDataClientCreate: {
122
+ const { clientId: o } = r.data.payload, i = e.createLoggingDataClient(o);
123
+ n._clients.set(o, i);
124
+ break;
125
+ }
126
+ case s.LoggingDataClientDestroy: {
127
+ const { clientId: o } = r.data.payload;
128
+ n._clients.has(o) && (n._clients.get(o).destroy(), n._clients.delete(o));
129
+ break;
130
+ }
131
+ case s.LoggingDataClientQuery: {
132
+ const { clientId: o, queryId: i, query: c } = r.data.payload;
133
+ let d = n._clients.get(o);
134
+ d && !d._destroyed && d.query(c, (p) => {
135
+ d._destroyed || t.contentWindow.postMessage(
136
+ {
137
+ type: s.LoggingDataClientQueryResult,
138
+ payload: { queryId: i, results: p }
139
+ },
140
+ "*"
141
+ );
142
+ });
143
+ break;
144
+ }
145
+ case s.ResourceDataClientCreate: {
146
+ const { clientId: o } = r.data.payload, i = e.createResourceDataClient(o);
147
+ n._clients.set(o, i);
148
+ break;
149
+ }
150
+ case s.ResourceDataClientDestroy: {
151
+ const { clientId: o } = r.data.payload;
152
+ n._clients.has(o) && (n._clients.get(o).destroy(), n._clients.delete(o));
153
+ break;
154
+ }
155
+ case s.ResourceDataClientQuery: {
156
+ const { clientId: o, queryId: i, query: c } = r.data.payload;
157
+ let d = n._clients.get(o);
158
+ d && !d._destroyed && d.query(c, (p) => {
159
+ d._destroyed || t.contentWindow.postMessage(
160
+ {
161
+ type: s.ResourceDataClientQueryResult,
162
+ payload: { queryId: i, results: p }
163
+ },
164
+ "*"
165
+ );
166
+ });
167
+ break;
168
+ }
169
+ case s.ResourceDataClientRender: {
170
+ const { clientId: o, queryId: i, query: c } = r.data.payload;
171
+ let d = n._clients.get(o);
172
+ d && !d._destroyed && d.render(c, (p) => {
173
+ d._destroyed || t.contentWindow.postMessage(
174
+ {
175
+ type: s.ResourceDataClientRenderResult,
176
+ payload: { queryId: i, results: p }
177
+ },
178
+ "*"
179
+ );
180
+ });
181
+ break;
182
+ }
183
+ case s.ResourceDataClientUpdate: {
184
+ const { clientId: o, updateId: i, update: c } = r.data.payload;
185
+ let d = n._clients.get(o);
186
+ d && !d._destroyed && d.update(c).then(() => {
187
+ d && !d._destroyed && t.contentWindow.postMessage(
188
+ {
189
+ type: s.ResourceDataClientUpdated,
190
+ payload: { updateId: i }
191
+ },
192
+ "*"
193
+ );
194
+ });
195
+ break;
196
+ }
197
+ case s.OpenActionBottomSheet:
198
+ e.openActionBottomSheet(r.data.payload.options).then((o) => {
199
+ t.contentWindow.postMessage({ type: s.OpenActionBottomSheetResult, payload: { result: o } }, "*");
200
+ });
201
+ break;
202
+ case s.OpenAlertDialog:
203
+ e.openAlertDialog(r.data.payload.options).then((o) => {
204
+ t.contentWindow.postMessage({ type: s.OpenAlertDialogResult, payload: { result: o } }, "*");
205
+ });
206
+ break;
207
+ case s.OpenConfirmDialog:
208
+ e.openConfirmDialog(r.data.payload.options).then((o) => {
209
+ t.contentWindow.postMessage({ type: s.OpenConfirmDialogResult, payload: { result: o } }, "*");
210
+ });
211
+ break;
212
+ case s.OpenFormDialog:
213
+ e.openFormDialog(r.data.payload.options).then((o) => {
214
+ t.contentWindow.postMessage({ type: s.OpenFormDialogResult, payload: { result: o } }, "*");
215
+ });
216
+ break;
217
+ case s.ShowVpnStatusDetails:
218
+ e.showVpnStatusDetails(r.data.payload.agentId);
219
+ break;
220
+ case s.ToggleVpn:
221
+ e.toggleVpn(r.data.payload.agentId);
222
+ break;
223
+ case s.NavigateByUrl:
224
+ e.navigateByUrl(r.data.payload.url);
225
+ break;
226
+ case s.SetTimeRange:
227
+ e.setTimeRange(r.data.payload.timeRange);
228
+ break;
229
+ }
230
+ }
231
+ }
232
+ class F {
233
+ constructor(e, a, n, r) {
234
+ this.query = e, this.variable = a, this.tag = n, this._onCancel = r, Object.freeze(this);
235
+ }
236
+ cancel() {
237
+ this._onCancel && this._onCancel();
238
+ }
239
+ }
240
+ var V = typeof global == "object" && global && global.Object === Object && global;
241
+ const P = V;
242
+ var H = typeof self == "object" && self && self.Object === Object && self, N = P || H || Function("return this")();
243
+ const $ = N;
244
+ var W = $.Symbol;
245
+ const _ = W;
246
+ var E = Object.prototype, Q = E.hasOwnProperty, z = E.toString, w = _ ? _.toStringTag : void 0;
247
+ function G(t) {
248
+ var e = Q.call(t, w), a = t[w];
249
+ try {
250
+ t[w] = void 0;
251
+ var n = !0;
252
+ } catch {
253
+ }
254
+ var r = z.call(t);
255
+ return n && (e ? t[w] = a : delete t[w]), r;
256
+ }
257
+ var J = Object.prototype, K = J.toString;
258
+ function X(t) {
259
+ return K.call(t);
260
+ }
261
+ var Y = "[object Null]", Z = "[object Undefined]", O = _ ? _.toStringTag : void 0;
262
+ function x(t) {
263
+ return t == null ? t === void 0 ? Z : Y : O && O in Object(t) ? G(t) : X(t);
264
+ }
265
+ function U(t) {
266
+ var e = typeof t;
267
+ return t != null && (e == "object" || e == "function");
268
+ }
269
+ var ee = "[object AsyncFunction]", te = "[object Function]", ae = "[object GeneratorFunction]", ne = "[object Proxy]";
270
+ function re(t) {
271
+ if (!U(t))
272
+ return !1;
273
+ var e = x(t);
274
+ return e == te || e == ae || e == ee || e == ne;
275
+ }
276
+ var oe = $["__core-js_shared__"];
277
+ const I = oe;
278
+ var L = function() {
279
+ var t = /[^.]+$/.exec(I && I.keys && I.keys.IE_PROTO || "");
280
+ return t ? "Symbol(src)_1." + t : "";
281
+ }();
282
+ function se(t) {
283
+ return !!L && L in t;
284
+ }
285
+ var ie = Function.prototype, le = ie.toString;
286
+ function de(t) {
287
+ if (t != null) {
288
+ try {
289
+ return le.call(t);
290
+ } catch {
291
+ }
292
+ try {
293
+ return t + "";
294
+ } catch {
295
+ }
296
+ }
297
+ return "";
298
+ }
299
+ var ce = /[\\^$.*+?()[\]{}|]/g, pe = /^\[object .+?Constructor\]$/, ue = Function.prototype, ge = Object.prototype, ye = ue.toString, he = ge.hasOwnProperty, fe = RegExp(
300
+ "^" + ye.call(he).replace(ce, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
301
+ );
302
+ function we(t) {
303
+ if (!U(t) || se(t))
304
+ return !1;
305
+ var e = re(t) ? fe : pe;
306
+ return e.test(de(t));
307
+ }
308
+ function me(t, e) {
309
+ return t == null ? void 0 : t[e];
310
+ }
311
+ function q(t, e) {
312
+ var a = me(t, e);
313
+ return we(a) ? a : void 0;
314
+ }
315
+ function _e(t, e) {
316
+ return t === e || t !== t && e !== e;
317
+ }
318
+ var Ce = q(Object, "create");
319
+ const m = Ce;
320
+ function De() {
321
+ this.__data__ = m ? m(null) : {}, this.size = 0;
322
+ }
323
+ function Re(t) {
324
+ var e = this.has(t) && delete this.__data__[t];
325
+ return this.size -= e ? 1 : 0, e;
326
+ }
327
+ var be = "__lodash_hash_undefined__", Ie = Object.prototype, ve = Ie.hasOwnProperty;
328
+ function $e(t) {
329
+ var e = this.__data__;
330
+ if (m) {
331
+ var a = e[t];
332
+ return a === be ? void 0 : a;
333
+ }
334
+ return ve.call(e, t) ? e[t] : void 0;
335
+ }
336
+ var Se = Object.prototype, Oe = Se.hasOwnProperty;
337
+ function Le(t) {
338
+ var e = this.__data__;
339
+ return m ? e[t] !== void 0 : Oe.call(e, t);
340
+ }
341
+ var Me = "__lodash_hash_undefined__";
342
+ function Ee(t, e) {
343
+ var a = this.__data__;
344
+ return this.size += this.has(t) ? 0 : 1, a[t] = m && e === void 0 ? Me : e, this;
345
+ }
346
+ function g(t) {
347
+ var e = -1, a = t == null ? 0 : t.length;
348
+ for (this.clear(); ++e < a; ) {
349
+ var n = t[e];
350
+ this.set(n[0], n[1]);
351
+ }
352
+ }
353
+ g.prototype.clear = De;
354
+ g.prototype.delete = Re;
355
+ g.prototype.get = $e;
356
+ g.prototype.has = Le;
357
+ g.prototype.set = Ee;
358
+ function Ue() {
359
+ this.__data__ = [], this.size = 0;
360
+ }
361
+ function C(t, e) {
362
+ for (var a = t.length; a--; )
363
+ if (_e(t[a][0], e))
364
+ return a;
365
+ return -1;
366
+ }
367
+ var qe = Array.prototype, Te = qe.splice;
368
+ function Ae(t) {
369
+ var e = this.__data__, a = C(e, t);
370
+ if (a < 0)
371
+ return !1;
372
+ var n = e.length - 1;
373
+ return a == n ? e.pop() : Te.call(e, a, 1), --this.size, !0;
374
+ }
375
+ function je(t) {
376
+ var e = this.__data__, a = C(e, t);
377
+ return a < 0 ? void 0 : e[a][1];
378
+ }
379
+ function ke(t) {
380
+ return C(this.__data__, t) > -1;
381
+ }
382
+ function Be(t, e) {
383
+ var a = this.__data__, n = C(a, t);
384
+ return n < 0 ? (++this.size, a.push([t, e])) : a[n][1] = e, this;
385
+ }
386
+ function f(t) {
387
+ var e = -1, a = t == null ? 0 : t.length;
388
+ for (this.clear(); ++e < a; ) {
389
+ var n = t[e];
390
+ this.set(n[0], n[1]);
391
+ }
392
+ }
393
+ f.prototype.clear = Ue;
394
+ f.prototype.delete = Ae;
395
+ f.prototype.get = je;
396
+ f.prototype.has = ke;
397
+ f.prototype.set = Be;
398
+ var Fe = q($, "Map");
399
+ const Ve = Fe;
400
+ function Pe() {
401
+ this.size = 0, this.__data__ = {
402
+ hash: new g(),
403
+ map: new (Ve || f)(),
404
+ string: new g()
405
+ };
406
+ }
407
+ function He(t) {
408
+ var e = typeof t;
409
+ return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
410
+ }
411
+ function D(t, e) {
412
+ var a = t.__data__;
413
+ return He(e) ? a[typeof e == "string" ? "string" : "hash"] : a.map;
414
+ }
415
+ function Ne(t) {
416
+ var e = D(this, t).delete(t);
417
+ return this.size -= e ? 1 : 0, e;
418
+ }
419
+ function We(t) {
420
+ return D(this, t).get(t);
421
+ }
422
+ function Qe(t) {
423
+ return D(this, t).has(t);
424
+ }
425
+ function ze(t, e) {
426
+ var a = D(this, t), n = a.size;
427
+ return a.set(t, e), this.size += a.size == n ? 0 : 1, this;
428
+ }
429
+ function y(t) {
430
+ var e = -1, a = t == null ? 0 : t.length;
431
+ for (this.clear(); ++e < a; ) {
432
+ var n = t[e];
433
+ this.set(n[0], n[1]);
434
+ }
435
+ }
436
+ y.prototype.clear = Pe;
437
+ y.prototype.delete = Ne;
438
+ y.prototype.get = We;
439
+ y.prototype.has = Qe;
440
+ y.prototype.set = ze;
441
+ var Ge = "Expected a function";
442
+ function S(t, e) {
443
+ if (typeof t != "function" || e != null && typeof e != "function")
444
+ throw new TypeError(Ge);
445
+ var a = function() {
446
+ var n = arguments, r = e ? e.apply(this, n) : n[0], o = a.cache;
447
+ if (o.has(r))
448
+ return o.get(r);
449
+ var i = t.apply(this, n);
450
+ return a.cache = o.set(r, i) || o, i;
451
+ };
452
+ return a.cache = new (S.Cache || y)(), a;
453
+ }
454
+ S.Cache = y;
455
+ const Je = 2, T = 1, A = "";
456
+ class R {
457
+ constructor(e, a, n) {
458
+ this.locale = e, this.queryRef = a, this.rawValue = n;
459
+ }
460
+ /**
461
+ * Creates a LoggingDataValue.
462
+ *
463
+ * @param locale the locale to use for formatting
464
+ * @param queryRef a reference to the query that produced this value
465
+ * @param rawValue the raw value
466
+ */
467
+ static create(e, a, n) {
468
+ return a.query.postAggr === "count" ? new Ke(e, a, n) : new R(e, a, n);
469
+ }
470
+ getDecimals(e = Je) {
471
+ return this.decimals ?? this.queryRef.query.decimals ?? e;
472
+ }
473
+ getFactor() {
474
+ var e, a, n;
475
+ return this.factor ?? this.queryRef.query.factor ?? ((a = (e = this.queryRef.tag) == null ? void 0 : e.variable) == null ? void 0 : a.factor) ?? ((n = this.queryRef.variable) == null ? void 0 : n.factor) ?? T;
476
+ }
477
+ getUnit() {
478
+ var e, a, n;
479
+ return this.unit ?? this.queryRef.query.unit ?? ((a = (e = this.queryRef.tag) == null ? void 0 : e.variable) == null ? void 0 : a.unit) ?? ((n = this.queryRef.variable) == null ? void 0 : n.unit) ?? A;
480
+ }
481
+ setDecimals(e) {
482
+ this.decimals = e;
483
+ }
484
+ /** @deprecated */
485
+ setFactor(e) {
486
+ this.factor = e;
487
+ }
488
+ setUnit(e) {
489
+ this.unit = e;
490
+ }
491
+ getValue() {
492
+ return this.rawValue;
493
+ }
494
+ toString() {
495
+ var n, r, o, i;
496
+ const e = this.locale !== null ? this.locale : void 0, a = S((c, d, p, b) => {
497
+ const j = {
498
+ style: "decimal",
499
+ minimumFractionDigits: Math.floor(d),
500
+ maximumFractionDigits: Math.floor(d)
501
+ };
502
+ return `${new Intl.NumberFormat(b, j).format(c)}${p ? " " + p : ""}`;
503
+ });
504
+ return this.rawValue === null ? "" : this.queryRef.query.postAggr === "count" ? a(this.rawValue, this.getDecimals(0), this.unit ?? this.queryRef.query.unit, e) : ((n = this.queryRef.variable) == null ? void 0 : n.type) === "str" ? this.rawValue : ((r = this.queryRef.variable) == null ? void 0 : r.type) === "bool" ? this.rawValue ? "True" : "False" : ((o = this.queryRef.variable) == null ? void 0 : o.type) === "int" ? a(
505
+ this.rawValue,
506
+ Number.isInteger(this.getFactor()) ? this.getDecimals(0) : this.getDecimals(),
507
+ this.getUnit(),
508
+ e
509
+ ) : ((i = this.queryRef.variable) == null ? void 0 : i.type) === "float" ? a(this.rawValue, this.getDecimals(), this.getUnit(), e) : String(this.getValue());
510
+ }
511
+ }
512
+ class Ke extends R {
513
+ getFactor() {
514
+ return this.factor ?? this.queryRef.query.factor ?? T;
515
+ }
516
+ getUnit() {
517
+ return this.unit ?? this.queryRef.query.unit ?? A;
518
+ }
519
+ }
520
+ function M(t) {
521
+ return t.map(({ queryRef: a, time: n, value: r }) => {
522
+ const o = new F(a.query, a.variable, a.tag), i = R.create(r.locale, o, r.rawValue);
523
+ return {
524
+ queryRef: o,
525
+ time: n,
526
+ value: i
527
+ };
528
+ });
529
+ }
530
+ class h extends Error {
531
+ constructor() {
532
+ super("Method is not implemented"), this.name = "NotImplementedError", this.message = "Method is not implemented", this.stack = "NotImplementedError: Method is not implemented";
533
+ }
534
+ }
535
+ class Xe {
536
+ constructor(e) {
537
+ u(this, "ontimerangechange", null);
538
+ u(this, "onvpnclientstatuschange", null);
539
+ u(this, "_getApiLinks");
540
+ u(this, "appData");
541
+ u(this, "componentBaseUrl");
542
+ u(this, "destroyed");
543
+ u(this, "mode");
544
+ u(this, "inputs");
545
+ u(this, "inputMap");
546
+ u(this, "timeRange");
547
+ u(this, "timeRangeIsAdjustable");
548
+ u(this, "vpnClientStatus");
549
+ this._getApiLinks = () => new Map(e._apiLinkEntries), this.appData = e.appData, this.componentBaseUrl = e.componentBaseUrl, this.destroyed = e.destroyed, this.mode = e.mode, this.inputs = e.inputs, this.inputMap = new Map(Object.entries(this.inputs)), this.timeRange = e.timeRange, this.timeRangeIsAdjustable = e.timeRangeIsAdjustable, this.vpnClientStatus = e.vpnClientStatus, this._messageHandler = this._messageHandler.bind(this), window.addEventListener("message", this._messageHandler, !1);
550
+ }
551
+ _messageHandler(e) {
552
+ if (e.source === window.parent)
553
+ switch (e.data.type) {
554
+ case s.TimeRangeChange:
555
+ this.ontimerangechange && this.ontimerangechange(...e.data.payload);
556
+ break;
557
+ case s.VpnClientStatusChange:
558
+ this.onvpnclientstatuschange && this.onvpnclientstatuschange(...e.data.payload);
559
+ break;
560
+ }
561
+ }
562
+ createBackendComponentClient() {
563
+ const e = crypto.randomUUID();
564
+ return window.parent.postMessage(
565
+ {
566
+ type: s.BackendComponentClientCreate,
567
+ payload: { clientId: e }
568
+ },
569
+ "*"
570
+ ), new Ye(e);
571
+ }
572
+ createLoggingDataClient() {
573
+ const e = crypto.randomUUID();
574
+ return window.parent.postMessage(
575
+ {
576
+ type: s.LoggingDataClientCreate,
577
+ payload: { clientId: e }
578
+ },
579
+ "*"
580
+ ), new Ze(e);
581
+ }
582
+ createObjectStorageClient() {
583
+ throw new h();
584
+ }
585
+ createResourceDataClient() {
586
+ const e = crypto.randomUUID();
587
+ return window.parent.postMessage(
588
+ {
589
+ type: s.ResourceDataClientCreate,
590
+ payload: { clientId: e }
591
+ },
592
+ "*"
593
+ ), new xe(e);
594
+ }
595
+ createTooltip() {
596
+ throw new h();
597
+ }
598
+ destroy() {
599
+ window.parent.postMessage({ type: s.Destroy }, "*"), window.removeEventListener("message", this._messageHandler, !1), this.destroyed = !0;
600
+ }
601
+ getApiUrl(e, a) {
602
+ const n = this._getApiLinks().get(e);
603
+ if (!n)
604
+ throw new Error("IxApiError: entry not found");
605
+ return a ? Object.keys(a).sort().reduce((r, o) => {
606
+ if (r.includes(`{${o}}`))
607
+ return r.replace(`{${o}}`, a[o]);
608
+ const i = new URL(r);
609
+ return i.searchParams.set(o, a[o]), decodeURIComponent(i.href);
610
+ }, n.href) : n.href;
611
+ }
612
+ navigateByUrl(e) {
613
+ window.parent.postMessage({ type: s.NavigateByUrl, payload: { url: e } }, "*");
614
+ }
615
+ openActionBottomSheet(e) {
616
+ return new Promise((a) => {
617
+ window.addEventListener("message", n, !1), window.parent.postMessage({ type: s.OpenActionBottomSheet, payload: { options: e } }, "*");
618
+ function n(r) {
619
+ r.source === window.parent && r.data.type === s.OpenActionBottomSheetResult && (window.removeEventListener("message", n, !1), a(r.data.payload.result));
620
+ }
621
+ });
622
+ }
623
+ openAlertDialog(e) {
624
+ return new Promise((a) => {
625
+ window.addEventListener("message", n, !1), window.parent.postMessage({ type: s.OpenAlertDialog, payload: { options: e } }, "*");
626
+ function n(r) {
627
+ r.source === window.parent && r.data.type === s.OpenAlertDialogResult && (window.removeEventListener("message", n, !1), a(r.data.payload.result));
628
+ }
629
+ });
630
+ }
631
+ openConfirmDialog(e) {
632
+ return new Promise((a) => {
633
+ window.addEventListener("message", n, !1), window.parent.postMessage({ type: s.OpenConfirmDialog, payload: { options: e } }, "*");
634
+ function n(r) {
635
+ r.source === window.parent && r.data.type === s.OpenConfirmDialogResult && (window.removeEventListener("message", n, !1), a(r.data.payload.result));
636
+ }
637
+ });
638
+ }
639
+ openFormDialog(e) {
640
+ return new Promise((a) => {
641
+ window.addEventListener("message", n, !1), window.parent.postMessage({ type: s.OpenFormDialog, payload: { options: e } }, "*");
642
+ function n(r) {
643
+ r.source === window.parent && r.data.type === s.OpenFormDialogResult && (window.removeEventListener("message", n, !1), a(r.data.payload.result));
644
+ }
645
+ });
646
+ }
647
+ saveAsFile() {
648
+ throw new h();
649
+ }
650
+ setTimeRange(e) {
651
+ window.parent.postMessage(
652
+ {
653
+ type: s.SetTimeRange,
654
+ payload: { timeRange: e }
655
+ },
656
+ "*"
657
+ );
658
+ }
659
+ showVpnStatusDetails(e) {
660
+ window.parent.postMessage(
661
+ {
662
+ type: s.ShowVpnStatusDetails,
663
+ payload: { agentId: e }
664
+ },
665
+ "*"
666
+ );
667
+ }
668
+ testVpnAccess() {
669
+ throw new h();
670
+ }
671
+ toggleVpn(e) {
672
+ window.parent.postMessage({ type: s.ToggleVpn, payload: { agentId: e } }, "*");
673
+ }
674
+ translate() {
675
+ throw new h();
676
+ }
677
+ }
678
+ class Ye {
679
+ constructor(e) {
680
+ this.id = e;
681
+ }
682
+ call(e, a) {
683
+ return new Promise((n) => {
684
+ const r = crypto.randomUUID();
685
+ window.addEventListener("message", o, !1), window.parent.postMessage({
686
+ type: s.BackendComponentClientCall,
687
+ payload: {
688
+ clientId: this.id,
689
+ callId: r,
690
+ functionName: e,
691
+ functionArguments: a
692
+ }
693
+ });
694
+ function o(i) {
695
+ i.source === window.parent && i.data.type === s.BackendComponentClientCallResult && i.data.payload.callId === r && (window.removeEventListener("message", o, !1), n(i.data.payload.result));
696
+ }
697
+ });
698
+ }
699
+ destroy() {
700
+ window.parent.postMessage(
701
+ {
702
+ type: s.BackendComponentClientDestroy,
703
+ payload: { clientId: this.id }
704
+ },
705
+ "*"
706
+ );
707
+ }
708
+ }
709
+ class Ze {
710
+ constructor(e) {
711
+ this.id = e;
712
+ }
713
+ query(e, a) {
714
+ const n = crypto.randomUUID();
715
+ return window.addEventListener("message", r, !1), window.parent.postMessage(
716
+ {
717
+ type: s.LoggingDataClientQuery,
718
+ payload: { clientId: this.id, queryId: n, query: e }
719
+ },
720
+ "*"
721
+ ), () => {
722
+ window.removeEventListener("message", r, !1);
723
+ };
724
+ function r(o) {
725
+ if (o.source === window.parent && o.data.type === s.LoggingDataClientQueryResult && o.data.payload.queryId === n) {
726
+ const { results: i } = o.data.payload;
727
+ if (e.length)
728
+ if (!e.queries || e.format !== "csv") {
729
+ const c = i.map((d) => M(d));
730
+ a(c);
731
+ } else
732
+ throw new h();
733
+ else {
734
+ const c = M(i);
735
+ a(c);
736
+ }
737
+ }
738
+ }
739
+ }
740
+ destroy() {
741
+ window.parent.postMessage(
742
+ {
743
+ type: s.LoggingDataClientDestroy,
744
+ payload: { clientId: this.id }
745
+ },
746
+ "*"
747
+ );
748
+ }
749
+ }
750
+ class xe {
751
+ constructor(e) {
752
+ this.id = e;
753
+ }
754
+ query(e, a) {
755
+ const n = crypto.randomUUID();
756
+ return window.addEventListener("message", r, !1), window.parent.postMessage(
757
+ {
758
+ type: s.ResourceDataClientQuery,
759
+ payload: { clientId: this.id, queryId: n, query: e }
760
+ },
761
+ "*"
762
+ ), () => {
763
+ window.removeEventListener("message", r, !1);
764
+ };
765
+ function r(o) {
766
+ o.source === window.parent && o.data.type === s.ResourceDataClientQueryResult && o.data.payload.queryId === n && a(o.data.payload.results);
767
+ }
768
+ }
769
+ update(e) {
770
+ return new Promise((a) => {
771
+ const n = crypto.randomUUID();
772
+ window.addEventListener("message", r, !1), window.parent.postMessage(
773
+ {
774
+ type: s.ResourceDataClientUpdate,
775
+ payload: { clientId: this.id, updateId: n, update: e }
776
+ },
777
+ "*"
778
+ );
779
+ function r(o) {
780
+ o.source === window.parent && o.data.type === s.ResourceDataClientUpdated && o.data.payload.updateId === n && (window.removeEventListener("message", r, !1), a());
781
+ }
782
+ });
783
+ }
784
+ render(e, a) {
785
+ const n = crypto.randomUUID();
786
+ return window.addEventListener("message", r, !1), window.parent.postMessage(
787
+ {
788
+ type: s.ResourceDataClientRender,
789
+ payload: { clientId: this.id, queryId: n, query: e }
790
+ },
791
+ "*"
792
+ ), () => {
793
+ window.removeEventListener("message", r, !1);
794
+ };
795
+ function r(o) {
796
+ o.source === window.parent && o.data.type === s.ResourceDataClientRenderResult && o.data.payload.queryId === n && a(o.data.payload.results);
797
+ }
798
+ }
799
+ destroy() {
800
+ window.parent.postMessage(
801
+ {
802
+ type: s.ResourceDataClientDestroy,
803
+ payload: { clientId: this.id }
804
+ },
805
+ "*"
806
+ );
807
+ }
808
+ }
809
+ function v(t) {
810
+ const e = !!(t && t.migrateInputs);
811
+ return !e && v.__cache__ ? Promise.resolve(v.__cache__) : new Promise((a) => {
812
+ window.addEventListener(
813
+ "message",
814
+ function n(r) {
815
+ if (r.source === window.parent && r.data && r.data.type === s.Created) {
816
+ let o = r.data.payload;
817
+ e && (o.inputs = t.migrateInputs(o.inputs, null));
818
+ const i = new Xe(o);
819
+ a(i), e || (v.__cache__ = i), window.removeEventListener("message", n, !1);
820
+ }
821
+ },
822
+ !1
823
+ ), window.parent.postMessage({ type: s.Create }, "*");
824
+ });
825
+ }
826
+ export {
827
+ at as connect,
828
+ v as getComponentContext
829
+ };