zudoku 0.3.0-dev.55 → 0.3.0-dev.56
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/dist/config/validators/validate.d.ts +12 -12
- package/dist/lib/components/DeveloperHint.d.ts +5 -0
- package/dist/lib/components/DeveloperHint.js +10 -0
- package/dist/lib/components/DeveloperHint.js.map +1 -0
- package/dist/lib/components/NotFoundPage.js +2 -2
- package/dist/lib/components/NotFoundPage.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
- package/dist/lib/plugins/api-keys/index.js +2 -12
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +2 -2
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +3 -3
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/lib/AnchorLink-GNsUeGSX.js +705 -0
- package/lib/{AnchorLink-BaXHjhF-.js.map → AnchorLink-GNsUeGSX.js.map} +1 -1
- package/lib/Button-DpHMZvVs.js +4571 -0
- package/lib/Button-DpHMZvVs.js.map +1 -0
- package/lib/DevPortalProvider-Do9oJqme.js +1081 -0
- package/lib/{DevPortalProvider-GjdO0Xr-.js.map → DevPortalProvider-Do9oJqme.js.map} +1 -1
- package/lib/Markdown-DtLFdxD1.js +15031 -0
- package/lib/Markdown-DtLFdxD1.js.map +1 -0
- package/lib/MdxPage-CbwYRKf5.js +190 -0
- package/lib/{MdxPage-Dlujuj-J.js.map → MdxPage-CbwYRKf5.js.map} +1 -1
- package/lib/OperationList-DpR4KzIJ.js +5570 -0
- package/lib/OperationList-DpR4KzIJ.js.map +1 -0
- package/lib/Route-C1LyvITr.js +13 -0
- package/lib/{Route-CR6TEwVC.js.map → Route-C1LyvITr.js.map} +1 -1
- package/lib/Spinner-Bhbs5aPI.js +182 -0
- package/lib/Spinner-Bhbs5aPI.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +4765 -0
- package/lib/assets/{index-CpIig0AX.js.map → index-BPdJm2ty.js.map} +1 -1
- package/lib/assets/worker-BjPv-hjP.js +14897 -0
- package/lib/assets/{worker-B5k2aBV9.js.map → worker-BjPv-hjP.js.map} +1 -1
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/{context-BoN_3uxi.js.map → context-_fYfJFgk.js.map} +1 -1
- package/lib/hook-Biq3zYel.js +92 -0
- package/lib/hook-Biq3zYel.js.map +1 -0
- package/lib/{index-Dih8IAqw.js → index-DZ910ttL.js} +83 -103
- package/lib/{index-Dih8IAqw.js.map → index-DZ910ttL.js.map} +1 -1
- package/lib/index-gsAuUwQh.js +418 -0
- package/lib/index-gsAuUwQh.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/{index-Bn03IPZt.js.map → index-pI9JkN46.js.map} +1 -1
- package/lib/jsx-runtime-CJZJivg2.js +1526 -0
- package/lib/{jsx-runtime-DvZ6OKMM.js.map → jsx-runtime-CJZJivg2.js.map} +1 -1
- package/lib/prism-bash.min-DadFsM4Z.js +7 -0
- package/lib/{prism-bash.min-BtBk0onv.js.map → prism-bash.min-DadFsM4Z.js.map} +1 -1
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/{prism-csharp.min-Cv7D49bv.js.map → prism-csharp.min-Yizuc34Y.js.map} +1 -1
- package/lib/prism-java.min-d5iT_mOd.js +7 -0
- package/lib/{prism-java.min-tNK-JX6x.js.map → prism-java.min-d5iT_mOd.js.map} +1 -1
- package/lib/prism-json.min-B1GJqK1k.js +2 -0
- package/lib/{prism-json.min-Cdtv-CME.js.map → prism-json.min-B1GJqK1k.js.map} +1 -1
- package/lib/prism-markup-templating-DZrrEs0A.js +62 -0
- package/lib/{prism-markup-templating-iotg2sCU.js.map → prism-markup-templating-DZrrEs0A.js.map} +1 -1
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/{prism-objectivec.min-CY4WGixz.js.map → prism-objectivec.min-BXSWqpJJ.js.map} +1 -1
- package/lib/prism-php.min-o7FpoMP_.js +11 -0
- package/lib/{prism-php.min-T6sIVgED.js.map → prism-php.min-o7FpoMP_.js.map} +1 -1
- package/lib/prism-ruby.min-C7LwcKyz.js +10 -0
- package/lib/{prism-ruby.min-B-2KAa4y.js.map → prism-ruby.min-C7LwcKyz.js.map} +1 -1
- package/lib/router-CBw2vqJE.js +2973 -0
- package/lib/{router-ButO1QyY.js.map → router-CBw2vqJE.js.map} +1 -1
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/{slugify-CmS97Vy8.js.map → slugify-CiPVjteN.js.map} +1 -1
- package/lib/state-DKdaQzvh.js +288 -0
- package/lib/{state-CmGfNKhR.js.map → state-DKdaQzvh.js.map} +1 -1
- package/lib/urql-DMlBWUKL.js +1592 -0
- package/lib/{urql-DtVKPBx_.js.map → urql-DMlBWUKL.js.map} +1 -1
- package/lib/util-_jwUlTBU.js +41 -0
- package/lib/{util-B5KX4h4M.js.map → util-_jwUlTBU.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +18 -24
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +34 -43
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +734 -1121
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +822 -1076
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +9691 -13786
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +171 -208
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +33 -41
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +6 -6
- package/lib/zudoku.plugin-redirect.js +8 -10
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/NotFoundPage.tsx +8 -14
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/api-keys/index.tsx +2 -21
- package/src/lib/plugins/openapi/OperationList.tsx +5 -8
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +3 -5
- package/lib/AnchorLink-BaXHjhF-.js +0 -989
- package/lib/Combination-BfufJFkX.js +0 -1365
- package/lib/Combination-BfufJFkX.js.map +0 -1
- package/lib/DevPortalProvider-GjdO0Xr-.js +0 -1610
- package/lib/Markdown-B8nPVql1.js +0 -19708
- package/lib/Markdown-B8nPVql1.js.map +0 -1
- package/lib/MdxPage-Dlujuj-J.js +0 -223
- package/lib/OperationList-krPgt6sE.js +0 -8041
- package/lib/OperationList-krPgt6sE.js.map +0 -1
- package/lib/Playground-DOHxca0P.js +0 -539
- package/lib/Playground-DOHxca0P.js.map +0 -1
- package/lib/Route-CR6TEwVC.js +0 -13
- package/lib/Select-Boi_pe3L.js +0 -5298
- package/lib/Select-Boi_pe3L.js.map +0 -1
- package/lib/Spinner-oU0QJmi_.js +0 -16
- package/lib/Spinner-oU0QJmi_.js.map +0 -1
- package/lib/_commonjsHelpers-BxmBWJD2.js +0 -34
- package/lib/_commonjsHelpers-BxmBWJD2.js.map +0 -1
- package/lib/assets/index-CpIig0AX.js +0 -6341
- package/lib/assets/worker-B5k2aBV9.js +0 -18921
- package/lib/context-BoN_3uxi.js +0 -17
- package/lib/hook-CIuFuyBT.js +0 -90
- package/lib/hook-CIuFuyBT.js.map +0 -1
- package/lib/index-BL1P4Gqq.js +0 -280
- package/lib/index-BL1P4Gqq.js.map +0 -1
- package/lib/index-Bn03IPZt.js +0 -6341
- package/lib/index-FprhHF51.js +0 -253
- package/lib/index-FprhHF51.js.map +0 -1
- package/lib/jsx-runtime-DvZ6OKMM.js +0 -2110
- package/lib/mutation-DWY9x2Uc.js +0 -250
- package/lib/mutation-DWY9x2Uc.js.map +0 -1
- package/lib/prism-bash.min-BtBk0onv.js +0 -7
- package/lib/prism-csharp.min-Cv7D49bv.js +0 -30
- package/lib/prism-java.min-tNK-JX6x.js +0 -7
- package/lib/prism-json.min-Cdtv-CME.js +0 -2
- package/lib/prism-markup-templating-iotg2sCU.js +0 -94
- package/lib/prism-objectivec.min-CY4WGixz.js +0 -2
- package/lib/prism-php.min-T6sIVgED.js +0 -11
- package/lib/prism-ruby.min-B-2KAa4y.js +0 -8
- package/lib/router-ButO1QyY.js +0 -4062
- package/lib/slugify-CmS97Vy8.js +0 -50
- package/lib/state-CmGfNKhR.js +0 -436
- package/lib/urql-DtVKPBx_.js +0 -2567
- package/lib/util-B5KX4h4M.js +0 -55
|
@@ -1,989 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
var _a, _b;
|
|
5
|
-
import React__default, { Component } from "react";
|
|
6
|
-
import { a as getDefaultExportFromCjs } from "./_commonjsHelpers-BxmBWJD2.js";
|
|
7
|
-
import { u as useLocation, j as jsxRuntimeExports } from "./jsx-runtime-DvZ6OKMM.js";
|
|
8
|
-
import { L as Link } from "./Markdown-B8nPVql1.js";
|
|
9
|
-
const emptyComponents = {};
|
|
10
|
-
const MDXContext = React__default.createContext(emptyComponents);
|
|
11
|
-
function useMDXComponents(components) {
|
|
12
|
-
const contextComponents = React__default.useContext(MDXContext);
|
|
13
|
-
return React__default.useMemo(
|
|
14
|
-
function() {
|
|
15
|
-
if (typeof components === "function") {
|
|
16
|
-
return components(contextComponents);
|
|
17
|
-
}
|
|
18
|
-
return { ...contextComponents, ...components };
|
|
19
|
-
},
|
|
20
|
-
[contextComponents, components]
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
function MDXProvider(properties) {
|
|
24
|
-
let allComponents;
|
|
25
|
-
if (properties.disableParentContext) {
|
|
26
|
-
allComponents = typeof properties.components === "function" ? properties.components(emptyComponents) : properties.components || emptyComponents;
|
|
27
|
-
} else {
|
|
28
|
-
allComponents = useMDXComponents(properties.components);
|
|
29
|
-
}
|
|
30
|
-
return React__default.createElement(
|
|
31
|
-
MDXContext.Provider,
|
|
32
|
-
{ value: allComponents },
|
|
33
|
-
properties.children
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
var hasElementType = typeof Element !== "undefined";
|
|
37
|
-
var hasMap = typeof Map === "function";
|
|
38
|
-
var hasSet = typeof Set === "function";
|
|
39
|
-
var hasArrayBuffer = typeof ArrayBuffer === "function" && !!ArrayBuffer.isView;
|
|
40
|
-
function equal(a, b) {
|
|
41
|
-
if (a === b) return true;
|
|
42
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
43
|
-
if (a.constructor !== b.constructor) return false;
|
|
44
|
-
var length, i, keys;
|
|
45
|
-
if (Array.isArray(a)) {
|
|
46
|
-
length = a.length;
|
|
47
|
-
if (length != b.length) return false;
|
|
48
|
-
for (i = length; i-- !== 0; )
|
|
49
|
-
if (!equal(a[i], b[i])) return false;
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
var it;
|
|
53
|
-
if (hasMap && a instanceof Map && b instanceof Map) {
|
|
54
|
-
if (a.size !== b.size) return false;
|
|
55
|
-
it = a.entries();
|
|
56
|
-
while (!(i = it.next()).done)
|
|
57
|
-
if (!b.has(i.value[0])) return false;
|
|
58
|
-
it = a.entries();
|
|
59
|
-
while (!(i = it.next()).done)
|
|
60
|
-
if (!equal(i.value[1], b.get(i.value[0]))) return false;
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
if (hasSet && a instanceof Set && b instanceof Set) {
|
|
64
|
-
if (a.size !== b.size) return false;
|
|
65
|
-
it = a.entries();
|
|
66
|
-
while (!(i = it.next()).done)
|
|
67
|
-
if (!b.has(i.value[0])) return false;
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
71
|
-
length = a.length;
|
|
72
|
-
if (length != b.length) return false;
|
|
73
|
-
for (i = length; i-- !== 0; )
|
|
74
|
-
if (a[i] !== b[i]) return false;
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
78
|
-
if (a.valueOf !== Object.prototype.valueOf && typeof a.valueOf === "function" && typeof b.valueOf === "function") return a.valueOf() === b.valueOf();
|
|
79
|
-
if (a.toString !== Object.prototype.toString && typeof a.toString === "function" && typeof b.toString === "function") return a.toString() === b.toString();
|
|
80
|
-
keys = Object.keys(a);
|
|
81
|
-
length = keys.length;
|
|
82
|
-
if (length !== Object.keys(b).length) return false;
|
|
83
|
-
for (i = length; i-- !== 0; )
|
|
84
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
85
|
-
if (hasElementType && a instanceof Element) return false;
|
|
86
|
-
for (i = length; i-- !== 0; ) {
|
|
87
|
-
if ((keys[i] === "_owner" || keys[i] === "__v" || keys[i] === "__o") && a.$$typeof) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (!equal(a[keys[i]], b[keys[i]])) return false;
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
return a !== a && b !== b;
|
|
95
|
-
}
|
|
96
|
-
var reactFastCompare = function isEqual(a, b) {
|
|
97
|
-
try {
|
|
98
|
-
return equal(a, b);
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if ((error.message || "").match(/stack|recursion/i)) {
|
|
101
|
-
console.warn("react-fast-compare cannot handle circular refs");
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const fastCompare = /* @__PURE__ */ getDefaultExportFromCjs(reactFastCompare);
|
|
108
|
-
var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
109
|
-
if (process.env.NODE_ENV !== "production") {
|
|
110
|
-
if (format === void 0) {
|
|
111
|
-
throw new Error("invariant requires an error message argument");
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (!condition) {
|
|
115
|
-
var error;
|
|
116
|
-
if (format === void 0) {
|
|
117
|
-
error = new Error(
|
|
118
|
-
"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
|
|
119
|
-
);
|
|
120
|
-
} else {
|
|
121
|
-
var args = [a, b, c, d, e, f];
|
|
122
|
-
var argIndex = 0;
|
|
123
|
-
error = new Error(
|
|
124
|
-
format.replace(/%s/g, function() {
|
|
125
|
-
return args[argIndex++];
|
|
126
|
-
})
|
|
127
|
-
);
|
|
128
|
-
error.name = "Invariant Violation";
|
|
129
|
-
}
|
|
130
|
-
error.framesToPop = 1;
|
|
131
|
-
throw error;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
var browser = invariant;
|
|
135
|
-
const invariant$1 = /* @__PURE__ */ getDefaultExportFromCjs(browser);
|
|
136
|
-
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
|
|
137
|
-
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
138
|
-
if (ret !== void 0) {
|
|
139
|
-
return !!ret;
|
|
140
|
-
}
|
|
141
|
-
if (objA === objB) {
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
var keysA = Object.keys(objA);
|
|
148
|
-
var keysB = Object.keys(objB);
|
|
149
|
-
if (keysA.length !== keysB.length) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
153
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
154
|
-
var key = keysA[idx];
|
|
155
|
-
if (!bHasOwnProperty(key)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
var valueA = objA[key];
|
|
159
|
-
var valueB = objB[key];
|
|
160
|
-
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
161
|
-
if (ret === false || ret === void 0 && valueA !== valueB) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return true;
|
|
166
|
-
};
|
|
167
|
-
const shallowEqual2 = /* @__PURE__ */ getDefaultExportFromCjs(shallowequal);
|
|
168
|
-
var TAG_NAMES = /* @__PURE__ */ ((TAG_NAMES2) => {
|
|
169
|
-
TAG_NAMES2["BASE"] = "base";
|
|
170
|
-
TAG_NAMES2["BODY"] = "body";
|
|
171
|
-
TAG_NAMES2["HEAD"] = "head";
|
|
172
|
-
TAG_NAMES2["HTML"] = "html";
|
|
173
|
-
TAG_NAMES2["LINK"] = "link";
|
|
174
|
-
TAG_NAMES2["META"] = "meta";
|
|
175
|
-
TAG_NAMES2["NOSCRIPT"] = "noscript";
|
|
176
|
-
TAG_NAMES2["SCRIPT"] = "script";
|
|
177
|
-
TAG_NAMES2["STYLE"] = "style";
|
|
178
|
-
TAG_NAMES2["TITLE"] = "title";
|
|
179
|
-
TAG_NAMES2["FRAGMENT"] = "Symbol(react.fragment)";
|
|
180
|
-
return TAG_NAMES2;
|
|
181
|
-
})(TAG_NAMES || {});
|
|
182
|
-
var SEO_PRIORITY_TAGS = {
|
|
183
|
-
link: { rel: ["amphtml", "canonical", "alternate"] },
|
|
184
|
-
script: { type: ["application/ld+json"] },
|
|
185
|
-
meta: {
|
|
186
|
-
charset: "",
|
|
187
|
-
name: ["generator", "robots", "description"],
|
|
188
|
-
property: [
|
|
189
|
-
"og:type",
|
|
190
|
-
"og:title",
|
|
191
|
-
"og:url",
|
|
192
|
-
"og:image",
|
|
193
|
-
"og:image:alt",
|
|
194
|
-
"og:description",
|
|
195
|
-
"twitter:url",
|
|
196
|
-
"twitter:title",
|
|
197
|
-
"twitter:description",
|
|
198
|
-
"twitter:image",
|
|
199
|
-
"twitter:image:alt",
|
|
200
|
-
"twitter:card",
|
|
201
|
-
"twitter:site"
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
var VALID_TAG_NAMES = Object.values(TAG_NAMES);
|
|
206
|
-
var REACT_TAG_MAP = {
|
|
207
|
-
accesskey: "accessKey",
|
|
208
|
-
charset: "charSet",
|
|
209
|
-
class: "className",
|
|
210
|
-
contenteditable: "contentEditable",
|
|
211
|
-
contextmenu: "contextMenu",
|
|
212
|
-
"http-equiv": "httpEquiv",
|
|
213
|
-
itemprop: "itemProp",
|
|
214
|
-
tabindex: "tabIndex"
|
|
215
|
-
};
|
|
216
|
-
var HTML_TAG_MAP = Object.entries(REACT_TAG_MAP).reduce(
|
|
217
|
-
(carry, [key, value]) => {
|
|
218
|
-
carry[value] = key;
|
|
219
|
-
return carry;
|
|
220
|
-
},
|
|
221
|
-
{}
|
|
222
|
-
);
|
|
223
|
-
var HELMET_ATTRIBUTE = "data-rh";
|
|
224
|
-
var HELMET_PROPS = {
|
|
225
|
-
DEFAULT_TITLE: "defaultTitle",
|
|
226
|
-
DEFER: "defer",
|
|
227
|
-
ENCODE_SPECIAL_CHARACTERS: "encodeSpecialCharacters",
|
|
228
|
-
ON_CHANGE_CLIENT_STATE: "onChangeClientState",
|
|
229
|
-
TITLE_TEMPLATE: "titleTemplate",
|
|
230
|
-
PRIORITIZE_SEO_TAGS: "prioritizeSeoTags"
|
|
231
|
-
};
|
|
232
|
-
var getInnermostProperty = (propsList, property) => {
|
|
233
|
-
for (let i = propsList.length - 1; i >= 0; i -= 1) {
|
|
234
|
-
const props = propsList[i];
|
|
235
|
-
if (Object.prototype.hasOwnProperty.call(props, property)) {
|
|
236
|
-
return props[property];
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return null;
|
|
240
|
-
};
|
|
241
|
-
var getTitleFromPropsList = (propsList) => {
|
|
242
|
-
let innermostTitle = getInnermostProperty(
|
|
243
|
-
propsList,
|
|
244
|
-
"title"
|
|
245
|
-
/* TITLE */
|
|
246
|
-
);
|
|
247
|
-
const innermostTemplate = getInnermostProperty(propsList, HELMET_PROPS.TITLE_TEMPLATE);
|
|
248
|
-
if (Array.isArray(innermostTitle)) {
|
|
249
|
-
innermostTitle = innermostTitle.join("");
|
|
250
|
-
}
|
|
251
|
-
if (innermostTemplate && innermostTitle) {
|
|
252
|
-
return innermostTemplate.replace(/%s/g, () => innermostTitle);
|
|
253
|
-
}
|
|
254
|
-
const innermostDefaultTitle = getInnermostProperty(propsList, HELMET_PROPS.DEFAULT_TITLE);
|
|
255
|
-
return innermostTitle || innermostDefaultTitle || void 0;
|
|
256
|
-
};
|
|
257
|
-
var getOnChangeClientState = (propsList) => getInnermostProperty(propsList, HELMET_PROPS.ON_CHANGE_CLIENT_STATE) || (() => {
|
|
258
|
-
});
|
|
259
|
-
var getAttributesFromPropsList = (tagType, propsList) => propsList.filter((props) => typeof props[tagType] !== "undefined").map((props) => props[tagType]).reduce((tagAttrs, current) => ({ ...tagAttrs, ...current }), {});
|
|
260
|
-
var getBaseTagFromPropsList = (primaryAttributes, propsList) => propsList.filter((props) => typeof props[
|
|
261
|
-
"base"
|
|
262
|
-
/* BASE */
|
|
263
|
-
] !== "undefined").map((props) => props[
|
|
264
|
-
"base"
|
|
265
|
-
/* BASE */
|
|
266
|
-
]).reverse().reduce((innermostBaseTag, tag) => {
|
|
267
|
-
if (!innermostBaseTag.length) {
|
|
268
|
-
const keys = Object.keys(tag);
|
|
269
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
270
|
-
const attributeKey = keys[i];
|
|
271
|
-
const lowerCaseAttributeKey = attributeKey.toLowerCase();
|
|
272
|
-
if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && tag[lowerCaseAttributeKey]) {
|
|
273
|
-
return innermostBaseTag.concat(tag);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return innermostBaseTag;
|
|
278
|
-
}, []);
|
|
279
|
-
var warn = (msg) => console && typeof console.warn === "function" && console.warn(msg);
|
|
280
|
-
var getTagsFromPropsList = (tagName, primaryAttributes, propsList) => {
|
|
281
|
-
const approvedSeenTags = {};
|
|
282
|
-
return propsList.filter((props) => {
|
|
283
|
-
if (Array.isArray(props[tagName])) {
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
if (typeof props[tagName] !== "undefined") {
|
|
287
|
-
warn(
|
|
288
|
-
`Helmet: ${tagName} should be of type "Array". Instead found type "${typeof props[tagName]}"`
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
return false;
|
|
292
|
-
}).map((props) => props[tagName]).reverse().reduce((approvedTags, instanceTags) => {
|
|
293
|
-
const instanceSeenTags = {};
|
|
294
|
-
instanceTags.filter((tag) => {
|
|
295
|
-
let primaryAttributeKey;
|
|
296
|
-
const keys2 = Object.keys(tag);
|
|
297
|
-
for (let i = 0; i < keys2.length; i += 1) {
|
|
298
|
-
const attributeKey = keys2[i];
|
|
299
|
-
const lowerCaseAttributeKey = attributeKey.toLowerCase();
|
|
300
|
-
if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && !(primaryAttributeKey === "rel" && tag[primaryAttributeKey].toLowerCase() === "canonical") && !(lowerCaseAttributeKey === "rel" && tag[lowerCaseAttributeKey].toLowerCase() === "stylesheet")) {
|
|
301
|
-
primaryAttributeKey = lowerCaseAttributeKey;
|
|
302
|
-
}
|
|
303
|
-
if (primaryAttributes.indexOf(attributeKey) !== -1 && (attributeKey === "innerHTML" || attributeKey === "cssText" || attributeKey === "itemprop")) {
|
|
304
|
-
primaryAttributeKey = attributeKey;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (!primaryAttributeKey || !tag[primaryAttributeKey]) {
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
const value = tag[primaryAttributeKey].toLowerCase();
|
|
311
|
-
if (!approvedSeenTags[primaryAttributeKey]) {
|
|
312
|
-
approvedSeenTags[primaryAttributeKey] = {};
|
|
313
|
-
}
|
|
314
|
-
if (!instanceSeenTags[primaryAttributeKey]) {
|
|
315
|
-
instanceSeenTags[primaryAttributeKey] = {};
|
|
316
|
-
}
|
|
317
|
-
if (!approvedSeenTags[primaryAttributeKey][value]) {
|
|
318
|
-
instanceSeenTags[primaryAttributeKey][value] = true;
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
return false;
|
|
322
|
-
}).reverse().forEach((tag) => approvedTags.push(tag));
|
|
323
|
-
const keys = Object.keys(instanceSeenTags);
|
|
324
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
325
|
-
const attributeKey = keys[i];
|
|
326
|
-
const tagUnion = {
|
|
327
|
-
...approvedSeenTags[attributeKey],
|
|
328
|
-
...instanceSeenTags[attributeKey]
|
|
329
|
-
};
|
|
330
|
-
approvedSeenTags[attributeKey] = tagUnion;
|
|
331
|
-
}
|
|
332
|
-
return approvedTags;
|
|
333
|
-
}, []).reverse();
|
|
334
|
-
};
|
|
335
|
-
var getAnyTrueFromPropsList = (propsList, checkedTag) => {
|
|
336
|
-
if (Array.isArray(propsList) && propsList.length) {
|
|
337
|
-
for (let index = 0; index < propsList.length; index += 1) {
|
|
338
|
-
const prop = propsList[index];
|
|
339
|
-
if (prop[checkedTag]) {
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return false;
|
|
345
|
-
};
|
|
346
|
-
var reducePropsToState = (propsList) => ({
|
|
347
|
-
baseTag: getBaseTagFromPropsList([
|
|
348
|
-
"href"
|
|
349
|
-
/* HREF */
|
|
350
|
-
], propsList),
|
|
351
|
-
bodyAttributes: getAttributesFromPropsList("bodyAttributes", propsList),
|
|
352
|
-
defer: getInnermostProperty(propsList, HELMET_PROPS.DEFER),
|
|
353
|
-
encode: getInnermostProperty(propsList, HELMET_PROPS.ENCODE_SPECIAL_CHARACTERS),
|
|
354
|
-
htmlAttributes: getAttributesFromPropsList("htmlAttributes", propsList),
|
|
355
|
-
linkTags: getTagsFromPropsList(
|
|
356
|
-
"link",
|
|
357
|
-
[
|
|
358
|
-
"rel",
|
|
359
|
-
"href"
|
|
360
|
-
/* HREF */
|
|
361
|
-
],
|
|
362
|
-
propsList
|
|
363
|
-
),
|
|
364
|
-
metaTags: getTagsFromPropsList(
|
|
365
|
-
"meta",
|
|
366
|
-
[
|
|
367
|
-
"name",
|
|
368
|
-
"charset",
|
|
369
|
-
"http-equiv",
|
|
370
|
-
"property",
|
|
371
|
-
"itemprop"
|
|
372
|
-
/* ITEM_PROP */
|
|
373
|
-
],
|
|
374
|
-
propsList
|
|
375
|
-
),
|
|
376
|
-
noscriptTags: getTagsFromPropsList("noscript", [
|
|
377
|
-
"innerHTML"
|
|
378
|
-
/* INNER_HTML */
|
|
379
|
-
], propsList),
|
|
380
|
-
onChangeClientState: getOnChangeClientState(propsList),
|
|
381
|
-
scriptTags: getTagsFromPropsList(
|
|
382
|
-
"script",
|
|
383
|
-
[
|
|
384
|
-
"src",
|
|
385
|
-
"innerHTML"
|
|
386
|
-
/* INNER_HTML */
|
|
387
|
-
],
|
|
388
|
-
propsList
|
|
389
|
-
),
|
|
390
|
-
styleTags: getTagsFromPropsList("style", [
|
|
391
|
-
"cssText"
|
|
392
|
-
/* CSS_TEXT */
|
|
393
|
-
], propsList),
|
|
394
|
-
title: getTitleFromPropsList(propsList),
|
|
395
|
-
titleAttributes: getAttributesFromPropsList("titleAttributes", propsList),
|
|
396
|
-
prioritizeSeoTags: getAnyTrueFromPropsList(propsList, HELMET_PROPS.PRIORITIZE_SEO_TAGS)
|
|
397
|
-
});
|
|
398
|
-
var flattenArray = (possibleArray) => Array.isArray(possibleArray) ? possibleArray.join("") : possibleArray;
|
|
399
|
-
var checkIfPropsMatch = (props, toMatch) => {
|
|
400
|
-
const keys = Object.keys(props);
|
|
401
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
402
|
-
if (toMatch[keys[i]] && toMatch[keys[i]].includes(props[keys[i]])) {
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return false;
|
|
407
|
-
};
|
|
408
|
-
var prioritizer = (elementsList, propsToMatch) => {
|
|
409
|
-
if (Array.isArray(elementsList)) {
|
|
410
|
-
return elementsList.reduce(
|
|
411
|
-
(acc, elementAttrs) => {
|
|
412
|
-
if (checkIfPropsMatch(elementAttrs, propsToMatch)) {
|
|
413
|
-
acc.priority.push(elementAttrs);
|
|
414
|
-
} else {
|
|
415
|
-
acc.default.push(elementAttrs);
|
|
416
|
-
}
|
|
417
|
-
return acc;
|
|
418
|
-
},
|
|
419
|
-
{ priority: [], default: [] }
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
return { default: elementsList, priority: [] };
|
|
423
|
-
};
|
|
424
|
-
var without = (obj, key) => {
|
|
425
|
-
return {
|
|
426
|
-
...obj,
|
|
427
|
-
[key]: void 0
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
var SELF_CLOSING_TAGS = [
|
|
431
|
-
"noscript",
|
|
432
|
-
"script",
|
|
433
|
-
"style"
|
|
434
|
-
/* STYLE */
|
|
435
|
-
];
|
|
436
|
-
var encodeSpecialCharacters = (str, encode = true) => {
|
|
437
|
-
if (encode === false) {
|
|
438
|
-
return String(str);
|
|
439
|
-
}
|
|
440
|
-
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
441
|
-
};
|
|
442
|
-
var generateElementAttributesAsString = (attributes) => Object.keys(attributes).reduce((str, key) => {
|
|
443
|
-
const attr = typeof attributes[key] !== "undefined" ? `${key}="${attributes[key]}"` : `${key}`;
|
|
444
|
-
return str ? `${str} ${attr}` : attr;
|
|
445
|
-
}, "");
|
|
446
|
-
var generateTitleAsString = (type, title, attributes, encode) => {
|
|
447
|
-
const attributeString = generateElementAttributesAsString(attributes);
|
|
448
|
-
const flattenedTitle = flattenArray(title);
|
|
449
|
-
return attributeString ? `<${type} ${HELMET_ATTRIBUTE}="true" ${attributeString}>${encodeSpecialCharacters(
|
|
450
|
-
flattenedTitle,
|
|
451
|
-
encode
|
|
452
|
-
)}</${type}>` : `<${type} ${HELMET_ATTRIBUTE}="true">${encodeSpecialCharacters(
|
|
453
|
-
flattenedTitle,
|
|
454
|
-
encode
|
|
455
|
-
)}</${type}>`;
|
|
456
|
-
};
|
|
457
|
-
var generateTagsAsString = (type, tags, encode = true) => tags.reduce((str, t) => {
|
|
458
|
-
const tag = t;
|
|
459
|
-
const attributeHtml = Object.keys(tag).filter(
|
|
460
|
-
(attribute) => !(attribute === "innerHTML" || attribute === "cssText")
|
|
461
|
-
).reduce((string, attribute) => {
|
|
462
|
-
const attr = typeof tag[attribute] === "undefined" ? attribute : `${attribute}="${encodeSpecialCharacters(tag[attribute], encode)}"`;
|
|
463
|
-
return string ? `${string} ${attr}` : attr;
|
|
464
|
-
}, "");
|
|
465
|
-
const tagContent = tag.innerHTML || tag.cssText || "";
|
|
466
|
-
const isSelfClosing = SELF_CLOSING_TAGS.indexOf(type) === -1;
|
|
467
|
-
return `${str}<${type} ${HELMET_ATTRIBUTE}="true" ${attributeHtml}${isSelfClosing ? `/>` : `>${tagContent}</${type}>`}`;
|
|
468
|
-
}, "");
|
|
469
|
-
var convertElementAttributesToReactProps = (attributes, initProps = {}) => Object.keys(attributes).reduce((obj, key) => {
|
|
470
|
-
const mapped = REACT_TAG_MAP[key];
|
|
471
|
-
obj[mapped || key] = attributes[key];
|
|
472
|
-
return obj;
|
|
473
|
-
}, initProps);
|
|
474
|
-
var generateTitleAsReactComponent = (_type, title, attributes) => {
|
|
475
|
-
const initProps = {
|
|
476
|
-
key: title,
|
|
477
|
-
[HELMET_ATTRIBUTE]: true
|
|
478
|
-
};
|
|
479
|
-
const props = convertElementAttributesToReactProps(attributes, initProps);
|
|
480
|
-
return [React__default.createElement("title", props, title)];
|
|
481
|
-
};
|
|
482
|
-
var generateTagsAsReactComponent = (type, tags) => tags.map((tag, i) => {
|
|
483
|
-
const mappedTag = {
|
|
484
|
-
key: i,
|
|
485
|
-
[HELMET_ATTRIBUTE]: true
|
|
486
|
-
};
|
|
487
|
-
Object.keys(tag).forEach((attribute) => {
|
|
488
|
-
const mapped = REACT_TAG_MAP[attribute];
|
|
489
|
-
const mappedAttribute = mapped || attribute;
|
|
490
|
-
if (mappedAttribute === "innerHTML" || mappedAttribute === "cssText") {
|
|
491
|
-
const content = tag.innerHTML || tag.cssText;
|
|
492
|
-
mappedTag.dangerouslySetInnerHTML = { __html: content };
|
|
493
|
-
} else {
|
|
494
|
-
mappedTag[mappedAttribute] = tag[attribute];
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
return React__default.createElement(type, mappedTag);
|
|
498
|
-
});
|
|
499
|
-
var getMethodsForTag = (type, tags, encode = true) => {
|
|
500
|
-
switch (type) {
|
|
501
|
-
case "title":
|
|
502
|
-
return {
|
|
503
|
-
toComponent: () => generateTitleAsReactComponent(type, tags.title, tags.titleAttributes),
|
|
504
|
-
toString: () => generateTitleAsString(type, tags.title, tags.titleAttributes, encode)
|
|
505
|
-
};
|
|
506
|
-
case "bodyAttributes":
|
|
507
|
-
case "htmlAttributes":
|
|
508
|
-
return {
|
|
509
|
-
toComponent: () => convertElementAttributesToReactProps(tags),
|
|
510
|
-
toString: () => generateElementAttributesAsString(tags)
|
|
511
|
-
};
|
|
512
|
-
default:
|
|
513
|
-
return {
|
|
514
|
-
toComponent: () => generateTagsAsReactComponent(type, tags),
|
|
515
|
-
toString: () => generateTagsAsString(type, tags, encode)
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
var getPriorityMethods = ({ metaTags, linkTags, scriptTags, encode }) => {
|
|
520
|
-
const meta = prioritizer(metaTags, SEO_PRIORITY_TAGS.meta);
|
|
521
|
-
const link = prioritizer(linkTags, SEO_PRIORITY_TAGS.link);
|
|
522
|
-
const script = prioritizer(scriptTags, SEO_PRIORITY_TAGS.script);
|
|
523
|
-
const priorityMethods = {
|
|
524
|
-
toComponent: () => [
|
|
525
|
-
...generateTagsAsReactComponent("meta", meta.priority),
|
|
526
|
-
...generateTagsAsReactComponent("link", link.priority),
|
|
527
|
-
...generateTagsAsReactComponent("script", script.priority)
|
|
528
|
-
],
|
|
529
|
-
toString: () => (
|
|
530
|
-
// generate all the tags as strings and concatenate them
|
|
531
|
-
`${getMethodsForTag("meta", meta.priority, encode)} ${getMethodsForTag(
|
|
532
|
-
"link",
|
|
533
|
-
link.priority,
|
|
534
|
-
encode
|
|
535
|
-
)} ${getMethodsForTag("script", script.priority, encode)}`
|
|
536
|
-
)
|
|
537
|
-
};
|
|
538
|
-
return {
|
|
539
|
-
priorityMethods,
|
|
540
|
-
metaTags: meta.default,
|
|
541
|
-
linkTags: link.default,
|
|
542
|
-
scriptTags: script.default
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
var mapStateOnServer = (props) => {
|
|
546
|
-
const {
|
|
547
|
-
baseTag,
|
|
548
|
-
bodyAttributes,
|
|
549
|
-
encode = true,
|
|
550
|
-
htmlAttributes,
|
|
551
|
-
noscriptTags,
|
|
552
|
-
styleTags,
|
|
553
|
-
title = "",
|
|
554
|
-
titleAttributes,
|
|
555
|
-
prioritizeSeoTags
|
|
556
|
-
} = props;
|
|
557
|
-
let { linkTags, metaTags, scriptTags } = props;
|
|
558
|
-
let priorityMethods = {
|
|
559
|
-
toComponent: () => {
|
|
560
|
-
},
|
|
561
|
-
toString: () => ""
|
|
562
|
-
};
|
|
563
|
-
if (prioritizeSeoTags) {
|
|
564
|
-
({ priorityMethods, linkTags, metaTags, scriptTags } = getPriorityMethods(props));
|
|
565
|
-
}
|
|
566
|
-
return {
|
|
567
|
-
priority: priorityMethods,
|
|
568
|
-
base: getMethodsForTag("base", baseTag, encode),
|
|
569
|
-
bodyAttributes: getMethodsForTag("bodyAttributes", bodyAttributes, encode),
|
|
570
|
-
htmlAttributes: getMethodsForTag("htmlAttributes", htmlAttributes, encode),
|
|
571
|
-
link: getMethodsForTag("link", linkTags, encode),
|
|
572
|
-
meta: getMethodsForTag("meta", metaTags, encode),
|
|
573
|
-
noscript: getMethodsForTag("noscript", noscriptTags, encode),
|
|
574
|
-
script: getMethodsForTag("script", scriptTags, encode),
|
|
575
|
-
style: getMethodsForTag("style", styleTags, encode),
|
|
576
|
-
title: getMethodsForTag("title", { title, titleAttributes }, encode)
|
|
577
|
-
};
|
|
578
|
-
};
|
|
579
|
-
var server_default = mapStateOnServer;
|
|
580
|
-
var instances = [];
|
|
581
|
-
var isDocument = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
582
|
-
var HelmetData = class {
|
|
583
|
-
constructor(context, canUseDOM) {
|
|
584
|
-
__publicField(this, "instances", []);
|
|
585
|
-
__publicField(this, "canUseDOM", isDocument);
|
|
586
|
-
__publicField(this, "context");
|
|
587
|
-
__publicField(this, "value", {
|
|
588
|
-
setHelmet: (serverState) => {
|
|
589
|
-
this.context.helmet = serverState;
|
|
590
|
-
},
|
|
591
|
-
helmetInstances: {
|
|
592
|
-
get: () => this.canUseDOM ? instances : this.instances,
|
|
593
|
-
add: (instance) => {
|
|
594
|
-
(this.canUseDOM ? instances : this.instances).push(instance);
|
|
595
|
-
},
|
|
596
|
-
remove: (instance) => {
|
|
597
|
-
const index = (this.canUseDOM ? instances : this.instances).indexOf(instance);
|
|
598
|
-
(this.canUseDOM ? instances : this.instances).splice(index, 1);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
this.context = context;
|
|
603
|
-
this.canUseDOM = canUseDOM || false;
|
|
604
|
-
if (!canUseDOM) {
|
|
605
|
-
context.helmet = server_default({
|
|
606
|
-
baseTag: [],
|
|
607
|
-
bodyAttributes: {},
|
|
608
|
-
encodeSpecialCharacters: true,
|
|
609
|
-
htmlAttributes: {},
|
|
610
|
-
linkTags: [],
|
|
611
|
-
metaTags: [],
|
|
612
|
-
noscriptTags: [],
|
|
613
|
-
scriptTags: [],
|
|
614
|
-
styleTags: [],
|
|
615
|
-
title: "",
|
|
616
|
-
titleAttributes: {}
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
var defaultValue = {};
|
|
622
|
-
var Context = React__default.createContext(defaultValue);
|
|
623
|
-
var HelmetProvider = (_a = class extends Component {
|
|
624
|
-
constructor(props) {
|
|
625
|
-
super(props);
|
|
626
|
-
__publicField(this, "helmetData");
|
|
627
|
-
this.helmetData = new HelmetData(this.props.context || {}, _a.canUseDOM);
|
|
628
|
-
}
|
|
629
|
-
render() {
|
|
630
|
-
return /* @__PURE__ */ React__default.createElement(Context.Provider, { value: this.helmetData.value }, this.props.children);
|
|
631
|
-
}
|
|
632
|
-
}, __publicField(_a, "canUseDOM", isDocument), _a);
|
|
633
|
-
var updateTags = (type, tags) => {
|
|
634
|
-
const headElement = document.head || document.querySelector(
|
|
635
|
-
"head"
|
|
636
|
-
/* HEAD */
|
|
637
|
-
);
|
|
638
|
-
const tagNodes = headElement.querySelectorAll(`${type}[${HELMET_ATTRIBUTE}]`);
|
|
639
|
-
const oldTags = [].slice.call(tagNodes);
|
|
640
|
-
const newTags = [];
|
|
641
|
-
let indexToDelete;
|
|
642
|
-
if (tags && tags.length) {
|
|
643
|
-
tags.forEach((tag) => {
|
|
644
|
-
const newElement = document.createElement(type);
|
|
645
|
-
for (const attribute in tag) {
|
|
646
|
-
if (Object.prototype.hasOwnProperty.call(tag, attribute)) {
|
|
647
|
-
if (attribute === "innerHTML") {
|
|
648
|
-
newElement.innerHTML = tag.innerHTML;
|
|
649
|
-
} else if (attribute === "cssText") {
|
|
650
|
-
if (newElement.styleSheet) {
|
|
651
|
-
newElement.styleSheet.cssText = tag.cssText;
|
|
652
|
-
} else {
|
|
653
|
-
newElement.appendChild(document.createTextNode(tag.cssText));
|
|
654
|
-
}
|
|
655
|
-
} else {
|
|
656
|
-
const attr = attribute;
|
|
657
|
-
const value = typeof tag[attr] === "undefined" ? "" : tag[attr];
|
|
658
|
-
newElement.setAttribute(attribute, value);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
newElement.setAttribute(HELMET_ATTRIBUTE, "true");
|
|
663
|
-
if (oldTags.some((existingTag, index) => {
|
|
664
|
-
indexToDelete = index;
|
|
665
|
-
return newElement.isEqualNode(existingTag);
|
|
666
|
-
})) {
|
|
667
|
-
oldTags.splice(indexToDelete, 1);
|
|
668
|
-
} else {
|
|
669
|
-
newTags.push(newElement);
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
oldTags.forEach((tag) => {
|
|
674
|
-
var _a2;
|
|
675
|
-
return (_a2 = tag.parentNode) == null ? void 0 : _a2.removeChild(tag);
|
|
676
|
-
});
|
|
677
|
-
newTags.forEach((tag) => headElement.appendChild(tag));
|
|
678
|
-
return {
|
|
679
|
-
oldTags,
|
|
680
|
-
newTags
|
|
681
|
-
};
|
|
682
|
-
};
|
|
683
|
-
var updateAttributes = (tagName, attributes) => {
|
|
684
|
-
const elementTag = document.getElementsByTagName(tagName)[0];
|
|
685
|
-
if (!elementTag) {
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
const helmetAttributeString = elementTag.getAttribute(HELMET_ATTRIBUTE);
|
|
689
|
-
const helmetAttributes = helmetAttributeString ? helmetAttributeString.split(",") : [];
|
|
690
|
-
const attributesToRemove = [...helmetAttributes];
|
|
691
|
-
const attributeKeys = Object.keys(attributes);
|
|
692
|
-
for (const attribute of attributeKeys) {
|
|
693
|
-
const value = attributes[attribute] || "";
|
|
694
|
-
if (elementTag.getAttribute(attribute) !== value) {
|
|
695
|
-
elementTag.setAttribute(attribute, value);
|
|
696
|
-
}
|
|
697
|
-
if (helmetAttributes.indexOf(attribute) === -1) {
|
|
698
|
-
helmetAttributes.push(attribute);
|
|
699
|
-
}
|
|
700
|
-
const indexToSave = attributesToRemove.indexOf(attribute);
|
|
701
|
-
if (indexToSave !== -1) {
|
|
702
|
-
attributesToRemove.splice(indexToSave, 1);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
for (let i = attributesToRemove.length - 1; i >= 0; i -= 1) {
|
|
706
|
-
elementTag.removeAttribute(attributesToRemove[i]);
|
|
707
|
-
}
|
|
708
|
-
if (helmetAttributes.length === attributesToRemove.length) {
|
|
709
|
-
elementTag.removeAttribute(HELMET_ATTRIBUTE);
|
|
710
|
-
} else if (elementTag.getAttribute(HELMET_ATTRIBUTE) !== attributeKeys.join(",")) {
|
|
711
|
-
elementTag.setAttribute(HELMET_ATTRIBUTE, attributeKeys.join(","));
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
var updateTitle = (title, attributes) => {
|
|
715
|
-
if (typeof title !== "undefined" && document.title !== title) {
|
|
716
|
-
document.title = flattenArray(title);
|
|
717
|
-
}
|
|
718
|
-
updateAttributes("title", attributes);
|
|
719
|
-
};
|
|
720
|
-
var commitTagChanges = (newState, cb) => {
|
|
721
|
-
const {
|
|
722
|
-
baseTag,
|
|
723
|
-
bodyAttributes,
|
|
724
|
-
htmlAttributes,
|
|
725
|
-
linkTags,
|
|
726
|
-
metaTags,
|
|
727
|
-
noscriptTags,
|
|
728
|
-
onChangeClientState,
|
|
729
|
-
scriptTags,
|
|
730
|
-
styleTags,
|
|
731
|
-
title,
|
|
732
|
-
titleAttributes
|
|
733
|
-
} = newState;
|
|
734
|
-
updateAttributes("body", bodyAttributes);
|
|
735
|
-
updateAttributes("html", htmlAttributes);
|
|
736
|
-
updateTitle(title, titleAttributes);
|
|
737
|
-
const tagUpdates = {
|
|
738
|
-
baseTag: updateTags("base", baseTag),
|
|
739
|
-
linkTags: updateTags("link", linkTags),
|
|
740
|
-
metaTags: updateTags("meta", metaTags),
|
|
741
|
-
noscriptTags: updateTags("noscript", noscriptTags),
|
|
742
|
-
scriptTags: updateTags("script", scriptTags),
|
|
743
|
-
styleTags: updateTags("style", styleTags)
|
|
744
|
-
};
|
|
745
|
-
const addedTags = {};
|
|
746
|
-
const removedTags = {};
|
|
747
|
-
Object.keys(tagUpdates).forEach((tagType) => {
|
|
748
|
-
const { newTags, oldTags } = tagUpdates[tagType];
|
|
749
|
-
if (newTags.length) {
|
|
750
|
-
addedTags[tagType] = newTags;
|
|
751
|
-
}
|
|
752
|
-
if (oldTags.length) {
|
|
753
|
-
removedTags[tagType] = tagUpdates[tagType].oldTags;
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
if (cb) {
|
|
757
|
-
cb();
|
|
758
|
-
}
|
|
759
|
-
onChangeClientState(newState, addedTags, removedTags);
|
|
760
|
-
};
|
|
761
|
-
var _helmetCallback = null;
|
|
762
|
-
var handleStateChangeOnClient = (newState) => {
|
|
763
|
-
if (_helmetCallback) {
|
|
764
|
-
cancelAnimationFrame(_helmetCallback);
|
|
765
|
-
}
|
|
766
|
-
if (newState.defer) {
|
|
767
|
-
_helmetCallback = requestAnimationFrame(() => {
|
|
768
|
-
commitTagChanges(newState, () => {
|
|
769
|
-
_helmetCallback = null;
|
|
770
|
-
});
|
|
771
|
-
});
|
|
772
|
-
} else {
|
|
773
|
-
commitTagChanges(newState);
|
|
774
|
-
_helmetCallback = null;
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
var client_default = handleStateChangeOnClient;
|
|
778
|
-
var HelmetDispatcher = class extends Component {
|
|
779
|
-
constructor() {
|
|
780
|
-
super(...arguments);
|
|
781
|
-
__publicField(this, "rendered", false);
|
|
782
|
-
}
|
|
783
|
-
shouldComponentUpdate(nextProps) {
|
|
784
|
-
return !shallowEqual2(nextProps, this.props);
|
|
785
|
-
}
|
|
786
|
-
componentDidUpdate() {
|
|
787
|
-
this.emitChange();
|
|
788
|
-
}
|
|
789
|
-
componentWillUnmount() {
|
|
790
|
-
const { helmetInstances } = this.props.context;
|
|
791
|
-
helmetInstances.remove(this);
|
|
792
|
-
this.emitChange();
|
|
793
|
-
}
|
|
794
|
-
emitChange() {
|
|
795
|
-
const { helmetInstances, setHelmet } = this.props.context;
|
|
796
|
-
let serverState = null;
|
|
797
|
-
const state = reducePropsToState(
|
|
798
|
-
helmetInstances.get().map((instance) => {
|
|
799
|
-
const props = { ...instance.props };
|
|
800
|
-
delete props.context;
|
|
801
|
-
return props;
|
|
802
|
-
})
|
|
803
|
-
);
|
|
804
|
-
if (HelmetProvider.canUseDOM) {
|
|
805
|
-
client_default(state);
|
|
806
|
-
} else if (server_default) {
|
|
807
|
-
serverState = server_default(state);
|
|
808
|
-
}
|
|
809
|
-
setHelmet(serverState);
|
|
810
|
-
}
|
|
811
|
-
// componentWillMount will be deprecated
|
|
812
|
-
// for SSR, initialize on first render
|
|
813
|
-
// constructor is also unsafe in StrictMode
|
|
814
|
-
init() {
|
|
815
|
-
if (this.rendered) {
|
|
816
|
-
return;
|
|
817
|
-
}
|
|
818
|
-
this.rendered = true;
|
|
819
|
-
const { helmetInstances } = this.props.context;
|
|
820
|
-
helmetInstances.add(this);
|
|
821
|
-
this.emitChange();
|
|
822
|
-
}
|
|
823
|
-
render() {
|
|
824
|
-
this.init();
|
|
825
|
-
return null;
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
var Helmet = (_b = class extends Component {
|
|
829
|
-
shouldComponentUpdate(nextProps) {
|
|
830
|
-
return !fastCompare(without(this.props, "helmetData"), without(nextProps, "helmetData"));
|
|
831
|
-
}
|
|
832
|
-
mapNestedChildrenToProps(child, nestedChildren) {
|
|
833
|
-
if (!nestedChildren) {
|
|
834
|
-
return null;
|
|
835
|
-
}
|
|
836
|
-
switch (child.type) {
|
|
837
|
-
case "script":
|
|
838
|
-
case "noscript":
|
|
839
|
-
return {
|
|
840
|
-
innerHTML: nestedChildren
|
|
841
|
-
};
|
|
842
|
-
case "style":
|
|
843
|
-
return {
|
|
844
|
-
cssText: nestedChildren
|
|
845
|
-
};
|
|
846
|
-
default:
|
|
847
|
-
throw new Error(
|
|
848
|
-
`<${child.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`
|
|
849
|
-
);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
flattenArrayTypeChildren(child, arrayTypeChildren, newChildProps, nestedChildren) {
|
|
853
|
-
return {
|
|
854
|
-
...arrayTypeChildren,
|
|
855
|
-
[child.type]: [
|
|
856
|
-
...arrayTypeChildren[child.type] || [],
|
|
857
|
-
{
|
|
858
|
-
...newChildProps,
|
|
859
|
-
...this.mapNestedChildrenToProps(child, nestedChildren)
|
|
860
|
-
}
|
|
861
|
-
]
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
mapObjectTypeChildren(child, newProps, newChildProps, nestedChildren) {
|
|
865
|
-
switch (child.type) {
|
|
866
|
-
case "title":
|
|
867
|
-
return {
|
|
868
|
-
...newProps,
|
|
869
|
-
[child.type]: nestedChildren,
|
|
870
|
-
titleAttributes: { ...newChildProps }
|
|
871
|
-
};
|
|
872
|
-
case "body":
|
|
873
|
-
return {
|
|
874
|
-
...newProps,
|
|
875
|
-
bodyAttributes: { ...newChildProps }
|
|
876
|
-
};
|
|
877
|
-
case "html":
|
|
878
|
-
return {
|
|
879
|
-
...newProps,
|
|
880
|
-
htmlAttributes: { ...newChildProps }
|
|
881
|
-
};
|
|
882
|
-
default:
|
|
883
|
-
return {
|
|
884
|
-
...newProps,
|
|
885
|
-
[child.type]: { ...newChildProps }
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
mapArrayTypeChildrenToProps(arrayTypeChildren, newProps) {
|
|
890
|
-
let newFlattenedProps = { ...newProps };
|
|
891
|
-
Object.keys(arrayTypeChildren).forEach((arrayChildName) => {
|
|
892
|
-
newFlattenedProps = {
|
|
893
|
-
...newFlattenedProps,
|
|
894
|
-
[arrayChildName]: arrayTypeChildren[arrayChildName]
|
|
895
|
-
};
|
|
896
|
-
});
|
|
897
|
-
return newFlattenedProps;
|
|
898
|
-
}
|
|
899
|
-
warnOnInvalidChildren(child, nestedChildren) {
|
|
900
|
-
invariant$1(
|
|
901
|
-
VALID_TAG_NAMES.some((name) => child.type === name),
|
|
902
|
-
typeof child.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 ${VALID_TAG_NAMES.join(
|
|
903
|
-
", "
|
|
904
|
-
)} are allowed. Helmet does not support rendering <${child.type}> elements. Refer to our API for more information.`
|
|
905
|
-
);
|
|
906
|
-
invariant$1(
|
|
907
|
-
!nestedChildren || typeof nestedChildren === "string" || Array.isArray(nestedChildren) && !nestedChildren.some((nestedChild) => typeof nestedChild !== "string"),
|
|
908
|
-
`Helmet expects a string as a child of <${child.type}>. Did you forget to wrap your children in braces? ( <${child.type}>{\`\`}</${child.type}> ) Refer to our API for more information.`
|
|
909
|
-
);
|
|
910
|
-
return true;
|
|
911
|
-
}
|
|
912
|
-
mapChildrenToProps(children, newProps) {
|
|
913
|
-
let arrayTypeChildren = {};
|
|
914
|
-
React__default.Children.forEach(children, (child) => {
|
|
915
|
-
if (!child || !child.props) {
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
const { children: nestedChildren, ...childProps } = child.props;
|
|
919
|
-
const newChildProps = Object.keys(childProps).reduce((obj, key) => {
|
|
920
|
-
obj[HTML_TAG_MAP[key] || key] = childProps[key];
|
|
921
|
-
return obj;
|
|
922
|
-
}, {});
|
|
923
|
-
let { type } = child;
|
|
924
|
-
if (typeof type === "symbol") {
|
|
925
|
-
type = type.toString();
|
|
926
|
-
} else {
|
|
927
|
-
this.warnOnInvalidChildren(child, nestedChildren);
|
|
928
|
-
}
|
|
929
|
-
switch (type) {
|
|
930
|
-
case "Symbol(react.fragment)":
|
|
931
|
-
newProps = this.mapChildrenToProps(nestedChildren, newProps);
|
|
932
|
-
break;
|
|
933
|
-
case "link":
|
|
934
|
-
case "meta":
|
|
935
|
-
case "noscript":
|
|
936
|
-
case "script":
|
|
937
|
-
case "style":
|
|
938
|
-
arrayTypeChildren = this.flattenArrayTypeChildren(
|
|
939
|
-
child,
|
|
940
|
-
arrayTypeChildren,
|
|
941
|
-
newChildProps,
|
|
942
|
-
nestedChildren
|
|
943
|
-
);
|
|
944
|
-
break;
|
|
945
|
-
default:
|
|
946
|
-
newProps = this.mapObjectTypeChildren(child, newProps, newChildProps, nestedChildren);
|
|
947
|
-
break;
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
return this.mapArrayTypeChildrenToProps(arrayTypeChildren, newProps);
|
|
951
|
-
}
|
|
952
|
-
render() {
|
|
953
|
-
const { children, ...props } = this.props;
|
|
954
|
-
let newProps = { ...props };
|
|
955
|
-
let { helmetData } = props;
|
|
956
|
-
if (children) {
|
|
957
|
-
newProps = this.mapChildrenToProps(children, newProps);
|
|
958
|
-
}
|
|
959
|
-
if (helmetData && !(helmetData instanceof HelmetData)) {
|
|
960
|
-
const data = helmetData;
|
|
961
|
-
helmetData = new HelmetData(data.context, true);
|
|
962
|
-
delete newProps.helmetData;
|
|
963
|
-
}
|
|
964
|
-
return helmetData ? /* @__PURE__ */ React__default.createElement(HelmetDispatcher, { ...newProps, context: helmetData.value }) : /* @__PURE__ */ React__default.createElement(Context.Consumer, null, (context) => /* @__PURE__ */ React__default.createElement(HelmetDispatcher, { ...newProps, context }));
|
|
965
|
-
}
|
|
966
|
-
}, __publicField(_b, "defaultProps", {
|
|
967
|
-
defer: true,
|
|
968
|
-
encodeSpecialCharacters: true,
|
|
969
|
-
prioritizeSeoTags: false
|
|
970
|
-
}), _b);
|
|
971
|
-
const AnchorLink = (props) => {
|
|
972
|
-
const location = useLocation();
|
|
973
|
-
const hash = typeof props.to === "string" ? props.to : props.to.hash;
|
|
974
|
-
const handleClick = (event) => {
|
|
975
|
-
var _a2;
|
|
976
|
-
if (!(hash == null ? void 0 : hash.startsWith("#")) || hash !== location.hash) return;
|
|
977
|
-
event.preventDefault();
|
|
978
|
-
(_a2 = document.getElementById(hash.slice(1))) == null ? void 0 : _a2.scrollIntoView();
|
|
979
|
-
};
|
|
980
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { onClick: handleClick, ...props });
|
|
981
|
-
};
|
|
982
|
-
export {
|
|
983
|
-
AnchorLink as A,
|
|
984
|
-
HelmetProvider as H,
|
|
985
|
-
MDXProvider as M,
|
|
986
|
-
Helmet as a,
|
|
987
|
-
useMDXComponents as u
|
|
988
|
-
};
|
|
989
|
-
//# sourceMappingURL=AnchorLink-BaXHjhF-.js.map
|