@kong-ui-public/entities-snis 3.4.9 → 3.5.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.
@@ -1,9 +1,9 @@
1
- import { defineComponent as X, ref as T, computed as x, watch as ye, renderSlot as se, createCommentVNode as Z, unref as y, toValue as Zn, onBeforeMount as dt, resolveComponent as B, openBlock as C, createBlock as D, resolveDynamicComponent as Se, withCtx as w, createElementVNode as L, toDisplayString as E, createElementBlock as q, withModifiers as at, createVNode as _, createTextVNode as Q, createSlots as Wt, withDirectives as ge, vShow as he, renderList as pt, Fragment as Yt, normalizeClass as Ee, withKeys as Gn, useSlots as Qn, useCssVars as Xn, inject as ei, onMounted as ti, onUnmounted as ni, normalizeStyle as Be, pushScopeId as Ke, popScopeId as Ve, Teleport as ii, reactive as kt } from "vue";
2
- import { createI18n as Jt, i18nTComponent as Zt } from "@kong-ui-public/i18n";
3
- import wt from "axios";
4
- import "@kong/kongponents";
5
- import { useRouter as Gt } from "vue-router";
6
- const ri = {
1
+ import { defineComponent as ce, ref as k, computed as v, watch as oe, onBeforeMount as de, resolveComponent as M, openBlock as b, createElementBlock as w, createVNode as g, unref as o, withCtx as d, createBlock as B, Teleport as ge, withDirectives as ye, createTextVNode as O, toDisplayString as S, vShow as ve, createElementVNode as re, Fragment as he, renderList as be, withModifiers as ke, reactive as se, createCommentVNode as _e } from "vue";
2
+ import { createI18n as Ie, i18nTComponent as Ce } from "@kong-ui-public/i18n";
3
+ import { useAxios as fe, useFetcher as Se, useDeleteUrlBuilder as Ee, FetcherStatus as Me, EntityBaseTable as $e, EntityFilter as xe, PermissionsWrapper as ae, EntityDeleteModal as De, EntityTypes as Fe, useErrors as Ne, EntityBaseFormType as ne, useDebouncedFilter as we, EntityBaseForm as Be, SupportedEntityType as Re, EntityFormSection as le } from "@kong-ui-public/entities-shared";
4
+ import { AddIcon as Ke } from "@kong/icons";
5
+ import { useRouter as Te } from "vue-router";
6
+ const qe = {
7
7
  create: "New SNI",
8
8
  copy_id: "Copy ID",
9
9
  copy_json: "Copy JSON",
@@ -11,10 +11,10 @@ const ri = {
11
11
  delete: "Delete",
12
12
  clear: "Clear",
13
13
  loading: "Loading..."
14
- }, ai = {
14
+ }, Pe = {
15
15
  placeholder: "Filter by exact name or ID",
16
16
  no_results: "No results found"
17
- }, oi = {
17
+ }, Ue = {
18
18
  title: "SNIs",
19
19
  list: {
20
20
  toolbar_actions: {
@@ -31,7 +31,7 @@ const ri = {
31
31
  description: "SNIs are used to map hostnames to a certificate."
32
32
  }
33
33
  }
34
- }, li = {
34
+ }, Oe = {
35
35
  sections: {
36
36
  general: {
37
37
  title: "General Information",
@@ -59,7 +59,7 @@ const ri = {
59
59
  footer: "Search by exact ID to find certificates not included in the list"
60
60
  }
61
61
  }
62
- }, si = {
62
+ }, Ve = {
63
63
  delete: "The SNI could not be deleted at this time.",
64
64
  general: "SNIs could not be retrieved",
65
65
  certificates: {
@@ -67,3726 +67,62 @@ const ri = {
67
67
  invalid: "Please select a valid certificate ID"
68
68
  },
69
69
  copy: "Failed to copy to clipboard"
70
- }, ci = {
70
+ }, je = {
71
71
  success: "Copied {val} to clipboard",
72
72
  success_brief: "Successfully copied to clipboard"
73
- }, ui = {
74
- actions: ri,
75
- search: ai,
76
- snis: oi,
77
- form: li,
73
+ }, Ae = {
74
+ actions: qe,
75
+ search: Pe,
76
+ snis: Ue,
77
+ form: Oe,
78
78
  delete: {
79
79
  title: "Delete an SNI",
80
80
  description: "This action cannot be reversed so make sure to check the SNI usage before deleting."
81
81
  },
82
- errors: si,
83
- copy: ci
82
+ errors: Ve,
83
+ copy: je
84
84
  };
85
- function di() {
86
- const e = Jt("en-us", ui);
85
+ function Le() {
86
+ const a = Ie("en-us", Ae);
87
87
  return {
88
- i18n: e,
89
- i18nT: Zt(e)
88
+ i18n: a,
89
+ i18nT: Ce(a)
90
90
  // Translation component <i18n-t>
91
91
  };
92
92
  }
93
- const Qt = {
94
- useI18n: di
95
- }, je = "/v2/control-planes/{controlPlaneId}/core-entities", Te = "/{workspace}", Fe = {
93
+ const ue = {
94
+ useI18n: Le
95
+ }, V = "/v2/control-planes/{controlPlaneId}/core-entities", j = "/{workspace}", A = {
96
96
  list: {
97
97
  konnect: {
98
- all: `${je}/snis`
98
+ all: `${V}/snis`
99
99
  },
100
100
  kongManager: {
101
- all: `${Te}/snis`
101
+ all: `${j}/snis`
102
102
  }
103
103
  },
104
104
  form: {
105
105
  konnect: {
106
- create: `${je}/snis`,
107
- edit: `${je}/snis/{id}`,
108
- validate: `${je}/v1/schemas/json/sni/validate`,
109
- certificates: `${je}/certificates`
106
+ create: `${V}/snis`,
107
+ edit: `${V}/snis/{id}`,
108
+ validate: `${V}/v1/schemas/json/sni/validate`,
109
+ certificates: `${V}/certificates`
110
110
  },
111
111
  kongManager: {
112
- create: `${Te}/snis`,
113
- edit: `${Te}/snis/{id}`,
114
- validate: `${Te}/schemas/snis/validate`,
115
- certificates: `${Te}/certificates`
112
+ create: `${j}/snis`,
113
+ edit: `${j}/snis/{id}`,
114
+ validate: `${j}/schemas/snis/validate`,
115
+ certificates: `${j}/certificates`
116
116
  }
117
117
  }
118
- };
119
- var Xt = /* @__PURE__ */ ((e) => (e.GatewayService = "service", e.Route = "route", e.Consumer = "consumer", e.ConsumerGroup = "consumer group", e.Plugin = "plugin", e.Upstream = "upstream", e.Certificate = "certificate", e.CACertificate = "ca certificate", e.SNI = "SNI", e.Key = "key", e.KeySet = "key set", e.Vault = "vault", e.Application = "application", e.Developer = "developer", e.acls = "ACL Credential", e["basic-auth"] = "Basic Auth Credential", e["key-auth"] = "Key Auth Credential", e["key-auth-enc"] = "Key Auth Encrypted Credential", e.oauth2 = "OAuth 2.0 Credential", e["hmac-auth"] = "HMAC Credential", e.jwt = "JWT Credential", e.Target = "target", e.Policy = "policy", e.Secret = "secret", e))(Xt || {}), Pe = /* @__PURE__ */ ((e) => (e.Edit = "edit", e.Create = "create", e))(Pe || {}), ke = /* @__PURE__ */ ((e) => (e[e.Loading = 0] = "Loading", e[e.Idle = 1] = "Idle", e[e.NoResults = 2] = "NoResults", e[e.Error = 3] = "Error", e))(ke || {}), Ze = /* @__PURE__ */ ((e) => (e.CaCertificate = "ca_certificate", e.Certificate = "certificate", e.Consumer = "consumer", e.ConsumerGroup = "consumer_group", e.GatewayService = "service", e.Key = "key", e.KeySet = "set", e.Plugin = "plugin", e.Route = "route", e.SNI = "sni", e.Upstream = "upstream", e.Target = "target", e.Vault = "vault", e.Other = "other", e))(Ze || {});
120
- const en = Object.values(Ze);
121
- function pi() {
122
- return {
123
- getAxiosInstance: (e = {}) => {
124
- try {
125
- const t = ei("get-axios-instance", void 0);
126
- return typeof t == "function" ? t(e) : wt.create({
127
- withCredentials: !0,
128
- timeout: 3e4,
129
- ...e
130
- });
131
- } catch (t) {
132
- return console.warn("getAxiosInstance:", t.message || t), wt.create({
133
- withCredentials: !0,
134
- timeout: 3e4,
135
- ...e
136
- });
137
- }
138
- },
139
- getTraceIdFromError: (e) => {
140
- var t;
141
- return ((t = e == null ? void 0 : e.response) == null ? void 0 : t.headers["x-datadog-trace-id"]) || "";
142
- }
143
- };
144
- }
145
- function fi() {
146
- return {
147
- debounce: (e, t) => {
148
- let n;
149
- return (...i) => {
150
- clearTimeout(n), n = window == null ? void 0 : window.setTimeout(() => {
151
- e(...i);
152
- }, t);
153
- };
154
- }
155
- };
156
- }
157
- const et = "khcp-user-table-preferences", gi = {
158
- pageSize: 30,
159
- sortColumnKey: void 0,
160
- sortColumnOrder: void 0,
161
- columnWidths: {},
162
- columnVisibility: {}
163
- };
164
- function hi() {
165
- const e = (n) => {
166
- if (typeof n == "string")
167
- try {
168
- return JSON.parse(n);
169
- } catch (i) {
170
- console.error("useTablePreferences(tryParseJson)", i);
171
- return;
172
- }
173
- }, t = () => {
174
- const n = e(localStorage.getItem(et));
175
- return !n || !Object.keys(n).length ? /* @__PURE__ */ new Map() : new Map(Object.entries(n));
176
- };
177
- return {
178
- setTablePreferences: (n, i) => {
179
- try {
180
- const r = t();
181
- r.set(n, i), localStorage.setItem(et, JSON.stringify(Object.fromEntries(r.entries())));
182
- } catch (r) {
183
- console.error("useTablePreferences(setTablePreferences)", r);
184
- }
185
- },
186
- getTablePreferences: (n) => {
187
- const i = t();
188
- return (i == null ? void 0 : i.get(n)) || void 0 || gi;
189
- },
190
- deleteAllTablePreferences: () => {
191
- localStorage.removeItem(et);
192
- }
193
- };
194
- }
195
- function ft(e = {}) {
196
- const { getAxiosInstance: t } = pi();
197
- return {
198
- axiosInstance: t(e)
199
- };
200
- }
201
- const mi = {
202
- actions: {
203
- copyId: "Copy ID",
204
- copied_id: 'Copied "{id}" to the clipboard',
205
- copyToClipboard: "Copied successfully!",
206
- copyToClipboardFailed: "Failed to copy to the clipboard"
207
- }
208
- }, yi = {
209
- message: "Are you sure you want to delete this {entityType}?",
210
- messageWithName: "Are you sure you want to delete this {entityType} {entityName}?"
211
- }, vi = {
212
- actions: {
213
- viewConfiguration: "View Configuration",
214
- save: "Save",
215
- cancel: "Cancel",
216
- back: "Back"
217
- },
218
- configuration: {
219
- title: "Configuration",
220
- message: "Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",
221
- yaml: "YAML",
222
- json: "JSON",
223
- terraform: "Terraform"
224
- },
225
- errors: {
226
- edit: "The entity could not be edited at this time."
227
- }
228
- }, bi = {
229
- emptyState: {
230
- noSearchResultsTitle: "No results found",
231
- noSearchResultsMessage: "Please adjust the criteria and try again.",
232
- noSearchResultsCtaText: "Clear"
233
- }
234
- }, ki = {
235
- title: "Configuration",
236
- actions: {
237
- copy: "Copy JSON"
238
- },
239
- sections: {
240
- advanced: "Advanced",
241
- plugin: "Plugin Specific Configuration"
242
- },
243
- commonFields: {
244
- id_label: "ID",
245
- name_label: "Name",
246
- enabled_label: "Enabled",
247
- enabled_tooltip: "Enabled is FTW",
248
- updated_at_label: "Last Updated",
249
- created_at_label: "Created",
250
- tags_label: "Tags",
251
- link: "Link"
252
- },
253
- statusBadge: {
254
- enabledLabel: "Enabled",
255
- disabledLabel: "Disabled"
256
- },
257
- copy: {
258
- tooltip: "Copy {label}",
259
- success: "Copied!"
260
- },
261
- errors: {
262
- load: "The entity configuration data could not be loaded at this time.",
263
- copy: "Failed to copy to clipboard"
264
- },
265
- general: {
266
- entryTitle: "Entry {index}",
267
- structuredFormat: "Structured"
268
- }
269
- }, wi = {
270
- filterButtonText: "Filter",
271
- fieldLabel: "Filter by:",
272
- inputPlaceholder: "Enter a value",
273
- selectPlaceholder: "Select an item",
274
- applyButtonText: "Apply",
275
- clearButtonText: "Clear",
276
- clearAllButtonText: "Clear all filters"
277
- }, Ci = {
278
- errors: {
279
- fetch: "Could not fetch available items",
280
- invalid: "Please select a valid value"
281
- }
282
- }, Si = {
283
- unexpected: "An unexpected error has occurred",
284
- dataKeyUndefined: 'The data key "{dataKey}" does not exist in the response.'
285
- }, xi = {
286
- utf8Name: "The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."
287
- }, Ii = {
288
- enable: {
289
- title: "Enable {entityType}",
290
- message: "Are you sure you want to enable the {entityType} {entityName}?",
291
- confirmText: "Yes, enable"
292
- },
293
- disable: {
294
- title: "Disable {entityType}",
295
- message: "Are you sure you want to disable the {entityType} {entityName}?",
296
- confirmText: "Yes, disable"
297
- }
298
- }, Ai = {
299
- global: mi,
300
- deleteModal: yi,
301
- baseForm: vi,
302
- baseTable: bi,
303
- baseConfigCard: ki,
304
- filter: wi,
305
- debouncedFilter: Ci,
306
- errors: Si,
307
- validationErrors: xi,
308
- toggleModal: Ii
309
- };
310
- function Ge() {
311
- const e = Jt("en-us", Ai);
312
- return {
313
- i18n: e,
314
- i18nT: Zt(e)
315
- // Translation component <i18n-t>
316
- };
317
- }
318
- function tn() {
319
- const e = (n, i) => (i == null ? void 0 : i[n]) ?? void 0, t = (n, i) => {
320
- if (n.length !== i.length) return !1;
321
- const r = /* @__PURE__ */ new Set([...n, ...i]);
322
- for (const o of r) {
323
- const a = n.filter((s) => s === o).length, l = i.filter((s) => s === o).length;
324
- if (a !== l) return !1;
325
- }
326
- return !0;
327
- };
328
- return {
329
- getPropValue: e,
330
- objectsAreEqual: (n, i, r) => {
331
- if (r) {
332
- if (Object.keys(n).length === Object.keys(i).length)
333
- for (const o in n)
334
- if (Array.isArray(n[o]) && Array.isArray(i[o])) {
335
- if (t(n[o], i[o]))
336
- continue;
337
- return !1;
338
- } else {
339
- if (n[o] === i[o])
340
- continue;
341
- return !1;
342
- }
343
- else
344
- return !1;
345
- return !0;
346
- }
347
- try {
348
- return JSON.stringify(n) === JSON.stringify(i);
349
- } catch {
350
- return !1;
351
- }
352
- },
353
- sortAlpha: (n) => (i, r) => {
354
- let o = i[n] === void 0 || i[n] === null ? "" : i[n], a = r[n] === void 0 || r[n] === null ? "" : r[n];
355
- return Array.isArray(i[n]) && (o = i[n][0]), Array.isArray(r[n]) && (a = r[n][0]), o.localeCompare(a);
356
- },
357
- isValidUuid: (n) => n ? /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n) : !1
358
- };
359
- }
360
- function _i(e, t, n, i = {
361
- fetchedItemsKey: "data",
362
- searchKeys: ["id"]
363
- }) {
364
- n || (n = "1000");
365
- const { axiosInstance: r } = ft(e.axiosRequestConfig), { i18n: { t: o } } = Ge(), { debounce: a } = fi(), l = a(async (N) => {
366
- await v(N);
367
- }, 200), s = T(!1), d = T(""), u = T(""), c = T([]), f = T([]), p = T(void 0), g = x(() => {
368
- const N = `${e.apiBaseUrl}${y(t)}`;
369
- return e.app === "konnect" ? N.replace(/{controlPlaneId}/gi, (e == null ? void 0 : e.controlPlaneId) || "") : e.app === "kongManager" ? N.replace(/\/{workspace}/gi, e != null && e.workspace ? `/${e.workspace}` : "") : N;
370
- }), { isValidUuid: k } = tn(), b = async () => {
371
- try {
372
- s.value = !0;
373
- const { data: N } = await r.get(`${g.value}?size=${n}`);
374
- N != null && N.next || (p.value = i.fetchedItemsKey in N ? N[i.fetchedItemsKey] : []), f.value = i.fetchedItemsKey in N ? N[i.fetchedItemsKey] : [], c.value = f.value;
375
- } catch {
376
- c.value = [], d.value = o("debouncedFilter.errors.fetch");
377
- } finally {
378
- s.value = !1;
379
- }
380
- }, I = T(""), v = async (N) => {
381
- var O, $, m;
382
- if (I.value !== N) {
383
- if (I.value = N ?? "", !N) {
384
- c.value = f.value;
385
- return;
386
- }
387
- if (p.value === void 0)
388
- try {
389
- if (s.value = !0, d.value = "", u.value = "", e.app === "konnect") {
390
- const h = `${g.value}/${N}`, { data: R } = await r.get(`${h}?size=${n}`);
391
- i.fetchedItemsKey in R ? c.value = R[i.fetchedItemsKey] : R != null && R[i.exactMatchKey ?? "id"] ? c.value = [R] : c.value = [];
392
- } else {
393
- const h = [];
394
- k(N) && i.searchKeys.includes("id") ? h.push((async () => {
395
- const { data: U } = await r.get(`${g.value}/${N}`);
396
- return [U[i.fetchedItemsKey] ?? U];
397
- })()) : h.push(
398
- ...i.searchKeys.filter((U) => U !== "id").map(async (U) => {
399
- const { data: G } = await r.get(`${g.value}?${U}=${N}`);
400
- return G[i.fetchedItemsKey];
401
- })
402
- );
403
- const R = await Promise.all(h), F = /* @__PURE__ */ new Set();
404
- c.value = [], (O = R == null ? void 0 : R.forEach) == null || O.call(R, (U) => {
405
- var G;
406
- (G = U == null ? void 0 : U.forEach) == null || G.call(U, (K) => {
407
- F.has(K.id) || (F.add(K.id), c.value.push(K));
408
- });
409
- });
410
- }
411
- } catch (h) {
412
- (($ = h == null ? void 0 : h.response) == null ? void 0 : $.status) === 404 ? u.value = o("debouncedFilter.errors.invalid") : (c.value = [], d.value = o("debouncedFilter.errors.fetch"));
413
- } finally {
414
- s.value = !1;
415
- }
416
- else
417
- s.value = !0, u.value = "", c.value = (m = p.value) == null ? void 0 : m.filter((h) => {
418
- var R;
419
- let F = !1;
420
- for (const U of i.searchKeys) {
421
- const G = typeof h[U] == "string" ? (R = h[U]) == null ? void 0 : R.toLowerCase() : h[U];
422
- G != null && G.includes(N.toLowerCase()) && (F = !0);
423
- }
424
- return F;
425
- }), (!c.value || !c.value.length) && (u.value = o("debouncedFilter.errors.invalid")), s.value = !1;
426
- }
427
- };
428
- return {
429
- loading: s,
430
- error: d,
431
- validationError: u,
432
- results: c,
433
- allRecords: p,
434
- loadItems: b,
435
- debouncedQueryChange: l
436
- };
437
- }
438
- function $i(e, t) {
439
- const n = y(t), i = x(
440
- () => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${n}`) : new URL(n)
441
- );
442
- return i.value.search = "", (r) => `${i.value.href}/${r}`;
443
- }
444
- function Ni() {
445
- const { i18n: { t: e } } = Ge();
446
- return {
447
- getMessageFromError: (t) => {
448
- var n, i, r, o;
449
- if (!t)
450
- return e("errors.unexpected");
451
- if (((n = t == null ? void 0 : t.response) == null ? void 0 : n.status) === 401)
452
- return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."), "";
453
- if ((i = t == null ? void 0 : t.response) != null && i.data) {
454
- if (t.response.data.detail)
455
- return t.response.data.detail;
456
- if ((r = t.response.data.details) != null && r.length)
457
- return t.response.data.details.map((a) => {
458
- let l = e("errors.unexpected");
459
- return a.messages && typeof a.messages == "object" && a.messages.length && (l = a.messages.join(", ")), a.field ? `${a.field} - ${l}` : l;
460
- }).join("; ");
461
- if (t.response.data.message) {
462
- const { message: a } = t.response.data;
463
- return Array.isArray(a) ? (o = a[0]) != null && o.constraints ? Object.values(a[0].constraints)[0] : a[0] : a;
464
- }
465
- if (typeof t.response.data == "string")
466
- return t.response.data;
467
- if (typeof t.response.data == "object")
468
- return Object.keys(t.response.data).map((a) => `${a} ${t.response.data[a]}`).join(", ");
469
- }
470
- return t.message || e("errors.unexpected");
471
- }
472
- };
473
- }
474
- function Oi(e) {
475
- const t = window.location.origin, n = t.endsWith("/") ? t : `${t}/`;
476
- try {
477
- const i = e.join("/"), r = `${n}${i}`, o = e.some((a) => a.trim() === "");
478
- if (/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(r) && !o && new URL(r))
479
- return `${n}${i}`;
480
- throw new Error("Invalid url");
481
- } catch (i) {
482
- return console.warn("Failed to build valid URL:", i), "";
483
- }
484
- }
485
- function nn(e, t) {
486
- const n = T(y(e)), i = T(y(t)), r = x(
487
- () => !!(n.value.app === "konnect" || n.value.isExactMatch)
488
- ), o = x(
489
- () => i.value.startsWith("/") ? new URL(`${window.location.origin}${i.value}`) : new URL(i.value)
490
- );
491
- return (a) => {
492
- const { page: l, pageSize: s, offset: d, sortColumnKey: u, sortColumnOrder: c, query: f } = a;
493
- try {
494
- let p = new URL(o.value.href);
495
- return r.value && f ? (p.search = "", p = n.value.isExactMatch ? new URL(`${p.href}/${f}/`) : new URL(`${p.href}?filter[name][contains]=${f}`)) : (r.value || new URLSearchParams(f).forEach((g, k) => {
496
- p.searchParams.append(k, g);
497
- }), u && p.searchParams.append("sort_by", u), c === "desc" && p.searchParams.append("sort_desc", "1"), p.searchParams.append("size", String(s))), d && l !== 1 && p.searchParams.append("offset", String(d)), p.href;
498
- } catch (p) {
499
- return console.error("RouteList(fetcher)", p), i.value;
500
- }
501
- };
502
- }
503
- function ji(e, t, n) {
504
- const i = y(t), { axiosInstance: r } = ft(e.axiosRequestConfig), o = nn(e, i), a = T({
505
- status: ke.Idle
506
- });
507
- return { fetcher: async (l) => {
508
- var s;
509
- const d = Zn(n) || "data";
510
- try {
511
- a.value = { status: ke.Loading };
512
- let u = o(l);
513
- u.includes("filter[name]") && (u = `${u}&page[size]=${l.pageSize}&page[number]=${l.page}`);
514
- const c = await r.get(u);
515
- if (c.status >= 400)
516
- throw c;
517
- const f = c.data, p = d && d.replace(/[^\w-_]/gi, "");
518
- let g;
519
- f[p] ? g = Array.isArray(f[p]) ? f[p] : [f[p]] : Array.isArray(f) ? g = f : g = Object.keys(f).length ? [f] : [];
520
- const k = {
521
- data: g,
522
- total: g.length,
523
- ...f.offset ? {
524
- pagination: {
525
- offset: f.offset
526
- }
527
- } : null
528
- };
529
- return a.value = {
530
- status: ke.Idle,
531
- response: k
532
- }, k;
533
- } catch (u) {
534
- const c = {
535
- data: [],
536
- total: 0
537
- };
538
- return l.query && (((s = u.response) == null ? void 0 : s.status) === 404 || u.status === 404) ? (a.value = {
539
- status: ke.NoResults,
540
- response: c,
541
- error: u.response ? u : { response: u }
542
- }, c) : (a.value = {
543
- status: ke.Error,
544
- response: c,
545
- error: u.response ? u : { response: u }
546
- }, c);
547
- }
548
- }, fetcherState: a };
549
- }
550
- function Ti() {
551
- const e = (n, i = "_") => n ? n.split(i).map((r) => r.toLowerCase() === "id" ? r.toUpperCase() : r.charAt(0).toUpperCase() + r.substring(1)).join(" ") : "", t = /(?:^|[\s-:'"])\w/g;
552
- return {
553
- capitalize: (n) => n ? n.replace(t, (i) => i.toUpperCase()) : "",
554
- convertKeyToTitle: e
555
- };
556
- }
557
- const rn = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ct = (e) => {
558
- if (typeof e != "string")
559
- throw new TypeError("Invalid argument expected string");
560
- const t = e.match(rn);
561
- if (!t)
562
- throw new Error(`Invalid argument not valid semver ('${e}' received)`);
563
- return t.shift(), t;
564
- }, St = (e) => e === "*" || e === "x" || e === "X", xt = (e) => {
565
- const t = parseInt(e, 10);
566
- return isNaN(t) ? e : t;
567
- }, Fi = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], Mi = (e, t) => {
568
- if (St(e) || St(t))
569
- return 0;
570
- const [n, i] = Fi(xt(e), xt(t));
571
- return n > i ? 1 : n < i ? -1 : 0;
572
- }, It = (e, t) => {
573
- for (let n = 0; n < Math.max(e.length, t.length); n++) {
574
- const i = Mi(e[n] || "0", t[n] || "0");
575
- if (i !== 0)
576
- return i;
577
- }
578
- return 0;
579
- }, Ei = (e, t) => {
580
- const n = Ct(e), i = Ct(t), r = n.pop(), o = i.pop(), a = It(n, i);
581
- return a !== 0 ? a : r && o ? It(r.split("."), o.split(".")) : r || o ? r ? -1 : 1 : 0;
582
- }, At = (e, t, n) => {
583
- qi(n);
584
- const i = Ei(e, t);
585
- return an[n].includes(i);
586
- }, an = {
587
- ">": [1],
588
- ">=": [0, 1],
589
- "=": [0],
590
- "<=": [-1, 0],
591
- "<": [-1],
592
- "!=": [-1, 1]
593
- }, _t = Object.keys(an), qi = (e) => {
594
- if (typeof e != "string")
595
- throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);
596
- if (_t.indexOf(e) === -1)
597
- throw new Error(`Invalid operator, expected one of ${_t.join("|")}`);
598
- }, Li = (e) => typeof e == "string" && /^[v\d]/.test(e) && rn.test(e);
599
- function Ri(e) {
600
- const { gatewayInfo: t, supportedRange: n } = e;
601
- if (!t)
602
- return !0;
603
- const { edition: i, version: r } = t;
604
- if (!Li(r))
605
- return console.error("Invalid version"), !1;
606
- const o = n[i];
607
- if (!o)
608
- return !1;
609
- const [a, l] = o;
610
- return !(a && At(r, a, "<") || l && At(r, l, ">"));
611
- }
612
- function Ui(e) {
613
- const t = T(0), n = T(0), i = T(!1);
614
- return ye(e, (r) => {
615
- r && !i.value && (t.value = r.offsetWidth, n.value = r.scrollWidth, i.value = !0);
616
- }), {
617
- isTruncated: x(() => t.value < n.value)
618
- };
619
- }
620
- function Bi() {
621
- const { i18n: { t: e } } = Ge();
622
- return {
623
- utf8Name: (t) => /^[\p{N}\p{L}.\-_~]*$/u.test(t) ? "" : e("validationErrors.utf8Name")
624
- };
625
- }
626
- const we = {
627
- useAxios: ft,
628
- useDebouncedFilter: _i,
629
- useDeleteUrlBuilder: $i,
630
- useErrors: Ni,
631
- useExternalLinkCreator: Oi,
632
- useFetcher: ji,
633
- useFetchUrlBuilder: nn,
634
- useHelpers: tn,
635
- useStringHelpers: Ti,
636
- useI18n: Ge,
637
- useGatewayFeatureSupported: Ri,
638
- useTruncationDetector: Ui,
639
- useValidators: Bi
640
- }, Oe = (e, t) => {
641
- const n = e.__vccOpts || e;
642
- for (const [i, r] of t)
643
- n[i] = r;
644
- return n;
645
- }, Ki = "#0044f4", Vi = "#afb7c5", Di = { class: "json-config" }, Pi = {
646
- key: 0,
647
- class: "json-endpoint"
648
- }, zi = /* @__PURE__ */ X({
649
- __name: "JsonCodeBlock",
650
- props: {
651
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
652
- config: {
653
- type: Object,
654
- required: !1,
655
- default: () => ({})
656
- },
657
- /** Fetcher url for the entity with the filled-in controlPlaneId, workspace, and entity id. */
658
- fetcherUrl: {
659
- type: String,
660
- required: !1,
661
- default: ""
662
- },
663
- /** A record to indicate the entity's configuration, used to populate the JSON code block */
664
- entityRecord: {
665
- type: Object,
666
- required: !0
667
- },
668
- /** HTTP request method like GET, POST, PUT, used to make the api call. */
669
- requestMethod: {
670
- type: String,
671
- required: !1,
672
- default: ""
673
- }
674
- },
675
- setup(e) {
676
- Xn((r) => ({
677
- "454fa8c4": `${i.value}ch`
678
- }));
679
- const t = e, n = x(() => t.entityRecord), i = x(() => {
680
- var r;
681
- if (!t.fetcherUrl)
682
- return 0;
683
- const o = (r = t.fetcherUrl) == null ? void 0 : r.split("/");
684
- return o.length < 2 ? 0 : 41 + (t.requestMethod === "post" ? o[o.length - 1] : o[o.length - 2]).length;
685
- });
686
- return (r, o) => {
687
- const a = B("KBadge"), l = B("KCodeBlock");
688
- return C(), q("div", Di, [
689
- t.fetcherUrl ? (C(), q("div", Pi, [
690
- _(a, {
691
- appearance: t.requestMethod
692
- }, {
693
- default: w(() => [
694
- Q(E(t.requestMethod), 1)
695
- ]),
696
- _: 1
697
- }, 8, ["appearance"]),
698
- _(l, {
699
- id: "json-endpoint-codeblock",
700
- code: t.fetcherUrl,
701
- language: "json",
702
- "single-line": "",
703
- theme: "dark"
704
- }, null, 8, ["code"])
705
- ])) : Z("", !0),
706
- t.entityRecord ? (C(), D(l, {
707
- key: 1,
708
- id: "json-codeblock",
709
- class: Ee({ "json-content": t.fetcherUrl }),
710
- code: JSON.stringify(n.value, null, 2),
711
- language: "json",
712
- theme: "dark"
713
- }, null, 8, ["class", "code"])) : Z("", !0)
714
- ]);
715
- };
716
- }
717
- });
718
- /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
719
- function on(e) {
720
- return typeof e > "u" || e === null;
721
- }
722
- function Hi(e) {
723
- return typeof e == "object" && e !== null;
724
- }
725
- function Wi(e) {
726
- return Array.isArray(e) ? e : on(e) ? [] : [e];
727
- }
728
- function Yi(e, t) {
729
- var n, i, r, o;
730
- if (t)
731
- for (o = Object.keys(t), n = 0, i = o.length; n < i; n += 1)
732
- r = o[n], e[r] = t[r];
733
- return e;
734
- }
735
- function Ji(e, t) {
736
- var n = "", i;
737
- for (i = 0; i < t; i += 1)
738
- n += e;
739
- return n;
740
- }
741
- function Zi(e) {
742
- return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
743
- }
744
- var Gi = on, Qi = Hi, Xi = Wi, er = Ji, tr = Zi, nr = Yi, J = {
745
- isNothing: Gi,
746
- isObject: Qi,
747
- toArray: Xi,
748
- repeat: er,
749
- isNegativeZero: tr,
750
- extend: nr
751
- };
752
- function ln(e, t) {
753
- var n = "", i = e.reason || "(unknown reason)";
754
- return e.mark ? (e.mark.name && (n += 'in "' + e.mark.name + '" '), n += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !t && e.mark.snippet && (n += `
755
-
756
- ` + e.mark.snippet), i + " " + n) : i;
757
- }
758
- function qe(e, t) {
759
- Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = t, this.message = ln(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
760
- }
761
- qe.prototype = Object.create(Error.prototype);
762
- qe.prototype.constructor = qe;
763
- qe.prototype.toString = function(e) {
764
- return this.name + ": " + ln(this, e);
765
- };
766
- var ae = qe;
767
- function tt(e, t, n, i, r) {
768
- var o = "", a = "", l = Math.floor(r / 2) - 1;
769
- return i - t > l && (o = " ... ", t = i - l + o.length), n - i > l && (a = " ...", n = i + l - a.length), {
770
- str: o + e.slice(t, n).replace(/\t/g, "→") + a,
771
- pos: i - t + o.length
772
- // relative position
773
- };
774
- }
775
- function nt(e, t) {
776
- return J.repeat(" ", t - e.length) + e;
777
- }
778
- function ir(e, t) {
779
- if (t = Object.create(t || null), !e.buffer) return null;
780
- t.maxLength || (t.maxLength = 79), typeof t.indent != "number" && (t.indent = 1), typeof t.linesBefore != "number" && (t.linesBefore = 3), typeof t.linesAfter != "number" && (t.linesAfter = 2);
781
- for (var n = /\r?\n|\r|\0/g, i = [0], r = [], o, a = -1; o = n.exec(e.buffer); )
782
- r.push(o.index), i.push(o.index + o[0].length), e.position <= o.index && a < 0 && (a = i.length - 2);
783
- a < 0 && (a = i.length - 1);
784
- var l = "", s, d, u = Math.min(e.line + t.linesAfter, r.length).toString().length, c = t.maxLength - (t.indent + u + 3);
785
- for (s = 1; s <= t.linesBefore && !(a - s < 0); s++)
786
- d = tt(
787
- e.buffer,
788
- i[a - s],
789
- r[a - s],
790
- e.position - (i[a] - i[a - s]),
791
- c
792
- ), l = J.repeat(" ", t.indent) + nt((e.line - s + 1).toString(), u) + " | " + d.str + `
793
- ` + l;
794
- for (d = tt(e.buffer, i[a], r[a], e.position, c), l += J.repeat(" ", t.indent) + nt((e.line + 1).toString(), u) + " | " + d.str + `
795
- `, l += J.repeat("-", t.indent + u + 3 + d.pos) + `^
796
- `, s = 1; s <= t.linesAfter && !(a + s >= r.length); s++)
797
- d = tt(
798
- e.buffer,
799
- i[a + s],
800
- r[a + s],
801
- e.position - (i[a] - i[a + s]),
802
- c
803
- ), l += J.repeat(" ", t.indent) + nt((e.line + s + 1).toString(), u) + " | " + d.str + `
804
- `;
805
- return l.replace(/\n$/, "");
806
- }
807
- var rr = ir, ar = [
808
- "kind",
809
- "multi",
810
- "resolve",
811
- "construct",
812
- "instanceOf",
813
- "predicate",
814
- "represent",
815
- "representName",
816
- "defaultStyle",
817
- "styleAliases"
818
- ], or = [
819
- "scalar",
820
- "sequence",
821
- "mapping"
822
- ];
823
- function lr(e) {
824
- var t = {};
825
- return e !== null && Object.keys(e).forEach(function(n) {
826
- e[n].forEach(function(i) {
827
- t[String(i)] = n;
828
- });
829
- }), t;
830
- }
831
- function sr(e, t) {
832
- if (t = t || {}, Object.keys(t).forEach(function(n) {
833
- if (ar.indexOf(n) === -1)
834
- throw new ae('Unknown option "' + n + '" is met in definition of "' + e + '" YAML type.');
835
- }), this.options = t, this.tag = e, this.kind = t.kind || null, this.resolve = t.resolve || function() {
836
- return !0;
837
- }, this.construct = t.construct || function(n) {
838
- return n;
839
- }, this.instanceOf = t.instanceOf || null, this.predicate = t.predicate || null, this.represent = t.represent || null, this.representName = t.representName || null, this.defaultStyle = t.defaultStyle || null, this.multi = t.multi || !1, this.styleAliases = lr(t.styleAliases || null), or.indexOf(this.kind) === -1)
840
- throw new ae('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
841
- }
842
- var te = sr;
843
- function $t(e, t) {
844
- var n = [];
845
- return e[t].forEach(function(i) {
846
- var r = n.length;
847
- n.forEach(function(o, a) {
848
- o.tag === i.tag && o.kind === i.kind && o.multi === i.multi && (r = a);
849
- }), n[r] = i;
850
- }), n;
851
- }
852
- function cr() {
853
- var e = {
854
- scalar: {},
855
- sequence: {},
856
- mapping: {},
857
- fallback: {},
858
- multi: {
859
- scalar: [],
860
- sequence: [],
861
- mapping: [],
862
- fallback: []
863
- }
864
- }, t, n;
865
- function i(r) {
866
- r.multi ? (e.multi[r.kind].push(r), e.multi.fallback.push(r)) : e[r.kind][r.tag] = e.fallback[r.tag] = r;
867
- }
868
- for (t = 0, n = arguments.length; t < n; t += 1)
869
- arguments[t].forEach(i);
870
- return e;
871
- }
872
- function ot(e) {
873
- return this.extend(e);
874
- }
875
- ot.prototype.extend = function(e) {
876
- var t = [], n = [];
877
- if (e instanceof te)
878
- n.push(e);
879
- else if (Array.isArray(e))
880
- n = n.concat(e);
881
- else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit)))
882
- e.implicit && (t = t.concat(e.implicit)), e.explicit && (n = n.concat(e.explicit));
883
- else
884
- throw new ae("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
885
- t.forEach(function(r) {
886
- if (!(r instanceof te))
887
- throw new ae("Specified list of YAML types (or a single Type object) contains a non-Type object.");
888
- if (r.loadKind && r.loadKind !== "scalar")
889
- throw new ae("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
890
- if (r.multi)
891
- throw new ae("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
892
- }), n.forEach(function(r) {
893
- if (!(r instanceof te))
894
- throw new ae("Specified list of YAML types (or a single Type object) contains a non-Type object.");
895
- });
896
- var i = Object.create(ot.prototype);
897
- return i.implicit = (this.implicit || []).concat(t), i.explicit = (this.explicit || []).concat(n), i.compiledImplicit = $t(i, "implicit"), i.compiledExplicit = $t(i, "explicit"), i.compiledTypeMap = cr(i.compiledImplicit, i.compiledExplicit), i;
898
- };
899
- var sn = ot, cn = new te("tag:yaml.org,2002:str", {
900
- kind: "scalar",
901
- construct: function(e) {
902
- return e !== null ? e : "";
903
- }
904
- }), un = new te("tag:yaml.org,2002:seq", {
905
- kind: "sequence",
906
- construct: function(e) {
907
- return e !== null ? e : [];
908
- }
909
- }), dn = new te("tag:yaml.org,2002:map", {
910
- kind: "mapping",
911
- construct: function(e) {
912
- return e !== null ? e : {};
913
- }
914
- }), pn = new sn({
915
- explicit: [
916
- cn,
917
- un,
918
- dn
919
- ]
920
- });
921
- function ur(e) {
922
- if (e === null) return !0;
923
- var t = e.length;
924
- return t === 1 && e === "~" || t === 4 && (e === "null" || e === "Null" || e === "NULL");
925
- }
926
- function dr() {
927
- return null;
928
- }
929
- function pr(e) {
930
- return e === null;
931
- }
932
- var fn = new te("tag:yaml.org,2002:null", {
933
- kind: "scalar",
934
- resolve: ur,
935
- construct: dr,
936
- predicate: pr,
937
- represent: {
938
- canonical: function() {
939
- return "~";
940
- },
941
- lowercase: function() {
942
- return "null";
943
- },
944
- uppercase: function() {
945
- return "NULL";
946
- },
947
- camelcase: function() {
948
- return "Null";
949
- },
950
- empty: function() {
951
- return "";
952
- }
953
- },
954
- defaultStyle: "lowercase"
955
- });
956
- function fr(e) {
957
- if (e === null) return !1;
958
- var t = e.length;
959
- return t === 4 && (e === "true" || e === "True" || e === "TRUE") || t === 5 && (e === "false" || e === "False" || e === "FALSE");
960
- }
961
- function gr(e) {
962
- return e === "true" || e === "True" || e === "TRUE";
963
- }
964
- function hr(e) {
965
- return Object.prototype.toString.call(e) === "[object Boolean]";
966
- }
967
- var gn = new te("tag:yaml.org,2002:bool", {
968
- kind: "scalar",
969
- resolve: fr,
970
- construct: gr,
971
- predicate: hr,
972
- represent: {
973
- lowercase: function(e) {
974
- return e ? "true" : "false";
975
- },
976
- uppercase: function(e) {
977
- return e ? "TRUE" : "FALSE";
978
- },
979
- camelcase: function(e) {
980
- return e ? "True" : "False";
981
- }
982
- },
983
- defaultStyle: "lowercase"
984
- });
985
- function mr(e) {
986
- return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
987
- }
988
- function yr(e) {
989
- return 48 <= e && e <= 55;
990
- }
991
- function vr(e) {
992
- return 48 <= e && e <= 57;
993
- }
994
- function br(e) {
995
- if (e === null) return !1;
996
- var t = e.length, n = 0, i = !1, r;
997
- if (!t) return !1;
998
- if (r = e[n], (r === "-" || r === "+") && (r = e[++n]), r === "0") {
999
- if (n + 1 === t) return !0;
1000
- if (r = e[++n], r === "b") {
1001
- for (n++; n < t; n++)
1002
- if (r = e[n], r !== "_") {
1003
- if (r !== "0" && r !== "1") return !1;
1004
- i = !0;
1005
- }
1006
- return i && r !== "_";
1007
- }
1008
- if (r === "x") {
1009
- for (n++; n < t; n++)
1010
- if (r = e[n], r !== "_") {
1011
- if (!mr(e.charCodeAt(n))) return !1;
1012
- i = !0;
1013
- }
1014
- return i && r !== "_";
1015
- }
1016
- if (r === "o") {
1017
- for (n++; n < t; n++)
1018
- if (r = e[n], r !== "_") {
1019
- if (!yr(e.charCodeAt(n))) return !1;
1020
- i = !0;
1021
- }
1022
- return i && r !== "_";
1023
- }
1024
- }
1025
- if (r === "_") return !1;
1026
- for (; n < t; n++)
1027
- if (r = e[n], r !== "_") {
1028
- if (!vr(e.charCodeAt(n)))
1029
- return !1;
1030
- i = !0;
1031
- }
1032
- return !(!i || r === "_");
1033
- }
1034
- function kr(e) {
1035
- var t = e, n = 1, i;
1036
- if (t.indexOf("_") !== -1 && (t = t.replace(/_/g, "")), i = t[0], (i === "-" || i === "+") && (i === "-" && (n = -1), t = t.slice(1), i = t[0]), t === "0") return 0;
1037
- if (i === "0") {
1038
- if (t[1] === "b") return n * parseInt(t.slice(2), 2);
1039
- if (t[1] === "x") return n * parseInt(t.slice(2), 16);
1040
- if (t[1] === "o") return n * parseInt(t.slice(2), 8);
1041
- }
1042
- return n * parseInt(t, 10);
1043
- }
1044
- function wr(e) {
1045
- return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !J.isNegativeZero(e);
1046
- }
1047
- var hn = new te("tag:yaml.org,2002:int", {
1048
- kind: "scalar",
1049
- resolve: br,
1050
- construct: kr,
1051
- predicate: wr,
1052
- represent: {
1053
- binary: function(e) {
1054
- return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
1055
- },
1056
- octal: function(e) {
1057
- return e >= 0 ? "0o" + e.toString(8) : "-0o" + e.toString(8).slice(1);
1058
- },
1059
- decimal: function(e) {
1060
- return e.toString(10);
1061
- },
1062
- /* eslint-disable max-len */
1063
- hexadecimal: function(e) {
1064
- return e >= 0 ? "0x" + e.toString(16).toUpperCase() : "-0x" + e.toString(16).toUpperCase().slice(1);
1065
- }
1066
- },
1067
- defaultStyle: "decimal",
1068
- styleAliases: {
1069
- binary: [2, "bin"],
1070
- octal: [8, "oct"],
1071
- decimal: [10, "dec"],
1072
- hexadecimal: [16, "hex"]
1073
- }
1074
- }), Cr = new RegExp(
1075
- // 2.5e4, 2.5 and integers
1076
- "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
1077
- );
1078
- function Sr(e) {
1079
- return !(e === null || !Cr.test(e) || // Quick hack to not allow integers end with `_`
1080
- // Probably should update regexp & check speed
1081
- e[e.length - 1] === "_");
1082
- }
1083
- function xr(e) {
1084
- var t, n;
1085
- return t = e.replace(/_/g, "").toLowerCase(), n = t[0] === "-" ? -1 : 1, "+-".indexOf(t[0]) >= 0 && (t = t.slice(1)), t === ".inf" ? n === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : t === ".nan" ? NaN : n * parseFloat(t, 10);
1086
- }
1087
- var Ir = /^[-+]?[0-9]+e/;
1088
- function Ar(e, t) {
1089
- var n;
1090
- if (isNaN(e))
1091
- switch (t) {
1092
- case "lowercase":
1093
- return ".nan";
1094
- case "uppercase":
1095
- return ".NAN";
1096
- case "camelcase":
1097
- return ".NaN";
1098
- }
1099
- else if (Number.POSITIVE_INFINITY === e)
1100
- switch (t) {
1101
- case "lowercase":
1102
- return ".inf";
1103
- case "uppercase":
1104
- return ".INF";
1105
- case "camelcase":
1106
- return ".Inf";
1107
- }
1108
- else if (Number.NEGATIVE_INFINITY === e)
1109
- switch (t) {
1110
- case "lowercase":
1111
- return "-.inf";
1112
- case "uppercase":
1113
- return "-.INF";
1114
- case "camelcase":
1115
- return "-.Inf";
1116
- }
1117
- else if (J.isNegativeZero(e))
1118
- return "-0.0";
1119
- return n = e.toString(10), Ir.test(n) ? n.replace("e", ".e") : n;
1120
- }
1121
- function _r(e) {
1122
- return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || J.isNegativeZero(e));
1123
- }
1124
- var mn = new te("tag:yaml.org,2002:float", {
1125
- kind: "scalar",
1126
- resolve: Sr,
1127
- construct: xr,
1128
- predicate: _r,
1129
- represent: Ar,
1130
- defaultStyle: "lowercase"
1131
- }), yn = pn.extend({
1132
- implicit: [
1133
- fn,
1134
- gn,
1135
- hn,
1136
- mn
1137
- ]
1138
- }), vn = yn, bn = new RegExp(
1139
- "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
1140
- ), kn = new RegExp(
1141
- "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
1142
- );
1143
- function $r(e) {
1144
- return e === null ? !1 : bn.exec(e) !== null || kn.exec(e) !== null;
1145
- }
1146
- function Nr(e) {
1147
- var t, n, i, r, o, a, l, s = 0, d = null, u, c, f;
1148
- if (t = bn.exec(e), t === null && (t = kn.exec(e)), t === null) throw new Error("Date resolve error");
1149
- if (n = +t[1], i = +t[2] - 1, r = +t[3], !t[4])
1150
- return new Date(Date.UTC(n, i, r));
1151
- if (o = +t[4], a = +t[5], l = +t[6], t[7]) {
1152
- for (s = t[7].slice(0, 3); s.length < 3; )
1153
- s += "0";
1154
- s = +s;
1155
- }
1156
- return t[9] && (u = +t[10], c = +(t[11] || 0), d = (u * 60 + c) * 6e4, t[9] === "-" && (d = -d)), f = new Date(Date.UTC(n, i, r, o, a, l, s)), d && f.setTime(f.getTime() - d), f;
1157
- }
1158
- function Or(e) {
1159
- return e.toISOString();
1160
- }
1161
- var wn = new te("tag:yaml.org,2002:timestamp", {
1162
- kind: "scalar",
1163
- resolve: $r,
1164
- construct: Nr,
1165
- instanceOf: Date,
1166
- represent: Or
1167
- });
1168
- function jr(e) {
1169
- return e === "<<" || e === null;
1170
- }
1171
- var Cn = new te("tag:yaml.org,2002:merge", {
1172
- kind: "scalar",
1173
- resolve: jr
1174
- }), gt = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
1175
- \r`;
1176
- function Tr(e) {
1177
- if (e === null) return !1;
1178
- var t, n, i = 0, r = e.length, o = gt;
1179
- for (n = 0; n < r; n++)
1180
- if (t = o.indexOf(e.charAt(n)), !(t > 64)) {
1181
- if (t < 0) return !1;
1182
- i += 6;
1183
- }
1184
- return i % 8 === 0;
1185
- }
1186
- function Fr(e) {
1187
- var t, n, i = e.replace(/[\r\n=]/g, ""), r = i.length, o = gt, a = 0, l = [];
1188
- for (t = 0; t < r; t++)
1189
- t % 4 === 0 && t && (l.push(a >> 16 & 255), l.push(a >> 8 & 255), l.push(a & 255)), a = a << 6 | o.indexOf(i.charAt(t));
1190
- return n = r % 4 * 6, n === 0 ? (l.push(a >> 16 & 255), l.push(a >> 8 & 255), l.push(a & 255)) : n === 18 ? (l.push(a >> 10 & 255), l.push(a >> 2 & 255)) : n === 12 && l.push(a >> 4 & 255), new Uint8Array(l);
1191
- }
1192
- function Mr(e) {
1193
- var t = "", n = 0, i, r, o = e.length, a = gt;
1194
- for (i = 0; i < o; i++)
1195
- i % 3 === 0 && i && (t += a[n >> 18 & 63], t += a[n >> 12 & 63], t += a[n >> 6 & 63], t += a[n & 63]), n = (n << 8) + e[i];
1196
- return r = o % 3, r === 0 ? (t += a[n >> 18 & 63], t += a[n >> 12 & 63], t += a[n >> 6 & 63], t += a[n & 63]) : r === 2 ? (t += a[n >> 10 & 63], t += a[n >> 4 & 63], t += a[n << 2 & 63], t += a[64]) : r === 1 && (t += a[n >> 2 & 63], t += a[n << 4 & 63], t += a[64], t += a[64]), t;
1197
- }
1198
- function Er(e) {
1199
- return Object.prototype.toString.call(e) === "[object Uint8Array]";
1200
- }
1201
- var Sn = new te("tag:yaml.org,2002:binary", {
1202
- kind: "scalar",
1203
- resolve: Tr,
1204
- construct: Fr,
1205
- predicate: Er,
1206
- represent: Mr
1207
- }), qr = Object.prototype.hasOwnProperty, Lr = Object.prototype.toString;
1208
- function Rr(e) {
1209
- if (e === null) return !0;
1210
- var t = [], n, i, r, o, a, l = e;
1211
- for (n = 0, i = l.length; n < i; n += 1) {
1212
- if (r = l[n], a = !1, Lr.call(r) !== "[object Object]") return !1;
1213
- for (o in r)
1214
- if (qr.call(r, o))
1215
- if (!a) a = !0;
1216
- else return !1;
1217
- if (!a) return !1;
1218
- if (t.indexOf(o) === -1) t.push(o);
1219
- else return !1;
1220
- }
1221
- return !0;
1222
- }
1223
- function Ur(e) {
1224
- return e !== null ? e : [];
1225
- }
1226
- var xn = new te("tag:yaml.org,2002:omap", {
1227
- kind: "sequence",
1228
- resolve: Rr,
1229
- construct: Ur
1230
- }), Br = Object.prototype.toString;
1231
- function Kr(e) {
1232
- if (e === null) return !0;
1233
- var t, n, i, r, o, a = e;
1234
- for (o = new Array(a.length), t = 0, n = a.length; t < n; t += 1) {
1235
- if (i = a[t], Br.call(i) !== "[object Object]" || (r = Object.keys(i), r.length !== 1)) return !1;
1236
- o[t] = [r[0], i[r[0]]];
1237
- }
1238
- return !0;
1239
- }
1240
- function Vr(e) {
1241
- if (e === null) return [];
1242
- var t, n, i, r, o, a = e;
1243
- for (o = new Array(a.length), t = 0, n = a.length; t < n; t += 1)
1244
- i = a[t], r = Object.keys(i), o[t] = [r[0], i[r[0]]];
1245
- return o;
1246
- }
1247
- var In = new te("tag:yaml.org,2002:pairs", {
1248
- kind: "sequence",
1249
- resolve: Kr,
1250
- construct: Vr
1251
- }), Dr = Object.prototype.hasOwnProperty;
1252
- function Pr(e) {
1253
- if (e === null) return !0;
1254
- var t, n = e;
1255
- for (t in n)
1256
- if (Dr.call(n, t) && n[t] !== null)
1257
- return !1;
1258
- return !0;
1259
- }
1260
- function zr(e) {
1261
- return e !== null ? e : {};
1262
- }
1263
- var An = new te("tag:yaml.org,2002:set", {
1264
- kind: "mapping",
1265
- resolve: Pr,
1266
- construct: zr
1267
- }), ht = vn.extend({
1268
- implicit: [
1269
- wn,
1270
- Cn
1271
- ],
1272
- explicit: [
1273
- Sn,
1274
- xn,
1275
- In,
1276
- An
1277
- ]
1278
- }), ve = Object.prototype.hasOwnProperty, ze = 1, _n = 2, $n = 3, He = 4, it = 1, Hr = 2, Nt = 3, Wr = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Yr = /[\x85\u2028\u2029]/, Jr = /[,\[\]\{\}]/, Nn = /^(?:!|!!|![a-z\-]+!)$/i, On = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1279
- function Ot(e) {
1280
- return Object.prototype.toString.call(e);
1281
- }
1282
- function ce(e) {
1283
- return e === 10 || e === 13;
1284
- }
1285
- function Ce(e) {
1286
- return e === 9 || e === 32;
1287
- }
1288
- function oe(e) {
1289
- return e === 9 || e === 32 || e === 10 || e === 13;
1290
- }
1291
- function _e(e) {
1292
- return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
1293
- }
1294
- function Zr(e) {
1295
- var t;
1296
- return 48 <= e && e <= 57 ? e - 48 : (t = e | 32, 97 <= t && t <= 102 ? t - 97 + 10 : -1);
1297
- }
1298
- function Gr(e) {
1299
- return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
1300
- }
1301
- function Qr(e) {
1302
- return 48 <= e && e <= 57 ? e - 48 : -1;
1303
- }
1304
- function jt(e) {
1305
- return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
1306
- ` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "…" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
1307
- }
1308
- function Xr(e) {
1309
- return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode(
1310
- (e - 65536 >> 10) + 55296,
1311
- (e - 65536 & 1023) + 56320
1312
- );
1313
- }
1314
- var jn = new Array(256), Tn = new Array(256);
1315
- for (var Ie = 0; Ie < 256; Ie++)
1316
- jn[Ie] = jt(Ie) ? 1 : 0, Tn[Ie] = jt(Ie);
1317
- function ea(e, t) {
1318
- this.input = e, this.filename = t.filename || null, this.schema = t.schema || ht, this.onWarning = t.onWarning || null, this.legacy = t.legacy || !1, this.json = t.json || !1, this.listener = t.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
1319
- }
1320
- function Fn(e, t) {
1321
- var n = {
1322
- name: e.filename,
1323
- buffer: e.input.slice(0, -1),
1324
- // omit trailing \0
1325
- position: e.position,
1326
- line: e.line,
1327
- column: e.position - e.lineStart
1328
- };
1329
- return n.snippet = rr(n), new ae(t, n);
1330
- }
1331
- function S(e, t) {
1332
- throw Fn(e, t);
1333
- }
1334
- function We(e, t) {
1335
- e.onWarning && e.onWarning.call(null, Fn(e, t));
1336
- }
1337
- var Tt = {
1338
- YAML: function(e, t, n) {
1339
- var i, r, o;
1340
- e.version !== null && S(e, "duplication of %YAML directive"), n.length !== 1 && S(e, "YAML directive accepts exactly one argument"), i = /^([0-9]+)\.([0-9]+)$/.exec(n[0]), i === null && S(e, "ill-formed argument of the YAML directive"), r = parseInt(i[1], 10), o = parseInt(i[2], 10), r !== 1 && S(e, "unacceptable YAML version of the document"), e.version = n[0], e.checkLineBreaks = o < 2, o !== 1 && o !== 2 && We(e, "unsupported YAML version of the document");
1341
- },
1342
- TAG: function(e, t, n) {
1343
- var i, r;
1344
- n.length !== 2 && S(e, "TAG directive accepts exactly two arguments"), i = n[0], r = n[1], Nn.test(i) || S(e, "ill-formed tag handle (first argument) of the TAG directive"), ve.call(e.tagMap, i) && S(e, 'there is a previously declared suffix for "' + i + '" tag handle'), On.test(r) || S(e, "ill-formed tag prefix (second argument) of the TAG directive");
1345
- try {
1346
- r = decodeURIComponent(r);
1347
- } catch {
1348
- S(e, "tag prefix is malformed: " + r);
1349
- }
1350
- e.tagMap[i] = r;
1351
- }
1352
- };
1353
- function me(e, t, n, i) {
1354
- var r, o, a, l;
1355
- if (t < n) {
1356
- if (l = e.input.slice(t, n), i)
1357
- for (r = 0, o = l.length; r < o; r += 1)
1358
- a = l.charCodeAt(r), a === 9 || 32 <= a && a <= 1114111 || S(e, "expected valid JSON character");
1359
- else Wr.test(l) && S(e, "the stream contains non-printable characters");
1360
- e.result += l;
1361
- }
1362
- }
1363
- function Ft(e, t, n, i) {
1364
- var r, o, a, l;
1365
- for (J.isObject(n) || S(e, "cannot merge mappings; the provided source object is unacceptable"), r = Object.keys(n), a = 0, l = r.length; a < l; a += 1)
1366
- o = r[a], ve.call(t, o) || (t[o] = n[o], i[o] = !0);
1367
- }
1368
- function $e(e, t, n, i, r, o, a, l, s) {
1369
- var d, u;
1370
- if (Array.isArray(r))
1371
- for (r = Array.prototype.slice.call(r), d = 0, u = r.length; d < u; d += 1)
1372
- Array.isArray(r[d]) && S(e, "nested arrays are not supported inside keys"), typeof r == "object" && Ot(r[d]) === "[object Object]" && (r[d] = "[object Object]");
1373
- if (typeof r == "object" && Ot(r) === "[object Object]" && (r = "[object Object]"), r = String(r), t === null && (t = {}), i === "tag:yaml.org,2002:merge")
1374
- if (Array.isArray(o))
1375
- for (d = 0, u = o.length; d < u; d += 1)
1376
- Ft(e, t, o[d], n);
1377
- else
1378
- Ft(e, t, o, n);
1379
- else
1380
- !e.json && !ve.call(n, r) && ve.call(t, r) && (e.line = a || e.line, e.lineStart = l || e.lineStart, e.position = s || e.position, S(e, "duplicated mapping key")), r === "__proto__" ? Object.defineProperty(t, r, {
1381
- configurable: !0,
1382
- enumerable: !0,
1383
- writable: !0,
1384
- value: o
1385
- }) : t[r] = o, delete n[r];
1386
- return t;
1387
- }
1388
- function mt(e) {
1389
- var t;
1390
- t = e.input.charCodeAt(e.position), t === 10 ? e.position++ : t === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : S(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
1391
- }
1392
- function W(e, t, n) {
1393
- for (var i = 0, r = e.input.charCodeAt(e.position); r !== 0; ) {
1394
- for (; Ce(r); )
1395
- r === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), r = e.input.charCodeAt(++e.position);
1396
- if (t && r === 35)
1397
- do
1398
- r = e.input.charCodeAt(++e.position);
1399
- while (r !== 10 && r !== 13 && r !== 0);
1400
- if (ce(r))
1401
- for (mt(e), r = e.input.charCodeAt(e.position), i++, e.lineIndent = 0; r === 32; )
1402
- e.lineIndent++, r = e.input.charCodeAt(++e.position);
1403
- else
1404
- break;
1405
- }
1406
- return n !== -1 && i !== 0 && e.lineIndent < n && We(e, "deficient indentation"), i;
1407
- }
1408
- function Qe(e) {
1409
- var t = e.position, n;
1410
- return n = e.input.charCodeAt(t), !!((n === 45 || n === 46) && n === e.input.charCodeAt(t + 1) && n === e.input.charCodeAt(t + 2) && (t += 3, n = e.input.charCodeAt(t), n === 0 || oe(n)));
1411
- }
1412
- function yt(e, t) {
1413
- t === 1 ? e.result += " " : t > 1 && (e.result += J.repeat(`
1414
- `, t - 1));
1415
- }
1416
- function ta(e, t, n) {
1417
- var i, r, o, a, l, s, d, u, c = e.kind, f = e.result, p;
1418
- if (p = e.input.charCodeAt(e.position), oe(p) || _e(p) || p === 35 || p === 38 || p === 42 || p === 33 || p === 124 || p === 62 || p === 39 || p === 34 || p === 37 || p === 64 || p === 96 || (p === 63 || p === 45) && (r = e.input.charCodeAt(e.position + 1), oe(r) || n && _e(r)))
1419
- return !1;
1420
- for (e.kind = "scalar", e.result = "", o = a = e.position, l = !1; p !== 0; ) {
1421
- if (p === 58) {
1422
- if (r = e.input.charCodeAt(e.position + 1), oe(r) || n && _e(r))
1423
- break;
1424
- } else if (p === 35) {
1425
- if (i = e.input.charCodeAt(e.position - 1), oe(i))
1426
- break;
1427
- } else {
1428
- if (e.position === e.lineStart && Qe(e) || n && _e(p))
1429
- break;
1430
- if (ce(p))
1431
- if (s = e.line, d = e.lineStart, u = e.lineIndent, W(e, !1, -1), e.lineIndent >= t) {
1432
- l = !0, p = e.input.charCodeAt(e.position);
1433
- continue;
1434
- } else {
1435
- e.position = a, e.line = s, e.lineStart = d, e.lineIndent = u;
1436
- break;
1437
- }
1438
- }
1439
- l && (me(e, o, a, !1), yt(e, e.line - s), o = a = e.position, l = !1), Ce(p) || (a = e.position + 1), p = e.input.charCodeAt(++e.position);
1440
- }
1441
- return me(e, o, a, !1), e.result ? !0 : (e.kind = c, e.result = f, !1);
1442
- }
1443
- function na(e, t) {
1444
- var n, i, r;
1445
- if (n = e.input.charCodeAt(e.position), n !== 39)
1446
- return !1;
1447
- for (e.kind = "scalar", e.result = "", e.position++, i = r = e.position; (n = e.input.charCodeAt(e.position)) !== 0; )
1448
- if (n === 39)
1449
- if (me(e, i, e.position, !0), n = e.input.charCodeAt(++e.position), n === 39)
1450
- i = e.position, e.position++, r = e.position;
1451
- else
1452
- return !0;
1453
- else ce(n) ? (me(e, i, r, !0), yt(e, W(e, !1, t)), i = r = e.position) : e.position === e.lineStart && Qe(e) ? S(e, "unexpected end of the document within a single quoted scalar") : (e.position++, r = e.position);
1454
- S(e, "unexpected end of the stream within a single quoted scalar");
1455
- }
1456
- function ia(e, t) {
1457
- var n, i, r, o, a, l;
1458
- if (l = e.input.charCodeAt(e.position), l !== 34)
1459
- return !1;
1460
- for (e.kind = "scalar", e.result = "", e.position++, n = i = e.position; (l = e.input.charCodeAt(e.position)) !== 0; ) {
1461
- if (l === 34)
1462
- return me(e, n, e.position, !0), e.position++, !0;
1463
- if (l === 92) {
1464
- if (me(e, n, e.position, !0), l = e.input.charCodeAt(++e.position), ce(l))
1465
- W(e, !1, t);
1466
- else if (l < 256 && jn[l])
1467
- e.result += Tn[l], e.position++;
1468
- else if ((a = Gr(l)) > 0) {
1469
- for (r = a, o = 0; r > 0; r--)
1470
- l = e.input.charCodeAt(++e.position), (a = Zr(l)) >= 0 ? o = (o << 4) + a : S(e, "expected hexadecimal character");
1471
- e.result += Xr(o), e.position++;
1472
- } else
1473
- S(e, "unknown escape sequence");
1474
- n = i = e.position;
1475
- } else ce(l) ? (me(e, n, i, !0), yt(e, W(e, !1, t)), n = i = e.position) : e.position === e.lineStart && Qe(e) ? S(e, "unexpected end of the document within a double quoted scalar") : (e.position++, i = e.position);
1476
- }
1477
- S(e, "unexpected end of the stream within a double quoted scalar");
1478
- }
1479
- function ra(e, t) {
1480
- var n = !0, i, r, o, a = e.tag, l, s = e.anchor, d, u, c, f, p, g = /* @__PURE__ */ Object.create(null), k, b, I, v;
1481
- if (v = e.input.charCodeAt(e.position), v === 91)
1482
- u = 93, p = !1, l = [];
1483
- else if (v === 123)
1484
- u = 125, p = !0, l = {};
1485
- else
1486
- return !1;
1487
- for (e.anchor !== null && (e.anchorMap[e.anchor] = l), v = e.input.charCodeAt(++e.position); v !== 0; ) {
1488
- if (W(e, !0, t), v = e.input.charCodeAt(e.position), v === u)
1489
- return e.position++, e.tag = a, e.anchor = s, e.kind = p ? "mapping" : "sequence", e.result = l, !0;
1490
- n ? v === 44 && S(e, "expected the node content, but found ','") : S(e, "missed comma between flow collection entries"), b = k = I = null, c = f = !1, v === 63 && (d = e.input.charCodeAt(e.position + 1), oe(d) && (c = f = !0, e.position++, W(e, !0, t))), i = e.line, r = e.lineStart, o = e.position, Ne(e, t, ze, !1, !0), b = e.tag, k = e.result, W(e, !0, t), v = e.input.charCodeAt(e.position), (f || e.line === i) && v === 58 && (c = !0, v = e.input.charCodeAt(++e.position), W(e, !0, t), Ne(e, t, ze, !1, !0), I = e.result), p ? $e(e, l, g, b, k, I, i, r, o) : c ? l.push($e(e, null, g, b, k, I, i, r, o)) : l.push(k), W(e, !0, t), v = e.input.charCodeAt(e.position), v === 44 ? (n = !0, v = e.input.charCodeAt(++e.position)) : n = !1;
1491
- }
1492
- S(e, "unexpected end of the stream within a flow collection");
1493
- }
1494
- function aa(e, t) {
1495
- var n, i, r = it, o = !1, a = !1, l = t, s = 0, d = !1, u, c;
1496
- if (c = e.input.charCodeAt(e.position), c === 124)
1497
- i = !1;
1498
- else if (c === 62)
1499
- i = !0;
1500
- else
1501
- return !1;
1502
- for (e.kind = "scalar", e.result = ""; c !== 0; )
1503
- if (c = e.input.charCodeAt(++e.position), c === 43 || c === 45)
1504
- it === r ? r = c === 43 ? Nt : Hr : S(e, "repeat of a chomping mode identifier");
1505
- else if ((u = Qr(c)) >= 0)
1506
- u === 0 ? S(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : a ? S(e, "repeat of an indentation width identifier") : (l = t + u - 1, a = !0);
1507
- else
1508
- break;
1509
- if (Ce(c)) {
1510
- do
1511
- c = e.input.charCodeAt(++e.position);
1512
- while (Ce(c));
1513
- if (c === 35)
1514
- do
1515
- c = e.input.charCodeAt(++e.position);
1516
- while (!ce(c) && c !== 0);
1517
- }
1518
- for (; c !== 0; ) {
1519
- for (mt(e), e.lineIndent = 0, c = e.input.charCodeAt(e.position); (!a || e.lineIndent < l) && c === 32; )
1520
- e.lineIndent++, c = e.input.charCodeAt(++e.position);
1521
- if (!a && e.lineIndent > l && (l = e.lineIndent), ce(c)) {
1522
- s++;
1523
- continue;
1524
- }
1525
- if (e.lineIndent < l) {
1526
- r === Nt ? e.result += J.repeat(`
1527
- `, o ? 1 + s : s) : r === it && o && (e.result += `
1528
- `);
1529
- break;
1530
- }
1531
- for (i ? Ce(c) ? (d = !0, e.result += J.repeat(`
1532
- `, o ? 1 + s : s)) : d ? (d = !1, e.result += J.repeat(`
1533
- `, s + 1)) : s === 0 ? o && (e.result += " ") : e.result += J.repeat(`
1534
- `, s) : e.result += J.repeat(`
1535
- `, o ? 1 + s : s), o = !0, a = !0, s = 0, n = e.position; !ce(c) && c !== 0; )
1536
- c = e.input.charCodeAt(++e.position);
1537
- me(e, n, e.position, !1);
1538
- }
1539
- return !0;
1540
- }
1541
- function Mt(e, t) {
1542
- var n, i = e.tag, r = e.anchor, o = [], a, l = !1, s;
1543
- if (e.firstTabInLine !== -1) return !1;
1544
- for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, S(e, "tab characters must not be used in indentation")), !(s !== 45 || (a = e.input.charCodeAt(e.position + 1), !oe(a)))); ) {
1545
- if (l = !0, e.position++, W(e, !0, -1) && e.lineIndent <= t) {
1546
- o.push(null), s = e.input.charCodeAt(e.position);
1547
- continue;
1548
- }
1549
- if (n = e.line, Ne(e, t, $n, !1, !0), o.push(e.result), W(e, !0, -1), s = e.input.charCodeAt(e.position), (e.line === n || e.lineIndent > t) && s !== 0)
1550
- S(e, "bad indentation of a sequence entry");
1551
- else if (e.lineIndent < t)
1552
- break;
1553
- }
1554
- return l ? (e.tag = i, e.anchor = r, e.kind = "sequence", e.result = o, !0) : !1;
1555
- }
1556
- function oa(e, t, n) {
1557
- var i, r, o, a, l, s, d = e.tag, u = e.anchor, c = {}, f = /* @__PURE__ */ Object.create(null), p = null, g = null, k = null, b = !1, I = !1, v;
1558
- if (e.firstTabInLine !== -1) return !1;
1559
- for (e.anchor !== null && (e.anchorMap[e.anchor] = c), v = e.input.charCodeAt(e.position); v !== 0; ) {
1560
- if (!b && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, S(e, "tab characters must not be used in indentation")), i = e.input.charCodeAt(e.position + 1), o = e.line, (v === 63 || v === 58) && oe(i))
1561
- v === 63 ? (b && ($e(e, c, f, p, g, null, a, l, s), p = g = k = null), I = !0, b = !0, r = !0) : b ? (b = !1, r = !0) : S(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = i;
1562
- else {
1563
- if (a = e.line, l = e.lineStart, s = e.position, !Ne(e, n, _n, !1, !0))
1564
- break;
1565
- if (e.line === o) {
1566
- for (v = e.input.charCodeAt(e.position); Ce(v); )
1567
- v = e.input.charCodeAt(++e.position);
1568
- if (v === 58)
1569
- v = e.input.charCodeAt(++e.position), oe(v) || S(e, "a whitespace character is expected after the key-value separator within a block mapping"), b && ($e(e, c, f, p, g, null, a, l, s), p = g = k = null), I = !0, b = !1, r = !1, p = e.tag, g = e.result;
1570
- else if (I)
1571
- S(e, "can not read an implicit mapping pair; a colon is missed");
1572
- else
1573
- return e.tag = d, e.anchor = u, !0;
1574
- } else if (I)
1575
- S(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
1576
- else
1577
- return e.tag = d, e.anchor = u, !0;
1578
- }
1579
- if ((e.line === o || e.lineIndent > t) && (b && (a = e.line, l = e.lineStart, s = e.position), Ne(e, t, He, !0, r) && (b ? g = e.result : k = e.result), b || ($e(e, c, f, p, g, k, a, l, s), p = g = k = null), W(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === o || e.lineIndent > t) && v !== 0)
1580
- S(e, "bad indentation of a mapping entry");
1581
- else if (e.lineIndent < t)
1582
- break;
1583
- }
1584
- return b && $e(e, c, f, p, g, null, a, l, s), I && (e.tag = d, e.anchor = u, e.kind = "mapping", e.result = c), I;
1585
- }
1586
- function la(e) {
1587
- var t, n = !1, i = !1, r, o, a;
1588
- if (a = e.input.charCodeAt(e.position), a !== 33) return !1;
1589
- if (e.tag !== null && S(e, "duplication of a tag property"), a = e.input.charCodeAt(++e.position), a === 60 ? (n = !0, a = e.input.charCodeAt(++e.position)) : a === 33 ? (i = !0, r = "!!", a = e.input.charCodeAt(++e.position)) : r = "!", t = e.position, n) {
1590
- do
1591
- a = e.input.charCodeAt(++e.position);
1592
- while (a !== 0 && a !== 62);
1593
- e.position < e.length ? (o = e.input.slice(t, e.position), a = e.input.charCodeAt(++e.position)) : S(e, "unexpected end of the stream within a verbatim tag");
1594
- } else {
1595
- for (; a !== 0 && !oe(a); )
1596
- a === 33 && (i ? S(e, "tag suffix cannot contain exclamation marks") : (r = e.input.slice(t - 1, e.position + 1), Nn.test(r) || S(e, "named tag handle cannot contain such characters"), i = !0, t = e.position + 1)), a = e.input.charCodeAt(++e.position);
1597
- o = e.input.slice(t, e.position), Jr.test(o) && S(e, "tag suffix cannot contain flow indicator characters");
1598
- }
1599
- o && !On.test(o) && S(e, "tag name cannot contain such characters: " + o);
1600
- try {
1601
- o = decodeURIComponent(o);
1602
- } catch {
1603
- S(e, "tag name is malformed: " + o);
1604
- }
1605
- return n ? e.tag = o : ve.call(e.tagMap, r) ? e.tag = e.tagMap[r] + o : r === "!" ? e.tag = "!" + o : r === "!!" ? e.tag = "tag:yaml.org,2002:" + o : S(e, 'undeclared tag handle "' + r + '"'), !0;
1606
- }
1607
- function sa(e) {
1608
- var t, n;
1609
- if (n = e.input.charCodeAt(e.position), n !== 38) return !1;
1610
- for (e.anchor !== null && S(e, "duplication of an anchor property"), n = e.input.charCodeAt(++e.position), t = e.position; n !== 0 && !oe(n) && !_e(n); )
1611
- n = e.input.charCodeAt(++e.position);
1612
- return e.position === t && S(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(t, e.position), !0;
1613
- }
1614
- function ca(e) {
1615
- var t, n, i;
1616
- if (i = e.input.charCodeAt(e.position), i !== 42) return !1;
1617
- for (i = e.input.charCodeAt(++e.position), t = e.position; i !== 0 && !oe(i) && !_e(i); )
1618
- i = e.input.charCodeAt(++e.position);
1619
- return e.position === t && S(e, "name of an alias node must contain at least one character"), n = e.input.slice(t, e.position), ve.call(e.anchorMap, n) || S(e, 'unidentified alias "' + n + '"'), e.result = e.anchorMap[n], W(e, !0, -1), !0;
1620
- }
1621
- function Ne(e, t, n, i, r) {
1622
- var o, a, l, s = 1, d = !1, u = !1, c, f, p, g, k, b;
1623
- if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = a = l = He === n || $n === n, i && W(e, !0, -1) && (d = !0, e.lineIndent > t ? s = 1 : e.lineIndent === t ? s = 0 : e.lineIndent < t && (s = -1)), s === 1)
1624
- for (; la(e) || sa(e); )
1625
- W(e, !0, -1) ? (d = !0, l = o, e.lineIndent > t ? s = 1 : e.lineIndent === t ? s = 0 : e.lineIndent < t && (s = -1)) : l = !1;
1626
- if (l && (l = d || r), (s === 1 || He === n) && (ze === n || _n === n ? k = t : k = t + 1, b = e.position - e.lineStart, s === 1 ? l && (Mt(e, b) || oa(e, b, k)) || ra(e, k) ? u = !0 : (a && aa(e, k) || na(e, k) || ia(e, k) ? u = !0 : ca(e) ? (u = !0, (e.tag !== null || e.anchor !== null) && S(e, "alias node should not have any properties")) : ta(e, k, ze === n) && (u = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : s === 0 && (u = l && Mt(e, b))), e.tag === null)
1627
- e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
1628
- else if (e.tag === "?") {
1629
- for (e.result !== null && e.kind !== "scalar" && S(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), c = 0, f = e.implicitTypes.length; c < f; c += 1)
1630
- if (g = e.implicitTypes[c], g.resolve(e.result)) {
1631
- e.result = g.construct(e.result), e.tag = g.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
1632
- break;
1633
- }
1634
- } else if (e.tag !== "!") {
1635
- if (ve.call(e.typeMap[e.kind || "fallback"], e.tag))
1636
- g = e.typeMap[e.kind || "fallback"][e.tag];
1637
- else
1638
- for (g = null, p = e.typeMap.multi[e.kind || "fallback"], c = 0, f = p.length; c < f; c += 1)
1639
- if (e.tag.slice(0, p[c].tag.length) === p[c].tag) {
1640
- g = p[c];
1641
- break;
1642
- }
1643
- g || S(e, "unknown tag !<" + e.tag + ">"), e.result !== null && g.kind !== e.kind && S(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + g.kind + '", not "' + e.kind + '"'), g.resolve(e.result, e.tag) ? (e.result = g.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : S(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
1644
- }
1645
- return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || u;
1646
- }
1647
- function ua(e) {
1648
- var t = e.position, n, i, r, o = !1, a;
1649
- for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (a = e.input.charCodeAt(e.position)) !== 0 && (W(e, !0, -1), a = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || a !== 37)); ) {
1650
- for (o = !0, a = e.input.charCodeAt(++e.position), n = e.position; a !== 0 && !oe(a); )
1651
- a = e.input.charCodeAt(++e.position);
1652
- for (i = e.input.slice(n, e.position), r = [], i.length < 1 && S(e, "directive name must not be less than one character in length"); a !== 0; ) {
1653
- for (; Ce(a); )
1654
- a = e.input.charCodeAt(++e.position);
1655
- if (a === 35) {
1656
- do
1657
- a = e.input.charCodeAt(++e.position);
1658
- while (a !== 0 && !ce(a));
1659
- break;
1660
- }
1661
- if (ce(a)) break;
1662
- for (n = e.position; a !== 0 && !oe(a); )
1663
- a = e.input.charCodeAt(++e.position);
1664
- r.push(e.input.slice(n, e.position));
1665
- }
1666
- a !== 0 && mt(e), ve.call(Tt, i) ? Tt[i](e, i, r) : We(e, 'unknown document directive "' + i + '"');
1667
- }
1668
- if (W(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, W(e, !0, -1)) : o && S(e, "directives end mark is expected"), Ne(e, e.lineIndent - 1, He, !1, !0), W(e, !0, -1), e.checkLineBreaks && Yr.test(e.input.slice(t, e.position)) && We(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Qe(e)) {
1669
- e.input.charCodeAt(e.position) === 46 && (e.position += 3, W(e, !0, -1));
1670
- return;
1671
- }
1672
- if (e.position < e.length - 1)
1673
- S(e, "end of the stream or a document separator is expected");
1674
- else
1675
- return;
1676
- }
1677
- function Mn(e, t) {
1678
- e = String(e), t = t || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
1679
- `), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
1680
- var n = new ea(e, t), i = e.indexOf("\0");
1681
- for (i !== -1 && (n.position = i, S(n, "null byte is not allowed in input")), n.input += "\0"; n.input.charCodeAt(n.position) === 32; )
1682
- n.lineIndent += 1, n.position += 1;
1683
- for (; n.position < n.length - 1; )
1684
- ua(n);
1685
- return n.documents;
1686
- }
1687
- function da(e, t, n) {
1688
- t !== null && typeof t == "object" && typeof n > "u" && (n = t, t = null);
1689
- var i = Mn(e, n);
1690
- if (typeof t != "function")
1691
- return i;
1692
- for (var r = 0, o = i.length; r < o; r += 1)
1693
- t(i[r]);
1694
- }
1695
- function pa(e, t) {
1696
- var n = Mn(e, t);
1697
- if (n.length !== 0) {
1698
- if (n.length === 1)
1699
- return n[0];
1700
- throw new ae("expected a single document in the stream, but found more");
1701
- }
1702
- }
1703
- var fa = da, ga = pa, En = {
1704
- loadAll: fa,
1705
- load: ga
1706
- }, qn = Object.prototype.toString, Ln = Object.prototype.hasOwnProperty, vt = 65279, ha = 9, Le = 10, ma = 13, ya = 32, va = 33, ba = 34, lt = 35, ka = 37, wa = 38, Ca = 39, Sa = 42, Rn = 44, xa = 45, Ye = 58, Ia = 61, Aa = 62, _a = 63, $a = 64, Un = 91, Bn = 93, Na = 96, Kn = 123, Oa = 124, Vn = 125, ne = {};
1707
- ne[0] = "\\0";
1708
- ne[7] = "\\a";
1709
- ne[8] = "\\b";
1710
- ne[9] = "\\t";
1711
- ne[10] = "\\n";
1712
- ne[11] = "\\v";
1713
- ne[12] = "\\f";
1714
- ne[13] = "\\r";
1715
- ne[27] = "\\e";
1716
- ne[34] = '\\"';
1717
- ne[92] = "\\\\";
1718
- ne[133] = "\\N";
1719
- ne[160] = "\\_";
1720
- ne[8232] = "\\L";
1721
- ne[8233] = "\\P";
1722
- var ja = [
1723
- "y",
1724
- "Y",
1725
- "yes",
1726
- "Yes",
1727
- "YES",
1728
- "on",
1729
- "On",
1730
- "ON",
1731
- "n",
1732
- "N",
1733
- "no",
1734
- "No",
1735
- "NO",
1736
- "off",
1737
- "Off",
1738
- "OFF"
1739
- ], Ta = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
1740
- function Fa(e, t) {
1741
- var n, i, r, o, a, l, s;
1742
- if (t === null) return {};
1743
- for (n = {}, i = Object.keys(t), r = 0, o = i.length; r < o; r += 1)
1744
- a = i[r], l = String(t[a]), a.slice(0, 2) === "!!" && (a = "tag:yaml.org,2002:" + a.slice(2)), s = e.compiledTypeMap.fallback[a], s && Ln.call(s.styleAliases, l) && (l = s.styleAliases[l]), n[a] = l;
1745
- return n;
1746
- }
1747
- function Ma(e) {
1748
- var t, n, i;
1749
- if (t = e.toString(16).toUpperCase(), e <= 255)
1750
- n = "x", i = 2;
1751
- else if (e <= 65535)
1752
- n = "u", i = 4;
1753
- else if (e <= 4294967295)
1754
- n = "U", i = 8;
1755
- else
1756
- throw new ae("code point within a string may not be greater than 0xFFFFFFFF");
1757
- return "\\" + n + J.repeat("0", i - t.length) + t;
1758
- }
1759
- var Ea = 1, Re = 2;
1760
- function qa(e) {
1761
- this.schema = e.schema || ht, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = J.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Fa(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? Re : Ea, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
1762
- }
1763
- function Et(e, t) {
1764
- for (var n = J.repeat(" ", t), i = 0, r = -1, o = "", a, l = e.length; i < l; )
1765
- r = e.indexOf(`
1766
- `, i), r === -1 ? (a = e.slice(i), i = l) : (a = e.slice(i, r + 1), i = r + 1), a.length && a !== `
1767
- ` && (o += n), o += a;
1768
- return o;
1769
- }
1770
- function st(e, t) {
1771
- return `
1772
- ` + J.repeat(" ", e.indent * t);
1773
- }
1774
- function La(e, t) {
1775
- var n, i, r;
1776
- for (n = 0, i = e.implicitTypes.length; n < i; n += 1)
1777
- if (r = e.implicitTypes[n], r.resolve(t))
1778
- return !0;
1779
- return !1;
1780
- }
1781
- function Je(e) {
1782
- return e === ya || e === ha;
1783
- }
1784
- function Ue(e) {
1785
- return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== vt || 65536 <= e && e <= 1114111;
1786
- }
1787
- function qt(e) {
1788
- return Ue(e) && e !== vt && e !== ma && e !== Le;
1789
- }
1790
- function Lt(e, t, n) {
1791
- var i = qt(e), r = i && !Je(e);
1792
- return (
1793
- // ns-plain-safe
1794
- (n ? (
1795
- // c = flow-in
1796
- i
1797
- ) : i && e !== Rn && e !== Un && e !== Bn && e !== Kn && e !== Vn) && e !== lt && !(t === Ye && !r) || qt(t) && !Je(t) && e === lt || t === Ye && r
1798
- );
1799
- }
1800
- function Ra(e) {
1801
- return Ue(e) && e !== vt && !Je(e) && e !== xa && e !== _a && e !== Ye && e !== Rn && e !== Un && e !== Bn && e !== Kn && e !== Vn && e !== lt && e !== wa && e !== Sa && e !== va && e !== Oa && e !== Ia && e !== Aa && e !== Ca && e !== ba && e !== ka && e !== $a && e !== Na;
1802
- }
1803
- function Ua(e) {
1804
- return !Je(e) && e !== Ye;
1805
- }
1806
- function Me(e, t) {
1807
- var n = e.charCodeAt(t), i;
1808
- return n >= 55296 && n <= 56319 && t + 1 < e.length && (i = e.charCodeAt(t + 1), i >= 56320 && i <= 57343) ? (n - 55296) * 1024 + i - 56320 + 65536 : n;
1809
- }
1810
- function Dn(e) {
1811
- var t = /^\n* /;
1812
- return t.test(e);
1813
- }
1814
- var Pn = 1, ct = 2, zn = 3, Hn = 4, Ae = 5;
1815
- function Ba(e, t, n, i, r, o, a, l) {
1816
- var s, d = 0, u = null, c = !1, f = !1, p = i !== -1, g = -1, k = Ra(Me(e, 0)) && Ua(Me(e, e.length - 1));
1817
- if (t || a)
1818
- for (s = 0; s < e.length; d >= 65536 ? s += 2 : s++) {
1819
- if (d = Me(e, s), !Ue(d))
1820
- return Ae;
1821
- k = k && Lt(d, u, l), u = d;
1822
- }
1823
- else {
1824
- for (s = 0; s < e.length; d >= 65536 ? s += 2 : s++) {
1825
- if (d = Me(e, s), d === Le)
1826
- c = !0, p && (f = f || // Foldable line = too long, and not more-indented.
1827
- s - g - 1 > i && e[g + 1] !== " ", g = s);
1828
- else if (!Ue(d))
1829
- return Ae;
1830
- k = k && Lt(d, u, l), u = d;
1831
- }
1832
- f = f || p && s - g - 1 > i && e[g + 1] !== " ";
1833
- }
1834
- return !c && !f ? k && !a && !r(e) ? Pn : o === Re ? Ae : ct : n > 9 && Dn(e) ? Ae : a ? o === Re ? Ae : ct : f ? Hn : zn;
1835
- }
1836
- function Ka(e, t, n, i, r) {
1837
- e.dump = function() {
1838
- if (t.length === 0)
1839
- return e.quotingType === Re ? '""' : "''";
1840
- if (!e.noCompatMode && (ja.indexOf(t) !== -1 || Ta.test(t)))
1841
- return e.quotingType === Re ? '"' + t + '"' : "'" + t + "'";
1842
- var o = e.indent * Math.max(1, n), a = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - o), l = i || e.flowLevel > -1 && n >= e.flowLevel;
1843
- function s(d) {
1844
- return La(e, d);
1845
- }
1846
- switch (Ba(
1847
- t,
1848
- l,
1849
- e.indent,
1850
- a,
1851
- s,
1852
- e.quotingType,
1853
- e.forceQuotes && !i,
1854
- r
1855
- )) {
1856
- case Pn:
1857
- return t;
1858
- case ct:
1859
- return "'" + t.replace(/'/g, "''") + "'";
1860
- case zn:
1861
- return "|" + Rt(t, e.indent) + Ut(Et(t, o));
1862
- case Hn:
1863
- return ">" + Rt(t, e.indent) + Ut(Et(Va(t, a), o));
1864
- case Ae:
1865
- return '"' + Da(t) + '"';
1866
- default:
1867
- throw new ae("impossible error: invalid scalar style");
1868
- }
1869
- }();
1870
- }
1871
- function Rt(e, t) {
1872
- var n = Dn(e) ? String(t) : "", i = e[e.length - 1] === `
1873
- `, r = i && (e[e.length - 2] === `
1874
- ` || e === `
1875
- `), o = r ? "+" : i ? "" : "-";
1876
- return n + o + `
1877
- `;
1878
- }
1879
- function Ut(e) {
1880
- return e[e.length - 1] === `
1881
- ` ? e.slice(0, -1) : e;
1882
- }
1883
- function Va(e, t) {
1884
- for (var n = /(\n+)([^\n]*)/g, i = function() {
1885
- var d = e.indexOf(`
1886
- `);
1887
- return d = d !== -1 ? d : e.length, n.lastIndex = d, Bt(e.slice(0, d), t);
1888
- }(), r = e[0] === `
1889
- ` || e[0] === " ", o, a; a = n.exec(e); ) {
1890
- var l = a[1], s = a[2];
1891
- o = s[0] === " ", i += l + (!r && !o && s !== "" ? `
1892
- ` : "") + Bt(s, t), r = o;
1893
- }
1894
- return i;
1895
- }
1896
- function Bt(e, t) {
1897
- if (e === "" || e[0] === " ") return e;
1898
- for (var n = / [^ ]/g, i, r = 0, o, a = 0, l = 0, s = ""; i = n.exec(e); )
1899
- l = i.index, l - r > t && (o = a > r ? a : l, s += `
1900
- ` + e.slice(r, o), r = o + 1), a = l;
1901
- return s += `
1902
- `, e.length - r > t && a > r ? s += e.slice(r, a) + `
1903
- ` + e.slice(a + 1) : s += e.slice(r), s.slice(1);
1904
- }
1905
- function Da(e) {
1906
- for (var t = "", n = 0, i, r = 0; r < e.length; n >= 65536 ? r += 2 : r++)
1907
- n = Me(e, r), i = ne[n], !i && Ue(n) ? (t += e[r], n >= 65536 && (t += e[r + 1])) : t += i || Ma(n);
1908
- return t;
1909
- }
1910
- function Pa(e, t, n) {
1911
- var i = "", r = e.tag, o, a, l;
1912
- for (o = 0, a = n.length; o < a; o += 1)
1913
- l = n[o], e.replacer && (l = e.replacer.call(n, String(o), l)), (pe(e, t, l, !1, !1) || typeof l > "u" && pe(e, t, null, !1, !1)) && (i !== "" && (i += "," + (e.condenseFlow ? "" : " ")), i += e.dump);
1914
- e.tag = r, e.dump = "[" + i + "]";
1915
- }
1916
- function Kt(e, t, n, i) {
1917
- var r = "", o = e.tag, a, l, s;
1918
- for (a = 0, l = n.length; a < l; a += 1)
1919
- s = n[a], e.replacer && (s = e.replacer.call(n, String(a), s)), (pe(e, t + 1, s, !0, !0, !1, !0) || typeof s > "u" && pe(e, t + 1, null, !0, !0, !1, !0)) && ((!i || r !== "") && (r += st(e, t)), e.dump && Le === e.dump.charCodeAt(0) ? r += "-" : r += "- ", r += e.dump);
1920
- e.tag = o, e.dump = r || "[]";
1921
- }
1922
- function za(e, t, n) {
1923
- var i = "", r = e.tag, o = Object.keys(n), a, l, s, d, u;
1924
- for (a = 0, l = o.length; a < l; a += 1)
1925
- u = "", i !== "" && (u += ", "), e.condenseFlow && (u += '"'), s = o[a], d = n[s], e.replacer && (d = e.replacer.call(n, s, d)), pe(e, t, s, !1, !1) && (e.dump.length > 1024 && (u += "? "), u += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), pe(e, t, d, !1, !1) && (u += e.dump, i += u));
1926
- e.tag = r, e.dump = "{" + i + "}";
1927
- }
1928
- function Ha(e, t, n, i) {
1929
- var r = "", o = e.tag, a = Object.keys(n), l, s, d, u, c, f;
1930
- if (e.sortKeys === !0)
1931
- a.sort();
1932
- else if (typeof e.sortKeys == "function")
1933
- a.sort(e.sortKeys);
1934
- else if (e.sortKeys)
1935
- throw new ae("sortKeys must be a boolean or a function");
1936
- for (l = 0, s = a.length; l < s; l += 1)
1937
- f = "", (!i || r !== "") && (f += st(e, t)), d = a[l], u = n[d], e.replacer && (u = e.replacer.call(n, d, u)), pe(e, t + 1, d, !0, !0, !0) && (c = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, c && (e.dump && Le === e.dump.charCodeAt(0) ? f += "?" : f += "? "), f += e.dump, c && (f += st(e, t)), pe(e, t + 1, u, !0, c) && (e.dump && Le === e.dump.charCodeAt(0) ? f += ":" : f += ": ", f += e.dump, r += f));
1938
- e.tag = o, e.dump = r || "{}";
1939
- }
1940
- function Vt(e, t, n) {
1941
- var i, r, o, a, l, s;
1942
- for (r = n ? e.explicitTypes : e.implicitTypes, o = 0, a = r.length; o < a; o += 1)
1943
- if (l = r[o], (l.instanceOf || l.predicate) && (!l.instanceOf || typeof t == "object" && t instanceof l.instanceOf) && (!l.predicate || l.predicate(t))) {
1944
- if (n ? l.multi && l.representName ? e.tag = l.representName(t) : e.tag = l.tag : e.tag = "?", l.represent) {
1945
- if (s = e.styleMap[l.tag] || l.defaultStyle, qn.call(l.represent) === "[object Function]")
1946
- i = l.represent(t, s);
1947
- else if (Ln.call(l.represent, s))
1948
- i = l.represent[s](t, s);
1949
- else
1950
- throw new ae("!<" + l.tag + '> tag resolver accepts not "' + s + '" style');
1951
- e.dump = i;
1952
- }
1953
- return !0;
1954
- }
1955
- return !1;
1956
- }
1957
- function pe(e, t, n, i, r, o, a) {
1958
- e.tag = null, e.dump = n, Vt(e, n, !1) || Vt(e, n, !0);
1959
- var l = qn.call(e.dump), s = i, d;
1960
- i && (i = e.flowLevel < 0 || e.flowLevel > t);
1961
- var u = l === "[object Object]" || l === "[object Array]", c, f;
1962
- if (u && (c = e.duplicates.indexOf(n), f = c !== -1), (e.tag !== null && e.tag !== "?" || f || e.indent !== 2 && t > 0) && (r = !1), f && e.usedDuplicates[c])
1963
- e.dump = "*ref_" + c;
1964
- else {
1965
- if (u && f && !e.usedDuplicates[c] && (e.usedDuplicates[c] = !0), l === "[object Object]")
1966
- i && Object.keys(e.dump).length !== 0 ? (Ha(e, t, e.dump, r), f && (e.dump = "&ref_" + c + e.dump)) : (za(e, t, e.dump), f && (e.dump = "&ref_" + c + " " + e.dump));
1967
- else if (l === "[object Array]")
1968
- i && e.dump.length !== 0 ? (e.noArrayIndent && !a && t > 0 ? Kt(e, t - 1, e.dump, r) : Kt(e, t, e.dump, r), f && (e.dump = "&ref_" + c + e.dump)) : (Pa(e, t, e.dump), f && (e.dump = "&ref_" + c + " " + e.dump));
1969
- else if (l === "[object String]")
1970
- e.tag !== "?" && Ka(e, e.dump, t, o, s);
1971
- else {
1972
- if (l === "[object Undefined]" || e.skipInvalid) return !1;
1973
- throw new ae("unacceptable kind of an object to dump " + l);
1974
- }
1975
- e.tag !== null && e.tag !== "?" && (d = encodeURI(
1976
- e.tag[0] === "!" ? e.tag.slice(1) : e.tag
1977
- ).replace(/!/g, "%21"), e.tag[0] === "!" ? d = "!" + d : d.slice(0, 18) === "tag:yaml.org,2002:" ? d = "!!" + d.slice(18) : d = "!<" + d + ">", e.dump = d + " " + e.dump);
1978
- }
1979
- return !0;
1980
- }
1981
- function Wa(e, t) {
1982
- var n = [], i = [], r, o;
1983
- for (ut(e, n, i), r = 0, o = i.length; r < o; r += 1)
1984
- t.duplicates.push(n[i[r]]);
1985
- t.usedDuplicates = new Array(o);
1986
- }
1987
- function ut(e, t, n) {
1988
- var i, r, o;
1989
- if (e !== null && typeof e == "object")
1990
- if (r = t.indexOf(e), r !== -1)
1991
- n.indexOf(r) === -1 && n.push(r);
1992
- else if (t.push(e), Array.isArray(e))
1993
- for (r = 0, o = e.length; r < o; r += 1)
1994
- ut(e[r], t, n);
1995
- else
1996
- for (i = Object.keys(e), r = 0, o = i.length; r < o; r += 1)
1997
- ut(e[i[r]], t, n);
1998
- }
1999
- function Ya(e, t) {
2000
- t = t || {};
2001
- var n = new qa(t);
2002
- n.noRefs || Wa(e, n);
2003
- var i = e;
2004
- return n.replacer && (i = n.replacer.call({ "": i }, "", i)), pe(n, 0, i, !0, !0) ? n.dump + `
2005
- ` : "";
2006
- }
2007
- var Ja = Ya, Za = {
2008
- dump: Ja
2009
- };
2010
- function bt(e, t) {
2011
- return function() {
2012
- throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + t + " instead, which is now safe by default.");
2013
- };
2014
- }
2015
- var Ga = te, Qa = sn, Xa = pn, eo = yn, to = vn, no = ht, io = En.load, ro = En.loadAll, ao = Za.dump, oo = ae, lo = {
2016
- binary: Sn,
2017
- float: mn,
2018
- map: dn,
2019
- null: fn,
2020
- pairs: In,
2021
- set: An,
2022
- timestamp: wn,
2023
- bool: gn,
2024
- int: hn,
2025
- merge: Cn,
2026
- omap: xn,
2027
- seq: un,
2028
- str: cn
2029
- }, so = bt("safeLoad", "load"), co = bt("safeLoadAll", "loadAll"), uo = bt("safeDump", "dump"), po = {
2030
- Type: Ga,
2031
- Schema: Qa,
2032
- FAILSAFE_SCHEMA: Xa,
2033
- JSON_SCHEMA: eo,
2034
- CORE_SCHEMA: to,
2035
- DEFAULT_SCHEMA: no,
2036
- load: io,
2037
- loadAll: ro,
2038
- dump: ao,
2039
- YAMLException: oo,
2040
- types: lo,
2041
- safeLoad: so,
2042
- safeLoadAll: co,
2043
- safeDump: uo
2044
- };
2045
- const fo = { class: "yaml-config" }, go = /* @__PURE__ */ X({
2046
- __name: "YamlCodeBlock",
2047
- props: {
2048
- /** A record to indicate the entity's configuration, used to populate the YAML code block */
2049
- entityRecord: {
2050
- type: Object,
2051
- required: !0
2052
- }
2053
- },
2054
- setup(e) {
2055
- const t = e, n = x(() => {
2056
- const i = Object.fromEntries(Object.entries(t.entityRecord).filter(([, r]) => r !== null && r !== "" && (Array.isArray(r) ? r.length !== 0 : !0)));
2057
- return Object.keys(i).length === 0 && i.constructor === Object ? "" : po.dump(i).trim();
2058
- });
2059
- return (i, r) => {
2060
- const o = B("KCodeBlock");
2061
- return C(), q("div", fo, [
2062
- t.entityRecord ? (C(), D(o, {
2063
- key: 0,
2064
- id: "yaml-codeblock",
2065
- code: n.value,
2066
- language: "yaml",
2067
- theme: "dark"
2068
- }, null, 8, ["code"])) : Z("", !0)
2069
- ]);
2070
- };
2071
- }
2072
- }), ho = { class: "terraform-config" }, re = " ", mo = /* @__PURE__ */ X({
2073
- __name: "TerraformCodeBlock",
2074
- props: {
2075
- /** A record to indicate the entity's configuration, used to populate the Terraform code block */
2076
- entityRecord: {
2077
- type: Object,
2078
- required: !0
2079
- },
2080
- entityType: {
2081
- type: String,
2082
- required: !0,
2083
- validator: (e) => en.includes(e)
2084
- },
2085
- credentialType: {
2086
- type: String,
2087
- default: ""
2088
- }
2089
- },
2090
- setup(e) {
2091
- const t = e, n = (l, s) => {
2092
- const d = re;
2093
- let u = "";
2094
- return typeof l == "string" ? u += `${d}${s} = "${l}"
2095
- ` : u += `${d}${s} = ${String(l ?? "")}
2096
- `, u;
2097
- }, i = (l, s, d = "") => {
2098
- if (typeof l != "object")
2099
- return "Invalid object";
2100
- const u = re + d;
2101
- let c = "";
2102
- if (s && (c += `${u}${s} = {
2103
- `), l === null)
2104
- return s ? c += `${u}}` : c = "{}", c;
2105
- const f = Object.fromEntries(Object.entries(l).filter(([, g]) => g !== null));
2106
- let p = "";
2107
- for (const [g, k] of Object.entries(f))
2108
- Array.isArray(k) ? k.length === 0 ? p = "[]" : (p = `[
2109
- `, p += r(k, void 0, u), p += `${u}${re}]`) : k && typeof k == "object" ? (p = `{
2110
- `, p += i(k, void 0, u), p += `${u}${re}}`) : p = String(k ?? ""), typeof k == "string" && (p = `"${p}"`), c += `${u}${re}${g} = ${p}
2111
- `;
2112
- return s ? c += `${u}}
2113
- ` : c;
2114
- }, r = (l, s, d = "") => {
2115
- if (!Array.isArray(l))
2116
- return "Invalid array";
2117
- const u = re + d;
2118
- let c = "";
2119
- s && (l.length === 0 ? c += `${u}${s} = [` : c += `${u}${s} = [
2120
- `);
2121
- for (let f = 0; f < l.length; f++) {
2122
- const p = l[f];
2123
- typeof p == "object" ? (c += `${u}${re}{
2124
- `, c += i(p, void 0, u), c += `${u}${re}}`) : typeof p == "string" ? c += `${u}${re}"${p}"` : c += `${u}${re}${String(p ?? "")}`, f < l.length - 1 && (c += ","), c += `
2125
- `;
2126
- }
2127
- return s && (l.length === 0 ? c += `]
2128
- ` : c += `${u}]
2129
- `), c;
2130
- }, o = (l) => {
2131
- let s = "";
2132
- for (const [d, u] of Object.entries(l))
2133
- Array.isArray(u) ? s += r(u, d) : typeof u == "object" ? s += i(u, d) : s += n(u, d);
2134
- return s;
2135
- }, a = x(() => {
2136
- var l, s, d, u, c, f, p;
2137
- const g = Object.fromEntries(Object.entries(t.entityRecord).filter(([, v]) => v != null)), k = t.entityRecord.config ? Object.fromEntries(Object.entries((l = t.entityRecord) == null ? void 0 : l.config).filter(([, v]) => v != null)) : void 0;
2138
- if (k && (g.config = k), Object.keys(g).length === 0)
2139
- return "";
2140
- delete g.id;
2141
- let b = "", I = "";
2142
- if ((s = g.service) != null && s.id ? (I = "service", delete g.service) : (d = g.route) != null && d.id ? (I = "route", delete g.route) : (u = g.consumer) != null && u.id ? (I = "consumer", delete g.consumer) : (c = g.consumer_group) != null && c.id ? (I = "consumer_group", delete g.consumer_group) : (f = g.certificate) != null && f.id ? (I = "certificate", delete g.certificate) : (p = g.set) != null && p.id && (I = "set", delete g.set), t.entityType === "plugin") {
2143
- const v = t.credentialType.replace(/-/g, "_") || (g.name + "").replace(/-/g, "_");
2144
- delete g.name, b += `resource "konnect_gateway_plugin_${v}" "my_${v}" {
2145
- `;
2146
- } else
2147
- b += `resource "konnect_gateway_${t.entityType}" "my_${t.entityType}" {
2148
- `;
2149
- return b += o(g), b += `${re}control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
2150
- `, I && (b += `${re}${I} = {
2151
- `, b += `${re}${re}id = konnect_gateway_${I}.my_${I}.id
2152
- `, b += `${re}}
2153
- `), b += `}
2154
- `, b;
2155
- });
2156
- return (l, s) => {
2157
- const d = B("KCodeBlock");
2158
- return C(), q("div", ho, [
2159
- t.entityRecord ? (C(), D(d, {
2160
- key: 0,
2161
- id: "terraform-codeblock",
2162
- code: a.value,
2163
- language: "terraform",
2164
- theme: "dark"
2165
- }, null, 8, ["code"])) : Z("", !0)
2166
- ]);
2167
- };
2168
- }
2169
- }), be = "24px", Xe = (e, t) => {
2170
- const n = e.__vccOpts || e;
2171
- for (const [i, r] of t)
2172
- n[i] = r;
2173
- return n;
2174
- }, yo = (e) => (Ke("data-v-c1f7c39c"), e = e(), Ve(), e), vo = ["aria-hidden"], bo = {
2175
- key: 0,
2176
- "data-testid": "kui-icon-svg-title"
2177
- }, ko = /* @__PURE__ */ yo(() => /* @__PURE__ */ L("path", {
2178
- d: "M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",
2179
- fill: "currentColor"
2180
- }, null, -1)), wo = /* @__PURE__ */ X({
2181
- __name: "AddIcon",
2182
- props: {
2183
- /** The accessibility text provided to screen readers */
2184
- title: {
2185
- type: String,
2186
- required: !1,
2187
- default: ""
2188
- },
2189
- /** The icon color. Defaults to `currentColor` which inherits text color from the parent element */
2190
- color: {
2191
- type: String,
2192
- required: !1,
2193
- default: "currentColor"
2194
- },
2195
- /** The CSS display property for the icon. Defaults to `block` */
2196
- display: {
2197
- type: String,
2198
- required: !1,
2199
- default: "block"
2200
- },
2201
- /** Whether the icon is just eye-candy or is meaningful to the page (should screen-readers ignore the icon?) */
2202
- decorative: {
2203
- type: Boolean,
2204
- required: !1,
2205
- default: !1
2206
- },
2207
- /** The icon size */
2208
- size: {
2209
- type: [Number, String],
2210
- required: !1,
2211
- default: be,
2212
- // if setting to the imported const fails, just pass a number of 24 as the default.
2213
- validator: (e) => {
2214
- if (typeof e == "number" && e > 0)
2215
- return !0;
2216
- if (typeof e == "string") {
2217
- const t = String(e).replace(/px/gi, ""), n = Number(t);
2218
- if (n && !isNaN(n) && Number.isInteger(n) && n > 0)
2219
- return !0;
2220
- }
2221
- return !1;
2222
- }
2223
- },
2224
- /** The HTML tag to utilize for the icon's wrapper element. Defaults to `span` */
2225
- as: {
2226
- type: String,
2227
- required: !1,
2228
- default: "span"
2229
- }
2230
- },
2231
- setup(e) {
2232
- const t = e, n = x(() => {
2233
- if (typeof t.size == "number" && t.size > 0)
2234
- return `${t.size}px`;
2235
- if (typeof t.size == "string") {
2236
- const r = String(t.size).replace(/px/gi, ""), o = Number(r);
2237
- if (o && !isNaN(o) && Number.isInteger(o) && o > 0)
2238
- return `${o}px`;
2239
- }
2240
- return be;
2241
- }), i = x(() => ({
2242
- boxSizing: "border-box",
2243
- color: t.color,
2244
- display: t.display,
2245
- flexShrink: "0",
2246
- height: n.value,
2247
- lineHeight: "0",
2248
- width: n.value
2249
- }));
2250
- return (r, o) => (C(), D(Se(e.as), {
2251
- "aria-hidden": e.decorative ? "true" : void 0,
2252
- class: "kui-icon add-icon",
2253
- "data-testid": "kui-icon-wrapper-add-icon",
2254
- style: Be(i.value)
2255
- }, {
2256
- default: w(() => [
2257
- (C(), q("svg", {
2258
- "aria-hidden": e.decorative ? "true" : void 0,
2259
- "data-testid": "kui-icon-svg-add-icon",
2260
- fill: "none",
2261
- height: "100%",
2262
- role: "img",
2263
- viewBox: "0 0 24 24",
2264
- width: "100%",
2265
- xmlns: "http://www.w3.org/2000/svg"
2266
- }, [
2267
- e.title ? (C(), q("title", bo, E(e.title), 1)) : Z("", !0),
2268
- ko
2269
- ], 8, vo))
2270
- ]),
2271
- _: 1
2272
- }, 8, ["aria-hidden", "style"]));
2273
- }
2274
- }), Co = /* @__PURE__ */ Xe(wo, [["__scopeId", "data-v-c1f7c39c"]]), So = (e) => (Ke("data-v-745761f6"), e = e(), Ve(), e), xo = ["aria-hidden"], Io = {
2275
- key: 0,
2276
- "data-testid": "kui-icon-svg-title"
2277
- }, Ao = /* @__PURE__ */ So(() => /* @__PURE__ */ L("path", {
2278
- d: "M12 15.4L6 9.4L7.4 8L12 12.6L16.6 8L18 9.4L12 15.4Z",
2279
- fill: "currentColor"
2280
- }, null, -1)), _o = /* @__PURE__ */ X({
2281
- __name: "ChevronDownIcon",
2282
- props: {
2283
- /** The accessibility text provided to screen readers */
2284
- title: {
2285
- type: String,
2286
- required: !1,
2287
- default: ""
2288
- },
2289
- /** The icon color. Defaults to `currentColor` which inherits text color from the parent element */
2290
- color: {
2291
- type: String,
2292
- required: !1,
2293
- default: "currentColor"
2294
- },
2295
- /** The CSS display property for the icon. Defaults to `block` */
2296
- display: {
2297
- type: String,
2298
- required: !1,
2299
- default: "block"
2300
- },
2301
- /** Whether the icon is just eye-candy or is meaningful to the page (should screen-readers ignore the icon?) */
2302
- decorative: {
2303
- type: Boolean,
2304
- required: !1,
2305
- default: !1
2306
- },
2307
- /** The icon size */
2308
- size: {
2309
- type: [Number, String],
2310
- required: !1,
2311
- default: be,
2312
- // if setting to the imported const fails, just pass a number of 24 as the default.
2313
- validator: (e) => {
2314
- if (typeof e == "number" && e > 0)
2315
- return !0;
2316
- if (typeof e == "string") {
2317
- const t = String(e).replace(/px/gi, ""), n = Number(t);
2318
- if (n && !isNaN(n) && Number.isInteger(n) && n > 0)
2319
- return !0;
2320
- }
2321
- return !1;
2322
- }
2323
- },
2324
- /** The HTML tag to utilize for the icon's wrapper element. Defaults to `span` */
2325
- as: {
2326
- type: String,
2327
- required: !1,
2328
- default: "span"
2329
- }
2330
- },
2331
- setup(e) {
2332
- const t = e, n = x(() => {
2333
- if (typeof t.size == "number" && t.size > 0)
2334
- return `${t.size}px`;
2335
- if (typeof t.size == "string") {
2336
- const r = String(t.size).replace(/px/gi, ""), o = Number(r);
2337
- if (o && !isNaN(o) && Number.isInteger(o) && o > 0)
2338
- return `${o}px`;
2339
- }
2340
- return be;
2341
- }), i = x(() => ({
2342
- boxSizing: "border-box",
2343
- color: t.color,
2344
- display: t.display,
2345
- flexShrink: "0",
2346
- height: n.value,
2347
- lineHeight: "0",
2348
- width: n.value
2349
- }));
2350
- return (r, o) => (C(), D(Se(e.as), {
2351
- "aria-hidden": e.decorative ? "true" : void 0,
2352
- class: "kui-icon chevron-down-icon",
2353
- "data-testid": "kui-icon-wrapper-chevron-down-icon",
2354
- style: Be(i.value)
2355
- }, {
2356
- default: w(() => [
2357
- (C(), q("svg", {
2358
- "aria-hidden": e.decorative ? "true" : void 0,
2359
- "data-testid": "kui-icon-svg-chevron-down-icon",
2360
- fill: "none",
2361
- height: "100%",
2362
- role: "img",
2363
- viewBox: "0 0 24 24",
2364
- width: "100%",
2365
- xmlns: "http://www.w3.org/2000/svg"
2366
- }, [
2367
- e.title ? (C(), q("title", Io, E(e.title), 1)) : Z("", !0),
2368
- Ao
2369
- ], 8, xo))
2370
- ]),
2371
- _: 1
2372
- }, 8, ["aria-hidden", "style"]));
2373
- }
2374
- }), $o = /* @__PURE__ */ Xe(_o, [["__scopeId", "data-v-745761f6"]]), No = (e) => (Ke("data-v-863d10eb"), e = e(), Ve(), e), Oo = ["aria-hidden"], jo = {
2375
- key: 0,
2376
- "data-testid": "kui-icon-svg-title"
2377
- }, To = /* @__PURE__ */ No(() => /* @__PURE__ */ L("path", {
2378
- d: "M6.4 19L5 17.6L10.6 12L5 6.4L6.4 5L12 10.6L17.6 5L19 6.4L13.4 12L19 17.6L17.6 19L12 13.4L6.4 19Z",
2379
- fill: "currentColor"
2380
- }, null, -1)), Fo = /* @__PURE__ */ X({
2381
- __name: "CloseIcon",
2382
- props: {
2383
- /** The accessibility text provided to screen readers */
2384
- title: {
2385
- type: String,
2386
- required: !1,
2387
- default: ""
2388
- },
2389
- /** The icon color. Defaults to `currentColor` which inherits text color from the parent element */
2390
- color: {
2391
- type: String,
2392
- required: !1,
2393
- default: "currentColor"
2394
- },
2395
- /** The CSS display property for the icon. Defaults to `block` */
2396
- display: {
2397
- type: String,
2398
- required: !1,
2399
- default: "block"
2400
- },
2401
- /** Whether the icon is just eye-candy or is meaningful to the page (should screen-readers ignore the icon?) */
2402
- decorative: {
2403
- type: Boolean,
2404
- required: !1,
2405
- default: !1
2406
- },
2407
- /** The icon size */
2408
- size: {
2409
- type: [Number, String],
2410
- required: !1,
2411
- default: be,
2412
- // if setting to the imported const fails, just pass a number of 24 as the default.
2413
- validator: (e) => {
2414
- if (typeof e == "number" && e > 0)
2415
- return !0;
2416
- if (typeof e == "string") {
2417
- const t = String(e).replace(/px/gi, ""), n = Number(t);
2418
- if (n && !isNaN(n) && Number.isInteger(n) && n > 0)
2419
- return !0;
2420
- }
2421
- return !1;
2422
- }
2423
- },
2424
- /** The HTML tag to utilize for the icon's wrapper element. Defaults to `span` */
2425
- as: {
2426
- type: String,
2427
- required: !1,
2428
- default: "span"
2429
- }
2430
- },
2431
- setup(e) {
2432
- const t = e, n = x(() => {
2433
- if (typeof t.size == "number" && t.size > 0)
2434
- return `${t.size}px`;
2435
- if (typeof t.size == "string") {
2436
- const r = String(t.size).replace(/px/gi, ""), o = Number(r);
2437
- if (o && !isNaN(o) && Number.isInteger(o) && o > 0)
2438
- return `${o}px`;
2439
- }
2440
- return be;
2441
- }), i = x(() => ({
2442
- boxSizing: "border-box",
2443
- color: t.color,
2444
- display: t.display,
2445
- flexShrink: "0",
2446
- height: n.value,
2447
- lineHeight: "0",
2448
- width: n.value
2449
- }));
2450
- return (r, o) => (C(), D(Se(e.as), {
2451
- "aria-hidden": e.decorative ? "true" : void 0,
2452
- class: "kui-icon close-icon",
2453
- "data-testid": "kui-icon-wrapper-close-icon",
2454
- style: Be(i.value)
2455
- }, {
2456
- default: w(() => [
2457
- (C(), q("svg", {
2458
- "aria-hidden": e.decorative ? "true" : void 0,
2459
- "data-testid": "kui-icon-svg-close-icon",
2460
- fill: "none",
2461
- height: "100%",
2462
- role: "img",
2463
- viewBox: "0 0 24 24",
2464
- width: "100%",
2465
- xmlns: "http://www.w3.org/2000/svg"
2466
- }, [
2467
- e.title ? (C(), q("title", jo, E(e.title), 1)) : Z("", !0),
2468
- To
2469
- ], 8, Oo))
2470
- ]),
2471
- _: 1
2472
- }, 8, ["aria-hidden", "style"]));
2473
- }
2474
- }), Mo = /* @__PURE__ */ Xe(Fo, [["__scopeId", "data-v-863d10eb"]]), Eo = (e) => (Ke("data-v-d9894a05"), e = e(), Ve(), e), qo = ["aria-hidden"], Lo = {
2475
- key: 0,
2476
- "data-testid": "kui-icon-svg-title"
2477
- }, Ro = /* @__PURE__ */ Eo(() => /* @__PURE__ */ L("path", {
2478
- d: "M12 20C11.45 20 10.9792 19.8042 10.5875 19.4125C10.1958 19.0208 10 18.55 10 18C10 17.45 10.1958 16.9792 10.5875 16.5875C10.9792 16.1958 11.45 16 12 16C12.55 16 13.0208 16.1958 13.4125 16.5875C13.8042 16.9792 14 17.45 14 18C14 18.55 13.8042 19.0208 13.4125 19.4125C13.0208 19.8042 12.55 20 12 20ZM12 14C11.45 14 10.9792 13.8042 10.5875 13.4125C10.1958 13.0208 10 12.55 10 12C10 11.45 10.1958 10.9792 10.5875 10.5875C10.9792 10.1958 11.45 10 12 10C12.55 10 13.0208 10.1958 13.4125 10.5875C13.8042 10.9792 14 11.45 14 12C14 12.55 13.8042 13.0208 13.4125 13.4125C13.0208 13.8042 12.55 14 12 14ZM12 8C11.45 8 10.9792 7.80417 10.5875 7.4125C10.1958 7.02083 10 6.55 10 6C10 5.45 10.1958 4.97917 10.5875 4.5875C10.9792 4.19583 11.45 4 12 4C12.55 4 13.0208 4.19583 13.4125 4.5875C13.8042 4.97917 14 5.45 14 6C14 6.55 13.8042 7.02083 13.4125 7.4125C13.0208 7.80417 12.55 8 12 8Z",
2479
- fill: "currentColor"
2480
- }, null, -1)), Uo = /* @__PURE__ */ X({
2481
- __name: "MoreIcon",
2482
- props: {
2483
- /** The accessibility text provided to screen readers */
2484
- title: {
2485
- type: String,
2486
- required: !1,
2487
- default: ""
2488
- },
2489
- /** The icon color. Defaults to `currentColor` which inherits text color from the parent element */
2490
- color: {
2491
- type: String,
2492
- required: !1,
2493
- default: "currentColor"
2494
- },
2495
- /** The CSS display property for the icon. Defaults to `block` */
2496
- display: {
2497
- type: String,
2498
- required: !1,
2499
- default: "block"
2500
- },
2501
- /** Whether the icon is just eye-candy or is meaningful to the page (should screen-readers ignore the icon?) */
2502
- decorative: {
2503
- type: Boolean,
2504
- required: !1,
2505
- default: !1
2506
- },
2507
- /** The icon size */
2508
- size: {
2509
- type: [Number, String],
2510
- required: !1,
2511
- default: be,
2512
- // if setting to the imported const fails, just pass a number of 24 as the default.
2513
- validator: (e) => {
2514
- if (typeof e == "number" && e > 0)
2515
- return !0;
2516
- if (typeof e == "string") {
2517
- const t = String(e).replace(/px/gi, ""), n = Number(t);
2518
- if (n && !isNaN(n) && Number.isInteger(n) && n > 0)
2519
- return !0;
2520
- }
2521
- return !1;
2522
- }
2523
- },
2524
- /** The HTML tag to utilize for the icon's wrapper element. Defaults to `span` */
2525
- as: {
2526
- type: String,
2527
- required: !1,
2528
- default: "span"
2529
- }
2530
- },
2531
- setup(e) {
2532
- const t = e, n = x(() => {
2533
- if (typeof t.size == "number" && t.size > 0)
2534
- return `${t.size}px`;
2535
- if (typeof t.size == "string") {
2536
- const r = String(t.size).replace(/px/gi, ""), o = Number(r);
2537
- if (o && !isNaN(o) && Number.isInteger(o) && o > 0)
2538
- return `${o}px`;
2539
- }
2540
- return be;
2541
- }), i = x(() => ({
2542
- boxSizing: "border-box",
2543
- color: t.color,
2544
- display: t.display,
2545
- flexShrink: "0",
2546
- height: n.value,
2547
- lineHeight: "0",
2548
- width: n.value
2549
- }));
2550
- return (r, o) => (C(), D(Se(e.as), {
2551
- "aria-hidden": e.decorative ? "true" : void 0,
2552
- class: "kui-icon more-icon",
2553
- "data-testid": "kui-icon-wrapper-more-icon",
2554
- style: Be(i.value)
2555
- }, {
2556
- default: w(() => [
2557
- (C(), q("svg", {
2558
- "aria-hidden": e.decorative ? "true" : void 0,
2559
- "data-testid": "kui-icon-svg-more-icon",
2560
- fill: "none",
2561
- height: "100%",
2562
- role: "img",
2563
- viewBox: "0 0 24 24",
2564
- width: "100%",
2565
- xmlns: "http://www.w3.org/2000/svg"
2566
- }, [
2567
- e.title ? (C(), q("title", Lo, E(e.title), 1)) : Z("", !0),
2568
- Ro
2569
- ], 8, qo))
2570
- ]),
2571
- _: 1
2572
- }, 8, ["aria-hidden", "style"]));
2573
- }
2574
- }), Bo = /* @__PURE__ */ Xe(Uo, [["__scopeId", "data-v-d9894a05"]]), Ko = ["novalidate"], Vo = {
2575
- class: "form-actions",
2576
- "data-testid": "form-actions"
2577
- }, Do = /* @__PURE__ */ X({
2578
- __name: "EntityBaseForm",
2579
- props: {
2580
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2581
- config: {
2582
- type: Object,
2583
- required: !0,
2584
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string")
2585
- },
2586
- /** If a valid edit ID is provided, it will put the form in Edit mode instead of Create */
2587
- editId: {
2588
- type: String,
2589
- required: !1,
2590
- default: ""
2591
- },
2592
- /**
2593
- * Entity type, required to generate terraform code
2594
- */
2595
- entityType: {
2596
- type: String,
2597
- required: !0,
2598
- validator: (e) => en.includes(e)
2599
- },
2600
- /**
2601
- * Fetch url for the item to edit. We will handle the replacement of {controlPlaneId}, {workspace}, and {id}.
2602
- * Value should NOT contain config.apiBaseUrl, as we auto include this. Typically this will just an entry from
2603
- * the endpoints file.
2604
- * Required if `editId` is specified.
2605
- *
2606
- * ex. `/v2/control-planes/{controlPlaneId}/core-entities/snis/{id}`
2607
- */
2608
- fetchUrl: {
2609
- type: String,
2610
- required: !1,
2611
- default: ""
2612
- },
2613
- /** Set this prop to true during Save action. Disables save and cancel buttons */
2614
- isReadonly: {
2615
- type: Boolean,
2616
- required: !1,
2617
- default: !1
2618
- },
2619
- /** Used to track form validation, disables save button when false */
2620
- canSubmit: {
2621
- type: Boolean,
2622
- required: !1,
2623
- default: void 0
2624
- },
2625
- /** If form submission fails, this is the error message to display */
2626
- errorMessage: {
2627
- type: String,
2628
- required: !1,
2629
- default: ""
2630
- },
2631
- /** Used to populate the Configuration JSON/YAML code blocks */
2632
- formFields: {
2633
- type: Object,
2634
- required: !0
2635
- },
2636
- /**
2637
- * Set true to disable the form validation upon submission.
2638
- */
2639
- noValidate: {
2640
- type: Boolean,
2641
- default: !1
2642
- },
2643
- /**
2644
- * Wrapper component to use at component's root level.
2645
- */
2646
- wrapperComponent: {
2647
- type: String,
2648
- default: "KCard"
2649
- },
2650
- /**
2651
- * Enable display of Terraform code
2652
- * Guarded by FF: khcp-12445-terraform-config-details
2653
- */
2654
- enableTerraform: {
2655
- type: Boolean,
2656
- default: !1
2657
- }
2658
- },
2659
- emits: ["loading", "fetch:success", "fetch:error", "submit", "cancel"],
2660
- setup(e, { emit: t }) {
2661
- var n;
2662
- const i = t, r = e, o = Gt(), { i18n: { t: a } } = we.useI18n(), { getMessageFromError: l } = we.useErrors(), { axiosInstance: s } = we.useAxios((n = r.config) == null ? void 0 : n.axiosRequestConfig), d = T(!1), u = x(() => !!r.editId), c = T(!1), f = T(""), p = x(() => r.canSubmit === !1 || r.isReadonly), g = T(!1), k = x(() => {
2663
- var $, m;
2664
- let h = `${r.config.apiBaseUrl}${r.fetchUrl}`;
2665
- return r.config.app === "konnect" ? h = h.replace(/{controlPlaneId}/gi, (($ = r.config) == null ? void 0 : $.controlPlaneId) || "") : r.config.app === "kongManager" && (h = h.replace(/\/{workspace}/gi, (m = r.config) != null && m.workspace ? `/${r.config.workspace}` : "")), r.editId ? (h = h.replace(/{id}/gi, r.editId), h) : (h = h.replace(/\/{id}/gi, ""), h);
2666
- }), b = () => {
2667
- g.value = !g.value;
2668
- }, I = () => {
2669
- r.config.cancelRoute ? o.push(r.config.cancelRoute) : v();
2670
- }, v = () => {
2671
- i("cancel");
2672
- }, N = () => {
2673
- p.value || i("submit");
2674
- }, O = T([
2675
- {
2676
- title: a("baseForm.configuration.json"),
2677
- hash: "#json"
2678
- },
2679
- {
2680
- title: a("baseForm.configuration.yaml"),
2681
- hash: "#yaml"
2682
- }
2683
- ]);
2684
- return r.enableTerraform && r.entityType !== Ze.Other && O.value.splice(1, 0, {
2685
- title: a("baseForm.configuration.terraform"),
2686
- hash: "#terraform"
2687
- }), ye(() => d.value, ($) => {
2688
- i("loading", $);
2689
- }, { immediate: !0 }), dt(async () => {
2690
- if (r.editId)
2691
- try {
2692
- c.value = !1, d.value = !0;
2693
- const { data: $ } = await s.get(k.value);
2694
- i("fetch:success", $);
2695
- } catch ($) {
2696
- const m = l($);
2697
- f.value = m.startsWith("code") ? a("baseForm.errors.edit") : m, c.value = !0, i("fetch:error", $);
2698
- } finally {
2699
- d.value = !1;
2700
- }
2701
- }), ($, m) => {
2702
- const h = B("KSkeleton"), R = B("KEmptyState"), F = B("KAlert"), U = B("KButton"), G = B("KTabs"), K = B("KSlideout");
2703
- return C(), D(Se(e.wrapperComponent), { class: "kong-ui-entity-base-form" }, {
2704
- default: w(() => [
2705
- d.value ? (C(), D(h, {
2706
- key: 0,
2707
- type: "form"
2708
- })) : c.value ? (C(), D(R, {
2709
- key: 1,
2710
- "action-button-text": y(a)("baseForm.actions.back"),
2711
- "data-testid": "form-fetch-error",
2712
- "icon-variant": "error",
2713
- onClickAction: I
2714
- }, {
2715
- default: w(() => [
2716
- L("h3", null, E(f.value), 1)
2717
- ]),
2718
- _: 1
2719
- }, 8, ["action-button-text"])) : (C(), q("form", {
2720
- key: 2,
2721
- "data-testid": "form-content",
2722
- novalidate: r.noValidate,
2723
- onReset: at(v, ["prevent"]),
2724
- onSubmit: at(N, ["prevent"])
2725
- }, [
2726
- se($.$slots, "default", {}, void 0, !0),
2727
- e.errorMessage ? (C(), D(F, {
2728
- key: 0,
2729
- appearance: "danger",
2730
- "data-testid": "form-error",
2731
- message: e.errorMessage
2732
- }, null, 8, ["message"])) : Z("", !0),
2733
- L("div", Vo, [
2734
- se($.$slots, "form-actions", {}, () => [
2735
- _(U, {
2736
- appearance: "tertiary",
2737
- "data-testid": `${e.entityType}-${u.value ? "edit" : "create"}-form-view-configuration`,
2738
- onClick: m[0] || (m[0] = (le) => b())
2739
- }, {
2740
- default: w(() => [
2741
- Q(E(y(a)("baseForm.actions.viewConfiguration")), 1)
2742
- ]),
2743
- _: 1
2744
- }, 8, ["data-testid"]),
2745
- _(U, {
2746
- appearance: "secondary",
2747
- "data-testid": `${e.entityType}-${u.value ? "edit" : "create"}-form-cancel`,
2748
- disabled: e.isReadonly,
2749
- type: "reset"
2750
- }, {
2751
- default: w(() => [
2752
- Q(E(y(a)("baseForm.actions.cancel")), 1)
2753
- ]),
2754
- _: 1
2755
- }, 8, ["data-testid", "disabled"]),
2756
- _(U, {
2757
- appearance: "primary",
2758
- "data-testid": `${e.entityType}-${u.value ? "edit" : "create"}-form-submit`,
2759
- disabled: p.value,
2760
- type: "submit"
2761
- }, {
2762
- default: w(() => [
2763
- Q(E(y(a)("baseForm.actions.save")), 1)
2764
- ]),
2765
- _: 1
2766
- }, 8, ["data-testid", "disabled"])
2767
- ], !0)
2768
- ])
2769
- ], 40, Ko)),
2770
- _(K, {
2771
- "close-on-blur": !1,
2772
- "data-testid": "form-view-configuration-slideout",
2773
- "has-overlay": !1,
2774
- "offset-top": 60,
2775
- title: y(a)("baseForm.configuration.title"),
2776
- visible: g.value,
2777
- onClose: m[1] || (m[1] = (le) => b())
2778
- }, {
2779
- default: w(() => [
2780
- L("div", null, E(y(a)("baseForm.configuration.message")), 1),
2781
- _(G, {
2782
- "data-testid": "form-view-configuration-slideout-tabs",
2783
- tabs: O.value
2784
- }, {
2785
- json: w(() => [
2786
- _(zi, {
2787
- config: e.config,
2788
- "entity-record": r.formFields,
2789
- "fetcher-url": k.value,
2790
- "request-method": r.editId ? "put" : "post"
2791
- }, null, 8, ["config", "entity-record", "fetcher-url", "request-method"])
2792
- ]),
2793
- yaml: w(() => [
2794
- _(go, {
2795
- "entity-record": r.formFields
2796
- }, null, 8, ["entity-record"])
2797
- ]),
2798
- terraform: w(() => [
2799
- _(mo, {
2800
- "entity-record": r.formFields,
2801
- "entity-type": e.entityType
2802
- }, null, 8, ["entity-record", "entity-type"])
2803
- ]),
2804
- _: 1
2805
- }, 8, ["tabs"])
2806
- ]),
2807
- _: 1
2808
- }, 8, ["title", "visible"])
2809
- ]),
2810
- _: 3
2811
- });
2812
- };
2813
- }
2814
- }), Po = /* @__PURE__ */ Oe(Do, [["__scopeId", "data-v-94d27e50"]]), zo = ["data-truncate"], Ho = /* @__PURE__ */ X({
2815
- __name: "EntityBaseTableCell",
2816
- props: {
2817
- keyName: {
2818
- type: String,
2819
- required: !0
2820
- },
2821
- rowEl: {
2822
- type: [Object, null],
2823
- required: !0
2824
- },
2825
- tooltip: {
2826
- type: Boolean,
2827
- default: !1
2828
- }
2829
- },
2830
- setup(e) {
2831
- const t = e, n = x(() => {
2832
- var b;
2833
- return ((b = t.rowEl) == null ? void 0 : b.querySelector(`[data-testid="${t.keyName}"]`)) || null;
2834
- }), i = x(() => {
2835
- var b;
2836
- return ((b = n.value) == null ? void 0 : b.querySelector('[data-truncate="true"]')) || null;
2837
- }), r = x(() => {
2838
- var b, I;
2839
- const v = (b = t.rowEl) == null ? void 0 : b.querySelectorAll("td");
2840
- return v ? ((I = v[0]) == null ? void 0 : I.getAttribute("data-testid")) === t.keyName : !0;
2841
- }), o = x(() => r.value || t.tooltip);
2842
- let a;
2843
- const l = () => {
2844
- a && (a.disconnect(), a = void 0);
2845
- }, s = () => {
2846
- var b, I, v;
2847
- let N = ((b = n.value) == null ? void 0 : b.clientWidth) || 0;
2848
- if (n.value && "getComputedStyle" in window) {
2849
- const O = window.getComputedStyle(n.value);
2850
- N -= (parseFloat(O.paddingLeft) || 0) + (parseFloat(O.paddingRight) || 0);
2851
- }
2852
- u.value = ((I = i.value) == null ? void 0 : I.getBoundingClientRect().width) || 0, c.value = N, f.value = ((v = d.value) == null ? void 0 : v.innerText) || "";
2853
- }, d = T({}), u = T(0), c = T(0), f = T(""), p = x(() => [i.value, n.value]), g = ye(
2854
- p,
2855
- (b) => {
2856
- if (o.value && (l(), "ResizeObserver" in window && window)) {
2857
- a = new ResizeObserver((I) => {
2858
- window.requestAnimationFrame(() => {
2859
- !Array.isArray(I) || !I.length || s();
2860
- });
2861
- });
2862
- for (const I of b)
2863
- I && a.observe(I);
2864
- }
2865
- },
2866
- { immediate: !0, flush: "post", deep: !0 }
2867
- ), k = x(() => o.value ? u.value > c.value : !1);
2868
- return ti(() => {
2869
- s();
2870
- }), ni(() => {
2871
- g();
2872
- }), (b, I) => {
2873
- const v = B("KTooltip");
2874
- return C(), q("span", {
2875
- ref_key: "contentRef",
2876
- ref: d,
2877
- class: "content-wrapper"
2878
- }, [
2879
- o.value ? (C(), q("span", {
2880
- key: 0,
2881
- "data-truncate": o.value || void 0
2882
- }, [
2883
- _(v, {
2884
- "max-width": "300",
2885
- placement: "bottom-start",
2886
- text: k.value ? f.value : ""
2887
- }, {
2888
- default: w(() => [
2889
- se(b.$slots, "default", {}, void 0, !0)
2890
- ]),
2891
- _: 3
2892
- }, 8, ["text"])
2893
- ], 8, zo)) : se(b.$slots, "default", { key: 1 }, void 0, !0)
2894
- ], 512);
2895
- };
2896
- }
2897
- }), Wo = /* @__PURE__ */ Oe(Ho, [["__scopeId", "data-v-b252463e"]]), Yo = { class: "toolbar-container" }, Jo = {
2898
- key: 0,
2899
- class: "toolbar-button-container"
2900
- }, Zo = ["data-testid"], Go = /* @__PURE__ */ X({
2901
- __name: "EntityBaseTable",
2902
- props: {
2903
- // table header configuration
2904
- tableHeaders: {
2905
- type: Object,
2906
- required: !0,
2907
- default: () => ({})
2908
- },
2909
- // fetcher function
2910
- fetcher: {
2911
- type: Function,
2912
- required: !0,
2913
- default: async () => ({
2914
- data: [],
2915
- total: 0
2916
- })
2917
- },
2918
- initialFetcherParams: {
2919
- type: Object,
2920
- default: null
2921
- },
2922
- // used to identify the cache entry
2923
- cacheIdentifier: {
2924
- type: String,
2925
- default: ""
2926
- },
2927
- // cache key for the fetcher
2928
- fetcherCacheKey: {
2929
- type: Number,
2930
- default: 1
2931
- },
2932
- // whether the table is loading
2933
- isLoading: {
2934
- type: Boolean,
2935
- default: !1
2936
- },
2937
- // search query
2938
- query: {
2939
- type: String,
2940
- default: ""
2941
- },
2942
- // Enable client-side sort (e.g. for Koko endpoints that do not support sort)
2943
- enableClientSort: {
2944
- type: Boolean,
2945
- default: !1
2946
- },
2947
- sortHandlerFunction: {
2948
- type: Function,
2949
- default: () => ({})
2950
- },
2951
- // whether to show the actions column
2952
- enableEntityActions: {
2953
- type: Boolean,
2954
- default: !0
2955
- },
2956
- // options for the empty state
2957
- emptyStateOptions: {
2958
- type: Object,
2959
- default: () => ({})
2960
- },
2961
- // error message to show in the error state
2962
- // this prop being set (or empty) determines if the KTable is in an error state
2963
- // please use `TableErrorMessage` since `string` is only for backwards compatibility
2964
- errorMessage: {
2965
- type: [String, Object],
2966
- default: null
2967
- },
2968
- disablePaginationPageJump: {
2969
- type: Boolean,
2970
- default: void 0
2971
- },
2972
- disableSorting: {
2973
- type: Boolean,
2974
- default: void 0
2975
- },
2976
- paginationType: {
2977
- type: String,
2978
- default: void 0
2979
- },
2980
- // A function for applying attributes to cells
2981
- cellAttributes: {
2982
- type: Function,
2983
- default: () => ({})
2984
- },
2985
- // A function for applying attributes to rows
2986
- rowAttributes: {
2987
- type: Function,
2988
- default: () => ({})
2989
- },
2990
- /** tableKey to use for user table preferences. If empty, will fallback to default preferences */
2991
- preferencesStorageKey: {
2992
- type: String,
2993
- default: "",
2994
- required: !0
2995
- },
2996
- /** dropdown menu width, default to 200px, defined in kPop */
2997
- dropdownMenuWidth: {
2998
- type: String,
2999
- default: "",
3000
- required: !1
3001
- },
3002
- title: {
3003
- type: String,
3004
- default: ""
3005
- },
3006
- titleTag: {
3007
- type: String,
3008
- default: "h2"
3009
- },
3010
- /** default to false, setting to true will suppress the row click event even if "@click:row" is attached */
3011
- disableRowClick: {
3012
- type: Boolean,
3013
- default: !1
3014
- }
3015
- },
3016
- emits: ["click:row", "sort", "clear-search-input", "empty-state-cta-clicked"],
3017
- setup(e, { emit: t }) {
3018
- const n = e, i = t, { i18n: { t: r } } = we.useI18n(), o = x(() => {
3019
- var m, h;
3020
- return typeof n.errorMessage == "string" ? {
3021
- hasError: !!n.errorMessage,
3022
- title: n.errorMessage,
3023
- message: void 0
3024
- } : {
3025
- hasError: !!n.errorMessage,
3026
- title: (m = n.errorMessage) == null ? void 0 : m.title,
3027
- message: (h = n.errorMessage) == null ? void 0 : h.message
3028
- };
3029
- }), a = x(() => n.cacheIdentifier || n.preferencesStorageKey), l = (m) => m.hasData || !!n.query, s = x(() => {
3030
- const m = [];
3031
- return Object.keys(n.tableHeaders).forEach((h) => {
3032
- const R = n.tableHeaders[h];
3033
- m.push({
3034
- label: R.label ?? h,
3035
- key: h,
3036
- sortable: R.sortable ?? !1,
3037
- hidable: R.hidable ?? !0
3038
- });
3039
- }), n.enableEntityActions && m.push({
3040
- key: "actions",
3041
- hideLabel: !0
3042
- }), m;
3043
- }), d = (m) => ({
3044
- "data-rowid": m.id,
3045
- "data-testid": m.name,
3046
- ...n.rowAttributes(m)
3047
- }), u = T({}), c = (m) => {
3048
- var h;
3049
- return (h = u.value) == null ? void 0 : h.$el.querySelector(`[data-rowid="${m.id}"]`);
3050
- }, f = (m) => {
3051
- const h = {
3052
- "data-testid": m.headerKey,
3053
- ...n.cellAttributes(m)
3054
- };
3055
- return m.colIndex === 0 && (h.style = {
3056
- maxWidth: "250px",
3057
- overflowX: "hidden",
3058
- textOverflow: "ellipsis"
3059
- }), h;
3060
- }, p = () => {
3061
- i("empty-state-cta-clicked"), g();
3062
- }, g = () => {
3063
- i("clear-search-input");
3064
- }, k = x(() => n.disableRowClick ? void 0 : (m, h) => {
3065
- i("click:row", h);
3066
- }), b = (m) => {
3067
- i("sort", m);
3068
- }, { setTablePreferences: I, getTablePreferences: v } = hi(), N = T(v(a.value)), O = x(() => {
3069
- const m = v(a.value);
3070
- return {
3071
- ...n.initialFetcherParams,
3072
- ...m
3073
- };
3074
- }), $ = (m) => {
3075
- N.value = m, s.value.forEach((h) => {
3076
- !("hidable" in h) || !N.value.columnVisibility || h.hidable === !1 && (N.value.columnVisibility[h.key] = !0);
3077
- }), a.value && I(a.value, m);
3078
- };
3079
- return (m, h) => {
3080
- const R = B("KButton"), F = B("KDropdown"), U = B("KTable"), G = B("KCard");
3081
- return C(), D(G, {
3082
- class: "kong-ui-entity-base-table",
3083
- title: e.title,
3084
- "title-tag": e.titleTag
3085
- }, {
3086
- default: w(() => [
3087
- _(U, {
3088
- ref_key: "tableRefs",
3089
- ref: u,
3090
- "cache-identifier": a.value,
3091
- "cell-attrs": f,
3092
- "client-sort": e.enableClientSort,
3093
- "disable-pagination-page-jump": e.disablePaginationPageJump,
3094
- "empty-state-action-message": e.query ? y(r)("baseTable.emptyState.noSearchResultsCtaText") : e.emptyStateOptions.ctaText,
3095
- "empty-state-action-route": e.query ? void 0 : e.emptyStateOptions.ctaPath,
3096
- "empty-state-icon-variant": e.query ? "search" : "kong",
3097
- "empty-state-message": e.query ? y(r)("baseTable.emptyState.noSearchResultsMessage") : e.emptyStateOptions.message,
3098
- "empty-state-title": e.query ? y(r)("baseTable.emptyState.noSearchResultsTitle") : e.emptyStateOptions.title,
3099
- error: o.value.hasError,
3100
- "error-state-message": o.value.message,
3101
- "error-state-title": o.value.title,
3102
- fetcher: e.fetcher,
3103
- "fetcher-cache-key": String(e.fetcherCacheKey),
3104
- headers: s.value,
3105
- "hide-pagination-when-optional": "",
3106
- "initial-fetcher-params": O.value,
3107
- loading: e.isLoading,
3108
- "pagination-offset": e.paginationType === "offset",
3109
- "resize-columns": "",
3110
- "row-attrs": d,
3111
- "search-input": e.query,
3112
- "sort-handler-function": e.enableClientSort ? e.sortHandlerFunction : void 0,
3113
- sortable: !e.disableSorting,
3114
- "table-preferences": N.value,
3115
- onEmptyStateActionClick: p,
3116
- "onRow:click": k.value,
3117
- onSort: h[0] || (h[0] = (K) => b(K)),
3118
- "onUpdate:tablePreferences": $
3119
- }, Wt({
3120
- toolbar: w(({ state: K }) => [
3121
- ge(L("div", Yo, [
3122
- se(m.$slots, "toolbar-filter", {}, void 0, !0),
3123
- m.$slots["toolbar-button"] ? (C(), q("div", Jo, [
3124
- se(m.$slots, "toolbar-button", {}, void 0, !0)
3125
- ])) : Z("", !0)
3126
- ], 512), [
3127
- [he, l(K)]
3128
- ])
3129
- ]),
3130
- actions: w(({ row: K, rowKey: le, rowValue: fe }) => [
3131
- L("div", {
3132
- class: "actions-container",
3133
- "data-testid": K.name
3134
- }, [
3135
- _(F, {
3136
- "kpop-attributes": { placement: "bottom-end" },
3137
- width: e.dropdownMenuWidth
3138
- }, {
3139
- items: w(() => [
3140
- se(m.$slots, "actions", {
3141
- row: K,
3142
- rowKey: le,
3143
- rowValue: fe
3144
- }, void 0, !0)
3145
- ]),
3146
- default: w(() => [
3147
- _(R, {
3148
- appearance: "tertiary",
3149
- class: "actions-trigger",
3150
- "data-testid": "overflow-actions-button",
3151
- icon: "",
3152
- size: "small"
3153
- }, {
3154
- default: w(() => [
3155
- _(y(Bo))
3156
- ]),
3157
- _: 1
3158
- })
3159
- ]),
3160
- _: 2
3161
- }, 1032, ["width"])
3162
- ], 8, Zo)
3163
- ]),
3164
- _: 2
3165
- }, [
3166
- pt(e.tableHeaders, (K, le) => ({
3167
- name: le,
3168
- fn: w(({ row: fe, rowKey: xe, rowValue: ue }) => [
3169
- _(Wo, {
3170
- "key-name": String(le),
3171
- "row-el": c(fe),
3172
- tooltip: K.tooltip
3173
- }, {
3174
- default: w(() => [
3175
- se(m.$slots, le, {
3176
- row: fe,
3177
- rowKey: xe,
3178
- rowValue: ue
3179
- }, () => [
3180
- Q(E(ue), 1)
3181
- ], !0)
3182
- ]),
3183
- _: 2
3184
- }, 1032, ["key-name", "row-el", "tooltip"])
3185
- ])
3186
- })),
3187
- e.query ? void 0 : {
3188
- name: "empty-state-action-icon",
3189
- fn: w(() => [
3190
- _(y(Co))
3191
- ]),
3192
- key: "0"
3193
- }
3194
- ]), 1032, ["cache-identifier", "client-sort", "disable-pagination-page-jump", "empty-state-action-message", "empty-state-action-route", "empty-state-icon-variant", "empty-state-message", "empty-state-title", "error", "error-state-message", "error-state-title", "fetcher", "fetcher-cache-key", "headers", "initial-fetcher-params", "loading", "pagination-offset", "search-input", "sort-handler-function", "sortable", "table-preferences", "onRow:click"])
3195
- ]),
3196
- _: 3
3197
- }, 8, ["title", "title-tag"]);
3198
- };
3199
- }
3200
- }), Qo = /* @__PURE__ */ Oe(Go, [["__scopeId", "data-v-71b4425a"]]), Xo = {
3201
- key: 0,
3202
- class: "kong-ui-entity-delete-error"
3203
- }, el = {
3204
- key: 1,
3205
- class: "description"
3206
- }, tl = /* @__PURE__ */ X({
3207
- __name: "EntityDeleteModal",
3208
- props: {
3209
- visible: {
3210
- type: Boolean,
3211
- required: !0,
3212
- default: !1
3213
- },
3214
- title: {
3215
- type: String,
3216
- default: "Delete"
3217
- },
3218
- entityType: {
3219
- type: String,
3220
- required: !0
3221
- },
3222
- entityName: {
3223
- type: String,
3224
- default: ""
3225
- },
3226
- needConfirm: {
3227
- type: Boolean,
3228
- default: !0
3229
- },
3230
- description: {
3231
- type: String,
3232
- default: ""
3233
- },
3234
- actionPending: {
3235
- type: Boolean,
3236
- default: !1
3237
- },
3238
- error: {
3239
- type: String,
3240
- default: ""
3241
- }
3242
- },
3243
- emits: ["cancel", "proceed"],
3244
- setup(e, { emit: t }) {
3245
- const { i18nT: n } = we.useI18n(), i = e, r = t, o = x(() => i.needConfirm ? i.entityName : ""), a = () => {
3246
- r("cancel");
3247
- }, l = () => {
3248
- r("proceed");
3249
- };
3250
- return (s, d) => {
3251
- const u = B("KAlert"), c = B("KPrompt");
3252
- return C(), D(c, {
3253
- "action-button-appearance": "danger",
3254
- "action-button-disabled": e.actionPending,
3255
- "action-button-text": "Yes, delete",
3256
- class: "kong-ui-entity-delete-modal",
3257
- "confirmation-text": o.value,
3258
- title: e.title,
3259
- visible: e.visible,
3260
- onCancel: a,
3261
- onProceed: l
3262
- }, {
3263
- default: w(() => [
3264
- e.error ? (C(), q("div", Xo, [
3265
- _(u, { appearance: "danger" }, {
3266
- default: w(() => [
3267
- Q(E(e.error), 1)
3268
- ]),
3269
- _: 1
3270
- })
3271
- ])) : Z("", !0),
3272
- _(y(n), {
3273
- class: "message",
3274
- keypath: i.entityName ? "deleteModal.messageWithName" : "deleteModal.message",
3275
- tag: "p"
3276
- }, Wt({
3277
- entityType: w(() => [
3278
- Q(E(i.entityType), 1)
3279
- ]),
3280
- _: 2
3281
- }, [
3282
- i.entityName ? {
3283
- name: "entityName",
3284
- fn: w(() => [
3285
- L("strong", null, E(i.entityName), 1)
3286
- ]),
3287
- key: "0"
3288
- } : void 0
3289
- ]), 1032, ["keypath"]),
3290
- i.description || s.$slots.description ? (C(), q("div", el, [
3291
- se(s.$slots, "description", {}, () => [
3292
- L("p", null, E(i.description), 1)
3293
- ], !0)
3294
- ])) : Z("", !0)
3295
- ]),
3296
- _: 3
3297
- }, 8, ["action-button-disabled", "confirmation-text", "title", "visible"]);
3298
- };
3299
- }
3300
- }), nl = /* @__PURE__ */ Oe(tl, [["__scopeId", "data-v-4361d622"]]), il = {
3301
- fill: "none",
3302
- height: "20",
3303
- viewBox: "0 0 20 20",
3304
- width: "20",
3305
- xmlns: "http://www.w3.org/2000/svg"
3306
- }, rl = {
3307
- id: "mask0_180_20349",
3308
- height: "20",
3309
- maskUnits: "userSpaceOnUse",
3310
- style: { "mask-type": "alpha" },
3311
- width: "20",
3312
- x: "0",
3313
- y: "0"
3314
- }, al = ["fill"], ol = { mask: "url(#mask0_180_20349)" }, ll = ["fill"], Dt = /* @__PURE__ */ X({
3315
- __name: "IconFilter",
3316
- props: {
3317
- color: {
3318
- type: String,
3319
- default: `var(--kong-ui-entity-filter-color, ${Ki})`
3320
- }
3321
- },
3322
- setup(e) {
3323
- return (t, n) => (C(), q("svg", il, [
3324
- L("mask", rl, [
3325
- L("rect", {
3326
- fill: e.color,
3327
- height: "20",
3328
- width: "20"
3329
- }, null, 8, al)
3330
- ]),
3331
- L("g", ol, [
3332
- L("path", {
3333
- d: "M8 14.5V13H12V14.5H8ZM5 10.75V9.25H15V10.75H5ZM3 7V5.5H17V7H3Z",
3334
- fill: e.color
3335
- }, null, 8, ll)
3336
- ])
3337
- ]));
3338
- }
3339
- }), sl = {
3340
- key: 1,
3341
- class: "kong-ui-entity-filter"
3342
- }, cl = { class: "kong-ui-entity-filter-menu" }, ul = ["data-testid"], dl = ["onClick", "onKeydown"], pl = { class: "menu-item-indicator" }, fl = { class: "menu-item-body" }, gl = ["for"], hl = { class: "menu-item-buttons" }, ml = { class: "filter-clear-button-container" }, yl = /* @__PURE__ */ X({
3343
- __name: "EntityFilter",
3344
- props: {
3345
- // filter config, either exact match or fuzzy match
3346
- config: {
3347
- type: Object,
3348
- required: !0,
3349
- default: () => ({
3350
- isExactMatch: !0,
3351
- placeholder: ""
3352
- })
3353
- },
3354
- // query string
3355
- modelValue: {
3356
- type: String,
3357
- required: !0
3358
- }
3359
- },
3360
- emits: ["update:modelValue"],
3361
- setup(e, { emit: t }) {
3362
- const { i18n: { t: n } } = we.useI18n(), i = e, r = t, o = T(!1), a = T({}), l = T(/* @__PURE__ */ new Set()), s = x(() => {
3363
- const O = [];
3364
- return new URLSearchParams(i.modelValue).forEach(($, m) => {
3365
- $ !== "" && O.push(m);
3366
- }), O;
3367
- }), d = x(() => {
3368
- const O = i.config.fields;
3369
- return Object.keys(O).filter(($) => {
3370
- var m;
3371
- return (m = O == null ? void 0 : O[$]) == null ? void 0 : m.searchable;
3372
- }).map(($) => ({
3373
- label: O[$].label || $,
3374
- value: $,
3375
- expanded: !1
3376
- }));
3377
- });
3378
- ye(() => i.modelValue, (O) => {
3379
- a.value = {}, new URLSearchParams(O).forEach(($, m) => {
3380
- a.value[m] = $;
3381
- });
3382
- });
3383
- const u = () => {
3384
- o.value = !o.value;
3385
- }, c = (O) => {
3386
- l.value.has(O) ? l.value.delete(O) : l.value.add(O);
3387
- }, f = (O) => {
3388
- r("update:modelValue", O);
3389
- }, p = () => {
3390
- f("");
3391
- }, g = (O) => `filter-${O}`, k = (O) => {
3392
- var $, m;
3393
- return (((m = ($ = i.config.schema) == null ? void 0 : $[O]) == null ? void 0 : m.values) ?? []).map((h) => ({
3394
- value: h,
3395
- label: h
3396
- }));
3397
- }, b = (O) => {
3398
- var $, m;
3399
- return ((m = ($ = i.config.schema) == null ? void 0 : $[O]) == null ? void 0 : m.type) ?? "text";
3400
- }, I = (O) => {
3401
- a.value = {
3402
- ...a.value,
3403
- [O]: ""
3404
- }, N();
3405
- }, v = () => {
3406
- a.value = {}, N(!0);
3407
- }, N = (O = !1) => {
3408
- const $ = Object.keys(a.value).reduce((m, h) => (a.value[h] && (m[h] = `${a.value[h]}`), m), {});
3409
- O && (o.value = !1), r("update:modelValue", new URLSearchParams($).toString());
3410
- };
3411
- return (O, $) => {
3412
- const m = B("KInput"), h = B("KButton"), R = B("KSelect");
3413
- return e.config.isExactMatch ? (C(), D(m, {
3414
- key: 0,
3415
- autocomplete: "off",
3416
- class: "kong-ui-entity-filter-input",
3417
- "data-testid": "search-input",
3418
- "model-value": e.modelValue,
3419
- placeholder: e.config.placeholder,
3420
- "onUpdate:modelValue": f
3421
- }, {
3422
- before: w(() => [
3423
- _(Dt)
3424
- ]),
3425
- after: w(() => [
3426
- ge(_(y(Mo), {
3427
- class: "kong-ui-entity-filter-clear",
3428
- onClick: p
3429
- }, null, 512), [
3430
- [he, e.modelValue !== ""]
3431
- ])
3432
- ]),
3433
- _: 1
3434
- }, 8, ["model-value", "placeholder"])) : (C(), q("div", sl, [
3435
- _(h, {
3436
- appearance: "tertiary",
3437
- "data-testid": "filter-button",
3438
- onClick: u
3439
- }, {
3440
- default: w(() => [
3441
- _(Dt),
3442
- Q(" " + E(y(n)("filter.filterButtonText")) + " " + E(s.value.length > 0 ? `(${s.value.length})` : ""), 1)
3443
- ]),
3444
- _: 1
3445
- }),
3446
- ge(L("div", {
3447
- class: "kong-ui-entity-filter-backdrop",
3448
- onClick: u
3449
- }, null, 512), [
3450
- [he, o.value]
3451
- ]),
3452
- ge(L("div", cl, [
3453
- (C(!0), q(Yt, null, pt(d.value, (F) => {
3454
- var U, G;
3455
- return C(), q("div", {
3456
- key: F.value,
3457
- class: "kong-ui-entity-filter-menu-item",
3458
- "data-testid": F.value
3459
- }, [
3460
- L("span", {
3461
- class: Ee(["menu-item-title", { expanded: l.value.has(F.value) }]),
3462
- role: "button",
3463
- tabindex: "0",
3464
- onClick: (K) => c(F.value),
3465
- onKeydown: Gn((K) => c(F.value), ["enter"])
3466
- }, [
3467
- Q(E(F.label) + " ", 1),
3468
- ge(L("span", pl, null, 512), [
3469
- [he, s.value.includes(F.value)]
3470
- ]),
3471
- _(y($o), {
3472
- class: Ee(["menu-item-expand-icon", { expanded: l.value.has(F.value) }]),
3473
- color: y(Vi)
3474
- }, null, 8, ["class", "color"])
3475
- ], 42, dl),
3476
- ge(L("div", fl, [
3477
- L("label", {
3478
- class: "menu-item-label",
3479
- for: g(F.value)
3480
- }, E(y(n)("filter.fieldLabel")), 9, gl),
3481
- ((G = (U = e.config.schema) == null ? void 0 : U[F.value]) == null ? void 0 : G.type) === "select" ? (C(), D(R, {
3482
- key: 0,
3483
- id: g(F.value),
3484
- modelValue: a.value[F.value],
3485
- "onUpdate:modelValue": (K) => a.value[F.value] = K,
3486
- items: k(F.value),
3487
- placeholder: y(n)("filter.selectPlaceholder")
3488
- }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "items", "placeholder"])) : (C(), D(m, {
3489
- key: 1,
3490
- id: g(F.value),
3491
- modelValue: a.value[F.value],
3492
- "onUpdate:modelValue": (K) => a.value[F.value] = K,
3493
- autocomplete: "off",
3494
- placeholder: y(n)("filter.inputPlaceholder"),
3495
- type: b(F.value)
3496
- }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "placeholder", "type"]))
3497
- ], 512), [
3498
- [he, l.value.has(F.value)]
3499
- ]),
3500
- ge(L("div", hl, [
3501
- _(h, {
3502
- appearance: "tertiary",
3503
- "data-testid": "apply-filter",
3504
- size: "small",
3505
- onClick: $[0] || ($[0] = (K) => N(!0))
3506
- }, {
3507
- default: w(() => [
3508
- Q(E(y(n)("filter.applyButtonText")), 1)
3509
- ]),
3510
- _: 1
3511
- }),
3512
- _(h, {
3513
- appearance: "tertiary",
3514
- "data-testid": "clear-filter",
3515
- size: "small",
3516
- onClick: (K) => I(F.value)
3517
- }, {
3518
- default: w(() => [
3519
- Q(E(y(n)("filter.clearButtonText")), 1)
3520
- ]),
3521
- _: 2
3522
- }, 1032, ["onClick"])
3523
- ], 512), [
3524
- [he, l.value.has(F.value)]
3525
- ])
3526
- ], 8, ul);
3527
- }), 128)),
3528
- L("div", ml, [
3529
- _(h, {
3530
- appearance: "tertiary",
3531
- size: "small",
3532
- onClick: v
3533
- }, {
3534
- default: w(() => [
3535
- Q(E(y(n)("filter.clearAllButtonText")), 1)
3536
- ]),
3537
- _: 1
3538
- })
3539
- ])
3540
- ], 512), [
3541
- [he, o.value]
3542
- ])
3543
- ]));
3544
- };
3545
- }
3546
- }), vl = /* @__PURE__ */ Oe(yl, [["__scopeId", "data-v-94990087"]]), rt = /* @__PURE__ */ X({
3547
- __name: "PermissionsWrapper",
3548
- props: {
3549
- /**
3550
- * Provide an async function that returns a boolean to determine whether
3551
- * the wrapper should hide or show the default slot content.
3552
- */
3553
- authFunction: {
3554
- type: Function,
3555
- required: !0,
3556
- default: async () => !0
3557
- },
3558
- /**
3559
- * Should the default slot content be shown once the authFunction is evaluated no matter what?
3560
- * e.g. if you want to display the item but disable it.
3561
- */
3562
- forceShow: {
3563
- type: Boolean,
3564
- default: !1
3565
- }
3566
- },
3567
- setup(e) {
3568
- const t = e, n = T(void 0), i = x(() => n.value === !0 || n.value !== void 0 && t.forceShow === !0);
3569
- return ye(() => t.authFunction, async () => {
3570
- n.value = await t.authFunction();
3571
- }, { immediate: !0 }), (r, o) => i.value ? se(r.$slots, "default", {
3572
- key: 0,
3573
- isAllowed: n.value
3574
- }) : Z("", !0);
3575
- }
3576
- });
3577
- let De;
3578
- const bl = new Uint8Array(16);
3579
- function kl() {
3580
- if (!De && (De = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !De))
3581
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
3582
- return De(bl);
3583
- }
3584
- const ee = [];
3585
- for (let e = 0; e < 256; ++e)
3586
- ee.push((e + 256).toString(16).slice(1));
3587
- function wl(e, t = 0) {
3588
- return ee[e[t + 0]] + ee[e[t + 1]] + ee[e[t + 2]] + ee[e[t + 3]] + "-" + ee[e[t + 4]] + ee[e[t + 5]] + "-" + ee[e[t + 6]] + ee[e[t + 7]] + "-" + ee[e[t + 8]] + ee[e[t + 9]] + "-" + ee[e[t + 10]] + ee[e[t + 11]] + ee[e[t + 12]] + ee[e[t + 13]] + ee[e[t + 14]] + ee[e[t + 15]];
3589
- }
3590
- const Cl = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Pt = {
3591
- randomUUID: Cl
3592
- };
3593
- function Sl(e, t, n) {
3594
- if (Pt.randomUUID && !t && !e)
3595
- return Pt.randomUUID();
3596
- e = e || {};
3597
- const i = e.random || (e.rng || kl)();
3598
- if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, t) {
3599
- n = n || 0;
3600
- for (let r = 0; r < 16; ++r)
3601
- t[n + r] = i[r];
3602
- return t;
3603
- }
3604
- return wl(i);
3605
- }
3606
- const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
3607
- key: 1,
3608
- class: "form-section-description"
3609
- }, _l = {
3610
- key: 2,
3611
- class: "form-section-footer"
3612
- }, $l = { class: "form-section-content" }, Nl = /* @__PURE__ */ X({
3613
- __name: "EntityFormSection",
3614
- props: {
3615
- title: {
3616
- type: String,
3617
- default: ""
3618
- },
3619
- description: {
3620
- type: String,
3621
- default: ""
3622
- },
3623
- hasDivider: {
3624
- type: Boolean,
3625
- default: !1
3626
- },
3627
- stickyInfoHeader: {
3628
- type: Boolean,
3629
- default: !0
3630
- },
3631
- hideInfoHeader: {
3632
- type: Boolean,
3633
- default: !1
3634
- },
3635
- titleTag: {
3636
- type: String,
3637
- default: "h2"
3638
- }
3639
- },
3640
- setup(e) {
3641
- const t = Qn(), n = Sl();
3642
- return (i, r) => (C(), q("div", {
3643
- "aria-labelledby": e.title ? y(n) : void 0,
3644
- class: Ee(["kong-ui-entity-form-section", { "has-divider": e.hasDivider }]),
3645
- role: "group"
3646
- }, [
3647
- L("div", Il, [
3648
- e.hideInfoHeader ? Z("", !0) : (C(), q("div", {
3649
- key: 0,
3650
- class: Ee(["form-section-info", { sticky: e.stickyInfoHeader }])
3651
- }, [
3652
- e.title ? (C(), D(Se(e.titleTag), {
3653
- key: 0,
3654
- id: y(n),
3655
- class: "form-section-title"
3656
- }, {
3657
- default: w(() => [
3658
- Q(E(e.title), 1)
3659
- ]),
3660
- _: 1
3661
- }, 8, ["id"])) : Z("", !0),
3662
- e.description || y(t).description ? (C(), q("div", Al, [
3663
- se(i.$slots, "description", {}, () => [
3664
- L("p", null, E(e.description), 1)
3665
- ], !0)
3666
- ])) : Z("", !0),
3667
- y(t).footer ? (C(), q("div", _l, [
3668
- se(i.$slots, "footer", {}, void 0, !0)
3669
- ])) : Z("", !0)
3670
- ], 2)),
3671
- L("div", $l, [
3672
- se(i.$slots, "default", {}, void 0, !0)
3673
- ])
3674
- ])
3675
- ], 10, xl));
3676
- }
3677
- }), zt = /* @__PURE__ */ Oe(Nl, [["__scopeId", "data-v-b1f74200"]]), { useAxios: Wn, useDeleteUrlBuilder: Ol, useErrors: jl, useExternalLinkCreator: es, useFetchUrlBuilder: ts, useFetcher: Tl, useDebouncedFilter: Fl, useStringHelpers: ns, useHelpers: is, useGatewayFeatureSupported: rs, useTruncationDetector: as, useValidators: os } = we, Ht = "24px", Ml = (e, t) => {
3678
- const n = e.__vccOpts || e;
3679
- for (const [i, r] of t)
3680
- n[i] = r;
3681
- return n;
3682
- }, El = (e) => (Ke("data-v-c1f7c39c"), e = e(), Ve(), e), ql = ["aria-hidden"], Ll = {
3683
- key: 0,
3684
- "data-testid": "kui-icon-svg-title"
3685
- }, Rl = /* @__PURE__ */ El(() => /* @__PURE__ */ L("path", {
3686
- d: "M11 19V13H5V11H11V5H13V11H19V13H13V19H11Z",
3687
- fill: "currentColor"
3688
- }, null, -1)), Ul = /* @__PURE__ */ X({
3689
- __name: "AddIcon",
3690
- props: {
3691
- /** The accessibility text provided to screen readers */
3692
- title: {
3693
- type: String,
3694
- required: !1,
3695
- default: ""
3696
- },
3697
- /** The icon color. Defaults to `currentColor` which inherits text color from the parent element */
3698
- color: {
3699
- type: String,
3700
- required: !1,
3701
- default: "currentColor"
3702
- },
3703
- /** The CSS display property for the icon. Defaults to `block` */
3704
- display: {
3705
- type: String,
3706
- required: !1,
3707
- default: "block"
3708
- },
3709
- /** Whether the icon is just eye-candy or is meaningful to the page (should screen-readers ignore the icon?) */
3710
- decorative: {
3711
- type: Boolean,
3712
- required: !1,
3713
- default: !1
3714
- },
3715
- /** The icon size */
3716
- size: {
3717
- type: [Number, String],
3718
- required: !1,
3719
- default: Ht,
3720
- // if setting to the imported const fails, just pass a number of 24 as the default.
3721
- validator: (e) => {
3722
- if (typeof e == "number" && e > 0)
3723
- return !0;
3724
- if (typeof e == "string") {
3725
- const t = String(e).replace(/px/gi, ""), n = Number(t);
3726
- if (n && !isNaN(n) && Number.isInteger(n) && n > 0)
3727
- return !0;
3728
- }
3729
- return !1;
3730
- }
3731
- },
3732
- /** The HTML tag to utilize for the icon's wrapper element. Defaults to `span` */
3733
- as: {
3734
- type: String,
3735
- required: !1,
3736
- default: "span"
3737
- }
3738
- },
3739
- setup(e) {
3740
- const t = e, n = x(() => {
3741
- if (typeof t.size == "number" && t.size > 0)
3742
- return `${t.size}px`;
3743
- if (typeof t.size == "string") {
3744
- const r = String(t.size).replace(/px/gi, ""), o = Number(r);
3745
- if (o && !isNaN(o) && Number.isInteger(o) && o > 0)
3746
- return `${o}px`;
3747
- }
3748
- return Ht;
3749
- }), i = x(() => ({
3750
- boxSizing: "border-box",
3751
- color: t.color,
3752
- display: t.display,
3753
- flexShrink: "0",
3754
- height: n.value,
3755
- lineHeight: "0",
3756
- width: n.value
3757
- }));
3758
- return (r, o) => (C(), D(Se(e.as), {
3759
- "aria-hidden": e.decorative ? "true" : void 0,
3760
- class: "kui-icon add-icon",
3761
- "data-testid": "kui-icon-wrapper-add-icon",
3762
- style: Be(i.value)
3763
- }, {
3764
- default: w(() => [
3765
- (C(), q("svg", {
3766
- "aria-hidden": e.decorative ? "true" : void 0,
3767
- "data-testid": "kui-icon-svg-add-icon",
3768
- fill: "none",
3769
- height: "100%",
3770
- role: "img",
3771
- viewBox: "0 0 24 24",
3772
- width: "100%",
3773
- xmlns: "http://www.w3.org/2000/svg"
3774
- }, [
3775
- e.title ? (C(), q("title", Ll, E(e.title), 1)) : Z("", !0),
3776
- Rl
3777
- ], 8, ql))
3778
- ]),
3779
- _: 1
3780
- }, 8, ["aria-hidden", "style"]));
3781
- }
3782
- }), Bl = /* @__PURE__ */ Ml(Ul, [["__scopeId", "data-v-c1f7c39c"]]), Kl = { class: "kong-ui-entities-snis-list" }, Vl = { key: 1 }, Dl = { key: 1 }, Pl = /* @__PURE__ */ X({
118
+ }, Je = { class: "kong-ui-entities-snis-list" }, Qe = { key: 1 }, Ge = { key: 1 }, We = /* @__PURE__ */ ce({
3783
119
  __name: "SniList",
3784
120
  props: {
3785
121
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
3786
122
  config: {
3787
123
  type: Object,
3788
124
  required: !0,
3789
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || !e.createRoute || !e.getViewRoute || !e.getEditRoute || e.app === "kongManager" && !e.isExactMatch && !e.filterSchema)
125
+ validator: (a) => !(!a || !["konnect", "kongManager"].includes(a == null ? void 0 : a.app) || !a.createRoute || !a.getViewRoute || !a.getEditRoute || a.app === "kongManager" && !a.isExactMatch && !a.filterSchema)
3790
126
  },
3791
127
  // used to override the default identifier for the cache entry
3792
128
  cacheIdentifier: {
@@ -3824,240 +160,240 @@ const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
3824
160
  }
3825
161
  },
3826
162
  emits: ["error", "copy:success", "copy:error", "delete:success"],
3827
- setup(e, { emit: t }) {
3828
- var ue;
3829
- const n = t, i = e, { i18n: { t: r } } = Qt.useI18n(), { axiosInstance: o } = Wn((ue = i.config) == null ? void 0 : ue.axiosRequestConfig), a = T(1), l = x(() => i.config.app !== "kongManager" || !!i.config.disableSorting), s = {
163
+ setup(a, { emit: R }) {
164
+ var N;
165
+ const h = R, t = a, { i18n: { t: s } } = ue.useI18n(), { axiosInstance: p } = fe((N = t.config) == null ? void 0 : N.axiosRequestConfig), K = k(1), $ = v(() => t.config.app !== "kongManager" || !!t.config.disableSorting), L = {
3830
166
  // the Name column is non-hidable
3831
- name: { label: r("snis.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
3832
- certificate: { label: r("snis.list.table_headers.certificate_id"), sortable: !1 },
3833
- tags: { label: r("snis.list.table_headers.tags"), sortable: !1 }
3834
- }, d = s, u = (j) => ({
167
+ name: { label: s("snis.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
168
+ certificate: { label: s("snis.list.table_headers.certificate_id"), sortable: !1 },
169
+ tags: { label: s("snis.list.table_headers.tags"), sortable: !1 }
170
+ }, x = L, D = (i) => ({
3835
171
  style: {
3836
- maxWidth: j.headerKey === "name" ? "250px" : j.headerKey === "certificate" ? "350px" : null
172
+ maxWidth: i.headerKey === "name" ? "250px" : i.headerKey === "certificate" ? "350px" : null
3837
173
  }
3838
- }), c = x(() => {
3839
- var z, Y;
3840
- let j = `${i.config.apiBaseUrl}${Fe.list[i.config.app].all}`;
3841
- return i.config.app === "konnect" ? j = j.replace(/{controlPlaneId}/gi, ((z = i.config) == null ? void 0 : z.controlPlaneId) || "") : i.config.app === "kongManager" && (j = j.replace(/\/{workspace}/gi, (Y = i.config) != null && Y.workspace ? `/${i.config.workspace}` : "")), j;
3842
- }), f = T(""), p = x(() => {
3843
- const j = i.config.app === "konnect" || i.config.isExactMatch;
3844
- if (j)
174
+ }), r = v(() => {
175
+ var f, m;
176
+ let i = `${t.config.apiBaseUrl}${A.list[t.config.app].all}`;
177
+ return t.config.app === "konnect" ? i = i.replace(/{controlPlaneId}/gi, ((f = t.config) == null ? void 0 : f.controlPlaneId) || "") : t.config.app === "kongManager" && (i = i.replace(/\/{workspace}/gi, (m = t.config) != null && m.workspace ? `/${t.config.workspace}` : "")), i;
178
+ }), E = k(""), G = v(() => {
179
+ const i = t.config.app === "konnect" || t.config.isExactMatch;
180
+ if (i)
3845
181
  return {
3846
- isExactMatch: j,
3847
- placeholder: r("search.placeholder")
182
+ isExactMatch: i,
183
+ placeholder: s("search.placeholder")
3848
184
  };
3849
- const { name: z } = s;
185
+ const { name: f } = L;
3850
186
  return {
3851
- isExactMatch: j,
3852
- fields: { name: z },
3853
- schema: i.config.filterSchema
187
+ isExactMatch: i,
188
+ fields: { name: f },
189
+ schema: t.config.filterSchema
3854
190
  };
3855
- }), { fetcher: g, fetcherState: k } = Tl(i.config, c.value), b = () => {
3856
- f.value = "";
3857
- }, I = () => {
3858
- a.value++;
3859
- }, v = T(null), N = T({
3860
- ctaPath: i.config.createRoute,
191
+ }), { fetcher: W, fetcherState: z } = Se(t.config, r.value), H = () => {
192
+ E.value = "";
193
+ }, T = () => {
194
+ K.value++;
195
+ }, _ = k(null), q = k({
196
+ ctaPath: t.config.createRoute,
3861
197
  ctaText: void 0,
3862
- message: `${r("snis.list.empty_state.description")}${i.config.additionMessageForEmptyState ? ` ${i.config.additionMessageForEmptyState}` : ""}`,
3863
- title: r("snis.title")
3864
- }), O = (j, z) => {
3865
- const Y = j.id;
3866
- if (!z(Y)) {
3867
- n("copy:error", {
3868
- entity: j,
198
+ message: `${s("snis.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
199
+ title: s("snis.title")
200
+ }), X = (i, f) => {
201
+ const m = i.id;
202
+ if (!f(m)) {
203
+ h("copy:error", {
204
+ entity: i,
3869
205
  field: "id",
3870
- message: r("errors.copy")
206
+ message: s("errors.copy")
3871
207
  });
3872
208
  return;
3873
209
  }
3874
- n("copy:success", {
3875
- entity: j,
210
+ h("copy:success", {
211
+ entity: i,
3876
212
  field: "id",
3877
- message: r("copy.success", { val: Y })
213
+ message: s("copy.success", { val: m })
3878
214
  });
3879
- }, $ = (j, z) => {
3880
- const Y = JSON.stringify(j);
3881
- if (!z(Y)) {
3882
- n("copy:error", {
3883
- entity: j,
3884
- message: r("errors.copy")
215
+ }, Y = (i, f) => {
216
+ const m = JSON.stringify(i);
217
+ if (!f(m)) {
218
+ h("copy:error", {
219
+ entity: i,
220
+ message: s("errors.copy")
3885
221
  });
3886
222
  return;
3887
223
  }
3888
- n("copy:success", {
3889
- entity: j,
3890
- message: r("copy.success_brief")
224
+ h("copy:success", {
225
+ entity: i,
226
+ message: s("copy.success_brief")
3891
227
  });
3892
- }, m = (j) => ({
3893
- label: r("actions.edit"),
3894
- to: i.config.getEditRoute(j)
3895
- }), h = T(void 0), R = T(!1), F = T(!1), U = T(""), G = Ol(i.config, c.value), K = (j) => {
3896
- h.value = j, R.value = !0;
3897
- }, le = () => {
3898
- R.value = !1, h.value = void 0;
3899
- }, fe = async () => {
3900
- var j, z, Y;
3901
- if ((j = h.value) != null && j.id) {
228
+ }, Z = (i) => ({
229
+ label: s("actions.edit"),
230
+ to: t.config.getEditRoute(i)
231
+ }), I = k(void 0), P = k(!1), F = k(!1), J = k(""), ee = Ee(t.config, r.value), te = (i) => {
232
+ I.value = i, P.value = !0;
233
+ }, U = () => {
234
+ P.value = !1, I.value = void 0;
235
+ }, ie = async () => {
236
+ var i, f, m;
237
+ if ((i = I.value) != null && i.id) {
3902
238
  F.value = !0;
3903
239
  try {
3904
- await o.delete(G(h.value.id)), n("delete:success", h.value), F.value = !1, le(), a.value++;
3905
- } catch (A) {
3906
- U.value = ((Y = (z = A.response) == null ? void 0 : z.data) == null ? void 0 : Y.message) || A.message || r("errors.delete"), n("error", A);
240
+ await p.delete(ee(I.value.id)), h("delete:success", I.value), F.value = !1, U(), K.value++;
241
+ } catch (e) {
242
+ J.value = ((m = (f = e.response) == null ? void 0 : f.data) == null ? void 0 : m.message) || e.message || s("errors.delete"), h("error", e);
3907
243
  } finally {
3908
244
  F.value = !1;
3909
245
  }
3910
246
  }
3911
- }, xe = T(!1);
3912
- return ye(k, (j) => {
3913
- var z, Y, A, M;
3914
- if (Array.isArray((z = j == null ? void 0 : j.response) == null ? void 0 : z.data) && (xe.value = j.response.data.length > 0), j.status === ke.Error) {
3915
- v.value = {
3916
- title: r("errors.general")
3917
- }, (M = (A = (Y = j.error) == null ? void 0 : Y.response) == null ? void 0 : A.data) != null && M.message && (v.value.message = j.error.response.data.message), n("error", j.error);
247
+ }, Q = k(!1);
248
+ return oe(z, (i) => {
249
+ var f, m, e, n;
250
+ if (Array.isArray((f = i == null ? void 0 : i.response) == null ? void 0 : f.data) && (Q.value = i.response.data.length > 0), i.status === Me.Error) {
251
+ _.value = {
252
+ title: s("errors.general")
253
+ }, (n = (e = (m = i.error) == null ? void 0 : m.response) == null ? void 0 : e.data) != null && n.message && (_.value.message = i.error.response.data.message), h("error", i.error);
3918
254
  return;
3919
255
  }
3920
- v.value = null;
3921
- }), dt(async () => {
3922
- await i.canCreate() && (N.value.title = r("snis.list.empty_state.title"), N.value.ctaText = r("actions.create"));
3923
- }), (j, z) => {
3924
- const Y = B("KButton"), A = B("KCopy"), M = B("KBadge"), H = B("KTruncate"), de = B("KDropdownItem"), ie = B("KClipboardProvider");
3925
- return C(), q("div", Kl, [
3926
- _(y(Qo), {
3927
- "cache-identifier": e.cacheIdentifier,
3928
- "cell-attributes": u,
256
+ _.value = null;
257
+ }), de(async () => {
258
+ await t.canCreate() && (q.value.title = s("snis.list.empty_state.title"), q.value.ctaText = s("actions.create"));
259
+ }), (i, f) => {
260
+ const m = M("KButton"), e = M("KCopy"), n = M("KBadge"), u = M("KTruncate"), C = M("KDropdownItem"), y = M("KClipboardProvider");
261
+ return b(), w("div", Je, [
262
+ g(o($e), {
263
+ "cache-identifier": a.cacheIdentifier,
264
+ "cell-attributes": D,
3929
265
  "disable-pagination-page-jump": "",
3930
266
  "disable-row-click": !0,
3931
- "disable-sorting": l.value,
3932
- "empty-state-options": N.value,
267
+ "disable-sorting": $.value,
268
+ "empty-state-options": q.value,
3933
269
  "enable-entity-actions": "",
3934
- "error-message": v.value,
3935
- fetcher: y(g),
3936
- "fetcher-cache-key": a.value,
270
+ "error-message": _.value,
271
+ fetcher: o(W),
272
+ "fetcher-cache-key": K.value,
3937
273
  "pagination-type": "offset",
3938
274
  "preferences-storage-key": "kong-ui-entities-snis-list",
3939
- query: f.value,
3940
- "table-headers": y(d),
3941
- "use-action-outside": e.useActionOutside,
3942
- onClearSearchInput: b,
3943
- onSort: I
275
+ query: E.value,
276
+ "table-headers": o(x),
277
+ "use-action-outside": a.useActionOutside,
278
+ onClearSearchInput: H,
279
+ onSort: T
3944
280
  }, {
3945
- "toolbar-filter": w(() => [
3946
- _(y(vl), {
3947
- modelValue: f.value,
3948
- "onUpdate:modelValue": z[0] || (z[0] = (P) => f.value = P),
3949
- config: p.value
281
+ "toolbar-filter": d(() => [
282
+ g(o(xe), {
283
+ modelValue: E.value,
284
+ "onUpdate:modelValue": f[0] || (f[0] = (c) => E.value = c),
285
+ config: G.value
3950
286
  }, null, 8, ["modelValue", "config"])
3951
287
  ]),
3952
- "toolbar-button": w(() => [
3953
- (C(), D(ii, {
3954
- disabled: !e.useActionOutside,
288
+ "toolbar-button": d(() => [
289
+ (b(), B(ge, {
290
+ disabled: !a.useActionOutside,
3955
291
  to: "#kong-ui-app-page-header-action-button"
3956
292
  }, [
3957
- _(y(rt), {
3958
- "auth-function": () => e.canCreate()
293
+ g(o(ae), {
294
+ "auth-function": () => a.canCreate()
3959
295
  }, {
3960
- default: w(() => [
3961
- ge(_(Y, {
296
+ default: d(() => [
297
+ ye(g(m, {
3962
298
  appearance: "primary",
3963
299
  "data-testid": "toolbar-add-sni",
3964
300
  size: "large",
3965
- to: e.config.createRoute
301
+ to: a.config.createRoute
3966
302
  }, {
3967
- default: w(() => [
3968
- _(y(Bl)),
3969
- Q(" " + E(y(r)("snis.list.toolbar_actions.new")), 1)
303
+ default: d(() => [
304
+ g(o(Ke)),
305
+ O(" " + S(o(s)("snis.list.toolbar_actions.new")), 1)
3970
306
  ]),
3971
307
  _: 1
3972
308
  }, 8, ["to"]), [
3973
- [he, xe.value]
309
+ [ve, Q.value]
3974
310
  ])
3975
311
  ]),
3976
312
  _: 1
3977
313
  }, 8, ["auth-function"])
3978
314
  ], 8, ["disabled"]))
3979
315
  ]),
3980
- name: w(({ rowValue: P }) => [
3981
- L("b", null, E(P ?? "-"), 1)
316
+ name: d(({ rowValue: c }) => [
317
+ re("b", null, S(c ?? "-"), 1)
3982
318
  ]),
3983
- certificate: w(({ row: P }) => [
3984
- P.certificate && P.certificate.id ? (C(), D(A, {
319
+ certificate: d(({ row: c }) => [
320
+ c.certificate && c.certificate.id ? (b(), B(e, {
3985
321
  key: 0,
3986
322
  class: "copy-certificate-uuid",
3987
323
  "data-testid": "copy-certificate-uuid",
3988
- text: P.certificate.id,
324
+ text: c.certificate.id,
3989
325
  truncate: ""
3990
- }, null, 8, ["text"])) : (C(), q("span", Vl, "-"))
326
+ }, null, 8, ["text"])) : (b(), w("span", Qe, "-"))
3991
327
  ]),
3992
- tags: w(({ rowValue: P }) => [
3993
- P != null && P.length ? (C(), D(H, { key: 0 }, {
3994
- default: w(() => [
3995
- (C(!0), q(Yt, null, pt(P, (V) => (C(), D(M, {
3996
- key: V,
3997
- onClick: z[1] || (z[1] = at(() => {
328
+ tags: d(({ rowValue: c }) => [
329
+ c != null && c.length ? (b(), B(u, { key: 0 }, {
330
+ default: d(() => [
331
+ (b(!0), w(he, null, be(c, (l) => (b(), B(n, {
332
+ key: l,
333
+ onClick: f[1] || (f[1] = ke(() => {
3998
334
  }, ["stop"]))
3999
335
  }, {
4000
- default: w(() => [
4001
- Q(E(V), 1)
336
+ default: d(() => [
337
+ O(S(l), 1)
4002
338
  ]),
4003
339
  _: 2
4004
340
  }, 1024))), 128))
4005
341
  ]),
4006
342
  _: 2
4007
- }, 1024)) : (C(), q("span", Dl, "-"))
343
+ }, 1024)) : (b(), w("span", Ge, "-"))
4008
344
  ]),
4009
- actions: w(({ row: P }) => [
4010
- _(ie, null, {
4011
- default: w(({ copyToClipboard: V }) => [
4012
- _(de, {
345
+ actions: d(({ row: c }) => [
346
+ g(y, null, {
347
+ default: d(({ copyToClipboard: l }) => [
348
+ g(C, {
4013
349
  "data-testid": "action-entity-copy-id",
4014
- onClick: (Jn) => O(P, V)
350
+ onClick: (me) => X(c, l)
4015
351
  }, {
4016
- default: w(() => [
4017
- Q(E(y(r)("actions.copy_id")), 1)
352
+ default: d(() => [
353
+ O(S(o(s)("actions.copy_id")), 1)
4018
354
  ]),
4019
355
  _: 2
4020
356
  }, 1032, ["onClick"])
4021
357
  ]),
4022
358
  _: 2
4023
359
  }, 1024),
4024
- _(ie, null, {
4025
- default: w(({ copyToClipboard: V }) => [
4026
- _(de, {
360
+ g(y, null, {
361
+ default: d(({ copyToClipboard: l }) => [
362
+ g(C, {
4027
363
  "data-testid": "action-entity-copy-json",
4028
- onClick: (Jn) => $(P, V)
364
+ onClick: (me) => Y(c, l)
4029
365
  }, {
4030
- default: w(() => [
4031
- Q(E(y(r)("actions.copy_json")), 1)
366
+ default: d(() => [
367
+ O(S(o(s)("actions.copy_json")), 1)
4032
368
  ]),
4033
369
  _: 2
4034
370
  }, 1032, ["onClick"])
4035
371
  ]),
4036
372
  _: 2
4037
373
  }, 1024),
4038
- _(y(rt), {
4039
- "auth-function": () => e.canEdit(P)
374
+ g(o(ae), {
375
+ "auth-function": () => a.canEdit(c)
4040
376
  }, {
4041
- default: w(() => [
4042
- _(de, {
377
+ default: d(() => [
378
+ g(C, {
4043
379
  "data-testid": "action-entity-edit",
4044
- item: m(P.id)
380
+ item: Z(c.id)
4045
381
  }, null, 8, ["item"])
4046
382
  ]),
4047
383
  _: 2
4048
384
  }, 1032, ["auth-function"]),
4049
- _(y(rt), {
4050
- "auth-function": () => e.canDelete(P)
385
+ g(o(ae), {
386
+ "auth-function": () => a.canDelete(c)
4051
387
  }, {
4052
- default: w(() => [
4053
- _(de, {
388
+ default: d(() => [
389
+ g(C, {
4054
390
  danger: "",
4055
391
  "data-testid": "action-entity-delete",
4056
392
  "has-divider": "",
4057
- onClick: (V) => K(P)
393
+ onClick: (l) => te(c)
4058
394
  }, {
4059
- default: w(() => [
4060
- Q(E(y(r)("actions.delete")), 1)
395
+ default: d(() => [
396
+ O(S(o(s)("actions.delete")), 1)
4061
397
  ]),
4062
398
  _: 2
4063
399
  }, 1032, ["onClick"])
@@ -4067,38 +403,38 @@ const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
4067
403
  ]),
4068
404
  _: 1
4069
405
  }, 8, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "use-action-outside"]),
4070
- _(y(nl), {
406
+ g(o(De), {
4071
407
  "action-pending": F.value,
4072
- description: y(r)("delete.description"),
4073
- "entity-name": h.value && (h.value.name || h.value.id),
4074
- "entity-type": y(Xt).SNI,
4075
- error: U.value,
408
+ description: o(s)("delete.description"),
409
+ "entity-name": I.value && (I.value.name || I.value.id),
410
+ "entity-type": o(Fe).SNI,
411
+ error: J.value,
4076
412
  "need-confirm": !1,
4077
- title: y(r)("delete.title"),
4078
- visible: R.value,
4079
- onCancel: le,
4080
- onProceed: fe
413
+ title: o(s)("delete.title"),
414
+ visible: P.value,
415
+ onCancel: U,
416
+ onProceed: ie
4081
417
  }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
4082
418
  ]);
4083
419
  };
4084
420
  }
4085
- }), Yn = (e, t) => {
4086
- const n = e.__vccOpts || e;
4087
- for (const [i, r] of t)
4088
- n[i] = r;
4089
- return n;
4090
- }, ls = /* @__PURE__ */ Yn(Pl, [["__scopeId", "data-v-7738772b"]]), zl = { class: "kong-ui-entities-snis-form" }, Hl = { "data-testid": "no-search-results" }, Wl = {
421
+ }), pe = (a, R) => {
422
+ const h = a.__vccOpts || a;
423
+ for (const [t, s] of R)
424
+ h[t] = s;
425
+ return h;
426
+ }, nt = /* @__PURE__ */ pe(We, [["__scopeId", "data-v-7738772b"]]), ze = { class: "kong-ui-entities-snis-form" }, He = { "data-testid": "no-search-results" }, Xe = {
4091
427
  key: 2,
4092
428
  class: "invalid-certificate-message",
4093
429
  "data-testid": "invalid-certificate-message"
4094
- }, Yl = /* @__PURE__ */ X({
430
+ }, Ye = /* @__PURE__ */ ce({
4095
431
  __name: "SniForm",
4096
432
  props: {
4097
433
  /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
4098
434
  config: {
4099
435
  type: Object,
4100
436
  required: !0,
4101
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string" || !e.cancelRoute)
437
+ validator: (a) => !(!a || !["konnect", "kongManager"].includes(a == null ? void 0 : a.app) || a.app === "konnect" && !a.controlPlaneId || a.app === "kongManager" && typeof a.workspace != "string" || !a.cancelRoute)
4102
438
  },
4103
439
  /** If a valid SNI ID is provided, it will put the form in Edit mode instead of Create */
4104
440
  sniId: {
@@ -4116,9 +452,9 @@ const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
4116
452
  }
4117
453
  },
4118
454
  emits: ["update", "error", "loading"],
4119
- setup(e, { emit: t }) {
4120
- var Y;
4121
- const n = t, i = e, r = Gt(), { i18n: { t: o } } = Qt.useI18n(), { getMessageFromError: a } = jl(), { axiosInstance: l } = Wn((Y = i.config) == null ? void 0 : Y.axiosRequestConfig), s = x(() => Fe.form[i.config.app].edit), d = x(() => i.sniId ? Pe.Edit : Pe.Create), u = x(() => i.config.certificateId && d.value === Pe.Create ? i.config.certificateId : ""), c = kt({
455
+ setup(a, { emit: R }) {
456
+ var m;
457
+ const h = R, t = a, s = Te(), { i18n: { t: p } } = ue.useI18n(), { getMessageFromError: K } = Ne(), { axiosInstance: $ } = fe((m = t.config) == null ? void 0 : m.axiosRequestConfig), L = v(() => A.form[t.config.app].edit), x = v(() => t.sniId ? ne.Edit : ne.Create), D = v(() => t.config.certificateId && x.value === ne.Create ? t.config.certificateId : ""), r = se({
4122
458
  fields: {
4123
459
  name: "",
4124
460
  tags: "",
@@ -4126,161 +462,161 @@ const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
4126
462
  },
4127
463
  isReadonly: !1,
4128
464
  errorMessage: ""
4129
- }), f = kt({
465
+ }), E = se({
4130
466
  name: "",
4131
467
  tags: "",
4132
468
  certificate_id: ""
4133
- }), p = x(() => JSON.stringify(c.fields) !== JSON.stringify(f) && !!c.fields.name && !!(c.fields.certificate_id || u.value)), g = (A) => {
4134
- var M, H;
4135
- c.fields.name = (A == null ? void 0 : A.name) || "", c.fields.tags = ((M = A == null ? void 0 : A.tags) == null ? void 0 : M.join(", ")) || "", c.fields.certificate_id = ((H = A == null ? void 0 : A.certificate) == null ? void 0 : H.id) || "", Object.assign(f, c.fields);
4136
- }, k = () => {
4137
- r.push(i.config.cancelRoute);
4138
- }, b = x(() => {
4139
- var M, H;
4140
- let A = `${i.config.apiBaseUrl}${Fe.form[i.config.app].validate}`;
4141
- return i.config.app === "konnect" ? A = A.replace(/{controlPlaneId}/gi, ((M = i.config) == null ? void 0 : M.controlPlaneId) || "") : i.config.app === "kongManager" && (A = A.replace(/\/{workspace}/gi, (H = i.config) != null && H.workspace ? `/${i.config.workspace}` : "")), A = A.replace(/{id}/gi, i.sniId), A;
4142
- }), I = x(() => {
4143
- var M, H;
4144
- let A = `${i.config.apiBaseUrl}${Fe.form[i.config.app][d.value]}`;
4145
- return i.config.app === "konnect" ? A = A.replace(/{controlPlaneId}/gi, ((M = i.config) == null ? void 0 : M.controlPlaneId) || "") : i.config.app === "kongManager" && (A = A.replace(/\/{workspace}/gi, (H = i.config) != null && H.workspace ? `/${i.config.workspace}` : "")), A = A.replace(/{id}/gi, i.sniId), A;
4146
- }), v = x(() => {
4147
- var A, M;
469
+ }), G = v(() => JSON.stringify(r.fields) !== JSON.stringify(E) && !!r.fields.name && !!(r.fields.certificate_id || D.value)), W = (e) => {
470
+ var n, u;
471
+ r.fields.name = (e == null ? void 0 : e.name) || "", r.fields.tags = ((n = e == null ? void 0 : e.tags) == null ? void 0 : n.join(", ")) || "", r.fields.certificate_id = ((u = e == null ? void 0 : e.certificate) == null ? void 0 : u.id) || "", Object.assign(E, r.fields);
472
+ }, z = () => {
473
+ s.push(t.config.cancelRoute);
474
+ }, H = v(() => {
475
+ var n, u;
476
+ let e = `${t.config.apiBaseUrl}${A.form[t.config.app].validate}`;
477
+ return t.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((n = t.config) == null ? void 0 : n.controlPlaneId) || "") : t.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (u = t.config) != null && u.workspace ? `/${t.config.workspace}` : "")), e = e.replace(/{id}/gi, t.sniId), e;
478
+ }), T = v(() => {
479
+ var n, u;
480
+ let e = `${t.config.apiBaseUrl}${A.form[t.config.app][x.value]}`;
481
+ return t.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((n = t.config) == null ? void 0 : n.controlPlaneId) || "") : t.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (u = t.config) != null && u.workspace ? `/${t.config.workspace}` : "")), e = e.replace(/{id}/gi, t.sniId), e;
482
+ }), _ = v(() => {
483
+ var e, n;
4148
484
  return {
4149
- name: c.fields.name,
4150
- tags: (M = (A = c.fields.tags.split(",")) == null ? void 0 : A.map((H) => String(H || "").trim())) == null ? void 0 : M.filter((H) => H !== ""),
4151
- certificate: { id: u.value || c.fields.certificate_id }
485
+ name: r.fields.name,
486
+ tags: (n = (e = r.fields.tags.split(",")) == null ? void 0 : e.map((u) => String(u || "").trim())) == null ? void 0 : n.filter((u) => u !== ""),
487
+ certificate: { id: D.value || r.fields.certificate_id }
4152
488
  };
4153
- }), N = async () => {
4154
- var A, M, H, de, ie, P;
489
+ }), q = async () => {
490
+ var e, n, u, C, y, c;
4155
491
  try {
4156
- c.isReadonly = !0;
4157
- let V;
4158
- await l.post(b.value, v.value), d.value === "create" ? V = await l.post(I.value, v.value) : d.value === "edit" && (V = ((A = i.config) == null ? void 0 : A.app) === "konnect" ? await l.put(I.value, v.value) : await l.patch(I.value, v.value)), c.fields.name = ((M = V == null ? void 0 : V.data) == null ? void 0 : M.name) || "", c.fields.tags = ((de = (H = V == null ? void 0 : V.data) == null ? void 0 : H.tags) == null ? void 0 : de.join(", ")) || "", c.fields.certificate_id = ((P = (ie = V == null ? void 0 : V.data) == null ? void 0 : ie.certificate) == null ? void 0 : P.id) || "", Object.assign(f, c.fields), n("update", V == null ? void 0 : V.data);
4159
- } catch (V) {
4160
- c.errorMessage = a(V), n("error", V);
492
+ r.isReadonly = !0;
493
+ let l;
494
+ await $.post(H.value, _.value), x.value === "create" ? l = await $.post(T.value, _.value) : x.value === "edit" && (l = ((e = t.config) == null ? void 0 : e.app) === "konnect" ? await $.put(T.value, _.value) : await $.patch(T.value, _.value)), r.fields.name = ((n = l == null ? void 0 : l.data) == null ? void 0 : n.name) || "", r.fields.tags = ((C = (u = l == null ? void 0 : l.data) == null ? void 0 : u.tags) == null ? void 0 : C.join(", ")) || "", r.fields.certificate_id = ((c = (y = l == null ? void 0 : l.data) == null ? void 0 : y.certificate) == null ? void 0 : c.id) || "", Object.assign(E, r.fields), h("update", l == null ? void 0 : l.data);
495
+ } catch (l) {
496
+ r.errorMessage = K(l), h("error", l);
4161
497
  } finally {
4162
- c.isReadonly = !1;
498
+ r.isReadonly = !1;
4163
499
  }
4164
500
  }, {
4165
- debouncedQueryChange: O,
4166
- loading: $,
4167
- allRecords: m,
4168
- error: h,
4169
- validationError: R,
501
+ debouncedQueryChange: X,
502
+ loading: Y,
503
+ allRecords: Z,
504
+ error: I,
505
+ validationError: P,
4170
506
  loadItems: F,
4171
- results: U
4172
- } = Fl(i.config, Fe.form[i.config.app].certificates), G = (A) => {
4173
- O(A);
4174
- }, K = x(() => h.value ? o("errors.certificates.fetch") : ""), le = x(() => R.value ? o("errors.certificates.invalid") : ""), fe = T(0), xe = x(() => m.value === void 0), ue = T(/* @__PURE__ */ new Set()), j = x(() => Array.from(ue.value).map((M) => ({
4175
- label: M,
4176
- value: M,
4177
- selected: c.fields.certificate_id === M
4178
- }))), z = (A) => {
4179
- ue.value.clear();
4180
- let M;
4181
- for (M of A)
4182
- ue.value.add(M.id);
507
+ results: J
508
+ } = we(t.config, A.form[t.config.app].certificates), ee = (e) => {
509
+ X(e);
510
+ }, te = v(() => I.value ? p("errors.certificates.fetch") : ""), U = v(() => P.value ? p("errors.certificates.invalid") : ""), ie = k(0), Q = v(() => Z.value === void 0), N = k(/* @__PURE__ */ new Set()), i = v(() => Array.from(N.value).map((n) => ({
511
+ label: n,
512
+ value: n,
513
+ selected: r.fields.certificate_id === n
514
+ }))), f = (e) => {
515
+ N.value.clear();
516
+ let n;
517
+ for (n of e)
518
+ N.value.add(n.id);
4183
519
  };
4184
- return ye(U, (A) => {
4185
- z(A);
4186
- }, { immediate: !0, deep: !0 }), ye(j, () => {
4187
- fe.value++;
4188
- }, { immediate: !0, deep: !0 }), dt(async () => {
520
+ return oe(J, (e) => {
521
+ f(e);
522
+ }, { immediate: !0, deep: !0 }), oe(i, () => {
523
+ ie.value++;
524
+ }, { immediate: !0, deep: !0 }), de(async () => {
4189
525
  await F();
4190
- }), (A, M) => {
4191
- const H = B("KInput"), de = B("KSelect");
4192
- return C(), q("div", zl, [
4193
- _(y(Po), {
4194
- "can-submit": p.value,
4195
- config: e.config,
4196
- "edit-id": e.sniId,
4197
- "enable-terraform": e.enableTerraform,
4198
- "entity-type": y(Ze).SNI,
4199
- "error-message": c.errorMessage || K.value,
4200
- "fetch-url": s.value,
4201
- "form-fields": v.value,
4202
- "is-readonly": c.isReadonly,
4203
- onCancel: k,
4204
- "onFetch:error": M[3] || (M[3] = (ie) => A.$emit("error", ie)),
4205
- "onFetch:success": g,
4206
- onLoading: M[4] || (M[4] = (ie) => A.$emit("loading", ie)),
4207
- onSubmit: N
526
+ }), (e, n) => {
527
+ const u = M("KInput"), C = M("KSelect");
528
+ return b(), w("div", ze, [
529
+ g(o(Be), {
530
+ "can-submit": G.value,
531
+ config: a.config,
532
+ "edit-id": a.sniId,
533
+ "enable-terraform": a.enableTerraform,
534
+ "entity-type": o(Re).SNI,
535
+ "error-message": r.errorMessage || te.value,
536
+ "fetch-url": L.value,
537
+ "form-fields": _.value,
538
+ "is-readonly": r.isReadonly,
539
+ onCancel: z,
540
+ "onFetch:error": n[3] || (n[3] = (y) => e.$emit("error", y)),
541
+ "onFetch:success": W,
542
+ onLoading: n[4] || (n[4] = (y) => e.$emit("loading", y)),
543
+ onSubmit: q
4208
544
  }, {
4209
- default: w(() => [
4210
- _(y(zt), {
4211
- description: y(o)("form.sections.general.description"),
4212
- title: y(o)("form.sections.general.title")
545
+ default: d(() => [
546
+ g(o(le), {
547
+ description: o(p)("form.sections.general.description"),
548
+ title: o(p)("form.sections.general.title")
4213
549
  }, {
4214
- default: w(() => [
4215
- _(H, {
4216
- modelValue: c.fields.name,
4217
- "onUpdate:modelValue": M[0] || (M[0] = (ie) => c.fields.name = ie),
550
+ default: d(() => [
551
+ g(u, {
552
+ modelValue: r.fields.name,
553
+ "onUpdate:modelValue": n[0] || (n[0] = (y) => r.fields.name = y),
4218
554
  modelModifiers: { trim: !0 },
4219
555
  autocomplete: "off",
4220
556
  "data-testid": "sni-form-name",
4221
- label: y(o)("form.fields.name.label"),
4222
- placeholder: y(o)("form.fields.name.placeholder"),
4223
- readonly: c.isReadonly,
557
+ label: o(p)("form.fields.name.label"),
558
+ placeholder: o(p)("form.fields.name.placeholder"),
559
+ readonly: r.isReadonly,
4224
560
  required: "",
4225
561
  type: "text"
4226
562
  }, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
4227
- _(H, {
4228
- modelValue: c.fields.tags,
4229
- "onUpdate:modelValue": M[1] || (M[1] = (ie) => c.fields.tags = ie),
563
+ g(u, {
564
+ modelValue: r.fields.tags,
565
+ "onUpdate:modelValue": n[1] || (n[1] = (y) => r.fields.tags = y),
4230
566
  modelModifiers: { trim: !0 },
4231
567
  autocomplete: "off",
4232
568
  "data-testid": "sni-form-tags",
4233
- help: y(o)("form.fields.tags.help"),
4234
- label: y(o)("form.fields.tags.label"),
4235
- "label-attributes": { info: y(o)("form.fields.tags.tooltip") },
4236
- placeholder: y(o)("form.fields.tags.placeholder"),
4237
- readonly: c.isReadonly,
569
+ help: o(p)("form.fields.tags.help"),
570
+ label: o(p)("form.fields.tags.label"),
571
+ "label-attributes": { info: o(p)("form.fields.tags.tooltip") },
572
+ placeholder: o(p)("form.fields.tags.placeholder"),
573
+ readonly: r.isReadonly,
4238
574
  type: "text"
4239
575
  }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
4240
576
  ]),
4241
577
  _: 1
4242
578
  }, 8, ["description", "title"]),
4243
- _(y(zt), {
4244
- description: y(o)("form.sections.certificate.description"),
579
+ g(o(le), {
580
+ description: o(p)("form.sections.certificate.description"),
4245
581
  "has-divider": "",
4246
- title: y(o)("form.sections.certificate.title")
582
+ title: o(p)("form.sections.certificate.title")
4247
583
  }, {
4248
- default: w(() => [
4249
- u.value ? (C(), D(H, {
584
+ default: d(() => [
585
+ D.value ? (b(), B(u, {
4250
586
  key: 0,
4251
587
  "data-testid": "sni-form-certificate-id",
4252
- label: y(o)("form.fields.certificate_id.label"),
4253
- "model-value": u.value,
588
+ label: o(p)("form.fields.certificate_id.label"),
589
+ "model-value": D.value,
4254
590
  readonly: "",
4255
591
  required: "",
4256
592
  width: "100%"
4257
- }, null, 8, ["label", "model-value"])) : (C(), D(de, {
593
+ }, null, 8, ["label", "model-value"])) : (b(), B(C, {
4258
594
  key: 1,
4259
- modelValue: c.fields.certificate_id,
4260
- "onUpdate:modelValue": M[2] || (M[2] = (ie) => c.fields.certificate_id = ie),
595
+ modelValue: r.fields.certificate_id,
596
+ "onUpdate:modelValue": n[2] || (n[2] = (y) => r.fields.certificate_id = y),
4261
597
  clearable: "",
4262
598
  "data-testid": "sni-form-certificate-id",
4263
- "dropdown-footer-text": xe.value ? y(o)("form.fields.certificate_id.footer") : void 0,
599
+ "dropdown-footer-text": Q.value ? o(p)("form.fields.certificate_id.footer") : void 0,
4264
600
  "enable-filtering": "",
4265
601
  "filter-function": () => !0,
4266
- items: j.value,
4267
- label: y(o)("form.fields.certificate_id.label"),
4268
- loading: y($),
4269
- placeholder: y(o)("form.fields.certificate_id.placeholder"),
4270
- readonly: c.isReadonly,
602
+ items: i.value,
603
+ label: o(p)("form.fields.certificate_id.label"),
604
+ loading: o(Y),
605
+ placeholder: o(p)("form.fields.certificate_id.placeholder"),
606
+ readonly: r.isReadonly,
4271
607
  required: "",
4272
608
  width: "100%",
4273
- onQueryChange: G
609
+ onQueryChange: ee
4274
610
  }, {
4275
- loading: w(() => [
4276
- L("div", null, E(y(o)("actions.loading")), 1)
611
+ loading: d(() => [
612
+ re("div", null, S(o(p)("actions.loading")), 1)
4277
613
  ]),
4278
- empty: w(() => [
4279
- L("div", Hl, E(y(o)("search.no_results")), 1)
614
+ empty: d(() => [
615
+ re("div", He, S(o(p)("search.no_results")), 1)
4280
616
  ]),
4281
617
  _: 1
4282
618
  }, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly"])),
4283
- le.value ? (C(), q("p", Wl, E(le.value), 1)) : Z("", !0)
619
+ U.value ? (b(), w("p", Xe, S(U.value), 1)) : _e("", !0)
4284
620
  ]),
4285
621
  _: 1
4286
622
  }, 8, ["description", "title"])
@@ -4290,8 +626,8 @@ const xl = ["aria-labelledby"], Il = { class: "form-section-wrapper" }, Al = {
4290
626
  ]);
4291
627
  };
4292
628
  }
4293
- }), ss = /* @__PURE__ */ Yn(Yl, [["__scopeId", "data-v-b606a09d"]]);
629
+ }), ot = /* @__PURE__ */ pe(Ye, [["__scopeId", "data-v-b606a09d"]]);
4294
630
  export {
4295
- ss as SniForm,
4296
- ls as SniList
631
+ ot as SniForm,
632
+ nt as SniList
4297
633
  };