zudoku 0.3.0-dev.32 → 0.3.0-dev.34

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 (40) hide show
  1. package/dist/app/entry.client.d.ts +0 -2
  2. package/dist/app/entry.client.js +17 -8
  3. package/dist/app/entry.client.js.map +1 -1
  4. package/dist/app/entry.server.js +2 -10
  5. package/dist/app/entry.server.js.map +1 -1
  6. package/dist/lib/components/DevPortal.js +3 -9
  7. package/dist/lib/components/DevPortal.js.map +1 -1
  8. package/dist/lib/components/Layout.js +1 -4
  9. package/dist/lib/components/Layout.js.map +1 -1
  10. package/dist/lib/plugins/markdown/MdxPage.js +1 -3
  11. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  12. package/dist/lib/plugins/openapi/playground/QueryParams.js +2 -1
  13. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  14. package/dist/vite/build.js +11 -5
  15. package/dist/vite/build.js.map +1 -1
  16. package/dist/vite/config.js +3 -2
  17. package/dist/vite/config.js.map +1 -1
  18. package/lib/{MdxPage-Z3HKNTrj.js → MdxPage-BRKQDcVW.js} +87 -88
  19. package/lib/{MdxPage-Z3HKNTrj.js.map → MdxPage-BRKQDcVW.js.map} +1 -1
  20. package/lib/{OperationList-KoITgfDT.js → OperationList-DfkWNe8Y.js} +7 -3
  21. package/lib/{OperationList-KoITgfDT.js.map → OperationList-DfkWNe8Y.js.map} +1 -1
  22. package/lib/{index-BoWzKb_9.js → index-BjSy8IQO.js} +2 -2
  23. package/lib/{index-BoWzKb_9.js.map → index-BjSy8IQO.js.map} +1 -1
  24. package/lib/{index-BdWBDosx.js → index-Brq2ztwd.js} +2 -2
  25. package/lib/{index-BdWBDosx.js.map → index-Brq2ztwd.js.map} +1 -1
  26. package/lib/index-QzXzw_ra.js +24 -0
  27. package/lib/index-QzXzw_ra.js.map +1 -0
  28. package/lib/zudoku.components.js +147 -156
  29. package/lib/zudoku.components.js.map +1 -1
  30. package/lib/zudoku.plugin-markdown.js +1 -1
  31. package/lib/zudoku.plugin-openapi.js +1 -1
  32. package/package.json +8 -9
  33. package/src/app/entry.client.tsx +28 -18
  34. package/src/app/entry.server.tsx +2 -17
  35. package/src/lib/components/DevPortal.tsx +1 -15
  36. package/src/lib/components/Layout.tsx +0 -9
  37. package/src/lib/plugins/markdown/MdxPage.tsx +0 -6
  38. package/src/lib/plugins/openapi/playground/QueryParams.tsx +6 -1
  39. package/lib/index.esm-CPEExBJE.js +0 -694
  40. package/lib/index.esm-CPEExBJE.js.map +0 -1
@@ -5,6 +5,7 @@ import {
5
5
  useFieldArray,
6
6
  useFormContext,
7
7
  } from "react-hook-form";
8
+ import { cn } from "../../../util/cn.js";
8
9
  import { InlineInput } from "./InlineInput.js";
9
10
  import type { PlaygroundForm } from "./Playground.js";
10
11
 
@@ -73,7 +74,11 @@ export const QueryParams = ({
73
74
  render={({ field }) => {
74
75
  return (
75
76
  <button
76
- className="hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible"
77
+ type="button"
78
+ className={cn(
79
+ "hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible",
80
+ field.value.length === 0 && "opacity-0 pointer-events-none",
81
+ )}
77
82
  onClick={() => field.onChange("")}
78
83
  >
79
84
  <XIcon size={16} />
@@ -1,694 +0,0 @@
1
- var re = Object.defineProperty;
2
- var ne = (e, t, r) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var T = (e, t, r) => ne(e, typeof t != "symbol" ? t + "" : t, r);
4
- import m, { Component as L } from "react";
5
- import { g as F } from "./_commonjsHelpers-BkfeUUK-.js";
6
- const H = {}, B = m.createContext(H);
7
- function se(e) {
8
- const t = m.useContext(B);
9
- return m.useMemo(
10
- function() {
11
- return typeof e == "function" ? e(t) : { ...t, ...e };
12
- },
13
- [t, e]
14
- );
15
- }
16
- function je(e) {
17
- let t;
18
- return e.disableParentContext ? t = typeof e.components == "function" ? e.components(H) : e.components || H : t = se(e.components), m.createElement(
19
- B.Provider,
20
- { value: t },
21
- e.children
22
- );
23
- }
24
- var ie = typeof Element < "u", oe = typeof Map == "function", ae = typeof Set == "function", le = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
25
- function x(e, t) {
26
- if (e === t) return !0;
27
- if (e && t && typeof e == "object" && typeof t == "object") {
28
- if (e.constructor !== t.constructor) return !1;
29
- var r, n, s;
30
- if (Array.isArray(e)) {
31
- if (r = e.length, r != t.length) return !1;
32
- for (n = r; n-- !== 0; )
33
- if (!x(e[n], t[n])) return !1;
34
- return !0;
35
- }
36
- var i;
37
- if (oe && e instanceof Map && t instanceof Map) {
38
- if (e.size !== t.size) return !1;
39
- for (i = e.entries(); !(n = i.next()).done; )
40
- if (!t.has(n.value[0])) return !1;
41
- for (i = e.entries(); !(n = i.next()).done; )
42
- if (!x(n.value[1], t.get(n.value[0]))) return !1;
43
- return !0;
44
- }
45
- if (ae && e instanceof Set && t instanceof Set) {
46
- if (e.size !== t.size) return !1;
47
- for (i = e.entries(); !(n = i.next()).done; )
48
- if (!t.has(n.value[0])) return !1;
49
- return !0;
50
- }
51
- if (le && ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
52
- if (r = e.length, r != t.length) return !1;
53
- for (n = r; n-- !== 0; )
54
- if (e[n] !== t[n]) return !1;
55
- return !0;
56
- }
57
- if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
58
- if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof t.valueOf == "function") return e.valueOf() === t.valueOf();
59
- if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof t.toString == "function") return e.toString() === t.toString();
60
- if (s = Object.keys(e), r = s.length, r !== Object.keys(t).length) return !1;
61
- for (n = r; n-- !== 0; )
62
- if (!Object.prototype.hasOwnProperty.call(t, s[n])) return !1;
63
- if (ie && e instanceof Element) return !1;
64
- for (n = r; n-- !== 0; )
65
- if (!((s[n] === "_owner" || s[n] === "__v" || s[n] === "__o") && e.$$typeof) && !x(e[s[n]], t[s[n]]))
66
- return !1;
67
- return !0;
68
- }
69
- return e !== e && t !== t;
70
- }
71
- var ce = function(t, r) {
72
- try {
73
- return x(t, r);
74
- } catch (n) {
75
- if ((n.message || "").match(/stack|recursion/i))
76
- return console.warn("react-fast-compare cannot handle circular refs"), !1;
77
- throw n;
78
- }
79
- };
80
- const ue = /* @__PURE__ */ F(ce);
81
- var fe = function(e, t, r, n, s, i, c, o) {
82
- if (process.env.NODE_ENV !== "production" && t === void 0)
83
- throw new Error("invariant requires an error message argument");
84
- if (!e) {
85
- var l;
86
- if (t === void 0)
87
- l = new Error(
88
- "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
89
- );
90
- else {
91
- var a = [r, n, s, i, c, o], u = 0;
92
- l = new Error(
93
- t.replace(/%s/g, function() {
94
- return a[u++];
95
- })
96
- ), l.name = "Invariant Violation";
97
- }
98
- throw l.framesToPop = 1, l;
99
- }
100
- }, pe = fe;
101
- const z = /* @__PURE__ */ F(pe);
102
- var de = function(t, r, n, s) {
103
- var i = n ? n.call(s, t, r) : void 0;
104
- if (i !== void 0)
105
- return !!i;
106
- if (t === r)
107
- return !0;
108
- if (typeof t != "object" || !t || typeof r != "object" || !r)
109
- return !1;
110
- var c = Object.keys(t), o = Object.keys(r);
111
- if (c.length !== o.length)
112
- return !1;
113
- for (var l = Object.prototype.hasOwnProperty.bind(r), a = 0; a < c.length; a++) {
114
- var u = c[a];
115
- if (!l(u))
116
- return !1;
117
- var f = t[u], h = r[u];
118
- if (i = n ? n.call(s, f, h, u) : void 0, i === !1 || i === void 0 && f !== h)
119
- return !1;
120
- }
121
- return !0;
122
- };
123
- const me = /* @__PURE__ */ F(de);
124
- var Z = /* @__PURE__ */ ((e) => (e.BASE = "base", e.BODY = "body", e.HEAD = "head", e.HTML = "html", e.LINK = "link", e.META = "meta", e.NOSCRIPT = "noscript", e.SCRIPT = "script", e.STYLE = "style", e.TITLE = "title", e.FRAGMENT = "Symbol(react.fragment)", e))(Z || {}), $ = {
125
- link: { rel: ["amphtml", "canonical", "alternate"] },
126
- script: { type: ["application/ld+json"] },
127
- meta: {
128
- charset: "",
129
- name: ["generator", "robots", "description"],
130
- property: [
131
- "og:type",
132
- "og:title",
133
- "og:url",
134
- "og:image",
135
- "og:image:alt",
136
- "og:description",
137
- "twitter:url",
138
- "twitter:title",
139
- "twitter:description",
140
- "twitter:image",
141
- "twitter:image:alt",
142
- "twitter:card",
143
- "twitter:site"
144
- ]
145
- }
146
- }, N = Object.values(Z), U = {
147
- accesskey: "accessKey",
148
- charset: "charSet",
149
- class: "className",
150
- contenteditable: "contentEditable",
151
- contextmenu: "contextMenu",
152
- "http-equiv": "httpEquiv",
153
- itemprop: "itemProp",
154
- tabindex: "tabIndex"
155
- }, he = Object.entries(U).reduce(
156
- (e, [t, r]) => (e[r] = t, e),
157
- {}
158
- ), y = "data-rh", C = {
159
- DEFAULT_TITLE: "defaultTitle",
160
- DEFER: "defer",
161
- ENCODE_SPECIAL_CHARACTERS: "encodeSpecialCharacters",
162
- ON_CHANGE_CLIENT_STATE: "onChangeClientState",
163
- TITLE_TEMPLATE: "titleTemplate",
164
- PRIORITIZE_SEO_TAGS: "prioritizeSeoTags"
165
- }, E = (e, t) => {
166
- for (let r = e.length - 1; r >= 0; r -= 1) {
167
- const n = e[r];
168
- if (Object.prototype.hasOwnProperty.call(n, t))
169
- return n[t];
170
- }
171
- return null;
172
- }, ye = (e) => {
173
- let t = E(
174
- e,
175
- "title"
176
- /* TITLE */
177
- );
178
- const r = E(e, C.TITLE_TEMPLATE);
179
- if (Array.isArray(t) && (t = t.join("")), r && t)
180
- return r.replace(/%s/g, () => t);
181
- const n = E(e, C.DEFAULT_TITLE);
182
- return t || n || void 0;
183
- }, Te = (e) => E(e, C.ON_CHANGE_CLIENT_STATE) || (() => {
184
- }), I = (e, t) => t.filter((r) => typeof r[e] < "u").map((r) => r[e]).reduce((r, n) => ({ ...r, ...n }), {}), ge = (e, t) => t.filter((r) => typeof r.base < "u").map((r) => r.base).reverse().reduce((r, n) => {
185
- if (!r.length) {
186
- const s = Object.keys(n);
187
- for (let i = 0; i < s.length; i += 1) {
188
- const o = s[i].toLowerCase();
189
- if (e.indexOf(o) !== -1 && n[o])
190
- return r.concat(n);
191
- }
192
- }
193
- return r;
194
- }, []), ve = (e) => console && typeof console.warn == "function" && console.warn(e), b = (e, t, r) => {
195
- const n = {};
196
- return r.filter((s) => Array.isArray(s[e]) ? !0 : (typeof s[e] < "u" && ve(
197
- `Helmet: ${e} should be of type "Array". Instead found type "${typeof s[e]}"`
198
- ), !1)).map((s) => s[e]).reverse().reduce((s, i) => {
199
- const c = {};
200
- i.filter((l) => {
201
- let a;
202
- const u = Object.keys(l);
203
- for (let h = 0; h < u.length; h += 1) {
204
- const p = u[h], g = p.toLowerCase();
205
- t.indexOf(g) !== -1 && !(a === "rel" && l[a].toLowerCase() === "canonical") && !(g === "rel" && l[g].toLowerCase() === "stylesheet") && (a = g), t.indexOf(p) !== -1 && (p === "innerHTML" || p === "cssText" || p === "itemprop") && (a = p);
206
- }
207
- if (!a || !l[a])
208
- return !1;
209
- const f = l[a].toLowerCase();
210
- return n[a] || (n[a] = {}), c[a] || (c[a] = {}), n[a][f] ? !1 : (c[a][f] = !0, !0);
211
- }).reverse().forEach((l) => s.push(l));
212
- const o = Object.keys(c);
213
- for (let l = 0; l < o.length; l += 1) {
214
- const a = o[l], u = {
215
- ...n[a],
216
- ...c[a]
217
- };
218
- n[a] = u;
219
- }
220
- return s;
221
- }, []).reverse();
222
- }, Ae = (e, t) => {
223
- if (Array.isArray(e) && e.length) {
224
- for (let r = 0; r < e.length; r += 1)
225
- if (e[r][t])
226
- return !0;
227
- }
228
- return !1;
229
- }, Ce = (e) => ({
230
- baseTag: ge([
231
- "href"
232
- /* HREF */
233
- ], e),
234
- bodyAttributes: I("bodyAttributes", e),
235
- defer: E(e, C.DEFER),
236
- encode: E(e, C.ENCODE_SPECIAL_CHARACTERS),
237
- htmlAttributes: I("htmlAttributes", e),
238
- linkTags: b(
239
- "link",
240
- [
241
- "rel",
242
- "href"
243
- /* HREF */
244
- ],
245
- e
246
- ),
247
- metaTags: b(
248
- "meta",
249
- [
250
- "name",
251
- "charset",
252
- "http-equiv",
253
- "property",
254
- "itemprop"
255
- /* ITEM_PROP */
256
- ],
257
- e
258
- ),
259
- noscriptTags: b("noscript", [
260
- "innerHTML"
261
- /* INNER_HTML */
262
- ], e),
263
- onChangeClientState: Te(e),
264
- scriptTags: b(
265
- "script",
266
- [
267
- "src",
268
- "innerHTML"
269
- /* INNER_HTML */
270
- ],
271
- e
272
- ),
273
- styleTags: b("style", [
274
- "cssText"
275
- /* CSS_TEXT */
276
- ], e),
277
- title: ye(e),
278
- titleAttributes: I("titleAttributes", e),
279
- prioritizeSeoTags: Ae(e, C.PRIORITIZE_SEO_TAGS)
280
- }), G = (e) => Array.isArray(e) ? e.join("") : e, Ee = (e, t) => {
281
- const r = Object.keys(e);
282
- for (let n = 0; n < r.length; n += 1)
283
- if (t[r[n]] && t[r[n]].includes(e[r[n]]))
284
- return !0;
285
- return !1;
286
- }, M = (e, t) => Array.isArray(e) ? e.reduce(
287
- (r, n) => (Ee(n, t) ? r.priority.push(n) : r.default.push(n), r),
288
- { priority: [], default: [] }
289
- ) : { default: e, priority: [] }, V = (e, t) => ({
290
- ...e,
291
- [t]: void 0
292
- }), be = [
293
- "noscript",
294
- "script",
295
- "style"
296
- /* STYLE */
297
- ], _ = (e, t = !0) => t === !1 ? String(e) : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;"), W = (e) => Object.keys(e).reduce((t, r) => {
298
- const n = typeof e[r] < "u" ? `${r}="${e[r]}"` : `${r}`;
299
- return t ? `${t} ${n}` : n;
300
- }, ""), Oe = (e, t, r, n) => {
301
- const s = W(r), i = G(t);
302
- return s ? `<${e} ${y}="true" ${s}>${_(
303
- i,
304
- n
305
- )}</${e}>` : `<${e} ${y}="true">${_(
306
- i,
307
- n
308
- )}</${e}>`;
309
- }, Se = (e, t, r = !0) => t.reduce((n, s) => {
310
- const i = s, c = Object.keys(i).filter(
311
- (a) => !(a === "innerHTML" || a === "cssText")
312
- ).reduce((a, u) => {
313
- const f = typeof i[u] > "u" ? u : `${u}="${_(i[u], r)}"`;
314
- return a ? `${a} ${f}` : f;
315
- }, ""), o = i.innerHTML || i.cssText || "", l = be.indexOf(e) === -1;
316
- return `${n}<${e} ${y}="true" ${c}${l ? "/>" : `>${o}</${e}>`}`;
317
- }, ""), J = (e, t = {}) => Object.keys(e).reduce((r, n) => {
318
- const s = U[n];
319
- return r[s || n] = e[n], r;
320
- }, t), we = (e, t, r) => {
321
- const n = {
322
- key: t,
323
- [y]: !0
324
- }, s = J(r, n);
325
- return [m.createElement("title", s, t)];
326
- }, P = (e, t) => t.map((r, n) => {
327
- const s = {
328
- key: n,
329
- [y]: !0
330
- };
331
- return Object.keys(r).forEach((i) => {
332
- const o = U[i] || i;
333
- if (o === "innerHTML" || o === "cssText") {
334
- const l = r.innerHTML || r.cssText;
335
- s.dangerouslySetInnerHTML = { __html: l };
336
- } else
337
- s[o] = r[i];
338
- }), m.createElement(e, s);
339
- }), d = (e, t, r = !0) => {
340
- switch (e) {
341
- case "title":
342
- return {
343
- toComponent: () => we(e, t.title, t.titleAttributes),
344
- toString: () => Oe(e, t.title, t.titleAttributes, r)
345
- };
346
- case "bodyAttributes":
347
- case "htmlAttributes":
348
- return {
349
- toComponent: () => J(t),
350
- toString: () => W(t)
351
- };
352
- default:
353
- return {
354
- toComponent: () => P(e, t),
355
- toString: () => Se(e, t, r)
356
- };
357
- }
358
- }, xe = ({ metaTags: e, linkTags: t, scriptTags: r, encode: n }) => {
359
- const s = M(e, $.meta), i = M(t, $.link), c = M(r, $.script);
360
- return {
361
- priorityMethods: {
362
- toComponent: () => [
363
- ...P("meta", s.priority),
364
- ...P("link", i.priority),
365
- ...P("script", c.priority)
366
- ],
367
- toString: () => (
368
- // generate all the tags as strings and concatenate them
369
- `${d("meta", s.priority, n)} ${d(
370
- "link",
371
- i.priority,
372
- n
373
- )} ${d("script", c.priority, n)}`
374
- )
375
- },
376
- metaTags: s.default,
377
- linkTags: i.default,
378
- scriptTags: c.default
379
- };
380
- }, Pe = (e) => {
381
- const {
382
- baseTag: t,
383
- bodyAttributes: r,
384
- encode: n = !0,
385
- htmlAttributes: s,
386
- noscriptTags: i,
387
- styleTags: c,
388
- title: o = "",
389
- titleAttributes: l,
390
- prioritizeSeoTags: a
391
- } = e;
392
- let { linkTags: u, metaTags: f, scriptTags: h } = e, p = {
393
- toComponent: () => {
394
- },
395
- toString: () => ""
396
- };
397
- return a && ({ priorityMethods: p, linkTags: u, metaTags: f, scriptTags: h } = xe(e)), {
398
- priority: p,
399
- base: d("base", t, n),
400
- bodyAttributes: d("bodyAttributes", r, n),
401
- htmlAttributes: d("htmlAttributes", s, n),
402
- link: d("link", u, n),
403
- meta: d("meta", f, n),
404
- noscript: d("noscript", i, n),
405
- script: d("script", h, n),
406
- style: d("style", c, n),
407
- title: d("title", { title: o, titleAttributes: l }, n)
408
- };
409
- }, k = Pe, w = [], Q = !!(typeof window < "u" && window.document && window.document.createElement), R = class {
410
- constructor(e, t) {
411
- T(this, "instances", []);
412
- T(this, "canUseDOM", Q);
413
- T(this, "context");
414
- T(this, "value", {
415
- setHelmet: (e) => {
416
- this.context.helmet = e;
417
- },
418
- helmetInstances: {
419
- get: () => this.canUseDOM ? w : this.instances,
420
- add: (e) => {
421
- (this.canUseDOM ? w : this.instances).push(e);
422
- },
423
- remove: (e) => {
424
- const t = (this.canUseDOM ? w : this.instances).indexOf(e);
425
- (this.canUseDOM ? w : this.instances).splice(t, 1);
426
- }
427
- }
428
- });
429
- this.context = e, this.canUseDOM = t || !1, t || (e.helmet = k({
430
- baseTag: [],
431
- bodyAttributes: {},
432
- encodeSpecialCharacters: !0,
433
- htmlAttributes: {},
434
- linkTags: [],
435
- metaTags: [],
436
- noscriptTags: [],
437
- scriptTags: [],
438
- styleTags: [],
439
- title: "",
440
- titleAttributes: {}
441
- }));
442
- }
443
- }, $e = {}, ee = m.createContext($e), v, Ie = (v = class extends L {
444
- constructor(r) {
445
- super(r);
446
- T(this, "helmetData");
447
- this.helmetData = new R(this.props.context || {}, v.canUseDOM);
448
- }
449
- render() {
450
- return /* @__PURE__ */ m.createElement(ee.Provider, { value: this.helmetData.value }, this.props.children);
451
- }
452
- }, T(v, "canUseDOM", Q), v), A = (e, t) => {
453
- const r = document.head || document.querySelector(
454
- "head"
455
- /* HEAD */
456
- ), n = r.querySelectorAll(`${e}[${y}]`), s = [].slice.call(n), i = [];
457
- let c;
458
- return t && t.length && t.forEach((o) => {
459
- const l = document.createElement(e);
460
- for (const a in o)
461
- if (Object.prototype.hasOwnProperty.call(o, a))
462
- if (a === "innerHTML")
463
- l.innerHTML = o.innerHTML;
464
- else if (a === "cssText")
465
- l.styleSheet ? l.styleSheet.cssText = o.cssText : l.appendChild(document.createTextNode(o.cssText));
466
- else {
467
- const u = a, f = typeof o[u] > "u" ? "" : o[u];
468
- l.setAttribute(a, f);
469
- }
470
- l.setAttribute(y, "true"), s.some((a, u) => (c = u, l.isEqualNode(a))) ? s.splice(c, 1) : i.push(l);
471
- }), s.forEach((o) => {
472
- var l;
473
- return (l = o.parentNode) == null ? void 0 : l.removeChild(o);
474
- }), i.forEach((o) => r.appendChild(o)), {
475
- oldTags: s,
476
- newTags: i
477
- };
478
- }, j = (e, t) => {
479
- const r = document.getElementsByTagName(e)[0];
480
- if (!r)
481
- return;
482
- const n = r.getAttribute(y), s = n ? n.split(",") : [], i = [...s], c = Object.keys(t);
483
- for (const o of c) {
484
- const l = t[o] || "";
485
- r.getAttribute(o) !== l && r.setAttribute(o, l), s.indexOf(o) === -1 && s.push(o);
486
- const a = i.indexOf(o);
487
- a !== -1 && i.splice(a, 1);
488
- }
489
- for (let o = i.length - 1; o >= 0; o -= 1)
490
- r.removeAttribute(i[o]);
491
- s.length === i.length ? r.removeAttribute(y) : r.getAttribute(y) !== c.join(",") && r.setAttribute(y, c.join(","));
492
- }, Me = (e, t) => {
493
- typeof e < "u" && document.title !== e && (document.title = G(e)), j("title", t);
494
- }, Y = (e, t) => {
495
- const {
496
- baseTag: r,
497
- bodyAttributes: n,
498
- htmlAttributes: s,
499
- linkTags: i,
500
- metaTags: c,
501
- noscriptTags: o,
502
- onChangeClientState: l,
503
- scriptTags: a,
504
- styleTags: u,
505
- title: f,
506
- titleAttributes: h
507
- } = e;
508
- j("body", n), j("html", s), Me(f, h);
509
- const p = {
510
- baseTag: A("base", r),
511
- linkTags: A("link", i),
512
- metaTags: A("meta", c),
513
- noscriptTags: A("noscript", o),
514
- scriptTags: A("script", a),
515
- styleTags: A("style", u)
516
- }, g = {}, q = {};
517
- Object.keys(p).forEach((S) => {
518
- const { newTags: K, oldTags: te } = p[S];
519
- K.length && (g[S] = K), te.length && (q[S] = p[S].oldTags);
520
- }), t && t(), l(e, g, q);
521
- }, O = null, De = (e) => {
522
- O && cancelAnimationFrame(O), e.defer ? O = requestAnimationFrame(() => {
523
- Y(e, () => {
524
- O = null;
525
- });
526
- }) : (Y(e), O = null);
527
- }, He = De, X = class extends L {
528
- constructor() {
529
- super(...arguments);
530
- T(this, "rendered", !1);
531
- }
532
- shouldComponentUpdate(t) {
533
- return !me(t, this.props);
534
- }
535
- componentDidUpdate() {
536
- this.emitChange();
537
- }
538
- componentWillUnmount() {
539
- const { helmetInstances: t } = this.props.context;
540
- t.remove(this), this.emitChange();
541
- }
542
- emitChange() {
543
- const { helmetInstances: t, setHelmet: r } = this.props.context;
544
- let n = null;
545
- const s = Ce(
546
- t.get().map((i) => {
547
- const c = { ...i.props };
548
- return delete c.context, c;
549
- })
550
- );
551
- Ie.canUseDOM ? He(s) : k && (n = k(s)), r(n);
552
- }
553
- // componentWillMount will be deprecated
554
- // for SSR, initialize on first render
555
- // constructor is also unsafe in StrictMode
556
- init() {
557
- if (this.rendered)
558
- return;
559
- this.rendered = !0;
560
- const { helmetInstances: t } = this.props.context;
561
- t.add(this), this.emitChange();
562
- }
563
- render() {
564
- return this.init(), null;
565
- }
566
- }, D, Le = (D = class extends L {
567
- shouldComponentUpdate(e) {
568
- return !ue(V(this.props, "helmetData"), V(e, "helmetData"));
569
- }
570
- mapNestedChildrenToProps(e, t) {
571
- if (!t)
572
- return null;
573
- switch (e.type) {
574
- case "script":
575
- case "noscript":
576
- return {
577
- innerHTML: t
578
- };
579
- case "style":
580
- return {
581
- cssText: t
582
- };
583
- default:
584
- throw new Error(
585
- `<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`
586
- );
587
- }
588
- }
589
- flattenArrayTypeChildren(e, t, r, n) {
590
- return {
591
- ...t,
592
- [e.type]: [
593
- ...t[e.type] || [],
594
- {
595
- ...r,
596
- ...this.mapNestedChildrenToProps(e, n)
597
- }
598
- ]
599
- };
600
- }
601
- mapObjectTypeChildren(e, t, r, n) {
602
- switch (e.type) {
603
- case "title":
604
- return {
605
- ...t,
606
- [e.type]: n,
607
- titleAttributes: { ...r }
608
- };
609
- case "body":
610
- return {
611
- ...t,
612
- bodyAttributes: { ...r }
613
- };
614
- case "html":
615
- return {
616
- ...t,
617
- htmlAttributes: { ...r }
618
- };
619
- default:
620
- return {
621
- ...t,
622
- [e.type]: { ...r }
623
- };
624
- }
625
- }
626
- mapArrayTypeChildrenToProps(e, t) {
627
- let r = { ...t };
628
- return Object.keys(e).forEach((n) => {
629
- r = {
630
- ...r,
631
- [n]: e[n]
632
- };
633
- }), r;
634
- }
635
- warnOnInvalidChildren(e, t) {
636
- return z(
637
- N.some((r) => e.type === r),
638
- typeof e.type == "function" ? "You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information." : `Only elements types ${N.join(
639
- ", "
640
- )} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`
641
- ), z(
642
- !t || typeof t == "string" || Array.isArray(t) && !t.some((r) => typeof r != "string"),
643
- `Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`}</${e.type}> ) Refer to our API for more information.`
644
- ), !0;
645
- }
646
- mapChildrenToProps(e, t) {
647
- let r = {};
648
- return m.Children.forEach(e, (n) => {
649
- if (!n || !n.props)
650
- return;
651
- const { children: s, ...i } = n.props, c = Object.keys(i).reduce((l, a) => (l[he[a] || a] = i[a], l), {});
652
- let { type: o } = n;
653
- switch (typeof o == "symbol" ? o = o.toString() : this.warnOnInvalidChildren(n, s), o) {
654
- case "Symbol(react.fragment)":
655
- t = this.mapChildrenToProps(s, t);
656
- break;
657
- case "link":
658
- case "meta":
659
- case "noscript":
660
- case "script":
661
- case "style":
662
- r = this.flattenArrayTypeChildren(
663
- n,
664
- r,
665
- c,
666
- s
667
- );
668
- break;
669
- default:
670
- t = this.mapObjectTypeChildren(n, t, c, s);
671
- break;
672
- }
673
- }), this.mapArrayTypeChildrenToProps(r, t);
674
- }
675
- render() {
676
- const { children: e, ...t } = this.props;
677
- let r = { ...t }, { helmetData: n } = t;
678
- if (e && (r = this.mapChildrenToProps(e, r)), n && !(n instanceof R)) {
679
- const s = n;
680
- n = new R(s.context, !0), delete r.helmetData;
681
- }
682
- return n ? /* @__PURE__ */ m.createElement(X, { ...r, context: n.value }) : /* @__PURE__ */ m.createElement(ee.Consumer, null, (s) => /* @__PURE__ */ m.createElement(X, { ...r, context: s }));
683
- }
684
- }, T(D, "defaultProps", {
685
- defer: !0,
686
- encodeSpecialCharacters: !0,
687
- prioritizeSeoTags: !1
688
- }), D);
689
- export {
690
- Le as H,
691
- je as M,
692
- se as u
693
- };
694
- //# sourceMappingURL=index.esm-CPEExBJE.js.map