@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.
- package/.storybook/main.ts +2 -2
- package/.storybook/preview.ts +1 -1
- package/README.md +4 -4
- package/bin/vitest/vitest-browser-importmaps.mjs +20 -20
- package/coverage/coverage-final.json +22 -22
- package/coverage/index.html +26 -26
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +662 -380
- package/coverage/src/custom-element/demo/index.html +1 -1
- package/coverage/src/custom-element/demo/z.js.html +1 -1
- package/coverage/src/custom-element/http-request.js.html +12 -12
- package/coverage/src/custom-element/index.html +21 -21
- package/coverage/src/custom-element/local-storage.js.html +78 -63
- package/coverage/src/custom-element/location-element.js.html +4 -4
- package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
- package/coverage/src/custom-element/module-url.js.html +16 -10
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/attributes.test.stories.ts.html +17 -11
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts.html +8 -2
- package/coverage/src/stories/dom-merge.test.stories.ts.html +17 -11
- package/coverage/src/stories/external-template.test.stories.ts.html +13 -10
- package/coverage/src/stories/form.test.stories.ts.html +8 -2
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +26 -26
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/local-storage.test.stories.ts.html +106 -76
- package/coverage/src/stories/location-element.test.stories.ts.html +8 -2
- package/coverage/src/stories/module-url.test.stories.ts.html +8 -2
- package/coverage/src/stories/set-url.test.stories.ts.html +8 -2
- package/coverage/src/stories/slice-events.test.stories.ts.html +8 -2
- package/coverage/src/stories/slots.test.stories.ts.html +8 -2
- package/coverage/src/stories/testStoryBook.ts.html +12 -12
- package/coverage/src/stories/version-select.test.stories.ts.html +8 -2
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-BOIPgtxz.js +565 -0
- package/dist/custom-element-CUsSENWc.cjs +97 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +25 -21
- package/dist/demo/a.svg +27 -0
- package/dist/demo/demo.css +6 -7
- package/dist/demo/external-template.html +3 -3
- package/dist/demo/npm-versions-demo.html +21 -8
- package/dist/demo/npm-versions.html +54 -25
- package/dist/demo/s.xml +11 -21
- package/dist/demo/s.xslt +16 -74
- package/dist/demo/s1.xslt +59 -59
- package/dist/demo/ss.html +24 -57
- package/dist/demo/z.html +33 -62
- package/dist/demo/z.xml +59 -59
- package/dist/demo/z1.html +34 -0
- package/dist/local-storage-78EivJ_B.cjs +1 -0
- package/dist/local-storage-DzmNKzgN.js +66 -0
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +27 -25
- package/public/demo/a.svg +27 -0
- package/public/demo/demo.css +6 -7
- package/public/demo/external-template.html +3 -3
- package/public/demo/npm-versions-demo.html +21 -8
- package/public/demo/npm-versions.html +54 -25
- package/public/demo/s.xml +11 -21
- package/public/demo/s.xslt +16 -74
- package/public/demo/s1.xslt +59 -59
- package/public/demo/ss.html +24 -57
- package/public/demo/z.html +33 -62
- package/public/demo/z.xml +59 -59
- package/public/demo/z1.html +34 -0
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.js +123 -29
- package/src/custom-element/demo/a.svg +27 -0
- package/src/custom-element/demo/demo.css +6 -7
- package/src/custom-element/demo/external-template.html +3 -3
- package/src/custom-element/demo/npm-versions-demo.html +21 -8
- package/src/custom-element/demo/npm-versions.html +54 -25
- package/src/custom-element/demo/s.xml +11 -21
- package/src/custom-element/demo/s.xslt +16 -74
- package/src/custom-element/demo/s1.xslt +59 -59
- package/src/custom-element/demo/ss.html +24 -57
- package/src/custom-element/demo/z.html +33 -62
- package/src/custom-element/demo/z.xml +59 -59
- package/src/custom-element/demo/z1.html +34 -0
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +19 -2
- package/src/custom-element/local-storage.js +19 -14
- package/src/custom-element/module-url.js +3 -2
- package/src/dce-social-preview.png +0 -0
- package/src/material/angular.css +987 -0
- package/src/material/components/autocomplete.html +241 -0
- package/src/material/components/dropdown.html +115 -0
- package/src/material/components/menu.html +235 -0
- package/src/material/components.html +109 -0
- package/src/material/demo.css +31 -0
- package/src/material/index.html +169 -0
- package/src/material/material.css +357 -0
- package/src/material/theme/README.md +18 -0
- package/src/material/theme/semantic.css +112 -0
- package/src/mocks/versions.mock.ts +8 -8
- package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +6 -4
- package/src/stories/css.test.stories.ts +2 -0
- package/src/stories/dom-merge.test.stories.ts +11 -9
- package/src/stories/external-template.test.stories.ts +4 -3
- package/src/stories/form.test.stories.ts +2 -0
- package/src/stories/local-storage.test.stories.ts +63 -53
- package/src/stories/location-element.test.stories.ts +2 -0
- package/src/stories/module-url.test.stories.ts +2 -0
- package/src/stories/set-url.test.stories.ts +2 -0
- package/src/stories/slice-events.test.stories.ts +2 -0
- package/src/stories/slots.test.stories.ts +2 -0
- package/src/stories/version-select.test.stories.ts +2 -0
- package/src/sum.test.ts +5 -5
- package/src/sum.ts +3 -3
- package/storybook-static/assets/Color-ERTF36HU-ChyYtq0t.js +1 -0
- package/storybook-static/assets/Configure-CJVwFVjC.js +165 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Bz6q-OqD.js +2 -0
- package/storybook-static/assets/{attributes.test.stories-DIQXccHc.js → attributes.test.stories-BJBuuXgZ.js} +13 -14
- package/storybook-static/assets/{css.test.stories-BV2hi4CY.js → css.test.stories-pgbBc17d.js} +1 -1
- package/storybook-static/assets/custom-element-BDGsYgbP.js +97 -0
- package/storybook-static/assets/{dom-merge.test.stories-Dws0C2-g.js → dom-merge.test.stories-CXcYP_-J.js} +26 -24
- package/storybook-static/assets/entry-preview-C313OLrj.js +26 -0
- package/storybook-static/assets/{entry-preview-docs-BMKNVQXA.js → entry-preview-docs-B7ORr9w5.js} +2 -2
- package/storybook-static/assets/{external-template.test.stories-BHO48b0j.js → external-template.test.stories-CpJ68Ghy.js} +19 -20
- package/storybook-static/assets/{form.test.stories-dv9mwp24.js → form.test.stories-D35lyqd8.js} +2 -2
- package/storybook-static/assets/{handlers-CaCq2ZPF.js → handlers-B-OZtf2K.js} +13 -13
- package/storybook-static/assets/{http-request.stories-B2ke7LtS.js → http-request.stories-DccXgHyF.js} +6 -6
- package/storybook-static/assets/iframe-Ddc_axoC.js +2 -0
- package/storybook-static/assets/index-BSz1w4Gl.js +234 -0
- package/storybook-static/assets/index-BdcJ-iJ7.js +8 -0
- package/storybook-static/assets/index-CiCdFubk.js +634 -0
- package/storybook-static/assets/{index-Dz4OaB2k.js → index-f2MAjm2i.js} +1 -1
- package/storybook-static/assets/index-lY6s0fkU.js +1 -0
- package/storybook-static/assets/index-tfEkrhWr.js +1 -0
- package/storybook-static/assets/local-storage.test.stories-BY-PWhuk.js +420 -0
- package/storybook-static/assets/{location-element.test.stories-BiFvBop7.js → location-element.test.stories-3auBYEaU.js} +3 -3
- package/storybook-static/assets/{module-url.test.stories-BXoM34tX.js → module-url.test.stories-B7L9cL60.js} +6 -6
- package/storybook-static/assets/{preview-0Jj89qip.js → preview-BRPR-UXC.js} +1 -1
- package/storybook-static/assets/preview-BUQm51_C.js +52 -0
- package/storybook-static/assets/{preview-DB9FwMii.js → preview-BWzBA1C2.js} +1 -1
- package/storybook-static/assets/preview-BhhEZcNS.js +1 -0
- package/storybook-static/assets/preview-CcS4DQh8.js +1 -0
- package/storybook-static/assets/{preview-Cg7hXPRq.js → preview-CfH4_OzN.js} +2 -2
- package/storybook-static/assets/{preview-FpHGYA1q.js → preview-DHPc-V4N.js} +1 -1
- package/storybook-static/assets/preview-DYzi3Z2p.js +1 -0
- package/storybook-static/assets/{preview-4Up_z4Em.js → preview-caVMbCIR.js} +2 -2
- package/storybook-static/assets/preview-ncvtW_hb.js +34 -0
- package/storybook-static/assets/{set-url.test.stories-Cg5Z0r7x.js → set-url.test.stories-CuSuDLIx.js} +3 -3
- package/storybook-static/assets/{slice-events.test.stories-D_ttGp3g.js → slice-events.test.stories-BkRKsKem.js} +4 -4
- package/storybook-static/assets/{slots.test.stories-DBNXOm0T.js → slots.test.stories-BJCUWFkE.js} +8 -8
- package/storybook-static/assets/{version-select.test.stories-CgV3UCim.js → version-select.test.stories-B3ybJn_Z.js} +2 -2
- package/storybook-static/demo/a.svg +27 -0
- package/storybook-static/demo/demo.css +6 -7
- package/storybook-static/demo/external-template.html +3 -3
- package/storybook-static/demo/npm-versions-demo.html +21 -8
- package/storybook-static/demo/npm-versions.html +54 -25
- package/storybook-static/demo/s.xml +11 -21
- package/storybook-static/demo/s.xslt +16 -74
- package/storybook-static/demo/s1.xslt +59 -59
- package/storybook-static/demo/ss.html +24 -57
- package/storybook-static/demo/z.html +33 -62
- package/storybook-static/demo/z.xml +59 -59
- package/storybook-static/demo/z1.html +34 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +3 -7
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +9 -9
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +76 -94
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-9/manager-bundle.js +211 -0
- package/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +11 -0
- package/storybook-static/sb-manager/globals-runtime.js +27803 -26928
- package/storybook-static/sb-manager/runtime.js +10341 -10136
- package/storybook-static/sb-preview/runtime.js +3841 -3828
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/compiler.xml +0 -6
- package/.idea/custom-element-dist.iml +0 -13
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.vscode/settings.json +0 -24
- package/dist/custom-element-CckoVsvO.cjs +0 -53
- package/dist/custom-element-b7c_7Kz4.js +0 -485
- package/dist/local-storage-Boafngui.cjs +0 -1
- package/dist/local-storage-BqDEu2kF.js +0 -59
- package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +0 -1
- package/storybook-static/assets/Configure-DFL_bm2M.js +0 -173
- package/storybook-static/assets/DocsRenderer-PKQXORMH-Bz-_1hmS.js +0 -2
- package/storybook-static/assets/custom-element-wn23PUwN.js +0 -231
- package/storybook-static/assets/entry-preview-BKQ8UCxI.js +0 -8
- package/storybook-static/assets/iframe-D4Sos1HO.js +0 -2
- package/storybook-static/assets/index-BnXBQqj9.js +0 -605
- package/storybook-static/assets/index-C8k3Z-3Y.js +0 -28
- package/storybook-static/assets/index-Cpxqn5iQ.js +0 -1
- package/storybook-static/assets/index-DGdNYaqV.js +0 -8
- package/storybook-static/assets/index-sm7QlJZE.js +0 -1
- package/storybook-static/assets/lit-element-DzhCn-8W.js +0 -19
- package/storybook-static/assets/local-storage.test.stories-BpogLNq-.js +0 -419
- package/storybook-static/assets/preview-BJPLiuSt.js +0 -1
- package/storybook-static/assets/preview-BMWqy4Bi.js +0 -1
- package/storybook-static/assets/preview-BnWGZYux.js +0 -1
- package/storybook-static/assets/preview-Djh1_Tal.js +0 -20
- package/storybook-static/assets/preview-oHxXRSIu.js +0 -48
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +0 -333
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +0 -40
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js +0 -234
- /package/{storybook-static/sb-addons/interactions-10/manager-bundle.js.LEGAL.txt → src/material/guide/getting-started/index.html} +0 -0
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, oe = (e) => typeof e == "string", re = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
|
-
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
|
-
return e;
|
|
4
|
-
}, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", q), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), N = (e, l = "", t = document) => {
|
|
5
|
-
const s = (n) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(n));
|
|
6
|
-
if (te(e))
|
|
7
|
-
return s(e);
|
|
8
|
-
const a = s("dce-object");
|
|
9
|
-
return a.setAttribute("dce-object-name", e), a;
|
|
10
|
-
}, G = (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 M(e) {
|
|
19
|
-
return new DOMParser().parseFromString(e, "application/xml");
|
|
20
|
-
}
|
|
21
|
-
function H(e) {
|
|
22
|
-
return new XMLSerializer().serializeToString(e);
|
|
23
|
-
}
|
|
24
|
-
function X(e, l, t, s) {
|
|
25
|
-
const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, u) => (p.append(u = a(h)), u))(l, e);
|
|
26
|
-
return [...t].forEach((h) => r.append(s(h))), r;
|
|
27
|
-
}
|
|
28
|
-
function ce(e) {
|
|
29
|
-
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
30
|
-
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
|
-
}
|
|
32
|
-
function $(e, l, t) {
|
|
33
|
-
const s = typeof e;
|
|
34
|
-
if (s === "string")
|
|
35
|
-
return N(l, e, t);
|
|
36
|
-
if (s === "number")
|
|
37
|
-
return N(l, "" + e, t);
|
|
38
|
-
if (e instanceof Array) {
|
|
39
|
-
const n = N("array", "", t);
|
|
40
|
-
return e.map((r) => n.append($(r, l, t))), n;
|
|
41
|
-
}
|
|
42
|
-
if (e instanceof FormData) {
|
|
43
|
-
const n = N("form-data", "", t);
|
|
44
|
-
for (const r of e)
|
|
45
|
-
n.append($(r[1], r[0], t));
|
|
46
|
-
return n;
|
|
47
|
-
}
|
|
48
|
-
const a = N(l, "", t);
|
|
49
|
-
for (let n in e)
|
|
50
|
-
re(e[n]) || typeof e[n] == "function" || e[n] instanceof Window || (typeof e[n] != "object" && te(n) ? a.setAttribute(n, e[n]) : a.append($(e[n], n, t)));
|
|
51
|
-
return a;
|
|
52
|
-
}
|
|
53
|
-
function Z(e) {
|
|
54
|
-
if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
55
|
-
const s = t.data, a = s.matchAll(/{([^}]*)}/g);
|
|
56
|
-
if (a) {
|
|
57
|
-
let n = 0, r = (p) => S(t, p), h = [];
|
|
58
|
-
if ([...a].forEach((p) => {
|
|
59
|
-
p.index > n && h.push(r(p.input.substring(n, p.index)));
|
|
60
|
-
const u = e.querySelector("value-of").cloneNode();
|
|
61
|
-
u.setAttribute("select", p[1]), h.push(u), n = p.index + p[0].length;
|
|
62
|
-
}), n < s.length && h.push(r(s.substring(n, s.length))), h.length) {
|
|
63
|
-
for (let p of h)
|
|
64
|
-
l.insertBefore(p, t);
|
|
65
|
-
l.removeChild(t);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
})), "all" in e) {
|
|
69
|
-
let l = 1;
|
|
70
|
-
for (let t of e.all)
|
|
71
|
-
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
72
|
-
}
|
|
73
|
-
return e;
|
|
74
|
-
}
|
|
75
|
-
function me(e, l = "xsl:stylesheet") {
|
|
76
|
-
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
77
|
-
return Z(e);
|
|
78
|
-
const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${q}" xmlns:exsl="${ie}" exclude-result-prefixes="exsl" >
|
|
79
|
-
<xsl:output method="xml" />
|
|
80
|
-
<xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
|
|
81
|
-
<xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
82
|
-
<xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
83
|
-
<xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
|
|
84
|
-
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]"><xsl:copy><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:copy></xsl:template>
|
|
85
|
-
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:element></xsl:template>
|
|
86
|
-
<xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
|
|
87
|
-
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
88
|
-
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
89
|
-
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']"><dce-text><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></dce-text></xsl:template>
|
|
90
|
-
<xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
|
|
91
|
-
</xsl:stylesheet>`), s = new XSLTProcessor(), a = ((i) => {
|
|
92
|
-
C(i, "script", (y) => y.remove());
|
|
93
|
-
const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
|
|
94
|
-
ve.forEach((y) => C(c, y, (v) => ge(v, c)));
|
|
95
|
-
const E = i.firstElementChild?.content || i.content, g = (y) => {
|
|
96
|
-
const v = M("<xhtml/>"), D = v.importNode(y, !0);
|
|
97
|
-
return v.replaceChild(D, v.documentElement), ee(D);
|
|
98
|
-
};
|
|
99
|
-
if (E) {
|
|
100
|
-
const y = N("div");
|
|
101
|
-
return [...E.childNodes].map((v) => y.append(v.cloneNode(!0))), g(y);
|
|
102
|
-
}
|
|
103
|
-
return g(i.documentElement || i.body || i);
|
|
104
|
-
})(e), n = M(
|
|
105
|
-
`<xsl:stylesheet version="1.0"
|
|
106
|
-
xmlns:xsl="${B}"
|
|
107
|
-
xmlns:xhtml="${q}"
|
|
108
|
-
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
109
|
-
xmlns:exsl="http://exslt.org/common"
|
|
110
|
-
exclude-result-prefixes="exsl"
|
|
111
|
-
>
|
|
112
|
-
<xsl:template match="ignore">
|
|
113
|
-
<xsl:choose>
|
|
114
|
-
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
115
|
-
<xsl:otherwise>{def}</xsl:otherwise>
|
|
116
|
-
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
117
|
-
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
118
|
-
<xsl:template match="/">
|
|
119
|
-
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
120
|
-
</xsl:template>
|
|
121
|
-
<xsl:template name="slot" >
|
|
122
|
-
<xsl:param name="slotname" />
|
|
123
|
-
<xsl:param name="defaultvalue" />
|
|
124
|
-
<xsl:choose>
|
|
125
|
-
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
126
|
-
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
127
|
-
</xsl:when>
|
|
128
|
-
<xsl:otherwise>
|
|
129
|
-
<xsl:copy-of select="$defaultvalue"/>
|
|
130
|
-
</xsl:otherwise>
|
|
131
|
-
</xsl:choose>
|
|
132
|
-
</xsl:template>
|
|
133
|
-
<xsl:variable name="js-injected-body">
|
|
134
|
-
<xsl:call-template name="slot" >
|
|
135
|
-
<xsl:with-param name="slotname" select="''"/>
|
|
136
|
-
<xsl:with-param name="defaultvalue"/>
|
|
137
|
-
</xsl:call-template>
|
|
138
|
-
</xsl:variable>
|
|
139
|
-
</xsl:stylesheet>`
|
|
140
|
-
);
|
|
141
|
-
s.importStylesheet(t);
|
|
142
|
-
const r = s.transformToFragment(a, document), h = (i, c) => i.querySelector(c), p = h(n, 'template[mode="payload"]');
|
|
143
|
-
if (!r)
|
|
144
|
-
return console.error("transformation error", { xml: a.outerHTML, xsl: H(t) });
|
|
145
|
-
const u = [];
|
|
146
|
-
[...r.querySelectorAll("dce-root>attribute")].forEach((i) => {
|
|
147
|
-
const c = G(i, "xsl:param"), E = x(i, "name");
|
|
148
|
-
p.append(c);
|
|
149
|
-
let g = x(c, "select")?.split("??");
|
|
150
|
-
g || (g = ["//" + E, `'${c.textContent}'`], U(c), c.setAttribute("name", E));
|
|
151
|
-
let y;
|
|
152
|
-
if (g?.length > 1) {
|
|
153
|
-
c.removeAttribute("select");
|
|
154
|
-
const v = h(n, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
155
|
-
U(v.firstElementChild).append(S(v, "{" + g[0] + "}")), U(v.lastElementChild).append(S(v, "{" + g[1] + "}")), v.firstElementChild.setAttribute("test", g[0]), c.append(v), y = v.cloneNode(!0);
|
|
156
|
-
} else
|
|
157
|
-
y = G(i, "xsl:value-of");
|
|
158
|
-
y.removeAttribute("name"), i.append(y), i.removeAttribute("select"), u.push(c);
|
|
159
|
-
}), [...r.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
|
|
160
|
-
const c = x(i, "value");
|
|
161
|
-
c && i.setAttribute("value", ye(c));
|
|
162
|
-
});
|
|
163
|
-
for (const i of r.childNodes)
|
|
164
|
-
p.append(n.importNode(i, !0));
|
|
165
|
-
[...p.getElementsByTagName("xsl:template")].forEach((i) => p.ownerDocument.documentElement.append(i));
|
|
166
|
-
const P = h(n, 'call-template[name="slot"]'), d = (i) => {
|
|
167
|
-
const c = P.cloneNode(!0), E = x(i, "name");
|
|
168
|
-
E && c.firstElementChild.setAttribute("select", `'${E}'`);
|
|
169
|
-
for (let g of i.childNodes)
|
|
170
|
-
c.lastElementChild.append(g);
|
|
171
|
-
return c;
|
|
172
|
-
};
|
|
173
|
-
C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
|
|
174
|
-
const m = Z(n);
|
|
175
|
-
return m.params = u, m;
|
|
176
|
-
}
|
|
177
|
-
async function ue(e) {
|
|
178
|
-
return await new Promise((t, s) => {
|
|
179
|
-
const a = new XMLHttpRequest();
|
|
180
|
-
a.open("GET", e), a.responseType = "document", a.onload = () => {
|
|
181
|
-
a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
|
|
182
|
-
}, a.addEventListener("error", (n) => s(n)), a.send();
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
function de(e, l, t = !1) {
|
|
186
|
-
if (e === l)
|
|
187
|
-
return !0;
|
|
188
|
-
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
189
|
-
return t;
|
|
190
|
-
for (let s in e)
|
|
191
|
-
if (!(s in l) || !de(e[s], l[s]))
|
|
192
|
-
return t;
|
|
193
|
-
return !0;
|
|
194
|
-
}
|
|
195
|
-
const se = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), pe = (e, l) => se(l).map((t) => {
|
|
196
|
-
let s = e.ownerDocument, a = (n) => (e.append(n), n);
|
|
197
|
-
if (t.includes("/")) {
|
|
198
|
-
const n = [], r = s.evaluate(t, e);
|
|
199
|
-
for (let h; h = r.iterateNext(); )
|
|
200
|
-
n.push(h);
|
|
201
|
-
return n;
|
|
202
|
-
}
|
|
203
|
-
return [...e.childNodes].find((n) => n.localName === t) || a(N(t, "", s));
|
|
204
|
-
}).flat();
|
|
205
|
-
function J(e, l, t, s) {
|
|
206
|
-
if (!t.sliceProcessed)
|
|
207
|
-
return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
|
|
208
|
-
const n = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
|
|
209
|
-
if (r.getAttributeNames().map((u) => a.setAttribute(u, x(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($(t, "event", n)), h.hasAttribute("slice-value")) {
|
|
210
|
-
r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
|
|
211
|
-
const u = L(x(h, "slice-value"), a);
|
|
212
|
-
p(), a.append(S(n, u));
|
|
213
|
-
} else {
|
|
214
|
-
if ("elements" in r)
|
|
215
|
-
return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
|
|
216
|
-
const u = r.value ?? x(r, "value");
|
|
217
|
-
p(), u == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(u) ? a.append(S(n, u)) : a.append($(u, "value", a.ownerDocument));
|
|
218
|
-
}
|
|
219
|
-
return a;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
function C(e, l, t) {
|
|
223
|
-
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
224
|
-
}
|
|
225
|
-
const fe = async (e, l) => {
|
|
226
|
-
if (!e || !e.trim())
|
|
227
|
-
return [l];
|
|
228
|
-
if (e.startsWith("#"))
|
|
229
|
-
return ((t) => {
|
|
230
|
-
const s = t.querySelectorAll(e);
|
|
231
|
-
return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
|
|
232
|
-
})(l.parentElement);
|
|
233
|
-
try {
|
|
234
|
-
const [t, s] = e.split("#");
|
|
235
|
-
if (e.charAt(0) === ".")
|
|
236
|
-
e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
|
|
237
|
-
else
|
|
238
|
-
try {
|
|
239
|
-
e = import.meta.resolve(t), s && (e += "#" + s);
|
|
240
|
-
} catch (n) {
|
|
241
|
-
console.error(n.message);
|
|
242
|
-
}
|
|
243
|
-
const a = await ue(e);
|
|
244
|
-
if (l.setAttributeNS("xml", "base", e), s) {
|
|
245
|
-
const n = a.querySelectorAll("#" + s);
|
|
246
|
-
return n.length ? [...n] : [l];
|
|
247
|
-
}
|
|
248
|
-
return [a];
|
|
249
|
-
} catch {
|
|
250
|
-
return [l];
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
function he(e, l) {
|
|
254
|
-
for (let t of e.attributes)
|
|
255
|
-
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
256
|
-
}
|
|
257
|
-
function le(e, l = 0) {
|
|
258
|
-
const t = {};
|
|
259
|
-
for (const s of e.childNodes) {
|
|
260
|
-
const a = x(s, "data-dce-id") || s.dceId || 0;
|
|
261
|
-
if (!t[a])
|
|
262
|
-
a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
263
|
-
else {
|
|
264
|
-
const n = s.dceId = a + "-" + t[a]++;
|
|
265
|
-
s.setAttribute && s.setAttribute("data-dce-id", n);
|
|
266
|
-
}
|
|
267
|
-
s.childNodes.length && le(s);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function xe(e, l, t) {
|
|
271
|
-
t = 1 * t;
|
|
272
|
-
for (let s of e.childNodes)
|
|
273
|
-
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
274
|
-
return e.insertBefore(l, s);
|
|
275
|
-
e.append(l);
|
|
276
|
-
}
|
|
277
|
-
function ae(e, l) {
|
|
278
|
-
if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
|
|
279
|
-
return;
|
|
280
|
-
if (!l.length)
|
|
281
|
-
return e.firstElementChild?.localName !== "dce-root" && K(e);
|
|
282
|
-
const t = {};
|
|
283
|
-
for (let s of e.childNodes)
|
|
284
|
-
t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
285
|
-
for (let s of [...l]) {
|
|
286
|
-
const a = x(s, "data-dce-id") || s.dceId, n = t[a];
|
|
287
|
-
n ? (Y(s) ? n.nodeValue !== s.nodeValue && (n.nodeValue = s.nodeValue) : (he(s, n), (n.childNodes.length || s.childNodes.length) && ae(n, s.childNodes)), delete t[a]) : xe(e, s, a);
|
|
288
|
-
}
|
|
289
|
-
for (let s of Object.values(t))
|
|
290
|
-
s.localName !== "dce-root" && s.remove();
|
|
291
|
-
}
|
|
292
|
-
function be(e, l) {
|
|
293
|
-
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
294
|
-
}
|
|
295
|
-
const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
296
|
-
if (!e.trim())
|
|
297
|
-
return e;
|
|
298
|
-
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
299
|
-
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
300
|
-
}, L = (e, l) => {
|
|
301
|
-
const t = e.split("??");
|
|
302
|
-
if (t.length > 1)
|
|
303
|
-
return L(t[0], l) || L(t[1], l);
|
|
304
|
-
e = F(e);
|
|
305
|
-
const s = l.ownerDocument.evaluate(e, l);
|
|
306
|
-
switch (s.resultType) {
|
|
307
|
-
case XPathResult.NUMBER_TYPE:
|
|
308
|
-
return s.numberValue;
|
|
309
|
-
case XPathResult.STRING_TYPE:
|
|
310
|
-
return s.stringValue;
|
|
311
|
-
case XPathResult.BOOLEAN_TYPE:
|
|
312
|
-
return s.booleanValue;
|
|
313
|
-
}
|
|
314
|
-
let a = "";
|
|
315
|
-
for (let n; n = s.iterateNext(); )
|
|
316
|
-
a += n.textContent;
|
|
317
|
-
return a;
|
|
318
|
-
}, ve = "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(","), ge = (e, l) => {
|
|
319
|
-
const t = N("xsl:" + e.localName);
|
|
320
|
-
for (let s of e.attributes)
|
|
321
|
-
t.setAttribute(s.name, s.value);
|
|
322
|
-
for (; e.firstChild; )
|
|
323
|
-
t.append(e.firstChild);
|
|
324
|
-
if (e.parentElement)
|
|
325
|
-
e.parentElement.replaceChild(t, e);
|
|
326
|
-
else {
|
|
327
|
-
const s = e.parentElement || l, a = [...s.childNodes];
|
|
328
|
-
a.forEach((n, r) => {
|
|
329
|
-
n === e && (a[r] = t);
|
|
330
|
-
}), s.replaceChildren(...a);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
class Ee extends HTMLElement {
|
|
334
|
-
static observedAttributes = ["src", "tag", "hidden"];
|
|
335
|
-
async connectedCallback() {
|
|
336
|
-
const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
337
|
-
for (const d of l)
|
|
338
|
-
C(d.templateNode || d.content || d, "style", (m) => {
|
|
339
|
-
const i = m.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
|
|
340
|
-
m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
|
|
341
|
-
});
|
|
342
|
-
const a = l.map((d) => me(d)), n = a.map((d, m) => (m = new XSLTProcessor(), m.importStylesheet(d), m));
|
|
343
|
-
Object.defineProperty(this, "xsltString", { get: () => a.map((d) => H(d)).join(`
|
|
344
|
-
`) });
|
|
345
|
-
const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, i) => i.indexOf(d) === m).map(se).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
|
|
346
|
-
class w extends HTMLElement {
|
|
347
|
-
static get observedAttributes() {
|
|
348
|
-
return u.map((m) => x(m, "name"));
|
|
349
|
-
}
|
|
350
|
-
#e = 0;
|
|
351
|
-
connectedCallback() {
|
|
352
|
-
let m = this.childNodes;
|
|
353
|
-
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
354
|
-
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
355
|
-
const f = this.firstElementChild;
|
|
356
|
-
f.remove(), m = f.content.childNodes;
|
|
357
|
-
for (const o of [...f.content.childNodes])
|
|
358
|
-
if (o.localName === "style") {
|
|
359
|
-
const b = be(this, "data-dce-style");
|
|
360
|
-
o.innerHTML = `${s}[data-dce-style="${b}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
|
|
361
|
-
} else
|
|
362
|
-
o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
|
|
363
|
-
}
|
|
364
|
-
const i = M("<datadom/>").documentElement, c = (f, o = "") => ((b) => (o && b.append(S(i, o)), b))(i.ownerDocument.createElement(f)), E = X(i, "payload", m, ce);
|
|
365
|
-
Q(E), ee(E), this.innerHTML = "";
|
|
366
|
-
const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
|
|
367
|
-
X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
|
|
368
|
-
const y = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, y);
|
|
369
|
-
this.xml = i;
|
|
370
|
-
const D = [], W = () => {
|
|
371
|
-
const f = {};
|
|
372
|
-
for (let o; o = D.pop(); ) {
|
|
373
|
-
const b = x(o.sliceElement, "slice");
|
|
374
|
-
f[b] || (J(y, b, o), f[b] = o);
|
|
375
|
-
}
|
|
376
|
-
Object.keys(f).length !== 0 && R();
|
|
377
|
-
};
|
|
378
|
-
let V;
|
|
379
|
-
this.onSlice = (f) => {
|
|
380
|
-
D.push(f), V || (V = setTimeout(() => {
|
|
381
|
-
W(), V = 0;
|
|
382
|
-
}, 1));
|
|
383
|
-
};
|
|
384
|
-
const R = this.transform = () => {
|
|
385
|
-
if (this.#e)
|
|
386
|
-
debugger;
|
|
387
|
-
this.#e = 1, n.map((o, b) => {
|
|
388
|
-
const I = o.transformToFragment(i.ownerDocument, document);
|
|
389
|
-
return I || console.error(`XSLT transformation error. xsl:
|
|
390
|
-
`, H(a[b]), `
|
|
391
|
-
xml:
|
|
392
|
-
`, H(i)), I;
|
|
393
|
-
}).map((o) => {
|
|
394
|
-
o && (le(o), ae(this, o.childNodes));
|
|
395
|
-
}), w.observedAttributes.map((o) => {
|
|
396
|
-
let b = x(this.firstElementChild, o);
|
|
397
|
-
b !== x(this, o) && (this.setAttribute(o, b), this.#t(o, b));
|
|
398
|
-
}), C(this, "[slice],[slice-event]", (o) => {
|
|
399
|
-
if (!o.dceInitialized) {
|
|
400
|
-
o.dceInitialized = 1;
|
|
401
|
-
let b = x(o, "slice-event");
|
|
402
|
-
o.hasAttribute("custom-validity") && (b += " change submit"), [...new Set((b || "change").split(" "))].forEach((I) => (o.localName === "slice" ? o.parentElement : o).addEventListener(I, (A) => {
|
|
403
|
-
A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
|
|
404
|
-
const ne = J(y, x(A.sliceElement, "slice"), A);
|
|
405
|
-
C(this, "[custom-validity]", (z) => {
|
|
406
|
-
if (!z.setCustomValidity)
|
|
407
|
-
return;
|
|
408
|
-
const _ = x(z, "custom-validity");
|
|
409
|
-
try {
|
|
410
|
-
const j = _ && L(_, g);
|
|
411
|
-
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
412
|
-
} catch (j) {
|
|
413
|
-
console.error(j, "xPath", _);
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
const k = x(o, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
|
|
417
|
-
if (k) {
|
|
418
|
-
if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
419
|
-
return T === !0 ? void 0 : (setTimeout(R, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
420
|
-
setTimeout(R, 1);
|
|
421
|
-
}
|
|
422
|
-
this.onSlice(A);
|
|
423
|
-
})), (!b || b.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = v(x(o, "slice")));
|
|
424
|
-
}
|
|
425
|
-
}), this.#e = 0;
|
|
426
|
-
};
|
|
427
|
-
R(), W();
|
|
428
|
-
}
|
|
429
|
-
#t(m, i) {
|
|
430
|
-
m === "value" && (this.value = i);
|
|
431
|
-
let c = this.xml.querySelector(`attributes>${m}`);
|
|
432
|
-
c ? U(c).append(S(c, i)) : (c = N(m, i, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: i } }));
|
|
433
|
-
}
|
|
434
|
-
attributeChangedCallback(m, i, c) {
|
|
435
|
-
!this.xml || this.#e || (this.#t(m, c), this.transform());
|
|
436
|
-
}
|
|
437
|
-
get dce() {
|
|
438
|
-
return r;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
const P = (d) => {
|
|
442
|
-
window.customElements.get(d) !== w && window.customElements.define(d, w);
|
|
443
|
-
};
|
|
444
|
-
if (t)
|
|
445
|
-
P(t);
|
|
446
|
-
else {
|
|
447
|
-
const d = s;
|
|
448
|
-
this.setAttribute("tag", d), P(d);
|
|
449
|
-
const m = document.createElement(d);
|
|
450
|
-
this.getAttributeNames().forEach((i) => m.setAttribute(i, this.getAttribute(i))), m.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(m);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
get templateNode() {
|
|
454
|
-
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
455
|
-
}
|
|
456
|
-
get dce() {
|
|
457
|
-
return this;
|
|
458
|
-
}
|
|
459
|
-
get xslt() {
|
|
460
|
-
return M(this.xsltString);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
window.customElements.define("custom-element", Ee);
|
|
464
|
-
export {
|
|
465
|
-
Ee as C,
|
|
466
|
-
H as a,
|
|
467
|
-
ue as b,
|
|
468
|
-
me as c,
|
|
469
|
-
de as d,
|
|
470
|
-
pe as e,
|
|
471
|
-
J as f,
|
|
472
|
-
le as g,
|
|
473
|
-
xe as h,
|
|
474
|
-
ae as i,
|
|
475
|
-
be as j,
|
|
476
|
-
ye as k,
|
|
477
|
-
F as l,
|
|
478
|
-
he as m,
|
|
479
|
-
L as n,
|
|
480
|
-
$ as o,
|
|
481
|
-
ve as p,
|
|
482
|
-
ge as q,
|
|
483
|
-
Z as t,
|
|
484
|
-
M as x
|
|
485
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=(t,e)=>{if(t==="text")return e;if(t==="json")try{return JSON.parse(e)}catch{return null}const a=document.createElement("input");return a.setAttribute("type",t),t==="number"?(a.value=e,a.valueAsNumber):t==="date"?e?(a.valueAsDate=new Date(e),a.value):null:(a.value=e,a.value)};let n,i,s;function d(){n||(n=localStorage.setItem,localStorage.setItem=function(t,e,...a){n.apply(this,[t,e,...a]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t,value:e}}))},i=localStorage.removeItem,localStorage.removeItem=function(t,...e){i.apply(this,[t,...e]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t}}))},s=localStorage.clear,localStorage.clear=function(...t){s.apply(this,[...t]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{}}))})}function c(t,e){localStorage.setItem(t,e),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t,value:e}}))}class u extends HTMLElement{static observedAttributes=["value","slice","key","type","live"];#e;get value(){return this.#e===null?void 0:this.#e}set value(e){return this.#e=e}async connectedCallback(){const e=l=>this.getAttribute(l),a=()=>{this.#e=r(e("type"),localStorage.getItem(e("key"))),this.dispatchEvent(new Event("change"))};if(this.#e=r(e("type"),localStorage.getItem(e("key"))),this.hasAttribute("value")?c(e("key"),this.#e=e("value")):a(),this.hasAttribute("live")){const l=o=>(o.detail.key===e("key")||!o.detail.key)&&a();window.addEventListener("local-storage",l),d(),this._destroy=()=>window.removeEventListener("local-storage",l)}}disconnectedCallback(){this._destroy?.()}}window.customElements.define("local-storage",u);exports.LocalStorageElement=u;exports.localStorageSetItem=c;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const r = (t, e) => {
|
|
2
|
-
if (t === "text")
|
|
3
|
-
return e;
|
|
4
|
-
if (t === "json")
|
|
5
|
-
try {
|
|
6
|
-
return JSON.parse(e);
|
|
7
|
-
} catch {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const a = document.createElement("input");
|
|
11
|
-
return a.setAttribute("type", t), t === "number" ? (a.value = e, a.valueAsNumber) : t === "date" ? e ? (a.valueAsDate = new Date(e), a.value) : null : (a.value = e, a.value);
|
|
12
|
-
};
|
|
13
|
-
let n, i, s;
|
|
14
|
-
function c() {
|
|
15
|
-
n || (n = localStorage.setItem, localStorage.setItem = function(t, e, ...a) {
|
|
16
|
-
n.apply(this, [t, e, ...a]), window.dispatchEvent(new CustomEvent("local-storage", { detail: { key: t, value: e } }));
|
|
17
|
-
}, i = localStorage.removeItem, localStorage.removeItem = function(t, ...e) {
|
|
18
|
-
i.apply(this, [t, ...e]), window.dispatchEvent(new CustomEvent("local-storage", { detail: { key: t } }));
|
|
19
|
-
}, s = localStorage.clear, localStorage.clear = function(...t) {
|
|
20
|
-
s.apply(this, [...t]), window.dispatchEvent(new CustomEvent("local-storage", { detail: {} }));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function u(t, e) {
|
|
24
|
-
localStorage.setItem(t, e), window.dispatchEvent(new CustomEvent("local-storage", { detail: { key: t, value: e } }));
|
|
25
|
-
}
|
|
26
|
-
class d extends HTMLElement {
|
|
27
|
-
static observedAttributes = [
|
|
28
|
-
"value",
|
|
29
|
-
"slice",
|
|
30
|
-
"key",
|
|
31
|
-
"type",
|
|
32
|
-
"live"
|
|
33
|
-
// monitors localStorage change
|
|
34
|
-
];
|
|
35
|
-
#e;
|
|
36
|
-
get value() {
|
|
37
|
-
return this.#e === null ? void 0 : this.#e;
|
|
38
|
-
}
|
|
39
|
-
set value(e) {
|
|
40
|
-
return this.#e = e;
|
|
41
|
-
}
|
|
42
|
-
async connectedCallback() {
|
|
43
|
-
const e = (l) => this.getAttribute(l), a = () => {
|
|
44
|
-
this.#e = r(e("type"), localStorage.getItem(e("key"))), this.dispatchEvent(new Event("change"));
|
|
45
|
-
};
|
|
46
|
-
if (this.#e = r(e("type"), localStorage.getItem(e("key"))), this.hasAttribute("value") ? u(e("key"), this.#e = e("value")) : a(), this.hasAttribute("live")) {
|
|
47
|
-
const l = (o) => (o.detail.key === e("key") || !o.detail.key) && a();
|
|
48
|
-
window.addEventListener("local-storage", l), c(), this._destroy = () => window.removeEventListener("local-storage", l);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
disconnectedCallback() {
|
|
52
|
-
this._destroy?.();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
window.customElements.define("local-storage", d);
|
|
56
|
-
export {
|
|
57
|
-
d as L,
|
|
58
|
-
u as l
|
|
59
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ae as h,ag as b,al as ie,am as Me,an as ue,ao as Ce,ap as C,a2 as fe,a0 as $e,w as Oe,aq as Ie,ar as Ne}from"./index-BnXBQqj9.js";import"./iframe-D4Sos1HO.js";import"../sb-preview/runtime.js";import"./index-D-8MO0q_.js";import"./index-DGdNYaqV.js";import"./index-DrFu-skq.js";function $(){return($=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function J(e,t){if(e==null)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}function K(e){var t=b.useRef(e),n=b.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var N=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},z=function(e){return"touches"in e},V=function(e){return e&&e.ownerDocument.defaultView||self},te=function(e,t,n){var r=e.getBoundingClientRect(),o=z(t)?function(a,l){for(var s=0;s<a.length;s++)if(a[s].identifier===l)return a[s];return a[0]}(t.touches,n):t;return{left:N((o.pageX-(r.left+V(e).pageXOffset))/r.width),top:N((o.pageY-(r.top+V(e).pageYOffset))/r.height)}},ne=function(e){!z(e)&&e.preventDefault()},Q=h.memo(function(e){var t=e.onMove,n=e.onKey,r=J(e,["onMove","onKey"]),o=b.useRef(null),a=K(t),l=K(n),s=b.useRef(null),c=b.useRef(!1),i=b.useMemo(function(){var w=function(p){ne(p),(z(p)?p.touches.length>0:p.buttons>0)&&o.current?a(te(o.current,p,s.current)):E(!1)},S=function(){return E(!1)};function E(p){var m=c.current,k=V(o.current),y=p?k.addEventListener:k.removeEventListener;y(m?"touchmove":"mousemove",w),y(m?"touchend":"mouseup",S)}return[function(p){var m=p.nativeEvent,k=o.current;if(k&&(ne(m),!function(R,j){return j&&!z(R)}(m,c.current)&&k)){if(z(m)){c.current=!0;var y=m.changedTouches||[];y.length&&(s.current=y[0].identifier)}k.focus(),a(te(k,m,s.current)),E(!0)}},function(p){var m=p.which||p.keyCode;m<37||m>40||(p.preventDefault(),l({left:m===39?.05:m===37?-.05:0,top:m===40?.05:m===38?-.05:0}))},E]},[l,a]),d=i[0],f=i[1],g=i[2];return b.useEffect(function(){return g},[g]),h.createElement("div",$({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:f,tabIndex:0,role:"slider"}))}),H=function(e){return e.filter(Boolean).join(" ")},Z=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,a=H(["react-colorful__pointer",e.className]);return h.createElement("div",{className:a,style:{top:100*o+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},x=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Se={grad:.9,turn:360,rad:360/(2*Math.PI)},Re=function(e){return ge(A(e))},A=function(e){return e[0]==="#"&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?x(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?x(parseInt(e.substring(6,8),16)/255,2):1}},je=function(e,t){return t===void 0&&(t="deg"),Number(e)*(Se[t]||1)},Te=function(e){var t=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?ze({h:je(t[1],t[2]),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}):{h:0,s:0,v:0,a:1}},ze=function(e){var t=e.s,n=e.l;return{h:e.h,s:(t*=(n<50?n:100-n)/100)>0?2*t/(n+t)*100:0,v:n+t,a:e.a}},Fe=function(e){return Pe(de(e))},he=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:x(e.h),s:x(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:x(o/2),a:x(r,2)}},G=function(e){var t=he(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},B=function(e){var t=he(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},de=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),l=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),i=a%6;return{r:x(255*[r,s,l,l,c,r][i]),g:x(255*[c,r,r,s,l,l][i]),b:x(255*[l,l,c,r,r,s][i]),a:x(o,2)}},He=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?ge({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},P=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Pe=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,a=o<1?P(x(255*o)):"";return"#"+P(t)+P(n)+P(r)+a},ge=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,a=Math.max(t,n,r),l=a-Math.min(t,n,r),s=l?a===t?(n-r)/l:a===n?2+(r-t)/l:4+(t-n)/l:0;return{h:x(60*(s<0?s+6:s)),s:x(a?l/a*100:0),v:x(a/255*100),a:o}},be=h.memo(function(e){var t=e.hue,n=e.onChange,r=H(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(Q,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:N(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":x(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Z,{className:"react-colorful__hue-pointer",left:t/360,color:G({h:t,s:100,v:100,a:1})})))}),me=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:G({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(Q,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:N(t.s+100*o.left,0,100),v:N(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+x(t.s)+"%, Brightness "+x(t.v)+"%"},h.createElement(Z,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:G(t)})))}),ve=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},pe=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")},Le=function(e,t){return e.toLowerCase()===t.toLowerCase()||ve(A(e),A(t))};function ye(e,t,n){var r=K(n),o=b.useState(function(){return e.toHsva(t)}),a=o[0],l=o[1],s=b.useRef({color:t,hsva:a});b.useEffect(function(){if(!e.equal(t,s.current.color)){var i=e.toHsva(t);s.current={hsva:i,color:t},l(i)}},[t,e]),b.useEffect(function(){var i;ve(a,s.current.hsva)||e.equal(i=e.fromHsva(a),s.current.color)||(s.current={hsva:a,color:i},r(i))},[a,e,r]);var c=b.useCallback(function(i){l(function(d){return Object.assign({},d,i)})},[]);return[a,c]}var qe=typeof window<"u"?b.useLayoutEffect:b.useEffect,Be=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},re=new Map,xe=function(e){qe(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!re.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,re.set(t,n);var r=Be();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},Xe=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,a=e.onChange,l=J(e,["className","colorModel","color","onChange"]),s=b.useRef(null);xe(s);var c=ye(n,o,a),i=c[0],d=c[1],f=H(["react-colorful",t]);return h.createElement("div",$({},l,{ref:s,className:f}),h.createElement(me,{hsva:i,onChange:d}),h.createElement(be,{hue:i.h,onChange:d,className:"react-colorful__last-control"}))},De={defaultColor:"000",toHsva:Re,fromHsva:function(e){return Fe({h:e.h,s:e.s,v:e.v,a:1})},equal:Le},We=function(e){return h.createElement(Xe,$({},e,{colorModel:De}))},Ke=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+B(Object.assign({},n,{a:0}))+", "+B(Object.assign({},n,{a:1}))+")"},a=H(["react-colorful__alpha",t]),l=x(100*n.a);return h.createElement("div",{className:a},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(Q,{onMove:function(s){r({a:s.left})},onKey:function(s){r({a:N(n.a+s.left)})},"aria-label":"Alpha","aria-valuetext":l+"%","aria-valuenow":l,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Z,{className:"react-colorful__alpha-pointer",left:n.a,color:B(n)})))},we=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,a=e.onChange,l=J(e,["className","colorModel","color","onChange"]),s=b.useRef(null);xe(s);var c=ye(n,o,a),i=c[0],d=c[1],f=H(["react-colorful",t]);return h.createElement("div",$({},l,{ref:s,className:f}),h.createElement(me,{hsva:i,onChange:d}),h.createElement(be,{hue:i.h,onChange:d}),h.createElement(Ke,{hsva:i,onChange:d,className:"react-colorful__last-control"}))},Ve={defaultColor:"hsla(0, 0%, 0%, 1)",toHsva:Te,fromHsva:B,equal:pe},Ae=function(e){return h.createElement(we,$({},e,{colorModel:Ve}))},Ge={defaultColor:"rgba(0, 0, 0, 1)",toHsva:He,fromHsva:function(e){var t=de(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:pe},Ue=function(e){return h.createElement(we,$({},e,{colorModel:Ge}))},Ye={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const F=Ye,ke={};for(const e of Object.keys(F))ke[F[e]]=e;const u={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var _e=u;for(const e of Object.keys(u)){if(!("channels"in u[e]))throw new Error("missing channels property: "+e);if(!("labels"in u[e]))throw new Error("missing channel labels property: "+e);if(u[e].labels.length!==u[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=u[e];delete u[e].channels,delete u[e].labels,Object.defineProperty(u[e],"channels",{value:t}),Object.defineProperty(u[e],"labels",{value:n})}u.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),a=Math.max(t,n,r),l=a-o;let s,c;a===o?s=0:t===a?s=(n-r)/l:n===a?s=2+(r-t)/l:r===a&&(s=4+(t-n)/l),s=Math.min(s*60,360),s<0&&(s+=360);const i=(o+a)/2;return a===o?c=0:i<=.5?c=l/(a+o):c=l/(2-a-o),[s,c*100,i*100]};u.rgb.hsv=function(e){let t,n,r,o,a;const l=e[0]/255,s=e[1]/255,c=e[2]/255,i=Math.max(l,s,c),d=i-Math.min(l,s,c),f=function(g){return(i-g)/6/d+1/2};return d===0?(o=0,a=0):(a=d/i,t=f(l),n=f(s),r=f(c),l===i?o=r-n:s===i?o=1/3+t-r:c===i&&(o=2/3+n-t),o<0?o+=1:o>1&&(o-=1)),[o*360,a*100,i*100]};u.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const o=u.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[o,a*100,r*100]};u.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r),a=(1-t-o)/(1-o)||0,l=(1-n-o)/(1-o)||0,s=(1-r-o)/(1-o)||0;return[a*100,l*100,s*100,o*100]};function Je(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}u.rgb.keyword=function(e){const t=ke[e];if(t)return t;let n=1/0,r;for(const o of Object.keys(F)){const a=F[o],l=Je(e,a);l<n&&(n=l,r=o)}return r};u.keyword.rgb=function(e){return F[e]};u.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124+n*.3576+r*.1805,a=t*.2126+n*.7152+r*.0722,l=t*.0193+n*.1192+r*.9505;return[o*100,a*100,l*100]};u.rgb.lab=function(e){const t=u.rgb.xyz(e);let n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;const a=116*r-16,l=500*(n-r),s=200*(r-o);return[a,l,s]};u.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let o,a,l;if(n===0)return l=r*255,[l,l,l];r<.5?o=r*(1+n):o=r+n-r*n;const s=2*r-o,c=[0,0,0];for(let i=0;i<3;i++)a=t+1/3*-(i-1),a<0&&a++,a>1&&a--,6*a<1?l=s+(o-s)*6*a:2*a<1?l=o:3*a<2?l=s+(o-s)*(2/3-a)*6:l=s,c[i]=l*255;return c};u.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,o=n;const a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,o*=a<=1?a:2-a;const l=(r+n)/2,s=r===0?2*o/(a+o):2*n/(r+n);return[t,s*100,l*100]};u.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6,a=t-Math.floor(t),l=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,o){case 0:return[r,c,l];case 1:return[s,r,l];case 2:return[l,r,c];case 3:return[l,s,r];case 4:return[c,l,r];case 5:return[r,l,s]}};u.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,.01);let a,l;l=(2-n)*r;const s=(2-n)*o;return a=n*o,a/=s<=1?s:2-s,a=a||0,l/=2,[t,a*100,l*100]};u.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const o=n+r;let a;o>1&&(n/=o,r/=o);const l=Math.floor(6*t),s=1-r;a=6*t-l,l&1&&(a=1-a);const c=n+a*(s-n);let i,d,f;switch(l){default:case 6:case 0:i=s,d=c,f=n;break;case 1:i=c,d=s,f=n;break;case 2:i=n,d=s,f=c;break;case 3:i=n,d=c,f=s;break;case 4:i=c,d=n,f=s;break;case 5:i=s,d=n,f=c;break}return[i*255,d*255,f*255]};u.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100,a=1-Math.min(1,t*(1-o)+o),l=1-Math.min(1,n*(1-o)+o),s=1-Math.min(1,r*(1-o)+o);return[a*255,l*255,s*255]};u.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let o,a,l;return o=t*3.2406+n*-1.5372+r*-.4986,a=t*-.9689+n*1.8758+r*.0415,l=t*.0557+n*-.204+r*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),l=Math.min(Math.max(0,l),1),[o*255,a*255,l*255]};u.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;const o=116*n-16,a=500*(t-n),l=200*(n-r);return[o,a,l]};u.lab.xyz=function(e){const t=e[0],n=e[1],r=e[2];let o,a,l;a=(t+16)/116,o=n/500+a,l=a-r/200;const s=a**3,c=o**3,i=l**3;return a=s>.008856?s:(a-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,l=i>.008856?i:(l-16/116)/7.787,o*=95.047,a*=100,l*=108.883,[o,a,l]};u.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let o;o=Math.atan2(r,n)*360/2/Math.PI,o<0&&(o+=360);const l=Math.sqrt(n*n+r*r);return[t,l,o]};u.lch.lab=function(e){const t=e[0],n=e[1],o=e[2]/360*2*Math.PI,a=n*Math.cos(o),l=n*Math.sin(o);return[t,a,l]};u.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let a=t===null?u.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let l=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(l+=60),l};u.hsv.ansi16=function(e){return u.rgb.ansi16(u.hsv.rgb(e),e[2])};u.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};u.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=(~~(e>50)+1)*.5,r=(t&1)*n*255,o=(t>>1&1)*n*255,a=(t>>2&1)*n*255;return[r,o,a]};u.ansi256.rgb=function(e){if(e>=232){const a=(e-232)*10+8;return[a,a,a]}e-=16;let t;const n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[n,r,o]};u.rgb.hex=function(e){const n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(n.length)+n};u.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=n.split("").map(s=>s+s).join(""));const r=parseInt(n,16),o=r>>16&255,a=r>>8&255,l=r&255;return[o,a,l]};u.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),l=o-a;let s,c;return l<1?s=a/(1-l):s=0,l<=0?c=0:o===t?c=(n-r)/l%6:o===n?c=2+(r-t)/l:c=4+(t-n)/l,c/=6,c%=1,[c*360,l*100,s*100]};u.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let o=0;return r<1&&(o=(n-.5*r)/(1-r)),[e[0],r*100,o*100]};u.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],r*100,o*100]};u.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];const o=[0,0,0],a=t%1*6,l=a%1,s=1-l;let c=0;switch(Math.floor(a)){case 0:o[0]=1,o[1]=l,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=l;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=l,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return c=(1-n)*r,[(n*o[0]+c)*255,(n*o[1]+c)*255,(n*o[2]+c)*255]};u.hcg.hsv=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);let o=0;return r>0&&(o=t/r),[e[0],o*100,r*100]};u.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let o=0;return r>0&&r<.5?o=t/(2*r):r>=.5&&r<1&&(o=t/(2*(1-r))),[e[0],o*100,r*100]};u.hcg.hwb=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};u.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,o=r-t;let a=0;return o<1&&(a=(r-o)/(1-o)),[e[0],o*100,a*100]};u.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};u.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};u.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};u.gray.hsl=function(e){return[0,0,e[0]]};u.gray.hsv=u.gray.hsl;u.gray.hwb=function(e){return[0,100,e[0]]};u.gray.cmyk=function(e){return[0,0,0,e[0]]};u.gray.lab=function(e){return[e[0],0,0]};u.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r};u.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const X=_e;function Qe(){const e={},t=Object.keys(X);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function Ze(e){const t=Qe(),n=[e];for(t[e].distance=0;n.length;){const r=n.pop(),o=Object.keys(X[r]);for(let a=o.length,l=0;l<a;l++){const s=o[l],c=t[s];c.distance===-1&&(c.distance=t[r].distance+1,c.parent=r,n.unshift(s))}}return t}function et(e,t){return function(n){return t(e(n))}}function tt(e,t){const n=[t[e].parent,e];let r=X[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),r=et(X[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}var nt=function(e){const t=Ze(e),n={},r=Object.keys(t);for(let o=r.length,a=0;a<o;a++){const l=r[a];t[l].parent!==null&&(n[l]=tt(l,t))}return n};const U=_e,rt=nt,O={},ot=Object.keys(U);function at(e){const t=function(...n){const r=n[0];return r==null?r:(r.length>1&&(n=r),e(n))};return"conversion"in e&&(t.conversion=e.conversion),t}function lt(e){const t=function(...n){const r=n[0];if(r==null)return r;r.length>1&&(n=r);const o=e(n);if(typeof o=="object")for(let a=o.length,l=0;l<a;l++)o[l]=Math.round(o[l]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}ot.forEach(e=>{O[e]={},Object.defineProperty(O[e],"channels",{value:U[e].channels}),Object.defineProperty(O[e],"labels",{value:U[e].labels});const t=rt(e);Object.keys(t).forEach(r=>{const o=t[r];O[e][r]=lt(o),O[e][r].raw=at(o)})});var st=O;const _=ie(st);var ct=Me,it=function(){return ct.Date.now()},ut=it,ft=/\s/;function ht(e){for(var t=e.length;t--&&ft.test(e.charAt(t)););return t}var dt=ht,gt=dt,bt=/^\s+/;function mt(e){return e&&e.slice(0,gt(e)+1).replace(bt,"")}var vt=mt,pt=vt,oe=ue,yt=Ce,ae=NaN,xt=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,kt=/^0o[0-7]+$/i,_t=parseInt;function Et(e){if(typeof e=="number")return e;if(yt(e))return ae;if(oe(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=oe(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=pt(e);var n=wt.test(e);return n||kt.test(e)?_t(e.slice(2),n?2:8):xt.test(e)?ae:+e}var Mt=Et,Ct=ue,W=ut,le=Mt,$t="Expected a function",Ot=Math.max,It=Math.min;function Nt(e,t,n){var r,o,a,l,s,c,i=0,d=!1,f=!1,g=!0;if(typeof e!="function")throw new TypeError($t);t=le(t)||0,Ct(n)&&(d=!!n.leading,f="maxWait"in n,a=f?Ot(le(n.maxWait)||0,t):a,g="trailing"in n?!!n.trailing:g);function w(v){var M=r,T=o;return r=o=void 0,i=v,l=e.apply(T,M),l}function S(v){return i=v,s=setTimeout(m,t),d?w(v):l}function E(v){var M=v-c,T=v-i,ee=t-M;return f?It(ee,a-T):ee}function p(v){var M=v-c,T=v-i;return c===void 0||M>=t||M<0||f&&T>=a}function m(){var v=W();if(p(v))return k(v);s=setTimeout(m,E(v))}function k(v){return s=void 0,g&&r?w(v):(r=o=void 0,l)}function y(){s!==void 0&&clearTimeout(s),i=0,r=c=o=s=void 0}function R(){return s===void 0?l:k(W())}function j(){var v=W(),M=p(v);if(r=arguments,o=this,c=v,M){if(s===void 0)return S(c);if(f)return clearTimeout(s),s=setTimeout(m,t),w(c)}return s===void 0&&(s=setTimeout(m,t)),l}return j.cancel=y,j.flush=R,j}var St=Nt;const Rt=ie(St);var jt=C.div({position:"relative",maxWidth:250,'&[aria-readonly="true"]':{opacity:.5}}),Tt=C(fe)({position:"absolute",zIndex:1,top:4,left:4,"[aria-readonly=true] &":{cursor:"not-allowed"}}),zt=C.div({width:200,margin:5,".react-colorful__saturation":{borderRadius:"4px 4px 0 0"},".react-colorful__hue":{boxShadow:"inset 0 0 0 1px rgb(0 0 0 / 5%)"},".react-colorful__last-control":{borderRadius:"0 0 4px 4px"}}),Ft=C($e)(({theme:e})=>({fontFamily:e.typography.fonts.base})),Ht=C.div({display:"grid",gridTemplateColumns:"repeat(9, 16px)",gap:6,padding:3,marginTop:5,width:200}),Pt=C.div(({theme:e,active:t})=>({width:16,height:16,boxShadow:t?`${e.appBorderColor} 0 0 0 1px inset, ${e.textMutedColor}50 0 0 0 4px`:`${e.appBorderColor} 0 0 0 1px inset`,borderRadius:e.appBorderRadius})),Lt=`url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')`,se=({value:e,style:t,...n})=>{let r=`linear-gradient(${e}, ${e}), ${Lt}, linear-gradient(#fff, #fff)`;return h.createElement(Pt,{...n,style:{...t,backgroundImage:r}})},qt=C(Oe.Input)(({theme:e,readOnly:t})=>({width:"100%",paddingLeft:30,paddingRight:30,boxSizing:"border-box",fontFamily:e.typography.fonts.base})),Bt=C(Ie)(({theme:e})=>({position:"absolute",zIndex:1,top:6,right:7,width:20,height:20,padding:4,boxSizing:"border-box",cursor:"pointer",color:e.input.color})),Ee=(e=>(e.RGB="rgb",e.HSL="hsl",e.HEX="hex",e))(Ee||{}),L=Object.values(Ee),Xt=/\(([0-9]+),\s*([0-9]+)%?,\s*([0-9]+)%?,?\s*([0-9.]+)?\)/,Dt=/^\s*rgba?\(([0-9]+),\s*([0-9]+),\s*([0-9]+),?\s*([0-9.]+)?\)\s*$/i,Wt=/^\s*hsla?\(([0-9]+),\s*([0-9]+)%,\s*([0-9]+)%,?\s*([0-9.]+)?\)\s*$/i,Y=/^\s*#?([0-9a-f]{3}|[0-9a-f]{6})\s*$/i,Kt=/^\s*#?([0-9a-f]{3})\s*$/i,Vt={hex:We,rgb:Ue,hsl:Ae},q={hex:"transparent",rgb:"rgba(0, 0, 0, 0)",hsl:"hsla(0, 0%, 0%, 0)"},ce=e=>{let t=e?.match(Xt);if(!t)return[0,0,0,1];let[,n,r,o,a=1]=t;return[n,r,o,a].map(Number)},I=e=>{if(!e)return;let t=!0;if(Dt.test(e)){let[l,s,c,i]=ce(e),[d,f,g]=_.rgb.hsl([l,s,c])||[0,0,0];return{valid:t,value:e,keyword:_.rgb.keyword([l,s,c]),colorSpace:"rgb",rgb:e,hsl:`hsla(${d}, ${f}%, ${g}%, ${i})`,hex:`#${_.rgb.hex([l,s,c]).toLowerCase()}`}}if(Wt.test(e)){let[l,s,c,i]=ce(e),[d,f,g]=_.hsl.rgb([l,s,c])||[0,0,0];return{valid:t,value:e,keyword:_.hsl.keyword([l,s,c]),colorSpace:"hsl",rgb:`rgba(${d}, ${f}, ${g}, ${i})`,hsl:e,hex:`#${_.hsl.hex([l,s,c]).toLowerCase()}`}}let n=e.replace("#",""),r=_.keyword.rgb(n)||_.hex.rgb(n),o=_.rgb.hsl(r),a=e;if(/[^#a-f0-9]/i.test(e)?a=n:Y.test(e)&&(a=`#${n}`),a.startsWith("#"))t=Y.test(a);else try{_.keyword.hex(a)}catch{t=!1}return{valid:t,value:a,keyword:_.rgb.keyword(r),colorSpace:"hex",rgb:`rgba(${r[0]}, ${r[1]}, ${r[2]}, 1)`,hsl:`hsla(${o[0]}, ${o[1]}%, ${o[2]}%, 1)`,hex:a}},At=(e,t,n)=>{if(!e||!t?.valid)return q[n];if(n!=="hex")return t?.[n]||q[n];if(!t.hex.startsWith("#"))try{return`#${_.keyword.hex(t.hex)}`}catch{return q.hex}let r=t.hex.match(Kt);if(!r)return Y.test(t.hex)?t.hex:q.hex;let[o,a,l]=r[1].split("");return`#${o}${o}${a}${a}${l}${l}`},Gt=(e,t)=>{let[n,r]=b.useState(e||""),[o,a]=b.useState(()=>I(n)),[l,s]=b.useState(o?.colorSpace||"hex");b.useEffect(()=>{let f=e||"",g=I(f);r(f),a(g),s(g?.colorSpace||"hex")},[e]);let c=b.useMemo(()=>At(n,o,l).toLowerCase(),[n,o,l]),i=b.useCallback(f=>{let g=I(f),w=g?.value||f||"";r(w),w===""&&(a(void 0),t(void 0)),g&&(a(g),s(g.colorSpace),t(g.value))},[t]),d=b.useCallback(()=>{let f=L.indexOf(l)+1;f>=L.length&&(f=0),s(L[f]);let g=o?.[L[f]]||"";r(g),t(g)},[o,l,t]);return{value:n,realValue:c,updateValue:i,color:o,colorSpace:l,cycleColorSpace:d}},D=e=>e.replace(/\s*/,"").toLowerCase(),Ut=(e,t,n)=>{let[r,o]=b.useState(t?.valid?[t]:[]);b.useEffect(()=>{t===void 0&&o([])},[t]);let a=b.useMemo(()=>(e||[]).map(s=>typeof s=="string"?I(s):s.title?{...I(s.color),keyword:s.title}:I(s.color)).concat(r).filter(Boolean).slice(-27),[e,r]),l=b.useCallback(s=>{s?.valid&&(a.some(c=>D(c[n])===D(s[n]))||o(c=>c.concat(s)))},[n,a]);return{presets:a,addPreset:l}},Yt=({name:e,value:t,onChange:n,onFocus:r,onBlur:o,presetColors:a,startOpen:l=!1,argType:s})=>{let c=b.useCallback(Rt(n,200),[n]),{value:i,realValue:d,updateValue:f,color:g,colorSpace:w,cycleColorSpace:S}=Gt(t,c),{presets:E,addPreset:p}=Ut(a,g,w),m=Vt[w],k=!!s?.table?.readonly;return h.createElement(jt,{"aria-readonly":k},h.createElement(Tt,{startOpen:l,trigger:k?[null]:void 0,closeOnOutsideClick:!0,onVisibleChange:()=>p(g),tooltip:h.createElement(zt,null,h.createElement(m,{color:d==="transparent"?"#000000":d,onChange:f,onFocus:r,onBlur:o}),E.length>0&&h.createElement(Ht,null,E.map((y,R)=>h.createElement(fe,{key:`${y.value}-${R}`,hasChrome:!1,tooltip:h.createElement(Ft,{note:y.keyword||y.value})},h.createElement(se,{value:y[w],active:g&&D(y[w])===D(g[w]),onClick:()=>f(y.value)})))))},h.createElement(se,{value:d,style:{margin:4}})),h.createElement(qt,{id:Ne(e),value:i,onChange:y=>f(y.target.value),onFocus:y=>y.target.select(),readOnly:k,placeholder:"Choose color..."}),i?h.createElement(Bt,{onClick:S}):null)},rn=Yt;export{Yt as ColorControl,rn as default};
|