@epa-wg/custom-element-dist 0.0.26 → 0.0.28

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 (216) hide show
  1. package/.storybook/main.ts +2 -2
  2. package/.storybook/preview.ts +1 -1
  3. package/README.md +4 -4
  4. package/bin/vitest/vitest-browser-importmaps.mjs +20 -20
  5. package/coverage/coverage-final.json +22 -22
  6. package/coverage/index.html +26 -26
  7. package/coverage/src/custom-element/coverage.svg +1 -1
  8. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  9. package/coverage/src/custom-element/custom-element.js.html +662 -380
  10. package/coverage/src/custom-element/demo/index.html +1 -1
  11. package/coverage/src/custom-element/demo/z.js.html +1 -1
  12. package/coverage/src/custom-element/http-request.js.html +12 -12
  13. package/coverage/src/custom-element/index.html +21 -21
  14. package/coverage/src/custom-element/local-storage.js.html +78 -63
  15. package/coverage/src/custom-element/location-element.js.html +4 -4
  16. package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
  17. package/coverage/src/custom-element/module-url.js.html +16 -10
  18. package/coverage/src/index.html +1 -1
  19. package/coverage/src/mocks/handlers.ts.html +1 -1
  20. package/coverage/src/mocks/index.html +1 -1
  21. package/coverage/src/stories/attributes.test.stories.ts.html +17 -11
  22. package/coverage/src/stories/coverage.svg +1 -1
  23. package/coverage/src/stories/css.test.stories.ts.html +8 -2
  24. package/coverage/src/stories/dom-merge.test.stories.ts.html +17 -11
  25. package/coverage/src/stories/external-template.test.stories.ts.html +13 -10
  26. package/coverage/src/stories/form.test.stories.ts.html +8 -2
  27. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  28. package/coverage/src/stories/index.html +26 -26
  29. package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
  30. package/coverage/src/stories/local-storage.test.stories.ts.html +106 -76
  31. package/coverage/src/stories/location-element.test.stories.ts.html +8 -2
  32. package/coverage/src/stories/module-url.test.stories.ts.html +8 -2
  33. package/coverage/src/stories/set-url.test.stories.ts.html +8 -2
  34. package/coverage/src/stories/slice-events.test.stories.ts.html +8 -2
  35. package/coverage/src/stories/slots.test.stories.ts.html +8 -2
  36. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  37. package/coverage/src/stories/version-select.test.stories.ts.html +8 -2
  38. package/coverage/src/sum.ts.html +1 -1
  39. package/dist/custom-element-BOIPgtxz.js +565 -0
  40. package/dist/custom-element-CUsSENWc.cjs +97 -0
  41. package/dist/custom-element-bundle.cjs +1 -1
  42. package/dist/custom-element-bundle.js +25 -21
  43. package/dist/demo/a.svg +27 -0
  44. package/dist/demo/demo.css +6 -7
  45. package/dist/demo/external-template.html +3 -3
  46. package/dist/demo/npm-versions-demo.html +21 -8
  47. package/dist/demo/npm-versions.html +54 -25
  48. package/dist/demo/s.xml +11 -21
  49. package/dist/demo/s.xslt +16 -74
  50. package/dist/demo/s1.xslt +59 -59
  51. package/dist/demo/ss.html +24 -57
  52. package/dist/demo/z.html +33 -62
  53. package/dist/demo/z.xml +59 -59
  54. package/dist/demo/z1.html +34 -0
  55. package/dist/local-storage-78EivJ_B.cjs +1 -0
  56. package/dist/local-storage-DzmNKzgN.js +66 -0
  57. package/dist/mockServiceWorker.js +1 -1
  58. package/package.json +27 -25
  59. package/public/demo/a.svg +27 -0
  60. package/public/demo/demo.css +6 -7
  61. package/public/demo/external-template.html +3 -3
  62. package/public/demo/npm-versions-demo.html +21 -8
  63. package/public/demo/npm-versions.html +54 -25
  64. package/public/demo/s.xml +11 -21
  65. package/public/demo/s.xslt +16 -74
  66. package/public/demo/s1.xslt +59 -59
  67. package/public/demo/ss.html +24 -57
  68. package/public/demo/z.html +33 -62
  69. package/public/demo/z.xml +59 -59
  70. package/public/demo/z1.html +34 -0
  71. package/public/mockServiceWorker.js +1 -1
  72. package/src/custom-element/custom-element.js +123 -29
  73. package/src/custom-element/demo/a.svg +27 -0
  74. package/src/custom-element/demo/demo.css +6 -7
  75. package/src/custom-element/demo/external-template.html +3 -3
  76. package/src/custom-element/demo/npm-versions-demo.html +21 -8
  77. package/src/custom-element/demo/npm-versions.html +54 -25
  78. package/src/custom-element/demo/s.xml +11 -21
  79. package/src/custom-element/demo/s.xslt +16 -74
  80. package/src/custom-element/demo/s1.xslt +59 -59
  81. package/src/custom-element/demo/ss.html +24 -57
  82. package/src/custom-element/demo/z.html +33 -62
  83. package/src/custom-element/demo/z.xml +59 -59
  84. package/src/custom-element/demo/z1.html +34 -0
  85. package/src/custom-element/ide/web-types-dce.json +1 -1
  86. package/src/custom-element/ide/web-types-xsl.json +1 -1
  87. package/src/custom-element/index.html +19 -2
  88. package/src/custom-element/local-storage.js +19 -14
  89. package/src/custom-element/module-url.js +3 -2
  90. package/src/dce-social-preview.png +0 -0
  91. package/src/material/angular.css +987 -0
  92. package/src/material/components/autocomplete.html +241 -0
  93. package/src/material/components/dropdown.html +115 -0
  94. package/src/material/components/menu.html +235 -0
  95. package/src/material/components.html +109 -0
  96. package/src/material/demo.css +31 -0
  97. package/src/material/index.html +169 -0
  98. package/src/material/material.css +357 -0
  99. package/src/material/theme/README.md +18 -0
  100. package/src/material/theme/semantic.css +112 -0
  101. package/src/mocks/versions.mock.ts +8 -8
  102. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  103. package/src/stories/attributes.test.stories.ts +6 -4
  104. package/src/stories/css.test.stories.ts +2 -0
  105. package/src/stories/dom-merge.test.stories.ts +11 -9
  106. package/src/stories/external-template.test.stories.ts +4 -3
  107. package/src/stories/form.test.stories.ts +2 -0
  108. package/src/stories/local-storage.test.stories.ts +63 -53
  109. package/src/stories/location-element.test.stories.ts +2 -0
  110. package/src/stories/module-url.test.stories.ts +2 -0
  111. package/src/stories/set-url.test.stories.ts +2 -0
  112. package/src/stories/slice-events.test.stories.ts +2 -0
  113. package/src/stories/slots.test.stories.ts +2 -0
  114. package/src/stories/version-select.test.stories.ts +2 -0
  115. package/src/sum.test.ts +5 -5
  116. package/src/sum.ts +3 -3
  117. package/storybook-static/assets/Color-ERTF36HU-ChyYtq0t.js +1 -0
  118. package/storybook-static/assets/Configure-CJVwFVjC.js +165 -0
  119. package/storybook-static/assets/DocsRenderer-CFRXHY34-Bz6q-OqD.js +2 -0
  120. package/storybook-static/assets/{attributes.test.stories-DIQXccHc.js → attributes.test.stories-BJBuuXgZ.js} +13 -14
  121. package/storybook-static/assets/{css.test.stories-BV2hi4CY.js → css.test.stories-pgbBc17d.js} +1 -1
  122. package/storybook-static/assets/custom-element-BDGsYgbP.js +97 -0
  123. package/storybook-static/assets/{dom-merge.test.stories-Dws0C2-g.js → dom-merge.test.stories-CXcYP_-J.js} +26 -24
  124. package/storybook-static/assets/entry-preview-C313OLrj.js +26 -0
  125. package/storybook-static/assets/{entry-preview-docs-BMKNVQXA.js → entry-preview-docs-B7ORr9w5.js} +2 -2
  126. package/storybook-static/assets/{external-template.test.stories-BHO48b0j.js → external-template.test.stories-CpJ68Ghy.js} +19 -20
  127. package/storybook-static/assets/{form.test.stories-dv9mwp24.js → form.test.stories-D35lyqd8.js} +2 -2
  128. package/storybook-static/assets/{handlers-CaCq2ZPF.js → handlers-B-OZtf2K.js} +13 -13
  129. package/storybook-static/assets/{http-request.stories-B2ke7LtS.js → http-request.stories-DccXgHyF.js} +6 -6
  130. package/storybook-static/assets/iframe-Ddc_axoC.js +2 -0
  131. package/storybook-static/assets/index-BSz1w4Gl.js +234 -0
  132. package/storybook-static/assets/index-BdcJ-iJ7.js +8 -0
  133. package/storybook-static/assets/index-CiCdFubk.js +634 -0
  134. package/storybook-static/assets/{index-Dz4OaB2k.js → index-f2MAjm2i.js} +1 -1
  135. package/storybook-static/assets/index-lY6s0fkU.js +1 -0
  136. package/storybook-static/assets/index-tfEkrhWr.js +1 -0
  137. package/storybook-static/assets/local-storage.test.stories-BY-PWhuk.js +420 -0
  138. package/storybook-static/assets/{location-element.test.stories-BiFvBop7.js → location-element.test.stories-3auBYEaU.js} +3 -3
  139. package/storybook-static/assets/{module-url.test.stories-BXoM34tX.js → module-url.test.stories-B7L9cL60.js} +6 -6
  140. package/storybook-static/assets/{preview-0Jj89qip.js → preview-BRPR-UXC.js} +1 -1
  141. package/storybook-static/assets/preview-BUQm51_C.js +52 -0
  142. package/storybook-static/assets/{preview-DB9FwMii.js → preview-BWzBA1C2.js} +1 -1
  143. package/storybook-static/assets/preview-BhhEZcNS.js +1 -0
  144. package/storybook-static/assets/preview-CcS4DQh8.js +1 -0
  145. package/storybook-static/assets/{preview-Cg7hXPRq.js → preview-CfH4_OzN.js} +2 -2
  146. package/storybook-static/assets/{preview-FpHGYA1q.js → preview-DHPc-V4N.js} +1 -1
  147. package/storybook-static/assets/preview-DYzi3Z2p.js +1 -0
  148. package/storybook-static/assets/{preview-4Up_z4Em.js → preview-caVMbCIR.js} +2 -2
  149. package/storybook-static/assets/preview-ncvtW_hb.js +34 -0
  150. package/storybook-static/assets/{set-url.test.stories-Cg5Z0r7x.js → set-url.test.stories-CuSuDLIx.js} +3 -3
  151. package/storybook-static/assets/{slice-events.test.stories-D_ttGp3g.js → slice-events.test.stories-BkRKsKem.js} +4 -4
  152. package/storybook-static/assets/{slots.test.stories-DBNXOm0T.js → slots.test.stories-BJCUWFkE.js} +8 -8
  153. package/storybook-static/assets/{version-select.test.stories-CgV3UCim.js → version-select.test.stories-B3ybJn_Z.js} +2 -2
  154. package/storybook-static/demo/a.svg +27 -0
  155. package/storybook-static/demo/demo.css +6 -7
  156. package/storybook-static/demo/external-template.html +3 -3
  157. package/storybook-static/demo/npm-versions-demo.html +21 -8
  158. package/storybook-static/demo/npm-versions.html +54 -25
  159. package/storybook-static/demo/s.xml +11 -21
  160. package/storybook-static/demo/s.xslt +16 -74
  161. package/storybook-static/demo/s1.xslt +59 -59
  162. package/storybook-static/demo/ss.html +24 -57
  163. package/storybook-static/demo/z.html +33 -62
  164. package/storybook-static/demo/z.xml +59 -59
  165. package/storybook-static/demo/z1.html +34 -0
  166. package/storybook-static/iframe.html +1 -1
  167. package/storybook-static/index.html +3 -7
  168. package/storybook-static/mockServiceWorker.js +1 -1
  169. package/storybook-static/project.json +1 -1
  170. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  171. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +9 -9
  172. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +76 -94
  173. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  174. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  175. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  176. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  177. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +211 -0
  178. package/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt +0 -0
  179. package/storybook-static/sb-manager/globals-module-info.js +11 -0
  180. package/storybook-static/sb-manager/globals-runtime.js +27803 -26928
  181. package/storybook-static/sb-manager/runtime.js +10341 -10136
  182. package/storybook-static/sb-preview/runtime.js +3841 -3828
  183. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  184. package/.idea/compiler.xml +0 -6
  185. package/.idea/custom-element-dist.iml +0 -13
  186. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  187. package/.idea/misc.xml +0 -6
  188. package/.idea/modules.xml +0 -8
  189. package/.idea/vcs.xml +0 -6
  190. package/.vscode/settings.json +0 -24
  191. package/dist/custom-element-CckoVsvO.cjs +0 -53
  192. package/dist/custom-element-b7c_7Kz4.js +0 -485
  193. package/dist/local-storage-Boafngui.cjs +0 -1
  194. package/dist/local-storage-BqDEu2kF.js +0 -59
  195. package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +0 -1
  196. package/storybook-static/assets/Configure-DFL_bm2M.js +0 -173
  197. package/storybook-static/assets/DocsRenderer-PKQXORMH-Bz-_1hmS.js +0 -2
  198. package/storybook-static/assets/custom-element-wn23PUwN.js +0 -231
  199. package/storybook-static/assets/entry-preview-BKQ8UCxI.js +0 -8
  200. package/storybook-static/assets/iframe-D4Sos1HO.js +0 -2
  201. package/storybook-static/assets/index-BnXBQqj9.js +0 -605
  202. package/storybook-static/assets/index-C8k3Z-3Y.js +0 -28
  203. package/storybook-static/assets/index-Cpxqn5iQ.js +0 -1
  204. package/storybook-static/assets/index-DGdNYaqV.js +0 -8
  205. package/storybook-static/assets/index-sm7QlJZE.js +0 -1
  206. package/storybook-static/assets/lit-element-DzhCn-8W.js +0 -19
  207. package/storybook-static/assets/local-storage.test.stories-BpogLNq-.js +0 -419
  208. package/storybook-static/assets/preview-BJPLiuSt.js +0 -1
  209. package/storybook-static/assets/preview-BMWqy4Bi.js +0 -1
  210. package/storybook-static/assets/preview-BnWGZYux.js +0 -1
  211. package/storybook-static/assets/preview-Djh1_Tal.js +0 -20
  212. package/storybook-static/assets/preview-oHxXRSIu.js +0 -48
  213. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +0 -333
  214. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +0 -40
  215. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +0 -234
  216. /package/{storybook-static/sb-addons/interactions-10/manager-bundle.js.LEGAL.txt → src/material/guide/getting-started/index.html} +0 -0
@@ -0,0 +1,565 @@
1
+ const W = "http://www.w3.org/1999/XSL/Transform", k = "http://www.w3.org/1999/xhtml", ue = "http://exslt.org/common", f = (e, l) => e.getAttribute?.(l), Z = (e) => e.nodeType === 3, de = (e) => typeof e == "string", pe = (e) => e && typeof e.nodeType == "number", $ = (e, l) => (e.ownerDocument || e).createTextNode(l), se = (e) => {
2
+ for (; e.firstChild; ) e.firstChild.remove();
3
+ return e;
4
+ }, V = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), se(e)), le = (e) => (e?.setAttribute("xmlns:xsl", W), e), ae = (e) => (e?.setAttribute("xmlns:xhtml", k), le(e)), ne = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), w = (e, l = "", t = document) => {
5
+ const s = (i) => ((r) => (l && r.append($(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(i));
6
+ if (ne(e))
7
+ return s(e);
8
+ const a = s("dce-object");
9
+ return a.setAttribute("dce-object-name", e), a;
10
+ }, J = (e, l) => {
11
+ const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
12
+ for (let s of e.attributes)
13
+ t.setAttribute(s.name, s.value);
14
+ for (; e.firstChild; )
15
+ t.append(e.firstChild);
16
+ return t;
17
+ };
18
+ function X(e) {
19
+ return new DOMParser().parseFromString(e, "application/xml");
20
+ }
21
+ function I(e) {
22
+ return new XMLSerializer().serializeToString(e);
23
+ }
24
+ function H(e, l, t, s) {
25
+ const a = (x) => e.ownerDocument.createElement(x), r = ((x, p, u) => (p.append(u = a(x)), u))(l, e);
26
+ return [...t].forEach((x) => r.append(s(x))), r;
27
+ }
28
+ function fe(e) {
29
+ return e.slot || (e.setAttribute || (e = w("span", e.textContent.replaceAll(`
30
+ `, ""))), e.setAttribute("slot", "")), e;
31
+ }
32
+ function K(e, l) {
33
+ e.getAttributeNames().forEach((t) => l.includes(t) || e.removeAttribute(t));
34
+ }
35
+ const Q = (e) => [...e].filter((l) => !(l.nodeType === 3 && l.data.trim() === ""));
36
+ function D(e, l, t) {
37
+ const s = typeof e;
38
+ if (s === "string")
39
+ return w(l, e, t);
40
+ if (s === "number")
41
+ return w(l, "" + e, t);
42
+ if (e instanceof Array) {
43
+ const i = w("array", "", t);
44
+ return e.map((r) => i.append(D(r, l, t))), i;
45
+ }
46
+ if (e instanceof FormData) {
47
+ const i = w("form-data", "", t);
48
+ for (const r of e)
49
+ i.append(D(r[1], r[0], t));
50
+ return i;
51
+ }
52
+ const a = w(l, "", t);
53
+ for (let i in e)
54
+ pe(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" && ne(i) ? a.setAttribute(i, e[i]) : a.append(D(e[i], i, t)));
55
+ return a;
56
+ }
57
+ function ee(e) {
58
+ if (L(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
59
+ const s = t.data, a = s.matchAll(/{([^}]*)}/g);
60
+ if (a) {
61
+ let i = 0, r = (p) => $(t, p), x = [];
62
+ if ([...a].forEach((p) => {
63
+ p.index > i && x.push(r(p.input.substring(i, p.index)));
64
+ const u = e.querySelector("value-of").cloneNode();
65
+ u.setAttribute("select", p[1]), x.push(u), i = p.index + p[0].length;
66
+ }), i < s.length && x.push(r(s.substring(i, s.length))), x.length) {
67
+ for (let p of x)
68
+ l.insertBefore(p, t);
69
+ l.removeChild(t);
70
+ }
71
+ }
72
+ })), "all" in e) {
73
+ let l = 1;
74
+ for (let t of e.all)
75
+ t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
76
+ }
77
+ return e;
78
+ }
79
+ function he(e, l = "xsl:stylesheet") {
80
+ if (e.tagName === l || e.documentElement?.tagName === l)
81
+ return ee(e);
82
+ const t = X(`<xsl:stylesheet version="1.0" xmlns:xsl="${W}" xmlns:xhtml="${k}" xmlns:exsl="${ue}" exclude-result-prefixes="exsl" >
83
+ <xsl:output method="xml"/>
84
+ <xsl:template match="/"><dce-root xmlns="${k}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
85
+ <xsl:template match="*[name()='template']">
86
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
87
+ </xsl:template>
88
+ <xsl:template match="*">
89
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
90
+ </xsl:template>
91
+ <xsl:template match="*[name()='svg']|*[name()='math']">
92
+ <xsl:apply-templates mode="sanitize" select="."/>
93
+ </xsl:template>
94
+ <xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
95
+ <xsl:copy>
96
+ <xsl:apply-templates mode="sanitize" select="@*"/>
97
+ <xsl:value-of select="text()"></xsl:value-of>
98
+ </xsl:copy>
99
+ </xsl:template>
100
+ <xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
101
+ <xsl:element name="{local-name()}">
102
+ <xsl:apply-templates mode="sanitize" select="@*"/>
103
+ <xsl:value-of select="text()"></xsl:value-of>
104
+ </xsl:element>
105
+ </xsl:template>
106
+ <xsl:template mode="sanitize" match="*|@*">
107
+ <xsl:copy>
108
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
109
+ </xsl:copy>
110
+ </xsl:template>
111
+ <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
112
+ <xsl:template mode="sanitize" match="text()">
113
+ <dce-text>
114
+ <xsl:copy/>
115
+ </dce-text>
116
+ </xsl:template>
117
+ <xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
118
+ <xsl:copy>
119
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
120
+ </xsl:copy>
121
+ </xsl:template>
122
+ <xsl:template mode="sanitize" match="xhtml:*">
123
+ <xsl:element name="{local-name()}">
124
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
125
+ </xsl:element>
126
+ </xsl:template>
127
+ <xsl:template mode="sanitize" match="xhtml:input">
128
+ <xsl:element name="{local-name()}">
129
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
130
+ </xsl:element>
131
+ <xsl:for-each select="*">
132
+ <xsl:copy>
133
+ <xsl:attribute name="for" >^</xsl:attribute>
134
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
135
+ </xsl:copy>
136
+ </xsl:for-each>
137
+ </xsl:template>
138
+ </xsl:stylesheet>`), s = new XSLTProcessor(), a = ((n) => {
139
+ L(n, "custom-element", (b) => {
140
+ b.firstElementChild.localName === "template" && ([...b.firstElementChild.content.childNodes].forEach((y) => b.append(y)), b.firstElementChild.remove());
141
+ }), L(n, "script", (b) => b.remove());
142
+ const c = n.content ?? n.firstElementChild?.content ?? n.body ?? n;
143
+ we.forEach((b) => L(c, b, (y) => Te(y, c)));
144
+ const N = n.firstElementChild?.content || n.content, E = (b) => {
145
+ const y = X("<xhtml/>"), M = y.importNode(b, !0);
146
+ return y.replaceChild(M, y.documentElement), ae(M);
147
+ };
148
+ if (N) {
149
+ const b = w("div");
150
+ return [...N.childNodes].map((y) => b.append(y.cloneNode(!0))), E(b);
151
+ }
152
+ return E(n.documentElement || n.body || n);
153
+ })(e), i = X(
154
+ `<xsl:stylesheet version="1.0"
155
+ xmlns:xsl="${W}"
156
+ xmlns:xhtml="${k}"
157
+ xmlns:dce="urn:schemas-epa-wg:dce"
158
+ xmlns:exsl="http://exslt.org/common"
159
+ exclude-result-prefixes="exsl"
160
+ >
161
+ <xsl:template match="ignore">
162
+ <xsl:choose>
163
+ <xsl:when test="//attr">{//attr}</xsl:when>
164
+ <xsl:otherwise>{def}</xsl:otherwise>
165
+ </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
166
+ <xsl:template mode="payload" match="attributes"></xsl:template>
167
+ <xsl:template match="/">
168
+ <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
169
+ </xsl:template>
170
+ <xsl:template name="slot" >
171
+ <xsl:param name="slotname" />
172
+ <xsl:param name="defaultvalue" />
173
+ <xsl:choose>
174
+ <xsl:when test="//payload/*[@slot=$slotname]">
175
+ <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
176
+ </xsl:when>
177
+ <xsl:otherwise>
178
+ <xsl:copy-of select="$defaultvalue"/>
179
+ </xsl:otherwise>
180
+ </xsl:choose>
181
+ </xsl:template>
182
+ <xsl:variable name="js-injected-body">
183
+ <xsl:call-template name="slot" >
184
+ <xsl:with-param name="slotname" select="''"/>
185
+ <xsl:with-param name="defaultvalue"/>
186
+ </xsl:call-template>
187
+ </xsl:variable>
188
+ </xsl:stylesheet>`
189
+ );
190
+ s.importStylesheet(t);
191
+ const r = s.transformToFragment(a, document), x = (n, c) => n.querySelector(c), p = x(i, 'template[mode="payload"]');
192
+ if (!r)
193
+ return console.error("transformation error", { xml: a.outerHTML, xsl: I(t) });
194
+ if (r.firstElementChild.localName !== "dce-root") {
195
+ const n = r.ownerDocument.createElement("dce-root");
196
+ [...r.childNodes].forEach((c) => n.append(c)), r.append(n);
197
+ }
198
+ const u = [];
199
+ [...r.querySelectorAll("dce-root>attribute")].forEach((n) => {
200
+ K(n, "namespace,name,select");
201
+ const c = J(n, "xsl:param"), N = f(n, "name");
202
+ p.append(c), K(c, "select,name");
203
+ let E = f(c, "select")?.split("??");
204
+ E || (E = ["//" + N, `'${c.textContent}'`], V(c), c.setAttribute("name", N));
205
+ let b;
206
+ if (E?.length > 1) {
207
+ c.removeAttribute("select");
208
+ const y = x(i, 'template[match="ignore"]>choose').cloneNode(!0);
209
+ V(y.firstElementChild).append($(y, "{" + E[0] + "}")), V(y.lastElementChild).append($(y, "{" + E[1] + "}")), y.firstElementChild.setAttribute("test", E[0]), c.append(y), b = y.cloneNode(!0);
210
+ } else
211
+ b = J(n, "xsl:value-of");
212
+ b.removeAttribute("name"), n.append(b), n.removeAttribute("select"), u.push(c);
213
+ }), [...r.querySelectorAll("[value]")].filter((n) => n.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((n) => {
214
+ const c = f(n, "value");
215
+ c && n.setAttribute("value", Ae(c));
216
+ });
217
+ for (const n of r.childNodes)
218
+ p.append(i.importNode(n, !0));
219
+ [...p.getElementsByTagName("xsl:template")].forEach((n) => p.ownerDocument.documentElement.append(n));
220
+ const q = x(i, 'call-template[name="slot"]'), d = (n) => {
221
+ const c = q.cloneNode(!0), N = f(n, "name");
222
+ N && c.firstElementChild.setAttribute("select", `'${N}'`);
223
+ for (let E of n.childNodes)
224
+ c.lastElementChild.append(E);
225
+ return c;
226
+ };
227
+ L(p, "slot", (n) => n.parentNode.replaceChild(d(n), n));
228
+ const m = ee(i);
229
+ return m.params = u, m;
230
+ }
231
+ async function xe(e) {
232
+ return await new Promise((t, s) => {
233
+ const a = new XMLHttpRequest();
234
+ a.open("GET", e), a.responseType = "document", a.onload = () => {
235
+ a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || w("div", a.responseText)) : s(`${a.statusText} - ${e}`);
236
+ }, a.addEventListener("error", (i) => s(i)), a.send();
237
+ });
238
+ }
239
+ function be(e, l, t = !1) {
240
+ if (e === l)
241
+ return !0;
242
+ if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
243
+ return t;
244
+ for (let s in e)
245
+ if (!(s in l) || !be(e[s], l[s]))
246
+ return t;
247
+ return !0;
248
+ }
249
+ const ie = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), ye = (e, l) => ie(l).map((t) => {
250
+ let s = e.ownerDocument, a = (i) => (e.append(i), i);
251
+ if (t.includes("/")) {
252
+ const i = [], r = s.evaluate(t, e);
253
+ for (let x; x = r.iterateNext(); )
254
+ i.push(x);
255
+ return i;
256
+ }
257
+ return [...e.childNodes].find((i) => i.localName === t) || a(w(t, "", s));
258
+ }).flat();
259
+ function te(e, l, t, s) {
260
+ if (!t.sliceProcessed)
261
+ return t.sliceProcessed = 1, ye(e, l ?? "").map((a) => {
262
+ const i = e.ownerDocument, r = t.sliceEventSource, x = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
263
+ if (r.getAttributeNames().map((u) => a.setAttribute(u, f(r, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append(D(t, "event", i)), x.hasAttribute("slice-value")) {
264
+ r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
265
+ const u = z(f(x, "slice-value"), a);
266
+ p(), a.append($(i, u));
267
+ } else {
268
+ if ("elements" in r)
269
+ return p(), a.append(D(new FormData(r), "value", a.ownerDocument)), a;
270
+ const u = r.value ?? f(r, "value");
271
+ p(), u == null ? [...a.childNodes].filter((T) => T.localName !== "event").map((T) => T.remove()) : de(u) ? a.append($(i, u)) : a.append(D(u, "value", a.ownerDocument));
272
+ }
273
+ return a;
274
+ });
275
+ }
276
+ function L(e, l, t) {
277
+ e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
278
+ }
279
+ const ge = async (e, l) => {
280
+ if (!e || !e.trim())
281
+ return [l];
282
+ if (e.startsWith("#"))
283
+ return ((t) => {
284
+ const s = t.querySelectorAll(e);
285
+ return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
286
+ })(l.parentElement);
287
+ try {
288
+ const [t, s] = e.split("#");
289
+ if (e.charAt(0) === ".")
290
+ e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
291
+ else
292
+ try {
293
+ e = import.meta.resolve(t), s && (e += "#" + s);
294
+ } catch (i) {
295
+ console.error(i.message);
296
+ }
297
+ const a = await xe(e);
298
+ if (l.setAttributeNS("xml", "base", e), s) {
299
+ const i = a.querySelectorAll("#" + s);
300
+ return i.length ? [...i] : (console.error("template not found", e + "#" + s), [l]);
301
+ }
302
+ return [a];
303
+ } catch {
304
+ return [l];
305
+ }
306
+ };
307
+ function ve(e, l) {
308
+ for (let t of e.attributes)
309
+ t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
310
+ }
311
+ function oe(e, l = 0) {
312
+ const t = {};
313
+ for (const s of e.childNodes) {
314
+ const a = f(s, "data-dce-id") || s.dceId || 0;
315
+ if (!t[a])
316
+ a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
317
+ else {
318
+ const i = s.dceId = a + "-" + t[a]++;
319
+ s.setAttribute && s.setAttribute("data-dce-id", i);
320
+ }
321
+ s.childNodes.length && oe(s);
322
+ }
323
+ }
324
+ function Ee(e, l, t) {
325
+ t = 1 * t;
326
+ for (let s of e.childNodes)
327
+ if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
328
+ return e.insertBefore(l, s);
329
+ e.append(l);
330
+ }
331
+ function re(e, l) {
332
+ if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
333
+ return;
334
+ if (!l.length)
335
+ return e.firstElementChild?.localName !== "dce-root" && se(e);
336
+ const t = {};
337
+ for (let s of e.childNodes)
338
+ t[s.dceId], Z(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[f(s, "data-dce-id") || 0] = s;
339
+ for (let s of [...l]) {
340
+ const a = f(s, "data-dce-id") || s.dceId, i = t[a];
341
+ i ? (Z(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (ve(s, i), (i.childNodes.length || s.childNodes.length) && re(i, s.childNodes)), delete t[a]) : Ee(e, s, a);
342
+ }
343
+ for (let s of Object.values(t))
344
+ s.localName !== "dce-root" && s.remove();
345
+ }
346
+ function Ne(e, l) {
347
+ return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
348
+ }
349
+ const Ae = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${Y(t[3])}}${t[4]}`).join(""), Y = (e) => {
350
+ if (!e.trim())
351
+ return e;
352
+ const l = e.split("??"), t = l.shift(), s = Y(l.join("??"));
353
+ return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
354
+ }, z = (e, l) => {
355
+ const t = e.split("??");
356
+ if (t.length > 1)
357
+ return z(t[0], l) || z(t[1], l);
358
+ e = Y(e);
359
+ const s = l.ownerDocument.evaluate(e, l);
360
+ switch (s.resultType) {
361
+ case XPathResult.NUMBER_TYPE:
362
+ return s.numberValue;
363
+ case XPathResult.STRING_TYPE:
364
+ return s.stringValue;
365
+ case XPathResult.BOOLEAN_TYPE:
366
+ return s.booleanValue;
367
+ }
368
+ let a = "";
369
+ for (let i; i = s.iterateNext(); )
370
+ a += i.textContent;
371
+ return a;
372
+ }, we = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), Te = (e, l) => {
373
+ const t = w("xsl:" + e.localName);
374
+ for (let s of e.attributes)
375
+ t.setAttribute(s.name, s.value);
376
+ for (; e.firstChild; )
377
+ t.append(e.firstChild);
378
+ if (e.parentElement)
379
+ e.parentElement.replaceChild(t, e);
380
+ else {
381
+ const s = e.parentElement || l, a = [...s.childNodes];
382
+ a.forEach((i, r) => {
383
+ i === e && (a[r] = t);
384
+ }), s.replaceChildren(...a);
385
+ }
386
+ };
387
+ class Se extends HTMLElement {
388
+ static observedAttributes = ["src", "tag", "hidden"];
389
+ async connectedCallback() {
390
+ this.firstElementChild && this.firstElementChild.localName !== "template" && console.warn(`custom-element used without template wrapping content
391
+ `, this.outerHTML);
392
+ const l = await ge(f(this, "src"), this), t = f(this, "tag"), s = t || "dce-" + crypto.randomUUID();
393
+ for (const d of l)
394
+ L(d.templateNode || d.content || d, "style", (m) => {
395
+ const n = m.closest("slot"), c = n ? `slot[name="${n.name}"]` : "";
396
+ m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
397
+ });
398
+ const a = l.map((d) => he(d)), i = a.map((d, m) => {
399
+ m = new XSLTProcessor();
400
+ try {
401
+ m.importStylesheet(d);
402
+ } catch (n) {
403
+ console.error(n, I(d));
404
+ }
405
+ return m;
406
+ });
407
+ Object.defineProperty(this, "xsltString", { get: () => a.map((d) => I(d)).join(`
408
+ `) });
409
+ const r = this, x = [...this.templateNode.querySelectorAll("[slice]")], p = x.map((d) => f(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, n) => n.indexOf(d) === m).map(ie).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
410
+ class T extends HTMLElement {
411
+ static get observedAttributes() {
412
+ return u.map((m) => f(m, "name"));
413
+ }
414
+ #e = 0;
415
+ connectedCallback() {
416
+ let m = Q(this.childNodes);
417
+ if (this.firstElementChild?.tagName === "TEMPLATE") {
418
+ this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
419
+ const h = this.firstElementChild;
420
+ h.remove(), m = Q(h.content.childNodes);
421
+ for (const g of m)
422
+ if (g.localName === "style") {
423
+ const o = Ne(this, "data-dce-style");
424
+ g.innerHTML = `${s}[data-dce-style="${o}"]{${g.innerHTML}}`, h.insertAdjacentElement("beforebegin", g);
425
+ } else
426
+ g.nodeType === 1 ? h.insertAdjacentElement("beforebegin", g) : g.nodeType === 3 && h.insertAdjacentText("beforebegin", g.data);
427
+ }
428
+ const n = X("<datadom/>").documentElement, c = (h, g = "") => ((o) => (g && o.append($(n, g)), o))(n.ownerDocument.createElement(h)), N = H(n, "payload", m, fe);
429
+ le(N), ae(N), this.innerHTML = "";
430
+ const E = H(n, "attributes", this.attributes, (h) => c(h.nodeName, h.value));
431
+ H(n, "dataset", Object.keys(this.dataset), (h) => c(h, this.dataset[h]));
432
+ const b = H(n, "slice", p, (h) => c(h, "")), y = (h) => z(h, b);
433
+ this.xml = n;
434
+ const M = [], G = () => {
435
+ const h = {};
436
+ for (let g; g = M.pop(); ) {
437
+ const o = f(g.sliceElement, "slice");
438
+ h[o] || (te(b, o, g), h[o] = g);
439
+ }
440
+ Object.keys(h).length !== 0 && U();
441
+ };
442
+ let O;
443
+ this.onSlice = (h) => {
444
+ M.push(h), O || (O = setTimeout(() => {
445
+ G(), O = 0;
446
+ }, 1));
447
+ };
448
+ const U = this.transform = () => {
449
+ if (this.#e)
450
+ debugger;
451
+ this.#e = 1, i.map((o, v) => {
452
+ const S = o.transformToFragment(n.ownerDocument, document);
453
+ return S || console.error(`XSLT transformation error. xsl:
454
+ `, I(a[v]), `
455
+ xml:
456
+ `, I(n)), S;
457
+ }).map((o) => {
458
+ o && (oe(o), re(this, o.childNodes));
459
+ }), T.observedAttributes.map((o) => {
460
+ let v = f(this.firstElementChild, o);
461
+ v !== f(this, o) && (this.setAttribute(o, v), this.#t(o, v));
462
+ });
463
+ function g(o) {
464
+ let v = o;
465
+ if (o.localName === "slice") {
466
+ const S = f(o, "for");
467
+ if (S || (v = o.parentElement), S === "^")
468
+ do
469
+ v = v.previousElementSibling;
470
+ while (v.localName === "slice");
471
+ else
472
+ v = this.querySelector(S);
473
+ if (!v)
474
+ return console.warn(`can not find selector in "slice for=${S}" `, o.outerHTML);
475
+ f(o, "slice") || o.setAttribute("slice", f(o, "name"));
476
+ }
477
+ return v;
478
+ }
479
+ L(this, "[slice],[slice-event]", (o) => {
480
+ let v = f(o, "slice-event");
481
+ const S = o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value, j = g(o);
482
+ o.dceInitialized || (o.dceInitialized = 1, j.hasAttribute("custom-validity") && (v += " change submit"), [...new Set((v || "change").split(" "))].forEach((ce) => j.addEventListener(ce, (A) => {
483
+ A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target, A.sliceProcessed = 0;
484
+ const me = te(b, f(A.sliceElement, "slice"), A);
485
+ L(this, "[custom-validity]", (P) => {
486
+ if (!P.setCustomValidity)
487
+ return;
488
+ const F = f(P, "custom-validity");
489
+ try {
490
+ const R = F && z(F, E);
491
+ P.setCustomValidity(R === !0 ? "" : R === !1 ? "invalid" : R);
492
+ } catch (R) {
493
+ console.error(R, "xPath", F);
494
+ }
495
+ });
496
+ const _ = f(j, "custom-validity"), C = _ && z(_, E), B = C === !0 ? "" : C;
497
+ if (_) {
498
+ if (o.setCustomValidity ? o.setCustomValidity(B) : o.validationMessage = B, me.map((P) => P.setAttribute("validation-message", B)), A.type === "submit")
499
+ return C === !0 ? void 0 : (setTimeout(U, 1), !!C === C ? (C || A.preventDefault(), C) : C ? (A.preventDefault(), !1) : void 0);
500
+ setTimeout(U, 1);
501
+ }
502
+ this.onSlice(A);
503
+ })), (!v || v.includes("init")) && (S ? this.onSlice({ type: "init", target: j, sliceElement: o, sliceEventSource: j }) : o.value = y(f(o, "slice"))));
504
+ }), this.#e = 0;
505
+ };
506
+ U(), G();
507
+ }
508
+ #t(m, n) {
509
+ m === "value" && (this.value = n);
510
+ let c = this.xml.querySelector(`attributes>${m}`);
511
+ c ? V(c).append($(c, n)) : (c = w(m, n, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: n } }));
512
+ }
513
+ attributeChangedCallback(m, n, c) {
514
+ !this.xml || this.#e || (this.#t(m, c), this.transform());
515
+ }
516
+ get dce() {
517
+ return r;
518
+ }
519
+ }
520
+ const q = (d) => {
521
+ window.customElements.get(d) !== T && window.customElements.define(d, T);
522
+ };
523
+ if (t)
524
+ q(t);
525
+ else {
526
+ const d = s;
527
+ this.setAttribute("tag", d), q(d);
528
+ const m = document.createElement(d);
529
+ this.getAttributeNames().forEach((n) => m.setAttribute(n, this.getAttribute(n))), m.append(...[...this.childNodes].filter((n) => n.localName !== "style")), this.append(m);
530
+ }
531
+ }
532
+ get templateNode() {
533
+ return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
534
+ }
535
+ get dce() {
536
+ return this;
537
+ }
538
+ get xslt() {
539
+ return X(this.xsltString);
540
+ }
541
+ }
542
+ window.customElements.define("custom-element", Se);
543
+ export {
544
+ Se as C,
545
+ I as a,
546
+ xe as b,
547
+ he as c,
548
+ be as d,
549
+ ye as e,
550
+ te as f,
551
+ oe as g,
552
+ Ee as h,
553
+ re as i,
554
+ Ne as j,
555
+ Ae as k,
556
+ Y as l,
557
+ ve as m,
558
+ z as n,
559
+ D as o,
560
+ we as p,
561
+ Te as q,
562
+ Q as s,
563
+ ee as t,
564
+ X as x
565
+ };