solid-ui 5.0.2-6 → 5.0.2-8

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 (168) hide show
  1. package/dist/acl/add-agent-buttons.cjs.js +1 -1
  2. package/dist/acl/add-agent-buttons.cjs.js.map +1 -1
  3. package/dist/acl/add-agent-buttons.d.ts.map +1 -1
  4. package/dist/acl/add-agent-buttons.esm.js +22 -20
  5. package/dist/acl/add-agent-buttons.esm.js.map +1 -1
  6. package/dist/chunks/{DialogProvider-CdesAsw-.js → DialogProvider-DwymaGN5.js} +3 -3
  7. package/dist/chunks/{DialogProvider-CdesAsw-.js.map → DialogProvider-DwymaGN5.js.map} +1 -1
  8. package/dist/chunks/{ResourceActionsMenu-KFMLta44.js → ResourceActionsMenu-mLMf4fAa.js} +9 -9
  9. package/dist/chunks/{ResourceActionsMenu-KFMLta44.js.map → ResourceActionsMenu-mLMf4fAa.js.map} +1 -1
  10. package/dist/chunks/{access-control-modal-BZdBv6VD.js → access-control-modal-BR7HhqpN.js} +29 -29
  11. package/dist/chunks/{access-control-modal-BZdBv6VD.js.map → access-control-modal-BR7HhqpN.js.map} +1 -1
  12. package/dist/chunks/{account-DWmMJre6.js → account-Dtv8-QEH.js} +10 -10
  13. package/dist/chunks/{account-DWmMJre6.js.map → account-Dtv8-QEH.js.map} +1 -1
  14. package/dist/chunks/{auth-EK-iYNYZ.js → auth-Cj-J-3Nf.js} +26 -26
  15. package/dist/chunks/auth-Cj-J-3Nf.js.map +1 -0
  16. package/dist/chunks/{avatar-BBgvMlqv.js → avatar-D_bHMV5F.js} +3 -3
  17. package/dist/chunks/{avatar-BBgvMlqv.js.map → avatar-D_bHMV5F.js.map} +1 -1
  18. package/dist/chunks/{button-D6qO2idW.js → button-D7XurXfj.js} +2 -2
  19. package/dist/chunks/{button-D6qO2idW.js.map → button-D7XurXfj.js.map} +1 -1
  20. package/dist/chunks/{chunk.UEBQI7VV-lcP-fpUk.js → chunk.UEBQI7VV-CrSDe9uN.js} +2 -2
  21. package/dist/chunks/{chunk.UEBQI7VV-lcP-fpUk.js.map → chunk.UEBQI7VV-CrSDe9uN.js.map} +1 -1
  22. package/dist/chunks/{combobox-DS6byaf1.js → combobox-CHli5LVO.js} +3 -3
  23. package/dist/chunks/{combobox-DS6byaf1.js.map → combobox-CHli5LVO.js.map} +1 -1
  24. package/dist/chunks/{combobox-option-DOtGuKel.js → combobox-option-lOJdg5cD.js} +2 -2
  25. package/dist/chunks/{combobox-option-DOtGuKel.js.map → combobox-option-lOJdg5cD.js.map} +1 -1
  26. package/dist/chunks/{components-C8c2Ucm5.js → components-CVuqsI0R.js} +2 -2
  27. package/dist/chunks/{components-C8c2Ucm5.js.map → components-CVuqsI0R.js.map} +1 -1
  28. package/dist/chunks/{context-BDrfQ9bN.js → context-0sxUfxf7.js} +2 -2
  29. package/dist/chunks/{context-BDrfQ9bN.js.map → context-0sxUfxf7.js.map} +1 -1
  30. package/dist/chunks/{dialog-CgYK767T.js → dialog-BTlq_YfO.js} +4 -4
  31. package/dist/chunks/{dialog-CgYK767T.js.map → dialog-BTlq_YfO.js.map} +1 -1
  32. package/dist/chunks/{dialog-content-DjwRH1ci.js → dialog-content-DHim135-.js} +2 -2
  33. package/dist/chunks/{dialog-content-DjwRH1ci.js.map → dialog-content-DHim135-.js.map} +1 -1
  34. package/dist/chunks/{dialog-footer-GQWi8lfB.js → dialog-footer-B8uRmp3J.js} +2 -2
  35. package/dist/chunks/{dialog-footer-GQWi8lfB.js.map → dialog-footer-B8uRmp3J.js.map} +1 -1
  36. package/dist/chunks/{dialog-header-c3qOMQfb.js → dialog-header-CQ2jzzUd.js} +2 -2
  37. package/dist/chunks/{dialog-header-c3qOMQfb.js.map → dialog-header-CQ2jzzUd.js.map} +1 -1
  38. package/dist/chunks/{dialogs-BmtLjMzg.js → dialogs-gEIIeLi6.js} +2 -2
  39. package/dist/chunks/{dialogs-BmtLjMzg.js.map → dialogs-gEIIeLi6.js.map} +1 -1
  40. package/dist/chunks/{dialogs-root-BNF3_SA8.js → dialogs-root-DuRAjRjg.js} +3 -3
  41. package/dist/chunks/{dialogs-root-BNF3_SA8.js.map → dialogs-root-DuRAjRjg.js.map} +1 -1
  42. package/dist/chunks/{error-state-jV9dlFX2.js → error-state-Y-Fe0JiX.js} +3 -3
  43. package/dist/chunks/{error-state-jV9dlFX2.js.map → error-state-Y-Fe0JiX.js.map} +1 -1
  44. package/dist/chunks/{file-explorer-header-BJzo6xDU.js → file-explorer-header-DGcG6Agk.js} +165 -137
  45. package/dist/chunks/file-explorer-header-DGcG6Agk.js.map +1 -0
  46. package/dist/chunks/{file-explorer-provider-DpjC7uds.js → file-explorer-provider-CIAJV8hq.js} +4 -4
  47. package/dist/chunks/{file-explorer-provider-DpjC7uds.js.map → file-explorer-provider-CIAJV8hq.js.map} +1 -1
  48. package/dist/chunks/{guard-SxVT1xr4.js → guard-53kvhglh.js} +3 -3
  49. package/dist/chunks/{guard-SxVT1xr4.js.map → guard-53kvhglh.js.map} +1 -1
  50. package/dist/chunks/index.esm-BYrQu5rV.js +6 -0
  51. package/dist/chunks/index.esm-BYrQu5rV.js.map +1 -0
  52. package/dist/chunks/{input-Bz3l514j.js → input-MtTyDieA.js} +2 -2
  53. package/dist/chunks/{input-Bz3l514j.js.map → input-MtTyDieA.js.map} +1 -1
  54. package/dist/chunks/{jsonld-C6IOQ1Tg.js → jsonld-lAxnRr2L.js} +2 -2
  55. package/dist/chunks/{jsonld-C6IOQ1Tg.js.map → jsonld-lAxnRr2L.js.map} +1 -1
  56. package/dist/chunks/{login-button-Dd0rwZJk.js → login-button-Dx58UUyH.js} +4 -4
  57. package/dist/chunks/{login-button-Dd0rwZJk.js.map → login-button-Dx58UUyH.js.map} +1 -1
  58. package/dist/chunks/{logout-button-Da34Lrnq.js → logout-button-Vrn0nLVQ.js} +4 -4
  59. package/dist/chunks/{logout-button-Da34Lrnq.js.map → logout-button-Vrn0nLVQ.js.map} +1 -1
  60. package/dist/chunks/{menu-item-nfPpH4dN.js → menu-item-EARrOY8C.js} +3 -3
  61. package/dist/chunks/menu-item-EARrOY8C.js.map +1 -0
  62. package/dist/chunks/{menu-BNJU654v.js → menu-pe4NxtfD.js} +3 -3
  63. package/dist/chunks/{menu-BNJU654v.js.map → menu-pe4NxtfD.js.map} +1 -1
  64. package/dist/chunks/{photo-capture-hJaJm4TM.js → photo-capture-B8ponMpE.js} +4 -4
  65. package/dist/chunks/{photo-capture-hJaJm4TM.js.map → photo-capture-B8ponMpE.js.map} +1 -1
  66. package/dist/chunks/{photo-capture-modal-BsHv6wmh.js → photo-capture-modal-SOcYsArw.js} +6 -6
  67. package/dist/chunks/{photo-capture-modal-BsHv6wmh.js.map → photo-capture-modal-SOcYsArw.js.map} +1 -1
  68. package/dist/chunks/{provide-z9U64q4m.js → provide-BQN7o60i.js} +2 -2
  69. package/dist/chunks/{provide-z9U64q4m.js.map → provide-BQN7o60i.js.map} +1 -1
  70. package/dist/chunks/{provider-B3FoP2qW.js → provider-CnOHE-B-.js} +5 -5
  71. package/dist/chunks/{provider-B3FoP2qW.js.map → provider-CnOHE-B-.js.map} +1 -1
  72. package/dist/chunks/{rdf-form-BkKDmFPD.js → rdf-form-CtskuSp2.js} +4 -4
  73. package/dist/chunks/{rdf-form-BkKDmFPD.js.map → rdf-form-CtskuSp2.js.map} +1 -1
  74. package/dist/chunks/{rdf-input-BPePtqfS.js → rdf-input-DfTBeaCB.js} +8 -8
  75. package/dist/chunks/{rdf-input-BPePtqfS.js.map → rdf-input-DfTBeaCB.js.map} +1 -1
  76. package/dist/chunks/{select-ClPkDkGl.js → select-BKXrVwJC.js} +2 -2
  77. package/dist/chunks/{select-ClPkDkGl.js.map → select-BKXrVwJC.js.map} +1 -1
  78. package/dist/chunks/{select-option-DQan7rcB.js → select-option-SlgG53he.js} +2 -2
  79. package/dist/chunks/{select-option-DQan7rcB.js.map → select-option-SlgG53he.js.map} +1 -1
  80. package/dist/chunks/{signup-button-DOInssOu.js → signup-button-C-dLsqr8.js} +4 -4
  81. package/dist/chunks/{signup-button-DOInssOu.js.map → signup-button-C-dLsqr8.js.map} +1 -1
  82. package/dist/chunks/{solid-emblem-DwLdkGuO.js → solid-emblem-BmFc2G2B.js} +2 -2
  83. package/dist/chunks/{solid-emblem-DwLdkGuO.js.map → solid-emblem-BmFc2G2B.js.map} +1 -1
  84. package/dist/chunks/{solidLogicSingleton.esm-Bvt7E7Vl.js → solidLogicSingleton.esm-CKYdvLzf.js} +12317 -4363
  85. package/dist/chunks/solidLogicSingleton.esm-CKYdvLzf.js.map +1 -0
  86. package/dist/chunks/{src-Cv9Lm1V-.js → src-CiHeLI_K.js} +2303 -2302
  87. package/dist/chunks/src-CiHeLI_K.js.map +1 -0
  88. package/dist/chunks/{style-Dlw9-wPn.js → style-Du-nyh8u.js} +7 -7
  89. package/dist/chunks/{style-Dlw9-wPn.js.map → style-Du-nyh8u.js.map} +1 -1
  90. package/dist/chunks/widgets-CTH3oXJI.js +2762 -0
  91. package/dist/chunks/widgets-CTH3oXJI.js.map +1 -0
  92. package/dist/components/access-control-modal.js +1 -1
  93. package/dist/components/account.js +1 -1
  94. package/dist/components/avatar.js +1 -1
  95. package/dist/components/button.js +1 -1
  96. package/dist/components/combobox-option.js +1 -1
  97. package/dist/components/combobox.js +1 -1
  98. package/dist/components/dialog-content.js +1 -1
  99. package/dist/components/dialog-footer.js +1 -1
  100. package/dist/components/dialog-header.js +1 -1
  101. package/dist/components/dialog-provider.js +1 -1
  102. package/dist/components/dialog.js +1 -1
  103. package/dist/components/dialogs-root.js +1 -1
  104. package/dist/components/error-state.js +1 -1
  105. package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js +3 -2
  106. package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js.map +1 -1
  107. package/dist/components/file-explorer-header/FileExplorerHeader.d.ts +1 -0
  108. package/dist/components/file-explorer-header/FileExplorerHeader.d.ts.map +1 -1
  109. package/dist/components/file-explorer-header/FileExplorerHeader.esm.js +57 -45
  110. package/dist/components/file-explorer-header/FileExplorerHeader.esm.js.map +1 -1
  111. package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js +1 -1
  112. package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js.map +1 -1
  113. package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js +5 -2
  114. package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js.map +1 -1
  115. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js +12 -10
  116. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js.map +1 -1
  117. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.d.ts +1 -0
  118. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.d.ts.map +1 -1
  119. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js +72 -59
  120. package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js.map +1 -1
  121. package/dist/components/file-explorer-header.js +1 -1
  122. package/dist/components/file-explorer-provider.js +1 -1
  123. package/dist/components/guard.js +1 -1
  124. package/dist/components/input.js +1 -1
  125. package/dist/components/login-button.js +1 -1
  126. package/dist/components/login-modal.js +1 -1
  127. package/dist/components/logout-button.js +1 -1
  128. package/dist/components/menu-item/MenuItem.styles.cjs.js +1 -1
  129. package/dist/components/menu-item/MenuItem.styles.cjs.js.map +1 -1
  130. package/dist/components/menu-item/MenuItem.styles.esm.js +1 -1
  131. package/dist/components/menu-item/MenuItem.styles.esm.js.map +1 -1
  132. package/dist/components/menu-item.js +1 -1
  133. package/dist/components/menu.js +1 -1
  134. package/dist/components/photo-capture-modal.js +1 -1
  135. package/dist/components/photo-capture.js +1 -1
  136. package/dist/components/provider.js +1 -1
  137. package/dist/components/rdf-form.js +1 -1
  138. package/dist/components/rdf-input.js +1 -1
  139. package/dist/components/resource-actions-menu.js +1 -1
  140. package/dist/components/select-option.js +1 -1
  141. package/dist/components/select.js +1 -1
  142. package/dist/components/signup-button.js +1 -1
  143. package/dist/components/solid-emblem.js +1 -1
  144. package/dist/components.js +30 -30
  145. package/dist/index.js +8 -8
  146. package/dist/lib/components/web-component/WebComponent.styles.cjs.js +1 -1
  147. package/dist/lib/components/web-component/WebComponent.styles.esm.js +1 -1
  148. package/dist/lib/file-explorer/compose-explorer.cjs.js +1 -1
  149. package/dist/lib/file-explorer/compose-explorer.cjs.js.map +1 -1
  150. package/dist/lib/file-explorer/compose-explorer.d.ts +1 -1
  151. package/dist/lib/file-explorer/compose-explorer.d.ts.map +1 -1
  152. package/dist/lib/file-explorer/compose-explorer.esm.js +1 -1
  153. package/dist/lib/file-explorer/compose-explorer.esm.js.map +1 -1
  154. package/dist/loader.js +8 -8
  155. package/dist/solid-ui.js +66 -63
  156. package/dist/solid-ui.min.js +66 -63
  157. package/dist/solid-ui.min.js.map +1 -1
  158. package/dist/theme.css +1 -1
  159. package/package.json +3 -3
  160. package/dist/chunks/auth-EK-iYNYZ.js.map +0 -1
  161. package/dist/chunks/file-explorer-header-BJzo6xDU.js.map +0 -1
  162. package/dist/chunks/index.esm-BQrkxchZ.js +0 -6
  163. package/dist/chunks/index.esm-BQrkxchZ.js.map +0 -1
  164. package/dist/chunks/menu-item-nfPpH4dN.js.map +0 -1
  165. package/dist/chunks/solidLogicSingleton.esm-Bvt7E7Vl.js.map +0 -1
  166. package/dist/chunks/src-Cv9Lm1V-.js.map +0 -1
  167. package/dist/chunks/widgets-C92ihtlF.js +0 -10628
  168. package/dist/chunks/widgets-C92ihtlF.js.map +0 -1
@@ -0,0 +1,2762 @@
1
+ import { D as e, E as t, F as n, G as r, H as i, K as a, L as o, N as s, O as c, V as l, b as u, q as d, t as f, u as p, z as m } from "./solidLogicSingleton.esm-CKYdvLzf.js";
2
+ import { a as h, c as g, f as _, i as v, n as y, o as b, p as x, s as S, t as C, u as w } from "./style-Du-nyh8u.js";
3
+ import { n as T, t as E } from "./index.esm-BYrQu5rV.js";
4
+ import "./square-arrow-out-up-right-DaALlpHo.js";
5
+ // src/lib/debug.ts
6
+ function D(...e) {
7
+ console.log(...e);
8
+ }
9
+ function O(...e) {
10
+ console.warn(...e);
11
+ }
12
+ function k(...e) {
13
+ console.error(...e);
14
+ }
15
+ function A(...e) {
16
+ console.trace(...e);
17
+ }
18
+ // node_modules/escape-html/index.js
19
+ var j = /* @__PURE__ */ r(((e, t) => {
20
+ var n = /["'&<>]/;
21
+ t.exports = r;
22
+ function r(e) {
23
+ var t = "" + e, r = n.exec(t);
24
+ if (!r) return t;
25
+ var i, a = "", o = 0, s = 0;
26
+ for (o = r.index; o < t.length; o++) {
27
+ switch (t.charCodeAt(o)) {
28
+ case 34:
29
+ i = "&quot;";
30
+ break;
31
+ case 38:
32
+ i = "&amp;";
33
+ break;
34
+ case 39:
35
+ i = "&#39;";
36
+ break;
37
+ case 60:
38
+ i = "&lt;";
39
+ break;
40
+ case 62:
41
+ i = "&gt;";
42
+ break;
43
+ default: continue;
44
+ }
45
+ s !== o && (a += t.substring(s, o)), s = o + 1, a += i;
46
+ }
47
+ return s === o ? a : a + t.substring(s, o);
48
+ }
49
+ })), M = [];
50
+ for (let e = 0; e < 256; ++e) M.push((e + 256).toString(16).slice(1));
51
+ function N(e, t = 0) {
52
+ return (M[e[t + 0]] + M[e[t + 1]] + M[e[t + 2]] + M[e[t + 3]] + "-" + M[e[t + 4]] + M[e[t + 5]] + "-" + M[e[t + 6]] + M[e[t + 7]] + "-" + M[e[t + 8]] + M[e[t + 9]] + "-" + M[e[t + 10]] + M[e[t + 11]] + M[e[t + 12]] + M[e[t + 13]] + M[e[t + 14]] + M[e[t + 15]]).toLowerCase();
53
+ }
54
+ // node_modules/uuid/dist/rng.js
55
+ var P = /* @__PURE__ */ new Uint8Array(16);
56
+ function F() {
57
+ return crypto.getRandomValues(P);
58
+ }
59
+ // node_modules/uuid/dist/v4.js
60
+ function ee(e, t, n) {
61
+ return !t && !e && crypto.randomUUID ? crypto.randomUUID() : te(e, t, n);
62
+ }
63
+ function te(e, t, n) {
64
+ e ||= {};
65
+ let r = e.random ?? e.rng?.() ?? F();
66
+ if (r.length < 16) throw Error("Random bytes length must be >= 16");
67
+ if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
68
+ if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
69
+ for (let e = 0; e < 16; ++e) t[n + e] = r[e];
70
+ return t;
71
+ }
72
+ return N(r);
73
+ }
74
+ // src/widgets/dragAndDrop.js
75
+ var I = /* @__PURE__ */ d(p());
76
+ function L(e, t, n) {
77
+ let r = function(e) {
78
+ return e.split("\n").map((e) => e.trim()).filter((e) => e && e[0] !== "#");
79
+ }, i = function(e) {
80
+ e.preventDefault(), e.stopPropagation(), e.dataTransfer.dropEffect = "copy";
81
+ }, a = function(e) {
82
+ e.preventDefault(), e.stopPropagation(), D("dragenter event dropEffect: " + e.dataTransfer.dropEffect), this.localStyle && (this.savedStyle ||= C.dragEvent), e.dataTransfer.dropEffect = "link", D("dragenter event dropEffect 2: " + e.dataTransfer.dropEffect);
83
+ }, o = function(e) {
84
+ e.stopPropagation(), D("dragleave event dropEffect: " + e.dataTransfer.dropEffect), this.localStyle = this.savedStyle ? this.savedStyle : C.dropEvent;
85
+ }, s = function(e) {
86
+ e.preventDefault && e.preventDefault(), e.stopPropagation && e.stopPropagation(), D("Drop event. dropEffect: " + e.dataTransfer.dropEffect), D("Drop event. types: " + (e.dataTransfer.types ? e.dataTransfer.types.join(", ") : "NOPE"));
87
+ let i = null, a;
88
+ if (e.dataTransfer.types) {
89
+ for (let t = 0; t < e.dataTransfer.types.length; t++) {
90
+ let o = e.dataTransfer.types[t];
91
+ if (o === "text/uri-list") i = r(e.dataTransfer.getData(o)), D("Dropped text/uri-list: " + i);
92
+ else if (o === "text/plain") a = e.dataTransfer.getData(o);
93
+ else if (o === "Files" && n) {
94
+ let t = e.dataTransfer.files;
95
+ for (let e = 0; t[e]; e++) {
96
+ let n = t[e];
97
+ D("Filename: " + n.name + ", type: " + (n.type || "n/a") + " size: " + n.size + " bytes, last modified: " + (n.lastModifiedDate ? n.lastModifiedDate.toLocaleDateString() : "n/a"));
98
+ }
99
+ n(t);
100
+ }
101
+ }
102
+ let t = a ? a.trim() : "";
103
+ i === null && t && t.slice(0, 4) === "http" && (i = [t], D("Warning: Poor man's drop: using text for URI"));
104
+ } else i = r(e.dataTransfer.getData("Text")), D("WARNING non-standard drop event: " + i[0]);
105
+ return D("Dropped URI list (2): " + i), i && t(i), this.localStyle = C.restoreStyle, !1;
106
+ };
107
+ (function(e) {
108
+ e || D("@@@ addTargetListeners: ele " + e), e.addEventListener("dragover", i), e.addEventListener("dragenter", a), e.addEventListener("dragleave", o), e.addEventListener("drop", s);
109
+ })(e, t);
110
+ }
111
+ function ne(e, t) {
112
+ e.setAttribute("draggable", "true"), e.addEventListener("dragstart", function(n) {
113
+ e.style.fontWeight = "bold", n.dataTransfer.setData("text/uri-list", t.uri), n.dataTransfer.setData("text/plain", t.uri), n.dataTransfer.setData("text/html", e.outerHTML), D("Dragstart: " + e + " -> " + t + "de: " + n.dataTransfer.dropEffect);
114
+ }, !1), e.addEventListener("drag", function(e) {
115
+ e.preventDefault(), e.stopPropagation();
116
+ }, !1), e.addEventListener("dragend", function(n) {
117
+ e.style.fontWeight = "normal", D("Dragend dropeffect: " + n.dataTransfer.dropEffect), D("Dragend: " + e + " -> " + t);
118
+ }, !1);
119
+ }
120
+ function re(e, t, n, r, i) {
121
+ let a = function(e, t) {
122
+ let n = t?.response?.status ?? t?.status, r = t?.message || String(t), i = `Upload failed while putting ${e}`;
123
+ return n === 413 ? `${i}: storage quota was exceeded. ${r}` : n ? `${i} (HTTP ${n}). ${r}` : `${i}. ${r}`;
124
+ };
125
+ for (let o = 0; t[o]; o++) {
126
+ let s = t[o];
127
+ D(" dropped: Filename: " + s.name + ", type: " + (s.type || "n/a") + " size: " + s.size + " bytes, last modified: " + (s.lastModifiedDate ? s.lastModifiedDate.toLocaleDateString() : "n/a"));
128
+ let c = new FileReader();
129
+ c.onload = function(t) {
130
+ return function(o) {
131
+ let s = o.target.result, c = "";
132
+ D(" File read byteLength : " + s.byteLength);
133
+ let l = t.type;
134
+ if (!t.type || t.type === "") {
135
+ if (l = I.lookup(t.name), !l) {
136
+ let e = "Filename needs to have an extension which gives a type we know: " + t.name;
137
+ throw D(e), alert(e), Error(e);
138
+ }
139
+ } else {
140
+ let e = I.extension(t.type);
141
+ e && e !== "false" && !t.name.endsWith("." + e) && t.type !== I.lookup(t.name) && (c = "_." + e);
142
+ }
143
+ let u = t.type.startsWith("image/") && r || n, d = u + (u.endsWith("/") ? "" : "/") + encodeURIComponent(t.name) + c;
144
+ e.webOperation("PUT", d, {
145
+ data: s,
146
+ contentType: l
147
+ }).then((e) => {
148
+ D(" Upload: put OK: " + d), i(t, d);
149
+ }, (e) => {
150
+ let t = a(d, e);
151
+ throw D(t), alert(t), Error(t);
152
+ });
153
+ };
154
+ }(s), c.readAsArrayBuffer(s);
155
+ }
156
+ }
157
+ // src/widgets/error.ts
158
+ function R(e, t, n, r) {
159
+ let i = e.createElement("div"), a = r || t instanceof Error ? t : null;
160
+ return a ? (console.error(`errorMessageBlock: ${a} at: ${a.stack || "??"}`, a), i.textContent = a.message) : i.textContent = t, i.appendChild(G(e, () => {
161
+ i.parentNode && i.parentNode.removeChild(i);
162
+ })).style = C.errorCancelButton, i.setAttribute("style", C.errorMessageBlockStyle), i.style.backgroundColor = n || y.defaultErrorBackgroundColor, i;
163
+ }
164
+ // src/lib/iconBase.ts
165
+ var ie = "https://solidos.github.io/solid-ui/src", z = typeof module < "u" && module.scriptURI ? {
166
+ iconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf("/")) + "/icons/",
167
+ originalIconBase: module.scriptURI.slice(0, module.scriptURI.lastIndexOf("/")) + "/originalIcons/"
168
+ } : typeof $SolidTestEnvironment < "u" && $SolidTestEnvironment.iconBase ? {
169
+ iconBase: $SolidTestEnvironment.iconBase,
170
+ originalIconBase: $SolidTestEnvironment.originalIconBase
171
+ } : {
172
+ iconBase: ie + "/icons/",
173
+ originalIconBase: ie + "/originalIcons/"
174
+ };
175
+ D(" icons.iconBase is set to : " + z.iconBase);
176
+ var ae = z.iconBase;
177
+ z.originalIconBase;
178
+ // src/widgets/peoplePicker.js
179
+ var B = /* @__PURE__ */ d(j()), V = f.store, oe = class {
180
+ constructor(e, t, n, r) {
181
+ this.options = r || {}, this.element = e, this.typeIndex = t, this.groupPickedCb = n, this.selectedgroup = this.options.selectedgroup, this.onSelectGroup = this.onSelectGroup.bind(this);
182
+ }
183
+ render() {
184
+ let e = document.createElement("div");
185
+ if (e.style.maxWidth = "350px", e.style.minHeight = "200px", e.style.outline = "1px solid black", e.style.display = "flex", this.selectedgroup) {
186
+ e.style.flexDirection = "column";
187
+ let t = document.createElement("div");
188
+ new ce(t, this.selectedgroup).render();
189
+ let n = document.createElement("button");
190
+ n.textContent = (0, B.default)("Change group"), n.addEventListener("click", (e) => {
191
+ this.selectedgroup = null, this.render();
192
+ }), e.appendChild(t), e.appendChild(n);
193
+ } else this.findAddressBook(this.typeIndex).then(({ book: t }) => {
194
+ let n = document.createElement("button");
195
+ n.textContent = (0, B.default)("Pick an existing group"), n.style.margin = "auto", n.addEventListener("click", (n) => {
196
+ new se(e, t, this.onSelectGroup).render();
197
+ });
198
+ let r = document.createElement("button");
199
+ r.textContent = (0, B.default)("Create a new group"), r.style.margin = "auto", r.addEventListener("click", (e) => {
200
+ this.createNewGroup(t, this.options.defaultNewGroupName).then(({ group: e }) => {
201
+ new le(this.element, t, e, this.onSelectGroup).render();
202
+ }).catch((e) => {
203
+ this.element.appendChild(R(document, (0, B.default)(`Error creating a new group. (${e})`)));
204
+ });
205
+ }), e.appendChild(n), e.appendChild(r), this.element.innerHTML = "", this.element.appendChild(e);
206
+ }).catch((e) => {
207
+ this.element.appendChild(R(document, (0, B.default)(`Could find your groups. (${e})`)));
208
+ });
209
+ return this.element.innerHTML = "", this.element.appendChild(e), this;
210
+ }
211
+ findAddressBook(e) {
212
+ return new Promise((t, n) => {
213
+ V.fetcher.nowOrWhenFetched(e, (r, i) => {
214
+ if (!r) return n(i);
215
+ let a = V.any(null, u.solid("forClass"), u.vcard("AddressBook"));
216
+ if (!a) return n(/* @__PURE__ */ Error("no address book registered in the solid type index " + e));
217
+ let o = V.any(a, u.solid("instance"));
218
+ if (!o) return n(/* @__PURE__ */ Error("incomplete address book registration"));
219
+ V.fetcher.load(o).then(function(e) {
220
+ return t({ book: o });
221
+ }).catch(function(e) {
222
+ return n(/* @__PURE__ */ Error("Could not load address book " + e));
223
+ });
224
+ });
225
+ });
226
+ }
227
+ createNewGroup(t, n) {
228
+ let { groupIndex: r, groupContainer: i } = pe(t), a = e(`${i.uri}${ee().slice(0, 8)}.ttl#this`), o = n || "Untitled Group", s = [a.doc(), r].map((e) => {
229
+ let n = c(a, u.rdf("type"), u.vcard("Group"), e), i = c(a, u.vcard("fn"), o, a.doc(), e), s = c(t, u.vcard("includesGroup"), a, e), l = e.equals(r) ? [
230
+ n,
231
+ i,
232
+ s
233
+ ] : [n, i];
234
+ return fe(e.uri, { toIns: l }).then(() => {
235
+ l.forEach((e) => {
236
+ V.add(e);
237
+ });
238
+ });
239
+ });
240
+ return Promise.all(s).then(() => ({ group: a })).catch((e) => {
241
+ throw D("Could not create new group. PATCH failed " + e), Error(`Couldn't create new group. PATCH failed for (${e.xhr ? e.xhr.responseURL : ""} )`);
242
+ });
243
+ }
244
+ onSelectGroup(e) {
245
+ this.selectedgroup = e, this.groupPickedCb(e), this.render();
246
+ }
247
+ }, se = class {
248
+ constructor(e, t, n) {
249
+ this.element = e, this.book = t, this.onSelectGroup = n;
250
+ }
251
+ render() {
252
+ return this.loadGroups().then((e) => {
253
+ let t = document.createElement("div");
254
+ t.style.display = "flex", t.style.flexDirection = "column", e.forEach((e) => {
255
+ let n = document.createElement("button");
256
+ n.addEventListener("click", this.handleClickGroup(e)), new ce(n, e).render(), t.appendChild(n);
257
+ }), this.element.innerHTML = "", this.element.appendChild(t);
258
+ }).catch((e) => {
259
+ this.element.appendChild(R(document, (0, B.default)(`There was an error loading your groups. (${e})`)));
260
+ }), this;
261
+ }
262
+ loadGroups() {
263
+ return new Promise((e, t) => {
264
+ let { groupIndex: n } = pe(this.book);
265
+ V.fetcher.nowOrWhenFetched(n, (n, r) => n ? e(V.each(this.book, u.vcard("includesGroup"))) : t(r));
266
+ });
267
+ }
268
+ handleClickGroup(e) {
269
+ return (t) => {
270
+ this.onSelectGroup(e);
271
+ };
272
+ }
273
+ }, ce = class {
274
+ constructor(e, t) {
275
+ this.element = e, this.group = t;
276
+ }
277
+ render() {
278
+ let e = document.createElement("div");
279
+ return e.textContent = (0, B.default)(de(this.group, u.vcard("fn"), `[${this.group.value}]`)), this.element.innerHTML = "", this.element.appendChild(e), this;
280
+ }
281
+ }, le = class {
282
+ constructor(e, t, n, r, i) {
283
+ this.element = e, this.book = t, this.group = n, this.onGroupChanged = (e, t, n) => {
284
+ i && i(e, t, n);
285
+ }, this.groupChangedCb = i, this.doneBuildingCb = r;
286
+ }
287
+ refresh() {}
288
+ render() {
289
+ let e = document.createElement("div");
290
+ e.style.maxWidth = "350px", e.style.minHeight = "200px", e.style.outline = "1px solid black", e.style.display = "flex", e.style.flexDirection = "column", L(e, (e) => {
291
+ e.forEach((e) => {
292
+ this.add(e).catch((e) => {
293
+ this.element.appendChild(R(document, (0, B.default)(`Could not add the given WebId. (${e})`)));
294
+ });
295
+ });
296
+ });
297
+ let t = document.createElement("input");
298
+ t.type = "text", t.value = de(this.group, u.vcard("fn"), "Untitled Group"), t.addEventListener("change", (e) => {
299
+ this.setGroupName(e.target.value).catch((e) => {
300
+ this.element.appendChild(R(document, `Error changing group name. (${e})`));
301
+ });
302
+ });
303
+ let n = document.createElement("label");
304
+ if (n.textContent = (0, B.default)("Group Name:"), n.appendChild(t), e.appendChild(n), V.any(this.group, u.vcard("hasMember"))) V.match(this.group, u.vcard("hasMember")).forEach((t) => {
305
+ let n = t.object, r = document.createElement("div");
306
+ new ue(r, n, this.handleRemove(n)).render(), e.appendChild(r);
307
+ });
308
+ else {
309
+ let t = document.createElement("p");
310
+ t.textContent = B.default`
311
+ To add someone to this group, drag and drop their WebID URL onto the box.
312
+ `, e.appendChild(t);
313
+ }
314
+ let r = document.createElement("button");
315
+ return r.textContent = (0, B.default)("Done"), r.addEventListener("click", (e) => {
316
+ this.doneBuildingCb(this.group);
317
+ }), e.appendChild(r), this.element.innerHTML = "", this.element.appendChild(e), this;
318
+ }
319
+ add(t) {
320
+ return new Promise((n, r) => {
321
+ V.fetcher.nowOrWhenFetched(t, (i, a) => {
322
+ if (!i) return this.onGroupChanged(a), r(a);
323
+ let o = e(t), s = V.any(o, u.rdf("type"));
324
+ return !s || !s.equals(u.foaf("Person")) ? r(/* @__PURE__ */ Error(`Only people supported right now. (tried to add something of type ${s.value})`)) : n(o);
325
+ });
326
+ }).then((e) => {
327
+ let t = c(this.group, u.vcard("hasMember"), e);
328
+ return V.holdsStatement(t) ? e : fe(this.group.doc().uri, { toIns: [t] }).then(() => {
329
+ t.why = this.group.doc(), V.add(t), this.onGroupChanged(null, "added", e), this.render();
330
+ });
331
+ });
332
+ }
333
+ handleRemove(e) {
334
+ return (t) => {
335
+ let n = c(this.group, u.vcard("hasMember"), e);
336
+ return fe(this.group.doc().uri, { toDel: [n] }).then(() => (V.remove(n), this.onGroupChanged(null, "removed", e), this.render(), !0)).catch((t) => {
337
+ let n = V.any(e, u.foaf("name")), r = n && n.value ? `Could not remove ${n.value}. (${t})` : `Could not remove ${e.value}. (${t})`;
338
+ throw Error(r);
339
+ });
340
+ };
341
+ }
342
+ setGroupName(e) {
343
+ let { groupIndex: n } = pe(this.book), r = [this.group.doc(), n].map((n) => {
344
+ let r = V.match(this.group, u.vcard("fn"), null, n), i = c(this.group, u.vcard("fn"), t(e));
345
+ return fe(n.value, {
346
+ toDel: r,
347
+ toIns: [i]
348
+ }).then((e) => {
349
+ V.removeStatements(r), i.why = n, V.add(i);
350
+ });
351
+ });
352
+ return Promise.all(r);
353
+ }
354
+ }, ue = class {
355
+ constructor(e, t, n) {
356
+ this.webIdNode = t, this.element = e, this.handleRemove = n;
357
+ }
358
+ render() {
359
+ let e = document.createElement("div");
360
+ e.style.display = "flex";
361
+ let t = de(this.webIdNode, u.foaf("img"), ae + "noun_15059.svg"), n = document.createElement("img");
362
+ n.src = (0, B.default)(t), n.width = "50", n.height = "50", n.style.margin = "5px";
363
+ let r = de(this.webIdNode, u.foaf("name"), `[${this.webIdNode}]`), i = document.createElement("span");
364
+ i.innerHTML = (0, B.default)(r), i.style.flexGrow = "1", i.style.margin = "auto 0";
365
+ let a = document.createElement("button");
366
+ return a.textContent = "Remove", a.addEventListener("click", (e) => this.handleRemove().catch((e) => {
367
+ this.element.appendChild(R(document, (0, B.default)(`${e}`)));
368
+ })), a.style.margin = "5px", e.appendChild(n), e.appendChild(i), e.appendChild(a), this.element.innerHTML = "", this.element.appendChild(e), this;
369
+ }
370
+ };
371
+ function de(e, t, n) {
372
+ let r = V.any(e, t);
373
+ return r ? r.value : n;
374
+ }
375
+ function fe(e, { toDel: t, toIns: n }) {
376
+ return new Promise((e, r) => {
377
+ V.updater.update(t, n, (t, n, i) => {
378
+ if (!n) return r(/* @__PURE__ */ Error(`PATCH failed for resource <${t}>: ${i}`));
379
+ e();
380
+ });
381
+ });
382
+ }
383
+ function pe(e) {
384
+ return {
385
+ groupIndex: V.any(e, u.vcard("groupIndex")),
386
+ groupContainer: V.sym(e.dir().uri + "Group/")
387
+ };
388
+ }
389
+ // src/lib/newperson.js
390
+ var me = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjAxNTcgOS4yNzM2M0MxNC4yOTU0IDguMzQwMzEgMTUuMTI4OCA2LjgyOTg0IDE1LjEyODggNS4xMjgyQzE1LjEyODggMi4zMDA1MSAxMi44MjgzIDAgMTAuMDAwNiAwQzcuMTcyODkgMCA0Ljg3MjM4IDIuMzAwNTEgNC44NzIzOCA1LjEyODJDNC44NzIzOCA2LjgyOTg0IDUuNzA1NyA4LjM0MDMxIDYuOTg1NDcgOS4yNzM2M0MzLjgwNDIyIDEwLjQ5MSAxLjUzOTA2IDEzLjU3NTQgMS41MzkwNiAxNy4xNzk1QzEuNTM5MDYgMTguNzM0NyAyLjgwNDM0IDIwIDQuMzU5NTcgMjBIMTUuNjQxNkMxNy4xOTY4IDIwIDE4LjQ2MjEgMTguNzM0NyAxOC40NjIxIDE3LjE3OTVDMTguNDYyMSAxMy41NzU0IDE2LjE5NyAxMC40OTEgMTMuMDE1NyA5LjI3MzYzWk02LjQxMDg2IDUuMTI4MkM2LjQxMDg2IDMuMTQ4ODMgOC4wMjEyMSAxLjUzODQ4IDEwLjAwMDYgMS41Mzg0OEMxMS45OCAxLjUzODQ4IDEzLjU5MDMgMy4xNDg4MyAxMy41OTAzIDUuMTI4MkMxMy41OTAzIDcuMTA3NTggMTEuOTggOC43MTc5NyAxMC4wMDA2IDguNzE3OTdDOC4wMjEyMSA4LjcxNzk3IDYuNDEwODYgNy4xMDc1OCA2LjQxMDg2IDUuMTI4MlpNMTUuNjQxNiAxOC40NjE1SDQuMzU5NTdDMy42NTI2NiAxOC40NjE1IDMuMDc3NTQgMTcuODg2NCAzLjA3NzU0IDE3LjE3OTVDMy4wNzc1NCAxMy4zNjIgNi4xODMxNiAxMC4yNTY0IDEwLjAwMDYgMTAuMjU2NEMxMy44MTgxIDEwLjI1NjQgMTYuOTIzNyAxMy4zNjIgMTYuOTIzNyAxNy4xNzk1QzE2LjkyMzcgMTcuODg2NCAxNi4zNDg2IDE4LjQ2MTUgMTUuNjQxNiAxOC40NjE1WiIgZmlsbD0iIzMxNDE1OCIvPgo8L3N2Zz4K", he = (e, t, n) => {
391
+ let r = e.createElement("tr");
392
+ return r.appendChild(e.createElement("td")).appendChild(t), r.subject = n, r;
393
+ }, ge = (e, t) => {
394
+ e.addEventListener("click", t);
395
+ }, _e = (e, t, n) => {
396
+ let r = t.appendChild(e.createElement("div"));
397
+ r.setAttribute("style", C.imageDivStyle), r.appendChild(n), n.setAttribute("draggable", "false");
398
+ };
399
+ // src/widgets/buttons/iconLinks.ts
400
+ function ve(e, t, n) {
401
+ let r = e.createElement("a");
402
+ if (r.setAttribute("href", t.uri), t.uri.startsWith("http") && r.setAttribute("target", "_blank"), n) {
403
+ let t = r.appendChild(e.createElement("img"));
404
+ t.setAttribute("src", n), t.setAttribute("style", "margin: 0.3em;");
405
+ } else {
406
+ r.setAttribute("aria-label", "Open resource");
407
+ let t = r.appendChild(e.createElement("icon-lucide-square-arrow-out-up-right"));
408
+ t.setAttribute("aria-hidden", "true"), t.setAttribute("style", "display: inline-block; width: 1em; height: 1em; margin: 0.2em; color: var(--color-text-secondary, #4A5565);");
409
+ }
410
+ return r;
411
+ }
412
+ var ye = (e, t, n) => {
413
+ let r = ve(e, n);
414
+ t.appendChild(r).classList.add("HoverControlHide"), t.appendChild(e.createElement("br"));
415
+ }, { iconBase: H } = z, be = H + "noun_1180156.svg", xe = H + "noun_1180158.svg";
416
+ function Se(e) {
417
+ let t = e && e.statusArea || e && e.div || null;
418
+ if (t) return t;
419
+ let n = e && e.dom;
420
+ if (!n && typeof document < "u" && (n = document), n) {
421
+ let r = n.getElementsByTagName("body")[0];
422
+ return t = n.createElement("div"), r.insertBefore(t, r.firstElementChild), e && (e.statusArea = t), t;
423
+ }
424
+ return null;
425
+ }
426
+ function Ce(e, t) {
427
+ if (!t) return;
428
+ let n = Se(e);
429
+ D("Complaint: " + t), n ? n.appendChild(R(e && e.dom || document, t)) : alert(t);
430
+ }
431
+ function we(e) {
432
+ for (; e.firstChild;) e.removeChild(e.firstChild);
433
+ return e;
434
+ }
435
+ function Te(e) {
436
+ let t = e.search(/logFile=/), n = e.search(/&rulesFile=/);
437
+ return e.substring(t + 8, n);
438
+ }
439
+ function Ee(e, t) {
440
+ if (!e) return "???";
441
+ let n = [
442
+ "Jan",
443
+ "Feb",
444
+ "Mar",
445
+ "Apr",
446
+ "May",
447
+ "Jun",
448
+ "Jul",
449
+ "Aug",
450
+ "Sep",
451
+ "Oct",
452
+ "Nov",
453
+ "Dec"
454
+ ];
455
+ try {
456
+ let r = (/* @__PURE__ */ new Date()).toISOString();
457
+ return e.slice(0, 10) === r.slice(0, 10) && !t ? e.slice(11, 16) : e.slice(0, 4) === r.slice(0, 4) ? n[parseInt(e.slice(5, 7), 10) - 1] + " " + parseInt(e.slice(8, 10), 10) : e.slice(0, 10);
458
+ } catch (e) {
459
+ return "shortdate:" + e;
460
+ }
461
+ }
462
+ function De(e, t) {
463
+ return t.split("{").map(function(t) {
464
+ let n = t.split("}")[0];
465
+ return t ? ("000" + (e["get" + n]() + ({ Month: 1 }[n] || 0))).slice(-({
466
+ Milliseconds: 3,
467
+ FullYear: 4
468
+ }[n] || 2)) + t.split("}")[1] : "";
469
+ }).join("");
470
+ }
471
+ function Oe() {
472
+ return De(/* @__PURE__ */ new Date(), "{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}");
473
+ }
474
+ function ke() {
475
+ return De(/* @__PURE__ */ new Date(), "{Hours}:{Minutes}:{Seconds}.{Milliseconds}");
476
+ }
477
+ function Ae(e, t) {
478
+ let n = E, r = function(e) {
479
+ let t = n.any(e, u.vcard("fn")) || n.any(e, u.foaf("name")) || n.any(e, u.vcard("organization-name"));
480
+ return t ? t.value : null;
481
+ }, i = t.sameTerm(u.foaf("Agent")) ? "Everyone" : r(t);
482
+ if (e.textContent = i || w(t), !i && t.uri) {
483
+ if (!n.fetcher) throw Error("kb has no fetcher");
484
+ n.fetcher.nowOrWhenFetched(t.doc(), void 0, function(n) {
485
+ e.textContent = r(t) || w(t);
486
+ });
487
+ }
488
+ }
489
+ function je(e, t) {
490
+ return t.each(e, u.sioc("avatar")).concat(t.each(e, u.foaf("img"))).concat(t.each(e, u.vcard("logo"))).concat(t.each(e, u.vcard("hasPhoto"))).concat(t.each(e, u.vcard("photo"))).concat(t.each(e, u.foaf("depiction")));
491
+ }
492
+ var Me = {
493
+ "solid:AppProviderClass": "noun_144.svg",
494
+ "solid:AppProvider": "noun_15177.svg",
495
+ "solid:Pod": "noun_Cabinet_1434380.svg",
496
+ "vcard:Group": "noun_339237.svg",
497
+ "vcard:Organization": "noun_143899.svg",
498
+ "vcard:Individual": me,
499
+ "schema:Person": me,
500
+ "foaf:Person": me,
501
+ "foaf:Agent": "noun_98053.svg",
502
+ "acl:AuthenticatedAgent": "noun_99101.svg",
503
+ "prov:SoftwareAgent": "noun_Robot_849764.svg",
504
+ "vcard:AddressBook": "noun_15695.svg",
505
+ "trip:Trip": "noun_581629.svg",
506
+ "meeting:LongChat": "noun_1689339.svg",
507
+ "meeting:Meeting": "noun_66617.svg",
508
+ "meeting:Project": "noun_1036577.svg",
509
+ "ui:Form": "noun_122196.svg",
510
+ "rdfs:Class": "class-rectangle.svg",
511
+ "rdf:Property": "property-diamond.svg",
512
+ "owl:Ontology": "noun_classification_1479198.svg",
513
+ "wf:Tracker": "noun_122196.svg",
514
+ "wf:Task": "noun_17020_gray-tick.svg",
515
+ "wf:Open": "noun_17020_sans-tick.svg",
516
+ "wf:Closed": "noun_17020.svg"
517
+ };
518
+ function Ne(e) {
519
+ let t = e.uri.split("#")[0], n = t.indexOf("//");
520
+ if (n < 0) throw Error("This URI does not have a web site part (origin)");
521
+ let r = t.indexOf("/", n + 2);
522
+ return r < 0 ? t.slice(0) + "/" : t.slice(0, r + 1);
523
+ }
524
+ function Pe(e) {
525
+ let t = H;
526
+ return typeof e != "string" && e.uri ? e.uri.split("/").length === 4 && !e.uri.split("/")[1] && !e.uri.split("/")[3] ? t + "noun_15177.svg" : e.uri.startsWith("message:") || e.uri.startsWith("mid:") ? t + "noun_480183.svg" : e.uri.startsWith("mailto:") ? t + "noun_567486.svg" : e.uri.startsWith("https:") && e.uri.indexOf("#") < 0 ? Ne(e) + "favicon.ico" : null : t + "noun_10636_grey.svg";
527
+ }
528
+ function Fe(e) {
529
+ let t = E, n = H;
530
+ if (e.sameTerm(u.foaf("Agent")) || e.sameTerm(u.rdf("Resource"))) return n + "noun_98053.svg";
531
+ let r = t.any(e, u.sioc("avatar")) || t.any(e, u.foaf("img")) || t.any(e, u.vcard("logo")) || t.any(e, u.vcard("hasPhoto")) || t.any(e, u.vcard("photo")) || t.any(e, u.foaf("depiction"));
532
+ return r ? r.uri : null;
533
+ }
534
+ function Ie(e, t, n) {
535
+ let r = E, i = Fe(t);
536
+ if (i) return e.setAttribute("src", i), !0;
537
+ let a = n[t.uri];
538
+ if (a) return e.setAttribute("src", a), e.style = C.classIconStyle, !0;
539
+ let o = Pe(t);
540
+ if (o) return e.setAttribute("src", o), !0;
541
+ let s = r.findTypeURIs(t);
542
+ for (let t in s) if (n[t]) return e.setAttribute("src", n[t]), !1;
543
+ return e.setAttribute("src", H + "noun_10636_grey.svg"), !1;
544
+ }
545
+ function Le(e, t) {
546
+ let n = E, r = {};
547
+ for (let e in Me) {
548
+ let t = e.split(":")[0], n = e.split(":")[1], i = u[t](n), a = Me[e];
549
+ a.startsWith("data:") ? r[i.uri] = a : r[i.uri] = m(a, H);
550
+ }
551
+ if (!Ie(e, t, r) && t.uri) {
552
+ if (!n.fetcher) throw Error("kb has no fetcher");
553
+ n.fetcher.nowOrWhenFetched(t.doc(), void 0, (n) => {
554
+ n && Ie(e, t, r);
555
+ });
556
+ }
557
+ }
558
+ function Re(e, t) {
559
+ let n = e.createElement("img");
560
+ if (n.style = C.iconStyle, n.setAttribute("src", H + (function(e) {
561
+ if (!e.uri) return !1;
562
+ let t = e.uri.split("/");
563
+ return t.length === 3 || t.length === 4 && t[3] === "";
564
+ }(t) ? "noun_15177.svg" : "noun_681601.svg")), t.uri && t.uri.startsWith("https:") && t.uri.indexOf("#") < 0) {
565
+ let r = e.createElement("object");
566
+ return r.setAttribute("data", Ne(t) + "favicon.ico"), r.setAttribute("type", "image/x-icon"), r.appendChild(n), r;
567
+ }
568
+ return Le(n, t), n;
569
+ }
570
+ function ze(e, t, n, r, i) {
571
+ function a() {
572
+ t.remove(), i();
573
+ }
574
+ function o() {
575
+ a();
576
+ let e = r();
577
+ if (e && typeof e.then == "function") return e.then(i);
578
+ i();
579
+ }
580
+ let s = e.createElement("div");
581
+ s.style.cssText = C.confirmPopupStyle, s.style.position = "absolute", s.style.top = "-1em", s.style.display = "grid", s.style.gridTemplateColumns = "auto auto";
582
+ let c = e.createElement("div");
583
+ c.style.gridColumn = "1/2", c.style.gridRow = "1";
584
+ let l = e.createElement("div");
585
+ l.style.gridColumn = "1/2", l.style.gridRow = "2";
586
+ let u = G(e, a);
587
+ s.appendChild(u), u.style.gridColumn = "1", u.style.gridRow = "2";
588
+ let d = s.appendChild(e.createElement("button"));
589
+ d.style.cssText = C.buttonStyle, d.style.gridRow = "2", d.style.gridColumn = "2", d.textContent = "Cancel";
590
+ let f = W(e, z.iconBase + "noun_925021.svg", "Delete it");
591
+ s.appendChild(f), f.style.gridRow = "1", f.style.gridColumn = "1";
592
+ let p = s.appendChild(e.createElement("button"));
593
+ return p.style.cssText = C.buttonStyle, p.style.gridRow = "1", p.style.gridColumn = "2", p.textContent = n, s.appendChild(p), f.addEventListener("click", o), p.addEventListener("click", o), d.addEventListener("click", a), s;
594
+ }
595
+ function U(e, t, n, r, i) {
596
+ function a() {
597
+ let n = "button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", a = [];
598
+ if (i) for (let e = t; e; e = e.parentElement) {
599
+ let t = Array.from(e.querySelectorAll(n));
600
+ a.push({
601
+ element: e,
602
+ index: t.indexOf(s)
603
+ });
604
+ }
605
+ function o() {
606
+ if (!i) return;
607
+ if (s.isConnected) {
608
+ s.focus();
609
+ return;
610
+ }
611
+ for (let e of a) {
612
+ if (!e.element.isConnected) continue;
613
+ let t = e.element.querySelectorAll(n);
614
+ if (t.length) {
615
+ t[Math.min(Math.max(e.index, 0), t.length - 1)].focus();
616
+ return;
617
+ }
618
+ }
619
+ let e = a.find((e) => e.element.isConnected);
620
+ e && (e.element.tabIndex = -1, e.element.focus());
621
+ }
622
+ let l = e.createElement("div");
623
+ i ? (i.querySelector(":scope > [data-delete-confirmation]")?.remove(), l.setAttribute("data-delete-confirmation", ""), l.setAttribute("role", "dialog"), l.setAttribute("aria-label", c), i.appendChild(l)) : (t.insertBefore(l, s), l.style.position = "relative");
624
+ let u = ze(e, l, c, r, o);
625
+ l.appendChild(u), i && (u.style.position = "static", u.style.top = "", Array.from(u.querySelectorAll("button")).find((e) => e.textContent === "Cancel")?.focus());
626
+ }
627
+ let o = H + "noun_2188_red.svg", s = e.createElement("img");
628
+ s.setAttribute("src", o), s.tabIndex = 0, s.setAttribute("role", "button"), s.setAttribute("style", C.smallButtonStyle), s.style.float = "right";
629
+ let c = "Remove this " + n;
630
+ return s.title = c, s.setAttribute("aria-label", c), s.classList.add("hoverControlHide"), s.addEventListener("click", a), s.addEventListener("keydown", (e) => {
631
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s.click());
632
+ }), t.classList.add("hoverControl"), t.appendChild(s), s.setAttribute("data-testid", "deleteButtonWithCheck"), s;
633
+ }
634
+ function W(e, t, n, r, i = {
635
+ buttonColor: "Primary",
636
+ needsBorder: !1
637
+ }) {
638
+ let a = e.createElement("button");
639
+ if (a.setAttribute("type", "button"), t) {
640
+ let r = a.appendChild(e.createElement("img"));
641
+ r.setAttribute("src", t), r.setAttribute("style", "width: 2em; height: 2em;"), r.title = n, a.setAttribute("style", C.buttonStyle);
642
+ } else a.textContent = n.toLocaleUpperCase(), a.onmouseover = function() {
643
+ i.buttonColor === "Secondary" ? i.needsBorder ? a.setAttribute("style", C.secondaryButtonNoBorderHover) : a.setAttribute("style", C.secondaryButtonHover) : i.needsBorder ? a.setAttribute("style", C.primaryButtonNoBorderHover) : a.setAttribute("style", C.primaryButtonHover);
644
+ }, a.onmouseout = function() {
645
+ i.buttonColor === "Secondary" ? i.needsBorder ? a.setAttribute("style", C.secondaryButtonNoBorder) : a.setAttribute("style", C.secondaryButton) : i.needsBorder ? a.setAttribute("style", C.primaryButtonNoBorder) : a.setAttribute("style", C.primaryButton);
646
+ }, i.buttonColor === "Secondary" ? i.needsBorder ? a.setAttribute("style", C.secondaryButtonNoBorder) : a.setAttribute("style", C.secondaryButton) : i.needsBorder ? a.setAttribute("style", C.primaryButtonNoBorder) : a.setAttribute("style", C.primaryButton);
647
+ return r && a.addEventListener("click", r, !1), a;
648
+ }
649
+ function G(e, t) {
650
+ let n = W(e, be, "Cancel", t);
651
+ return n.firstChild && (n.firstChild.style.opacity = "0.3"), n;
652
+ }
653
+ function Be(e, t) {
654
+ return W(e, xe, "Continue", t);
655
+ }
656
+ function Ve(e, t, n, r, i, a) {
657
+ return new Promise(function(t, o) {
658
+ let s = e.createElement("div");
659
+ r ||= u.foaf("name"), a ||= i ? w(i) : " ";
660
+ let c = a + " " + w(r) + ": ";
661
+ s.appendChild(e.createElement("p")).textContent = c;
662
+ let l = e.createElement("input");
663
+ l.setAttribute("type", "text"), l.setAttribute("size", "100"), l.setAttribute("maxLength", "2048"), l.setAttribute("style", C.textInputStyle), l.select(), s.appendChild(l), n.appendChild(s);
664
+ function d() {
665
+ s.parentNode.removeChild(s), t(l.value.trim());
666
+ }
667
+ l.addEventListener("keyup", function(e) {
668
+ e.keyCode === 13 && d();
669
+ }, !1), s.appendChild(e.createElement("br")), s.appendChild(G(e, function(e) {
670
+ s.parentNode.removeChild(s), t(null);
671
+ })), s.appendChild(Be(e, function(e) {
672
+ d();
673
+ })), l.focus();
674
+ });
675
+ }
676
+ var He = Ue;
677
+ function Ue(e, t, n, r) {
678
+ let i = e.createElement("tr");
679
+ r ||= {};
680
+ let a = i.appendChild(e.createElement("td")), o = i.appendChild(e.createElement("td")), s = i.appendChild(e.createElement("td")), c = r.image || Re(e, n);
681
+ a.setAttribute("style", "vertical-align: middle; width:2.5em; padding:0.5em; height: 2.5em;"), o.setAttribute("style", "vertical-align: middle; text-align:left;"), s.setAttribute("style", "vertical-align: middle; width:2em; padding:0.5em; height: 4em;"), a.appendChild(c);
682
+ let l = o.appendChild(e.createElement("div")), u = l.appendChild(e.createElement("span"));
683
+ if (r.title ? u.textContent = r.title : Ae(u, n), typeof r.renderNameSuffix == "function") {
684
+ let t = r.renderNameSuffix(n, e);
685
+ if (t) {
686
+ let n = l.appendChild(e.createElement("span"));
687
+ n.setAttribute("style", "margin-left: 0.4em; opacity: 0.8;"), typeof t == "string" ? n.textContent = t : n.appendChild(t);
688
+ }
689
+ }
690
+ if (typeof r.renderSupportingInfo == "function") {
691
+ let t = r.renderSupportingInfo(n, e);
692
+ if (t) {
693
+ let n = o.appendChild(e.createElement("div"));
694
+ n.setAttribute("style", "font-size: 90%; opacity: 0.8;"), typeof t == "string" ? n.textContent = t : n.appendChild(t);
695
+ }
696
+ }
697
+ return r.deleteFunction && U(e, s, r.noun || "one", r.deleteFunction, r.confirmationContainer), n.uri && (r.link !== !1 && (s.appendChild(ve(e, n)).classList.add("HoverControlHide"), s.appendChild(e.createElement("br"))), r.draggable !== !1 && (c.setAttribute("draggable", "false"), ne(i, n))), i.subject = n, i;
698
+ }
699
+ function We(e, t, n, r) {
700
+ let i = t.appendChild(e.createElement("div"));
701
+ n ? i.textContent = n : Ae(i, r);
702
+ }
703
+ function Ge(e, t, n, r) {
704
+ let i = t.appendChild(e.createElement("div"));
705
+ i.setAttribute("style", C.linkDivStyle), r.deleteFunction && U(e, i, r.noun || "one", r.deleteFunction, r.confirmationContainer), n.uri && (r.link !== !1 && ye(e, i, n), ne(t, n));
706
+ }
707
+ function Ke(e, t, n) {
708
+ let r = e.createElement("div");
709
+ return r.setAttribute("style", C.renderAsDivStyle), n ||= {}, _e(e, r, n.image || Re(e, t)), We(e, r, n.title, t), Ge(e, r, t, n), n.clickable && n.onClickFunction && ge(r, n.onClickFunction), n.wrapInATR ? he(e, r, t) : r;
710
+ }
711
+ function qe(e) {
712
+ if (e.refresh) e.refresh();
713
+ else for (let t = 0; t < e.children.length; t++) qe(e.children[t]);
714
+ }
715
+ function Je(t, n, r, i = {}) {
716
+ let a = /* @__PURE__ */ new Set(), o = !!(i.renderSupportingInfo || i.renderNameSuffix), s = i.refreshOnDocumentLoad ?? !0, l = function(e) {
717
+ let t = b.updater;
718
+ if (!t) throw Error("kb has no updater");
719
+ return new Promise((r) => t.update(c(n, v, e, h), [], function(e, t, n, i) {
720
+ t ? f() : Ce(void 0, "Error deleting one: " + n), r();
721
+ }));
722
+ };
723
+ function d(e) {
724
+ let n = e, r = { noun: y };
725
+ if (r.renderSupportingInfo = i.renderSupportingInfo, r.renderNameSuffix = i.renderNameSuffix, r.confirmationContainer = i.confirmationContainer, o && s && e?.uri && b.fetcher) {
726
+ let t = e.doc(), n = t?.uri ? b.fetcher.requested?.[t.uri] : void 0, r = n !== "done" && n !== "failed";
727
+ t?.uri && r && !a.has(t.uri) && (a.add(t.uri), b.fetcher.nowOrWhenFetched(t, void 0, () => {
728
+ a.delete(t.uri), f();
729
+ }));
730
+ }
731
+ return g && (r.deleteFunction = function() {
732
+ return l(n);
733
+ }), He(t, v, e, r);
734
+ }
735
+ let f = function() {
736
+ let e = b.each(n, v);
737
+ e.sort(), S(T, e, d, o ? function(e, t) {
738
+ return d(t);
739
+ } : void 0);
740
+ };
741
+ function p(t) {
742
+ let r = [];
743
+ if (t.forEach(function(t) {
744
+ let i = e(t);
745
+ D("Dropped on attachemnt " + t), r.push(c(n, v, i, h));
746
+ }), !b.updater) throw Error("kb has no updater");
747
+ b.updater.update([], r, function(e, t, n, r) {
748
+ t ? f() : Ce(void 0, "Error adding one: " + n);
749
+ });
750
+ }
751
+ function m(e) {
752
+ re(b.fetcher, e, i.uploadFolder?.uri, i.uploadFolder?.uri, function(e, t) {
753
+ let r = [c(n, v, b.sym(t), h)];
754
+ if (!b.updater) throw Error("kb has no updater");
755
+ b.updater.update([], r, function(e, t, n, r) {
756
+ t ? f() : Ce(void 0, "Error adding link to uploaded file: " + n);
757
+ });
758
+ });
759
+ }
760
+ let h = i.doc || n.doc();
761
+ i.modify === void 0 && (i.modify = !0);
762
+ let g = i.modify, _ = i.promptIcon || H + "noun_748003.svg", v = i.predicate || u.wf("attachment"), y = i.noun || "attachment", b = E, x = r.appendChild(t.createElement("table"));
763
+ x.setAttribute("style", "margin-top: 1em; margin-bottom: 1em;");
764
+ let C = x.appendChild(t.createElement("tr")), w = C.appendChild(t.createElement("td")), T = C.appendChild(t.createElement("td")).appendChild(t.createElement("table"));
765
+ if (T.appendChild(t.createElement("tr")), x.refresh = f, f(), g) {
766
+ let e = W(t, _, "Drop attachments here");
767
+ w.appendChild(e);
768
+ let n = i.uploadFolder ? m : null;
769
+ L(e, p, n);
770
+ let r = e.querySelector("img");
771
+ if (r && L(r, p, n), L(w, p, n), i.uploadFolder) {
772
+ let e = ft(t, m);
773
+ w.appendChild(e);
774
+ }
775
+ }
776
+ return x;
777
+ }
778
+ function Ye(e) {
779
+ e.preventDefault(), e.stopPropagation();
780
+ let t = h(e).getAttribute("href");
781
+ if (!t) return D("openHrefInOutlineMode: No href found!\n");
782
+ let n = window.document;
783
+ n.outlineManager ? n.outlineManager.GotoSubject(E.sym(t), !0, void 0, !0, void 0) : window && window.panes && window.panes.getOutliner ? window.panes.getOutliner().GotoSubject(E.sym(t), !0, void 0, !0, void 0) : D("ERROR: Can't access outline manager in this config");
784
+ }
785
+ function Xe(e) {
786
+ if (e.uri === void 0) return;
787
+ let t = e.uri;
788
+ if (t.slice(0, 7) !== "http://") return;
789
+ t = t.slice(7);
790
+ let n = t.indexOf("#");
791
+ if (n >= 0) t = t.slice(0, n);
792
+ else {
793
+ let e = t.lastIndexOf("/");
794
+ if (e < 0) return;
795
+ t = t.slice(0, e);
796
+ }
797
+ return E.sym("http://tabulator.org/wiki/annnotation/" + t);
798
+ }
799
+ function Ze() {
800
+ let e = {};
801
+ return E.statementsMatching(void 0, u.rdf("type"), void 0).forEach(function(t) {
802
+ t.object.value && (e[t.object.value] = !0);
803
+ }), E.statementsMatching(void 0, u.rdfs("subClassOf"), void 0).forEach(function(t) {
804
+ t.object.value && (e[t.object.value] = !0), t.subject.value && (e[t.subject.value] = !0);
805
+ }), E.each(void 0, u.rdf("type"), u.rdfs("Class")).forEach(function(t) {
806
+ t.value && (e[t.value] = !0);
807
+ }), e;
808
+ }
809
+ function Qe(e) {
810
+ let t = {}, n = {}, r = {}, i = 0, a = 0, o = 0, s = e.predicateIndex;
811
+ for (let e in s) s[e][0].object.termType === "Literal" ? (n[e] = !0, a++) : (r[e] = !0, i++);
812
+ let c = e.each(void 0, u.rdf("type"), u.rdf("Property"));
813
+ for (let e = 0; e < c.length; e++) {
814
+ let t = c[e].toNT();
815
+ !r[t] && !n[t] && (n[t] = !0, r[t] = !0, o++);
816
+ }
817
+ return t.op = r, t.dp = n, x(`propertyTriage: ${i} non-lit, ${a} literal. ${o} unknown.`), t;
818
+ }
819
+ function $e(e, t) {
820
+ let n = e.createElement("button");
821
+ return n.setAttribute("type", "button"), n.textContent = "Goto " + w(t), n.addEventListener("click", function(n) {
822
+ e.outlineManager.GotoSubject(t, !0, void 0, !0, void 0);
823
+ }, !0), n;
824
+ }
825
+ function et(e, t) {
826
+ let n = e.createElement("button");
827
+ return n.setAttribute("type", "button"), n.textContent = "✕", n.addEventListener("click", function(e) {
828
+ t.parentNode.removeChild(t);
829
+ }, !0), n;
830
+ }
831
+ function tt(e, t, n, r, i, a, o, s, c) {
832
+ return nt(e.createElement("div"), e, t, n, r, i, a, o, s, c);
833
+ }
834
+ function nt(e, t, n, r, i, a, o, s, c, l) {
835
+ let u = "border: 0.1em solid #ddd; border-bottom: none; width: 95%; height: 2em; padding: 0.5em;", d = null;
836
+ e.innerHTML = "";
837
+ let f = function(e, o) {
838
+ let f, p, m = function() {
839
+ let e = a ? n.each(void 0, i, o) : n.each(o, i);
840
+ _.setAttribute("class", e.length === 0 ? "hideTillHover" : ""), p.setAttribute("src", s.connectIcon || H + "noun_25830.svg"), p.setAttribute("title", e.length ? e.length : "attach");
841
+ };
842
+ f = rt.twoLine.widgetForClass(r)(t, o), f.setAttribute("style", u);
843
+ let h = t.createElement("div");
844
+ h.setAttribute("class", "hideTillHover"), h.setAttribute("style", "float:right; width:10%");
845
+ let g = t.createElement("a");
846
+ g.setAttribute("href", o.uri), g.setAttribute("style", "float:right"), h.appendChild(g).textContent = ">", e.appendChild(h);
847
+ let _ = t.createElement("div");
848
+ return _.setAttribute("style", (a ? "float:left;" : "float:right;") + " width:30px;"), p = t.createElement("img"), m(), _.appendChild(p), e.appendChild(_), f.addEventListener("click", function(e) {
849
+ d === f ? (f.setAttribute("style", u), d = null) : (d && d.setAttribute("style", u), f.setAttribute("style", u + "background-color: #ccc; color:black;"), d = f), c(o, e, d === f), m();
850
+ }, !1), p.addEventListener("click", function(e) {
851
+ l(o, e, a, m);
852
+ }, !1), e.appendChild(f), e;
853
+ };
854
+ for (let n = 0; n < o.length; n++) {
855
+ let r = t.createElement("div");
856
+ e.appendChild(r), f(r, o[n]);
857
+ }
858
+ return e;
859
+ }
860
+ var rt = {};
861
+ function it(e, t) {
862
+ let n = e.createElement("div");
863
+ return n.textContent = w(t), n;
864
+ }
865
+ function at(e) {
866
+ let t = rt.twoLine[e.uri], n = E;
867
+ if (t) return t;
868
+ let r = n.findSuperClassesNT(e);
869
+ for (let e in r) if (t = rt.twoLine[n.fromNT(e).uri], t) return t;
870
+ return rt.twoLine[""];
871
+ }
872
+ function ot(e, t) {
873
+ let n = "", r = function(e) {
874
+ let r = E.any(t, u.qu(e));
875
+ return r || (n += "@@ No value for " + e + "! "), r ? v(r.value) : "?";
876
+ }, i = e.createElement("table");
877
+ return i.innerHTML = `
878
+ <tr>
879
+ <td colspan="2"> ${r("payee")}</td>
880
+ < /tr>
881
+ < tr >
882
+ <td>${r("date").slice(0, 10)}</td>
883
+ <td style = "text-align: right;">${r("amount")}</td>
884
+ </tr>`, n && (i.innerHTML = `
885
+ <tr>
886
+ <td><a href="${v(t.uri)}">${v(n)}</a></td>
887
+ </tr>`), i;
888
+ }
889
+ function st(e, t) {
890
+ let n = function(e) {
891
+ let n = E.any(t, e);
892
+ return n ? v(n.value) : "?";
893
+ }, r = e.createElement("table");
894
+ return r.innerHTML = `
895
+ <tr>
896
+ <td colspan="2">${n(u.dc("title"))}</td>
897
+ </tr>
898
+ <tr style="color: #777">
899
+ <td>${n(u.cal("dtstart"))}</td>
900
+ <td>${n(u.cal("dtend"))}</td>
901
+ </tr>`, r;
902
+ }
903
+ function ct(e, t) {
904
+ let n = e.querySelectorAll("link");
905
+ for (let e = 0; e < n.length; e++) if ((n[e].getAttribute("rel") || "") === "stylesheet" && (n[e].getAttribute("href") || "") === t) return;
906
+ let r = e.createElement("link");
907
+ r.setAttribute("rel", "stylesheet"), r.setAttribute("type", "text/css"), r.setAttribute("href", t), e.getElementsByTagName("head")[0].appendChild(r);
908
+ }
909
+ function lt(e) {
910
+ return dt(e, "audio");
911
+ }
912
+ function ut(e) {
913
+ return dt(e, "video");
914
+ }
915
+ function dt(e, t) {
916
+ let n = {
917
+ audio: "http://purl.org/dc/dcmitype/Sound",
918
+ image: "http://purl.org/dc/dcmitype/Image",
919
+ video: "http://purl.org/dc/dcmitype/MovingImage"
920
+ }, r = t || "image", i = E.findTypeURIs(e), a = o(r + "/*").uri.split("*")[0];
921
+ for (let e in i) if (e.startsWith(a)) return !0;
922
+ return n[r] in i;
923
+ }
924
+ function ft(e, t) {
925
+ let n = e.createElement("div"), r = n.appendChild(e.createElement("input"));
926
+ return r.setAttribute("type", "file"), r.setAttribute("multiple", "true"), r.addEventListener("change", (e) => {
927
+ D("File drop event: ", e), e.files ? t(e.files) : e.target && e.target.files ? t(e.target.files) : alert("Sorry no files .. internal error?");
928
+ }, !1), r.style = "display:none", L(n.appendChild(W(e, H + "noun_Upload_76574_000000.svg", "Upload files", (e) => {
929
+ r.click();
930
+ })), null, t), n;
931
+ }
932
+ rt = {
933
+ line: {},
934
+ twoLine: {
935
+ "": it,
936
+ "http://www.w3.org/2000/10/swap/pim/qif#Transaction": ot,
937
+ "http://www.w3.org/ns/pim/trip#Trip": st,
938
+ widgetForClass: at
939
+ }
940
+ };
941
+ // src/widgets/forms/fieldParams.ts
942
+ var pt = {
943
+ [u.ui("ColorField").uri]: {
944
+ size: 9,
945
+ type: "color",
946
+ style: "height: 3em;",
947
+ dt: "color",
948
+ pattern: /^\s*#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]([0-9a-f][0-9a-f])?\s*$/
949
+ },
950
+ [u.ui("DateField").uri]: {
951
+ size: 20,
952
+ type: "date",
953
+ dt: "date",
954
+ pattern: /^\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?Z?\s*$/
955
+ },
956
+ [u.ui("DateTimeField").uri]: {
957
+ size: 20,
958
+ type: "datetime-local",
959
+ dt: "dateTime",
960
+ pattern: /^\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?(T[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?Z?\s*$/
961
+ },
962
+ [u.ui("TimeField").uri]: {
963
+ size: 10,
964
+ type: "time",
965
+ dt: "time",
966
+ pattern: /^\s*([0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)\s*$/
967
+ },
968
+ [u.ui("IntegerField").uri]: {
969
+ size: 12,
970
+ style: "text-align: right;",
971
+ dt: "integer",
972
+ pattern: /^\s*-?[0-9]+\s*$/
973
+ },
974
+ [u.ui("DecimalField").uri]: {
975
+ size: 12,
976
+ style: "text-align: right;",
977
+ dt: "decimal",
978
+ pattern: /^\s*-?[0-9]*(\.[0-9]*)?\s*$/
979
+ },
980
+ [u.ui("FloatField").uri]: {
981
+ size: 12,
982
+ style: "text-align: right;",
983
+ dt: "float",
984
+ pattern: /^\s*-?[0-9]*(\.[0-9]*)?((e|E)-?[0-9]*)?\s*$/
985
+ },
986
+ [u.ui("SingleLineTextField").uri]: {},
987
+ [u.ui("NamedNodeURIField").uri]: { namedNode: !0 },
988
+ [u.ui("TextField").uri]: {},
989
+ [u.ui("PhoneField").uri]: {
990
+ size: 20,
991
+ uriPrefix: "tel:",
992
+ pattern: /^\+?[\d-]+[\d]*$/
993
+ },
994
+ [u.ui("EmailField").uri]: {
995
+ size: 30,
996
+ uriPrefix: "mailto:",
997
+ pattern: /^\s*.*@.*\..*\s*$/
998
+ },
999
+ [u.ui("Group").uri]: { style: C.formGroupStyle },
1000
+ [u.ui("Comment").uri]: {
1001
+ element: "p",
1002
+ style: C.commentStyle
1003
+ },
1004
+ [u.ui("Heading").uri]: {
1005
+ element: "h3",
1006
+ style: C.formHeadingStyle
1007
+ }
1008
+ }, mt = f.store, K = {};
1009
+ function ht(e) {
1010
+ let t = mt, n = t.findTypeURIs(e), r = t.bottomTypeURIs(n), i = [];
1011
+ for (let e in r) i.push(e);
1012
+ return i[0];
1013
+ }
1014
+ function q(e, t) {
1015
+ let n = ht(t), r = K[n];
1016
+ return _("paneUtils: Going to implement field " + t + " of type " + n), r || function(e, r) {
1017
+ let i = R(e, "No handler for field " + t + " of type " + n);
1018
+ return r && r.appendChild(i), i;
1019
+ };
1020
+ }
1021
+ // src/widgets/forms/formStyle.ts
1022
+ var gt = "https://www.w3.org/ns/css#";
1023
+ function _t(e, t) {
1024
+ let n = pt[ht(t)] || {}, r = E.any(t, u.ui("style"));
1025
+ r ? r.termType === "Literal" ? r && e.setAttribute("style", r.value) : E.statementsMatching(r, null, null, t.doc()).forEach((t) => {
1026
+ if (t.predicate.uri && t.predicate.uri.startsWith(gt)) {
1027
+ let n = t.predicate.uri.slice(26);
1028
+ try {
1029
+ e.style[n] = t.object.value;
1030
+ } catch {
1031
+ console.warn(`setFieldStyle: Error setting element style ${n} to "${t.object.value}"`), console.warn(`setFieldStyle: ... Element tagName was "${e.tagName || "???"}"`);
1032
+ }
1033
+ }
1034
+ }) : n.style && e.setAttribute("style", n.style);
1035
+ }
1036
+ // src/widgets/forms/basic.ts
1037
+ var J = f.store;
1038
+ function vt(e, t, n, r, i) {
1039
+ n.style.display = "flex", n.style.flexDirection = "row";
1040
+ let a = n.appendChild(e.createElement("div"));
1041
+ a.style.width = y.formFieldNameBoxWidth;
1042
+ let o = n.appendChild(e.createElement("div"));
1043
+ return a.setAttribute("class", "formFieldName"), a.setAttribute("style", C.formFieldNameBoxStyle), o.setAttribute("class", "formFieldValue"), i ? a.appendChild(e.createTextNode(i)) : t.any(r, u.ui("property")) ? a.appendChild(yt(e, t.any(r, u.ui("property")), r)) : (o.appendChild(R(e, "No property or label given for form field: " + r)), a.appendChild(e.createTextNode("???"))), o;
1044
+ }
1045
+ function yt(e, t, n) {
1046
+ let r = J.any(n, u.ui("label"));
1047
+ if (r ||= w(t, !0), t === void 0) return e.createTextNode("@@Internal error: undefined property");
1048
+ let i = e.createElement("a");
1049
+ return t.uri && i.setAttribute("href", t.uri), i.setAttribute("style", "color: #3B5998; text-decoration: none;"), i.textContent = r, i;
1050
+ }
1051
+ function bt(e, t, n) {
1052
+ let r = J.statementsMatching(e, t);
1053
+ if (r.length === 0) return n;
1054
+ if (!J.updater) throw Error("Store has no updater");
1055
+ return r.length > 0 && r[0].why.value && J.updater.editable(r[0].why.value, J) ? J.sym(r[0].why.value) : n;
1056
+ }
1057
+ function Y(e, t, n, r, a, o, s) {
1058
+ let l = J, d = a.doc ? a.doc() : null, f = e.createElement("div"), p = l.any(a, u.ui("property"));
1059
+ if (t && t.appendChild(f), !p) return f.appendChild(R(e, "Error: No property given for text field: " + a));
1060
+ let m = vt(e, l, f, a), h = l.anyJS(a, u.ui("suppressEmptyUneditable"), null, d), g = pt[ht(a)];
1061
+ g === void 0 && (g = { style: "" });
1062
+ let _ = g.style || "", v = C.textInputStyle + _, b = e.createElement("input");
1063
+ b.style = v, m.appendChild(b), b.setAttribute("type", g.type ? g.type : "text");
1064
+ let x = (b.getAttribute("type") || "").toLowerCase(), S = x === "date" || x === "datetime-local", w = l.anyJS(a, u.ui("size")) || y.textInputSize || 20;
1065
+ b.setAttribute("size", w);
1066
+ let T = l.any(a, u.ui("maxLength"));
1067
+ b.setAttribute("maxLength", T ? "" + T : y.basicMaxLength), o ||= bt(r, p, o);
1068
+ let E = l.any(r, p, void 0, o);
1069
+ if (E ||= l.any(a, u.ui("default")), E && E.value && g.uriPrefix ? b.value = decodeURIComponent(E.value.replace(g.uriPrefix, "")).replace(/ /g, "") : E &&
1070
+ /* istanbul ignore next */
1071
+ (b.value = E.value || E.value || ""), b.setAttribute("style", v), !l.updater) throw Error("kb has no updater");
1072
+ return l.updater.editable(o.uri) ? (b.addEventListener("keyup", function(e) {
1073
+ g.pattern && b.setAttribute("style", v + (b.value.match(g.pattern) ? "color: green;" : "color: red;"));
1074
+ }, !0), b.addEventListener("change", function(t) {
1075
+ if (S && e.activeElement === b) {
1076
+ b.dataset && (b.dataset.deferredChange = "true");
1077
+ return;
1078
+ }
1079
+ if (g.pattern && !b.value.match(g.pattern)) return;
1080
+ let n = !S;
1081
+ n && (b.disabled = !0), b.setAttribute("style", v + "color: gray;");
1082
+ let a = l.statementsMatching(r, p), d;
1083
+ g.namedNode ? d = l.sym(b.value) : g.uriPrefix ? (d = encodeURIComponent(b.value.replace(/ /g, "")), d = l.sym(g.uriPrefix + b.value)) : d = g.dt ? new i(b.value.trim(), void 0, u.xsd(g.dt)) : new i(b.value);
1084
+ let m = a.map((e) => c(e.subject, e.predicate, d, e.why));
1085
+ m.length === 0 && (m = [c(r, p, d, o)]);
1086
+ function h(e, t, n) {
1087
+ let r = [];
1088
+ /* istanbul ignore next */
1089
+ if (t.forEach((e) => {
1090
+ r.includes(e.why.uri) || r.push(e.why.uri);
1091
+ }), e.forEach((e) => {
1092
+ /* istanbul ignore next */
1093
+ r.includes(e.why.uri) || r.push(e.why.uri);
1094
+ }), r.length === 0) throw Error("updateMany has no docs to patch");
1095
+ if (!l.updater) throw Error("kb has no updater");
1096
+ if (r.length === 1) return l.updater.update(e, t, n);
1097
+ let i = r.pop(), a = t.filter((e) => e.why.uri === i), o = t.filter((e) => e.why.uri !== i), s = e.filter((e) => e.why.uri === i), c = e.filter((e) => e.why.uri !== i);
1098
+ l.updater.update(s, a, function(e, t, r) {
1099
+ t ? h(c, o, n) : n(e, t, r);
1100
+ });
1101
+ }
1102
+ h(a, m, function(t, r, i) {
1103
+ r ? (n && (b.disabled = !1), b.setAttribute("style", v)) : f.appendChild(R(e, i)), s(r, i);
1104
+ });
1105
+ }, !0), b.addEventListener("blur", function(e) {
1106
+ if (S && b.dataset && b.dataset.deferredChange === "true") {
1107
+ delete b.dataset.deferredChange;
1108
+ let e = new Event("change", { bubbles: !0 });
1109
+ b.dispatchEvent(e);
1110
+ }
1111
+ }, !0), f) : (b.readOnly = !0, b.style = C.textInputStyleUneditable + _, h && b.value === "" && (f.style.display = "none"), f);
1112
+ }
1113
+ // src/widgets/forms/autocomplete/language.ts
1114
+ var xt = /* @__PURE__ */ a({
1115
+ addDefaults: () => Ct,
1116
+ defaultPreferredLanguages: () => X,
1117
+ filterByLanguage: () => Et,
1118
+ getPreferredLanguages: () => Tt,
1119
+ getPreferredLanguagesFor: () => wt,
1120
+ languageCodeURIBase: () => St
1121
+ }), St = "https://www.w3.org/ns/iana/language-code/", X = [
1122
+ "en",
1123
+ "fr",
1124
+ "de",
1125
+ "it",
1126
+ "ar"
1127
+ ];
1128
+ function Ct(e) {
1129
+ return e ||= [], e.concat(X.filter((t) => !e.includes(t)));
1130
+ }
1131
+ async function wt(e) {
1132
+ let t = e.doc();
1133
+ await E.fetcher?.load(t);
1134
+ let n = E.any(e, u.schema("knowsLanguage"), null, t);
1135
+ if (!n) return X;
1136
+ let r = [];
1137
+ return n.elements.forEach((e) => {
1138
+ let n = E.any(e, u.solid("publicId"), null, t);
1139
+ if (!n) {
1140
+ console.warn("getPreferredLanguages: No publiID of language.");
1141
+ return;
1142
+ }
1143
+ if (!n.value.startsWith("https://www.w3.org/ns/iana/language-code/")) {
1144
+ console.error(`What should be a language code ${n.value} does not start with ${St}`);
1145
+ return;
1146
+ }
1147
+ let i = n.value.slice(41);
1148
+ r.push(i);
1149
+ }), r.length > 0 ? (console.log(` User knows languages with codes: "${r.join(",")}"`), Ct(r)) : null;
1150
+ }
1151
+ async function Tt() {
1152
+ let e = await T.currentUser();
1153
+ if (e) {
1154
+ let t = await wt(e);
1155
+ if (t) return t;
1156
+ }
1157
+ if (typeof navigator < "u") {
1158
+ if (navigator.languages) return Ct(navigator.languages.map((e) => e.split("-")[0]));
1159
+ if (navigator.language) return Ct([navigator.language.split("-")[0]]);
1160
+ }
1161
+ return X;
1162
+ }
1163
+ function Et(e, t) {
1164
+ let n = {};
1165
+ e.forEach((e) => {
1166
+ let t = e.subject.value;
1167
+ n[t] = n[t] || [], n[t].push(e);
1168
+ });
1169
+ let r = t || X;
1170
+ r.reverse();
1171
+ let i = [];
1172
+ for (let e in n) {
1173
+ let t = n[e].map((e) => {
1174
+ let t = e.name["xml:lang"];
1175
+ return [r.indexOf(t), e];
1176
+ });
1177
+ t.sort(), t.reverse(), i.push(t[0][1]);
1178
+ }
1179
+ return D(` Filter by language: ${e.length} -> ${i.length}`), i;
1180
+ }
1181
+ // src/widgets/forms/autocomplete/publicData.ts
1182
+ var Dt = /* @__PURE__ */ a({
1183
+ AUTOCOMPLETE_LIMIT: () => 200,
1184
+ ESCOResultToBindings: () => Vt,
1185
+ bindingToTerm: () => zt,
1186
+ dbPediaTypeMap: () => Pt,
1187
+ dbpediaParameters: () => Nt,
1188
+ escoParameters: () => Mt,
1189
+ fetcherOptionsJsonPublicData: () => jt,
1190
+ getDbpediaDetails: () => Zt,
1191
+ getWikidataDetails: () => Jt,
1192
+ getWikidataDetailsOld: () => Yt,
1193
+ getWikidataLocation: () => Xt,
1194
+ instituteDetailsWikidataQuery: () => At,
1195
+ loadFromBindings: () => Bt,
1196
+ loadPublicDataThing: () => qt,
1197
+ queryESCODataByName: () => Ht,
1198
+ queryPublicDataByName: () => Wt,
1199
+ queryPublicDataConstruct: () => Kt,
1200
+ queryPublicDataSelect: () => Gt,
1201
+ variableNameToPredicateMap: () => Rt,
1202
+ wikidataClasses: () => kt,
1203
+ wikidataIncomingClassMap: () => Lt,
1204
+ wikidataOutgoingClassMap: () => Ft,
1205
+ wikidataParameters: () => It
1206
+ }), Ot = /\$\(subject\)/g, kt = {
1207
+ Corporation: "http://www.wikidata.org/entity/Q6881511",
1208
+ EducationalOrganization: "http://www.wikidata.org/entity/Q178706",
1209
+ GovernmentOrganization: "http://www.wikidata.org/entity/Q327333",
1210
+ MedicalOrganization: "http://www.wikidata.org/entity/Q4287745",
1211
+ MusicGroup: "http://www.wikidata.org/entity/Q32178211",
1212
+ NGO: "http://www.wikidata.org/entity/Q163740",
1213
+ Occupation: "http://www.wikidata.org/entity/Q28640",
1214
+ Project: "http://www.wikidata.org/entity/Q170584",
1215
+ ResearchOrganization: "http://www.wikidata.org/entity/Q31855",
1216
+ SportsOrganization: "http://www.wikidata.org/entity/Q4438121"
1217
+ }, At = "prefix vcard: <http://www.w3.org/2006/vcard/ns#>\nCONSTRUCT\n{ wd:Q49108 vcard:fn ?itemLabel.\nwd:Q49108 rdf:type ?klass. ?klass rdfs:label ?klassLabel; rdfs:comment ?klassDescription .\nwd:Q49108 schema:logo ?logo;\n schema:image ?image;\n schema:logo ?sealImage;\n schema:subOrganization ?subsidiary .\n ?subsidiary rdfs:label ?subsidiaryLabel .\n ?supersidiary schema:subOrganization wd:Q49108 .\n ?supersidiary rdfs:label ?supersidiaryLabel .\n wd:Q49108 schema:location ?location .\n ?location schema:elevation ?elevation .\n ?location wdt:P131 ?region . ?region rdfs:label ?regionLabel .\n ?location wdt:P625 ?coordinates .\n ?location schema:country ?country . ?country rdfs:label ?countryLabel .\n}\nWHERE\n{ optional {wd:Q49108 rdfs:label ?itemLabel} .\n optional {wd:Q49108 wdt:P154 ?logo .}\n optional {wd:Q49108 wdt:P31 ?klass .}\n optional {wd:Q49108 wdt:P158 ?sealImage .}\n optional {wd:Q49108 wdt:P18 ?image .}\n\n optional { wd:Q49108 wdt:P355 ?subsidiary . }\n optional { ?supersidiary wdt:P355 wd:Q49108. }\n\n optional { wd:Q49108 wdt:P276 ?location .\n\n optional { ?location schema:eleveation ?elevation }\n optional { ?location wdt:P131 ?region }\n optional { ?location wdt:P625 ?coordinates }\n optional { ?location wdt:P17 ?country }\n }\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"fr,en,de,it\". }\n}", jt = {
1218
+ credentials: "omit",
1219
+ headers: new Headers({ Accept: "application/json" })
1220
+ }, Mt = {
1221
+ label: "ESCO",
1222
+ logo: E.sym("https://ec.europa.eu/esco/portal/static_resource2/images/logo/logo_en.gif"),
1223
+ searchByNameURI: "https://ec.europa.eu/esco/api/search?language=$(language)&type=occupation&text=$(name)"
1224
+ }, Nt = {
1225
+ label: "DBPedia",
1226
+ logo: E.sym("https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/DBpediaLogo.svg/263px-DBpediaLogo.svg.png"),
1227
+ searchByNameQuery: "select distinct ?subject, ?name where {\n ?subject a $(targetClass); rdfs:label ?name\n FILTER regex(?name, \"$(name)\", \"i\")\n } LIMIT $(limit)",
1228
+ endpoint: "https://dbpedia.org/sparql/"
1229
+ }, Pt = { AcademicInsitution: "http://umbel.org/umbel/rc/EducationalOrganization" }, Ft = {
1230
+ AcademicInsitution: "http://www.wikidata.org/entity/Q4671277",
1231
+ Enterprise: "http://www.wikidata.org/entity/Q6881511",
1232
+ Business: "http://www.wikidata.org/entity/Q4830453",
1233
+ NGO: "http://www.wikidata.org/entity/Q79913",
1234
+ CharitableOrganization: "http://www.wikidata.org/entity/Q708676",
1235
+ Insitute: "http://www.wikidata.org/entity/Q1664720"
1236
+ }, It = {
1237
+ label: "WikiData",
1238
+ limit: 3e3,
1239
+ logo: E.sym("https://www.wikimedia.org/static/images/project-logos/wikidatawiki.png"),
1240
+ endpoint: "https://query.wikidata.org/sparql",
1241
+ searchByNameQuery: "SELECT ?subject ?name\n WHERE {\n ?klass wdt:P279* $(targetClass) .\n ?subject wdt:P31 ?klass .\n ?subject rdfs:label ?name.\n FILTER regex(?name, \"$(name)\", \"i\")\n } LIMIT $(limit) ",
1242
+ insitituteDetailsQuery: "CONSTRUCT\n{ wd:Q49108 schema:name ?itemLabel;\n schema:logo ?logo;\n schema:logo ?sealImage;\n schema:subOrganization ?subsidiary .\n ?subsidiary schema:name ?subsidiaryLabel .\n}\nWHERE\n{\n wd:Q49108 # rdfs:label ?itemLabel ;\n wdt:P154 ?logo;\n wdt:P158 ?sealImage ;\n wdt:P355 ?subsidiary .\n # ?subsidiary rdfs:label ?subsidiaryLabel .\n\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE], fr\". }\n}"
1243
+ }, Lt = {
1244
+ "http://www.wikidata.org/entity/Q15936437": u.schema("CollegeOrUniversity"),
1245
+ "http://www.wikidata.org/entity/Q1664720": u.schema("EducationalOrganization"),
1246
+ "http://www.wikidata.org/entity/Q43229": u.schema("Organization"),
1247
+ "http://www.wikidata.org/entity/Q3918": u.schema("CollegeOrUniversity"),
1248
+ "http://www.wikidata.org/entity/Q170584": u.schema("Project"),
1249
+ "http://www.wikidata.org/entity/Q327333": u.schema("GovernmentOrganization"),
1250
+ "http://www.wikidata.org/entity/Q2221906": u.schema("Place"),
1251
+ "http://www.wikidata.org/entity/Q167037": u.schema("Corporation")
1252
+ }, Rt = {
1253
+ targetClass: u.rdf("type"),
1254
+ sealImage: u.schema("logo"),
1255
+ shortName: u.foaf("nick"),
1256
+ subsidiary: u.schema("subOrganization"),
1257
+ city: u.vcard("locality"),
1258
+ state: u.vcard("region"),
1259
+ country: u.vcard("country-name"),
1260
+ homepage: u.foaf("homepage"),
1261
+ lat: u.schema("latitude"),
1262
+ long: u.schema("longitude")
1263
+ };
1264
+ function zt(e) {
1265
+ let t = e.type.toLowerCase();
1266
+ if (t === "uri" || t === "iri") return E.sym(e.value);
1267
+ if (t === "literal") return e["xml:lang"] ? new i(e.value, e["xml:lang"]) : new i(e.value);
1268
+ throw Error(`bindingToTerm: Unexpected type "${e.type}" in sparql binding}`);
1269
+ }
1270
+ function Bt(e, t, n, r, a = Rt) {
1271
+ let o = {};
1272
+ D(`loadFromBindings: subject: ${t}`), D(` doc: ${r}`), n.forEach((e) => {
1273
+ for (let t in e) {
1274
+ let n = e[t], r = JSON.stringify(n);
1275
+ o[t] = o[t] || /* @__PURE__ */ new Set(), o[t].add(r);
1276
+ }
1277
+ });
1278
+ for (let n in o) {
1279
+ let s = o[n];
1280
+ D(` results ${n} -> ${s}`), s.forEach((o) => {
1281
+ let s = JSON.parse(o), { type: c, value: l } = s, d;
1282
+ if (c === "uri") d = e.sym(l);
1283
+ else if (c === "literal") d = new i(l, s.language, s.datatype);
1284
+ else throw Error(`loadFromBindings: unexpected type: ${c}`);
1285
+ if (n === "type") Lt[l] ? d = Lt[l] : O("Unmapped Wikidata Class: " + l);
1286
+ else if (n === "coordinates") {
1287
+ D(" @@@ hey a point: " + l);
1288
+ let n = /.*\(([-0-9.-]*) ([-0-9.-]*)\)/.exec(l);
1289
+ if (n) {
1290
+ let a = u.xsd("float"), o = new i(n[1], null, a), s = new i(n[2], null, a);
1291
+ e.add(t, u.schema("longitude"), s, r), e.add(t, u.schema("latitude"), o, r);
1292
+ } else D("Bad coordinates syntax: " + l);
1293
+ } else {
1294
+ let i = a[n] || u.schema(n);
1295
+ e.add(t, i, d, r), D(` public data ${i} ${d}.`);
1296
+ }
1297
+ });
1298
+ }
1299
+ }
1300
+ function Vt(e) {
1301
+ return e._embedded.results.map((e) => {
1302
+ let t = e.title, n = e.uri;
1303
+ return {
1304
+ name: {
1305
+ value: t,
1306
+ type: "literal"
1307
+ },
1308
+ subject: {
1309
+ type: "IRI",
1310
+ value: n
1311
+ }
1312
+ };
1313
+ });
1314
+ }
1315
+ async function Ht(e, t, n) {
1316
+ if (!n.searchByNameURI) throw Error("Missing queryTarget.searchByNameURI on queryESCODataByName");
1317
+ let r = n.limit || 200, i = n.searchByNameURI.replace("$(name)", e).replace("$(limit)", "" + r).replace("$(targetClass)", t.toNT());
1318
+ D("Querying ESCO data - uri: " + i);
1319
+ let a = (await E.fetcher?.webOperation("GET", i, jt))?.responseText || "";
1320
+ if (D(" Query result text" + a.slice(0, 500) + "..."), a.length === 0) throw Error("Wot no text back from ESCO query " + i);
1321
+ let o = JSON.parse(a);
1322
+ return D(" ESCO Query result JSON" + JSON.stringify(o, null, 4).slice(0, 500) + "..."), Vt(o);
1323
+ }
1324
+ function Ut(e) {
1325
+ let t = e.indexOf("SPARQL-QUERY");
1326
+ if (t < 0) return e;
1327
+ O(" ### Fixing JSON with wikidata error code injection " + e.slice(t, t + 200));
1328
+ let n = e.lastIndexOf("}, {");
1329
+ return e.slice(0, n) + " } ] } } ";
1330
+ }
1331
+ async function Wt(e, t, n, r) {
1332
+ function i(n) {
1333
+ let i = r.limit || 200;
1334
+ return n.replace("$(name)", e).replace("$(limit)", "" + i).replace("$(language)", a).replace("$(targetClass)", t.toNT());
1335
+ }
1336
+ if (!t) throw Error("queryPublicDataByName: No class provided");
1337
+ let a = (await Tt() || X)[0] || "en";
1338
+ if (r.searchByNameQuery) {
1339
+ let e = i(r.searchByNameQuery);
1340
+ return D("Querying public data - sparql: " + e), Gt(e, r);
1341
+ }
1342
+ if (r.searchByNameURI) {
1343
+ let e = i(r.searchByNameURI), t;
1344
+ try {
1345
+ t = await E.fetcher?.webOperation("GET", e, jt);
1346
+ } catch (t) {
1347
+ throw Error(`Exception when trying to fetch ${e} \n ${t}`);
1348
+ }
1349
+ let n = t.responseText || "";
1350
+ if (t.status !== 200) throw Error(`HTTP error status ${t.status} trying to fetch ${e} `);
1351
+ if (D(" Query result text" + n.slice(0, 500) + "..."), n.length === 0) throw Error("queryPublicDataByName: No text back from public data query " + e);
1352
+ let a = Ut(n), o = JSON.parse(a);
1353
+ if (D(" API Query result JSON" + JSON.stringify(o, null, 4).slice(0, 500) + "..."), o._embedded) return D(" Looks like ESCO"), Vt(o);
1354
+ throw alert("Code me: unrecognized API return format"), Error(`*** Need to add code to parse unrecognized API JSON return\n${JSON.stringify(o, null, 4)}`);
1355
+ }
1356
+ throw Error("Query source must have either rest API or SPARQL endpoint.");
1357
+ }
1358
+ async function Gt(e, t) {
1359
+ if (!t.endpoint) throw Error("Missing queryTarget.endpoint required for queryPublicDataSelect");
1360
+ let n = new URL(t.endpoint);
1361
+ n.searchParams.append("query", e);
1362
+ let r = n.href;
1363
+ D(" queryPublicDataSelect uri: " + r);
1364
+ let i = new Headers();
1365
+ i.append("Accept", "application/json");
1366
+ let a = {
1367
+ credentials: "omit",
1368
+ headers: i
1369
+ }, o = (await E.fetcher?.webOperation("GET", r, a))?.responseText || "";
1370
+ if (o.length === 0) throw Error("No text back from query " + r);
1371
+ let s = Ut(o), c = JSON.parse(s);
1372
+ return D(" Query result JSON" + JSON.stringify(c, null, 4).slice(0, 100) + "..."), c.results.bindings;
1373
+ }
1374
+ async function Kt(e, t, n) {
1375
+ if (D("queryPublicDataConstruct: sparql:", e), !n.endpoint) throw Error("Missing queryTarget.endpoint required for queryPublicDataConstruct");
1376
+ let r = new URL(n.endpoint);
1377
+ r.searchParams.append("query", e);
1378
+ let i = r.href;
1379
+ D(" queryPublicDataConstruct uri: " + i);
1380
+ let a = new Headers();
1381
+ a.append("Accept", "text/turtle");
1382
+ let o = {
1383
+ credentials: "omit",
1384
+ headers: a
1385
+ }, c = (await E.fetcher?.webOperation("GET", i, o))?.responseText || "No response text?";
1386
+ if (D(" queryPublicDataConstruct result text:" + (c.length > 500 ? c.slice(0, 200) + " ... " + c.slice(-200) : c)), c.length === 0) throw Error("queryPublicDataConstruct: No text back from construct query:" + i);
1387
+ s(c, E, t.uri, "text/turtle");
1388
+ }
1389
+ async function qt(e, t, n) {
1390
+ if (n.uri.startsWith("https://dbpedia.org/resource/")) return Zt(e, t, n);
1391
+ if (n.uri.match(/^https?:\/\/www\.wikidata\.org\/entity\/.*/)) await Jt(e, t, n);
1392
+ else {
1393
+ let t = n.uri.startsWith("http:") ? e.sym("https:" + n.uri.slice(5)) : n, r = new Headers();
1394
+ return r.append("Accept", "text/turtle"), e.fetcher.load(t, {
1395
+ credentials: "omit",
1396
+ headers: r
1397
+ });
1398
+ }
1399
+ }
1400
+ async function Jt(e, t, n) {
1401
+ await Kt(At.replace(/wd:Q49108/g, n.toNT()), n, It), D("getWikidataDetails: loaded.", n);
1402
+ }
1403
+ async function Yt(e, t, n) {
1404
+ Bt(e, n, await Gt("select distinct * where {\n optional { $(subject) wdt:P31 ?targetClass } # instance of\n optional { $(subject) wdt:P154 ?logo }\n optional { $(subject) wdt:P158 ?sealImage }\n# optional { $(subject) wdt:P159 ?headquartersLocation }\n\noptional { $(subject) wdt:P17 ?country }\noptional { $(subject) wdt:P18 ?image }\noptional { $(subject) wdt:P1813 ?shortName }\n\noptional { $(subject) wdt:P355 ?subsidiary }\n# SERVICE wikibase:label { bd:serviceParam wikibase:language \"fr,en,de,it\" }\n}".replace(Ot, n.toNT()), It), n.doc());
1405
+ }
1406
+ async function Xt(e, t, n) {
1407
+ let r = "select distinct * where {\n\n $(subject) wdt:P276 ?location .\n\n optional { ?location wdt:P2044 ?elevation }\n optional { ?location wdt:P131 ?region }\n optional { ?location wdt:P625 ?coordinates }\noptional { ?location wdt:P17 ?country }\n\n# SERVICE wikibase:label { bd:serviceParam wikibase:language \"fr,en,de,it\" }\n}".replace(Ot, n.toNT());
1408
+ D(" location query sparql:" + r);
1409
+ let i = await Gt(r, It);
1410
+ D(" location query bindings:", i), Bt(e, n, i, n.doc());
1411
+ }
1412
+ async function Zt(e, t, n) {
1413
+ Bt(e, n, await Gt(`select distinct ?city, ?state, ?country, ?homepage, ?logo, ?lat, ?long, WHERE {
1414
+ OPTIONAL { <${n}> <http://dbpedia.org/ontology/city> ?city }
1415
+ OPTIONAL { ${n} <http://dbpedia.org/ontology/state> ?state }
1416
+ OPTIONAL { ${n} <http://dbpedia.org/ontology/country> ?country }
1417
+ OPTIONAL { ${n} foaf:homepage ?homepage }
1418
+ OPTIONAL { ${n} foaf:lat ?lat; foaf:long ?long }
1419
+ OPTIONAL { ${n} <http://dbpedia.org/ontology/country> ?country }
1420
+ }`, Nt), n.doc()), D("Finished getDbpediaDetails.");
1421
+ }
1422
+ // src/widgets/forms/autocomplete/autocompletePicker.ts
1423
+ var Qt = 4, $t = 20, en = 40;
1424
+ function Z(e, t) {
1425
+ e.style.display = t ? "" : "none";
1426
+ }
1427
+ async function tn(e, t, n, r) {
1428
+ function i(t) {
1429
+ let n = A.appendChild(e.createElement("tr"));
1430
+ D(t);
1431
+ let r = Error(t);
1432
+ n.appendChild(R(e, r, "pink")), C.setStyle(n, "autocompleteRowStyle"), n.style.padding = "1em";
1433
+ }
1434
+ function a(e, n) {
1435
+ D("Auto complete: finish! " + e), e.termType === "Literal" && t.queryParams.objectURIBase && (e = E.sym(t.queryParams.objectURIBase.value + e.value)), u(), r(e, n);
1436
+ }
1437
+ async function o(e, t) {
1438
+ n.acceptButton ? (n.acceptButton.disbaled = !1, Z(n.acceptButton, !0), M.value = t.value, O = t, k = e, D("Auto complete: name: " + t), D("Auto complete: waiting for accept " + e), u()) : (Z(n.cancelButton, !0), a(e, t));
1439
+ }
1440
+ async function s(e) {
1441
+ O && M.value === O.value && a(k, O);
1442
+ }
1443
+ async function c(e) {
1444
+ D("Auto complete: Canceled by user! "), t.permanent ? h() : T.parentNode && T.parentNode.removeChild(T);
1445
+ }
1446
+ function l(e, t) {
1447
+ let n = e.split(" ");
1448
+ for (let e = 0; e < n.length; e++) {
1449
+ let r = n[e];
1450
+ if (t.toLowerCase().indexOf(r) < 0) return !1;
1451
+ }
1452
+ return !0;
1453
+ }
1454
+ function u() {
1455
+ for (; A.children.length > 1;) A.removeChild(A.lastChild);
1456
+ }
1457
+ async function d(e) {
1458
+ Z(n.cancelButton, !0), m();
1459
+ }
1460
+ async function f(e, n) {
1461
+ let r;
1462
+ try {
1463
+ r = await Wt(e, g, n || X, t.queryParams);
1464
+ } catch (e) {
1465
+ i("Error querying db of organizations: " + e), b = !1;
1466
+ return;
1467
+ }
1468
+ return v = r.length < 200, S = v ? e : void 0, u(), Et(r, n) || [];
1469
+ }
1470
+ function p(e, t) {
1471
+ return (t || []).filter((t) => l(e, t.name.value));
1472
+ }
1473
+ async function m() {
1474
+ function t(t) {
1475
+ let n = e.createElement("tr");
1476
+ C.setStyle(n, "autocompleteRowStyle"), n.setAttribute("style", "padding: 0.3em;"), n.style.color = x ? "#080" : "#088", n.textContent = t.name.value;
1477
+ let r = zt(t.subject), i = zt(t.name);
1478
+ return n.addEventListener("click", async (e) => {
1479
+ D(" click row textContent: " + n.textContent), D(" click name: " + i.value), r && i && o(r, i);
1480
+ }), n;
1481
+ }
1482
+ function n(e, t) {
1483
+ return t.name.value > e.name.value ? 1 : t.name.name < e.name.value ? -1 : 0;
1484
+ }
1485
+ if (b) {
1486
+ D(`Ignoring "${M.value}" because of lock `);
1487
+ return;
1488
+ }
1489
+ D(`Setting lock at "${M.value}"`), b = !0;
1490
+ let r = await Tt(), i = M.value.trim().toLowerCase();
1491
+ if (i.length < Qt) u(), w = $t;
1492
+ else {
1493
+ x && S && i.startsWith(S) || (D(` Querying database at "${i}" cf last "${S}".`), _ = await f(i, r) || []);
1494
+ let e = p(i, _);
1495
+ v && e.length <= en && (w = e.length), x = v && e.length <= w, D(` Filter:"${i}" lastBindings: ${_.length}, slimmed to ${e.length}; rows: ${w}, Enough? ${v}, All displayed? ${x}`);
1496
+ let a = e.slice(0, w);
1497
+ a.sort(n), u();
1498
+ for (let e of a) A.appendChild(t(e));
1499
+ e.length === 1 && o(zt(e[0].subject), zt(e[0].name));
1500
+ }
1501
+ b = !1;
1502
+ }
1503
+ function h() {
1504
+ t.currentObject ? (M.value = t.currentName ? t.currentName.value : "??? wot no name for " + t.currentObject, O = t.currentName, S = t.currentName ? t.currentName.value : void 0, k = t.currentObject) : (M.value = "", S = void 0, k = void 0), n.deleteButton && Z(n.deleteButton, !!t.currentObject), n.acceptButton && Z(n.acceptButton, !1), n.editButton && Z(n.editButton, !0), n.cancelButton && Z(n.cancelButton, !1), b = !1, u();
1505
+ }
1506
+ let g = t.targetClass;
1507
+ if (!g) throw Error("renderAutoComplete: missing targetClass");
1508
+ n.acceptButton && n.acceptButton.addEventListener("click", s, !1), n.cancelButton && n.cancelButton.addEventListener("click", c, !1);
1509
+ let _, v = !1, b = !1, x = !1, S, w = $t, T = e.createElement("div"), O, k, A = T.appendChild(e.createElement("table"));
1510
+ A.setAttribute("data-testid", "autocomplete-table"), A.setAttribute("style", "max-width: 30em; margin: 0.5em;");
1511
+ let j = A.appendChild(e.createElement("tr"));
1512
+ C.setStyle(j, "autocompleteRowStyle");
1513
+ let M = j.appendChild(e.createElement("td")).appendChild(e.createElement("input"));
1514
+ M.setAttribute("type", "text"), h();
1515
+ let N = t.size || y.textInputSize || 20;
1516
+ M.setAttribute("size", N), M.setAttribute("data-testid", "autocomplete-input");
1517
+ let P = C.textInputStyle || "border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em";
1518
+ return M.setAttribute("style", P), M.addEventListener("keyup", function(e) {
1519
+ e.keyCode === 13 && s(e);
1520
+ }, !1), M.addEventListener("input", d), T;
1521
+ }
1522
+ // src/widgets/forms/autocomplete/autocompleteBar.ts
1523
+ var nn = "Solid ID", rn = z.iconBase + "noun_34653_green.svg", an = z.iconBase + "noun_Search_875351.svg", on = z.iconBase + "noun_253504.svg";
1524
+ async function sn(e, t, n, r, i, a) {
1525
+ async function o(e, t) {
1526
+ return r.permanent ? (Z(_, !0), Z(p, !1), Z(m, !1)) : c(), i(e, t);
1527
+ }
1528
+ async function s(n) {
1529
+ let r = await Ve(e, E, S, u.vcard("url"), void 0, nn);
1530
+ if (r) return i(t, r);
1531
+ }
1532
+ function c() {
1533
+ x &&= (S.removeChild(x), void 0);
1534
+ }
1535
+ async function l() {
1536
+ x = e.createElement("div"), x.setAttribute("style", "display: flex; flex-flow: wrap;"), x.appendChild(await tn(e, r, b, o)), x.appendChild(p), x.appendChild(m), x.appendChild(_), x.appendChild(h), S.appendChild(x);
1537
+ }
1538
+ async function d(e) {
1539
+ x ? (S.removeChild(x), x = void 0) : await l();
1540
+ }
1541
+ async function f(e) {
1542
+ for (let n of e) await i(t, n);
1543
+ }
1544
+ let p = Be(e);
1545
+ p.setAttribute("data-testid", "accept-button");
1546
+ let m = G(e);
1547
+ m.setAttribute("data-testid", "cancel-button");
1548
+ let h = e.createElement("div"), g = U(e, h, r.targetClass ? w(r.targetClass) : "item", a);
1549
+ g.setAttribute("data-testid", "delete-button");
1550
+ let _ = W(e, on, "Edit", (e) => {
1551
+ v = !v, y();
1552
+ });
1553
+ _.setAttribute("data-testid", "edit-button");
1554
+ let v = !0;
1555
+ function y() {
1556
+ v ? (Z(_, !1), Z(p, !1), Z(m, !1)) : (Z(_, !0), Z(p, !1), Z(m, !1));
1557
+ }
1558
+ let b = {
1559
+ acceptButton: p,
1560
+ cancelButton: m,
1561
+ editButton: _,
1562
+ deleteButton: g
1563
+ }, x, S = e.createElement("div");
1564
+ return S.style.display = "flex", S.style.flexDirection = "row", (r.permanent || r.currentObject) && await l(), n.editable && (S.style.width = "100%", n.manualURIEntry && L(S.appendChild(W(e, rn, n.idNoun, s)), f, void 0), n.dbLookup && !r.currentObject && !r.permanent && S.appendChild(W(e, an, n.idNoun, d))), y(), S;
1565
+ }
1566
+ // src/widgets/forms/autocomplete/autocompleteField.ts
1567
+ function cn(e, t, n, r, i, a, o) {
1568
+ async function s(t, n) {
1569
+ if (!n) throw Error("autocompleteField: No name set.");
1570
+ let i = d.the(r, g, null, a);
1571
+ if (i) {
1572
+ let e = d.any(i, _, null, a);
1573
+ if (i.equals(t) && e && e.sameTerm(n)) return;
1574
+ }
1575
+ let s = i ? d.statementsMatching(r, g, i, a).concat(d.statementsMatching(i, _, null, a)) : [], l = [c(r, g, t, a), c(t, _, n, a)];
1576
+ try {
1577
+ await d.updater?.updateMany(s, l);
1578
+ } catch (t) {
1579
+ o(!1, t), p.appendChild(R(e, "Autocomplete form data update error:" + t, null, t));
1580
+ return;
1581
+ }
1582
+ o(!0, "");
1583
+ }
1584
+ async function l(t, n) {
1585
+ let i = d.the(r, g, null, a);
1586
+ if (!i) {
1587
+ o(!1, "NO data to elete"), p.appendChild(R(e, "Autocomplete delete: no old data!"));
1588
+ return;
1589
+ }
1590
+ let s = d.statementsMatching(r, g, i, a).concat(d.statementsMatching(i, _, null, a)), c = [];
1591
+ try {
1592
+ await d.updater?.updateMany(s, c);
1593
+ } catch (t) {
1594
+ let n = /* @__PURE__ */ Error("Autocomplete form data delete error:" + t);
1595
+ o(!1, t), p.appendChild(R(e, n, null, t));
1596
+ return;
1597
+ }
1598
+ o(!0, "");
1599
+ }
1600
+ if (r.termType !== "NamedNode") throw Error("Sorry this field only works on NamedNode subjects (for editable)");
1601
+ let d = E, f = i.doc ? i.doc() : null, p = e.createElement("div");
1602
+ t && t.appendChild(p);
1603
+ let m = e.createElement("div");
1604
+ m.setAttribute("class", "formFieldName"), m.setAttribute("style", C.formFieldNameBoxStyle), p.appendChild(m);
1605
+ let h = e.createElement("div");
1606
+ h.setAttribute("class", "formFieldValue"), p.appendChild(h);
1607
+ let g = d.any(i, u.ui("property"));
1608
+ if (!g) return p.appendChild(R(e, "Error: No property given for autocomplete field: " + i));
1609
+ let _ = d.any(i, u.ui("labelProperty")) || u.schema("name"), v = d.any(i, u.ui("dataSource"));
1610
+ if (!v) return p.appendChild(R(e, "Error: No data source given for autocomplete field: " + i));
1611
+ let y = {
1612
+ label: d.anyJS(v, u.schema("name"), null, v.doc()),
1613
+ logo: d.any(v, u.schema("logo"), null, v.doc())
1614
+ }, b = d.any(i, u.ui("targetClass"), null, i.doc()) || d.any(v, u.ui("targetClass"), null, v.doc());
1615
+ b && (y.targetClass = b), y.objectURIBase = d.any(v, u.ui("objectURIBase"), null, v.doc()) || void 0;
1616
+ let x = d.anyJS(v, u.ui("endpoint"), null, v.doc());
1617
+ if (x) {
1618
+ if (y.endpoint = x, y.searchByNameQuery = d.anyJS(v, u.ui("searchByNameQuery"), null, v.doc()), !y.searchByNameQuery) return p.appendChild(R(e, "Error: No searchByNameQuery given for endpoint data Source: " + i));
1619
+ y.insitituteDetailsQuery = d.anyJS(v, u.ui("insitituteDetailsQuery"), null, v.doc());
1620
+ } else {
1621
+ let t = d.anyJS(v, u.ui("searchByNameURI"));
1622
+ if (!t) return p.appendChild(R(e, "Error: No searchByNameURI OR sparql endpoint given for dataSource: " + v));
1623
+ y.searchByNameURI = t;
1624
+ }
1625
+ let S = d.anyJS(i, u.ui("suppressEmptyUneditable"), null, f), w = d.updater?.editable(a.uri), T = {
1626
+ permanent: !0,
1627
+ targetClass: y.targetClass,
1628
+ queryParams: y
1629
+ };
1630
+ T.size = d.anyJS(i, u.ui("size"), null, f) || void 0;
1631
+ let D = d.any(r, g, void 0, a);
1632
+ if (D) T.currentObject = D, T.currentName = d.any(T.currentObject, _, null, a);
1633
+ else if (D = d.any(i, u.ui("default")), D) T.currentObject = D, T.currentName = d.any(T.currentObject, _, null, a);
1634
+ else if (S && !w) return p.style.display = "none", p;
1635
+ return m.appendChild(yt(e, g, i)), sn(e, r, {
1636
+ editable: w,
1637
+ dbLookup: !0
1638
+ }, T, s, l).then((e) => {
1639
+ h.appendChild(e);
1640
+ }, (t) => {
1641
+ h.appendChild(R(e, `Error rendering autocomplete ${i}: ${t}`, "#fee", t));
1642
+ }), p;
1643
+ }
1644
+ // src/lib/style_multiSelect.js
1645
+ var Q = {
1646
+ multiselect__container: "\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n min-height: 36px;\n padding: 4px 8px 0 8px;\n position: relative;\n width: 354px;\n margin-bottom: 5px;\n font-size: 100%\n ",
1647
+ multiselect__wrapper: "\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n ",
1648
+ multiselect__clear_btn: "\n cursor: pointer;\n align-items: center;\n margin-bottom: 4px;\n margin-left: 4px;\n ",
1649
+ multiselect__options: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n ",
1650
+ multiselect__options_visible: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n max-height: 200px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n opacity: 1;\n transition: max-height 0.2s ease;\n ",
1651
+ multiselect__options_ul: "\n list-style: none;\n margin: 0;\n padding: 2px 0;\n max-height: 200px;\n overflow: auto;\n ",
1652
+ multiselect__options_ul_li: "\n cursor: pointer;\n padding: 4px 8px;\n ",
1653
+ multiselect__options_ul_li_hover: "\n background-color: #dedede;\n ",
1654
+ multiselect__options_ul_p_multiselect__options_no_results: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
1655
+ multiselect__options_ul_p_multiselect__options_no_data: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
1656
+ multiselect__options_ul_li_multiselect__options_selected: "\n background-color: #656565;\n color: #fff;\n ",
1657
+ multiselect__options_ul_li_multiselect__options_selected_hover: "\n background-color: #656565;\n ",
1658
+ multiselect__options_ul_li_arrow_selected: "\n border: 2px solid rgba(101, 101, 101, 0.5);\n ",
1659
+ multiselect__selected: "\n background-color: #656565;\n border-radius: 2px;\n color: #fff;\n margin-bottom: 4px;\n margin-right: 4px;\n padding: 4px 8px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n ",
1660
+ multiselect__selected_multiselect__remove_btn: "\n cursor: pointer;\n display: flex;\n margin-left: 6px;\n ",
1661
+ multiselect__input: "\n border: none;\n -ms-flex-preferred-size: 40%;\n flex-basis: 40%;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 5px; \n margin-bottom: 4px;\n min-width: 40%;\n outline: none; \n "
1662
+ };
1663
+ Q.setStyle = function(e, t) {
1664
+ e.style = Q[t];
1665
+ };
1666
+ // src/widgets/multiSelect.js
1667
+ var ln = class {
1668
+ _data;
1669
+ _domElements;
1670
+ _event = () => {};
1671
+ _itemTemplate;
1672
+ _multiselect;
1673
+ _noData;
1674
+ _noResults;
1675
+ _options = [];
1676
+ _placeholder;
1677
+ _select;
1678
+ _selectContainer;
1679
+ _selectedOptions = [];
1680
+ _tagTemplate;
1681
+ _textField;
1682
+ _valueField;
1683
+ _cross = "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ";
1684
+ constructor({ data: e, itemTemplate: t, noData: n, noResults: r, placeholder: i, select: a, container: o, tagTemplate: s, textField: c, valueField: l }) {
1685
+ this._data = e ?? [], this._itemTemplate = t ?? null, this._noData = n ?? "No data found.", this._noResults = r ?? "No results found.", this._placeholder = i ?? "Select...", this._select = a, this._selectContainer = o, this._tagTemplate = s ?? null, this._textField = c ?? null, this._valueField = l ?? null;
1686
+ }
1687
+ init() {
1688
+ if (this._select && this._select.nodeName === "SELECT") {
1689
+ if (this._itemTemplate && this._data.length === 0) throw Error("itemTemplate must be initialized with data from the component settings");
1690
+ if (this._tagTemplate && this._data.length === 0) throw Error("tagTemplate must be initialized with data from the component settings");
1691
+ this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag(), this._renderMultiselect(), this._renderOptionsList(), this._domElements = {
1692
+ clear: this._multiselect.querySelector(".multiselect__clear-btn"),
1693
+ input: this._multiselect.querySelector(".multiselect__input"),
1694
+ optionsContainer: this._multiselect.querySelector(".multiselect__options"),
1695
+ optionsContainerList: this._multiselect.querySelector(".multiselect__options > ul"),
1696
+ options: {
1697
+ list: this._multiselect.querySelectorAll(".multiselect__options > ul > li"),
1698
+ find: function(e) {
1699
+ for (let t = 0; t < this.list.length; t++) {
1700
+ let n = this.list[t];
1701
+ if (e(n)) return n;
1702
+ }
1703
+ },
1704
+ some: function(e) {
1705
+ for (let t = 0; t < this.list.length; t++) {
1706
+ let n = this.list[t];
1707
+ if (e(n, t)) return !0;
1708
+ }
1709
+ return !1;
1710
+ }
1711
+ }
1712
+ }, this._enableEventListenners(), this._initSelectedList();
1713
+ } else throw Error(`The selector '${this._select}' did not select any valid select tag.`);
1714
+ }
1715
+ subscribe(e) {
1716
+ if (typeof e == "function") this._event = e;
1717
+ else throw Error("parameter in the subscribe method is not a function");
1718
+ }
1719
+ _addOptionToList(e, t) {
1720
+ let n = `<span class="multiselect__selected" style="${Q.multiselect__selected}" data-value="${e.value}">${this._tagTemplate ? this._processTemplate(this._tagTemplate, t) : e.text}<span class="multiselect__remove-btn" style="${Q.multiselect__remove_btn}">${this._cross}</span></span>`;
1721
+ this._domElements.input.insertAdjacentHTML("beforebegin", n);
1722
+ let { lastElementChild: r } = this._multiselect.querySelector(`span[data-value="${e.value}"]`);
1723
+ r.addEventListener("click", () => {
1724
+ let t = this._domElements.options.find((t) => t.dataset.value === e.value);
1725
+ this._handleOption(t);
1726
+ });
1727
+ }
1728
+ _clearSelection() {
1729
+ for (let e = 0; e < this._selectedOptions.length; e++) {
1730
+ let t = this._selectedOptions[e], n = this._domElements.options.find((e) => e.dataset.value === t.value);
1731
+ n.classList.remove("multiselect__options--selected"), n.setAttribute("style", Q.multiselect__options), this._removeOptionFromList(n.dataset.value);
1732
+ }
1733
+ this._selectedOptions = [], this._handleClearSelectionBtn(), this._handlePlaceholder(), this._dispatchEvent({
1734
+ action: "CLEAR_ALL_OPTIONS",
1735
+ selection: this._selectedOptions
1736
+ });
1737
+ }
1738
+ _closeList() {
1739
+ this._domElements.input.value = "", this._domElements.optionsContainer.classList.remove("visible"), this._domElements.optionsContainer.setAttribute("style", Q.multiselect__options), this._filterOptions(""), this._removeAllArrowSelected();
1740
+ }
1741
+ _dispatchEvent(e) {
1742
+ this._event(e);
1743
+ }
1744
+ _enableEventListenners() {
1745
+ document.addEventListener("mouseup", ({ target: e }) => {
1746
+ this._multiselect.contains(e) || (this._filterOptions(""), this._closeList(), this._handlePlaceholder());
1747
+ }), this._domElements.clear.addEventListener("click", () => {
1748
+ this._clearSelection();
1749
+ });
1750
+ for (let e = 0; e < this._domElements.options.list.length; e++) this._domElements.options.list[e].addEventListener("click", ({ target: e }) => {
1751
+ this._handleOption(e), this._closeList();
1752
+ });
1753
+ this._domElements.input.addEventListener("focus", () => {
1754
+ this._domElements.optionsContainer.classList.add("visible"), this._domElements.optionsContainer.setAttribute("style", Q.multiselect__options_visible);
1755
+ }), this._domElements.input.addEventListener("input", ({ target: { value: e } }) => {
1756
+ this._domElements.options.list.length > 0 && this._filterOptions(e);
1757
+ }), this._domElements.input.addEventListener("keydown", (e) => {
1758
+ this._handleArrows(e), this._handleBackspace(e), this._handleEnter(e);
1759
+ });
1760
+ }
1761
+ _filterOptions(e) {
1762
+ let t = this._domElements.optionsContainer.classList.contains("visible"), n = e.toLowerCase();
1763
+ if (!t && e.length > 0 && (this._domElements.optionsContainer.classList.add("visible"), this._domElements.optionsContainer.setAttribute("style", Q.multiselect__options_visible)), this._domElements.options.list.length > 0) {
1764
+ for (let e = 0; e < this._domElements.options.list.length; e++) {
1765
+ let t = this._domElements.options.list[e];
1766
+ (this._itemTemplate ? this._data[e][this._textField] : t.textContent).toLowerCase().substring(0, n.length) === n ? this._domElements.optionsContainerList.appendChild(t) : t.parentNode && t.parentNode.removeChild(t);
1767
+ }
1768
+ let e = this._domElements.options.some((e, t) => (this._itemTemplate ? this._data[t][this._textField] : e.textContent).toLowerCase().substring(0, n.length) === n);
1769
+ this._showNoResults(!e);
1770
+ }
1771
+ }
1772
+ _generateId(e) {
1773
+ let t = "";
1774
+ for (let n = 0; n < e; n++) t += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random() * 62));
1775
+ return t;
1776
+ }
1777
+ _getDataFromSelectTag() {
1778
+ let e = [], { options: t } = this._select;
1779
+ for (let n = 0; n < t.length; n++) {
1780
+ let r = t[n];
1781
+ e.push({
1782
+ text: r.text,
1783
+ value: r.value,
1784
+ selected: r.hasAttribute("selected")
1785
+ });
1786
+ }
1787
+ return e;
1788
+ }
1789
+ _getDataFromSettings() {
1790
+ if (this._data.length > 0 && this._valueField && this._textField) {
1791
+ let e = typeof this._valueField == "string", t = typeof this._textField == "string", n = [];
1792
+ if (!e || !t) throw Error("textField and valueField must be of type string");
1793
+ for (let e = 0; e < this._data.length; e++) {
1794
+ let t = this._data[e];
1795
+ n.push({
1796
+ value: t[this._valueField],
1797
+ text: t[this._textField],
1798
+ selected: typeof t.selected == "boolean" && t.selected
1799
+ });
1800
+ }
1801
+ return n;
1802
+ }
1803
+ return null;
1804
+ }
1805
+ _handleArrows(e) {
1806
+ if (e.keyCode === 40 || e.keyCode === 38) {
1807
+ e.preventDefault();
1808
+ let t = this._domElements.optionsContainer.classList.contains("visible"), n = this._multiselect.querySelector(".multiselect__options > ul");
1809
+ if (!t) this._domElements.optionsContainer.classList.add("visible"), this._domElements.optionsContainer.setAttribute("style", Q.multiselect__options_visible), n.firstElementChild.classList.add("arrow-selected"), n.firstElementChild.setAttribute("style", Q.multiselect__options_ul_li_arrow_selected), n.firstElementChild.scrollIntoView(!1);
1810
+ else {
1811
+ let t = this._multiselect.querySelector(".multiselect__options ul li.arrow-selected"), r = {
1812
+ ArrowUp: "previous",
1813
+ Up: "previous",
1814
+ ArrowDown: "next",
1815
+ Down: "next"
1816
+ };
1817
+ if (!t) {
1818
+ n.firstElementChild.classList.add("arrow-selected"), n.firstElementChild.setAttribute("style", Q.multiselect__options_ul_li_arrow_selected), n.firstElementChild.scrollIntoView(!1);
1819
+ return;
1820
+ }
1821
+ if (t.classList.remove("arrow-selected"), t.setAttribute("style", Q.multiselect__options_ul_li), t = t[r[e.key] + "ElementSibling"], !t) {
1822
+ t = n.children[r[e.key] === "next" ? 0 : n.children.length - 1], t.classList.add("arrow-selected"), t.setAttribute("style", Q.multiselect__options_ul_li_arrow_selected), this._scrollIntoView(n, t);
1823
+ return;
1824
+ }
1825
+ t.classList.add("arrow-selected"), t.setAttribute("style", Q.multiselect__options_ul_li_arrow_selected), this._scrollIntoView(n, t);
1826
+ }
1827
+ }
1828
+ }
1829
+ _handleBackspace(e) {
1830
+ if (e.keyCode === 8 && e.target.value === "") {
1831
+ let e = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
1832
+ if (e) {
1833
+ let t = this._multiselect.querySelector(`li[data-value="${e.value}"]`);
1834
+ this._handleOption(t), this._selectedOptions.length === 0 && (this._domElements.optionsContainer.classList.remove("visible"), this._domElements.optionsContainer.setAttribute("style", Q.multiselect__options));
1835
+ }
1836
+ }
1837
+ }
1838
+ _handleClearSelectionBtn() {
1839
+ this._selectedOptions.length > 0 ? this._domElements.clear.style.display = "flex" : this._domElements.clear.style.display = "none";
1840
+ }
1841
+ _handleEnter(e) {
1842
+ if (e.keyCode === 13) {
1843
+ let e = this._multiselect.querySelector(".multiselect__options ul li.arrow-selected");
1844
+ e && (this._handleOption(e), this._closeList());
1845
+ }
1846
+ }
1847
+ _handleOption(e, t = !0) {
1848
+ for (let n = 0; n < this._selectedOptions.length; n++) if (this._selectedOptions[n].value === e.dataset.value) return e.classList.remove("multiselect__options--selected"), e.setAttribute("style", Q.multiselect__options), this._selectedOptions.splice(n, 1), this._removeOptionFromList(e.dataset.value), this._handleClearSelectionBtn(), this._handlePlaceholder(), t && this._dispatchEvent({
1849
+ action: "REMOVE_OPTION",
1850
+ value: e.dataset.value,
1851
+ selection: this._selectedOptions
1852
+ });
1853
+ for (let n = 0; n < this._options.length; n++) {
1854
+ let r = this._options[n];
1855
+ if (r.value === e.dataset.value) return e.classList.add("multiselect__options--selected"), e.setAttribute("style", Q.multiselect__options_selected), this._selectedOptions = [...this._selectedOptions, r], this._addOptionToList(r, n), this._handleClearSelectionBtn(), this._handlePlaceholder(), t && this._dispatchEvent({
1856
+ action: "ADD_OPTION",
1857
+ value: e.dataset.value,
1858
+ selection: this._selectedOptions
1859
+ });
1860
+ }
1861
+ }
1862
+ _handlePlaceholder() {
1863
+ this._domElements.input.placeholder = this._placeholder;
1864
+ }
1865
+ _initSelectedList() {
1866
+ let e = !1;
1867
+ for (let t = 0; t < this._options.length; t++) {
1868
+ let n = this._options[t];
1869
+ if (n.selected) {
1870
+ e = !0;
1871
+ let r = this._domElements.options.find((e) => e.dataset.value === n.value);
1872
+ r.classList.add("multiselect__options--selected"), r.setAttribute("style", Q.multiselect__options_selected), this._selectedOptions = [...this._selectedOptions, n], this._addOptionToList(n, t);
1873
+ }
1874
+ }
1875
+ e && this._handleClearSelectionBtn(), this._handlePlaceholder();
1876
+ }
1877
+ _processTemplate(e, t) {
1878
+ let n = e, r = e.match(/\$\{(\w+)\}/g).map((e) => e.replace(/\$\{|\}/g, ""));
1879
+ for (let e = 0; e < r.length; e++) {
1880
+ let i = r[e];
1881
+ n = n.replace(`\$\{${i}\}`, this._data[t][i] ?? "");
1882
+ }
1883
+ return n;
1884
+ }
1885
+ _removeAllArrowSelected() {
1886
+ let e = "arrow-selected", t = this._domElements.options.find((t) => t.classList.contains(e));
1887
+ t && t.classList.remove(e) && t.setAttribute("style", Q.multiselect__options_ul_li);
1888
+ }
1889
+ _removeOptionFromList(e) {
1890
+ let t = this._multiselect.querySelector(`span[data-value="${e}"]`);
1891
+ t && t.parentNode && t.parentNode.removeChild(t);
1892
+ }
1893
+ _renderOptionsList() {
1894
+ let e = `
1895
+ <div class="multiselect__options" style="${Q.multiselect__options}">
1896
+ <ul style="${Q.multiselect__options_ul}">
1897
+ ${this._options.length > 0 && !this._itemTemplate ? this._options.map((e) => `
1898
+ <li data-value="${e.value}" style="${Q.multiselect__options_ul_li}">${e.text}</li>
1899
+ `).join("") : ""}
1900
+
1901
+ ${this._options.length > 0 && this._itemTemplate ? this._options.map((e, t) => `
1902
+ <li data-value="${e.value}" style="${Q.multiselect__options_ul_li}">${this._processTemplate(this._itemTemplate, t)}</li>
1903
+ `).join("") : ""}
1904
+ ${this._showNoData(this._options.length === 0)}
1905
+ </ul>
1906
+ </div>
1907
+ `;
1908
+ this._multiselect.insertAdjacentHTML("beforeend", e);
1909
+ }
1910
+ _renderMultiselect() {
1911
+ this._select.style.display = "none";
1912
+ let e = "iconic-" + this._generateId(20);
1913
+ this._multiselect = document.createElement("div"), this._multiselect.setAttribute("id", e), this._multiselect.setAttribute("class", "multiselect__container"), this._multiselect.setAttribute("style", Q.multiselect__container);
1914
+ let t = `
1915
+ <div class="multiselect__wrapper" style="${Q.multiselect__wrapper}">
1916
+ <input class="multiselect__input" style="${Q.multiselect__input}" placeholder="${this._placeholder}" />
1917
+ </div>
1918
+ <span style="display: none;" class="multiselect__clear-btn" style="${Q.multiselect__clear_btn}">${this._cross}</span>
1919
+ `;
1920
+ this._multiselect.innerHTML = t, this._selectContainer.appendChild(this._multiselect);
1921
+ }
1922
+ _scrollIntoView(e, t) {
1923
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
1924
+ n.top < r.bottom - t.offsetHeight || (e.scrollTop = t.clientHeight + (t.offsetTop - t.offsetHeight)), n.bottom > r.top + t.offsetHeight || (e.scrollTop = t.clientHeight + (t.offsetTop - t.offsetHeight) - (e.offsetHeight - (t.offsetHeight + (t.offsetHeight - t.clientHeight))));
1925
+ }
1926
+ _showNoData(e) {
1927
+ return e ? `<p class="multiselect__options--no-data" style="${Q.multiselect__options_ul_p_multiselect__options_no_data}">${this._noData}</p>` : "";
1928
+ }
1929
+ _showNoResults(e) {
1930
+ let t = this._multiselect.querySelector(".multiselect__options--no-results");
1931
+ if (e) {
1932
+ let e = `<p class="multiselect__options--no-results" style="${Q.multiselect__options_ul_p_multiselect__options_no_results}">${this._noResults}</p>`;
1933
+ !t && this._domElements.optionsContainerList.insertAdjacentHTML("beforeend", e);
1934
+ } else t && t.parentNode && t.parentNode.removeChild(t);
1935
+ }
1936
+ }, un = "✓", dn = "✕", fn = "-", pn = E;
1937
+ K[u.ui("AutocompleteField").uri] = cn;
1938
+ function mn(e, t, n, r, i, a, o) {
1939
+ let s = a.children;
1940
+ for (let c = 0; c < o.length; c++) {
1941
+ let l = o[c];
1942
+ if (ht(l) === u.ui("Options").uri) {
1943
+ let o = q(e, l)(e, null, t, n, l, r, i);
1944
+ D("Refreshing Options field by replacing it."), a.insertBefore(o, s[c]), a.removeChild(s[c + 1]);
1945
+ }
1946
+ }
1947
+ }
1948
+ K[u.ui("Form").uri] = K[u.ui("Group").uri] = function(e, t, n, r, i, a, o) {
1949
+ let s = e.createElement("div"), c = u.ui;
1950
+ if (t && t.appendChild(s), !i) return;
1951
+ let l = r.toNT() + "|" + i.toNT();
1952
+ if (n[l]) return s.appendChild(e.createTextNode("Group: see above " + l)), s;
1953
+ let d = {};
1954
+ for (let e in n) d[e] = 1;
1955
+ d[l] = 1;
1956
+ let f = i.doc ? i.doc() : null, p = pn.any(i, c("weight"), null, f), m = p ? Number(p.value) : 1;
1957
+ if (m > 3 || m < 0) return s.appendChild(R(e, `Form Group weight ${m} should be 0-3`));
1958
+ s.setAttribute("style", C.formGroupStyle[m]), s.style.display = "flex", s.style.flexDirection = "column", s.class = "form-weight-" + m;
1959
+ let h = pn.any(i, c("parts"), null, f), g;
1960
+ if (h ? g = h.elements : (h = pn.each(i, c("part"), null, f), g = Sn(h)), !h) return s.appendChild(R(e, "No parts to form! "));
1961
+ for (let t = 0; t < g.length; t++) {
1962
+ let i = g[t], c = q(e, i);
1963
+ s.appendChild(c(e, null, d, r, i, a, function(t, i) {
1964
+ t && i && i.widget && i.widget === "select" && mn(e, n, r, a, o, s, g), o(t, {
1965
+ widget: "group",
1966
+ change: i
1967
+ });
1968
+ }));
1969
+ }
1970
+ return s;
1971
+ }, K[u.ui("Options").uri] = function(t, n, r, i, a, o, s) {
1972
+ let c = E, l = t.createElement("div"), d = a.doc ? a.doc() : null, f = u.ui;
1973
+ n && n.appendChild(l);
1974
+ let p = c.any(a, f("dependingOn"));
1975
+ p ||= u.rdf("type");
1976
+ let m = c.each(a, f("case"), null, d);
1977
+ m || l.appendChild(R(t, "No cases to Options form. "));
1978
+ let h;
1979
+ h = p.sameTerm(u.rdf("type")) ? Object.keys(c.findTypeURIs(i)).map((t) => e(t)) : c.each(i, p);
1980
+ for (let e = 0; e < m.length; e++) {
1981
+ let n = m[e], u = c.each(n, f("for"), null, d), p = !1;
1982
+ for (let e = 0; e < u.length; e++) for (let t of h) {
1983
+ let n = u[e];
1984
+ (t.sameTerm(u) || t.termType === n.termType && t.value === n.value) && (p = !0);
1985
+ }
1986
+ if (p) {
1987
+ let e = c.the(n, f("use"));
1988
+ if (e) vn(t, l, r, i, e, o, s);
1989
+ else return l.appendChild(R(t, "No \"use\" part for case in form " + a)), l;
1990
+ break;
1991
+ }
1992
+ }
1993
+ return l;
1994
+ }, K[u.ui("Multiple").uri] = function(e, t, r, i, a, o, s) {
1995
+ function d(e) {
1996
+ return e.map((e) => e.toString().slice(-7)).join(", ");
1997
+ }
1998
+ async function f() {
1999
+ let t = $(o);
2000
+ if (C) ee(), P.elements.push(t), await te();
2001
+ else {
2002
+ let n = O ? [c(t, T, i, o)] : [c(i, T, t, o)];
2003
+ try {
2004
+ await h.updater.update([], n);
2005
+ } catch (t) {
2006
+ let n = "Error adding to unordered multiple: " + t;
2007
+ y.appendChild(R(e, n)), k(n);
2008
+ }
2009
+ I();
2010
+ }
2011
+ }
2012
+ function p(t) {
2013
+ async function n() {
2014
+ if (C) {
2015
+ D("pre delete: " + d(P.elements));
2016
+ for (let e = 0; e < P.elements.length; e++) if (P.elements[e].sameTerm(t)) {
2017
+ P.elements.splice(e, 1), await te();
2018
+ return;
2019
+ }
2020
+ } else if (h.holds(i, T, t, o)) {
2021
+ let n = [c(i, T, t, o)];
2022
+ h.updater.update(n, [], function(t, n, r) {
2023
+ n ? N.removeChild(u) : N.appendChild(R(e, "Multiple: delete failed: " + r));
2024
+ });
2025
+ }
2026
+ }
2027
+ async function a(e, n) {
2028
+ D("pre move: " + d(P.elements));
2029
+ let r = 0;
2030
+ for (; r < P.elements.length && !P.elements[r].sameTerm(t); r++);
2031
+ if (r === P.elements.length && alert("list move: not found element for " + t), n) {
2032
+ if (r === 0) {
2033
+ alert("@@ boop - already at top -temp message");
2034
+ return;
2035
+ }
2036
+ P.elements.splice(r - 1, 2, P.elements[r], P.elements[r - 1]);
2037
+ } else {
2038
+ if (r === P.elements.length - 1) {
2039
+ alert("@@ boop - already at bottom -temp message");
2040
+ return;
2041
+ }
2042
+ P.elements.splice(r, 2, P.elements[r + 1], P.elements[r]);
2043
+ }
2044
+ await te();
2045
+ }
2046
+ function l(e, n) {
2047
+ D(`Item done callback for item ${t.toString()}`), e || k(" Item done callback: Error: " + n), s(e, n);
2048
+ }
2049
+ _("Multiple: render object: " + t);
2050
+ let u = q(e, M)(e, null, r, t, M, o, l);
2051
+ if (u.subject = t, h.updater.editable(o.uri) && (U(e, u, A, n), C)) {
2052
+ let t = e.createElement("div");
2053
+ t.style.display = "grid", t.style.gridTemplateColumns = "auto 3em", t.style.gridTemplateRows = "50% 50%";
2054
+ let n = W(e, z.iconBase + "noun_1369237.svg", "Move Up", async (e) => a(e, !0)), r = W(e, z.iconBase + "noun_1369241.svg", "Move Down", async (e) => a(e, !1)), i = e.createElement("div");
2055
+ return i.appendChild(u), t.appendChild(i), t.appendChild(n), t.appendChild(r), n.style.gridColumn = 2, r.style.gridColumn = 2, n.style.gridRow = 1, r.style.padding = "0em", n.style.padding = "0em", r.style.gridRow = 2, i.style.gridColumn = 1, i.style.gridRowStart = "span 2", t;
2056
+ }
2057
+ return u;
2058
+ }
2059
+ let m = z.iconBase + "noun_19460_green.svg", h = E, v = a.doc ? a.doc() : null, y = e.createElement("div"), b = y, x = u.ui;
2060
+ t && t.appendChild(y);
2061
+ let S = h.any(a, x("ordered")), C = S ? n.toJS(S) : !1, T = h.any(a, x("property")), O = h.anyJS(a, x("reverse"), null, v);
2062
+ if (!T) return y.appendChild(R(e, "No property to multiple: " + a)), b;
2063
+ let A = h.any(a, x("label"));
2064
+ A ||= w(T);
2065
+ let j = h.any(a, x("min"));
2066
+ j = j ? 0 + j.value : 0;
2067
+ let M = h.any(a, x("part"));
2068
+ if (!M) return y.appendChild(R(e, "No part to multiple: " + a)), b;
2069
+ let N = y.appendChild(e.createElement("div"));
2070
+ N.style.display = "flex", N.style.flexDirection = "column";
2071
+ let P, F;
2072
+ if (F = O ? h.any(null, T, i, o) : h.any(i, T, null, o), C ? (P = O ? h.any(null, T, i, o) : h.any(i, T, null, o), F = P ? P.elements : []) : (F = O ? h.each(null, T, i, o) : h.each(i, T, null, o), P = null), h.updater.editable(o.uri)) {
2073
+ let t = y.appendChild(e.createElement("div"));
2074
+ t.style.padding = "0.5em";
2075
+ let n = t.appendChild(e.createElement("img"));
2076
+ n.setAttribute("src", m), n.setAttribute("style", "margin: 0.2em; width: 1.5em; height:1.5em"), n.title = "Click to add another " + A;
2077
+ let r = e.createElement("span");
2078
+ r.textContent = (F.length === 0 ? "Add another " : "Add ") + A, t.addEventListener("click", async (e) => {
2079
+ await f();
2080
+ }, !0), t.appendChild(r);
2081
+ }
2082
+ function ee() {
2083
+ P || (P = new l(), O ? h.add(P, T, i, o) : h.add(i, T, P, o));
2084
+ }
2085
+ async function te() {
2086
+ D("save list: " + d(P.elements)), ee();
2087
+ try {
2088
+ await h.fetcher.putBack(o);
2089
+ } catch (t) {
2090
+ y.appendChild(R(e, "Error trying to put back a list: " + t));
2091
+ return;
2092
+ }
2093
+ I();
2094
+ }
2095
+ function I() {
2096
+ let e;
2097
+ if (C) {
2098
+ let t = O ? h.the(null, T, i, o) : h.the(i, T, null, o);
2099
+ e = t ? t.elements : [];
2100
+ } else e = O ? h.each(null, T, i, o) : h.each(i, T, null, o), e.sort();
2101
+ g(N, e, p);
2102
+ }
2103
+ N.refresh = I, I();
2104
+ async function L() {
2105
+ let e = j - F.length;
2106
+ if (e > 0) {
2107
+ for (let t = 0; t < e; t++) D("Adding extra: min " + j), await f();
2108
+ await te();
2109
+ }
2110
+ }
2111
+ return L().then(() => {
2112
+ D(" Multiple render: async stuff ok");
2113
+ }, (e) => {
2114
+ k(" Multiple render: async stuff fails. #### ", e);
2115
+ }), b;
2116
+ }, K[u.ui("PhoneField").uri] = Y, K[u.ui("EmailField").uri] = Y, K[u.ui("ColorField").uri] = Y, K[u.ui("DateField").uri] = Y, K[u.ui("DateTimeField").uri] = Y, K[u.ui("TimeField").uri] = Y, K[u.ui("NumericField").uri] = Y, K[u.ui("IntegerField").uri] = Y, K[u.ui("DecimalField").uri] = Y, K[u.ui("FloatField").uri] = Y, K[u.ui("TextField").uri] = Y, K[u.ui("SingleLineTextField").uri] = Y, K[u.ui("NamedNodeURIField").uri] = Y, K[u.ui("MultiLineTextField").uri] = function(e, t, n, r, i, a, o) {
2117
+ let s = u.ui, c = E, l = i.doc ? i.doc() : null, d = c.any(i, s("property"));
2118
+ if (!d) return R(e, "No property to text field: " + i);
2119
+ let f = e.createElement("div");
2120
+ f.style.display = "flex", f.style.flexDirection = "row";
2121
+ let p = f.appendChild(e.createElement("div"));
2122
+ p.style.width = y.formFieldNameBoxWidth;
2123
+ let m = f.appendChild(e.createElement("div"));
2124
+ p.appendChild(yt(e, d, i)), a = bt(r, d, a);
2125
+ let h = c.anyJS(r, d, null, a) || "", g = c.updater.editable(a.uri), _ = i && c.anyJS(i, u.ui("suppressEmptyUneditable"), null, l);
2126
+ !g && _ && h === "" && (f.style.display = "none");
2127
+ let v = En(e, c, r, d, a, o);
2128
+ return m.appendChild(v), t && t.appendChild(f), f;
2129
+ };
2130
+ function hn(e, t, n, r, i, a, o, s) {
2131
+ let l = u.ui, d = E, f = d.any(i, l("property"));
2132
+ if (!f) {
2133
+ let n = R(e, "No property to boolean field: " + i);
2134
+ return t && t.appendChild(n), n;
2135
+ }
2136
+ let p = d.any(i, l("label"));
2137
+ p ||= w(f, !0), a = bt(r, f, a);
2138
+ let m = d.any(r, f);
2139
+ m === void 0 && (m = !1);
2140
+ let h = c(r, f, !0, a), g = c(r, f, !1, a), _ = jn(e, d, p, g, h, i, a, s);
2141
+ return t && t.appendChild(_), _;
2142
+ }
2143
+ K[u.ui("BooleanField").uri] = function(e, t, n, r, i, a, o) {
2144
+ return hn(e, t, n, r, i, a, o, !1);
2145
+ }, K[u.ui("TristateField").uri] = function(e, t, n, r, i, a, o) {
2146
+ return hn(e, t, n, r, i, a, o, !0);
2147
+ }, K[u.ui("Classifier").uri] = function(e, t, n, r, i, a, o) {
2148
+ let s = E, c = u.ui, l = s.any(i, c("category"));
2149
+ if (!l) return R(e, "No category for classifier: " + i);
2150
+ _("Classifier: dataDoc=" + a);
2151
+ let d = function(e, t) {
2152
+ return o(e || e, t);
2153
+ }, f = e.createElement("div");
2154
+ f.setAttribute("class", "classifierBox");
2155
+ let p = e.createElement("div");
2156
+ p.setAttribute("class", "formFieldName classifierBox-label"), p.appendChild(yt(e, l, i)), f.appendChild(p);
2157
+ let m = e.createElement("div");
2158
+ m.setAttribute("class", "formFieldValue classifierBox-selectBox");
2159
+ let h = An(e, s, r, l, a, d);
2160
+ if (h && h.querySelectorAll) {
2161
+ let e = h.querySelectorAll("select");
2162
+ e.length && !s.updater.editable(a.uri) && e.forEach((e) => {
2163
+ e.readOnly = !0, e.style = C.textInputStyleUneditable;
2164
+ });
2165
+ }
2166
+ return m.appendChild(h), f.appendChild(m), t && t.appendChild(f), f;
2167
+ }, K[u.ui("Choice").uri] = function(t, n, r, i, a, o, s) {
2168
+ let l = u.ui, d = E, f = a.doc ? a.doc() : null, p, m = t.createElement("div");
2169
+ m.setAttribute("class", "choiceBox"), n && n.appendChild(m);
2170
+ let h = t.createElement("div");
2171
+ h.setAttribute("class", "formFieldName choiceBox-label"), m.appendChild(h);
2172
+ let g = t.createElement("div");
2173
+ g.setAttribute("class", "formFieldValue choiceBox-selectBox"), m.appendChild(g);
2174
+ let _ = d.any(a, l("property"));
2175
+ if (!_) return m.appendChild(R(t, "No property for Choice: " + a));
2176
+ h.appendChild(yt(t, _, a));
2177
+ let v = d.any(a, l("from"));
2178
+ if (!v) return R(t, "No 'from' for Choice: " + a);
2179
+ let y = d.any(a, l("use")), b = {
2180
+ form: a,
2181
+ subForm: y,
2182
+ disambiguate: !1
2183
+ };
2184
+ function x(e) {
2185
+ let t = [], n;
2186
+ t = d.each(void 0, u.rdf("type"), v, f);
2187
+ for (let n in Pn(d, v, e)) t.push(d.fromNT(n));
2188
+ if (v.sameTerm(u.rdfs("Class"))) for (p in Ze()) t.push(d.sym(p));
2189
+ else if (v.sameTerm(u.rdf("Property"))) {
2190
+ for (p in n = Qe(d), n.op) t.push(d.fromNT(p));
2191
+ for (p in n.dp) t.push(d.fromNT(p));
2192
+ b.disambiguate = !0;
2193
+ } else if (v.sameTerm(u.owl("ObjectProperty"))) {
2194
+ for (p in n = Qe(d), n.op) t.push(d.fromNT(p));
2195
+ b.disambiguate = !0;
2196
+ } else if (v.sameTerm(u.owl("DatatypeProperty"))) {
2197
+ for (p in n = Qe(d), n.dp) t.push(d.fromNT(p));
2198
+ b.disambiguate = !0;
2199
+ }
2200
+ return t;
2201
+ }
2202
+ d.any(a, l("canMintNew")) && (b.mint = "* Create new *");
2203
+ let S = d.any(a, l("multiselect"));
2204
+ S && (b.multiSelect = !0);
2205
+ let C = d.each(a, l("search-full-store")).length ? null : o, w;
2206
+ return g.refresh = function() {
2207
+ let n = d.each(i, _, null, o).map((e) => e.value), r = x(C);
2208
+ if (r.push(n), r = Cn(r), w = Mn(t, g, d, i, _, r, n, v, b, o, s), g.innerHTML = "", g.appendChild(w), S) {
2209
+ let r = new ln({
2210
+ placeholder: w.selected,
2211
+ select: w,
2212
+ container: g,
2213
+ textField: "textField",
2214
+ valueField: "valueField"
2215
+ });
2216
+ r.init(), r.subscribe(function(r) {
2217
+ if (r.action === "REMOVE_OPTION" && (n = n.filter(function(e) {
2218
+ return e !== r.value;
2219
+ })), r.action === "CLEAR_ALL_OPTIONS" && (n = []), r.action === "ADD_OPTION") {
2220
+ if ((r.value + "").includes("Create new")) {
2221
+ let r = $(o), a = [];
2222
+ a.push(c(i, _, d.sym(r), o)), v && a.push(c(r, u.rdf("type"), d.sym(v), o)), y && gn(t, g, {}, e(r), y, o, function(e, i) {
2223
+ e ? (d.updater.update([], a, function(e, n, r) {
2224
+ n || g.appendChild(R(t, "Error updating select: " + r));
2225
+ }), n.push(r), s && s(e, {
2226
+ widget: "select",
2227
+ event: "new"
2228
+ })) : g.appendChild(R(t, "Error updating data in field of select: " + i));
2229
+ });
2230
+ } else n.push(r.value);
2231
+ }
2232
+ w.update(n);
2233
+ });
2234
+ }
2235
+ }, g.refresh(), w && w.refresh && w.refresh(), m;
2236
+ };
2237
+ function gn(e, t, n, r, i, a, o) {
2238
+ q(e, i)(e, t, n, r, i, a, o);
2239
+ }
2240
+ K[u.ui("Comment").uri] = K[u.ui("Heading").uri] = function(e, t, n, r, i, a, o) {
2241
+ let s = u.ui, c = E, l = c.any(i, s("contents"));
2242
+ l ||= "Error: No contents in comment field.";
2243
+ let d = i.doc ? i.doc() : null, f = pt[ht(i)] || {}, p = e.createElement("div");
2244
+ t && t.appendChild(p);
2245
+ let m = p.appendChild(e.createElement(f.element));
2246
+ m.textContent = l, _t(m, i);
2247
+ let h = c.anyJS(i, u.ui("suppressIfUneditable"), null, d), g = c.updater.editable(a.uri);
2248
+ return h && !g && (p.style.display = "none"), p;
2249
+ };
2250
+ function _n(e, t, n, r, i) {
2251
+ let a = e.createElement("button");
2252
+ return a.setAttribute("type", "button"), a.innerHTML = "Edit " + w(u.ui("Form")), a.addEventListener("click", function(o) {
2253
+ vn(e, t, {}, n, u.ui("FormForm"), r, i).setAttribute("style", u.ui("FormForm").sameTerm(n) ? "background-color: #fee;" : "background-color: #ffffe7;"), a.parentNode.removeChild(a);
2254
+ }, !0), a;
2255
+ }
2256
+ function vn(e, t, n, r, i, a, o) {
2257
+ return q(e, i)(e, t, n, r, i, a, o);
2258
+ }
2259
+ function yn(e, t) {
2260
+ let n = e.each(void 0, u.rdf("range"), t);
2261
+ [
2262
+ u.rdfs("comment"),
2263
+ u.dc("title"),
2264
+ u.foaf("name"),
2265
+ u.foaf("homepage")
2266
+ ].forEach(function(e) {
2267
+ n.push(e);
2268
+ });
2269
+ let r = e.each(void 0, u.rdf("type"), t);
2270
+ r.length > 60 && (r = r.slice(0, 60));
2271
+ let i = {};
2272
+ for (let t = 0; t < (r.length > 60 ? 60 : r.length); t++) e.statementsMatching(r[t], void 0, void 0).forEach(function(e) {
2273
+ i[e.predicate.uri] = !0;
2274
+ });
2275
+ n.forEach(function(e) {
2276
+ i[e.uri] = !0;
2277
+ });
2278
+ let a = [];
2279
+ for (let t in i) a.push(e.sym(t));
2280
+ return a;
2281
+ }
2282
+ function bn(e, t, n) {
2283
+ let r = [e.sym(t)];
2284
+ for (; r.length > 0;) {
2285
+ let t = r.shift(), i = e.each(t, n);
2286
+ if (_("Lists for " + t + ", " + n + ": " + i.length), i.length !== 0) return i;
2287
+ let a = e.each(t, u.rdfs("subClassOf"));
2288
+ for (let e = 0; e < a.length; e++) r.push(a[e]), _("findClosest: add super: " + a[e]);
2289
+ }
2290
+ return [];
2291
+ }
2292
+ function xn(e) {
2293
+ let t = E;
2294
+ _("formsFor: subject=" + e);
2295
+ let n = t.findTypeURIs(e), r;
2296
+ for (r in n) _(" type: " + r);
2297
+ let i = t.bottomTypeURIs(n), a = [];
2298
+ for (let e in i) _("candidatesFor: trying bottom type =" + e), a = a.concat(bn(t, e, u.ui("creationForm"))), a = a.concat(bn(t, e, u.ui("annotationForm")));
2299
+ return a;
2300
+ }
2301
+ function Sn(e) {
2302
+ let t = e.map(function(e) {
2303
+ return [pn.any(e, u.ui("sequence")) || 9999, e];
2304
+ });
2305
+ return t.sort(function(e, t) {
2306
+ return e[0] - t[0];
2307
+ }), t.map(function(e) {
2308
+ return e[1];
2309
+ });
2310
+ }
2311
+ function Cn(e) {
2312
+ let t = e.map(function(e) {
2313
+ return [w(e).toLowerCase(), e];
2314
+ });
2315
+ return t.sort(), t.map(function(e) {
2316
+ return e[1];
2317
+ });
2318
+ }
2319
+ function wn(e, t, n, r, i, a, o, s) {
2320
+ let c = e.createElement("button");
2321
+ return c.setAttribute("type", "button"), c.innerHTML = "New " + w(i), c.addEventListener("click", function(l) {
2322
+ c.parentNode.appendChild(Tn(e, t, n, r, i, a, o, s));
2323
+ }, !1), c;
2324
+ }
2325
+ function Tn(e, t, n, r, i, a, o, s) {
2326
+ let l = e.createElement("form");
2327
+ if (!a) {
2328
+ let n = bn(t, i.uri, u.ui("creationForm"));
2329
+ if (n.length === 0) {
2330
+ let t = l.appendChild(e.createElement("p"));
2331
+ t.textContent = "I am sorry, you need to provide information about a " + w(i) + " but I don't know enough information about those to ask you.";
2332
+ let n = l.appendChild(e.createElement("button"));
2333
+ return n.setAttribute("type", "button"), n.setAttribute("style", "float: right;"), n.innerHTML = "Goto " + w(i), n.addEventListener("click", function(t) {
2334
+ e.outlineManager.GotoSubject(i, !0, void 0, !0, void 0);
2335
+ }, !1), l;
2336
+ }
2337
+ _("lists[0] is " + n[0]), a = n[0];
2338
+ }
2339
+ _("form is " + a), l.setAttribute("style", `border: 0.05em solid ${y.formBorderColor}; color: ${y.formBorderColor}`), l.innerHTML = "<h3>New " + w(i) + "</h3>";
2340
+ let d = q(e, a), f = $(o), p = !1, m = function(a, d) {
2341
+ if (!a) return s(a, d);
2342
+ let m = [];
2343
+ n && !t.holds(n, r, f, o) && m.push(c(n, r, f, o)), n && !t.holds(f, u.rdf("type"), i, o) && m.push(c(f, u.rdf("type"), i, o)), m.length ? t.updater.update([], m, h) : s(!0, d), p ||= l.appendChild($e(e, f));
2344
+ };
2345
+ function h(e, t, n) {
2346
+ return s(t, n);
2347
+ }
2348
+ return x("paneUtils Object is " + f), et(e, d(e, l, {}, f, a, o, m)).setAttribute("style", "float: right;"), l.AJAR_subject = f, l;
2349
+ }
2350
+ function En(e, t, n, r, i, a) {
2351
+ let o = e.createElement("div"), s = t.anyJS(n, r, null, i) || "", l = e.createElement("textarea");
2352
+ o.appendChild(l), l.rows = s ? s.split("\n").length + 2 : 2, l.cols = 80, l.setAttribute("style", C.multilineTextInputStyle), s === null ? l.select() : l.value = s, o.refresh = function() {
2353
+ let e = t.any(n, r, null, i);
2354
+ e && e.value !== l.value && (l.value = e.value);
2355
+ };
2356
+ function u(s) {
2357
+ f.disabled = !0, f.setAttribute("style", "visibility: hidden; float: right;"), l.disabled = !0, l.style.color = y.textInputColorPending;
2358
+ let u = t.statementsMatching(n, r, null, i), d = c(n, r, l.value, i);
2359
+ t.updater.update(u, d, function(t, n, r) {
2360
+ n ? (l.style.color = y.textInputColor, l.disabled = !1) : o.appendChild(R(e, "Error (while saving change to " + i.uri + "): " + r)), a && a(n, r);
2361
+ });
2362
+ }
2363
+ let d = t.updater.editable(i.uri), f;
2364
+ return d ? (f = Be(e, u), f.disabled = !0, f.style.visibility = "hidden", f.style.float = "right", o.appendChild(f), l.addEventListener("keyup", function(e) {
2365
+ l.style.color = "green", f && (f.disabled = !1, f.style.visibility = "");
2366
+ }, !0), l.addEventListener("change", u, !0)) : (l.disabled = !0, l.style.backgroundColor = y.textInputBackgroundColorUneditable), o;
2367
+ }
2368
+ function Dn(e, t, n, r, i, a, o, s) {
2369
+ _("Select list length now " + i.length);
2370
+ let l = 0, d = {}, f = t.updater.editable(o.uri);
2371
+ for (let e = 0; e < i.length; e++) {
2372
+ let t = i[e];
2373
+ t.uri || O(`makeSelectForClassifierOptions: option does not have an uri: ${t}, with predicate: ${r}`), !t.uri || t.uri in d || (d[t.uri] = !0, l++);
2374
+ }
2375
+ if (l === 0 && !a.mint) return R(e, "Can't do selector with no options, subject= " + n + " property = " + r + ".");
2376
+ _("makeSelectForClassifierOptions: dataDoc=" + o);
2377
+ let p, m = function() {
2378
+ return p = {}, r.sameTerm(u.rdf("type")) ? p = t.findTypeURIs(n) : t.each(n, r, null, o).forEach(function(e) {
2379
+ p[e.uri] = !0;
2380
+ }), p;
2381
+ };
2382
+ p = m();
2383
+ let h = function(i) {
2384
+ g.disabled = !0;
2385
+ let l = [], u = [], d = function(e) {
2386
+ t.holds(n, r, e, o) && l.push(c(n, r, e, o));
2387
+ }, f;
2388
+ for (let i = 0; i < g.options.length; i++) {
2389
+ let l = g.options[i];
2390
+ if (l.selected && l.AJAR_mint) {
2391
+ if (a.mintClass) {
2392
+ let i = Tn(e, t, n, r, a.mintClass, null, o, function(e, t) {
2393
+ e || s(e, t, { change: "new" });
2394
+ });
2395
+ g.parentNode.appendChild(i), f = i.AJAR_subject;
2396
+ } else f = $(o);
2397
+ u.push(c(n, r, f, o)), a.mintStatementsFun && (u = u.concat(a.mintStatementsFun(f)));
2398
+ }
2399
+ l.AJAR_uri && (l.selected && !(l.AJAR_uri in p) && u.push(c(n, r, t.sym(l.AJAR_uri), o)), !l.selected && l.AJAR_uri in p && d(t.sym(l.AJAR_uri)), l.selected && (g.currentURI = l.AJAR_uri));
2400
+ }
2401
+ let h = g.subSelect;
2402
+ for (; h && h.currentURI;) d(t.sym(h.currentURI)), h = h.subSelect;
2403
+ for (h = g.superSelect; h && h.currentURI;) d(t.sym(h.currentURI)), h = h.superSelect;
2404
+ function _(e, t) {
2405
+ s(e, {
2406
+ widget: "select",
2407
+ event: "new"
2408
+ });
2409
+ }
2410
+ x("makeSelectForClassifierOptions: data doc = " + o), t.updater.update(l, u, function(t, n, r) {
2411
+ if (p = m(), n) g.disabled = !1, f && q(e, a.subForm)(e, g.parentNode, {}, f, a.subForm, o, _);
2412
+ else return g.parentNode.appendChild(R(e, "Error updating data in select: " + r));
2413
+ s && s(n, {
2414
+ widget: "select",
2415
+ event: "change"
2416
+ });
2417
+ });
2418
+ }, g = e.createElement("select");
2419
+ g.setAttribute("style", C.formSelectStyle), a.multiple && g.setAttribute("multiple", "true"), g.currentURI = null, g.refresh = function() {
2420
+ p = m();
2421
+ for (let e = 0; e < g.children.length; e++) {
2422
+ let t = g.children[e];
2423
+ t.AJAR_uri && (t.selected = t.AJAR_uri in p);
2424
+ }
2425
+ g.disabled = !1;
2426
+ };
2427
+ for (let n in d) {
2428
+ let r = t.sym(n), i = e.createElement("option");
2429
+ a.disambiguate ? i.appendChild(e.createTextNode(b(r, !0))) : i.appendChild(e.createTextNode(w(r, !0)));
2430
+ let o = t.any(r, t.sym("http://www.w3.org/ns/ui#backgroundColor"));
2431
+ o && i.setAttribute("style", "background-color: " + o.value + "; "), i.AJAR_uri = n, n in p && (i.setAttribute("selected", "true"), g.currentURI = n), g.appendChild(i);
2432
+ }
2433
+ if (f && a.mint) {
2434
+ let t = e.createElement("option");
2435
+ t.appendChild(e.createTextNode(a.mint)), t.AJAR_mint = !0, g.insertBefore(t, g.firstChild);
2436
+ }
2437
+ if (g.currentURI == null && !a.multiple) {
2438
+ let t = e.createElement("option");
2439
+ t.appendChild(e.createTextNode(a.nullLabel)), g.insertBefore(t, g.firstChild), t.selected = !0;
2440
+ }
2441
+ return f && g.addEventListener("change", h, !1), g;
2442
+ }
2443
+ function On(e, t, n, r, i, a, o, s) {
2444
+ _("Select list length now " + i.length);
2445
+ let l = 0, d = {}, f = t.updater.editable(o.uri);
2446
+ for (let e = 0; e < i.length; e++) {
2447
+ let t = i[e];
2448
+ t.uri || O(`makeSelectForOptions: option does not have an uri: ${t}, with predicate: ${r}`), !t.uri || t.uri in d || (d[t.uri] = !0, l++);
2449
+ }
2450
+ if (l === 0) return R(e, "Can't do selector with no options, subject= " + n + " property = " + r + ".");
2451
+ _("makeSelectForOptions: dataDoc=" + o);
2452
+ let p, m = function() {
2453
+ return p = {}, r.sameTerm(u.rdf("type")) ? p = t.findTypeURIs(n) : t.each(n, r, null, o).forEach(function(e) {
2454
+ e.uri && (p[e.uri] = !0);
2455
+ }), p;
2456
+ };
2457
+ p = m();
2458
+ let h = function(i) {
2459
+ g.disabled = !0;
2460
+ let a = [], l = [], u = function(e) {
2461
+ t.holds(n, r, e, o) && a.push(c(n, r, e, o));
2462
+ };
2463
+ for (let e = 0; e < g.options.length; e++) {
2464
+ let i = g.options[e];
2465
+ i.AJAR_uri && (i.selected && !(i.AJAR_uri in p) && l.push(c(n, r, t.sym(i.AJAR_uri), o)), !i.selected && i.AJAR_uri in p && u(t.sym(i.AJAR_uri)), i.selected && (g.currentURI = i.AJAR_uri));
2466
+ }
2467
+ let d = g.subSelect;
2468
+ for (; d && d.currentURI;) u(t.sym(d.currentURI)), d = d.subSelect;
2469
+ for (d = g.superSelect; d && d.currentURI;) u(t.sym(d.currentURI)), d = d.superSelect;
2470
+ x("selectForOptions: data doc = " + o), t.updater.update(a, l, function(t, n, r) {
2471
+ if (p = m(), n) g.disabled = !1;
2472
+ else return g.parentNode.appendChild(R(e, "Error updating data in select: " + r));
2473
+ s && s(n, {
2474
+ widget: "select",
2475
+ event: "change"
2476
+ });
2477
+ });
2478
+ }, g = e.createElement("select");
2479
+ g.setAttribute("style", C.formSelectStyle), g.currentURI = null, g.refresh = function() {
2480
+ p = m();
2481
+ for (let e = 0; e < g.children.length; e++) {
2482
+ let t = g.children[e];
2483
+ t.AJAR_uri && (t.selected = t.AJAR_uri in p);
2484
+ }
2485
+ g.disabled = !1;
2486
+ };
2487
+ for (let n in d) {
2488
+ let r = t.sym(n), i = e.createElement("option");
2489
+ a.disambiguate ? i.appendChild(e.createTextNode(b(r, !0))) : i.appendChild(e.createTextNode(w(r, !0)));
2490
+ let o = t.any(r, t.sym("http://www.w3.org/ns/ui#backgroundColor"));
2491
+ o && i.setAttribute("style", "background-color: " + o.value + "; "), i.AJAR_uri = n, n in p && (i.setAttribute("selected", "true"), g.currentURI = n), g.appendChild(i);
2492
+ }
2493
+ if (!g.currentURI) {
2494
+ let t = e.createElement("option");
2495
+ t.appendChild(e.createTextNode(a.nullLabel)), g.insertBefore(t, g.firstChild), t.selected = !0;
2496
+ }
2497
+ return f && g.addEventListener("change", h, !1), g;
2498
+ }
2499
+ function kn(e, t, n, r, i, a) {
2500
+ let o = t.any(r, u.owl("disjointUnionOf")), s, c = !1;
2501
+ return o ? s = o.elements : (s = t.each(void 0, u.rdfs("subClassOf"), r), c = !0), _("Select list length " + s.length), s.length === 0 ? R(e, "Can't do " + (c ? "multiple " : "") + "selector with no subclasses of category: " + r) : s.length === 1 ? R(e, "Can't do " + (c ? "multiple " : "") + "selector with only 1 subclass of category: " + r + ":" + s[1]) : Dn(e, t, n, u.rdf("type"), s, {
2502
+ multiple: c,
2503
+ nullLabel: "* Select type *"
2504
+ }, i, a);
2505
+ }
2506
+ function An(e, t, n, r, i, a) {
2507
+ function o() {
2508
+ c &&= (s.removeChild(c), null), d.currentURI && t.any(t.sym(d.currentURI), u.owl("disjointUnionOf")) && (c = An(e, t, n, t.sym(d.currentURI), i, a), d.subSelect = c.firstChild, d.subSelect.superSelect = d, s.appendChild(c));
2509
+ }
2510
+ let s = e.createElement("span"), c = null;
2511
+ function l(e, t) {
2512
+ e && o(), a(e, t);
2513
+ }
2514
+ let d = kn(e, t, n, r, i, l);
2515
+ return s.appendChild(d), o(), s;
2516
+ }
2517
+ function jn(e, t, n, r, i, a, o, s) {
2518
+ let c = e.createElement("div"), l = vt(e, t, c, a, n), d = t.updater.editable(o.uri), f = e.createElement("button"), p = f;
2519
+ f.style = C.checkboxInputStyle, l.appendChild(f);
2520
+ function m(e) {
2521
+ if (!e) return [];
2522
+ if (e.object) return e.why ||= o, [e];
2523
+ if (e instanceof Array) return e;
2524
+ throw Error("buildCheckboxForm: bad param " + e);
2525
+ }
2526
+ i = m(i), r = m(r);
2527
+ function h(e) {
2528
+ return e.filter((e) => !t.holds(e.subject, e.predicate, e.object, e.why)).length === 0;
2529
+ }
2530
+ function g() {
2531
+ let n = h(i), o = n;
2532
+ if (r.length) {
2533
+ let l = h(r);
2534
+ if (n && l) return c.appendChild(R(e, "Inconsistent data in dataDoc!\n" + i + " and\n" + r)), c;
2535
+ if (!n && !l) {
2536
+ n = null;
2537
+ let e = t.any(a, u.ui("default"));
2538
+ o = e ? e.value === "1" : s ? null : !1;
2539
+ }
2540
+ }
2541
+ f.state = n, f.textContent = {
2542
+ true: un,
2543
+ false: s ? dn : " ",
2544
+ null: fn
2545
+ }[o];
2546
+ }
2547
+ if (g(), !d) return c;
2548
+ let _ = !1;
2549
+ return f.addEventListener("click", function(n) {
2550
+ if (_) return;
2551
+ _ = !0, f.disabled = !0;
2552
+ let a = !1, o = function() {
2553
+ return !a && (a = !0, _ = !1, f.disabled = !1, !0);
2554
+ }, l = function(t) {
2555
+ p.style.color = "#000", p.style.backgroundColor = "#fee", c.appendChild(R(e, `Checkbox: Error updating dataDoc from ${f.state} to ${f.newState}:\n\n${t}`));
2556
+ };
2557
+ p.style.color = "#bbb";
2558
+ let u = f.state === !0 ? i : f.state === !1 ? r : [];
2559
+ f.newState = f.state === null ? !0 : f.state === !0 ? !1 : !s || null;
2560
+ let d = f.newState === !0 ? i : f.newState === !1 ? r : [];
2561
+ D(` Deleting ${u}`), D(` Inserting ${d}`);
2562
+ try {
2563
+ let e = t.updater.update(u, d, function(e, n, r) {
2564
+ o() && (n ? (p.style.color = "#000", f.state = f.newState, f.textContent = {
2565
+ true: un,
2566
+ false: dn,
2567
+ null: fn
2568
+ }[f.state]) : (u.why && t.holds(u.subject, u.predicate, u.object, u.why) && D(" @@@@@ weird if 409 - does hold statement"), l(r)));
2569
+ });
2570
+ e && typeof e.then == "function" && e.catch(function(e) {
2571
+ o() && l(e instanceof Error ? e.message : e);
2572
+ }).finally(function() {
2573
+ o();
2574
+ });
2575
+ } catch (e) {
2576
+ throw o(), e;
2577
+ }
2578
+ }, !1), c;
2579
+ }
2580
+ function $(t) {
2581
+ let n = /* @__PURE__ */ new Date();
2582
+ return e(t.uri + "#id" + ("" + n.getTime()));
2583
+ }
2584
+ function Mn(t, n, r, i, a, o, s, l, d, f, p) {
2585
+ let m = {}, h = r.updater.editable(f.uri);
2586
+ for (let e = 0; e < o.length; e++) {
2587
+ let t = o[e];
2588
+ !t.uri || t.uri in m || (m[t.uri] = !0);
2589
+ }
2590
+ if (Object.keys(m).length === 0 && !d.mint) return R(t, "Can't do selector with no options, subject= " + i + " property = " + a + ".");
2591
+ _("makeSelectForChoice: dataDoc=" + f);
2592
+ function g() {
2593
+ let e = "--- choice ---";
2594
+ return a && a.termType !== "BlankNode" && (e = "* Select for property: " + w(a) + " *"), i && i.termType !== "BlankNode" && (e = "* Select for " + w(i, !0) + " *"), e;
2595
+ }
2596
+ function v() {
2597
+ let e = t.createElement("option");
2598
+ return e.appendChild(t.createTextNode(g())), e.disabled = !0, e.value = !0, e.hidden = !0, e.selected = !0, e;
2599
+ }
2600
+ let y = function(e) {
2601
+ n.removeChild(n.lastChild), S.refresh();
2602
+ }, S = t.createElement("select");
2603
+ S.setAttribute("style", C.formSelectStyle), S.setAttribute("id", "formSelect"), S.currentURI = null;
2604
+ for (let e in m) S.appendChild(T(e));
2605
+ if (h && d.mint) {
2606
+ let e = t.createElement("option");
2607
+ e.appendChild(t.createTextNode(d.mint)), e.AJAR_mint = !0, S.insertBefore(e, S.firstChild);
2608
+ }
2609
+ S.children.length === 0 && S.insertBefore(v(), S.firstChild), S.update = function(n) {
2610
+ s = n;
2611
+ let o = [], d = [], m = function(e) {
2612
+ r.holds(i, a, e, f) && o.push(c(i, a, e, f));
2613
+ }, h = function(e) {
2614
+ r.holds(i, a, e, f) || d.push(c(i, a, e, f)), l && !r.holds(e, u.rdf("type"), r.sym(l), f) && d.push(c(e, u.rdf("type"), r.sym(l), f));
2615
+ }, g = r.each(i, a, null, f).map((e) => e.value);
2616
+ for (let t of g) Nn(t, s) || m(e(t));
2617
+ for (let t of s) t in g || h(e(t));
2618
+ r.updater.update(o, d, function(e, n, r) {
2619
+ if (!n) return S.parentNode.appendChild(R(t, "Error updating data in select: " + r));
2620
+ S.refresh(), p && p(n, {
2621
+ widget: "select",
2622
+ event: "change"
2623
+ });
2624
+ });
2625
+ }, S.refresh = function() {
2626
+ S.disabled = !0;
2627
+ let o = [], m;
2628
+ for (let e = 0; e < S.options.length; e++) {
2629
+ let n = S.options[e];
2630
+ if (n.selected && n.AJAR_mint) {
2631
+ if (d.mintClass) {
2632
+ let e = Tn(t, r, i, a, l, d.subForm, f, function(e, t) {
2633
+ e || p(e, t, { change: "new" });
2634
+ });
2635
+ S.parentNode.appendChild(e), m = e.AJAR_subject;
2636
+ } else m = $(f);
2637
+ o.push(c(i, a, r.sym(m), f)), l && o.push(c(m, u.rdf("type"), r.sym(l), f)), d.mintStatementsFun && (o = o.concat(d.mintStatementsFun(m))), S.currentURI = m;
2638
+ }
2639
+ n.AJAR_uri && (n.selected && Nn(n.AJAR_uri, s) && (S.currentURI = n.AJAR_uri), Nn(n.AJAR_uri, s) || n.removeAttribute("selected"), Nn(n.AJAR_uri, s) && n.setAttribute("selected", "true"));
2640
+ }
2641
+ x("selectForOptions: data doc = " + f), S.currentURI && d.subForm && !d.multiSelect && gn(t, n, {}, e(S.currentURI), d.subForm, f, function(e, i) {
2642
+ e ? (r.updater.update([], o, function(e, r, i) {
2643
+ r || n.appendChild(R(t, "Error updating select: " + i));
2644
+ }), p && p(e, {
2645
+ widget: "select",
2646
+ event: "new"
2647
+ })) : n.appendChild(R(t, "Error updating data in field of select: " + i));
2648
+ }), S.disabled = !1;
2649
+ };
2650
+ function T(e) {
2651
+ let n = t.createElement("option"), i = r.sym(e), a;
2652
+ a = d.disambiguate ? b(i, !0) : w(i, !0), n.appendChild(t.createTextNode(a)), n.setAttribute("value", e);
2653
+ let o = r.any(i, r.sym("http://www.w3.org/ns/ui#backgroundColor"));
2654
+ return o && n.setAttribute("style", "background-color: " + o.value + "; "), n.AJAR_uri = e, Nn(i.value, s) && n.setAttribute("selected", "true"), n;
2655
+ }
2656
+ return h && S.addEventListener("change", y, !1), S;
2657
+ }
2658
+ function Nn(e, t) {
2659
+ let n = 0;
2660
+ for (; n < t.length; n++) if (t[n] === e) return !0;
2661
+ return !1;
2662
+ }
2663
+ function Pn(e, t, n) {
2664
+ let r, i, a, o, s, c, l, u, d, f, p, m = {};
2665
+ m[t.toNT()] = !0;
2666
+ let h = {}, g = e.transitiveClosure(m, e.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"), !0);
2667
+ for (let t in g) {
2668
+ s = e.statementsMatching(null, e.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), e.fromNT(t), n);
2669
+ for (let e = 0, t = s.length; e < t; e++) f = s[e], h[f.subject.toNT()] = f;
2670
+ c = e.each(null, e.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"), e.fromNT(t), n);
2671
+ for (let t = 0, i = c.length; t < i; t++) for (o = c[t], l = e.statementsMatching(null, o, null, n), a = 0, r = l.length; a < r; a++) f = l[a], h[f.subject.toNT()] = f;
2672
+ u = e.each(null, e.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"), e.fromNT(t), n);
2673
+ for (let t = 0, r = u.length; t < r; t++) for (o = u[t], d = e.statementsMatching(null, o, null, n), p = 0, i = d.length; p < i; p++) f = d[p], h[f.object.toNT()] = f;
2674
+ }
2675
+ return h;
2676
+ }
2677
+ // src/widgets/index.js
2678
+ var Fn = /* @__PURE__ */ a({
2679
+ Group: () => ce,
2680
+ GroupBuilder: () => le,
2681
+ GroupPicker: () => se,
2682
+ PeoplePicker: () => oe,
2683
+ Person: () => ue,
2684
+ addStyleSheet: () => ct,
2685
+ allClassURIs: () => Ze,
2686
+ appendForm: () => vn,
2687
+ askName: () => Ve,
2688
+ attachmentList: () => Je,
2689
+ basicField: () => Y,
2690
+ buildCheckboxForm: () => jn,
2691
+ button: () => W,
2692
+ cancelButton: () => G,
2693
+ clearElement: () => we,
2694
+ complain: () => Ce,
2695
+ continueButton: () => Be,
2696
+ createLinkDiv: () => Ge,
2697
+ createLinkForURI: () => ye,
2698
+ createNameDiv: () => We,
2699
+ defaultAnnotationStore: () => Xe,
2700
+ deleteButtonWithCheck: () => U,
2701
+ editFormButton: () => _n,
2702
+ errorMessageBlock: () => R,
2703
+ extractLogURI: () => Te,
2704
+ faviconOrDefault: () => Re,
2705
+ field: () => K,
2706
+ fieldFunction: () => q,
2707
+ fieldLabel: () => yt,
2708
+ fieldParams: () => pt,
2709
+ fieldStore: () => bt,
2710
+ fileUploadButtonDiv: () => ft,
2711
+ findClosest: () => bn,
2712
+ findImage: () => Fe,
2713
+ findImageFromURI: () => Pe,
2714
+ formatDateTime: () => De,
2715
+ formsFor: () => xn,
2716
+ iconForClass: () => Me,
2717
+ imagesOf: () => je,
2718
+ index: () => rt,
2719
+ isAudio: () => lt,
2720
+ isImage: () => dt,
2721
+ isVideo: () => ut,
2722
+ linkButton: () => $e,
2723
+ linkIcon: () => ve,
2724
+ makeDescription: () => En,
2725
+ makeDraggable: () => ne,
2726
+ makeDropTarget: () => L,
2727
+ makeSelectForCategory: () => kn,
2728
+ makeSelectForChoice: () => Mn,
2729
+ makeSelectForClassifierOptions: () => Dn,
2730
+ makeSelectForNestedCategory: () => An,
2731
+ makeSelectForOptions: () => On,
2732
+ mostSpecificClassURI: () => ht,
2733
+ newButton: () => wn,
2734
+ newThing: () => $,
2735
+ openHrefInOutlineMode: () => Ye,
2736
+ personTR: () => He,
2737
+ promptForNew: () => Tn,
2738
+ propertiesForClass: () => yn,
2739
+ propertyTriage: () => Qe,
2740
+ publicData: () => Dt,
2741
+ refreshTree: () => qe,
2742
+ removeButton: () => et,
2743
+ renderAsDiv: () => Ke,
2744
+ renderAsRow: () => Ue,
2745
+ renderAutoComplete: () => tn,
2746
+ renderAutocompleteControl: () => sn,
2747
+ renderNameValuePair: () => vt,
2748
+ selectorPanel: () => tt,
2749
+ selectorPanelRefresh: () => nt,
2750
+ setImage: () => Le,
2751
+ setName: () => Ae,
2752
+ setVisible: () => Z,
2753
+ shortDate: () => Ee,
2754
+ shortTime: () => ke,
2755
+ sortByLabel: () => Cn,
2756
+ sortBySequence: () => Sn,
2757
+ timestamp: () => Oe,
2758
+ uploadFiles: () => re
2759
+ });
2760
+ export { L as C, A as D, D as E, O, ne as S, k as T, qe as _, xt as a, z as b, G as c, Be as d, U as f, He as g, Ye as h, $ as i, we as l, Me as m, vn as n, Ve as o, Fe as p, jn as r, W as s, Fn as t, Ce as u, Le as v, re as w, R as x, Ee as y };
2761
+
2762
+ //# sourceMappingURL=widgets-CTH3oXJI.js.map