@schalkneethling/miyagi-core 4.4.2 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +7 -2
  2. package/api/app.js +16 -16
  3. package/api/index.js +263 -262
  4. package/bin/miyagi.js +1 -1
  5. package/dist/css/iframe.css +6 -30
  6. package/frontend/assets/css/iframe/accordion-tabs.css +39 -39
  7. package/frontend/assets/css/iframe/jsontree.js.css +149 -149
  8. package/frontend/assets/css/iframe/prism.css +45 -45
  9. package/frontend/assets/css/iframe/styleguide/colors.css +27 -27
  10. package/frontend/assets/css/iframe/styleguide/fonts.css +23 -23
  11. package/frontend/assets/css/iframe/styleguide/index.css +58 -58
  12. package/frontend/assets/css/iframe/styleguide/spacings.css +10 -10
  13. package/frontend/assets/css/iframe.css +191 -191
  14. package/frontend/assets/css/main/menu/config-switcher.css +21 -21
  15. package/frontend/assets/css/main/menu/config-switchers.css +34 -34
  16. package/frontend/assets/css/main/menu/goto.css +16 -16
  17. package/frontend/assets/css/main/menu/nav.css +49 -49
  18. package/frontend/assets/css/main/menu/search.css +34 -34
  19. package/frontend/assets/css/main/menu/title.css +18 -18
  20. package/frontend/assets/css/main/menu.css +89 -89
  21. package/frontend/assets/css/main/reset.css +47 -47
  22. package/frontend/assets/css/main.css +41 -41
  23. package/frontend/assets/css/shared.css +16 -16
  24. package/frontend/assets/css/tokens.css +108 -107
  25. package/frontend/assets/js/_accordion-tabs.js +392 -392
  26. package/frontend/assets/js/_goto.js +59 -59
  27. package/frontend/assets/js/_iframe-links.js +14 -14
  28. package/frontend/assets/js/_is-triggered.js +3 -3
  29. package/frontend/assets/js/_main.js +369 -369
  30. package/frontend/assets/js/_mock-data.js +8 -8
  31. package/frontend/assets/js/_prism.js +1082 -1081
  32. package/frontend/assets/js/_search.js +186 -186
  33. package/frontend/assets/js/_socket.js +44 -44
  34. package/frontend/assets/js/config-switcher/development-mode.js +38 -38
  35. package/frontend/assets/js/config-switcher/index.js +55 -55
  36. package/frontend/assets/js/config-switcher/text-direction.js +22 -22
  37. package/frontend/assets/js/config-switcher/theme.js +68 -68
  38. package/frontend/assets/js/iframe.build.js +25 -25
  39. package/frontend/assets/js/iframe.js +38 -38
  40. package/frontend/assets/js/jsontree.js +979 -976
  41. package/frontend/assets/js/main.build.js +29 -29
  42. package/frontend/assets/js/main.js +31 -31
  43. package/frontend/assets/js/styleguide/color-converter.js +652 -652
  44. package/frontend/assets/js/styleguide/index.js +100 -100
  45. package/lib/build/index.js +1014 -1020
  46. package/lib/cli/app.js +16 -16
  47. package/lib/cli/component.js +50 -50
  48. package/lib/cli/doctor.js +130 -121
  49. package/lib/cli/drupal-assets.js +163 -157
  50. package/lib/cli/lint.js +196 -196
  51. package/lib/cli/run.js +150 -146
  52. package/lib/config.js +86 -86
  53. package/lib/constants/lint-log-levels.js +6 -6
  54. package/lib/drupal/load-assets-config.js +59 -60
  55. package/lib/drupal/resolve-library-assets.js +132 -141
  56. package/lib/errors.js +20 -20
  57. package/lib/generator/component.js +124 -124
  58. package/lib/generator/mocks.js +156 -156
  59. package/lib/helpers.js +68 -68
  60. package/lib/i18n/en.js +93 -93
  61. package/lib/i18n/index.js +8 -8
  62. package/lib/index.js +13 -13
  63. package/lib/init/args.js +153 -153
  64. package/lib/init/config.js +452 -438
  65. package/lib/init/engines.js +41 -41
  66. package/lib/init/index.js +83 -83
  67. package/lib/init/rendering.js +3 -3
  68. package/lib/init/static.js +90 -90
  69. package/lib/init/twing/cache.js +27 -27
  70. package/lib/init/twing/functions.js +37 -37
  71. package/lib/init/views.js +5 -5
  72. package/lib/logger.js +72 -72
  73. package/lib/mocks/get.js +88 -88
  74. package/lib/mocks/index.js +2 -2
  75. package/lib/mocks/resolve/ref.js +447 -447
  76. package/lib/mocks/resolve/tpl.js +218 -218
  77. package/lib/mocks/resolve.js +154 -154
  78. package/lib/render/helpers/resolve-assets.js +29 -39
  79. package/lib/render/helpers.js +27 -27
  80. package/lib/render/index.js +18 -18
  81. package/lib/render/views/iframe/component.docs.js +50 -50
  82. package/lib/render/views/iframe/component.js +249 -248
  83. package/lib/render/views/iframe/design-tokens/colors.js +38 -38
  84. package/lib/render/views/iframe/design-tokens/index.js +3 -3
  85. package/lib/render/views/iframe/design-tokens/sizes.js +35 -35
  86. package/lib/render/views/iframe/design-tokens/typography.js +37 -37
  87. package/lib/render/views/iframe/docs.js +42 -42
  88. package/lib/render/views/iframe/index.js +28 -28
  89. package/lib/render/views/iframe/variation.js +89 -89
  90. package/lib/render/views/iframe/variation.standalone.js +69 -68
  91. package/lib/render/views/main/component.docs.js +38 -38
  92. package/lib/render/views/main/component.js +55 -55
  93. package/lib/render/views/main/design-tokens.js +38 -38
  94. package/lib/render/views/main/docs.js +33 -33
  95. package/lib/render/views/main/index.js +33 -33
  96. package/lib/state/components.js +99 -99
  97. package/lib/state/css.js +33 -33
  98. package/lib/state/docs.js +72 -72
  99. package/lib/state/file-contents.js +154 -154
  100. package/lib/state/helpers.js +53 -53
  101. package/lib/state/index.js +39 -39
  102. package/lib/state/menu/index.js +202 -202
  103. package/lib/state/menu/structure.js +84 -84
  104. package/lib/state/partials.js +12 -12
  105. package/lib/state/source-tree.js +51 -51
  106. package/lib/styleguide/color-names.js +148 -148
  107. package/lib/styleguide/colors.js +113 -113
  108. package/lib/styleguide/helpers.js +33 -33
  109. package/lib/styleguide/index.js +4 -4
  110. package/lib/styleguide/media-queries.js +18 -18
  111. package/lib/styleguide/spacings.js +22 -22
  112. package/lib/styleguide/typography.js +46 -46
  113. package/lib/validator/mocks.js +110 -83
  114. package/lib/validator/schemas.js +236 -227
  115. package/package.json +120 -117
@@ -1,979 +1,982 @@
1
1
  "use strict";
2
2
  var Is, Data, DomElement, DateTime, Constants;
3
- ((e) => {
4
- function t(e) {
5
- return null != e && "" !== e.toString();
6
- }
7
- function n(e) {
8
- return t(e) && "object" == typeof e;
9
- }
10
- function o(e) {
11
- return n(e) && e instanceof Array;
12
- }
13
- (e.defined = t),
14
- (e.definedObject = n),
15
- (e.definedBoolean = function (e) {
16
- return t(e) && "boolean" == typeof e;
17
- }),
18
- (e.definedString = function (e) {
19
- return t(e) && "string" == typeof e;
20
- }),
21
- (e.definedFunction = function (e) {
22
- return t(e) && "function" == typeof e;
23
- }),
24
- (e.definedNumber = function (e) {
25
- return t(e) && "number" == typeof e;
26
- }),
27
- (e.definedArray = o),
28
- (e.definedDate = function (e) {
29
- return n(e) && e instanceof Date;
30
- }),
31
- (e.definedDecimal = function (e) {
32
- return t(e) && "number" == typeof e && e % 1 != 0;
33
- }),
34
- (e.invalidOptionArray = function (e, t = 1) {
35
- return !o(e) || e.length < t;
36
- }),
37
- (e.hexColor = function (e) {
38
- let t = e.length >= 2 && e.length <= 7;
39
- return t && "#" === e[0] && (t = isNaN(+e.substring(1, e.length - 1))), t;
40
- });
3
+ (((e) => {
4
+ function t(e) {
5
+ return null != e && "" !== e.toString();
6
+ }
7
+ function n(e) {
8
+ return t(e) && "object" == typeof e;
9
+ }
10
+ function o(e) {
11
+ return n(e) && e instanceof Array;
12
+ }
13
+ ((e.defined = t),
14
+ (e.definedObject = n),
15
+ (e.definedBoolean = function (e) {
16
+ return t(e) && "boolean" == typeof e;
17
+ }),
18
+ (e.definedString = function (e) {
19
+ return t(e) && "string" == typeof e;
20
+ }),
21
+ (e.definedFunction = function (e) {
22
+ return t(e) && "function" == typeof e;
23
+ }),
24
+ (e.definedNumber = function (e) {
25
+ return t(e) && "number" == typeof e;
26
+ }),
27
+ (e.definedArray = o),
28
+ (e.definedDate = function (e) {
29
+ return n(e) && e instanceof Date;
30
+ }),
31
+ (e.definedDecimal = function (e) {
32
+ return t(e) && "number" == typeof e && e % 1 != 0;
33
+ }),
34
+ (e.invalidOptionArray = function (e, t = 1) {
35
+ return !o(e) || e.length < t;
36
+ }),
37
+ (e.hexColor = function (e) {
38
+ let t = e.length >= 2 && e.length <= 7;
39
+ return (
40
+ t && "#" === e[0] && (t = isNaN(+e.substring(1, e.length - 1))),
41
+ t
42
+ );
43
+ }));
41
44
  })(Is || (Is = {})),
42
- ((e) => {
43
- let t;
44
- var n;
45
- function o(e, t) {
46
- return Is.definedArray(e) ? e : t;
47
- }
48
- ((n = t = e.String || (e.String = {})).newGuid = function () {
49
- const e = [];
50
- for (let t = 0; t < 32; t++) {
51
- (8 !== t && 12 !== t && 16 !== t && 20 !== t) || e.push("-");
52
- const n = Math.floor(16 * Math.random()).toString(16);
53
- e.push(n);
54
- }
55
- return e.join("");
56
- }),
57
- (n.padNumber = function (e, t = 1) {
58
- const n = e.toString();
59
- let o = n;
60
- if (n.length < t) {
61
- const e = t - n.length + 1;
62
- o = Array(e).join("0") + n;
63
- }
64
- return o;
65
- }),
66
- (e.getDefaultAnyString = function (e, t) {
67
- return "string" == typeof e ? e : t;
68
- }),
69
- (e.getDefaultString = function (e, t) {
70
- return Is.definedString(e) ? e : t;
71
- }),
72
- (e.getDefaultBoolean = function (e, t) {
73
- return Is.definedBoolean(e) ? e : t;
74
- }),
75
- (e.getDefaultNumber = function (e, t) {
76
- return Is.definedNumber(e) ? e : t;
77
- }),
78
- (e.getDefaultFunction = function (e, t) {
79
- return Is.definedFunction(e) ? e : t;
80
- }),
81
- (e.getDefaultArray = o),
82
- (e.getDefaultObject = function (e, t) {
83
- return Is.definedObject(e) ? e : t;
84
- }),
85
- (e.getDefaultStringOrArray = function (e, t) {
86
- let n = t;
87
- if (Is.definedString(e)) {
88
- const o = e.toString().split(" ");
89
- 0 === o.length ? (e = t) : (n = o);
90
- } else n = o(e, t);
91
- return n;
92
- }),
93
- (e.getFixedDecimalPlacesValue = function (e, t) {
94
- var n;
95
- const o = new RegExp("^-?\\d+(?:.\\d{0," + (t || -1) + "})?");
96
- return (null == (n = e.toString().match(o)) ? void 0 : n[0]) || "";
97
- });
98
- })(Data || (Data = {})),
99
- ((e) => {
100
- function t(e, t, n = "", o = null) {
101
- const r = t.toLowerCase();
102
- let a =
103
- "text" === r ? document.createTextNode("") : document.createElement(r);
104
- return (
105
- Is.defined(n) && (a.className = n),
106
- Is.defined(o) ? e.insertBefore(a, o) : e.appendChild(a),
107
- a
108
- );
109
- }
110
- (e.create = t),
111
- (e.createWithHTML = function (e, n, o, r, a = null) {
112
- const i = t(e, n, o, a);
113
- return (i.textContent = r), i;
114
- }),
115
- (e.addClass = function (e, t) {
116
- e.classList.add(t);
117
- });
118
- })(DomElement || (DomElement = {})),
119
- ((e) => {
120
- function t(e) {
121
- return e.getDay() - 1 < 0 ? 6 : e.getDay() - 1;
122
- }
123
- function n(e, t) {
124
- let n = e.thText;
125
- return (
126
- 31 === t || 21 === t || 1 === t
127
- ? (n = e.stText)
128
- : 22 === t || 2 === t
129
- ? (n = e.ndText)
130
- : (23 !== t && 3 !== t) || (n = e.rdText),
131
- n
132
- );
133
- }
134
- (e.getWeekdayNumber = t),
135
- (e.getDayOrdinal = n),
136
- (e.getCustomFormattedDateText = function (e, o, r) {
137
- let a = r;
138
- const i = t(o);
139
- return (
140
- (a = a.replace("{hh}", Data.String.padNumber(o.getHours(), 2))),
141
- (a = a.replace("{h}", o.getHours().toString())),
142
- (a = a.replace("{MM}", Data.String.padNumber(o.getMinutes(), 2))),
143
- (a = a.replace("{M}", o.getMinutes().toString())),
144
- (a = a.replace("{ss}", Data.String.padNumber(o.getSeconds(), 2))),
145
- (a = a.replace("{s}", o.getSeconds().toString())),
146
- (a = a.replace("{dddd}", e.dayNames[i])),
147
- (a = a.replace("{ddd}", e.dayNamesAbbreviated[i])),
148
- (a = a.replace("{dd}", Data.String.padNumber(o.getDate()))),
149
- (a = a.replace("{d}", o.getDate().toString())),
150
- (a = a.replace("{o}", n(e, o.getDate()))),
151
- (a = a.replace("{mmmm}", e.monthNames[o.getMonth()])),
152
- (a = a.replace("{mmm}", e.monthNamesAbbreviated[o.getMonth()])),
153
- (a = a.replace("{mm}", Data.String.padNumber(o.getMonth() + 1))),
154
- (a = a.replace("{m}", (o.getMonth() + 1).toString())),
155
- (a = a.replace("{yyyy}", o.getFullYear().toString())),
156
- (a = a.replace("{yyy}", o.getFullYear().toString().substring(1))),
157
- (a = a.replace("{yy}", o.getFullYear().toString().substring(2))),
158
- (a = a.replace(
159
- "{y}",
160
- Number.parseInt(o.getFullYear().toString().substring(2)).toString(),
161
- )),
162
- a
163
- );
164
- });
165
- })(DateTime || (DateTime = {})),
166
- ((Constants || (Constants = {})).JSONTREE_JS_ATTRIBUTE_NAME =
167
- "data-jsontree-js"),
168
- (() => {
169
- let _configuration = {},
170
- _elements_Data = {};
171
- function render() {
172
- const e = _configuration.domElementTypes,
173
- t = e.length;
174
- for (let n = 0; n < t; n++) {
175
- const t = document.getElementsByTagName(e[n]),
176
- o = [].slice.call(t),
177
- r = o.length;
178
- for (let e = 0; e < r && renderElement(o[e]); e++);
179
- }
180
- }
181
- function renderElement(e) {
182
- let t = !0;
183
- if (
184
- Is.defined(e) &&
185
- e.hasAttribute(Constants.JSONTREE_JS_ATTRIBUTE_NAME)
186
- ) {
187
- const n = e.getAttribute(Constants.JSONTREE_JS_ATTRIBUTE_NAME);
188
- if (Is.definedString(n)) {
189
- const o = getObjectFromString(n);
190
- o.parsed && Is.definedObject(o.object)
191
- ? renderControl(renderBindingOptions(o.object, e))
192
- : _configuration.safeMode ||
193
- (console.error(
194
- _configuration.attributeNotValidErrorText.replace(
195
- "{{attribute_name}}",
196
- Constants.JSONTREE_JS_ATTRIBUTE_NAME,
197
- ),
198
- ),
199
- (t = !1));
200
- } else
201
- _configuration.safeMode ||
202
- (console.error(
203
- _configuration.attributeNotSetErrorText.replace(
204
- "{{attribute_name}}",
205
- Constants.JSONTREE_JS_ATTRIBUTE_NAME,
206
- ),
207
- ),
208
- (t = !1));
209
- }
210
- return t;
211
- }
212
- function renderBindingOptions(e, t) {
213
- const n = buildAttributeOptions(e);
214
- return (n._currentView = {}), (n._currentView.element = t), n;
215
- }
216
- function renderControl(e) {
217
- fireCustomTriggerEvent(e.events.onBeforeRender, e._currentView.element),
218
- Is.definedString(e._currentView.element.id) ||
219
- (e._currentView.element.id = Data.String.newGuid()),
220
- (e._currentView.element.className = "json-tree-js"),
221
- e._currentView.element.removeAttribute(
222
- Constants.JSONTREE_JS_ATTRIBUTE_NAME,
223
- ),
224
- _elements_Data.hasOwnProperty(e._currentView.element.id) ||
225
- (_elements_Data[e._currentView.element.id] = e),
226
- renderControlContainer(e),
227
- fireCustomTriggerEvent(
228
- e.events.onRenderComplete,
229
- e._currentView.element,
230
- );
231
- }
232
- function renderControlContainer(e) {
233
- const t = _elements_Data[e._currentView.element.id].data;
234
- (e._currentView.element.innerHTML = ""),
235
- renderControlTitleBar(e),
236
- Is.definedObject(t) && !Is.definedArray(t)
237
- ? renderObject(e._currentView.element, e, t)
238
- : Is.definedArray(t) && renderArray(e._currentView.element, e, t);
239
- }
240
- function renderControlTitleBar(e) {
241
- if (e.title.show || e.title.showTreeControls || e.title.showCopyButton) {
242
- const t = DomElement.create(e._currentView.element, "div", "title-bar"),
243
- n = DomElement.create(t, "div", "controls");
244
- if (
245
- (e.title.show &&
246
- DomElement.createWithHTML(t, "div", "title", e.title.text, n),
247
- e.title.showCopyButton)
248
- ) {
249
- DomElement.createWithHTML(
250
- n,
251
- "button",
252
- "copy-all",
253
- _configuration.copyAllButtonText,
254
- ).onclick = () => {
255
- const t = JSON.stringify(
256
- _elements_Data[e._currentView.element.id].data,
257
- );
258
- navigator.clipboard.writeText(t),
259
- fireCustomTriggerEvent(e.events.onCopyAll, t);
260
- };
261
- }
262
- if (e.title.showTreeControls) {
263
- const t = DomElement.createWithHTML(
264
- n,
265
- "button",
266
- "openAll",
267
- _configuration.openAllButtonText,
268
- ),
269
- o = DomElement.createWithHTML(
270
- n,
271
- "button",
272
- "closeAll",
273
- _configuration.closeAllButtonText,
274
- );
275
- (t.onclick = () => {
276
- openAllNodes(e);
277
- }),
278
- (o.onclick = () => {
279
- closeAllNodes(e);
280
- });
281
- }
282
- }
283
- }
284
- function openAllNodes(e) {
285
- (e.showAllAsClosed = !1),
286
- renderControlContainer(e),
287
- fireCustomTriggerEvent(e.events.onOpenAll, e._currentView.element);
288
- }
289
- function closeAllNodes(e) {
290
- (e.showAllAsClosed = !0),
291
- renderControlContainer(e),
292
- fireCustomTriggerEvent(e.events.onCloseAll, e._currentView.element);
293
- }
294
- function renderObject(e, t, n) {
295
- const o = DomElement.create(e, "div", "object-type-title"),
296
- r = DomElement.create(e, "div", "object-type-contents"),
297
- a = renderObjectValues(
298
- t.showArrowToggles
299
- ? DomElement.create(o, "button", "down-arrow")
300
- : null,
301
- r,
302
- t,
303
- n,
304
- );
305
- DomElement.createWithHTML(
306
- o,
307
- "span",
308
- t.showValueColors ? "object" : "",
309
- _configuration.objectText,
310
- ),
311
- t.showCounts &&
312
- a > 0 &&
313
- DomElement.createWithHTML(
314
- o,
315
- "span",
316
- t.showValueColors ? "object count" : "count",
317
- "{" + a + "}",
318
- );
319
- }
320
- function renderArray(e, t, n) {
321
- const o = DomElement.create(e, "div", "object-type-title"),
322
- r = DomElement.create(e, "div", "object-type-contents"),
323
- a = t.showArrowToggles
324
- ? DomElement.create(o, "button", "down-arrow")
325
- : null;
326
- DomElement.createWithHTML(
327
- o,
328
- "span",
329
- t.showValueColors ? "array" : "",
330
- _configuration.arrayText,
331
- ),
332
- renderArrayValues(a, r, t, n),
333
- t.showCounts &&
334
- DomElement.createWithHTML(
335
- o,
336
- "span",
337
- t.showValueColors ? "array count" : "count",
338
- "[" + n.length + "]",
339
- );
340
- }
341
- function renderObjectValues(e, t, n, o) {
342
- let r = 0,
343
- a = [];
344
- for (let e in o) o.hasOwnProperty(e) && a.push(e);
345
- n.sortPropertyNames &&
346
- ((a = a.sort()),
347
- n.sortPropertyNamesInAlphabeticalOrder || (a = a.reverse()));
348
- const i = a.length;
349
- for (let e = 0; e < i; e++) {
350
- const l = a[e];
351
- o.hasOwnProperty(l) && (renderValue(t, n, l, o[l], e === i - 1), r++);
352
- }
353
- return addArrowEvent(n, e, t), r;
354
- }
355
- function renderArrayValues(e, t, n, o) {
356
- const r = o.length;
357
- if (n.reverseArrayValues)
358
- for (let e = r; e--; )
359
- renderValue(t, n, getIndexName(n, e, r), o[e], 0 === e);
360
- else
361
- for (let e = 0; e < r; e++)
362
- renderValue(t, n, getIndexName(n, e, r), o[e], e === r - 1);
363
- addArrowEvent(n, e, t);
364
- }
365
- function renderValue(e, t, n, o, r) {
366
- const a = DomElement.create(e, "div", "object-type-value"),
367
- i = t.showArrowToggles
368
- ? DomElement.create(a, "button", "no-arrow")
369
- : null;
370
- let l = null,
371
- s = null,
372
- u = !1,
373
- c = null,
374
- d = !0;
375
- if (
376
- (DomElement.createWithHTML(a, "span", "title", n),
377
- DomElement.createWithHTML(a, "span", "split", ":"),
378
- Is.defined(o))
379
- )
380
- if (Is.definedFunction(o))
381
- t.ignore.functionValues
382
- ? (u = !0)
383
- : ((l = t.showValueColors ? "function" : ""),
384
- (s = DomElement.createWithHTML(a, "span", l, getFunctionName(o))),
385
- (c = "function"),
386
- Is.definedFunction(t.events.onFunctionRender) &&
387
- fireCustomTriggerEvent(t.events.onFunctionRender, s),
388
- createComma(t, a, r));
389
- else if (Is.definedBoolean(o))
390
- t.ignore.booleanValues
391
- ? (u = !0)
392
- : ((l = t.showValueColors ? "boolean" : ""),
393
- (s = DomElement.createWithHTML(a, "span", l, o)),
394
- (c = "boolean"),
395
- Is.definedFunction(t.events.onBooleanRender) &&
396
- fireCustomTriggerEvent(t.events.onBooleanRender, s),
397
- createComma(t, a, r));
398
- else if (Is.definedDecimal(o))
399
- if (t.ignore.decimalValues) u = !0;
400
- else {
401
- const e = Data.getFixedDecimalPlacesValue(
402
- o,
403
- t.maximumDecimalPlaces,
404
- );
405
- (l = t.showValueColors ? "decimal" : ""),
406
- (s = DomElement.createWithHTML(a, "span", l, e)),
407
- (c = "decimal"),
408
- Is.definedFunction(t.events.onDecimalRender) &&
409
- fireCustomTriggerEvent(t.events.onDecimalRender, s),
410
- createComma(t, a, r);
411
- }
412
- else if (Is.definedNumber(o))
413
- t.ignore.numberValues
414
- ? (u = !0)
415
- : ((l = t.showValueColors ? "number" : ""),
416
- (s = DomElement.createWithHTML(a, "span", l, o)),
417
- (c = "number"),
418
- Is.definedFunction(t.events.onNumberRender) &&
419
- fireCustomTriggerEvent(t.events.onNumberRender, s),
420
- createComma(t, a, r));
421
- else if (Is.definedString(o))
422
- if (t.ignore.stringValues) u = !0;
423
- else {
424
- let e = null;
425
- t.showValueColors && t.showStringHexColors && Is.hexColor(o)
426
- ? (e = o)
427
- : t.maximumStringLength > 0 &&
428
- o.length > t.maximumStringLength &&
429
- (o =
430
- o.substring(0, t.maximumStringLength) +
431
- _configuration.ellipsisText);
432
- const n = t.showStringQuotes ? '"' + o + '"' : o;
433
- (l = t.showValueColors ? "string" : ""),
434
- (s = DomElement.createWithHTML(a, "span", l, n)),
435
- (c = "string"),
436
- Is.definedString(e) && (s.style.color = e),
437
- Is.definedFunction(t.events.onStringRender) &&
438
- fireCustomTriggerEvent(t.events.onStringRender, s),
439
- createComma(t, a, r);
440
- }
441
- else if (Is.definedDate(o))
442
- t.ignore.dateValues
443
- ? (u = !0)
444
- : ((l = t.showValueColors ? "date" : ""),
445
- (s = DomElement.createWithHTML(
446
- a,
447
- "span",
448
- l,
449
- DateTime.getCustomFormattedDateText(
450
- _configuration,
451
- o,
452
- t.dateTimeFormat,
453
- ),
454
- )),
455
- (c = "date"),
456
- Is.definedFunction(t.events.onDateRender) &&
457
- fireCustomTriggerEvent(t.events.onDateRender, s),
458
- createComma(t, a, r));
459
- else if (Is.definedObject(o) && !Is.definedArray(o))
460
- if (t.ignore.objectValues) u = !0;
461
- else {
462
- const e = DomElement.create(
463
- a,
464
- "span",
465
- t.showValueColors ? "object" : "",
466
- ),
467
- n = renderObjectValues(
468
- i,
469
- DomElement.create(a, "div", "object-type-contents"),
470
- t,
471
- o,
472
- );
473
- DomElement.createWithHTML(
474
- e,
475
- "span",
476
- "title",
477
- _configuration.objectText,
478
- ),
479
- t.showCounts &&
480
- n > 0 &&
481
- DomElement.createWithHTML(e, "span", "count", "{" + n + "}"),
482
- createComma(t, e, r),
483
- (c = "object");
484
- }
485
- else if (Is.definedArray(o))
486
- if (t.ignore.arrayValues) u = !0;
487
- else {
488
- const e = DomElement.create(
489
- a,
490
- "span",
491
- t.showValueColors ? "array" : "",
492
- ),
493
- n = DomElement.create(a, "div", "object-type-contents");
494
- DomElement.createWithHTML(
495
- e,
496
- "span",
497
- "title",
498
- _configuration.arrayText,
499
- ),
500
- t.showCounts &&
501
- DomElement.createWithHTML(
502
- e,
503
- "span",
504
- "count",
505
- "[" + o.length + "]",
506
- ),
507
- createComma(t, e, r),
508
- renderArrayValues(i, n, t, o),
509
- (c = "array");
510
- }
511
- else
512
- t.ignore.unknownValues
513
- ? (u = !0)
514
- : ((l = t.showValueColors ? "unknown" : ""),
515
- (s = DomElement.createWithHTML(a, "span", l, o.toString())),
516
- (c = "unknown"),
517
- Is.definedFunction(t.events.onUnknownRender) &&
518
- fireCustomTriggerEvent(t.events.onUnknownRender, s),
519
- createComma(t, a, r));
520
- else
521
- t.ignore.nullValues
522
- ? (u = !0)
523
- : ((l = t.showValueColors ? "null" : ""),
524
- (s = DomElement.createWithHTML(a, "span", l, "null")),
525
- (d = !1),
526
- Is.definedFunction(t.events.onNullRender) &&
527
- fireCustomTriggerEvent(t.events.onNullRender, s),
528
- createComma(t, a, r));
529
- u ? e.removeChild(a) : Is.defined(s) && addValueClickEvent(t, s, o, c, d);
530
- }
531
- function addValueClickEvent(e, t, n, o, r) {
532
- r && Is.definedFunction(e.events.onValueClick)
533
- ? (t.onclick = () => {
534
- fireCustomTriggerEvent(e.events.onValueClick, n, o);
535
- })
536
- : DomElement.addClass(t, "no-hover");
537
- }
538
- function addArrowEvent(e, t, n) {
539
- Is.defined(t) &&
540
- ((t.onclick = () => {
541
- "down-arrow" === t.className
542
- ? ((n.style.display = "none"), (t.className = "right-arrow"))
543
- : ((n.style.display = "block"), (t.className = "down-arrow"));
544
- }),
545
- e.showAllAsClosed
546
- ? ((n.style.display = "none"), (t.className = "right-arrow"))
547
- : (t.className = "down-arrow"));
548
- }
549
- function getFunctionName(e) {
550
- let t;
551
- const n = e.toString().split("(")[0].split(" ");
552
- return (t = 2 === n.length ? n[1] : n[0]), (t += "()"), t;
553
- }
554
- function createComma(e, t, n) {
555
- e.showCommas && !n && DomElement.createWithHTML(t, "span", "comma", ",");
556
- }
557
- function getIndexName(e, t, n) {
558
- let o = e.useZeroIndexingForArrays ? t.toString() : (t + 1).toString();
559
- return (
560
- e.addArrayIndexPadding ||
561
- (o = Data.String.padNumber(parseInt(o), n.toString().length)),
562
- o
563
- );
564
- }
565
- function buildAttributeOptions(e) {
566
- let t = Data.getDefaultObject(e, {});
567
- return (
568
- (t.data = Data.getDefaultObject(t.data, null)),
569
- (t.showCounts = Data.getDefaultBoolean(t.showCounts, !0)),
570
- (t.useZeroIndexingForArrays = Data.getDefaultBoolean(
571
- t.useZeroIndexingForArrays,
572
- !0,
573
- )),
574
- (t.dateTimeFormat = Data.getDefaultString(
575
- t.dateTimeFormat,
576
- "{dd}{o} {mmmm} {yyyy} {hh}:{MM}:{ss}",
577
- )),
578
- (t.showArrowToggles = Data.getDefaultBoolean(t.showArrowToggles, !0)),
579
- (t.showStringQuotes = Data.getDefaultBoolean(t.showStringQuotes, !0)),
580
- (t.showAllAsClosed = Data.getDefaultBoolean(t.showAllAsClosed, !1)),
581
- (t.sortPropertyNames = Data.getDefaultBoolean(t.sortPropertyNames, !0)),
582
- (t.sortPropertyNamesInAlphabeticalOrder = Data.getDefaultBoolean(
583
- t.sortPropertyNamesInAlphabeticalOrder,
584
- !0,
585
- )),
586
- (t.showCommas = Data.getDefaultBoolean(t.showCommas, !1)),
587
- (t.reverseArrayValues = Data.getDefaultBoolean(
588
- t.reverseArrayValues,
589
- !1,
590
- )),
591
- (t.addArrayIndexPadding = Data.getDefaultBoolean(
592
- t.addArrayIndexPadding,
593
- !1,
594
- )),
595
- (t.showValueColors = Data.getDefaultBoolean(t.showValueColors, !0)),
596
- (t.maximumDecimalPlaces = Data.getDefaultNumber(
597
- t.maximumDecimalPlaces,
598
- 2,
599
- )),
600
- (t.maximumStringLength = Data.getDefaultNumber(
601
- t.maximumStringLength,
602
- 0,
603
- )),
604
- (t.showStringHexColors = Data.getDefaultBoolean(
605
- t.showStringHexColors,
606
- !1,
607
- )),
608
- (t = buildAttributeOptionTitle(t)),
609
- (t = buildAttributeOptionIgnore(t)),
610
- (t = buildAttributeOptionCustomTriggers(t)),
611
- t
612
- );
613
- }
614
- function buildAttributeOptionTitle(e) {
615
- return (
616
- (e.title = Data.getDefaultObject(e.title, {})),
617
- (e.title.text = Data.getDefaultString(e.title.text, "JsonTree.js")),
618
- (e.title.show = Data.getDefaultBoolean(e.title.show, !0)),
619
- (e.title.showTreeControls = Data.getDefaultBoolean(
620
- e.title.showTreeControls,
621
- !0,
622
- )),
623
- (e.title.showCopyButton = Data.getDefaultBoolean(
624
- e.title.showCopyButton,
625
- !1,
626
- )),
627
- e
628
- );
629
- }
630
- function buildAttributeOptionIgnore(e) {
631
- return (
632
- (e.ignore = Data.getDefaultObject(e.ignore, {})),
633
- (e.ignore.nullValues = Data.getDefaultBoolean(e.ignore.nullValues, !1)),
634
- (e.ignore.functionValues = Data.getDefaultBoolean(
635
- e.ignore.functionValues,
636
- !1,
637
- )),
638
- (e.ignore.unknownValues = Data.getDefaultBoolean(
639
- e.ignore.unknownValues,
640
- !1,
641
- )),
642
- (e.ignore.booleanValues = Data.getDefaultBoolean(
643
- e.ignore.booleanValues,
644
- !1,
645
- )),
646
- (e.ignore.decimalValues = Data.getDefaultBoolean(
647
- e.ignore.decimalValues,
648
- !1,
649
- )),
650
- (e.ignore.numberValues = Data.getDefaultBoolean(
651
- e.ignore.numberValues,
652
- !1,
653
- )),
654
- (e.ignore.stringValues = Data.getDefaultBoolean(
655
- e.ignore.stringValues,
656
- !1,
657
- )),
658
- (e.ignore.dateValues = Data.getDefaultBoolean(e.ignore.dateValues, !1)),
659
- (e.ignore.objectValues = Data.getDefaultBoolean(
660
- e.ignore.objectValues,
661
- !1,
662
- )),
663
- (e.ignore.arrayValues = Data.getDefaultBoolean(
664
- e.ignore.arrayValues,
665
- !1,
666
- )),
667
- e
668
- );
669
- }
670
- function buildAttributeOptionCustomTriggers(e) {
671
- return (
672
- (e.events = Data.getDefaultObject(e.events, {})),
673
- (e.events.onBeforeRender = Data.getDefaultFunction(
674
- e.events.onBeforeRender,
675
- null,
676
- )),
677
- (e.events.onRenderComplete = Data.getDefaultFunction(
678
- e.events.onRenderComplete,
679
- null,
680
- )),
681
- (e.events.onValueClick = Data.getDefaultFunction(
682
- e.events.onValueClick,
683
- null,
684
- )),
685
- (e.events.onRefresh = Data.getDefaultFunction(
686
- e.events.onRefresh,
687
- null,
688
- )),
689
- (e.events.onCopyAll = Data.getDefaultFunction(
690
- e.events.onCopyAll,
691
- null,
692
- )),
693
- (e.events.onOpenAll = Data.getDefaultFunction(
694
- e.events.onOpenAll,
695
- null,
696
- )),
697
- (e.events.onCloseAll = Data.getDefaultFunction(
698
- e.events.onCloseAll,
699
- null,
700
- )),
701
- (e.events.onDestroy = Data.getDefaultFunction(
702
- e.events.onDestroy,
703
- null,
704
- )),
705
- (e.events.onBooleanRender = Data.getDefaultFunction(
706
- e.events.onBooleanRender,
707
- null,
708
- )),
709
- (e.events.onDecimalRender = Data.getDefaultFunction(
710
- e.events.onDecimalRender,
711
- null,
712
- )),
713
- (e.events.onNumberRender = Data.getDefaultFunction(
714
- e.events.onNumberRender,
715
- null,
716
- )),
717
- (e.events.onStringRender = Data.getDefaultFunction(
718
- e.events.onStringRender,
719
- null,
720
- )),
721
- (e.events.onDateRender = Data.getDefaultFunction(
722
- e.events.onDateRender,
723
- null,
724
- )),
725
- (e.events.onFunctionRender = Data.getDefaultFunction(
726
- e.events.onFunctionRender,
727
- null,
728
- )),
729
- (e.events.onNullRender = Data.getDefaultFunction(
730
- e.events.onNullRender,
731
- null,
732
- )),
733
- (e.events.onUnknownRender = Data.getDefaultFunction(
734
- e.events.onUnknownRender,
735
- null,
736
- )),
737
- e
738
- );
739
- }
740
- function fireCustomTriggerEvent(e, ...t) {
741
- Is.definedFunction(e) && e.apply(null, [].slice.call(t, 0));
742
- }
743
- function getObjectFromString(objectString) {
744
- const result = {
745
- parsed: !0,
746
- object: null,
747
- };
748
- try {
749
- Is.definedString(objectString) &&
750
- (result.object = JSON.parse(objectString));
751
- } catch (e1) {
752
- try {
753
- (result.object = eval("(" + objectString + ")")),
754
- Is.definedFunction(result.object) &&
755
- (result.object = result.object());
756
- } catch (e) {
757
- _configuration.safeMode ||
758
- (console.error(
759
- _configuration.objectErrorText
760
- .replace("{{error_1}}", e1.message)
761
- .replace("{{error_2}}", e.message),
762
- ),
763
- (result.parsed = !1)),
764
- (result.object = null);
765
- }
766
- }
767
- return result;
768
- }
769
- function destroyElement(e) {
770
- (e._currentView.element.innerHTML = ""),
771
- (e._currentView.element.className = ""),
772
- fireCustomTriggerEvent(e.events.onDestroy, e._currentView.element);
773
- }
774
- function buildDefaultConfiguration(e = null) {
775
- (_configuration = Data.getDefaultObject(e, {})),
776
- (_configuration.safeMode = Data.getDefaultBoolean(
777
- _configuration.safeMode,
778
- !0,
779
- )),
780
- (_configuration.domElementTypes = Data.getDefaultStringOrArray(
781
- _configuration.domElementTypes,
782
- ["*"],
783
- )),
784
- buildDefaultConfigurationStrings();
785
- }
786
- function buildDefaultConfigurationStrings() {
787
- (_configuration.objectText = Data.getDefaultAnyString(
788
- _configuration.objectText,
789
- "object",
790
- )),
791
- (_configuration.arrayText = Data.getDefaultAnyString(
792
- _configuration.arrayText,
793
- "array",
794
- )),
795
- (_configuration.closeAllButtonText = Data.getDefaultAnyString(
796
- _configuration.closeAllButtonText,
797
- "Close All",
798
- )),
799
- (_configuration.openAllButtonText = Data.getDefaultAnyString(
800
- _configuration.openAllButtonText,
801
- "Open All",
802
- )),
803
- (_configuration.copyAllButtonText = Data.getDefaultAnyString(
804
- _configuration.copyAllButtonText,
805
- "Copy All",
806
- )),
807
- (_configuration.objectErrorText = Data.getDefaultAnyString(
808
- _configuration.objectErrorText,
809
- "Errors in object: {{error_1}}, {{error_2}}",
810
- )),
811
- (_configuration.attributeNotValidErrorText = Data.getDefaultAnyString(
812
- _configuration.attributeNotValidErrorText,
813
- "The attribute '{{attribute_name}}' is not a valid object.",
814
- )),
815
- (_configuration.attributeNotSetErrorText = Data.getDefaultAnyString(
816
- _configuration.attributeNotSetErrorText,
817
- "The attribute '{{attribute_name}}' has not been set correctly.",
818
- )),
819
- (_configuration.stText = Data.getDefaultAnyString(
820
- _configuration.stText,
821
- "st",
822
- )),
823
- (_configuration.ndText = Data.getDefaultAnyString(
824
- _configuration.ndText,
825
- "nd",
826
- )),
827
- (_configuration.rdText = Data.getDefaultAnyString(
828
- _configuration.rdText,
829
- "rd",
830
- )),
831
- (_configuration.thText = Data.getDefaultAnyString(
832
- _configuration.thText,
833
- "th",
834
- )),
835
- (_configuration.ellipsisText = Data.getDefaultAnyString(
836
- _configuration.ellipsisText,
837
- "...",
838
- )),
839
- Is.invalidOptionArray(_configuration.dayNames, 7) &&
840
- (_configuration.dayNames = [
841
- "Monday",
842
- "Tuesday",
843
- "Wednesday",
844
- "Thursday",
845
- "Friday",
846
- "Saturday",
847
- "Sunday",
848
- ]),
849
- Is.invalidOptionArray(_configuration.dayNamesAbbreviated, 7) &&
850
- (_configuration.dayNamesAbbreviated = [
851
- "Mon",
852
- "Tue",
853
- "Wed",
854
- "Thu",
855
- "Fri",
856
- "Sat",
857
- "Sun",
858
- ]),
859
- Is.invalidOptionArray(_configuration.monthNames, 12) &&
860
- (_configuration.monthNames = [
861
- "January",
862
- "February",
863
- "March",
864
- "April",
865
- "May",
866
- "June",
867
- "July",
868
- "August",
869
- "September",
870
- "October",
871
- "November",
872
- "December",
873
- ]),
874
- Is.invalidOptionArray(_configuration.monthNamesAbbreviated, 12) &&
875
- (_configuration.monthNamesAbbreviated = [
876
- "Jan",
877
- "Feb",
878
- "Mar",
879
- "Apr",
880
- "May",
881
- "Jun",
882
- "Jul",
883
- "Aug",
884
- "Sep",
885
- "Oct",
886
- "Nov",
887
- "Dec",
888
- ]);
889
- }
890
- const _public = {
891
- refresh: function (e) {
892
- if (Is.definedString(e) && _elements_Data.hasOwnProperty(e)) {
893
- const t = _elements_Data[e];
894
- renderControlContainer(t),
895
- fireCustomTriggerEvent(t.events.onRefresh, t._currentView.element);
896
- }
897
- return _public;
898
- },
899
- refreshAll: function () {
900
- for (let e in _elements_Data)
901
- if (_elements_Data.hasOwnProperty(e)) {
902
- const t = _elements_Data[e];
903
- renderControlContainer(t),
904
- fireCustomTriggerEvent(
905
- t.events.onRefresh,
906
- t._currentView.element,
907
- );
908
- }
909
- return _public;
910
- },
911
- render: function (e, t) {
912
- return (
913
- Is.definedObject(e) &&
914
- Is.definedObject(t) &&
915
- renderControl(renderBindingOptions(t, e)),
916
- _public
917
- );
918
- },
919
- renderAll: function () {
920
- return render(), _public;
921
- },
922
- openAll: function (e) {
923
- return (
924
- Is.definedString(e) &&
925
- _elements_Data.hasOwnProperty(e) &&
926
- openAllNodes(_elements_Data[e]),
927
- _public
928
- );
929
- },
930
- closeAll: function (e) {
931
- return (
932
- Is.definedString(e) &&
933
- _elements_Data.hasOwnProperty(e) &&
934
- closeAllNodes(_elements_Data[e]),
935
- _public
936
- );
937
- },
938
- destroy: function (e) {
939
- return (
940
- Is.definedString(e) &&
941
- _elements_Data.hasOwnProperty(e) &&
942
- (destroyElement(_elements_Data[e]), delete _elements_Data[e]),
943
- _public
944
- );
945
- },
946
- destroyAll: function () {
947
- for (let e in _elements_Data)
948
- _elements_Data.hasOwnProperty(e) && destroyElement(_elements_Data[e]);
949
- return (_elements_Data = {}), _public;
950
- },
951
- setConfiguration: function (e) {
952
- if (Is.definedObject(e)) {
953
- let t = !1;
954
- const n = _configuration;
955
- for (let o in e)
956
- e.hasOwnProperty(o) &&
957
- _configuration.hasOwnProperty(o) &&
958
- n[o] !== e[o] &&
959
- ((n[o] = e[o]), (t = !0));
960
- t && buildDefaultConfiguration(n);
961
- }
962
- return _public;
963
- },
964
- getIds: function () {
965
- const e = [];
966
- for (let t in _elements_Data)
967
- _elements_Data.hasOwnProperty(t) && e.push(t);
968
- return e;
969
- },
970
- getVersion: function () {
971
- return "2.0.0";
972
- },
973
- };
974
- buildDefaultConfiguration(),
975
- document.addEventListener("DOMContentLoaded", function () {
976
- render();
977
- }),
978
- Is.defined(window.$jsontree) || (window.$jsontree = _public);
979
- })();
45
+ ((e) => {
46
+ let t;
47
+ var n;
48
+ function o(e, t) {
49
+ return Is.definedArray(e) ? e : t;
50
+ }
51
+ (((n = t = e.String || (e.String = {})).newGuid = function () {
52
+ const e = [];
53
+ for (let t = 0; t < 32; t++) {
54
+ (8 !== t && 12 !== t && 16 !== t && 20 !== t) || e.push("-");
55
+ const n = Math.floor(16 * Math.random()).toString(16);
56
+ e.push(n);
57
+ }
58
+ return e.join("");
59
+ }),
60
+ (n.padNumber = function (e, t = 1) {
61
+ const n = e.toString();
62
+ let o = n;
63
+ if (n.length < t) {
64
+ const e = t - n.length + 1;
65
+ o = Array(e).join("0") + n;
66
+ }
67
+ return o;
68
+ }),
69
+ (e.getDefaultAnyString = function (e, t) {
70
+ return "string" == typeof e ? e : t;
71
+ }),
72
+ (e.getDefaultString = function (e, t) {
73
+ return Is.definedString(e) ? e : t;
74
+ }),
75
+ (e.getDefaultBoolean = function (e, t) {
76
+ return Is.definedBoolean(e) ? e : t;
77
+ }),
78
+ (e.getDefaultNumber = function (e, t) {
79
+ return Is.definedNumber(e) ? e : t;
80
+ }),
81
+ (e.getDefaultFunction = function (e, t) {
82
+ return Is.definedFunction(e) ? e : t;
83
+ }),
84
+ (e.getDefaultArray = o),
85
+ (e.getDefaultObject = function (e, t) {
86
+ return Is.definedObject(e) ? e : t;
87
+ }),
88
+ (e.getDefaultStringOrArray = function (e, t) {
89
+ let n = t;
90
+ if (Is.definedString(e)) {
91
+ const o = e.toString().split(" ");
92
+ 0 === o.length ? (e = t) : (n = o);
93
+ } else n = o(e, t);
94
+ return n;
95
+ }),
96
+ (e.getFixedDecimalPlacesValue = function (e, t) {
97
+ var n;
98
+ const o = new RegExp("^-?\\d+(?:.\\d{0," + (t || -1) + "})?");
99
+ return (null == (n = e.toString().match(o)) ? void 0 : n[0]) || "";
100
+ }));
101
+ })(Data || (Data = {})),
102
+ ((e) => {
103
+ function t(e, t, n = "", o = null) {
104
+ const r = t.toLowerCase();
105
+ let a =
106
+ "text" === r ? document.createTextNode("") : document.createElement(r);
107
+ return (
108
+ Is.defined(n) && (a.className = n),
109
+ Is.defined(o) ? e.insertBefore(a, o) : e.appendChild(a),
110
+ a
111
+ );
112
+ }
113
+ ((e.create = t),
114
+ (e.createWithHTML = function (e, n, o, r, a = null) {
115
+ const i = t(e, n, o, a);
116
+ return ((i.textContent = r), i);
117
+ }),
118
+ (e.addClass = function (e, t) {
119
+ e.classList.add(t);
120
+ }));
121
+ })(DomElement || (DomElement = {})),
122
+ ((e) => {
123
+ function t(e) {
124
+ return e.getDay() - 1 < 0 ? 6 : e.getDay() - 1;
125
+ }
126
+ function n(e, t) {
127
+ let n = e.thText;
128
+ return (
129
+ 31 === t || 21 === t || 1 === t
130
+ ? (n = e.stText)
131
+ : 22 === t || 2 === t
132
+ ? (n = e.ndText)
133
+ : (23 !== t && 3 !== t) || (n = e.rdText),
134
+ n
135
+ );
136
+ }
137
+ ((e.getWeekdayNumber = t),
138
+ (e.getDayOrdinal = n),
139
+ (e.getCustomFormattedDateText = function (e, o, r) {
140
+ let a = r;
141
+ const i = t(o);
142
+ return (
143
+ (a = a.replace("{hh}", Data.String.padNumber(o.getHours(), 2))),
144
+ (a = a.replace("{h}", o.getHours().toString())),
145
+ (a = a.replace("{MM}", Data.String.padNumber(o.getMinutes(), 2))),
146
+ (a = a.replace("{M}", o.getMinutes().toString())),
147
+ (a = a.replace("{ss}", Data.String.padNumber(o.getSeconds(), 2))),
148
+ (a = a.replace("{s}", o.getSeconds().toString())),
149
+ (a = a.replace("{dddd}", e.dayNames[i])),
150
+ (a = a.replace("{ddd}", e.dayNamesAbbreviated[i])),
151
+ (a = a.replace("{dd}", Data.String.padNumber(o.getDate()))),
152
+ (a = a.replace("{d}", o.getDate().toString())),
153
+ (a = a.replace("{o}", n(e, o.getDate()))),
154
+ (a = a.replace("{mmmm}", e.monthNames[o.getMonth()])),
155
+ (a = a.replace("{mmm}", e.monthNamesAbbreviated[o.getMonth()])),
156
+ (a = a.replace("{mm}", Data.String.padNumber(o.getMonth() + 1))),
157
+ (a = a.replace("{m}", (o.getMonth() + 1).toString())),
158
+ (a = a.replace("{yyyy}", o.getFullYear().toString())),
159
+ (a = a.replace("{yyy}", o.getFullYear().toString().substring(1))),
160
+ (a = a.replace("{yy}", o.getFullYear().toString().substring(2))),
161
+ (a = a.replace(
162
+ "{y}",
163
+ Number.parseInt(o.getFullYear().toString().substring(2)).toString(),
164
+ )),
165
+ a
166
+ );
167
+ }));
168
+ })(DateTime || (DateTime = {})),
169
+ ((Constants || (Constants = {})).JSONTREE_JS_ATTRIBUTE_NAME =
170
+ "data-jsontree-js"),
171
+ (() => {
172
+ let _configuration = {},
173
+ _elements_Data = {};
174
+ function render() {
175
+ const e = _configuration.domElementTypes,
176
+ t = e.length;
177
+ for (let n = 0; n < t; n++) {
178
+ const t = document.getElementsByTagName(e[n]),
179
+ o = [].slice.call(t),
180
+ r = o.length;
181
+ for (let e = 0; e < r && renderElement(o[e]); e++);
182
+ }
183
+ }
184
+ function renderElement(e) {
185
+ let t = !0;
186
+ if (
187
+ Is.defined(e) &&
188
+ e.hasAttribute(Constants.JSONTREE_JS_ATTRIBUTE_NAME)
189
+ ) {
190
+ const n = e.getAttribute(Constants.JSONTREE_JS_ATTRIBUTE_NAME);
191
+ if (Is.definedString(n)) {
192
+ const o = getObjectFromString(n);
193
+ o.parsed && Is.definedObject(o.object)
194
+ ? renderControl(renderBindingOptions(o.object, e))
195
+ : _configuration.safeMode ||
196
+ (console.error(
197
+ _configuration.attributeNotValidErrorText.replace(
198
+ "{{attribute_name}}",
199
+ Constants.JSONTREE_JS_ATTRIBUTE_NAME,
200
+ ),
201
+ ),
202
+ (t = !1));
203
+ } else
204
+ _configuration.safeMode ||
205
+ (console.error(
206
+ _configuration.attributeNotSetErrorText.replace(
207
+ "{{attribute_name}}",
208
+ Constants.JSONTREE_JS_ATTRIBUTE_NAME,
209
+ ),
210
+ ),
211
+ (t = !1));
212
+ }
213
+ return t;
214
+ }
215
+ function renderBindingOptions(e, t) {
216
+ const n = buildAttributeOptions(e);
217
+ return ((n._currentView = {}), (n._currentView.element = t), n);
218
+ }
219
+ function renderControl(e) {
220
+ (fireCustomTriggerEvent(e.events.onBeforeRender, e._currentView.element),
221
+ Is.definedString(e._currentView.element.id) ||
222
+ (e._currentView.element.id = Data.String.newGuid()),
223
+ (e._currentView.element.className = "json-tree-js"),
224
+ e._currentView.element.removeAttribute(
225
+ Constants.JSONTREE_JS_ATTRIBUTE_NAME,
226
+ ),
227
+ _elements_Data.hasOwnProperty(e._currentView.element.id) ||
228
+ (_elements_Data[e._currentView.element.id] = e),
229
+ renderControlContainer(e),
230
+ fireCustomTriggerEvent(
231
+ e.events.onRenderComplete,
232
+ e._currentView.element,
233
+ ));
234
+ }
235
+ function renderControlContainer(e) {
236
+ const t = _elements_Data[e._currentView.element.id].data;
237
+ ((e._currentView.element.innerHTML = ""),
238
+ renderControlTitleBar(e),
239
+ Is.definedObject(t) && !Is.definedArray(t)
240
+ ? renderObject(e._currentView.element, e, t)
241
+ : Is.definedArray(t) && renderArray(e._currentView.element, e, t));
242
+ }
243
+ function renderControlTitleBar(e) {
244
+ if (e.title.show || e.title.showTreeControls || e.title.showCopyButton) {
245
+ const t = DomElement.create(e._currentView.element, "div", "title-bar"),
246
+ n = DomElement.create(t, "div", "controls");
247
+ if (
248
+ (e.title.show &&
249
+ DomElement.createWithHTML(t, "div", "title", e.title.text, n),
250
+ e.title.showCopyButton)
251
+ ) {
252
+ DomElement.createWithHTML(
253
+ n,
254
+ "button",
255
+ "copy-all",
256
+ _configuration.copyAllButtonText,
257
+ ).onclick = () => {
258
+ const t = JSON.stringify(
259
+ _elements_Data[e._currentView.element.id].data,
260
+ );
261
+ (navigator.clipboard.writeText(t),
262
+ fireCustomTriggerEvent(e.events.onCopyAll, t));
263
+ };
264
+ }
265
+ if (e.title.showTreeControls) {
266
+ const t = DomElement.createWithHTML(
267
+ n,
268
+ "button",
269
+ "openAll",
270
+ _configuration.openAllButtonText,
271
+ ),
272
+ o = DomElement.createWithHTML(
273
+ n,
274
+ "button",
275
+ "closeAll",
276
+ _configuration.closeAllButtonText,
277
+ );
278
+ ((t.onclick = () => {
279
+ openAllNodes(e);
280
+ }),
281
+ (o.onclick = () => {
282
+ closeAllNodes(e);
283
+ }));
284
+ }
285
+ }
286
+ }
287
+ function openAllNodes(e) {
288
+ ((e.showAllAsClosed = !1),
289
+ renderControlContainer(e),
290
+ fireCustomTriggerEvent(e.events.onOpenAll, e._currentView.element));
291
+ }
292
+ function closeAllNodes(e) {
293
+ ((e.showAllAsClosed = !0),
294
+ renderControlContainer(e),
295
+ fireCustomTriggerEvent(e.events.onCloseAll, e._currentView.element));
296
+ }
297
+ function renderObject(e, t, n) {
298
+ const o = DomElement.create(e, "div", "object-type-title"),
299
+ r = DomElement.create(e, "div", "object-type-contents"),
300
+ a = renderObjectValues(
301
+ t.showArrowToggles
302
+ ? DomElement.create(o, "button", "down-arrow")
303
+ : null,
304
+ r,
305
+ t,
306
+ n,
307
+ );
308
+ (DomElement.createWithHTML(
309
+ o,
310
+ "span",
311
+ t.showValueColors ? "object" : "",
312
+ _configuration.objectText,
313
+ ),
314
+ t.showCounts &&
315
+ a > 0 &&
316
+ DomElement.createWithHTML(
317
+ o,
318
+ "span",
319
+ t.showValueColors ? "object count" : "count",
320
+ "{" + a + "}",
321
+ ));
322
+ }
323
+ function renderArray(e, t, n) {
324
+ const o = DomElement.create(e, "div", "object-type-title"),
325
+ r = DomElement.create(e, "div", "object-type-contents"),
326
+ a = t.showArrowToggles
327
+ ? DomElement.create(o, "button", "down-arrow")
328
+ : null;
329
+ (DomElement.createWithHTML(
330
+ o,
331
+ "span",
332
+ t.showValueColors ? "array" : "",
333
+ _configuration.arrayText,
334
+ ),
335
+ renderArrayValues(a, r, t, n),
336
+ t.showCounts &&
337
+ DomElement.createWithHTML(
338
+ o,
339
+ "span",
340
+ t.showValueColors ? "array count" : "count",
341
+ "[" + n.length + "]",
342
+ ));
343
+ }
344
+ function renderObjectValues(e, t, n, o) {
345
+ let r = 0,
346
+ a = [];
347
+ for (let e in o) o.hasOwnProperty(e) && a.push(e);
348
+ n.sortPropertyNames &&
349
+ ((a = a.sort()),
350
+ n.sortPropertyNamesInAlphabeticalOrder || (a = a.reverse()));
351
+ const i = a.length;
352
+ for (let e = 0; e < i; e++) {
353
+ const l = a[e];
354
+ o.hasOwnProperty(l) && (renderValue(t, n, l, o[l], e === i - 1), r++);
355
+ }
356
+ return (addArrowEvent(n, e, t), r);
357
+ }
358
+ function renderArrayValues(e, t, n, o) {
359
+ const r = o.length;
360
+ if (n.reverseArrayValues)
361
+ for (let e = r; e--; )
362
+ renderValue(t, n, getIndexName(n, e, r), o[e], 0 === e);
363
+ else
364
+ for (let e = 0; e < r; e++)
365
+ renderValue(t, n, getIndexName(n, e, r), o[e], e === r - 1);
366
+ addArrowEvent(n, e, t);
367
+ }
368
+ function renderValue(e, t, n, o, r) {
369
+ const a = DomElement.create(e, "div", "object-type-value"),
370
+ i = t.showArrowToggles
371
+ ? DomElement.create(a, "button", "no-arrow")
372
+ : null;
373
+ let l = null,
374
+ s = null,
375
+ u = !1,
376
+ c = null,
377
+ d = !0;
378
+ if (
379
+ (DomElement.createWithHTML(a, "span", "title", n),
380
+ DomElement.createWithHTML(a, "span", "split", ":"),
381
+ Is.defined(o))
382
+ )
383
+ if (Is.definedFunction(o))
384
+ t.ignore.functionValues
385
+ ? (u = !0)
386
+ : ((l = t.showValueColors ? "function" : ""),
387
+ (s = DomElement.createWithHTML(a, "span", l, getFunctionName(o))),
388
+ (c = "function"),
389
+ Is.definedFunction(t.events.onFunctionRender) &&
390
+ fireCustomTriggerEvent(t.events.onFunctionRender, s),
391
+ createComma(t, a, r));
392
+ else if (Is.definedBoolean(o))
393
+ t.ignore.booleanValues
394
+ ? (u = !0)
395
+ : ((l = t.showValueColors ? "boolean" : ""),
396
+ (s = DomElement.createWithHTML(a, "span", l, o)),
397
+ (c = "boolean"),
398
+ Is.definedFunction(t.events.onBooleanRender) &&
399
+ fireCustomTriggerEvent(t.events.onBooleanRender, s),
400
+ createComma(t, a, r));
401
+ else if (Is.definedDecimal(o))
402
+ if (t.ignore.decimalValues) u = !0;
403
+ else {
404
+ const e = Data.getFixedDecimalPlacesValue(
405
+ o,
406
+ t.maximumDecimalPlaces,
407
+ );
408
+ ((l = t.showValueColors ? "decimal" : ""),
409
+ (s = DomElement.createWithHTML(a, "span", l, e)),
410
+ (c = "decimal"),
411
+ Is.definedFunction(t.events.onDecimalRender) &&
412
+ fireCustomTriggerEvent(t.events.onDecimalRender, s),
413
+ createComma(t, a, r));
414
+ }
415
+ else if (Is.definedNumber(o))
416
+ t.ignore.numberValues
417
+ ? (u = !0)
418
+ : ((l = t.showValueColors ? "number" : ""),
419
+ (s = DomElement.createWithHTML(a, "span", l, o)),
420
+ (c = "number"),
421
+ Is.definedFunction(t.events.onNumberRender) &&
422
+ fireCustomTriggerEvent(t.events.onNumberRender, s),
423
+ createComma(t, a, r));
424
+ else if (Is.definedString(o))
425
+ if (t.ignore.stringValues) u = !0;
426
+ else {
427
+ let e = null;
428
+ t.showValueColors && t.showStringHexColors && Is.hexColor(o)
429
+ ? (e = o)
430
+ : t.maximumStringLength > 0 &&
431
+ o.length > t.maximumStringLength &&
432
+ (o =
433
+ o.substring(0, t.maximumStringLength) +
434
+ _configuration.ellipsisText);
435
+ const n = t.showStringQuotes ? '"' + o + '"' : o;
436
+ ((l = t.showValueColors ? "string" : ""),
437
+ (s = DomElement.createWithHTML(a, "span", l, n)),
438
+ (c = "string"),
439
+ Is.definedString(e) && (s.style.color = e),
440
+ Is.definedFunction(t.events.onStringRender) &&
441
+ fireCustomTriggerEvent(t.events.onStringRender, s),
442
+ createComma(t, a, r));
443
+ }
444
+ else if (Is.definedDate(o))
445
+ t.ignore.dateValues
446
+ ? (u = !0)
447
+ : ((l = t.showValueColors ? "date" : ""),
448
+ (s = DomElement.createWithHTML(
449
+ a,
450
+ "span",
451
+ l,
452
+ DateTime.getCustomFormattedDateText(
453
+ _configuration,
454
+ o,
455
+ t.dateTimeFormat,
456
+ ),
457
+ )),
458
+ (c = "date"),
459
+ Is.definedFunction(t.events.onDateRender) &&
460
+ fireCustomTriggerEvent(t.events.onDateRender, s),
461
+ createComma(t, a, r));
462
+ else if (Is.definedObject(o) && !Is.definedArray(o))
463
+ if (t.ignore.objectValues) u = !0;
464
+ else {
465
+ const e = DomElement.create(
466
+ a,
467
+ "span",
468
+ t.showValueColors ? "object" : "",
469
+ ),
470
+ n = renderObjectValues(
471
+ i,
472
+ DomElement.create(a, "div", "object-type-contents"),
473
+ t,
474
+ o,
475
+ );
476
+ (DomElement.createWithHTML(
477
+ e,
478
+ "span",
479
+ "title",
480
+ _configuration.objectText,
481
+ ),
482
+ t.showCounts &&
483
+ n > 0 &&
484
+ DomElement.createWithHTML(e, "span", "count", "{" + n + "}"),
485
+ createComma(t, e, r),
486
+ (c = "object"));
487
+ }
488
+ else if (Is.definedArray(o))
489
+ if (t.ignore.arrayValues) u = !0;
490
+ else {
491
+ const e = DomElement.create(
492
+ a,
493
+ "span",
494
+ t.showValueColors ? "array" : "",
495
+ ),
496
+ n = DomElement.create(a, "div", "object-type-contents");
497
+ (DomElement.createWithHTML(
498
+ e,
499
+ "span",
500
+ "title",
501
+ _configuration.arrayText,
502
+ ),
503
+ t.showCounts &&
504
+ DomElement.createWithHTML(
505
+ e,
506
+ "span",
507
+ "count",
508
+ "[" + o.length + "]",
509
+ ),
510
+ createComma(t, e, r),
511
+ renderArrayValues(i, n, t, o),
512
+ (c = "array"));
513
+ }
514
+ else
515
+ t.ignore.unknownValues
516
+ ? (u = !0)
517
+ : ((l = t.showValueColors ? "unknown" : ""),
518
+ (s = DomElement.createWithHTML(a, "span", l, o.toString())),
519
+ (c = "unknown"),
520
+ Is.definedFunction(t.events.onUnknownRender) &&
521
+ fireCustomTriggerEvent(t.events.onUnknownRender, s),
522
+ createComma(t, a, r));
523
+ else
524
+ t.ignore.nullValues
525
+ ? (u = !0)
526
+ : ((l = t.showValueColors ? "null" : ""),
527
+ (s = DomElement.createWithHTML(a, "span", l, "null")),
528
+ (d = !1),
529
+ Is.definedFunction(t.events.onNullRender) &&
530
+ fireCustomTriggerEvent(t.events.onNullRender, s),
531
+ createComma(t, a, r));
532
+ u ? e.removeChild(a) : Is.defined(s) && addValueClickEvent(t, s, o, c, d);
533
+ }
534
+ function addValueClickEvent(e, t, n, o, r) {
535
+ r && Is.definedFunction(e.events.onValueClick)
536
+ ? (t.onclick = () => {
537
+ fireCustomTriggerEvent(e.events.onValueClick, n, o);
538
+ })
539
+ : DomElement.addClass(t, "no-hover");
540
+ }
541
+ function addArrowEvent(e, t, n) {
542
+ Is.defined(t) &&
543
+ ((t.onclick = () => {
544
+ "down-arrow" === t.className
545
+ ? ((n.style.display = "none"), (t.className = "right-arrow"))
546
+ : ((n.style.display = "block"), (t.className = "down-arrow"));
547
+ }),
548
+ e.showAllAsClosed
549
+ ? ((n.style.display = "none"), (t.className = "right-arrow"))
550
+ : (t.className = "down-arrow"));
551
+ }
552
+ function getFunctionName(e) {
553
+ let t;
554
+ const n = e.toString().split("(")[0].split(" ");
555
+ return ((t = 2 === n.length ? n[1] : n[0]), (t += "()"), t);
556
+ }
557
+ function createComma(e, t, n) {
558
+ e.showCommas && !n && DomElement.createWithHTML(t, "span", "comma", ",");
559
+ }
560
+ function getIndexName(e, t, n) {
561
+ let o = e.useZeroIndexingForArrays ? t.toString() : (t + 1).toString();
562
+ return (
563
+ e.addArrayIndexPadding ||
564
+ (o = Data.String.padNumber(parseInt(o), n.toString().length)),
565
+ o
566
+ );
567
+ }
568
+ function buildAttributeOptions(e) {
569
+ let t = Data.getDefaultObject(e, {});
570
+ return (
571
+ (t.data = Data.getDefaultObject(t.data, null)),
572
+ (t.showCounts = Data.getDefaultBoolean(t.showCounts, !0)),
573
+ (t.useZeroIndexingForArrays = Data.getDefaultBoolean(
574
+ t.useZeroIndexingForArrays,
575
+ !0,
576
+ )),
577
+ (t.dateTimeFormat = Data.getDefaultString(
578
+ t.dateTimeFormat,
579
+ "{dd}{o} {mmmm} {yyyy} {hh}:{MM}:{ss}",
580
+ )),
581
+ (t.showArrowToggles = Data.getDefaultBoolean(t.showArrowToggles, !0)),
582
+ (t.showStringQuotes = Data.getDefaultBoolean(t.showStringQuotes, !0)),
583
+ (t.showAllAsClosed = Data.getDefaultBoolean(t.showAllAsClosed, !1)),
584
+ (t.sortPropertyNames = Data.getDefaultBoolean(t.sortPropertyNames, !0)),
585
+ (t.sortPropertyNamesInAlphabeticalOrder = Data.getDefaultBoolean(
586
+ t.sortPropertyNamesInAlphabeticalOrder,
587
+ !0,
588
+ )),
589
+ (t.showCommas = Data.getDefaultBoolean(t.showCommas, !1)),
590
+ (t.reverseArrayValues = Data.getDefaultBoolean(
591
+ t.reverseArrayValues,
592
+ !1,
593
+ )),
594
+ (t.addArrayIndexPadding = Data.getDefaultBoolean(
595
+ t.addArrayIndexPadding,
596
+ !1,
597
+ )),
598
+ (t.showValueColors = Data.getDefaultBoolean(t.showValueColors, !0)),
599
+ (t.maximumDecimalPlaces = Data.getDefaultNumber(
600
+ t.maximumDecimalPlaces,
601
+ 2,
602
+ )),
603
+ (t.maximumStringLength = Data.getDefaultNumber(
604
+ t.maximumStringLength,
605
+ 0,
606
+ )),
607
+ (t.showStringHexColors = Data.getDefaultBoolean(
608
+ t.showStringHexColors,
609
+ !1,
610
+ )),
611
+ (t = buildAttributeOptionTitle(t)),
612
+ (t = buildAttributeOptionIgnore(t)),
613
+ (t = buildAttributeOptionCustomTriggers(t)),
614
+ t
615
+ );
616
+ }
617
+ function buildAttributeOptionTitle(e) {
618
+ return (
619
+ (e.title = Data.getDefaultObject(e.title, {})),
620
+ (e.title.text = Data.getDefaultString(e.title.text, "JsonTree.js")),
621
+ (e.title.show = Data.getDefaultBoolean(e.title.show, !0)),
622
+ (e.title.showTreeControls = Data.getDefaultBoolean(
623
+ e.title.showTreeControls,
624
+ !0,
625
+ )),
626
+ (e.title.showCopyButton = Data.getDefaultBoolean(
627
+ e.title.showCopyButton,
628
+ !1,
629
+ )),
630
+ e
631
+ );
632
+ }
633
+ function buildAttributeOptionIgnore(e) {
634
+ return (
635
+ (e.ignore = Data.getDefaultObject(e.ignore, {})),
636
+ (e.ignore.nullValues = Data.getDefaultBoolean(e.ignore.nullValues, !1)),
637
+ (e.ignore.functionValues = Data.getDefaultBoolean(
638
+ e.ignore.functionValues,
639
+ !1,
640
+ )),
641
+ (e.ignore.unknownValues = Data.getDefaultBoolean(
642
+ e.ignore.unknownValues,
643
+ !1,
644
+ )),
645
+ (e.ignore.booleanValues = Data.getDefaultBoolean(
646
+ e.ignore.booleanValues,
647
+ !1,
648
+ )),
649
+ (e.ignore.decimalValues = Data.getDefaultBoolean(
650
+ e.ignore.decimalValues,
651
+ !1,
652
+ )),
653
+ (e.ignore.numberValues = Data.getDefaultBoolean(
654
+ e.ignore.numberValues,
655
+ !1,
656
+ )),
657
+ (e.ignore.stringValues = Data.getDefaultBoolean(
658
+ e.ignore.stringValues,
659
+ !1,
660
+ )),
661
+ (e.ignore.dateValues = Data.getDefaultBoolean(e.ignore.dateValues, !1)),
662
+ (e.ignore.objectValues = Data.getDefaultBoolean(
663
+ e.ignore.objectValues,
664
+ !1,
665
+ )),
666
+ (e.ignore.arrayValues = Data.getDefaultBoolean(
667
+ e.ignore.arrayValues,
668
+ !1,
669
+ )),
670
+ e
671
+ );
672
+ }
673
+ function buildAttributeOptionCustomTriggers(e) {
674
+ return (
675
+ (e.events = Data.getDefaultObject(e.events, {})),
676
+ (e.events.onBeforeRender = Data.getDefaultFunction(
677
+ e.events.onBeforeRender,
678
+ null,
679
+ )),
680
+ (e.events.onRenderComplete = Data.getDefaultFunction(
681
+ e.events.onRenderComplete,
682
+ null,
683
+ )),
684
+ (e.events.onValueClick = Data.getDefaultFunction(
685
+ e.events.onValueClick,
686
+ null,
687
+ )),
688
+ (e.events.onRefresh = Data.getDefaultFunction(
689
+ e.events.onRefresh,
690
+ null,
691
+ )),
692
+ (e.events.onCopyAll = Data.getDefaultFunction(
693
+ e.events.onCopyAll,
694
+ null,
695
+ )),
696
+ (e.events.onOpenAll = Data.getDefaultFunction(
697
+ e.events.onOpenAll,
698
+ null,
699
+ )),
700
+ (e.events.onCloseAll = Data.getDefaultFunction(
701
+ e.events.onCloseAll,
702
+ null,
703
+ )),
704
+ (e.events.onDestroy = Data.getDefaultFunction(
705
+ e.events.onDestroy,
706
+ null,
707
+ )),
708
+ (e.events.onBooleanRender = Data.getDefaultFunction(
709
+ e.events.onBooleanRender,
710
+ null,
711
+ )),
712
+ (e.events.onDecimalRender = Data.getDefaultFunction(
713
+ e.events.onDecimalRender,
714
+ null,
715
+ )),
716
+ (e.events.onNumberRender = Data.getDefaultFunction(
717
+ e.events.onNumberRender,
718
+ null,
719
+ )),
720
+ (e.events.onStringRender = Data.getDefaultFunction(
721
+ e.events.onStringRender,
722
+ null,
723
+ )),
724
+ (e.events.onDateRender = Data.getDefaultFunction(
725
+ e.events.onDateRender,
726
+ null,
727
+ )),
728
+ (e.events.onFunctionRender = Data.getDefaultFunction(
729
+ e.events.onFunctionRender,
730
+ null,
731
+ )),
732
+ (e.events.onNullRender = Data.getDefaultFunction(
733
+ e.events.onNullRender,
734
+ null,
735
+ )),
736
+ (e.events.onUnknownRender = Data.getDefaultFunction(
737
+ e.events.onUnknownRender,
738
+ null,
739
+ )),
740
+ e
741
+ );
742
+ }
743
+ function fireCustomTriggerEvent(e, ...t) {
744
+ Is.definedFunction(e) && e.apply(null, [].slice.call(t, 0));
745
+ }
746
+ function getObjectFromString(objectString) {
747
+ const result = {
748
+ parsed: !0,
749
+ object: null,
750
+ };
751
+ try {
752
+ Is.definedString(objectString) &&
753
+ (result.object = JSON.parse(objectString));
754
+ } catch (e1) {
755
+ try {
756
+ ((result.object = eval("(" + objectString + ")")),
757
+ Is.definedFunction(result.object) &&
758
+ (result.object = result.object()));
759
+ } catch (e) {
760
+ (_configuration.safeMode ||
761
+ (console.error(
762
+ _configuration.objectErrorText
763
+ .replace("{{error_1}}", e1.message)
764
+ .replace("{{error_2}}", e.message),
765
+ ),
766
+ (result.parsed = !1)),
767
+ (result.object = null));
768
+ }
769
+ }
770
+ return result;
771
+ }
772
+ function destroyElement(e) {
773
+ ((e._currentView.element.innerHTML = ""),
774
+ (e._currentView.element.className = ""),
775
+ fireCustomTriggerEvent(e.events.onDestroy, e._currentView.element));
776
+ }
777
+ function buildDefaultConfiguration(e = null) {
778
+ ((_configuration = Data.getDefaultObject(e, {})),
779
+ (_configuration.safeMode = Data.getDefaultBoolean(
780
+ _configuration.safeMode,
781
+ !0,
782
+ )),
783
+ (_configuration.domElementTypes = Data.getDefaultStringOrArray(
784
+ _configuration.domElementTypes,
785
+ ["*"],
786
+ )),
787
+ buildDefaultConfigurationStrings());
788
+ }
789
+ function buildDefaultConfigurationStrings() {
790
+ ((_configuration.objectText = Data.getDefaultAnyString(
791
+ _configuration.objectText,
792
+ "object",
793
+ )),
794
+ (_configuration.arrayText = Data.getDefaultAnyString(
795
+ _configuration.arrayText,
796
+ "array",
797
+ )),
798
+ (_configuration.closeAllButtonText = Data.getDefaultAnyString(
799
+ _configuration.closeAllButtonText,
800
+ "Close All",
801
+ )),
802
+ (_configuration.openAllButtonText = Data.getDefaultAnyString(
803
+ _configuration.openAllButtonText,
804
+ "Open All",
805
+ )),
806
+ (_configuration.copyAllButtonText = Data.getDefaultAnyString(
807
+ _configuration.copyAllButtonText,
808
+ "Copy All",
809
+ )),
810
+ (_configuration.objectErrorText = Data.getDefaultAnyString(
811
+ _configuration.objectErrorText,
812
+ "Errors in object: {{error_1}}, {{error_2}}",
813
+ )),
814
+ (_configuration.attributeNotValidErrorText = Data.getDefaultAnyString(
815
+ _configuration.attributeNotValidErrorText,
816
+ "The attribute '{{attribute_name}}' is not a valid object.",
817
+ )),
818
+ (_configuration.attributeNotSetErrorText = Data.getDefaultAnyString(
819
+ _configuration.attributeNotSetErrorText,
820
+ "The attribute '{{attribute_name}}' has not been set correctly.",
821
+ )),
822
+ (_configuration.stText = Data.getDefaultAnyString(
823
+ _configuration.stText,
824
+ "st",
825
+ )),
826
+ (_configuration.ndText = Data.getDefaultAnyString(
827
+ _configuration.ndText,
828
+ "nd",
829
+ )),
830
+ (_configuration.rdText = Data.getDefaultAnyString(
831
+ _configuration.rdText,
832
+ "rd",
833
+ )),
834
+ (_configuration.thText = Data.getDefaultAnyString(
835
+ _configuration.thText,
836
+ "th",
837
+ )),
838
+ (_configuration.ellipsisText = Data.getDefaultAnyString(
839
+ _configuration.ellipsisText,
840
+ "...",
841
+ )),
842
+ Is.invalidOptionArray(_configuration.dayNames, 7) &&
843
+ (_configuration.dayNames = [
844
+ "Monday",
845
+ "Tuesday",
846
+ "Wednesday",
847
+ "Thursday",
848
+ "Friday",
849
+ "Saturday",
850
+ "Sunday",
851
+ ]),
852
+ Is.invalidOptionArray(_configuration.dayNamesAbbreviated, 7) &&
853
+ (_configuration.dayNamesAbbreviated = [
854
+ "Mon",
855
+ "Tue",
856
+ "Wed",
857
+ "Thu",
858
+ "Fri",
859
+ "Sat",
860
+ "Sun",
861
+ ]),
862
+ Is.invalidOptionArray(_configuration.monthNames, 12) &&
863
+ (_configuration.monthNames = [
864
+ "January",
865
+ "February",
866
+ "March",
867
+ "April",
868
+ "May",
869
+ "June",
870
+ "July",
871
+ "August",
872
+ "September",
873
+ "October",
874
+ "November",
875
+ "December",
876
+ ]),
877
+ Is.invalidOptionArray(_configuration.monthNamesAbbreviated, 12) &&
878
+ (_configuration.monthNamesAbbreviated = [
879
+ "Jan",
880
+ "Feb",
881
+ "Mar",
882
+ "Apr",
883
+ "May",
884
+ "Jun",
885
+ "Jul",
886
+ "Aug",
887
+ "Sep",
888
+ "Oct",
889
+ "Nov",
890
+ "Dec",
891
+ ]));
892
+ }
893
+ const _public = {
894
+ refresh: function (e) {
895
+ if (Is.definedString(e) && _elements_Data.hasOwnProperty(e)) {
896
+ const t = _elements_Data[e];
897
+ (renderControlContainer(t),
898
+ fireCustomTriggerEvent(t.events.onRefresh, t._currentView.element));
899
+ }
900
+ return _public;
901
+ },
902
+ refreshAll: function () {
903
+ for (let e in _elements_Data)
904
+ if (_elements_Data.hasOwnProperty(e)) {
905
+ const t = _elements_Data[e];
906
+ (renderControlContainer(t),
907
+ fireCustomTriggerEvent(
908
+ t.events.onRefresh,
909
+ t._currentView.element,
910
+ ));
911
+ }
912
+ return _public;
913
+ },
914
+ render: function (e, t) {
915
+ return (
916
+ Is.definedObject(e) &&
917
+ Is.definedObject(t) &&
918
+ renderControl(renderBindingOptions(t, e)),
919
+ _public
920
+ );
921
+ },
922
+ renderAll: function () {
923
+ return (render(), _public);
924
+ },
925
+ openAll: function (e) {
926
+ return (
927
+ Is.definedString(e) &&
928
+ _elements_Data.hasOwnProperty(e) &&
929
+ openAllNodes(_elements_Data[e]),
930
+ _public
931
+ );
932
+ },
933
+ closeAll: function (e) {
934
+ return (
935
+ Is.definedString(e) &&
936
+ _elements_Data.hasOwnProperty(e) &&
937
+ closeAllNodes(_elements_Data[e]),
938
+ _public
939
+ );
940
+ },
941
+ destroy: function (e) {
942
+ return (
943
+ Is.definedString(e) &&
944
+ _elements_Data.hasOwnProperty(e) &&
945
+ (destroyElement(_elements_Data[e]), delete _elements_Data[e]),
946
+ _public
947
+ );
948
+ },
949
+ destroyAll: function () {
950
+ for (let e in _elements_Data)
951
+ _elements_Data.hasOwnProperty(e) && destroyElement(_elements_Data[e]);
952
+ return ((_elements_Data = {}), _public);
953
+ },
954
+ setConfiguration: function (e) {
955
+ if (Is.definedObject(e)) {
956
+ let t = !1;
957
+ const n = _configuration;
958
+ for (let o in e)
959
+ e.hasOwnProperty(o) &&
960
+ _configuration.hasOwnProperty(o) &&
961
+ n[o] !== e[o] &&
962
+ ((n[o] = e[o]), (t = !0));
963
+ t && buildDefaultConfiguration(n);
964
+ }
965
+ return _public;
966
+ },
967
+ getIds: function () {
968
+ const e = [];
969
+ for (let t in _elements_Data)
970
+ _elements_Data.hasOwnProperty(t) && e.push(t);
971
+ return e;
972
+ },
973
+ getVersion: function () {
974
+ return "2.0.0";
975
+ },
976
+ };
977
+ (buildDefaultConfiguration(),
978
+ document.addEventListener("DOMContentLoaded", function () {
979
+ render();
980
+ }),
981
+ Is.defined(window.$jsontree) || (window.$jsontree = _public));
982
+ })());