what-core 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -38
  3. package/a11y.d.ts +128 -0
  4. package/data.d.ts +294 -0
  5. package/dist/a11y.js +510 -0
  6. package/dist/a11y.min.js +413 -0
  7. package/dist/actions.js +158 -0
  8. package/dist/actions.min.js +112 -0
  9. package/dist/animation.js +481 -0
  10. package/dist/animation.min.js +295 -0
  11. package/dist/async.js +180 -0
  12. package/dist/async.min.js +134 -0
  13. package/dist/components.js +577 -0
  14. package/dist/components.min.js +413 -0
  15. package/dist/data.js +1212 -0
  16. package/dist/data.min.js +918 -0
  17. package/dist/diagnostics.js +187 -0
  18. package/dist/diagnostics.min.js +134 -0
  19. package/dist/dom.js +796 -0
  20. package/dist/dom.min.js +603 -0
  21. package/dist/entries/a11y.js +43 -0
  22. package/dist/entries/a11y.min.js +43 -0
  23. package/dist/entries/data.js +29 -0
  24. package/dist/entries/data.min.js +29 -0
  25. package/dist/entries/dom.js +45 -0
  26. package/dist/entries/dom.min.js +45 -0
  27. package/dist/entries/form.js +31 -0
  28. package/dist/entries/form.min.js +31 -0
  29. package/dist/entries/internal.js +123 -0
  30. package/dist/entries/internal.min.js +123 -0
  31. package/dist/entries/motion.js +23 -0
  32. package/dist/entries/motion.min.js +23 -0
  33. package/dist/entries/ui.js +25 -0
  34. package/dist/entries/ui.min.js +25 -0
  35. package/dist/env.js +5 -0
  36. package/dist/env.min.js +5 -0
  37. package/dist/errors.js +1518 -0
  38. package/dist/errors.min.js +548 -0
  39. package/dist/form.js +936 -0
  40. package/dist/form.min.js +703 -0
  41. package/dist/guardrails.js +84 -0
  42. package/dist/guardrails.min.js +55 -0
  43. package/dist/h.js +232 -0
  44. package/dist/h.min.js +171 -0
  45. package/dist/head.js +241 -0
  46. package/dist/head.min.js +207 -0
  47. package/dist/helpers.js +126 -0
  48. package/dist/helpers.min.js +98 -0
  49. package/dist/hooks.js +255 -0
  50. package/dist/hooks.min.js +153 -0
  51. package/dist/hot.js +215 -0
  52. package/dist/hot.min.js +24 -0
  53. package/dist/hydration-data.js +495 -0
  54. package/dist/hydration-data.min.js +371 -0
  55. package/dist/import-changes.js +273 -0
  56. package/dist/import-changes.min.js +272 -0
  57. package/dist/index.js +95 -0
  58. package/dist/index.min.js +95 -227
  59. package/dist/jsx-dev-runtime.js +10 -0
  60. package/dist/jsx-dev-runtime.min.js +10 -1
  61. package/dist/jsx-runtime.js +27 -0
  62. package/dist/jsx-runtime.min.js +15 -1
  63. package/dist/live.js +54 -0
  64. package/dist/live.min.js +49 -0
  65. package/dist/markup-rules.js +250 -0
  66. package/dist/markup-rules.min.js +213 -0
  67. package/dist/reactive.js +3334 -0
  68. package/dist/reactive.min.js +2033 -0
  69. package/dist/render.js +4746 -0
  70. package/dist/render.min.js +2797 -1
  71. package/dist/scheduler.js +225 -0
  72. package/dist/scheduler.min.js +162 -0
  73. package/dist/selector.js +11 -0
  74. package/dist/selector.min.js +10 -0
  75. package/dist/server-context.js +148 -0
  76. package/dist/server-context.min.js +121 -0
  77. package/dist/skeleton.js +342 -0
  78. package/dist/skeleton.min.js +310 -0
  79. package/dist/store.js +72 -0
  80. package/dist/store.min.js +50 -0
  81. package/dist/testing.js +720 -0
  82. package/dist/testing.min.js +458 -1
  83. package/dist/vnode-adoption.js +19 -0
  84. package/dist/vnode-adoption.min.js +19 -0
  85. package/dist/vnode-renderer.js +61 -0
  86. package/dist/vnode-renderer.min.js +47 -0
  87. package/dom.d.ts +44 -0
  88. package/form.d.ts +218 -0
  89. package/hot.d.ts +35 -0
  90. package/index.d.ts +421 -736
  91. package/internal.d.ts +284 -0
  92. package/jsx-runtime.d.ts +160 -137
  93. package/markup-rules.d.ts +83 -0
  94. package/motion.d.ts +156 -0
  95. package/package.json +117 -3
  96. package/render.d.ts +278 -29
  97. package/src/a11y.js +64 -59
  98. package/src/actions.js +226 -0
  99. package/src/animation.js +105 -57
  100. package/src/async.js +259 -0
  101. package/src/components.js +495 -144
  102. package/src/data.js +1410 -1159
  103. package/src/diagnostics.js +263 -0
  104. package/src/dom.js +1159 -872
  105. package/src/entries/a11y.js +24 -0
  106. package/src/entries/data.js +17 -0
  107. package/src/entries/dom.js +29 -0
  108. package/src/entries/form.js +16 -0
  109. package/src/entries/internal.js +63 -0
  110. package/src/entries/motion.js +13 -0
  111. package/src/entries/ui.js +13 -0
  112. package/src/env-development.js +12 -0
  113. package/src/env.js +33 -0
  114. package/src/errors.js +1144 -168
  115. package/src/form.js +723 -225
  116. package/src/guardrails.js +38 -126
  117. package/src/h.js +227 -152
  118. package/src/head.js +189 -19
  119. package/src/helpers.js +47 -75
  120. package/src/hooks.js +233 -248
  121. package/src/hot.js +316 -0
  122. package/src/hydration-data.js +859 -16
  123. package/src/import-changes.js +156 -0
  124. package/src/index.js +38 -188
  125. package/src/jsx-dev-runtime.js +7 -14
  126. package/src/jsx-runtime.js +25 -9
  127. package/src/live.js +80 -0
  128. package/src/markup-rules.js +387 -0
  129. package/src/reactive.js +4400 -862
  130. package/src/render.js +6502 -2570
  131. package/src/scheduler.js +56 -21
  132. package/src/selector.js +31 -0
  133. package/src/server-context.js +252 -22
  134. package/src/skeleton.js +22 -12
  135. package/src/store.js +17 -31
  136. package/src/testing.js +389 -63
  137. package/src/vnode-adoption.js +48 -0
  138. package/src/vnode-renderer.js +114 -0
  139. package/testing.d.ts +81 -1
  140. package/ui.d.ts +20 -0
  141. package/dist/chunk-6YOUZ6T4.min.js +0 -1
  142. package/dist/chunk-FN6HXME3.min.js +0 -11
  143. package/dist/chunk-VKZY7JPN.min.js +0 -1
  144. package/src/agent-context.js +0 -127
  145. package/src/warnings.js +0 -193
@@ -0,0 +1,49 @@
1
+ // src/live.js
2
+ import { _readKey as c, untrack as s } from "./reactive.min.js";
3
+ function a(r) {
4
+ if (typeof r != "function") throw new TypeError("live(source): source must be a function that returns the current value");
5
+ let u = /* @__PURE__ */ Object.create(null), i = (t) => c(t, r), o = () => s(() => c(null, r)), f = (t) => {
6
+ !Object.hasOwn(u, t) && Object.isExtensible(u) && Object.defineProperty(u, t, {
7
+ get: () => {
8
+ let e = i(t);
9
+ return e?.[t];
10
+ },
11
+ enumerable: !0,
12
+ configurable: !0
13
+ });
14
+ };
15
+ return new Proxy(u, {
16
+ get(t, e) {
17
+ if (typeof e != "string") return;
18
+ let n = i(e);
19
+ if (n != null)
20
+ return Object.hasOwn(n, e) && f(e), n[e];
21
+ },
22
+ getOwnPropertyDescriptor(t, e) {
23
+ if (typeof e == "string") {
24
+ if (!Object.hasOwn(t, e)) {
25
+ let n = o();
26
+ if (n == null || !Object.hasOwn(n, e)) return;
27
+ f(e);
28
+ }
29
+ return Reflect.getOwnPropertyDescriptor(t, e);
30
+ }
31
+ },
32
+ has(t, e) {
33
+ if (typeof e != "string") return !1;
34
+ let n = o();
35
+ return n != null && e in Object(n) || Object.hasOwn(t, e);
36
+ },
37
+ ownKeys(t) {
38
+ let e = r();
39
+ if (e != null) for (let n of Object.keys(e)) f(n);
40
+ return Reflect.ownKeys(t);
41
+ },
42
+ set() {
43
+ return !1;
44
+ }
45
+ });
46
+ }
47
+ export {
48
+ a as live
49
+ };
@@ -0,0 +1,250 @@
1
+ // src/markup-rules.js
2
+ var SAFE_ATTR_NAME = /^[a-zA-Z_:][a-zA-Z0-9:._-]*$/;
3
+ var SAFE_TAG_NAME = /^[a-zA-Z_][a-zA-Z0-9._:-]*$/;
4
+ var URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "ping", "xlink:href", "xlinkhref", "values", "to", "from", "by"]);
5
+ function isUrlAttr(name) {
6
+ return URL_ATTRS.has(name.toLowerCase());
7
+ }
8
+ function isUnsafeUrl(value) {
9
+ if (value == null) return false;
10
+ let normalized;
11
+ try {
12
+ normalized = String(value).replace(/[\p{Cc}\s]+/gu, "").toLowerCase();
13
+ } catch {
14
+ return true;
15
+ }
16
+ return normalized.split(";").some((url) => url.startsWith("javascript:") || url.startsWith("vbscript:") || url.startsWith("data:"));
17
+ }
18
+ var REFUSED_ATTRS = /* @__PURE__ */ new Set(["srcdoc", "outerhtml"]);
19
+ function isRefusedAttr(name) {
20
+ return REFUSED_ATTRS.has(name.toLowerCase());
21
+ }
22
+ var INNER_HTML_PROPS = /* @__PURE__ */ new Set(["innerHTML", "dangerouslySetInnerHTML"]);
23
+ var ATTRIBUTE_ALIASES = /* @__PURE__ */ new Map([
24
+ ["className", "class"],
25
+ ["htmlFor", "for"],
26
+ ["httpEquiv", "http-equiv"],
27
+ ["acceptCharset", "accept-charset"]
28
+ ]);
29
+ function attributeName(prop) {
30
+ return ATTRIBUTE_ALIASES.get(prop) || prop;
31
+ }
32
+ var DEFAULT_ATTRIBUTES = /* @__PURE__ */ new Map([
33
+ ["defaultValue", "value"],
34
+ ["defaultChecked", "checked"],
35
+ ["defaultSelected", "selected"]
36
+ ]);
37
+ var XML_PROP = /^(xlink|xml)([A-Z])/;
38
+ function markupName(prop) {
39
+ return DEFAULT_ATTRIBUTES.get(prop) || attributeName(prop).replace(XML_PROP, (_, prefix, first) => prefix + ":" + first.toLowerCase());
40
+ }
41
+ var FIELD_PROPS = /* @__PURE__ */ new Set(["value", "defaultValue", "checked", "defaultChecked"]);
42
+ var FIELD_TAGS = /* @__PURE__ */ new Set(["input", "textarea", "select"]);
43
+ var ATTRIBUTE_VALUE_TYPES = /* @__PURE__ */ new Set(["checkbox", "radio", "hidden", "submit", "reset", "button", "image"]);
44
+ function stripAndCollapse(text) {
45
+ return text.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g, "").replace(/[\t\n\f\r ]+/g, " ");
46
+ }
47
+ function selectedOptions(values, value) {
48
+ if (Array.isArray(value)) {
49
+ const wanted = value.map(String);
50
+ return values.map((v) => wanted.includes(v));
51
+ }
52
+ const at = values.indexOf(String(value));
53
+ return values.map((_, i) => i === at);
54
+ }
55
+ function isAriaAttr(name) {
56
+ return name === "role" || name.startsWith("aria-");
57
+ }
58
+ function isEnumeratedAttr(name) {
59
+ return isAriaAttr(name) || name.startsWith("data-") || /^(draggable|spellcheck|contenteditable)$/i.test(name);
60
+ }
61
+ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
62
+ "area",
63
+ "base",
64
+ "br",
65
+ "col",
66
+ "embed",
67
+ "hr",
68
+ "img",
69
+ "input",
70
+ "link",
71
+ "meta",
72
+ "param",
73
+ "source",
74
+ "track",
75
+ "wbr"
76
+ ]);
77
+ var SVG_HTML_INTEGRATION_POINTS = /* @__PURE__ */ new Set(["foreignObject", "desc", "title"]);
78
+ var MATHML_TEXT_INTEGRATION_POINTS = /* @__PURE__ */ new Set(["mi", "mo", "mn", "ms", "mtext"]);
79
+ var MATHML_IN_TEXT_POINTS = /* @__PURE__ */ new Set(["mglyph", "malignmark"]);
80
+ var HTML_ENCODINGS = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml"]);
81
+ function childNamespace(ns, tag, encoding) {
82
+ if (ns === null) {
83
+ if (tag === "svg") return "svg";
84
+ return tag === "math" || MATHML_IN_TEXT_POINTS.has(tag) ? "math" : null;
85
+ }
86
+ if (ns === "svg") return SVG_HTML_INTEGRATION_POINTS.has(tag) ? null : "svg";
87
+ if (ns === "math") {
88
+ if (MATHML_TEXT_INTEGRATION_POINTS.has(tag)) return null;
89
+ return tag === "annotation-xml" && typeof encoding === "string" && HTML_ENCODINGS.has(encoding.toLowerCase()) ? null : "math";
90
+ }
91
+ return ns;
92
+ }
93
+ var RAW_TEXT_ELEMENTS = /* @__PURE__ */ new Set(["script", "style"]);
94
+ var TEXT_ONLY_ELEMENTS = /* @__PURE__ */ new Set(["textarea", "title"]);
95
+ var LEADING_NEWLINE_ELEMENTS = /* @__PURE__ */ new Set(["pre", "textarea", "listing"]);
96
+ function rawTextHazard(tag, text) {
97
+ return text.includes("</") || tag === "script" && text.includes("<!--");
98
+ }
99
+ function encodeRawText(tag, text) {
100
+ if (!rawTextHazard(tag, text)) return text;
101
+ const out = text.replace(/<\//g, "<\\/");
102
+ return tag === "script" ? out.replace(/<!--/g, "\\u003C!--") : out;
103
+ }
104
+ function rawTextContent(tag, text, ns) {
105
+ if (ns === null) return encodeRawText(tag, text);
106
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
107
+ }
108
+ function isNamespaceNeutralText(text) {
109
+ return !/[&<]/.test(text);
110
+ }
111
+ var NEEDS_ESCAPE = /[&<>"']/;
112
+ function escapeHtml(str) {
113
+ if (!NEEDS_ESCAPE.test(str)) return str;
114
+ const first = str.search(NEEDS_ESCAPE);
115
+ let out = "";
116
+ let last = 0;
117
+ for (let i = first; i < str.length; i++) {
118
+ let replacement;
119
+ switch (str.charCodeAt(i)) {
120
+ case 38:
121
+ replacement = "&amp;";
122
+ break;
123
+ case 60:
124
+ replacement = "&lt;";
125
+ break;
126
+ case 62:
127
+ replacement = "&gt;";
128
+ break;
129
+ case 34:
130
+ replacement = "&quot;";
131
+ break;
132
+ case 39:
133
+ replacement = "&#39;";
134
+ break;
135
+ default:
136
+ continue;
137
+ }
138
+ if (last < i) out += str.slice(last, i);
139
+ out += replacement;
140
+ last = i + 1;
141
+ }
142
+ return last < str.length ? out + str.slice(last) : out;
143
+ }
144
+ var CSS_PROPERTY = /^(?:--[\w-]+|-?[a-zA-Z][\w-]*)$/;
145
+ var isControl = (code) => code < 32 && code !== 9 && code !== 10 && code !== 12 && code !== 13 || code === 127;
146
+ function oneDeclaration(text) {
147
+ const open = [];
148
+ let quote = "";
149
+ for (let i = 0; i < text.length; i++) {
150
+ const c = text[i];
151
+ if (isControl(text.charCodeAt(i))) return false;
152
+ if (quote !== "") {
153
+ if (c === "\\") i++;
154
+ else if (c === quote) quote = "";
155
+ else if (c === "\n" || c === "\r" || c === "\f") return false;
156
+ } else if (c === '"' || c === "'") quote = c;
157
+ else if (c === "(" && isUrlFunction(text, i)) {
158
+ const end = urlTokenEnd(text, i + 1);
159
+ if (end === -1) return false;
160
+ if (end > i) i = end;
161
+ else open.push(")");
162
+ } else if (c === "(" || c === "[") open.push(c === "(" ? ")" : "]");
163
+ else if (c === ")" || c === "]") {
164
+ if (open.pop() !== c) return false;
165
+ } else if (c === "\\" || c === "{" || c === "}" || c === "/" && text[i + 1] === "*" || c === ";" && open.length === 0) return false;
166
+ }
167
+ return open.length === 0 && quote === "";
168
+ }
169
+ function isUrlFunction(text, at) {
170
+ return at >= 3 && text.slice(at - 3, at).toLowerCase() === "url" && (at === 3 || !/[\w\u0080-\uffff-]/.test(text[at - 4]));
171
+ }
172
+ function urlTokenEnd(text, from) {
173
+ let i = from;
174
+ while (i < text.length && /[ \t\n\r\f]/.test(text[i])) i++;
175
+ if (text[i] === '"' || text[i] === "'") return from - 1;
176
+ for (; i < text.length; i++) {
177
+ const c = text[i];
178
+ if (c === ")") return i;
179
+ if (c === '"' || c === "'" || c === "(" || c === "\\") return -1;
180
+ if (/[ \t\n\r\f]/.test(c)) {
181
+ while (i < text.length && /[ \t\n\r\f]/.test(text[i])) i++;
182
+ return text[i] === ")" ? i : -1;
183
+ }
184
+ }
185
+ return -1;
186
+ }
187
+ var _cssNames = /* @__PURE__ */ new Map();
188
+ var CSS_NAME_CACHE_SIZE = 1024;
189
+ function cssName(property) {
190
+ let name = _cssNames.get(property);
191
+ if (name === void 0) {
192
+ name = !CSS_PROPERTY.test(property) ? null : property.startsWith("--") ? property : property.replace(/([A-Z])/g, "-$1").toLowerCase();
193
+ if (_cssNames.size < CSS_NAME_CACHE_SIZE) _cssNames.set(property, name);
194
+ }
195
+ return name;
196
+ }
197
+ var PLAIN_CSS_VALUE = /^[\w#%.,+ -]*$/;
198
+ function styleText(style) {
199
+ let css = "";
200
+ const properties = Object.keys(style);
201
+ for (let i = 0; i < properties.length; i++) {
202
+ const property = properties[i];
203
+ const value = style[property];
204
+ if (value == null || value === "" || typeof value === "boolean") continue;
205
+ const text = String(value);
206
+ const name = cssName(property);
207
+ if (name === null || !(PLAIN_CSS_VALUE.test(text) || oneDeclaration(text))) continue;
208
+ css += (css ? ";" : "") + name + ":" + text;
209
+ }
210
+ return css;
211
+ }
212
+ export {
213
+ ATTRIBUTE_ALIASES,
214
+ ATTRIBUTE_VALUE_TYPES,
215
+ CSS_NAME_CACHE_SIZE,
216
+ FIELD_PROPS,
217
+ FIELD_TAGS,
218
+ HTML_ENCODINGS,
219
+ INNER_HTML_PROPS,
220
+ LEADING_NEWLINE_ELEMENTS,
221
+ MATHML_IN_TEXT_POINTS,
222
+ MATHML_TEXT_INTEGRATION_POINTS,
223
+ PLAIN_CSS_VALUE,
224
+ RAW_TEXT_ELEMENTS,
225
+ REFUSED_ATTRS,
226
+ SAFE_ATTR_NAME,
227
+ SAFE_TAG_NAME,
228
+ SVG_HTML_INTEGRATION_POINTS,
229
+ TEXT_ONLY_ELEMENTS,
230
+ URL_ATTRS,
231
+ VOID_ELEMENTS,
232
+ _cssNames,
233
+ attributeName,
234
+ childNamespace,
235
+ encodeRawText,
236
+ escapeHtml,
237
+ isAriaAttr,
238
+ isEnumeratedAttr,
239
+ isNamespaceNeutralText,
240
+ isRefusedAttr,
241
+ isUnsafeUrl,
242
+ isUrlAttr,
243
+ markupName,
244
+ oneDeclaration,
245
+ rawTextContent,
246
+ rawTextHazard,
247
+ selectedOptions,
248
+ stripAndCollapse,
249
+ styleText
250
+ };
@@ -0,0 +1,213 @@
1
+ // src/markup-rules.js
2
+ var R = /^[a-zA-Z_:][a-zA-Z0-9:._-]*$/, O = /^[a-zA-Z_][a-zA-Z0-9._:-]*$/, u = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "ping", "xlink:href", "xlinkhref", "values", "to", "from", "by"]);
3
+ function P(e) {
4
+ return u.has(e.toLowerCase());
5
+ }
6
+ function U(e) {
7
+ if (e == null) return !1;
8
+ let t;
9
+ try {
10
+ t = String(e).replace(/[\p{Cc}\s]+/gu, "").toLowerCase();
11
+ } catch {
12
+ return !0;
13
+ }
14
+ return t.split(";").some((n) => n.startsWith("javascript:") || n.startsWith("vbscript:") || n.startsWith("data:"));
15
+ }
16
+ var f = /* @__PURE__ */ new Set(["srcdoc", "outerhtml"]);
17
+ function H(e) {
18
+ return f.has(e.toLowerCase());
19
+ }
20
+ var D = /* @__PURE__ */ new Set(["innerHTML", "dangerouslySetInnerHTML"]), p = /* @__PURE__ */ new Map([
21
+ ["className", "class"],
22
+ ["htmlFor", "for"],
23
+ ["httpEquiv", "http-equiv"],
24
+ ["acceptCharset", "accept-charset"]
25
+ ]);
26
+ function h(e) {
27
+ return p.get(e) || e;
28
+ }
29
+ var T = /* @__PURE__ */ new Map([
30
+ ["defaultValue", "value"],
31
+ ["defaultChecked", "checked"],
32
+ ["defaultSelected", "selected"]
33
+ ]), E = /^(xlink|xml)([A-Z])/;
34
+ function z(e) {
35
+ return T.get(e) || h(e).replace(E, (t, n, s) => n + ":" + s.toLowerCase());
36
+ }
37
+ var F = /* @__PURE__ */ new Set(["value", "defaultValue", "checked", "defaultChecked"]), W = /* @__PURE__ */ new Set(["input", "textarea", "select"]), Z = /* @__PURE__ */ new Set(["checkbox", "radio", "hidden", "submit", "reset", "button", "image"]);
38
+ function v(e) {
39
+ return e.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g, "").replace(/[\t\n\f\r ]+/g, " ");
40
+ }
41
+ function G(e, t) {
42
+ if (Array.isArray(t)) {
43
+ let s = t.map(String);
44
+ return e.map((r) => s.includes(r));
45
+ }
46
+ let n = e.indexOf(String(t));
47
+ return e.map((s, r) => r === n);
48
+ }
49
+ function S(e) {
50
+ return e === "role" || e.startsWith("aria-");
51
+ }
52
+ function $(e) {
53
+ return S(e) || e.startsWith("data-") || /^(draggable|spellcheck|contenteditable)$/i.test(e);
54
+ }
55
+ var y = /* @__PURE__ */ new Set([
56
+ "area",
57
+ "base",
58
+ "br",
59
+ "col",
60
+ "embed",
61
+ "hr",
62
+ "img",
63
+ "input",
64
+ "link",
65
+ "meta",
66
+ "param",
67
+ "source",
68
+ "track",
69
+ "wbr"
70
+ ]), _ = /* @__PURE__ */ new Set(["foreignObject", "desc", "title"]), x = /* @__PURE__ */ new Set(["mi", "mo", "mn", "ms", "mtext"]), A = /* @__PURE__ */ new Set(["mglyph", "malignmark"]), m = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml"]);
71
+ function V(e, t, n) {
72
+ return e === null ? t === "svg" ? "svg" : t === "math" || A.has(t) ? "math" : null : e === "svg" ? _.has(t) ? null : "svg" : e === "math" ? x.has(t) || t === "annotation-xml" && typeof n == "string" && m.has(n.toLowerCase()) ? null : "math" : e;
73
+ }
74
+ var X = /* @__PURE__ */ new Set(["script", "style"]), q = /* @__PURE__ */ new Set(["textarea", "title"]), j = /* @__PURE__ */ new Set(["pre", "textarea", "listing"]);
75
+ function d(e, t) {
76
+ return t.includes("</") || e === "script" && t.includes("<!--");
77
+ }
78
+ function w(e, t) {
79
+ if (!d(e, t)) return t;
80
+ let n = t.replace(/<\//g, "<\\/");
81
+ return e === "script" ? n.replace(/<!--/g, "\\u003C!--") : n;
82
+ }
83
+ function B(e, t, n) {
84
+ return n === null ? w(e, t) : t.replace(/&/g, "&amp;").replace(/</g, "&lt;");
85
+ }
86
+ function Y(e) {
87
+ return !/[&<]/.test(e);
88
+ }
89
+ var l = /[&<>"']/;
90
+ function J(e) {
91
+ if (!l.test(e)) return e;
92
+ let t = e.search(l), n = "", s = 0;
93
+ for (let r = t; r < e.length; r++) {
94
+ let o;
95
+ switch (e.charCodeAt(r)) {
96
+ case 38:
97
+ o = "&amp;";
98
+ break;
99
+ case 60:
100
+ o = "&lt;";
101
+ break;
102
+ case 62:
103
+ o = "&gt;";
104
+ break;
105
+ case 34:
106
+ o = "&quot;";
107
+ break;
108
+ case 39:
109
+ o = "&#39;";
110
+ break;
111
+ default:
112
+ continue;
113
+ }
114
+ s < r && (n += e.slice(s, r)), n += o, s = r + 1;
115
+ }
116
+ return s < e.length ? n + e.slice(s) : n;
117
+ }
118
+ var g = /^(?:--[\w-]+|-?[a-zA-Z][\w-]*)$/, N = (e) => e < 32 && e !== 9 && e !== 10 && e !== 12 && e !== 13 || e === 127;
119
+ function L(e) {
120
+ let t = [], n = "";
121
+ for (let s = 0; s < e.length; s++) {
122
+ let r = e[s];
123
+ if (N(e.charCodeAt(s))) return !1;
124
+ if (n !== "") {
125
+ if (r === "\\") s++;
126
+ else if (r === n) n = "";
127
+ else if (r === `
128
+ ` || r === "\r" || r === "\f") return !1;
129
+ } else if (r === '"' || r === "'") n = r;
130
+ else if (r === "(" && C(e, s)) {
131
+ let o = I(e, s + 1);
132
+ if (o === -1) return !1;
133
+ o > s ? s = o : t.push(")");
134
+ } else if (r === "(" || r === "[") t.push(r === "(" ? ")" : "]");
135
+ else if (r === ")" || r === "]") {
136
+ if (t.pop() !== r) return !1;
137
+ } else if (r === "\\" || r === "{" || r === "}" || r === "/" && e[s + 1] === "*" || r === ";" && t.length === 0) return !1;
138
+ }
139
+ return t.length === 0 && n === "";
140
+ }
141
+ function C(e, t) {
142
+ return t >= 3 && e.slice(t - 3, t).toLowerCase() === "url" && (t === 3 || !/[\w\u0080-\uffff-]/.test(e[t - 4]));
143
+ }
144
+ function I(e, t) {
145
+ let n = t;
146
+ for (; n < e.length && /[ \t\n\r\f]/.test(e[n]); ) n++;
147
+ if (e[n] === '"' || e[n] === "'") return t - 1;
148
+ for (; n < e.length; n++) {
149
+ let s = e[n];
150
+ if (s === ")") return n;
151
+ if (s === '"' || s === "'" || s === "(" || s === "\\") return -1;
152
+ if (/[ \t\n\r\f]/.test(s)) {
153
+ for (; n < e.length && /[ \t\n\r\f]/.test(e[n]); ) n++;
154
+ return e[n] === ")" ? n : -1;
155
+ }
156
+ }
157
+ return -1;
158
+ }
159
+ var i = /* @__PURE__ */ new Map(), b = 1024;
160
+ function k(e) {
161
+ let t = i.get(e);
162
+ return t === void 0 && (t = g.test(e) ? e.startsWith("--") ? e : e.replace(/([A-Z])/g, "-$1").toLowerCase() : null, i.size < b && i.set(e, t)), t;
163
+ }
164
+ var M = /^[\w#%.,+ -]*$/;
165
+ function K(e) {
166
+ let t = "", n = Object.keys(e);
167
+ for (let s = 0; s < n.length; s++) {
168
+ let r = n[s], o = e[r];
169
+ if (o == null || o === "" || typeof o == "boolean") continue;
170
+ let a = String(o), c = k(r);
171
+ c === null || !(M.test(a) || L(a)) || (t += (t ? ";" : "") + c + ":" + a);
172
+ }
173
+ return t;
174
+ }
175
+ export {
176
+ p as ATTRIBUTE_ALIASES,
177
+ Z as ATTRIBUTE_VALUE_TYPES,
178
+ b as CSS_NAME_CACHE_SIZE,
179
+ F as FIELD_PROPS,
180
+ W as FIELD_TAGS,
181
+ m as HTML_ENCODINGS,
182
+ D as INNER_HTML_PROPS,
183
+ j as LEADING_NEWLINE_ELEMENTS,
184
+ A as MATHML_IN_TEXT_POINTS,
185
+ x as MATHML_TEXT_INTEGRATION_POINTS,
186
+ M as PLAIN_CSS_VALUE,
187
+ X as RAW_TEXT_ELEMENTS,
188
+ f as REFUSED_ATTRS,
189
+ R as SAFE_ATTR_NAME,
190
+ O as SAFE_TAG_NAME,
191
+ _ as SVG_HTML_INTEGRATION_POINTS,
192
+ q as TEXT_ONLY_ELEMENTS,
193
+ u as URL_ATTRS,
194
+ y as VOID_ELEMENTS,
195
+ i as _cssNames,
196
+ h as attributeName,
197
+ V as childNamespace,
198
+ w as encodeRawText,
199
+ J as escapeHtml,
200
+ S as isAriaAttr,
201
+ $ as isEnumeratedAttr,
202
+ Y as isNamespaceNeutralText,
203
+ H as isRefusedAttr,
204
+ U as isUnsafeUrl,
205
+ P as isUrlAttr,
206
+ z as markupName,
207
+ L as oneDeclaration,
208
+ B as rawTextContent,
209
+ d as rawTextHazard,
210
+ G as selectedOptions,
211
+ v as stripAndCollapse,
212
+ K as styleText
213
+ };